From ee4806a4b2ec94ec63b4cb9b58447d9863baebe5 Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期四, 27 三月 2025 09:02:41 +0800 Subject: [PATCH] 修改问题 --- Wms/WMS.BLL/BllTransServer/NoticeServer.cs | 562 +++++++++++++++++++++++++++++++++----------------------- 1 files changed, 332 insertions(+), 230 deletions(-) diff --git a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs index c029acf..59d0c0c 100644 --- a/Wms/WMS.BLL/BllTransServer/NoticeServer.cs +++ b/Wms/WMS.BLL/BllTransServer/NoticeServer.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Utility.Tools; using WMS.BLL.LogServer; using WMS.DAL; using WMS.Entity.BllAsnEntity; @@ -15,6 +16,7 @@ using WMS.Entity.LogEntity; using WMS.Entity.SysEntity; using WMS.IBLL.IBllTransServer; +using static Model.InterFaceModel.RCSModel; namespace WMS.BLL.BllTransServer { @@ -29,7 +31,7 @@ /// </summary> /// <param name="model"></param> /// <returns></returns> - public ErpModel CreateAsn(AsnInfo model) + public ErpModel CreateAsnWork(AsnInfo model) { try { @@ -55,7 +57,7 @@ Origin = string.IsNullOrEmpty(model.Origin) ? "MES" : model.Origin, CustomerNo = model.Customer, CustomerName = "", - OrderCode = model.OrderCode, + OrderCode = model.OrderCode }; // 鍏ュ簱鏄庣粏琛ㄤ俊鎭� @@ -127,7 +129,7 @@ /// <param name="TaskNo"></param> /// <param name="Status"></param> /// <returns></returns> - public ErpModel FinishTask(string TaskNo,string Status) + public ErpModel RCSFinishTask(string TaskNo,string Status) { try { @@ -163,31 +165,17 @@ resultModel.Success = 0; resultModel.Message = "鎴愬姛"; + + //鎻愪氦浜嬪姟 + Db.CommitTran(); + return resultModel; } switch (taskInfo.OrderType) { #region 鍏ュ簱瀹屾垚 case "0": - //鍏ュ簱鍗曟槑缁嗕俊鎭� - var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo); - if (noticeDetail == null) - { - resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曟槑缁嗕笉瀛樺湪!"; - return resultModel; - } - //鍏ュ簱鍗曚俊鎭� - var notice = Db.Queryable<BllArrivalNotice>().First(w => w.ASNNo == noticeDetail.ASNNo); - if (notice == null) - { - resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曚笉瀛樺湪!"; - return resultModel; - } - if (notice.Status == "3" || notice.Status == "4") - { - resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曞凡鎵ц瀹屾垚!"; - return resultModel; - } + //鐩爣鍌ㄤ綅淇℃伅 var locatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0"); if (locatInfo == null) @@ -195,51 +183,13 @@ resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; return resultModel; } + //搴撳瓨鏄庣粏 var sd1 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo); if (sd1 == null) { - sd1 = new DataStockDetail() - { - LotNo = noticeDetail.LotNo, - LotText = noticeDetail.LotText, - SupplierLot = noticeDetail.SupplierLot, - SkuNo = noticeDetail.SkuNo, - SkuName = noticeDetail.SkuName, - Standard = noticeDetail.Standard, - Qty = 1, - LockQty = 0, - FrozenQty = 0, - InspectQty = 0, - ASNNo = noticeDetail.ASNNo, - ASNDetailNo = noticeDetail.Id, - WareHouseNo = locatInfo.WareHouseNo,//鎵�灞炰粨搴� - RoadwayNo = locatInfo.RoadwayNo,//鎵�灞炲贩閬� - AreaNo = locatInfo.AreaNo,//鎵�灞炲尯鍩� - LocatNo = locatInfo.LocatNo,//鍌ㄤ綅鍦板潃 - PalletNo = taskInfo.PalletNo, - PalletNo2 = "", - PalletNo3 = "", - PalletTags = "0", - CompleteTime = comTime, - ProductionTime = null, - ExpirationTime = null, - Status = "0", - InspectMark = "0", - InspectStatus = "0",//寰呮楠� - BitPalletMark = "0", - PackagNo = "", - IsBale = "0", - IsBelt = "0", - - PalletStatus = "1", - - IsDel = "0", - CreateUser = 0, - CreateTime = comTime - }; - //鎻掑叆搴撳瓨鏄庣粏 - Db.Insertable(sd1).ExecuteCommand(); + resultModel.Message = $"璇ユ《瀵瑰簲鐨勫簱瀛樹俊鎭笉瀛樺湪锛屾《鍙凤細{taskInfo.PalletNo}!"; + return resultModel; } else { @@ -247,140 +197,154 @@ sd1.LockQty = 0; sd1.FrozenQty = 0; sd1.InspectQty = 0; - sd1.ASNNo = noticeDetail.ASNNo; - sd1.ASNDetailNo = noticeDetail.Id; sd1.WareHouseNo = locatInfo.WareHouseNo;//鎵�灞炰粨搴� sd1.RoadwayNo = locatInfo.RoadwayNo;//鎵�灞炲贩閬� sd1.AreaNo = locatInfo.AreaNo;//鎵�灞炲尯鍩� sd1.LocatNo = locatInfo.LocatNo;//鍌ㄤ綅鍦板潃 sd1.CompleteTime = comTime; sd1.InspectStatus = "0";//寰呮楠� - sd1.PalletStatus = "1";//棰勬贩 + sd1.PalletStatus = "2";//鍗婃垚鍝� //淇敼搴撳瓨鏄庣粏 Db.Updateable(sd1).ExecuteCommand(); } - - noticeDetail.CompleteQty += 1;//瀹屾垚鏁伴噺 - noticeDetail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴� - if (noticeDetail.CompleteQty >= noticeDetail.Qty) - { - noticeDetail.Status = "2"; - noticeDetail.CompleteTime = comTime; - } - noticeDetail.UpdateUser = 0; - noticeDetail.UpdateTime = comTime; - //鏇存柊鍏ュ簱鍗曟槑缁� - Db.Updateable(noticeDetail).ExecuteCommand(); - - notice.UpdateUser = 0; - notice.UpdateTime = comTime; - if (notice.Status == "0") - { - notice.Status = "1"; - } - var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == noticeDetail.ASNNo && m.Status != "2"); - if (asnDetailNum == 0) - { - notice.Status = "2"; - notice.CompleteTime = comTime;//瀹屾垚鏃堕棿 - } - //鏇存柊鍏ュ簱鍗� - Db.Updateable(notice).ExecuteCommand(); - locatInfo.Status = "1";//鏈夌墿鍝� //鏇存柊鍌ㄤ綅鐘舵�� Db.Updateable(locatInfo).ExecuteCommand(); - #region 璐ㄦ璇烽獙 - var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == noticeDetail.SkuNo && m.LotNo == noticeDetail.LotNo && m.SupplierLot == noticeDetail.SupplierLot); - if (qualityRequest == null) + //鍏ュ簱鍗曟槑缁嗕俊鎭� + var noticeDetail = Db.Queryable<BllArrivalNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo); + if (noticeDetail != null) { - //璐ㄦ璇烽獙鍗曚俊鎭� - string qcNo = new Common().GetMaxNo("QC"); - qualityRequest = new BllQualityInspectionRequest(); - qualityRequest.QcNo = qcNo; - qualityRequest.Status = "0"; - qualityRequest.SkuNo = noticeDetail.SkuNo; - qualityRequest.SkuName = noticeDetail.SkuName; - qualityRequest.LotNo = noticeDetail.LotNo; - qualityRequest.SupplierLot = noticeDetail.SupplierLot; - qualityRequest.Qty = noticeDetail.Qty; - qualityRequest.SamplingQty = 0; - qualityRequest.ASNNo = noticeDetail.ASNNo; - qualityRequest.CreateUser = 0; - qualityRequest.CreateTime = comTime; - - // 璁板綍浠诲姟鏃ュ織 - var taskNo = new Common().GetMaxNo("TK"); - var exTask = new LogTask() + //鍏ュ簱鍗曚俊鎭� + var notice = Db.Queryable<BllArrivalNotice>().First(w => w.ASNNo == noticeDetail.ASNNo); + if (notice == null) { - TaskNo = taskNo, - Sender = "WMS", - Receiver = "Limes", - IsSuccess = 0,//鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛 - StartLocat = "",//璧峰浣嶇疆 - PalletNo = "",//鎵樼洏鐮� - IsSend = 1,//鏄惁鍙啀娆′笅鍙� - IsCancel = 1,//鏄惁鍙彇娑� - IsFinish = 1,//鏄惁鍙畬鎴� - Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚 - OrderType = "5",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗� 4 鍙栨牱鍑哄簱鍗� 5 鍏朵粬 - EndLocat = "",//鐩爣浣嶇疆 - Type = "3",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟 - Msg = "璇烽獙浠诲姟" - }; - // 鎻掑叆浠诲姟鏃ュ織 - Db.Insertable(exTask).ExecuteCommand(); - - // 璋冪敤Limes鎺ュ彛鍙戣捣璇烽獙 - var sendModel = new SendLimesModel() - { - QcNo = qualityRequest.QcNo, - SkuNo = qualityRequest.SkuNo, - Qty = qualityRequest.Qty.ToString(), - LotNo = qualityRequest.LotNo, - SupplierLot = qualityRequest.SupplierLot, - RequestUser = "", // 璇烽獙浜� - }; - var jsonData = JsonConvert.SerializeObject(sendModel); - string response = ""; - try - { - var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss") - //response = HttpHelper.DoPost(url, jsonData, "涓婁紶Limes绯荤粺鍙戣捣璇烽獙", "Limes"); - var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss") - - ////瑙f瀽杩斿洖鏁版嵁 - //var limesModel = JsonConvert.DeserializeObject<LimesModel>(response); - List<string> list1 = new List<string>(); - list1.Add(taskNo); - //if (limesModel.Success == 0) - //{ - //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�// - new TaskServer().EditTaskIssueOk(list1, time1, time2); - - // 鏇存柊璇烽獙鍗曚俊鎭� - qualityRequest.Status = "1"; - qualityRequest.SamplingQty = 10;//decimal.Parse(limesModel.SamplingQty); - qualityRequest.RequestUser = 0; - qualityRequest.RequestTime = DateTime.Now; - qualityRequest.UpdateTime = DateTime.Now; - qualityRequest.UpdateUser = 0; - //娣诲姞璐ㄦ璇烽獙鍗� - Db.Insertable(qualityRequest).ExecuteCommand(); - //} - //if (limesModel.Success == -1) - //{ - // new TaskServer().EditTaskIssueNo(list1, time1, time2,limesModel.Message); - // throw new Exception(limesModel.Message); - //} + resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曚笉瀛樺湪!"; + return resultModel; } - catch (Exception ex) + if (notice.Status == "3" || notice.Status == "4") { - throw new Exception(ex.Message); + resultModel.Message = "璇ヤ换鍔″搴旂殑鍏ュ簱鍗曞凡鎵ц瀹屾垚!"; + return resultModel; } + noticeDetail.CompleteQty += 1;//瀹屾垚鏁伴噺 + noticeDetail.Status = "1";//0锛氱瓑寰呮墽琛� 1锛氭鍦ㄦ墽琛� 2锛氭墽琛屽畬鎴� + if (noticeDetail.CompleteQty >= noticeDetail.Qty) + { + noticeDetail.Status = "2"; + noticeDetail.CompleteTime = comTime; + } + noticeDetail.UpdateUser = 0; + noticeDetail.UpdateTime = comTime; + //鏇存柊鍏ュ簱鍗曟槑缁� + Db.Updateable(noticeDetail).ExecuteCommand(); + + notice.UpdateUser = 0; + notice.UpdateTime = comTime; + if (notice.Status == "0") + { + notice.Status = "1"; + } + var asnDetailNum = Db.Queryable<BllArrivalNoticeDetail>().Count(m => m.IsDel == "0" && m.ASNNo == noticeDetail.ASNNo && m.Status != "2"); + if (asnDetailNum == 0) + { + notice.Status = "2"; + notice.CompleteTime = comTime;//瀹屾垚鏃堕棿 + } + //鏇存柊鍏ュ簱鍗� + Db.Updateable(notice).ExecuteCommand(); } + + #region 璐ㄦ璇烽獙锛屽幓鎺塎ES + //var qualityRequest = Db.Queryable<BllQualityInspectionRequest>().First(m => m.IsDel == "0" && m.SkuNo == noticeDetail.SkuNo && m.LotNo == noticeDetail.LotNo && m.SupplierLot == noticeDetail.SupplierLot); + //if (qualityRequest == null) + //{ + // //璐ㄦ璇烽獙鍗曚俊鎭� + // string qcNo = new Common().GetMaxNo("QC"); + // qualityRequest = new BllQualityInspectionRequest(); + // qualityRequest.QcNo = qcNo; + // qualityRequest.Status = "0"; + // qualityRequest.SkuNo = noticeDetail.SkuNo; + // qualityRequest.SkuName = noticeDetail.SkuName; + // qualityRequest.LotNo = noticeDetail.LotNo; + // qualityRequest.SupplierLot = noticeDetail.SupplierLot; + // qualityRequest.Qty = noticeDetail.Qty; + // qualityRequest.SamplingQty = 0; + // qualityRequest.ASNNo = noticeDetail.ASNNo; + // qualityRequest.CreateUser = 0; + // qualityRequest.CreateTime = comTime; + + // // 璁板綍浠诲姟鏃ュ織 + // var taskNo = new Common().GetMaxNo("TK"); + // var exTask = new LogTask() + // { + // TaskNo = taskNo, + // Sender = "WMS", + // Receiver = "Limes", + // IsSuccess = 0,//鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛 + // StartLocat = "",//璧峰浣嶇疆 + // PalletNo = "",//鎵樼洏鐮� + // IsSend = 1,//鏄惁鍙啀娆′笅鍙� + // IsCancel = 1,//鏄惁鍙彇娑� + // IsFinish = 1,//鏄惁鍙畬鎴� + // Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚 + // OrderType = "5",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗� 4 鍙栨牱鍑哄簱鍗� 5 鍏朵粬 + // EndLocat = "",//鐩爣浣嶇疆 + // Type = "3",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟 + // Msg = "璇烽獙浠诲姟" + // }; + // // 鎻掑叆浠诲姟鏃ュ織 + // Db.Insertable(exTask).ExecuteCommand(); + + // // 璋冪敤Limes鎺ュ彛鍙戣捣璇烽獙 + // var sendModel = new SendLimesModel() + // { + // QcNo = qualityRequest.QcNo, + // SkuNo = qualityRequest.SkuNo, + // Qty = qualityRequest.Qty.ToString(), + // LotNo = qualityRequest.LotNo, + // SupplierLot = qualityRequest.SupplierLot, + // RequestUser = "", // 璇烽獙浜� + // }; + // var jsonData = JsonConvert.SerializeObject(sendModel); + // string response = ""; + // try + // { + // var time1 = DateTime.Now;//鍙戦�佹椂闂� .ToString("yyyy-MM-dd HH:mm:ss") + // //response = HttpHelper.DoPost(url, jsonData, "涓婁紶Limes绯荤粺鍙戣捣璇烽獙", "Limes"); + // var time2 = DateTime.Now;//杩斿洖鏃堕棿 .ToString("yyyy-MM-dd HH:mm:ss") + + // ////瑙f瀽杩斿洖鏁版嵁 + // //var limesModel = JsonConvert.DeserializeObject<LimesModel>(response); + // List<string> list1 = new List<string>(); + // list1.Add(taskNo); + // //if (limesModel.Success == 0) + // //{ + // //鏇存敼浠诲姟鐨勫彂閫佽繑鍥炴椂闂�// + // new TaskServer().EditTaskIssueOk(list1, time1, time2); + + // // 鏇存柊璇烽獙鍗曚俊鎭� + // qualityRequest.Status = "1"; + // qualityRequest.SamplingQty = 10;//decimal.Parse(limesModel.SamplingQty); + // qualityRequest.RequestUser = 0; + // qualityRequest.RequestTime = DateTime.Now; + // qualityRequest.UpdateTime = DateTime.Now; + // qualityRequest.UpdateUser = 0; + // //娣诲姞璐ㄦ璇烽獙鍗� + // Db.Insertable(qualityRequest).ExecuteCommand(); + // //} + // //if (limesModel.Success == -1) + // //{ + // // new TaskServer().EditTaskIssueNo(list1, time1, time2,limesModel.Message); + // // throw new Exception(limesModel.Message); + // //} + // } + // catch (Exception ex) + // { + // throw new Exception(ex.Message); + // } + //} #endregion break; @@ -388,37 +352,12 @@ #region 鍑哄簱瀹屾垚 case "1": - //鍑哄簱鍗曟槑缁嗕俊鎭� - var exNoticeDetail = Db.Queryable<BllExportNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo); - if (exNoticeDetail == null) - { - resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曟槑缁嗕笉瀛樺湪!"; - return resultModel; - } - //鍑哄簱鍗曚俊鎭� - var exNotice = Db.Queryable<BllExportNotice>().First(w => w.SONo == exNoticeDetail.SONo); - if (exNotice == null) - { - resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曚笉瀛樺湪!"; - return resultModel; - } - if (exNotice.Status == "4" || exNotice.Status == "5") - { - resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曞凡鎵ц瀹屾垚!"; - return resultModel; - } + //璧峰鍌ㄤ綅淇℃伅 var startLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0"); if (startLocatInfo == null) { resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; - return resultModel; - } - //鐩爣鍌ㄤ綅淇℃伅 - var endLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0"); - if (endLocatInfo == null) - { - resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; return resultModel; } //搴撳瓨鏄庣粏 @@ -428,34 +367,16 @@ resultModel.Message = "搴撳瓨淇℃伅涓嶅瓨鍦�!"; return resultModel; } - //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲� - exNoticeDetail.CompleteQty += sd2.Qty; - Db.Updateable(exNoticeDetail).ExecuteCommand(); - - exNotice.UpdateUser = 0; - exNotice.UpdateTime = comTime; - if (exNotice.Status == "0" || exNotice.Status == "1" || exNotice.Status == "2") - { - exNotice.Status = "3";//鏇存敼涓烘鍦ㄦ墽琛� - } - var num = Db.Queryable<BllExportNoticeDetail>().Count(m => m.IsDel == "0" && m.SONo == exNoticeDetail.SONo && m.CompleteQty < m.Qty); - if (num <= 0) - { - exNotice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴� - } - //淇敼鍑哄簱鍗曚俊鎭� - Db.Updateable(exNotice).ExecuteCommand(); - sd2.Qty = 0; sd2.LockQty = 0; sd2.FrozenQty = 0; sd2.InspectQty = 0; sd2.ASNNo = ""; sd2.ASNDetailNo = null; - sd2.WareHouseNo = endLocatInfo.WareHouseNo;//鎵�灞炰粨搴� - sd2.RoadwayNo = endLocatInfo.RoadwayNo;//鎵�灞炲贩閬� - sd2.AreaNo = endLocatInfo.AreaNo;//鎵�灞炲尯鍩� - sd2.LocatNo = endLocatInfo.LocatNo;//鍌ㄤ綅鍦板潃 + sd2.WareHouseNo = "";//鎵�灞炰粨搴� + sd2.RoadwayNo = "";//鎵�灞炲贩閬� + sd2.AreaNo = "";//鎵�灞炲尯鍩� + sd2.LocatNo = "";//鍌ㄤ綅鍦板潃 sd2.CompleteTime = comTime; //淇敼搴撳瓨鏄庣粏 Db.Updateable(sd2).ExecuteCommand(); @@ -463,12 +384,168 @@ startLocatInfo.Status = "0";//绌哄偍浣� //淇敼璧峰鍌ㄤ綅鐘舵�� Db.Updateable(startLocatInfo).ExecuteCommand(); + //鍑哄簱鍗曟槑缁嗕俊鎭� + var exNoticeDetail = Db.Queryable<BllExportNoticeDetail>().First(w => w.Id == taskInfo.NoticeDetailNo); + if (exNoticeDetail != null) + { + //鍑哄簱鍗曚俊鎭� + var exNotice = Db.Queryable<BllExportNotice>().First(w => w.SONo == exNoticeDetail.SONo); + if (exNotice == null) + { + resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曚笉瀛樺湪!"; + return resultModel; + } + if (exNotice.Status == "4" || exNotice.Status == "5") + { + resultModel.Message = "璇ヤ换鍔″搴旂殑鍑哄簱鍗曞凡鎵ц瀹屾垚!"; + return resultModel; + } + exNotice.UpdateUser = 0; + exNotice.UpdateTime = comTime; + if (exNotice.Status == "0" || exNotice.Status == "1" || exNotice.Status == "2") + { + exNotice.Status = "3";//鏇存敼涓烘鍦ㄦ墽琛� + } + var num = Db.Queryable<BllExportNoticeDetail>().Count(m => m.IsDel == "0" && m.SONo == exNoticeDetail.SONo && m.CompleteQty < m.Qty); + if (num <= 0) + { + exNotice.Status = "4"; //鏇存敼涓烘墽琛屽畬鎴� + } + //淇敼鍑哄簱鍗曚俊鎭� + Db.Updateable(exNotice).ExecuteCommand(); - endLocatInfo.Status = "1";//绌哄偍浣� - //淇敼鐩爣鍌ㄤ綅鐘舵�� - Db.Updateable(endLocatInfo).ExecuteCommand(); - + //淇敼鍑哄簱鍗曟槑缁嗘嫞璐ф暟閲� + exNoticeDetail.CompleteQty += sd2.Qty; + Db.Updateable(exNoticeDetail).ExecuteCommand(); + } break; + #endregion + + #region 绉诲簱瀹屾垚 + case "3": + //搴撳瓨鏄庣粏 + var sd3 = Db.Queryable<DataStockDetail>().First(w => w.PalletNo == taskInfo.PalletNo); + if (sd3 == null) + { + resultModel.Message = "搴撳瓨淇℃伅涓嶅瓨鍦�!"; + return resultModel; + } + if (taskInfo.Type == "0")//鍏ュ簱浠诲姟 + { + //鐩爣鍌ㄤ綅淇℃伅 + var endLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0"); + if (endLocatInfo2 == null) + { + resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; + return resultModel; + } + endLocatInfo2.Status = "1";//鏈夌墿鍝� + //淇敼鐩爣鍌ㄤ綅鐘舵�� + Db.Updateable(endLocatInfo2).ExecuteCommand(); + + sd3.WareHouseNo = endLocatInfo2.WareHouseNo;//鎵�灞炰粨搴� + sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//鎵�灞炲贩閬� + sd3.AreaNo = endLocatInfo2.AreaNo;//鎵�灞炲尯鍩� + sd3.LocatNo = endLocatInfo2.LocatNo;//鍌ㄤ綅鍦板潃 + if (endLocatInfo2.AreaNo.Contains("01"))//鍑�妗跺尯 + { + sd3.PalletStatus = "0"; + } + else if (endLocatInfo2.AreaNo.Contains("02"))//棰勬贩鍖� + { + sd3.PalletStatus = "1"; + } + else if (endLocatInfo2.AreaNo.Contains("03"))//鍗婃垚鍝佸尯 + { + sd3.PalletStatus = "2"; + } + else if (endLocatInfo2.AreaNo.Contains("04"))//鑴忔《鍖� + { + sd3.PalletStatus = "3"; + sd3.LotNo = "";//鎵规 + sd3.SkuNo = ""; + sd3.SkuName = ""; + sd3.InspectStatus = "0";//寰呮楠� + } + } + else if (taskInfo.Type == "1")//鍑哄簱浠诲姟 + { + //璧峰鍌ㄤ綅淇℃伅 + var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0"); + if (startLocatInfo2 == null) + { + resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; + return resultModel; + } + startLocatInfo2.Status = "0";//绌哄偍浣� + //淇敼璧峰鍌ㄤ綅鐘舵�� + Db.Updateable(startLocatInfo2).ExecuteCommand(); + + sd3.WareHouseNo = "";//鎵�灞炰粨搴� + sd3.RoadwayNo = "";//鎵�灞炲贩閬� + sd3.AreaNo = "";//鎵�灞炲尯鍩� + sd3.LocatNo = "";//鍌ㄤ綅鍦板潃 + } + else if (taskInfo.Type == "2")//绉诲簱浠诲姟 + { + //璧峰鍌ㄤ綅淇℃伅 + var startLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.StartLocat && w.IsDel == "0"); + if (startLocatInfo2 == null) + { + resultModel.Message = "璧峰鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; + return resultModel; + } + startLocatInfo2.Status = "0";//绌哄偍浣� + //淇敼璧峰鍌ㄤ綅鐘舵�� + Db.Updateable(startLocatInfo2).ExecuteCommand(); + + //鐩爣鍌ㄤ綅淇℃伅 + var endLocatInfo2 = Db.Queryable<SysStorageLocat>().First(w => w.LocatNo == taskInfo.EndLocat && w.IsDel == "0"); + if (endLocatInfo2 == null) + { + resultModel.Message = "鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦�!"; + return resultModel; + } + endLocatInfo2.Status = "1";//鏈夌墿鍝� + //淇敼鐩爣鍌ㄤ綅鐘舵�� + Db.Updateable(endLocatInfo2).ExecuteCommand(); + + sd3.WareHouseNo = endLocatInfo2.WareHouseNo;//鎵�灞炰粨搴� + sd3.RoadwayNo = endLocatInfo2.RoadwayNo;//鎵�灞炲贩閬� + sd3.AreaNo = endLocatInfo2.AreaNo;//鎵�灞炲尯鍩� + sd3.LocatNo = endLocatInfo2.LocatNo;//鍌ㄤ綅鍦板潃 + sd3.Status = "0"; + if (endLocatInfo2.AreaNo.Contains("01"))//娲佸噣鍖� + { + sd3.PalletStatus = "0"; + sd3.Status = "0"; + } + else if (endLocatInfo2.AreaNo.Contains("02"))//棰勬贩鍖� + { + sd3.PalletStatus = "1"; + } + else if (endLocatInfo2.AreaNo.Contains("03"))//鍗婃垚鍝佸尯 + { + sd3.PalletStatus = "2"; + } + else if (endLocatInfo2.AreaNo.Contains("04"))//鑴忔《鍖� + { + sd3.PalletStatus = "3"; + sd3.LotNo = "";//鎵规 + sd3.SkuNo = ""; + sd3.SkuName = ""; + sd3.InspectStatus = "0";//寰呮楠� + } + } + //淇敼搴撳瓨鏄庣粏 + Db.Updateable(sd3).ExecuteCommand(); + + #region 鍘绘帀MES + //鍥炰紶妗剁姸鎬佺粰MES + //BackPalletStatus(taskInfo.PalletNo, sd3.PalletStatus); + #endregion + + break; #endregion } taskInfo.Status = "2";//鎵ц瀹屾垚 @@ -491,11 +568,36 @@ } /// <summary> + /// 鍥炰紶妗剁姸鎬佺粰MES + /// </summary> + /// <param name="PalletNo">妗跺彿</param> + /// <param name="Status">0锛氬噣妗� 1锛氶娣� 2锛氬崐鎴愬搧 3锛氳剰妗�</param> + /// <param name="url"></param> + public void BackPalletStatus(string PalletNo, string Status,string url="") + { + try + { + var obj = new + { + PalletNo = PalletNo, + Status = Status + }; + string jsonReq = JsonConvert.SerializeObject(obj); + var response = HttpHelper.DoPost(url, jsonReq, "鍥炰紶MES妗剁姸鎬�", "MES").ToString(); + var result = JsonConvert.DeserializeObject<ReMes>(response);//瑙f瀽杩斿洖鏁版嵁 + } + catch (Exception ex) + { + throw ex; + } + } + + /// <summary> /// 涓嬪彂鍑哄簱鍗� /// </summary> /// <param name="model"></param> /// <returns></returns> - public SoResInfo ErpAddExportNotice(SoInfo model) + public SoResInfo CreateSoWork(SoInfo model) { try { -- Gitblit v1.8.0