From 27aa7a13c64b829eef39fbd67255f1be9155cc12 Mon Sep 17 00:00:00 2001 From: lss <Lss@HanInfo> Date: 星期一, 19 五月 2025 17:17:27 +0800 Subject: [PATCH] 合肥佳通问题优化 --- HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs | 323 ++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 233 insertions(+), 90 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs index a658aa4..5ed6fd0 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs @@ -6,6 +6,7 @@ using HH.WCS.JiaTong.wms; using Newtonsoft.Json; using NLog.Fluent; +using S7.Net; using SqlSugar; using System; using System.Collections.Generic; @@ -52,9 +53,14 @@ try { var db = new SqlHelper<object>().GetInstance(); + string CntrCode = "";//鎵樼洏缂栫爜 + string ItemCode = "";//鐗╂枡缂栫爜 + if (partData != null) + { + CntrCode = partData.rfid;//鎵樼洏缂栫爜 + ItemCode = partData.partNumber;//鐗╂枡缂栫爜 + } string Start = ""; //鍙栬揣鐐�- string CntrCode = partData.rfid;//鎵樼洏缂栫爜 - string ItemCode = partData.partNumber;//鐗╂枡缂栫爜 string End = ""; string areacode = ""; string note = ""; //绔嬪簱涓嬪彂浠诲姟闇�閫氱煡mes鎺ュ彛鐗╂枡鍒颁綅锛岀敤澶囨敞鑷姩杩涜鍖哄垎 @@ -84,20 +90,24 @@ // return result; //} int n_type = 0; //浠诲姟鏉ユ簮 1.閽笣绔嬪簱 2.鑳剁墖搴� 3.棰勫搴�,4.鍘熸潗鏂欏簱,閫氳繃鐗╂枡纭浠诲姟鏉ユ簮 - + string Source = ""; switch (areacode) { case "ML": n_type = 1; + Source = "瀵嗙偧"; break; case "JP": n_type = 2; + Source = "浜曟澗"; break; case "YBK": n_type = 3; + Source = "棰勫搴�; break; case "wmwhse1": n_type = 4; + Source = "鍘熸潗鏂�; break; } LogHelper.Info($"Createtask==>浠诲姟绫诲瀷:{n_type}"); @@ -108,6 +118,8 @@ AddErrorInfo("鐗╂枡搴撳尯鏈畾涔�, result.msg); return result; } + + #endregion Location endloc = new Location(); @@ -132,7 +144,7 @@ { result.code = "1"; result.msg = $"鏈哄彴缂栫爜:{taskData.dropStation}锛屾湭鎵惧埌鍙敤璐т綅"; - AddErrorInfo("瀵绘壘鍑哄簱璐т綅澶辫触", result.msg); + AddErrorInfo("瀵绘壘鍑哄簱璐т綅澶辫触", result.msg, Source); return result; } } @@ -140,19 +152,20 @@ { result.code = "1"; result.msg = "鍒涘缓鎵樼洏鐗╂枡淇℃伅澶辫触"; - AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg); + AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg, Source); return result; } } else { - LogHelper.Info($"Putin==> 浠诲姟璧风偣:{taskData.pickStation}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"); + result.code = "1"; result.msg = $"Putin==> 浠诲姟璧风偣:{taskData.pickStation}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; - AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg); + LogHelper.Info($"Putin==> {result.msg}"); + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); } } - else if (taskData.taskType == 2)//鍏ュ簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟 + else if (taskData.taskType == 2)//鍏ュ簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛岃捣鐐归渶瑕佹湁鎵樼洏 { startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); if (startloc != null) @@ -167,10 +180,16 @@ { result.code = "1"; result.msg = $"鏍规嵁璧风偣{Start},鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�; - AddErrorInfo("鎵樼洏鏌ユ壘澶辫触", result.msg); + AddErrorInfo("鎵樼洏鏌ユ壘澶辫触", result.msg, Source); return result; } + } + //鍒ゆ柇鏄惁鏄┖鎵樺洖搴�+ var CntrItem = db.Queryable<CntrItemDetail>().Where(a => a.S_CNTR_CODE.Trim() == CntrCode).First(); + if (CntrItem == null) + { + note = "绌烘墭鍥炲簱";//浜曟澗绌烘墭鍥炲簱锛岄渶瑕佷笌鍙犵洏鏈哄畨鍏ㄤ氦浜� } endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); if (endloc != null) @@ -181,7 +200,7 @@ { result.code = "1"; result.msg = $"鏍规嵁缁堢偣{End},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; - AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg); + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); return result; } } @@ -194,10 +213,24 @@ { Start = taskData.pickStation; } + else + { + result.code = "1"; + result.msg = $"鏍规嵁璧风偣{taskData.pickStation},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); + return result; + } endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); if (endloc != null) { End = taskData.dropStation; + } + else + { + result.code = "1"; + result.msg = $"鏍规嵁缁堢偣{taskData.dropStation},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); + return result; } } else if (taskData.taskType == 4)//鍘熸潗鏂欏簱闇�鍒ゆ柇鏄惁闇�鍒嗛厤鐢垫浠诲姟,鍒涘缓鍒嗘。浠诲姟 @@ -222,7 +255,7 @@ { result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛岃捣鐐�{startloc.S_AREA_CODE},缁堢偣锛歿endloc.S_AREA_CODE}鏈壘鍒板搴斿簱鍖�; - AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg); + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); return result; } if (startArea.N_FLOOR == endArea.N_FLOOR) @@ -322,7 +355,7 @@ return result; } } - else if (taskData.taskType == 5)//绉诲簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛�+ else if (taskData.taskType == 5)//绉诲簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛屽苟缁戝畾鎵樼洏 { //鍒涘缓鎵樼洏鐗╂枡缁戝畾淇℃伅锛屽苟璁$畻缁堢偣璐т綅 if (CreateCntrIteminfo(taskData.pickStation, CntrCode, ItemCode, partData.partDesc, partData.partType, partData.lotNumber, partData.unit, partData.weight, taskData.carrierType, taskData.grade)) @@ -332,17 +365,31 @@ { Start = taskData.pickStation; } + else + { + result.code = "1"; + result.msg = $"鏍规嵁璧风偣{taskData.pickStation},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); + return result; + } endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); if (endloc != null) { End = taskData.dropStation; + } + else + { + result.code = "1"; + result.msg = $"鏍规嵁缁堢偣{taskData.dropStation},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); + return result; } } else { result.code = "1"; result.msg = "鍒涘缓鎵樼洏鐗╂枡淇℃伅澶辫触"; - AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg); + AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg, Source); return result; } @@ -364,7 +411,7 @@ { result.code = "1"; result.msg = $"鏍规嵁鎵樼洏{partData.rfid},鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�; - AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg); + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); return result; } } @@ -377,7 +424,7 @@ { result.code = "1"; result.msg = $"鏍规嵁缁堢偣{End},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; - AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg); + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); return result; } } @@ -405,7 +452,7 @@ { result.code = "1"; result.msg = $"缁堢偣搴撳尯锛歿taskData.dropStation}鏃犲彲鐢ㄨ揣浣�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); return result; } @@ -414,7 +461,7 @@ { result.code = "1"; result.msg = $"鏍规嵁缁堢偣搴撳尯锛歿taskData.dropStation},鏈壘鍒板搴旇揣浣�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); return result; } } @@ -422,7 +469,35 @@ { result.code = "1"; result.msg = "鍒涘缓鎵樼洏鐗╂枡淇℃伅澶辫触"; - AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg); + AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg, Source); + return result; + } + } + else if (taskData.taskType == 8)//鍙犵洏鏈虹┖鎵樺洖搴�+ { + note = "绌烘墭鍥炲簱";//浜曟澗绌烘墭鍥炲簱锛岄渶瑕佷笌鍙犵洏鏈哄畨鍏ㄤ氦浜�+ startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); + if (startloc != null) + { + Start = startloc.S_CODE; + } + else + { + result.code = "1"; + result.msg = $"鏍规嵁璧风偣:{taskData.pickStation},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); + return result; + } + endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First(); + if (endloc != null) + { + End = taskData.dropStation; + } + else + { + result.code = "1"; + result.msg = $"鏍规嵁缁堢偣:{End},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; + AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source); return result; } } @@ -431,7 +506,7 @@ LogHelper.Info($"Createtask==> 浠诲姟绫诲瀷鏈夎"); result.code = "1"; result.msg = "浠诲姟绫诲瀷锛歿taskData.taskType}涓嶅湪瑙勫畾鑼冨洿鍐�; - AddErrorInfo("浠诲姟绫诲瀷閿欒", result.msg); + AddErrorInfo("浠诲姟绫诲瀷閿欒", result.msg, Source); } if (taskData.taskType != 4) { @@ -507,6 +582,8 @@ } + + /// <summary> /// 棰勫搴撲换鍔$姸鎬佷笅鍙� /// </summary> @@ -565,7 +642,7 @@ LogHelper.Info($"AllowThrough==> 鍙傛暟涓簄ull"); result.code = "1"; result.msg = "鍙傛暟涓簄ull鍊硷紝璇锋鏌ュ弬鏁版牸寮�; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, "", model.task_no); return result; } @@ -587,7 +664,7 @@ { result.code = "1"; result.msg = $"鏍规嵁涓嬪彂浠诲姟鍙穥model.task_no}鏈壘鍒板搴斾换鍔�; - AddErrorInfo("鏈壘鍒颁换鍔�, result.msg); + AddErrorInfo("鏈壘鍒颁换鍔�, result.msg, "", model.task_no); return result; } return result; @@ -620,7 +697,7 @@ try { //鍒涘缓鎵樼洏鏁版嵁缁戝畾鍏崇郴 - if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight)) + if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty)) { //鍒涘缓鎴愬姛娴佺▼ } @@ -628,7 +705,7 @@ { result.code = "1"; result.msg = "浜у嚭淇℃伅涓嬪彂澶辫触锛屾墭鐩樼墿鏂欑粦瀹氬叧绯诲垱寤哄け璐�; - AddErrorInfo("鍒涘缓缁戝畾鍏崇郴澶辫触", result.msg); + AddErrorInfo("鍒涘缓缁戝畾鍏崇郴澶辫触", result.msg, "Mes"); return result; } return result; @@ -653,40 +730,49 @@ internal static Result Putin(Putin model, int n_type) { Result result = new Result() { code = "200", msg = "鍏ュ钩搴撲换鍔′笅鍙戞垚鍔� }; + string Source = "Mes"; + if (n_type == 0) + { + Source = "PDA"; + } if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } var db = new SqlHelper<object>().GetInstance(); Location loc = new Location(); + string Start = model.InitialLocation; //璧风偣璐т綅 string itemcode = model.PartNumber; //鐗╂枡缂栫爜 string areacode = ""; try { - #region 鍒ゆ柇鎵樼洏缁戝畾璐т綅鏄惁鍜屼笅鍙戠粦瀹氳捣鐐圭浉鍚�+ + #region 鍒ゆ柇鎵樼洏缁戝畾璐т綅鏄惁鍜屼笅鍙戠粦瀹氳捣鐐圭浉鍚�濡傛灉娌$粦瀹氭墭鐩樺垯缁戝畾鎵樼洏 var CntrLoc = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE.Trim() == model.Rfid).First(); if (CntrLoc != null) { if (CntrLoc.S_LOC_CODE != Start) { - LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鎵樼洏:{model.Rfid}缁戝畾浣嶇疆涓嶆槸璧风偣锛歿Start}"); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾墭鐩�{model.Rfid}缁戝畾浣嶇疆涓嶆槸璧风偣锛歿Start}"; - AddErrorInfo("鎵樼洏缁戝畾浣嶇疆涓嶅悓", result.msg); + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鎵樼洏缁戝畾浣嶇疆涓嶅悓", result.msg, Source); return result; } } else { - LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鎵樼洏:{model.Rfid}鏈壘鍒扮粦瀹氳揣浣�); - result.code = "1"; - result.msg = $"鍒涘缓浠诲姟澶辫触锛屾墭鐩�{model.Rfid}鏈壘鍒扮粦瀹氳揣浣�; - AddErrorInfo("鏌ユ壘鎵樼洏璐т綅澶辫触", result.msg); - return result; + LocationHelper.BindingLoc(Start, new List<string> { model.Rfid }); + //LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鎵樼洏:{model.Rfid}鏈壘鍒扮粦瀹氳揣浣�); + //result.code = "1"; + //result.msg = $"鍒涘缓浠诲姟澶辫触锛屾墭鐩�{model.Rfid}鏈壘鍒扮粦瀹氳揣浣�; + //AddErrorInfo("鏌ユ壘鎵樼洏璐т綅澶辫触", result.msg); + //return result; } // Console.WriteLine("鏌ヨ璐т綅缁戝畾鍏崇郴"); //鍒ゆ柇鎵樼洏涓庤揣浣嶆槸鍚︽湁缁戝畾鍏崇郴锛屽鏋滄病鏈夊垯杩涜缁戝畾 @@ -712,7 +798,6 @@ //} #endregion - #region 鏍规嵁璧风偣璐т綅鐨勪粨搴撶紪鐮�鑾峰彇骞冲簱缂栫爜,骞惰绠楀叆搴撹揣浣� string End = ""; @@ -743,18 +828,20 @@ } else { - LogHelper.Info($"Putin==>搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�); + result.code = "1"; result.msg = $"搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + LogHelper.Info($"Putin==> {result.msg}"); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); } } else { - LogHelper.Info($"Putin==> 浠诲姟璧风偣:{Start}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"); + result.code = "1"; result.msg = $"浠诲姟璧风偣:{Start}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + LogHelper.Info($"Putin==> {result.msg}"); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); } #endregion @@ -765,7 +852,7 @@ { result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛岃捣鐐�{Start}鏈夐攣"; - AddErrorInfo("璐т綅鏈夐攣", result.msg); + AddErrorInfo("璐т綅鏈夐攣", result.msg, Source); return result; } //鍒涘缓wcs浠诲姟 @@ -802,6 +889,7 @@ return result; } #endregion + return result; } catch (Exception ex) @@ -823,11 +911,16 @@ internal static Result PutOut(PutOut model, int n_type) { Result result = new Result() { code = "200", msg = "鍑哄钩搴撲换鍔′笅鍙戞垚鍔� }; + string Source = "Mes"; + if (n_type == 0) + { + Source = "PDA"; + } if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } @@ -835,6 +928,7 @@ string Start = ""; string End = ""; string CntrCode = ""; + string itemcode = model.PartNumber; string cntrType = ""; string areacode = ""; @@ -861,10 +955,11 @@ } else { - LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鐗╂枡鍙穥model.PartNumber}涓嶅睘浜庤瀹氱墿鏂�); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛岀墿鏂欏彿{model.PartNumber}涓嶅睘浜庤瀹氱墿鏂�; - AddErrorInfo("鐗╂枡缂栫爜鏍煎紡閿欒", result.msg); + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鐗╂枡缂栫爜鏍煎紡閿欒", result.msg, Source); return result; } } @@ -906,10 +1001,11 @@ } else { - LogHelper.Info($"PutOut==> 浠诲姟鐗╂枡:{itemcode}鎵句笉鍒板搴斿簱瀛�); + result.code = "1"; result.msg = $"浠诲姟鐗╂枡:{itemcode}鎵句笉鍒板搴斿簱瀛�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); } #endregion @@ -920,7 +1016,7 @@ { result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛岃捣鐐箋Start}鏈夐攣"; - AddErrorInfo("璐т綅鏈夐攣", result.msg); + AddErrorInfo("璐т綅鏈夐攣", result.msg, Source); return result; } //鍒涘缓wcs浠诲姟 @@ -978,11 +1074,12 @@ internal static Result Empty(Empty model) { Result result = new Result() { code = "200", msg = "绌哄伐瑁呭洖搴撲换鍔′笅鍙戞垚鍔� }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } @@ -1032,13 +1129,13 @@ var dploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "鍙犵洏" && a.N_LAYER == startloc.N_LAYER && a.S_WH_CODE.Trim() == startloc.S_WH_CODE).ToList(); if (dploc.Count > 0) { - LogHelper.Info($"鑾峰彇鍙犵洏璐т綅:{JsonConvert.SerializeObject(dploc)}"); + // LogHelper.Info($"鑾峰彇鍙犵洏璐т綅:{JsonConvert.SerializeObject(dploc)}"); loc = dploc.FindAll(a => a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM < 6).OrderByDescending(a => a.N_CURRENT_NUM).FirstOrDefault(); if (loc == null) { result.code = "1"; result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); return result; } else @@ -1048,10 +1145,39 @@ } else { - LogHelper.Info($"鏍规嵁璐т綅澶囨敞锛氬彔鐩橈紝璐т綅妤煎眰:{startloc.N_LAYER},璐т綅浠撳簱:{startloc.S_WH_CODE}锛屾壘涓嶅埌鍙犵洏璐т綅"); + result.code = "1"; result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + LogHelper.Info($"鏍规嵁璐т綅澶囨敞锛氬彔鐩橈紝璐т綅妤煎眰:{startloc.N_LAYER},璐т綅浠撳簱:{startloc.S_WH_CODE}锛屾壘涓嶅埌鍙犵洏璐т綅"); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); + return result; + } + } + else if (startloc.S_NOTE == "PM") + { + //鎵惧潡鑳跺爢鍙犲尯 + var KjDploc = db.Queryable<Location>().Where(a => a.S_NOTE.Trim() == "鐗囪兌鍫嗗彔浣� && a.S_WH_CODE.Trim() == startloc.S_WH_CODE).ToList(); + if (KjDploc.Count > 0) + { + loc = KjDploc.FindAll(a => a.N_LOCK_STATE == 0 && a.N_CURRENT_NUM < 6).OrderByDescending(a => a.N_CURRENT_NUM).FirstOrDefault(); + if (loc == null) + { + result.code = "1"; + result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�; + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; + } + else + { + endlayer = loc.N_CURRENT_NUM + 1; + } + } + else + { + LogHelper.Info($"鏍规嵁璐т綅澶囨敞锛氱墖鑳跺爢鍙犱綅,璐т綅浠撳簱:{startloc.S_WH_CODE}锛屾壘涓嶅埌鍙犵洏璐т綅"); + result.code = "1"; + result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�; + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); return result; } } @@ -1071,18 +1197,20 @@ } else { - LogHelper.Info($"鍒涘缓浠诲姟澶辫触锛屾牴鎹墭鐩樼紪鐮亄model.Rfid}鏈壘鍒版墭鐩樺嚭搴撲换鍔�); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾牴鎹墭鐩樼紪鐮亄model.Rfid}鏈壘鍒版墭鐩樺嚭搴撲换鍔�; - AddErrorInfo("鏌ユ壘浠诲姟澶辫触", result.msg); + LogHelper.Info($"{result.msg}"); + AddErrorInfo("鏌ユ壘浠诲姟澶辫触", result.msg, Source); return result; } if (string.IsNullOrEmpty(areacode)) { - LogHelper.Info($"鍒涘缓浠诲姟澶辫触锛屾牴鎹墭鐩樼紪鐮亄model.Rfid}鎵惧埌鍑哄簱浠诲姟{mst.S_CODE}鐨勮捣鐐瑰簱鍖轰负绌�); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾牴鎹墭鐩樼紪鐮亄model.Rfid}鎵惧埌鍑哄簱浠诲姟{mst.S_CODE}鐨勮捣鐐瑰簱鍖轰负绌�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + LogHelper.Info($"{result.msg}"); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); return result; } #endregion @@ -1099,10 +1227,11 @@ } else { - LogHelper.Info($"搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�); + result.code = "1"; result.msg = $"搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + LogHelper.Info($"{result.msg}"); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); return result; } } @@ -1110,10 +1239,11 @@ } else { - LogHelper.Info($"Empty==> 浠诲姟璧风偣:{Start}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"); + result.code = "1"; result.msg = $"Empty==> 浠诲姟璧风偣:{Start}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + LogHelper.Info($"{result.msg}"); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); return result; } #endregion @@ -1186,11 +1316,12 @@ { var db = new SqlHelper<object>().GetInstance(); Result result = new Result() { code = "200", msg = "绌哄伐瑁呭懠鍙换鍔′笅鍙戞垚鍔� }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } @@ -1232,10 +1363,10 @@ } else { - LogHelper.Info($"callfixture:鍒涘缓绌哄伐瑁呭懠鍙换鍔�=>鏍规嵁璐т綅{endloc.S_CODE}鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�); result.code = "1"; result.msg = $"鍒涘缓绌哄伐瑁呭懠鍙换鍔�=>鏍规嵁璐т綅{endloc.S_CODE}鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�; - AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg); + LogHelper.Info($"callfixture:{result.msg}"); + AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg, Source); return result; } @@ -1244,10 +1375,11 @@ } else { - LogHelper.Info($"callfixture==> 浠诲姟璧风偣:{End}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"); + result.code = "1"; result.msg = $"浠诲姟璧风偣:{End}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + LogHelper.Info($"callfixture:{result.msg}"); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); } #endregion @@ -1320,11 +1452,12 @@ internal static Result ItemBack(ItemBack model) { Result result = new Result() { code = "200", msg = "浣欐枡杩斿洖浠诲姟涓嬪彂鎴愬姛" }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } @@ -1348,19 +1481,21 @@ { if (CntrLoc.S_LOC_CODE != Start) { - LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鎵樼洏:{model.Rfid}缁戝畾浣嶇疆涓嶆槸璧风偣锛歿Start}"); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾墭鐩�{model.Rfid}缁戝畾浣嶇疆涓嶆槸璧风偣锛歿Start}"; - AddErrorInfo("鎵樼洏缁戝畾浣嶇疆涓嶅悓", result.msg); + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鎵樼洏缁戝畾浣嶇疆涓嶅悓", result.msg, Source); return result; } } else { - LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鎵樼洏:{model.Rfid}鏈壘鍒扮粦瀹氳揣浣�); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾墭鐩�{model.Rfid}鏈壘鍒扮粦瀹氳揣浣�; - AddErrorInfo("鏌ユ壘鎵樼洏璐т綅澶辫触", result.msg); + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鏌ユ壘鎵樼洏璐т綅澶辫触", result.msg, Source); return result; } #endregion @@ -1416,10 +1551,11 @@ } else { - LogHelper.Info($"ItemBack锛氬垱寤轰换鍔″け璐ワ紝鐗╂枡鍙穥model.PartNumber}涓嶅睘浜庤瀹氱墿鏂�); + result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛岀墿鏂欏彿{model.PartNumber}涓嶅睘浜庤瀹氱墿鏂�; - AddErrorInfo("鐗╂枡缂栫爜鏍煎紡閿欒", result.msg); + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鐗╂枡缂栫爜鏍煎紡閿欒", result.msg, Source); return result; } var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areacode).ToList(); @@ -1434,7 +1570,7 @@ { result.code = "1"; result.msg = $"缁堢偣搴撳尯锛歿areacode}鏃犲彲鐢ㄨ揣浣�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); return result; } @@ -1443,7 +1579,7 @@ { result.code = "1"; result.msg = $"鏍规嵁缁堢偣搴撳尯锛歿areacode},鏈壘鍒板搴旇揣浣�; - AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); return result; } //loc = StorageCompute(itemcode, areacode); @@ -1458,19 +1594,19 @@ } else { - LogHelper.Info($"搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�); + result.code = "1"; result.msg = $"搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); return result; } } else { - LogHelper.Info($"璐т綅:{Start}鎵句笉鍒板搴旇揣浣�); + result.code = "1"; result.msg = $"璐т綅:{Start}鎵句笉鍒板搴旇揣浣�; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); return result; } @@ -1560,11 +1696,12 @@ msg = "绾胯竟搴撳瓨鏌ヨ鎴愬姛" }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } @@ -1611,11 +1748,12 @@ internal static Result add(add model) { Result result = new Result() { code = "200", msg = "鐗╂枡涓绘暟鎹垱寤烘垚鍔� }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg,Source); return result; } try @@ -1625,7 +1763,7 @@ { result.code = "1"; result.msg = "鐗╂枡涓绘暟鎹凡瀛樺湪"; - AddErrorInfo("鐗╂枡涓绘暟鎹凡瀛樺湪", result.msg); + AddErrorInfo("鐗╂枡涓绘暟鎹凡瀛樺湪", result.msg,Source); return result; } TN_Material itemInfo = new TN_Material(); @@ -1657,11 +1795,12 @@ internal static Result CreatTask(CreatTask model) { Result result = new Result() { code = "200", msg = "鐐瑰鐐逛换鍔″垱寤烘垚鍔� }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } string Start = ""; //鍙栬揣鐐�@@ -1687,7 +1826,7 @@ { result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾牴鎹捣鐐箋model.InitialLocation}鏈壘鍒板搴旇揣浣嶇粦瀹氭墭鐩樻墭鐩�; - AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg); + AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg, Source); return result; } } @@ -1765,11 +1904,12 @@ internal static Result CreatelevatorTask(Elevator model) { Result result = new Result() { code = "200", msg = "鐐瑰鐐逛换鍔″垱寤烘垚鍔� }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg,Source); return result; } @@ -1789,17 +1929,18 @@ { result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛岃捣鐐箋startloc.S_CODE}鏈夐攣"; - AddErrorInfo("璐т綅鏈夐攣", result.msg); + AddErrorInfo("璐т綅鏈夐攣", result.msg,Source); return result; } var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First(); if (cntr == null) { - LogHelper.Info($"callfixture:鍒涘缓绌哄伐瑁呭懠鍙换鍔�=>鏍规嵁璐т綅{endloc.S_CODE}鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�); + result.code = "1"; result.msg = $"璧风偣{model.Data.start_loc_code}鏈煡璇㈢粦瀹氭墭鐩�; - AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg); + LogHelper.Info($"callfixture:鍒涘缓绌哄伐瑁呭懠鍙换鍔�=>{result.msg}"); + AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg, Source); return result; } @@ -1813,7 +1954,7 @@ { result.code = "1"; result.msg = $"鍒涘缓浠诲姟澶辫触锛屾牴鎹揣浣嶇紪鐮�{dtcode}鏈壘鍒扮數姊揣浣�; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg,Source); return result; } @@ -1897,6 +2038,7 @@ { Result result = new Result() { code = "200", msg = "璐т綅淇℃伅涓婁紶鎴愬姛" }; + String Source = "MES"; RequestList<UploadLoc> result1 = new RequestList<UploadLoc>(); List<UploadLoc> listuploadloc = new List<UploadLoc>(); var db = new SqlHelper<object>().GetInstance(); @@ -1920,7 +2062,7 @@ { result.code = "1"; result.msg = $"璐т綅涓婁紶澶辫触锛屾牴鎹揣浣嶇紪鐮亄item.Location}鏈壘鍒板搴旂殑璐т綅淇℃伅"; - AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg); + AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); return result; } } @@ -1951,7 +2093,7 @@ LogHelper.Info($"鐗╂枡鍒颁綅鍥炴姤澶辫触=>鍥炴姤鍦板潃娌℃湁閰嶇疆"); result.code = "1"; result.msg = $"鐗╂枡鍒颁綅鍥炴姤澶辫触=>鍥炴姤鍦板潃娌℃湁閰嶇疆"; - AddErrorInfo("鍦板潃閿欒", result.msg); + AddErrorInfo("鍦板潃閿欒", result.msg, Source); } return result; } @@ -1965,11 +2107,12 @@ internal static Result ClearLoc(ClearTask model) { Result result = new Result() { code = "200", msg = "搴撲綅娓呴櫎鎴愬姛" }; + string Source = "MES"; if (model == null) { result.code = "1"; result.msg = "鍙傛暟涓簄ull"; - AddErrorInfo("鍙傛暟涓虹┖", result.msg); + AddErrorInfo("鍙傛暟涓虹┖", result.msg, Source); return result; } string loc = model.LocationNum; @@ -2009,7 +2152,7 @@ { result.code = "1"; result.msg = $"鏍规嵁璐т綅:{loc}鎵句笉鍒拌揣浣嶅叧绯�; - AddErrorInfo("璐т綅涓虹┖", result.msg); + AddErrorInfo("璐т綅涓虹┖", result.msg, Source); return result; } } @@ -2234,7 +2377,7 @@ { var error = new ErrorInfo { - EEEORMESSAGE = errorInfo, + ERRORMESSAGE = errorInfo, TASKNO = taskno, AREACODE = areacode, REMAKE = remake, -- Gitblit v1.9.1