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 |  248 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 162 insertions(+), 86 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 1e6dc8f..5ed6fd0 100644
--- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
+++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
@@ -53,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鎺ュ彛鐗╂枡鍒颁綅锛岀敤澶囨敞鑷姩杩涜鍖哄垎
@@ -85,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}");
@@ -109,6 +118,8 @@
                     AddErrorInfo("鐗╂枡搴撳尯鏈畾涔�, result.msg);
                     return result;
                 }
+
+
                 #endregion
 
                 Location endloc = new Location();
@@ -133,7 +144,7 @@
                             {
                                 result.code = "1";
                                 result.msg = $"鏈哄彴缂栫爜:{taskData.dropStation}锛屾湭鎵惧埌鍙敤璐т綅";
-                                AddErrorInfo("瀵绘壘鍑哄簱璐т綅澶辫触", result.msg);
+                                AddErrorInfo("瀵绘壘鍑哄簱璐т綅澶辫触", result.msg, Source);
                                 return result;
                             }
                         }
@@ -141,16 +152,17 @@
                         {
                             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)//鍏ュ簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛岃捣鐐归渶瑕佹湁鎵樼洏
@@ -168,7 +180,7 @@
                         {
                             result.code = "1";
                             result.msg = $"鏍规嵁璧风偣{Start},鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�;
-                            AddErrorInfo("鎵樼洏鏌ユ壘澶辫触", result.msg);
+                            AddErrorInfo("鎵樼洏鏌ユ壘澶辫触", result.msg, Source);
                             return result;
                         }
 
@@ -188,7 +200,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鏍规嵁缁堢偣{End},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃";
-                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg);
+                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source);
                         return result;
                     }
                 }
@@ -201,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)//鍘熸潗鏂欏簱闇�鍒ゆ柇鏄惁闇�鍒嗛厤鐢垫浠诲姟,鍒涘缓鍒嗘。浠诲姟
@@ -229,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)
@@ -329,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))
@@ -339,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;
                     }
 
@@ -371,7 +411,7 @@
                         {
                             result.code = "1";
                             result.msg = $"鏍规嵁鎵樼洏{partData.rfid},鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�;
-                            AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg);
+                            AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source);
                             return result;
                         }
                     }
@@ -384,7 +424,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鏍规嵁缁堢偣{End},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃";
-                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg);
+                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source);
                         return result;
                     }
                 }
@@ -412,7 +452,7 @@
                             {
                                 result.code = "1";
                                 result.msg = $"缁堢偣搴撳尯锛歿taskData.dropStation}鏃犲彲鐢ㄨ揣浣�;
-                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg);
+                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                 return result;
                             }
 
@@ -421,7 +461,7 @@
                         {
                             result.code = "1";
                             result.msg = $"鏍规嵁缁堢偣搴撳尯锛歿taskData.dropStation},鏈壘鍒板搴旇揣浣�;
-                            AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg);
+                            AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                             return result;
                         }
                     }
@@ -429,7 +469,7 @@
                     {
                         result.code = "1";
                         result.msg = "鍒涘缓鎵樼洏鐗╂枡淇℃伅澶辫触";
-                        AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg);
+                        AddErrorInfo("鍒涘缓鎵樼洏澶辫触", result.msg, Source);
                         return result;
                     }
                 }
@@ -445,7 +485,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鏍规嵁璧风偣:{taskData.pickStation},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃";
-                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg);
+                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source);
                         return result;
                     }
                     endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First();
@@ -457,7 +497,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鏍规嵁缁堢偣:{End},鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃";
-                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg);
+                        AddErrorInfo("璐т綅鏌ユ壘澶辫触", result.msg, Source);
                         return result;
                     }
                 }
@@ -466,7 +506,7 @@
                     LogHelper.Info($"Createtask==> 浠诲姟绫诲瀷鏈夎");
                     result.code = "1";
                     result.msg = "浠诲姟绫诲瀷锛歿taskData.taskType}涓嶅湪瑙勫畾鑼冨洿鍐�;
