.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/389a9ecd-a526-48f5-a8fc-7674b5b1ccbb.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/4aa3cdce-699e-4b56-8f66-713b5a23d340.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/594ceefb-7323-468d-a892-4c58118c09b5.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/5bebbc83-b7b9-4df0-ac76-c479ffe00afd.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/60d0bfba-4866-48d3-9cce-4f08e36a5c1a.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/74fd05ca-43f2-4ec8-8a4d-03ecad79beaa.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/8fff2f95-d6df-452f-ad7d-079ab21a0f28.vsidxBinary files differ
.vs/HH.WCS.Mobox3.DSZSH/FileContentIndex/fda7b9bf-81ae-418b-8902-2ec6312d7784.vsidxBinary files differ
api/ApiHelper.cs
@@ -1337,7 +1337,7 @@ private static string GenerateOrderNo(string snType, string prefix) { var id = SYSHelper.GetSerialNumber(snType, prefix); var date = DateTime.Now.ToString("yyMMdd"); return $"{prefix}{date}{id.ToString().PadLeft(4, '0')}"; return $"{prefix}{date}-{id.ToString().PadLeft(4, '0')}"; } /// <summary> @@ -1437,15 +1437,23 @@ var info = ""; try { // 参数合法性确认部分:错误编码:400 if (model.pzsl <= 0) { info = $"物料数量(pzsl){model.pzsl}不合法:物料数量应该大于 0"; if (model.pzjs <= 0) { info = $"物料数量(pzjs){model.pzjs}不合法:物料数量应该大于 0"; LogHelper.Info(info); return NewErpResult(400, info); } var outboundPlan = new TN_Outbound_Plan { var outboundPlan = db.Queryable<TN_Outbound_Plan>() .Where(p => p.JHDH == model.jhdh).First(); if (outboundPlan != null) { info = $"计划单号{model.jhdh}已在数据库中存在"; LogHelper.Info(info); return NewErpResult(1, info); } outboundPlan = new TN_Outbound_Plan { JHDH = model.jhdh, // 计划单号(唯一标识) CKZT = model.ckzt, // 出库状态 CKZT = model.ckzt, // 出库状态(需要返回) JHLB = model.jhlb, // 计划类别 CKDH = model.ckdh, // 参考单号 CPH = model.cph, // 车牌号 @@ -1456,9 +1464,9 @@ CPLB = model.cplb, // 产品类别 CPLBMX = model.cplbmx, // 产品类别明细 PP = model.pp, // 品牌 DJ = model.dj, // 等级 DJ = model.dj, // 等级(需要返回) GH = model.gh, // 罐号 PH = model.ph, // 批号 PH = model.ph, // 批号(需要返回) BZLX = model.bzlx, // 包装类型 PZDH = model.pzdh, // 派装单号 PZD_DW = model.pzd_dw, // 派装单单位 @@ -1471,15 +1479,15 @@ PZ_ZFRQ = model.pz_zfrq, // 派装作废日期 PZ_BZ = model.pz_bz, // 派装备注 CKDBH = model.ckdbh, // 出库单编号 SFJS = model.sfjs, // 实发件数 SFSL = model.sfsl, // 实发数量 SFCS = model.sfcs, // 实发车数 ZCSJ = model.zcsj, // 装车时间 JLDW = model.jldw, // 计量单位 FHRQ = model.fhrq, // 发货日期 CKDM = model.ckdm, // 仓库代码 FHR = model.fhr, // 发货人 CZYDM = model.czydm, // 操作员 SFJS = model.sfjs, // 实发件数(需要返回) SFSL = model.sfsl, // 实发数量(需要返回) SFCS = model.sfcs, // 实发车数(需要返回) ZCSJ = model.zcsj, // 装车时间(需要返回) JLDW = model.jldw, // 计量单位(需要返回) FHRQ = model.fhrq, // 发货日期(需要返回) CKDM = model.ckdm, // 仓库代码(需要返回) FHR = model.fhr, // 发货人(需要返回) CZYDM = model.czydm, // 操作员(需要返回) SHR_USERNAME = model.shr_username, // 审核人 SHRQ = model.shrq, // 审核日期 ZFBJ = model.zfbj, // 作废标记 @@ -1488,40 +1496,63 @@ SHDW = model.shdw, // 收货单位 YSDW = model.ysdw, // 运输单位 LXR = model.lxr, // 联系人 RY_ZXG = model.ry_zxg, // 装卸工 RY_CCSJ = model.ry_ccsj, // 叉车司机 RY_ZXG = model.ry_zxg, // 装卸工(需要返回) RY_CCSJ = model.ry_ccsj, // 叉车司机(需要返回) ERPHX_JHDH = model.erphx_jhdh, // erp交货单号 ERPHX_WLBM = model.erphx_wlbm, // erp物料编码 ERPHX_WLMC = model.erphx_wlmc, // erp物料名称 ERPHX_CJRQ = model.erphx_cjrq, // erp创建日期 HW = model.hw, // 货位 HWZT = model.hwzt // 货位状态 HW = model.hw, // 货位(需要返回) HWZT = model.hwzt // 货位状态(需要返回) }; var cgDetailList = SelectCgByTotalQty( qty: (int)model.pzsl, itemCode: model.cpdm, batchNo: model.ph ); //var cgDetailList = SelectCgByTotalQty( // qty: (int)model.pzsl, // itemCode: model.cpdm, // batchNo: model.ph // ); if (cgDetailList.Count == 0) { info = "没有合适的物料可以出库"; //if (cgDetailList.Count == 0) { // info = "没有合适的物料可以出库"; // LogHelper.Info(info); // return NewErpResult(3, info); //} var cgDetail = db.Queryable<TN_CG_Detail>() .Where(d => d.S_ITEM_CODE == model.cpdm && d.N_ITEM_NUM >= model.pzjs).First(); if (cgDetail == null ) { info = $"没有合适的物料可以满足:物料编码={model.cpdm},物料数量>={model.pzjs}"; LogHelper.Info(info); return NewErpResult(3, info); return NewErpResult(2, info); } var order = new TN_Outbound_Order { S_NO = orderNo, //S_ITEM_CODE = model.cpdm, //S_BATCH = model.ph, //N_END_NUM = (int)model.pzsl, S_ITEM_CODE = model.cpdm, S_BATCH = model.ph, N_END_NUM = (int)model.pzsl, S_BATCH = cgDetail.S_BATCH_NO, N_END_NUM = (int)model.pzjs, S_END_AREA = "QCCKQ", // ERP下发出库任务为汽车出库区 S_BS_NO = model.jhdh, S_BS_TYPE = "ERP", }; var detailList = new List<TN_Outbound_Detail>(); foreach (var cgDetail in cgDetailList) { //foreach (var cgDetail in cgDetailList) { // var detail = new TN_Outbound_Detail { // S_OO_NO = orderNo, // S_ITEM_CODE = cgDetail.S_ITEM_CODE, // S_BATCH_NO = cgDetail.S_BATCH_NO, // S_CNTR_CODE = cgDetail.S_CNTR_CODE, // N_COUNT = cgDetail.N_ITEM_NUM, // S_END_AREA = order.S_END_AREA, // order为detail的每一个货位设置终点值 // S_BS_NO = order.S_BS_NO, // S_BS_TYPE= order.S_BS_TYPE, // }; // detailList.Add(detail); //} var detail = new TN_Outbound_Detail { S_OO_NO = orderNo, S_ITEM_CODE = cgDetail.S_ITEM_CODE, @@ -1533,7 +1564,6 @@ S_BS_TYPE= order.S_BS_TYPE, }; detailList.Add(detail); } using (var tran = db.Ado.UseTran()) { if (db.Insertable<TN_Outbound_Order>(order).ExecuteCommand() <= 0) { @@ -1560,7 +1590,7 @@ tran.CommitTran(); } info = $"生成出库单成功"; info = $"生成出库单成功:" + JsonConvert.SerializeObject(order) + "\n出库单明细:" +JsonConvert.SerializeObject(detail); LogHelper.Info(info); return NewErpResult(0, info); } api/ApiModel.cs
@@ -440,262 +440,262 @@ /// <summary> /// 计划单号(唯一标识) /// </summary> public string jhdh { get; set; } public string jhdh { get; set; } = string.Empty; /// <summary> /// 出库状态 /// </summary> public string ckzt { get; set; } public string ckzt { get; set; } = string.Empty;// 需要返回 /// <summary> /// 计划类别 /// </summary> public string jhlb { get; set; } public string jhlb { get; set; } = string.Empty; /// <summary> /// 参考单号 /// </summary> public string ckdh { get; set; } public string ckdh { get; set; } = string.Empty; /// <summary> /// 车牌号 /// </summary> public string cph { get; set; } public string cph { get; set; } = string.Empty; /// <summary> /// 运输方式 /// </summary> public string ysfs { get; set; } public string ysfs { get; set; } = string.Empty; /// <summary> /// 产品状态 /// </summary> public string cpzt { get; set; } public string cpzt { get; set; } = string.Empty; /// <summary> /// 买断单位 /// </summary> public string mddw { get; set; } public string mddw { get; set; } = string.Empty; /// <summary> /// 产品代码 /// </summary> public string cpdm { get; set; } public string cpdm { get; set; } = string.Empty; /// <summary> /// 产品类别 /// </summary> public string cplb { get; set; } public string cplb { get; set; } = string.Empty; /// <summary> /// 产品类别明细 /// </summary> public string cplbmx { get; set; } public string cplbmx { get; set; } = string.Empty; /// <summary> /// 品牌 /// </summary> public string pp { get; set; } public string pp { get; set; } = string.Empty; /// <summary> /// 等级 /// </summary> public string dj { get; set; } public string dj { get; set; } = string.Empty;// 需要返回 /// <summary> /// 罐号 /// </summary> public string gh { get; set; } public string gh { get; set; } = string.Empty; /// <summary> /// 批号 /// </summary> public string ph { get; set; } public string ph { get; set; } = string.Empty;// 需要返回 /// <summary> /// 包装类型 /// </summary> public string bzlx { get; set; } public string bzlx { get; set; } = string.Empty; /// <summary> /// 派装单号 /// </summary> public string pzdh { get; set; } public string pzdh { get; set; } = string.Empty; /// <summary> /// 派装单单位 /// </summary> public string pzd_dw { get; set; } public string pzd_dw { get; set; } = string.Empty; /// <summary> /// 派装单调运编号 /// </summary> public string pzd_dybh { get; set; } public string pzd_dybh { get; set; } = string.Empty; /// <summary> /// 派装件数 /// </summary> public double pzjs { get; set; } public double pzjs { get; set; } = 0; /// <summary> /// 派装数量 /// </summary> public decimal pzsl { get; set; } public decimal pzsl { get; set; } = 0; /// <summary> /// 派装日期(yyyy-mm-dd) /// </summary> public string pz_rq { get; set; } public string pz_rq { get; set; } = string.Empty; /// <summary> /// 派装操作日期 /// </summary> public long pz_czrq { get; set; } public long pz_czrq { get; set; } = 0; /// <summary> /// 派装作废标记 /// </summary> public int pz_zfbj { get; set; } public int pz_zfbj { get; set; } = 0; /// <summary> /// 派装作废日期 /// </summary> public long pz_zfrq { get; set; } public long pz_zfrq { get; set; } = 0; /// <summary> /// 派装备注 /// </summary> public string pz_bz { get; set; } public string pz_bz { get; set; } = string.Empty; /// <summary> /// 出库单编号 /// </summary> public string ckdbh { get; set; } public string ckdbh { get; set; } = string.Empty; /// <summary> /// 实发件数 /// </summary> public double sfjs { get; set; } public double sfjs { get; set; } = 0; // 需要返回 /// <summary> /// 实发数量 /// </summary> public decimal sfsl { get; set; } public decimal sfsl { get; set; } = 0; // 需要返回 /// <summary> /// 实发车数 /// </summary> public int sfcs { get; set; } public int sfcs { get; set; } = 0; // 需要返回 /// <summary> /// 装车时间 /// </summary> public string zcsj { get; set; } public string zcsj { get; set; } = string.Empty; // 需要返回 /// <summary> /// 计量单位 /// </summary> public string jldw { get; set; } public string jldw { get; set; } = string.Empty;// 需要返回 /// <summary> /// 发货日期 /// </summary> public long fhrq { get; set; } public long fhrq { get; set; } = 0; // 需要返回 /// <summary> /// 仓库代码 /// </summary> public string ckdm { get; set; } public string ckdm { get; set; } = string.Empty; // 需要返回 /// <summary> /// 发货人 /// </summary> public string fhr { get; set; } public string fhr { get; set; } = string.Empty; // 需要返回 /// <summary> /// 操作员 /// </summary> public string czydm { get; set; } public string czydm { get; set; } = string.Empty; // 需要返回 /// <summary> /// 审核人 /// </summary> public string shr_username { get; set; } public string shr_username { get; set; } = string.Empty; /// <summary> /// 审核日期 /// </summary> public long shrq { get; set; } public long shrq { get; set; } = 0; /// <summary> /// 作废标记 /// </summary> public long zfbj { get; set; } public long zfbj { get; set; } = 0; /// <summary> /// 作废日期 /// </summary> public long zfrq { get; set; } public long zfrq { get; set; } = 0; /// <summary> /// 结算单位 /// </summary> public string jsdw { get; set; } public string jsdw { get; set; } = string.Empty; /// <summary> /// 收货单位 /// </summary> public string shdw { get; set; } public string shdw { get; set; } = string.Empty; /// <summary> /// 运输单位 /// </summary> public string ysdw { get; set; } public string ysdw { get; set; } = string.Empty; /// <summary> /// 联系人 /// </summary> public string lxr { get; set; } public string lxr { get; set; } = string.Empty; /// <summary> /// 装卸工 /// </summary> public string ry_zxg { get; set; } public string ry_zxg { get; set; } = string.Empty; // 需要返回 /// <summary> /// 叉车司机 /// </summary> public string ry_ccsj { get; set; } public string ry_ccsj { get; set; } = string.Empty; // 需要返回 /// <summary> /// erp交货单号 /// </summary> public string erphx_jhdh { get; set; } public string erphx_jhdh { get; set; } = string.Empty; /// <summary> /// erp物料编码 /// </summary> public string erphx_wlbm { get; set; } public string erphx_wlbm { get; set; } = string.Empty; /// <summary> /// erp物料名称 /// </summary> public string erphx_wlmc { get; set; } public string erphx_wlmc { get; set; } = string.Empty; /// <summary> /// erp创建日期 /// </summary> public string erphx_cjrq { get; set; } public string erphx_cjrq { get; set; } = string.Empty; /// <summary> /// 货位 /// </summary> public string hw { get; set; } public string hw { get; set; } = string.Empty; // 需要返回 /// <summary> /// 货位状态 /// </summary> public string hwzt { get; set; } public string hwzt { get; set; } = string.Empty; // 需要返回 } public class PickUpReturnErpInfo { @@ -707,7 +707,7 @@ /// <summary> /// 出库状态 /// </summary> public string ckzt { get; set; } public string ckzt { get; set; } // 需要返回 /// <summary> /// 计划类别 @@ -762,7 +762,7 @@ /// <summary> /// 等级 /// </summary> public string dj { get; set; } public string dj { get; set; } // 需要返回 /// <summary> /// 罐号 @@ -772,7 +772,7 @@ /// <summary> /// 批号 /// </summary> public string ph { get; set; } public string ph { get; set; } // 需要返回 /// <summary> /// 包装类型 @@ -837,47 +837,47 @@ /// <summary> /// 实发件数 /// </summary> public double sfjs { get; set; } public double sfjs { get; set; } // 需要返回 /// <summary> /// 实发数量 /// </summary> public decimal sfsl { get; set; } public decimal sfsl { get; set; } // 需要返回 /// <summary> /// 实发车数 /// </summary> public int sfcs { get; set; } ///// <summary> ///// 实发车数 ///// </summary> //public int sfcs { get; set; } // 需要返回 /// <summary> /// 装车时间 /// </summary> public string zcsj { get; set; } ///// <summary> ///// 装车时间 ///// </summary> //public string zcsj { get; set; } // 需要返回 /// <summary> /// 计量单位 /// </summary> public string jldw { get; set; } ///// <summary> ///// 计量单位 ///// </summary> //public string jldw { get; set; } // 需要返回 /// <summary> /// 发货日期 /// </summary> public long fhrq { get; set; } ///// <summary> ///// 发货日期 ///// </summary> //public long fhrq { get; set; } // 需要返回 /// <summary> /// 仓库代码 /// </summary> public string ckdm { get; set; } ///// <summary> ///// 仓库代码 ///// </summary> //public string ckdm { get; set; } // 需要返回 /// <summary> /// 发货人 /// </summary> public string fhr { get; set; } ///// <summary> ///// 发货人 ///// </summary> //public string fhr { get; set; } // 需要返回 /// <summary> /// 操作员 /// </summary> public string czydm { get; set; } ///// <summary> ///// 操作员 ///// </summary> //public string czydm { get; set; } // 需要返回 /// <summary> /// 审核人 @@ -919,15 +919,15 @@ /// </summary> public string lxr { get; set; } /// <summary> /// 装卸工 /// </summary> public string ry_zxg { get; set; } ///// <summary> ///// 装卸工 ///// </summary> //public string ry_zxg { get; set; } // 需要返回 /// <summary> /// 叉车司机 /// </summary> public string ry_ccsj { get; set; } ///// <summary> ///// 叉车司机 ///// </summary> //public string ry_ccsj { get; set; } // 需要返回 /// <summary> /// erp交货单号 @@ -952,12 +952,274 @@ /// <summary> /// 货位 /// </summary> public string hw { get; set; } public string hw { get; set; } // 需要返回 /// <summary> /// 货位状态 /// </summary> public string hwzt { get; set; } public string hwzt { get; set; } // 需要返回 } public class CreateTaskReturnErpInfo { /// <summary> /// 计划单号(唯一标识) /// </summary> public string jhdh { get; set; } /// <summary> /// 出库状态 /// </summary> public string ckzt { get; set; } // 需要返回 /// <summary> /// 计划类别 /// </summary> public string jhlb { get; set; } /// <summary> /// 参考单号 /// </summary> public string ckdh { get; set; } /// <summary> /// 车牌号 /// </summary> public string cph { get; set; } /// <summary> /// 运输方式 /// </summary> public string ysfs { get; set; } /// <summary> /// 产品状态 /// </summary> public string cpzt { get; set; } /// <summary> /// 买断单位 /// </summary> public string mddw { get; set; } /// <summary> /// 产品代码 /// </summary> public string cpdm { get; set; } /// <summary> /// 产品类别 /// </summary> public string cplb { get; set; } /// <summary> /// 产品类别明细 /// </summary> public string cplbmx { get; set; } /// <summary> /// 品牌 /// </summary> public string pp { get; set; } /// <summary> /// 等级 /// </summary> public string dj { get; set; } // 需要返回 /// <summary> /// 罐号 /// </summary> public string gh { get; set; } /// <summary> /// 批号 /// </summary> public string ph { get; set; } // 需要返回 /// <summary> /// 包装类型 /// </summary> public string bzlx { get; set; } /// <summary> /// 派装单号 /// </summary> public string pzdh { get; set; } /// <summary> /// 派装单单位 /// </summary> public string pzd_dw { get; set; } /// <summary> /// 派装单调运编号 /// </summary> public string pzd_dybh { get; set; } /// <summary> /// 派装件数 /// </summary> public double pzjs { get; set; } /// <summary> /// 派装数量 /// </summary> public decimal pzsl { get; set; } /// <summary> /// 派装日期(yyyy-mm-dd) /// </summary> public string pz_rq { get; set; } /// <summary> /// 派装操作日期 /// </summary> public long pz_czrq { get; set; } /// <summary> /// 派装作废标记 /// </summary> public int pz_zfbj { get; set; } /// <summary> /// 派装作废日期 /// </summary> public long pz_zfrq { get; set; } /// <summary> /// 派装备注 /// </summary> public string pz_bz { get; set; } /// <summary> /// 出库单编号 /// </summary> public string ckdbh { get; set; } ///// <summary> ///// 实发件数 ///// </summary> //public double sfjs { get; set; } // 需要返回 ///// <summary> ///// 实发数量 ///// </summary> //public decimal sfsl { get; set; } // 需要返回 ///// <summary> ///// 实发车数 ///// </summary> //public int sfcs { get; set; } // 需要返回 ///// <summary> ///// 装车时间 ///// </summary> //public string zcsj { get; set; } // 需要返回 ///// <summary> ///// 计量单位 ///// </summary> //public string jldw { get; set; } // 需要返回 ///// <summary> ///// 发货日期 ///// </summary> //public long fhrq { get; set; } // 需要返回 ///// <summary> ///// 仓库代码 ///// </summary> //public string ckdm { get; set; } // 需要返回 ///// <summary> ///// 发货人 ///// </summary> //public string fhr { get; set; } // 需要返回 ///// <summary> ///// 操作员 ///// </summary> //public string czydm { get; set; } // 需要返回 /// <summary> /// 审核人 /// </summary> public string shr_username { get; set; } /// <summary> /// 审核日期 /// </summary> public long shrq { get; set; } /// <summary> /// 作废标记 /// </summary> public long zfbj { get; set; } /// <summary> /// 作废日期 /// </summary> public long zfrq { get; set; } /// <summary> /// 结算单位 /// </summary> public string jsdw { get; set; } /// <summary> /// 收货单位 /// </summary> public string shdw { get; set; } /// <summary> /// 运输单位 /// </summary> public string ysdw { get; set; } /// <summary> /// 联系人 /// </summary> public string lxr { get; set; } ///// <summary> ///// 装卸工 ///// </summary> //public string ry_zxg { get; set; } // 需要返回 ///// <summary> ///// 叉车司机 ///// </summary> //public string ry_ccsj { get; set; } // 需要返回 /// <summary> /// erp交货单号 /// </summary> public string erphx_jhdh { get; set; } /// <summary> /// erp物料编码 /// </summary> public string erphx_wlbm { get; set; } /// <summary> /// erp物料名称 /// </summary> public string erphx_wlmc { get; set; } /// <summary> /// erp创建日期 /// </summary> public string erphx_cjrq { get; set; } /// <summary> /// 货位 /// </summary> public string hw { get; set; } // 需要返回 /// <summary> /// 货位状态 /// </summary> public string hwzt { get; set; } // 需要返回 } } } api/DebugController.cs
@@ -14,6 +14,7 @@ using SqlSugar; using static HH.WCS.Mobox3.DSZSH.api.ApiModel; using static HH.WCS.Mobox3.DSZSH.api.OtherModel; using static HH.WCS.Mobox3.DSZSH.core.Monitor; namespace HH.WCS.Mobox3.DSZSH.api { @@ -196,9 +197,9 @@ try { var db = new SqlHelper<object>().GetInstance(); var entityTypes = new Type[] { }; var entityTypes = new Type[] { }; //db.CodeFirst.InitTables(entityTypes); } catch (Exception ex) { LogHelper.Info($"发生了异常"); @@ -327,6 +328,74 @@ return ex.Message; } } [HttpPost] [Route("TestErpSendOutboundPlan")] public ErpResult TestErpSendOutboundPlan(TestErpSendOutboundPlanInfo model) { var apiName = "ERP下发出库计划单"; //LogHelper.InfoApi(apiName, model); var erpModel = new ErpSendOutboundPlanInfo(); erpModel.jhdh = model.PlanNo; erpModel.cpdm = model.ItemCode; erpModel.pzjs = model.ItemNum; LogHelper.InfoApi(apiName, erpModel); return ApiHelper.ErpSendOutboundPlan(erpModel); } [HttpPost] [Route("PickUpReturn")] public TestErpResult PickUpReturn(PickUpReturnErpInfo model) { if (model.sfjs == 0) { return new TestErpResult { code = 1, message = "实发件数未确定" }; } return new TestErpResult { code = 0, message = "success" }; } [HttpPost] [Route("CreateTaskReturn")] public TestErpResult CreateTaskReturn(CreateTaskReturnErpInfo model) { if (model.hw == "") { return new TestErpResult { code = 1, message = "货位信息未提供" }; } return new TestErpResult { code = 0, message = "success" }; } } public class TestErpSendOutboundPlanInfo { /// <summary> /// 出库计划单号(计划单号 jhdh) /// </summary> public string PlanNo { get; set; } = string.Empty; /// <summary> /// 物料编码(产品代码 cpdm) /// </summary> public string ItemCode { get; set; } = string.Empty; /// <summary> /// 物料数量(派装件数 pzjs) /// </summary> public float ItemNum { get; set; } = 0; } public class TestErpResult { public int code { get; set; } public string message { get; set; } } public class AddInboundTaskInfo { config/config.json
@@ -1,8 +1,8 @@ { "WebApiUrl": "http://127.0.0.1:8901", "NdcApiUrl": "http://127.0.0.1:5201/api/order/", "ErpApiUrl": "http://127.0.0.1:8085/api/", "SqlServer": "Data Source=(local);Initial Catalog=DSZSHTest;User ID=sa;Password=123456;", "ErpApiUrl": "http://127.0.0.1:8901/api/", "SqlServer": "Data Source=192.168.1.87;Initial Catalog=AMS_OIMobox;User ID=sa;Password=123456;", "TcpServerIp": "127.0.0.1", "TcpServerPort": 8085, "Areas": [ core/Monitor.cs
@@ -4,6 +4,7 @@ using System.Text; using System.Threading.Tasks; using HH.WCS.Mobox3.DSZSH.api; using HH.WCS.Mobox3.DSZSH.device; using HH.WCS.Mobox3.DSZSH.models; using HH.WCS.Mobox3.DSZSH.util; @@ -11,6 +12,8 @@ using Microsoft.Win32; using Newtonsoft.Json; using Org.BouncyCastle.Asn1.X509; namespace HH.WCS.Mobox3.DSZSH.core { public class Monitor { @@ -189,6 +192,8 @@ return; } Console.WriteLine(JsonConvert.SerializeObject(orderList)); // TEST var detailList = new List<TN_Outbound_Detail>(); foreach (var order in orderList) { var doingCount = db.Queryable<TN_Outbound_Detail>() @@ -310,9 +315,16 @@ tran.CommitTran(); info = $"生成任务'{taskName}'成功,任务号={task.S_CODE},容器号={cntId},起点={startLoc.S_CODE},终点={endLoc.S_CODE}"; LogHelper.Info(info); continue; //continue; } // 如果当前出库单明细是ERP下发的,任务创建完成反馈货位信息 if (detail.S_BS_TYPE == "ERP") { //var createTaskReturnErpTask = Task.Run(() => { // CreateTaskReturnErp(task); //}); CreateTaskReturnErp(task); } } @@ -607,5 +619,104 @@ LogHelper.InfoEx(ex); } } public static void CreateTaskReturnErp(TN_Task task) { var db = new SqlHelper<object>().GetInstance(); var info = ""; var httpH = new HttpHelper(); try { var plan = db.Queryable<TN_Outbound_Plan>() .Where(p => p.JHDH == task.S_BS_NO) .First(); if (plan == null) { info = $"计划单号{task.S_BS_NO}不存在!"; LogHelper.Info(info); } var cgDetail = db.Queryable<TN_CG_Detail>() .Where(d => d.S_CNTR_CODE == task.S_CNTR_CODE) .First(); if (cgDetail == null) { info = $"物料编码不存在!"; LogHelper.Info(info); } var model = new OtherModel.CreateTaskReturnErpInfo { jhdh = plan.JHDH , // 计划单号(唯一标识) ckzt = plan.CKZT , // 出库状态(需要返回) jhlb = plan.JHLB , // 计划类别 ckdh = plan.CKDH , // 参考单号 cph = plan.CPH , // 车牌号 ysfs = plan.YSFS , // 运输方式 cpzt = plan.CPZT , // 产品状态 mddw = plan.MDDW , // 买断单位 cpdm = plan.CPDM , // 产品代码 cplb = plan.CPLB , // 产品类别 cplbmx = plan.CPLBMX , // 产品类别明细 pp = plan.PP , // 品牌 dj = plan.DJ , // 等级(需要返回) gh = plan.GH , // 罐号 ph = plan.PH , // 批号(需要返回) bzlx = plan.BZLX , // 包装类型 pzdh = plan.PZDH , // 派装单号 pzd_dw = plan.PZD_DW , // 派装单单位 pzd_dybh = plan.PZD_DYBH , // 派装单调运编号 pzjs = plan.PZJS , // 派装件数 pzsl = plan.PZSL , // 派装数量 pz_rq = plan.PZ_RQ , // 派装日期(yyyy-mm-dd) pz_czrq = plan.PZ_CZRQ , // 派装操作日期 pz_zfbj = plan.PZ_ZFBJ , // 派装作废标记 pz_zfrq = plan.PZ_ZFRQ , // 派装作废日期 pz_bz = plan.PZ_BZ , // 派装备注 ckdbh = plan.CKDBH , // 出库单编号 //sfjs = plan.SFJS , // 实发件数(需要返回) //sfsl = plan.SFSL , // 实发数量(需要返回) //sfcs = plan.SFCS , // 实发车数(需要返回) //zcsj = plan.ZCSJ , // 装车时间(需要返回) //jldw = plan.JLDW , // 计量单位(需要返回) //fhrq = plan.FHRQ , // 发货日期(需要返回) //ckdm = plan.CKDM , // 仓库代码(需要返回) //fhr = plan.FHR , // 发货人(需要返回) //czydm = plan.CZYDM , // 操作员(需要返回) shr_username = plan.SHR_USERNAME , // 审核人 shrq = plan.SHRQ , // 审核日期 zfbj = plan.ZFBJ , // 作废标记 zfrq = plan.ZFRQ , // 作废日期 jsdw = plan.JSDW , // 结算单位 shdw = plan.SHDW , // 收货单位 ysdw = plan.YSDW , // 运输单位 lxr = plan.LXR , // 联系人 //ry_zxg = plan.RY_ZXG , // 装卸工(需要返回) //ry_ccsj = plan.RY_CCSJ , // 叉车司机(需要返回) erphx_jhdh = plan.ERPHX_JHDH , // erp交货单号 erphx_wlbm = plan.ERPHX_WLBM , // erp物料编码 erphx_wlmc = plan.ERPHX_WLMC , // erp物料名称 erphx_cjrq = plan.ERPHX_CJRQ , // erp创建日期 hw = plan.HW , // 货位(需要返回) hwzt = plan.HWZT // 货位状态(需要返回) }; model.hw = task.S_START_LOC; model.hwzt = "待出库"; model.ph = cgDetail.S_BATCH_NO; var jsonInfo = JsonConvert.SerializeObject(model); var result = httpH.WebPost(Settings.ErpApiUrl + "CreateTaskReturn", jsonInfo); LogHelper.InfoApi($"创建任务完成反馈ERP接口,结果={result},调用参数:", model); plan.HW = model.hw; plan.HWZT = model.hwzt; plan.PH = model.ph; var success = db.Updateable<TN_Outbound_Plan>(plan).UpdateColumns(p => new { p.HW, p.HWZT, p.PH }).ExecuteCommand() > 0; info = "更新出库计划单记录表" + (success ? "成功" : "失败"); LogHelper.Info(info); } catch (Exception ex) { LogHelper.InfoEx(ex); } } } } core/WCSCore.cs
@@ -150,7 +150,17 @@ isInbound= true; } var record = new TN_Record_Table { //var needUpdateRecordTable = false; var record = db.Queryable<TN_Record_Table>() .Where(r => r.S_TASK_NO == task.S_CODE).First(); if (record != null) { //needUpdateRecordTable = true; info = $"出入库记录表中已经存在任务号{task.S_CODE}"; // 防止测试时反复调用134562导致重复记录 LogHelper.Info(info); return; } record = new TN_Record_Table { S_ITEM_CODE = cgDetail.S_ITEM_CODE, S_BATCH_NO = cgDetail.S_BATCH_NO, S_ITEM_NAME = cgDetail.S_ITEM_NAME, @@ -346,17 +356,75 @@ LogHelper.Info(info); } // TODO var model = new OtherModel.PickUpReturnErpInfo(); var model = new OtherModel.PickUpReturnErpInfo { jhdh = plan.JHDH, // 计划单号(唯一标识) ckzt = plan.CKZT, // 出库状态(需要返回) jhlb = plan.JHLB, // 计划类别 ckdh = plan.CKDH, // 参考单号 cph = plan.CPH, // 车牌号 ysfs = plan.YSFS, // 运输方式 cpzt = plan.CPZT, // 产品状态 mddw = plan.MDDW, // 买断单位 cpdm = plan.CPDM, // 产品代码 cplb = plan.CPLB, // 产品类别 cplbmx = plan.CPLBMX, // 产品类别明细 pp = plan.PP, // 品牌 dj = plan.DJ, // 等级(需要返回) gh = plan.GH, // 罐号 ph = plan.PH, // 批号(需要返回) bzlx = plan.BZLX, // 包装类型 pzdh = plan.PZDH, // 派装单号 pzd_dw = plan.PZD_DW, // 派装单单位 pzd_dybh = plan.PZD_DYBH, // 派装单调运编号 pzjs = plan.PZJS, // 派装件数 pzsl = plan.PZSL, // 派装数量 pz_rq = plan.PZ_RQ, // 派装日期(yyyy-mm-dd) pz_czrq = plan.PZ_CZRQ, // 派装操作日期 pz_zfbj = plan.PZ_ZFBJ, // 派装作废标记 pz_zfrq = plan.PZ_ZFRQ, // 派装作废日期 pz_bz = plan.PZ_BZ, // 派装备注 ckdbh = plan.CKDBH, // 出库单编号 sfjs = plan.SFJS, // 实发件数(需要返回)--更新 sfsl = plan.SFSL, // 实发数量(需要返回)--更新 //sfcs = plan.SFCS , // 实发车数(需要返回) //zcsj = plan.ZCSJ , // 装车时间(需要返回) //jldw = plan.JLDW , // 计量单位(需要返回) //fhrq = plan.FHRQ , // 发货日期(需要返回) //ckdm = plan.CKDM , // 仓库代码(需要返回) //fhr = plan.FHR , // 发货人(需要返回) //czydm = plan.CZYDM , // 操作员(需要返回) shr_username = plan.SHR_USERNAME, // 审核人 shrq = plan.SHRQ, // 审核日期 zfbj = plan.ZFBJ, // 作废标记 zfrq = plan.ZFRQ, // 作废日期 jsdw = plan.JSDW, // 结算单位 shdw = plan.SHDW, // 收货单位 ysdw = plan.YSDW, // 运输单位 lxr = plan.LXR, // 联系人 //ry_zxg = plan.RY_ZXG , // 装卸工(需要返回) //ry_ccsj = plan.RY_CCSJ , // 叉车司机(需要返回) erphx_jhdh = plan.ERPHX_JHDH, // erp交货单号 erphx_wlbm = plan.ERPHX_WLBM, // erp物料编码 erphx_wlmc = plan.ERPHX_WLMC, // erp物料名称 erphx_cjrq = plan.ERPHX_CJRQ, // erp创建日期 hw = plan.HW, // 货位(需要返回) hwzt = plan.HWZT // 货位状态(需要返回) }; model.sfjs = cgDetail.N_ITEM_NUM; model.sfsl = 0; //model.hw = task.S_START_LOC; //model.hwzt = ""; model.sfsl = (decimal) cgDetail.F_QTY; // TEMP model.hwzt = "已出库"; var jsonInfo = JsonConvert.SerializeObject(model); var result = httpH.WebPost(Settings.ErpApiUrl + "PickUpReturn", jsonInfo); LogHelper.InfoApi("取货完成反馈ERP接口", model); LogHelper.InfoApi($"取货完成反馈ERP接口,结果={result},调用参数:", model); plan.SFJS = model.sfjs; plan.SFSL = model.sfsl; plan.HWZT = model.hwzt; var success = db.Updateable<TN_Outbound_Plan>(plan).UpdateColumns(p => new { p.SFJS, p.SFSL, p.HWZT }).ExecuteCommand() > 0; info = "更新出库计划单记录表" + (success ? "成功" : "失败"); LogHelper.Info(info); } catch (Exception ex) { LogHelper.InfoEx(ex); models/TN_CG_Detail.cs
@@ -47,6 +47,8 @@ /// </summary> public int N_ITEM_NUM { get; set; } = 0; public float F_QTY { get; set; } = 0f; /// <summary> /// 物料规格 /// </summary>