DS7_JinGang
hanxuntao 2 years ago
commit 64f422bc2d

@ -2076,7 +2076,13 @@ namespace DSWeb.Common.DB
public string GOODSMODEL { get; set; }
public string GOODSSTANDARD { get; set; }
public string GOODSPACK { get; set; }
/// <summary>
/// 计费单位 吨/千克/CBM/箱/件
/// </summary>
public string CHARGEUNIT { get; set; }
/// <summary>
/// 出库量
/// </summary>
public decimal? GOODSPFSL { get; set; }
public decimal? GOODSOUTFEE { get; set; }
public string TRUCKNO { get; set; }
@ -2084,6 +2090,9 @@ namespace DSWeb.Common.DB
public DateTime? CREATETIME { get; set; }
public string REMARK { get; set; }
public string ASSOCIATEDNO { get; set; }
/// <summary>
/// 出库件数
/// </summary>
public decimal? GOODSPACKPFSL { get; set; }
public decimal? ARFEE { get; set; }
public decimal? APFEE { get; set; }

@ -22,6 +22,8 @@ namespace DSWeb.Common.DB
public DbSet<view_hrmresource_md> view_hrmresource { get; set; }
public DbSet<view_pjrequestbas_md> view_pjrequestbas { get; set; }
public DbSet<view_xdf_md> view_xdf { get; set; }
}

@ -19,7 +19,8 @@ namespace DSWeb.Common.DB
public int id { get; set; }
public string loginid { get; set; }
public string lastname { get; set; }
public int departmentid { get; set; }
public int subcompanyid1 { get; set; }
}
/// <summary>
@ -39,4 +40,28 @@ namespace DSWeb.Common.DB
public string lastoperatetime { get; set; }
public string currentnodetype { get; set; }
}
[Table("view_xdf")]
public class view_xdf_md
{
[Key]
public int id { get; set; }
public int? requestId { get; set; }
public string yxzhmc { get; set; }
public string khx { get; set; }
public string yxzh { get; set; }
public string gyskhmc { get; set; }
public int? formmodeid { get; set; }
public int? modedatacreater { get; set; }
public int? modedatacreatertype { get; set; }
public string modedatacreatedate { get; set; }
public string modedatacreatetime { get; set; }
public int? modedatamodifier { get; set; }
public string modedatamodifydatetime { get; set; }
public string form_biz_id { get; set; }
public string MODEUUID { get; set; }
public string kjry { get; set; }
}
}

@ -48,6 +48,7 @@ namespace DSWeb.Service.Output
var idList = List.Select(s => s.PAYAPPID).ToList();
//从dc1中寻找这些id的业务的审核结果
var List = dc1.view_pjrequestbas.Where(x => x.workflowid == 79 && x.currentnodetype == "3" && idList.Contains(x.requestid.ToString())).ToList();