-                    AddErrorInfo("浠诲姟绫诲瀷閿欒", result.msg);
+                    AddErrorInfo("浠诲姟绫诲瀷閿欒", result.msg, Source);
                 }
                 if (taskData.taskType != 4)
                 {
@@ -602,7 +642,7 @@
                 LogHelper.Info($"AllowThrough==> 鍙傛暟涓簄ull");
                 result.code = "1";
                 result.msg = "鍙傛暟涓簄ull鍊硷紝璇锋鏌ュ弬鏁版牸寮�;
-                AddErrorInfo("鍙傛暟涓虹┖", result.msg);
+                AddErrorInfo("鍙傛暟涓虹┖", result.msg, "", model.task_no);
                 return result;
             }
 
@@ -624,7 +664,7 @@
                 {
                     result.code = "1";
                     result.msg = $"鏍规嵁涓嬪彂浠诲姟鍙穥model.task_no}鏈壘鍒板搴斾换鍔�;
-                    AddErrorInfo("鏈壘鍒颁换鍔�, result.msg);
+                    AddErrorInfo("鏈壘鍒颁换鍔�, result.msg, "", model.task_no);
                     return result;
                 }
                 return result;
@@ -657,7 +697,7 @@
             try
             {
                 //鍒涘缓鎵樼洏鏁版嵁缁戝畾鍏崇郴
-                if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight,model.Qty))
+                if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty))
                 {
                     //鍒涘缓鎴愬姛娴佺▼
                 }
@@ -665,7 +705,7 @@
                 {
                     result.code = "1";
                     result.msg = "浜у嚭淇℃伅涓嬪彂澶辫触锛屾墭鐩樼墿鏂欑粦瀹氬叧绯诲垱寤哄け璐�;
-                    AddErrorInfo("鍒涘缓缁戝畾鍏崇郴澶辫触", result.msg);
+                    AddErrorInfo("鍒涘缓缁戝畾鍏崇郴澶辫触", result.msg, "Mes");
                     return result;
                 }
                 return result;
@@ -690,31 +730,38 @@
         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 鍒ゆ柇鎵樼洏缁戝畾璐т綅鏄惁鍜屼笅鍙戠粦瀹氳捣鐐圭浉鍚�濡傛灉娌$粦瀹氭墭鐩樺垯缁戝畾鎵樼洏
                 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;
                     }
                 }
@@ -781,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
 
@@ -803,7 +852,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鍒涘缓浠诲姟澶辫触锛岃捣鐐�{Start}鏈夐攣";
-                        AddErrorInfo("璐т綅鏈夐攣", result.msg);
+                        AddErrorInfo("璐т綅鏈夐攣", result.msg, Source);
                         return result;
                     }
                     //鍒涘缓wcs浠诲姟
@@ -862,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;
             }
 
@@ -874,6 +928,7 @@
             string Start = "";
             string End = "";
             string CntrCode = "";
+
             string itemcode = model.PartNumber;
             string cntrType = "";
             string areacode = "";
@@ -900,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;
                     }
                 }
@@ -945,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
 
@@ -959,7 +1016,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鍒涘缓浠诲姟澶辫触锛岃捣鐐箋Start}鏈夐攣";
-                        AddErrorInfo("璐т綅鏈夐攣", result.msg);
+                        AddErrorInfo("璐т綅鏈夐攣", result.msg, Source);
                         return result;
                     }
                     //鍒涘缓wcs浠诲姟
@@ -1017,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;
             }
 
@@ -1077,7 +1135,7 @@
                             {
                                 result.code = "1";
                                 result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�;
-                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg);
+                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                 return result;
                             }
                             else
@@ -1087,10 +1145,11 @@
                         }
                         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;
                         }
                     }
@@ -1105,7 +1164,7 @@
                             {
                                 result.code = "1";
                                 result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�;
-                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg);
+                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                 return result;
                             }
                             else
@@ -1118,7 +1177,7 @@
                             LogHelper.Info($"鏍规嵁璐т綅澶囨敞锛氱墖鑳跺爢鍙犱綅,璐т綅浠撳簱:{startloc.S_WH_CODE}锛屾壘涓嶅埌鍙犵洏璐т綅");
                             result.code = "1";
                             result.msg = $"鍙犵洏璐т綅涓嶅彲鐢�;
-                            AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg);
+                            AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source);
                             return result;
                         }
                     }
@@ -1138,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
@@ -1166,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;
                         }
                     }
@@ -1177,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
@@ -1253,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;
             }
 
@@ -1299,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;
                         }
 
@@ -1311,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
@@ -1387,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;
 
             }
@@ -1415,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
@@ -1483,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();
@@ -1501,7 +1570,7 @@
                             {
                                 result.code = "1";
                                 result.msg = $"缁堢偣搴撳尯锛歿areacode}鏃犲彲鐢ㄨ揣浣�;
-                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg);
+                                AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                                 return result;
                             }
 
@@ -1510,7 +1579,7 @@
                         {
                             result.code = "1";
                             result.msg = $"鏍规嵁缁堢偣搴撳尯锛歿areacode},鏈壘鍒板搴旇揣浣�;
-                            AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg);
+                            AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source);
                             return result;
                         }
                         //loc = StorageCompute(itemcode, areacode);
@@ -1525,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;
                 }
 
@@ -1627,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;
 
             }
@@ -1678,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
@@ -1692,7 +1763,7 @@
                 {
                     result.code = "1";
                     result.msg = "鐗╂枡涓绘暟鎹凡瀛樺湪";
-                    AddErrorInfo("鐗╂枡涓绘暟鎹凡瀛樺湪", result.msg);
+                    AddErrorInfo("鐗╂枡涓绘暟鎹凡瀛樺湪", result.msg,Source);
                     return result;
                 }
                 TN_Material itemInfo = new TN_Material();
@@ -1724,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 = ""; //鍙栬揣鐐�@@ -1754,7 +1826,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鍒涘缓浠诲姟澶辫触锛屾牴鎹捣鐐箋model.InitialLocation}鏈壘鍒板搴旇揣浣嶇粦瀹氭墭鐩樻墭鐩�;
-                        AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg);
+                        AddErrorInfo("鏌ユ壘鎵樼洏澶辫触", result.msg, Source);
                         return result;
                     }
                 }
@@ -1832,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;
             }
 
@@ -1856,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;
                     }
 
@@ -1880,7 +1954,7 @@
                     {
                         result.code = "1";
                         result.msg = $"鍒涘缓浠诲姟澶辫触锛屾牴鎹揣浣嶇紪鐮�{dtcode}鏈壘鍒扮數姊揣浣�;
-                        AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg);
+                        AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg,Source);
                         return result;
                     }
 
@@ -1964,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();
@@ -1987,7 +2062,7 @@
                 {
                     result.code = "1";
                     result.msg = $"璐т綅涓婁紶澶辫触锛屾牴鎹揣浣嶇紪鐮亄item.Location}鏈壘鍒板搴旂殑璐т綅淇℃伅";
-                    AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg);
+                    AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source);
                     return result;
                 }
             }
@@ -2018,7 +2093,7 @@
                 LogHelper.Info($"鐗╂枡鍒颁綅鍥炴姤澶辫触=>鍥炴姤鍦板潃娌℃湁閰嶇疆");
                 result.code = "1";
                 result.msg = $"鐗╂枡鍒颁綅鍥炴姤澶辫触=>鍥炴姤鍦板潃娌℃湁閰嶇疆";
-                AddErrorInfo("鍦板潃閿欒", result.msg);
+                AddErrorInfo("鍦板潃閿欒", result.msg, Source);
             }
             return result;
         }
@@ -2032,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;
@@ -2076,7 +2152,7 @@
                 {
                     result.code = "1";
                     result.msg = $"鏍规嵁璐т綅:{loc}鎵句笉鍒拌揣浣嶅叧绯�;
-                    AddErrorInfo("璐т綅涓虹┖", result.msg);
+                    AddErrorInfo("璐т綅涓虹┖", result.msg, Source);
                     return result;
                 }
             }
@@ -2301,7 +2377,7 @@
             {
                 var error = new ErrorInfo
                 {
-                    EEEORMESSAGE = errorInfo,
+                    ERRORMESSAGE = errorInfo,
                     TASKNO = taskno,
                     AREACODE = areacode,
                     REMAKE = remake,

--
Gitblit v1.9.1