@ -2459,7 +2459,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication
}
else
{
var requestid = result.Data.ToString();
var requestid = _r.Data.ToString();
var cmdupdate = db.GetSqlStringCommand("update ch_fee_payapplication set PAYAPPID='" + requestid + "' where BILLNO=@BILLNO");
cmdupdate.Parameters.Clear();

@ -1068,45 +1068,50 @@ namespace DSWeb.Areas.CommMng.DAL
public List<Field> fieldValue { get; set; }
}
public static ArrayList GetMainData(ChPayapplication headdata, string userid, string username, string compoanyid) {
public static ArrayList GetMainData(ChPayapplication headdata, string userid,int deptid, view_xdf_md fkdx) {
var result = new ArrayList();
result.add(new Field("sqr", headdata.APPLICANTNAME));
result.add(new Field("sqbm", headdata.APPLICANTDEPT));
var applytimestr = headdata.APPLYTIME == null ? "" : ((DateTime)(headdata.APPLYTIME)).ToString("yyyy-MM-dd HH:mm:ss");
result.add(new Field("lcbh", headdata.BILLNO));
result.add(new Field("bz", headdata.REMARK));
result.add(new Field("fkdx", headdata.CUSTOMERNAME));
result.add(new Field("sqr", userid));//申请人 改用ID
result.add(new Field("sqbm", deptid.ToString()));//申请部门 改用申请人部门ID
var applytimestr = headdata.APPLYTIME == null ? DateTime.Now.ToString("yyyy-MM-dd") : ((DateTime)(headdata.APPLYTIME)).ToString("yyyy-MM-dd");
result.add(new Field("sqrq", applytimestr));//申请日期
var yxzh = "";
var khx = "";
var cdc = new CommonDataContext();
if (!string.IsNullOrWhiteSpace(headdata.CUSTACCOUNTGID)) {
var custbank = cdc.info_client_bank.FirstOrDefault(x => x.GID == headdata.CUSTACCOUNTGID);
result.add(new Field("lcbh", headdata.BILLNO));//流程编号 用付费申请单号
result.add(new Field("bz", headdata.REMARK));//备注
yxzh = custbank.ACCOUNT;
khx = custbank.BANKNAME;
result.add(new Field("fkdx", fkdx.id.ToString()));//headdata.CUSTOMERNAME 付款对象 需使用泛微的一个ID号
}
var cdc = new CommonDataContext();
result.add(new Field("yxzh", yxzh));
result.add(new Field("khx", khx));
result.add(new Field("wtdw", headdata.BS_CUSTOMERNAME));
//var yxzh = "";
//var khx = "";
//if (!string.IsNullOrWhiteSpace(headdata.CUSTACCOUNTGID)) {
// var custbank = cdc.info_client_bank.FirstOrDefault(x => x.GID == headdata.CUSTACCOUNTGID);
// yxzh = custbank.ACCOUNT;
// khx = custbank.BANKNAME;
//}
result.add(new Field("yxzh", fkdx.yxzh));//银行账号
result.add(new Field("khx", fkdx.khx));//开户行
result.add(new Field("wtdw", headdata.BS_CUSTOMERNAME));//委托单位 文本
result.add(new Field("jehj", Math.Round(headdata.AMOUNTRMB,2)));
result.add(new Field("jehjdx", Math.Round(headdata.AMOUNTRMB,2)));
result.add(new Field("jehj", Math.Round(headdata.AMOUNTRMB,2)));//金额合计
result.add(new Field("jehjdx", Math.Round(headdata.AMOUNTRMB,2)));//金额合计大写
//result.add(new Field("jehjdx", BasicDataRefDAL.ConvertToChineseMoney2( (double)headdata.AMOUNTRMB)));
result.add(new Field("jehjmj", Math.Round(headdata.AMOUNTUSD,2)));
result.add(new Field("jehjdxmj", Math.Round(headdata.AMOUNTUSD,2)));
result.add(new Field("jehjmj", Math.Round(headdata.AMOUNTUSD,2)));//金额合计美金
result.add(new Field("jehjdxmj", Math.Round(headdata.AMOUNTUSD,2)));//金额合计大写美金
//result.add(new Field("jehjmjdx", BasicDataRefDAL.ConvertToChineseMoney2((double)headdata.AMOUNTUSD)));
var bodymblnolist = cdc.ch_fee_do.Where(x=>x.BILLNO ==headdata.BILLNO).Select(s=>s.MBLNO).Distinct().ToList();
var bsnolist = cdc.ch_fee_do.Where(x=>x.BILLNO ==headdata.BILLNO).Select(s=>s.BSNO).Distinct().ToList();
var vopbsMblnoList = cdc.v_op_bs.Where(x => bsnolist.Contains(x.BSNO)).Select(s => s.MBLNO).Distinct().ToList();
var bodymblnostr = "";
if (bodymblnolist != null && bodymblnolist.Count > 0) {
bodymblnostr = string.Join(" , ", bodymblnolist);
if (vopbsMblnoList != null && vopbsMblnoList.Count > 0) {
bodymblnostr = string.Join(" , ", vopbsMblnoList);
}
result.add(new Field("tdh", bodymblnostr));
result.add(new Field("tdh", bodymblnostr));//提单号 依据付款申请的ch_fee_do的bsno关联v_op_bs的MBLNO
return result;
}
@ -1224,12 +1229,14 @@ namespace DSWeb.Areas.CommMng.DAL
var FanWeidc = new OtherDB(fanweiconnstr);
var fwuser = FanWeidc.view_hrmresource.Where(x => x.lastname == _user.SHOWNAME).ToList();
var oaname = _user.SHOWNAME.Trim().Replace(" ", "");
var fwuser = FanWeidc.view_hrmresource.Where(x => x.lastname == oaname).ToList();
if (fwuser == null || fwuser.Count <= 0)
{
result.SetErrorInfo($"用户[{_user.SHOWNAME}]在OA系统中不存在");
result.SetErrorInfo($"用户[{oaname}]在OA系统中不存在");
return result;
}
else
@ -1249,7 +1256,17 @@ namespace DSWeb.Areas.CommMng.DAL
{ "userid", _userid_m }
};
var maindata = GetMainData(headdata, userid, username, companyid);
var = cdc.info_client.First(x => x.SHORTNAME == headdata.CUSTOMERNAME);
var fxdxlist = FanWeidc.view_xdf.Where(x => x.gyskhmc == .DESCRIPTION).ToList();
if (fxdxlist == null || fxdxlist.Count <= 0)
{
result.SetErrorInfo($"客户[{付费申请付款对象.DESCRIPTION}]在OA系统中不存在");
return result;
}
var fxdx = fxdxlist[0];
var maindata = GetMainData(headdata, _userid, fwuser[0].departmentid, fxdx);
var detaildata = GetDetailData(headdata);
@ -1274,15 +1291,27 @@ namespace DSWeb.Areas.CommMng.DAL
};
//var jsonstr=JsonConvert.Serialize(sendobj).Replace("\r\n","");
BasicDataRefDAL.SaveLog("url:" + Url + "dic" + JsonConvert.Serialize(dic) + "valuedic" + JsonConvert.Serialize(valuedic)
,"","泛微OA","发送"
);
var rtn = WebRequestHelper.DoPost_Header(Url, dic, valuedic);
BasicDataRefDAL.SaveLog(rtn , "", "泛微OA", "返回" );
try {
_res = JsonConvert.Deserialize<SuccessResponse>(rtn);
if (_res.code.Contains("ERROR")) {
var bottom= Regex.Replace(_res.reqFailMsg.msgInfo.bottom, @"\<[^\<]*\>", "");
var detail = Regex.Replace(_res.reqFailMsg.msgInfo.detail, @"\<[^\<]*\>", "");
result.SetErrorInfo(JsonConvert.Serialize( _res.reqFailMsg.msgInfo.title+":" + bottom + "\r\n\r\n" + detail));
}
else
{
result.Data = _res.data.requestid;
result.OK("发送成功");
}
//要记录requestid
@ -1370,6 +1399,11 @@ namespace DSWeb.Areas.CommMng.DAL
public class MsgInfo
{
public string prompttype { get; set; }
public string bottom { get; set; }
public string detail { get; set; }
public string title { get; set; }
}
public class OtherParams

@ -742,7 +742,6 @@ namespace DSWeb.MvcShipping.Controllers
return new ContentResult() { Content = json };
}
public ContentResult modify(string data, string modifydata)
{
var bodyList = JsonConvert.Deserialize<List<WMSNewList>>(data);

@ -948,7 +948,7 @@ namespace DSWeb.MvcShipping.Controllers
}
#endregion
#region 费用入账
#region 出库费用入账
public ContentResult setislock(string sOUTGID,bool EIP,string outType)
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")

@ -145,9 +145,7 @@ namespace DSWeb.MvcShipping.DAL.MsRptZjTotalDAL
strSql.Append(",B.USDPROFIT,B.RMBPROFIT,B.OTPROFIT,B.TTLPROFIT,B.PROFITRATE,B.TAXPROFIT,B.RMBNODR,B.USDNODR,B.OTNODR,B.TTLNODR,B.RMBNOCR,B.USDNOCR,B.OTNOCR,B.TTLNOCR ");
strSql.Append(",T.SETTLETIME,T.STLTTLDR MONTHSTLTTLDR");//,f.ISFEE
//该客户的 Info_Client_ACCDATE.BGNDATE (生效日期) 减 每票货的开船日期得出是否超过一年以内
//一年以内则提成30% 一年之外为15%
//此处ACTUALDAY为ETD-帐期生效日期。大于1年则ACTUALDAY小于-365
strSql.Append(",DATEDIFF([day],b.ETD,(select min(bgndate) from Info_Client_ACCDATE where LINKGID=(select gid from Info_Client where SHORTNAME=b.CUSTOMERNAME)))+1 ACTUALDAY");
strSql.Append(",DATEDIFF([day],ISNULL(T.SETTLETIME,GETDATE()),(select min(bgndate) from Info_Client_ACCDATE where LINKGID=(select gid from Info_Client where SHORTNAME=b.CUSTOMERNAME))) NODAY");
@ -377,11 +375,11 @@ namespace DSWeb.MvcShipping.DAL.MsRptZjTotalDAL
/// 向数据中加入资金占用的费用
/// </summary>
/// <param name="headList">用于参数和返回的数据集</param>
/// <param name="days">资金开始计算利息的天数默认90</param>
/// <param name="days">资金开始计算利息的天数默认90 20230117 改为120天</param>
/// <param name="feerate">资金利率 默认12%</param>
/// <param name="days2">资金开始计算利息的天数改为90</param>
/// <param name="feerate2">资金利率 日利率改为万分之3</param>
public static void GetZJFee(ref List<MsOpBillProfit> headList,int days=90,decimal feerate=0.12M) {
public static void GetZJFee(ref List<MsOpBillProfit> headList,int days=120,decimal feerate=0.12M) {
var cdc = new CommonDataContext();
var bsnolist = headList.Select(s => s.BSNO).Distinct().ToList();

@ -20,6 +20,8 @@ using Ivony.Html;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using Ivony.Fluent;
using DSWeb.MvcShipping.DAL.WMSStock;
using System.Configuration;
using DSWeb.Areas.MvcShipping.Helper;
namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
{
@ -1879,7 +1881,7 @@ namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
}
#endregion
#region 费用入账//需求编号SR2017073000001
#region 出库费用入账//需求编号SR2017073000001
public static DBResult setislock(string gids,bool bEIP, string outType,string strUserID, string strCompanyID, string strDEPTNAME, string strSHOWNAME)
{
DBResult result = new DBResult();
@ -1906,6 +1908,7 @@ namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
strSql.Append(" from wms_out o inner join wms_out_detail d on o.bsno = d.outbsno ");
strSql.Append(" where o.gid in (" + gids + ") and o.ISLOCK=0");
var List = new List<string>();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
@ -1939,7 +1942,7 @@ namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
{
sSQL =
"insert into ch_fee(GID,BSNO,FEETYPE,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,AMOUNT,EXCHANGERATE,CURRENCY,COMMISSIONRATE,FEEFRT,REMARK,ISADVANCEDPAY,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO,LINENUM,[TAXRATE],[NOTAXAMOUNT],[TAX],[ORDERSETTLEMENT],[TAXUNITPRICE],[ORDERINVSETTLEMENT],MODIFIEDUSER,MODIFIEDTIME,CARGO_GID) "
+ " values(newid() ,'" + outFee.BSNO + "',1,'仓储费','" + outFee.ARCLIENTWMSOUT + "','单票','" + outFee.GOODSOUTFEE_OUT + "',1,'" + outFee.GOODSOUTFEE_OUT + "',1,'RMB',0,'PP','“出库明细单'+'" + outFee.OUTNO + "'+'”中的仓储费',0,'" + strUserID +"',getdate(),1,'" + outFee.OUTGID + "',0,0,'" + outFee.GOODSOUTFEE_OUT + "',0,0,'" + outFee.GOODSOUTFEE_OUT + "',0,'" + strUserID + "', getdate(),'"+ outFee.OUTDEGID + "')";
+ " values(newid() ,'" + outFee.BSNO + "',1,'仓储费','" + outFee.ARCLIENTWMSOUT + "','单票','" + outFee.GOODSOUTFEE_OUT + "',1,'" + outFee.GOODSOUTFEE_OUT + "',1,'RMB',0,'PP','“出库明细单'+'" + outFee.OUTNO + "'+'”中的仓储费',0,'" + strUserID + "',getdate(),1,'" + outFee.OUTGID + "',0,0,'" + outFee.GOODSOUTFEE_OUT + "',0,0,'" + outFee.GOODSOUTFEE_OUT + "',0,'" + strUserID + "', getdate(),'" + outFee.OUTDEGID + "')";
existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, sSQL, null);
@ -1952,7 +1955,7 @@ namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
if (outFee.GOODSOUTFEEAP_OUT > 0)
{
sSQL = "insert into ch_fee(GID,BSNO,FEETYPE,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,AMOUNT,EXCHANGERATE,CURRENCY,COMMISSIONRATE,FEEFRT,REMARK,ISADVANCEDPAY,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO,LINENUM,[TAXRATE],[NOTAXAMOUNT],[TAX],[ORDERSETTLEMENT],[TAXUNITPRICE],[ORDERINVSETTLEMENT],MODIFIEDUSER,MODIFIEDTIME,CARGO_GID) "
+ " values(newid() ,'" + outFee.BSNO + "',2,'仓储费','" + outFee.TRUCKNAME_OUT + "','单票','" + outFee.GOODSOUTFEEAP_OUT + "',1,'" + outFee.GOODSOUTFEEAP_OUT + "',1,'RMB',0,'PP','“出库明细单'+'" + outFee.OUTNO + "'+'”中的仓储费',0,'" + strUserID +"',getdate(),1,'" + outFee.OUTGID + "',0,0,'" + outFee.GOODSOUTFEEAP_OUT + "',0,0,'" + outFee.GOODSOUTFEEAP_OUT + "',0,'" + strUserID + "', getdate(),'" + outFee.OUTDEGID + "')";
+ " values(newid() ,'" + outFee.BSNO + "',2,'仓储费','" + outFee.TRUCKNAME_OUT + "','单票','" + outFee.GOODSOUTFEEAP_OUT + "',1,'" + outFee.GOODSOUTFEEAP_OUT + "',1,'RMB',0,'PP','“出库明细单'+'" + outFee.OUTNO + "'+'”中的仓储费',0,'" + strUserID + "',getdate(),1,'" + outFee.OUTGID + "',0,0,'" + outFee.GOODSOUTFEEAP_OUT + "',0,0,'" + outFee.GOODSOUTFEEAP_OUT + "',0,'" + strUserID + "', getdate(),'" + outFee.OUTDEGID + "')";
existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, sSQL, null);
}
@ -1978,15 +1981,16 @@ namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
if (outFee.ARFEE_2_OUT > 0)
{
sSQL = "insert into ch_fee(GID,BSNO,FEETYPE,FEENAME,CUSTOMERNAME,UNIT,UNITPRICE,QUANTITY,AMOUNT,EXCHANGERATE,CURRENCY,COMMISSIONRATE,FEEFRT,REMARK,ISADVANCEDPAY,ENTEROPERATOR,ENTERDATE,FEESTATUS,WMSOUTBSNO,LINENUM,[TAXRATE],[NOTAXAMOUNT],[TAX],[ORDERSETTLEMENT],[TAXUNITPRICE],[ORDERINVSETTLEMENT],MODIFIEDUSER,MODIFIEDTIME) "
+ " values(newid() ,'" + outFee.BSNO + "',1,'过磅费','" + outFee.ARCLIENTWMSOUT + "','单票','" + outFee.ARFEE_2_OUT + "',1,'" + outFee.ARFEE_2_OUT + "',1,'RMB',0,'PP','“出库明细单'+'" + outFee.OUTNO + "'+'”中的过磅费',0,'" + strUserID +"',getdate(),1,'" + outFee.OUTGID + "',0,0,'" + outFee.ARFEE_2_OUT + "',0,0,'" + outFee.ARFEE_2_OUT + "',0,'" + strUserID + "', getdate())";
+ " values(newid() ,'" + outFee.BSNO + "',1,'过磅费','" + outFee.ARCLIENTWMSOUT + "','单票','" + outFee.ARFEE_2_OUT + "',1,'" + outFee.ARFEE_2_OUT + "',1,'RMB',0,'PP','“出库明细单'+'" + outFee.OUTNO + "'+'”中的过磅费',0,'" + strUserID + "',getdate(),1,'" + outFee.OUTGID + "',0,0,'" + outFee.ARFEE_2_OUT + "',0,0,'" + outFee.ARFEE_2_OUT + "',0,'" + strUserID + "', getdate())";
existVal = SqlHelper.ExecuteNonQuery(sqlTran, CommandType.Text, sSQL, null);
}
#endregion
if (!List.Exists(x => x == outFee.OUTNO)) {
List.Add(outFee.OUTNO);
}
}
@ -2019,9 +2023,26 @@ namespace DSWeb.MvcShipping.DAL.WMSOUT_GuiGeDAL
#endregion
}
if (ConfigurationManager.AppSettings["DingTalkAuditWMSIN"] == "true" )
{//向钉钉发送出库审批流程
var _r0 = new DBResult();
_r0.OK();
//如果是费用入账动作 且配置了钉钉审批入库 则调用向钉钉发送新建审批实例方法
foreach (var outbsno in List) {
var _r = DingTalkHelper.Send_WMSOUT(strUserID, outbsno);
if (!_r.Success) {
_r0.SetErrorInfo(_r.Message);
}
}
//仅用于测试解析读取钉钉审批实例内容
//result = TestReadDingtalkInstanceinfo();
if (!_r0.Success) {
result.Success = false;
result.Message = "发送钉钉审批失败:"+_r0.Message;
}
}
}
catch (Exception)
{

@ -30,6 +30,7 @@ using Newtonsoft.Json.Linq;
using sun.tools.jar.resources;
using System.Data.Entity.Migrations;
using AlibabaCloud.SDK.Dingtalkworkflow_1_0.Models;
using NPOI.SS.Formula.Functions;
namespace DSWeb.Areas.MvcShipping.Helper
{
@ -139,7 +140,7 @@ namespace DSWeb.Areas.MvcShipping.Helper
{
var result = new DBResult();
DingTalk_SendAuditWork dh = new DingTalk_SendAuditWork(uid);
DingTalk_WmsInAudit dh = new DingTalk_WmsInAudit(uid);
if (dh.cansend(wmsno))
{
@ -166,6 +167,36 @@ namespace DSWeb.Areas.MvcShipping.Helper
return result;
}
public static DBResult Send_WMSOUT(string uid, string BSNO)
{
var result = new DBResult();
DingTalk_WmsOutAudit dh = new DingTalk_WmsOutAudit(uid);
if (dh.cansend(BSNO))
{
result = dh.MakeSendMessage(BSNO);
if (!result.Success)
{
return result;
}
result = dh.DoSend();
if (result.Success)
{
}
}
else
{
result.SetErrorInfo("该业务已发送");
}
return result;
}
}
@ -238,7 +269,9 @@ namespace DSWeb.Areas.MvcShipping.Helper
if (jsonObj != null)
{
BasicDataRefDAL.SaveLog("url:" + url+ "header:" +JsonConvert.SerializeObject(HeaderDic)+" body:"+ JsonConvert.SerializeObject(jsonObj),"","钉钉审核","发出");
resp=WebRequestHelper.DoPost_Header(url, HeaderDic, jsonObj);
BasicDataRefDAL.SaveLog(resp, "", "钉钉审核", "返回");
}
else {
resp=WebRequestHelper.DoPost_Header(url, HeaderDic);
@ -313,9 +346,11 @@ namespace DSWeb.Areas.MvcShipping.Helper
public class DingTalk_SendAuditWork : DingTalkSendHelper
{
public string BSNO { get; set; }
public DingTalk_SendAuditWork()
{
}
public DingTalk_SendAuditWork(string uid)
{
this.uid = uid;
getUser();
}
@ -366,7 +401,63 @@ namespace DSWeb.Areas.MvcShipping.Helper
return true;
}
public DBResult MakeSendMessage(string wmsno)
public virtual DBResult MakeSendMessage(string wmsno)
{
var result = new DBResult();
return result;
}
public class DingTalk_SendAuditResult {
public string instanceId { get; set; }
}
public DBResult DoSend() {
var result = base.DoSend_Header();
if (result.Success) {
try
{
var jo = new DingTalk_SendAuditResult();
jo = (DingTalk_SendAuditResult)JsonToObject(result.Data.ToString(), jo);
var dic = new Dictionary<string, string>();
dic.Add("instanceId", jo.instanceId);
BasicDataRefDAL.SaveLogicInfo(BSNO, "钉钉审批", dic);
}catch(Exception ex)
{
}
}
return result;
}
}
public class DingTalk_WmsInAudit : DingTalk_SendAuditWork
{
public DingTalk_WmsInAudit(string uid)
{
this.uid = uid;
getUser();
}
//public bool cansend(string GID)
//{
// //看是否已发过
// var logiclog = BasicDataRefDAL.GetLogicInfo(GID, "钉钉审批");
// if (logiclog.Count > 0)
// {
// return false;
// }
// return true;
//}
public override DBResult MakeSendMessage(string wmsno)
{
var result = new DBResult();
@ -394,8 +485,8 @@ namespace DSWeb.Areas.MvcShipping.Helper
//获取用户的钉钉id
var dtc = new DingTalkContext();
body.approvers.Add(new DingTalkForm_approvers("OR", new List<string> { user.DingTalkAccount }));
//20230116 改为不指定审核人 完全依照审核流程自身的安排
//body.approvers.Add(new DingTalkForm_approvers("OR", new List<string> { "5620105362687730" }));
body.microappAgentId = dp.agentid;//
@ -427,18 +518,28 @@ namespace DSWeb.Areas.MvcShipping.Helper
list.Add(newrk);
if (list != null && list.Exists(x => x.GID == item.CHEDUIID))
{
//if (车队list != null && 车队list.Exists(x => x.GID == item.CHEDUIID))
//{
var = list.First(x => x.GID == item.CHEDUIID);
var newcl = new List<DingTalkFormField>{
new DingTalkFormField("车队", .SHORTNAME),
new DingTalkFormField("车牌号", item.TRUCKNO)
};
list.Add(newcl);
}
// var 车队 = 车队list.First(x => x.GID == item.CHEDUIID);
// var newcl = new List<DingTalkFormField>{
// new DingTalkFormField("车队", 车队.SHORTNAME),
// new DingTalkFormField("车牌号", item.TRUCKNO)
// };
// 车队信息list.Add(newcl);
//}
}
//var newcl = new List<DingTalkFormField>{
// new DingTalkFormField("车队", "青岛众盈"),
// new DingTalkFormField("车牌号", "车牌号")
// };
//车队信息list.Add(newcl);
var = new DingTalkFormField("入库信息", JsonConvert.SerializeObject(list));
var = new DingTalkFormField("车队信息", JsonConvert.SerializeObject(list));
@ -464,19 +565,209 @@ namespace DSWeb.Areas.MvcShipping.Helper
result.OK();
return result;
}
catch (Exception e) {
return result.SetErrorInfo(e.Message );
catch (Exception e)
{
return result.SetErrorInfo(e.Message);
}
}
public class DingTalk_SendAuditResult {
public string instanceId { get; set; }
public DBResult DoSend()
{
var result = base.DoSend_Header();
if (result.Success)
{
try
{
var jo = new DingTalk_SendAuditResult();
jo = (DingTalk_SendAuditResult)JsonToObject(result.Data.ToString(), jo);
var dic = new Dictionary<string, string>();
dic.Add("instanceId", jo.instanceId);
BasicDataRefDAL.SaveLogicInfo(BSNO, "钉钉审批", dic);
}
catch (Exception ex)
{
public DBResult DoSend() {
}
}
return result;
}
}
public class DingTalk_WmsOutAudit : DingTalk_SendAuditWork
{
public DingTalk_WmsOutAudit(string uid)
{
this.uid = uid;
getUser();
}
public override DBResult MakeSendMessage(string bsno)
{
var result = new DBResult();
bsno = bsno.Replace("'", "");
try
{
if (string.IsNullOrWhiteSpace(user.DingTalkAccount))
{
return result.SetErrorInfo("请配置用户的钉钉id");
}
BSNO = bsno;
DingTalk_OAAuditBody body = new DingTalk_OAAuditBody();
var app = DingTalkApp.GetDingTalkApp("诚锐东胜对接");
var dp = app.GetProcess("诚锐出货通知");
body.deptId = dp.deptid;//
//获取用户的钉钉id
var dtc = new DingTalkContext();
//body.approvers.Add(new DingTalkForm_approvers("OR", new List<string> { user.DingTalkAccount }));
body.microappAgentId = dp.agentid;//
body.originatorUserId = user.DingTalkAccount;
body.processCode = dp.processCode;
var cdc = new CommonDataContext();
var wmsout = cdc.wms_out.First(p => p.BSNO == BSNO);
var wmsoutdetailList = cdc.wms_out_detail.Where(x => x.OUTBSNO == BSNO).ToList();
var list = new List<List<DingTalkFormField>>();
var list = new List<List<DingTalkFormField>>();
var =new List<wms_out_detail_md>();
var ingidlist= wmsoutdetailList.Select(s=>s.ASSOCIATEDNO).ToList();
var wmsList = cdc.wms.Where(x => ingidlist.Contains(x.GID)).ToList();
var wmsinList = cdc.wms_in.Where(x => ingidlist.Contains(x.ASSOCIATEDNO)).ToList();
foreach (var item in wmsoutdetailList)
{
var wms = wmsList.First(x => x.GID == item.ASSOCIATEDNO);
var wmsin = new wms_in_md();
if (item.ASSOCIATEDNO == item.INBSNO)
{
//整体出库 明细取第一条即可
wmsin = wmsinList.First(x => x.ASSOCIATEDNO == item.ASSOCIATEDNO);
}
else {
//明细出库 取具体条目
wmsin= wmsinList.First(x => x.GID == item.INBSNO);
}
//重量和尺码 都来自出库量字段GOODSPFSL 填充重量还是尺码 决定于chargeunit
var = 0M;
var = 0M;
if (wms.CHARGEUNIT == "吨" || wms.CHARGEUNIT == "千克") {
= item.GOODSPFSL == null?0M:(decimal)item.GOODSPFSL;
}
if (wms.CHARGEUNIT == "CBM")
{
= item.GOODSPFSL == null ? 0M : (decimal)item.GOODSPFSL;
}
var newrk = new List<DingTalkFormField>
{
new DingTalkFormField("提单号", wms.BLNO),
//new DingTalkFormField("箱号", 对应入库wmsin.CNTRNO),
new DingTalkFormField("品名", item.GOODSNAME),
new DingTalkFormField("重量", .ToString()),
new DingTalkFormField("件数", item.GOODSPACKPFSL.ToString()),
new DingTalkFormField("尺码", .ToString()),
new DingTalkFormField("库位", string.IsNullOrWhiteSpace(wmsin.AREANAME.ToString())?"无":wmsin.AREANAME.ToString())
};
list.Add(newrk);
if (.Exists(x => x.TRUCKNO == item.TRUCKNO)) {
if (.Exists(x => x.TRUCKNO == item.TRUCKNO && (x.DRIVERIDCARD != null && x.DRIVERIDCARD != "")))
{
}
else {
.First(x => x.TRUCKNO == item.TRUCKNO).DRIVERIDCARD = item.DRIVERIDCARD;
}
}
else {
.Add(item);
}
}
if (!=null && .Count>0)
{
foreach(var item in ) {
var newcl = new List<DingTalkFormField>{
new DingTalkFormField("车牌号", item.TRUCKNO),
new DingTalkFormField("司机姓名", item.DRIVERIDCARD)
};
list.Add(newcl);
}
}
var = new DingTalkFormField("出库信息", JsonConvert.SerializeObject(list));
var = new DingTalkFormField("车辆信息", JsonConvert.SerializeObject(list));
body.formComponentValues = new List<DingTalkFormField>
{
//new DingTalkFormField("提单号", "123123")
//增加字段内容
new DingTalkFormField("客户名称", wmsout.CUSTOMERNAME),
new DingTalkFormField("出库日期", ((DateTime)wmsout.DODATE).ToString("yyyy-MM-dd")),
,
};
jsonObj = body;
token = MemoryCache.Default[DingTalkTokenJob.DingTalkAccessTokenStoreKey].ToString();
url = $"https://api.dingtalk.com/v1.0/workflow/processInstances";
HeaderDic = new Dictionary<string, string>
{
{ "x-acs-dingtalk-access-token", token }
};
result.OK();
return result;
}
catch (Exception e)
{
return result.SetErrorInfo(e.Message);
}
}
public DBResult DoSend()
{
var result = base.DoSend_Header();
if (result.Success) {
if (result.Success)
{
try
{
var jo = new DingTalk_SendAuditResult();
@ -487,7 +778,8 @@ namespace DSWeb.Areas.MvcShipping.Helper
dic.Add("instanceId", jo.instanceId);
BasicDataRefDAL.SaveLogicInfo(BSNO, "钉钉审批", dic);
}catch(Exception ex)
}
catch (Exception ex)
{
}
@ -1011,6 +1303,14 @@ namespace DSWeb.Areas.MvcShipping.Helper
{
return new DingTalkProcess();
}
public void Getappinfo(ref DingTalkProcess process) {
process.token = token;
process.aes_key = aes_key;
process.appkey = appkey;
process.agentid = agentid;
process.deptid = deptid;
}
}
@ -1024,20 +1324,21 @@ namespace DSWeb.Areas.MvcShipping.Helper
deptid = 809181118;
}
public static DingTalkProcess GetDingTalkProcess(string processname)
public override DingTalkProcess GetProcess(string processname)
{
var result = new DingTalkProcess();
if (processname == "测试入货通知")
{
result = new DingTalkProcess_(processname);
Getappinfo(ref result);
return result;
}
return result;
}
public static DingTalkProcess GetDingTalkProcessByProcessCode(string processCode)
public override DingTalkProcess GetDingTalkProcessByProcessCode(string processCode)
{
var processdic = new Dictionary<string, string> {
{ "PROC-0DC40EA2-E9D2-4917-A597-AD77EC055C49","测试入货通知"}
@ -1045,7 +1346,7 @@ namespace DSWeb.Areas.MvcShipping.Helper
if (processdic.ContainsKey(processCode))
{
return GetDingTalkProcess(processdic[processCode]);
return GetProcess(processdic[processCode]);
}
else { return new DingTalkProcess(); }
}
@ -1062,27 +1363,35 @@ namespace DSWeb.Areas.MvcShipping.Helper
deptid = 432400353;
}
public static DingTalkProcess GetDingTalkProcess(string processname)
public override DingTalkProcess GetProcess(string processname)
{
var result = new DingTalkProcess();
if (processname == "诚锐入货通知")
{
result = new DingTalkProcess_(processname);
Getappinfo(ref result);
return result;
}
if (processname == "诚锐出货通知")
{
result = new DingTalkProcess_(processname);
Getappinfo(ref result);
return result;
}
return result;
}
new public static DingTalkProcess GetDingTalkProcessByProcessCode(string processCode)
new public DingTalkProcess GetDingTalkProcessByProcessCode(string processCode)
{
var processdic = new Dictionary<string, string> {
{ "PROC-0888A19C-0562-42AC-A9C6-24E4C4398410","诚锐入货通知"}
{ "PROC-0888A19C-0562-42AC-A9C6-24E4C4398410","诚锐入货通知"},
{ "PROC-7F3CA810-FB06-4E59-867F-49C42BFC25FB","诚锐出货通知"}
};
if (processdic.ContainsKey(processCode))
{
return GetDingTalkProcess(processdic[processCode]);
return GetProcess(processdic[processCode]);
}
else { return new DingTalkProcess(); }
}
@ -1163,6 +1472,27 @@ namespace DSWeb.Areas.MvcShipping.Helper
return callbackinfo.ReadDingtalkInstanceinfo();
}
}
public class DingTalkProcess_ : DingTalkProcess
{
public DingTalkProcess_(string processname)
{
this.processname = processname;
//token = "CWhvNvfyuNf9D8halMs5PyHV70CrFx3E";
//aes_key = "O5u6L8YnUaucnC8FyFNMeMeGE5uoYSAGFGdg3rOHftt";
//appkey = "dingkt5caipnn4fbuqsf";
//agentid = 2365401074;
processCode = "PROC-7F3CA810-FB06-4E59-867F-49C42BFC25FB";
}
//public override DBResult DoDeal()
//{
// //return new DBResult();
// //return callbackinfo.ReadDingtalkInstanceinfo();
//}
}
#endregion
}
Loading…
Cancel
Save