From cb58fdbdc4391136e7176210e3f1969606f11903 Mon Sep 17 00:00:00 2001 From: lss <Lss@HanInfo> Date: 星期四, 29 五月 2025 16:52:21 +0800 Subject: [PATCH] 合肥佳通 --- HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs | 89 +++++++++++++++++++++++++++++++++++++------- 1 files changed, 75 insertions(+), 14 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 8d12ee2..028afc0 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs @@ -11,8 +11,11 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection.Emit; +using System.ServiceModel; using System.Threading; using System.Threading.Tasks; +using System.Web.UI.WebControls; using static HH.WCS.JiaTong.api.ApiModel; using static HH.WCS.JiaTong.api.OtherModel; using static HH.WCS.JiaTong.LISTA.process.HttpModel; @@ -155,6 +158,7 @@ } else if (taskData.taskType == 2)//鍏ュ簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛岃捣鐐归渶瑕佹湁鎵樼洏 { + note = "鍏ュ簱"; startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); if (startloc != null) { @@ -173,12 +177,7 @@ } } - //鍒ゆ柇鏄惁鏄┖鎵樺洖搴�- 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) { @@ -194,8 +193,8 @@ } else if (taskData.taskType == 3)//绉诲簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟锛� { + note = "鍑哄簱"; //鍒涘缓鎵樼洏鐗╂枡缁戝畾淇℃伅锛屽苟璁$畻缁堢偣璐т綅 - startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First(); if (startloc != null) { @@ -388,6 +387,7 @@ //鏆傚瓨浣嶅洖搴� else if (taskData.taskType == 6)//鍏ュ簱娴佺▼锛岀洿鎺ヤ娇鐢ㄨ捣鐐硅揣浣嶅拰缁堢偣璐т綅鐢熸垚浠诲姟 { + note = "鍏ュ簱"; //鏍规嵁鎵樼洏鍙锋壘璐т綅 var CntrRel = db.Queryable<LocCntrRel>().Where(a => a.S_CNTR_CODE == partData.rfid).First(); if (CntrRel != null) @@ -806,6 +806,7 @@ result.msg = $"鏍规嵁璧风偣浠撳簱缂栫爜锛歿startloc.S_WH_CODE}鏈壘鍒板搴旈厤缃枃浠�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } //鍒ゆ柇鏈夋棤鐩稿悓鐗╂枡鎺�@@ -826,6 +827,7 @@ result.msg = $"搴撳尯:{areacode}鏃犲彲鐢ㄨ揣浣�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } } else @@ -835,6 +837,7 @@ result.msg = $"浠诲姟璧风偣:{Start}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); + return result; } #endregion @@ -939,6 +942,7 @@ result.msg = $"鏍规嵁鏈哄彴缂栫爜锛歿model.WorkCenter}鏈壘鍒板搴旇揣浣�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } //鏍规嵁浠撳簱 璁$畻搴撳尯 var whcode = Settings.wareLoc.Where(a => a.AreaCode == locJt.S_WH_CODE).FirstOrDefault(); @@ -973,6 +977,7 @@ result.msg = $"鏍规嵁缁堢偣搴撳尯浠撳簱缂栫爜锛歿locJt.S_WH_CODE}鏈壘鍒板搴旈厤缃枃浠�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } #endregion @@ -991,6 +996,14 @@ { End = Endloc.S_CODE; } + else + { + result.code = "1"; + result.msg = $"Computeloc==銆嬫牴鎹満鍙扮紪鐮侊細{model.WorkCenter},宸ヨ绫诲瀷锛歿cntrType} 鏈壘鍒扮┖璐т綅鏁版嵁锛岃妫�煡璐т綅琛�; + LogHelper.Info($"ItemBack锛歿result.msg}"); + AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; + } } else { @@ -999,6 +1012,7 @@ result.msg = $"浠诲姟鐗╂枡:{itemcode}鎵句笉鍒板搴斿簱瀛�; LogHelper.Info($"ItemBack锛歿result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } #endregion @@ -1192,6 +1206,7 @@ result.msg = $"鏍规嵁璧风偣浠撳簱缂栫爜锛歿startloc.S_WH_CODE}鏈壘鍒板搴旈厤缃枃浠�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } #endregion @@ -1333,11 +1348,12 @@ result.msg = $"鏍规嵁璧风偣浠撳簱缂栫爜锛歿endloc.S_WH_CODE}鏈壘鍒板搴旈厤缃枃浠�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } //璁$畻鍑哄簱鎵樼洏 - startloc = airlift(areacode, itemcode); + startloc = LocationHelper.GetLocByAreacode(areacode); if (startloc != null) { var cntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == startloc.S_CODE).First(); @@ -1365,7 +1381,7 @@ result.msg = $"浠诲姟璧风偣:{End}鎵句笉鍒板搴旇揣浣嶏紝璇锋鏌ヨ揣浣嶈〃"; LogHelper.Info($"callfixture:{result.msg}"); AddErrorInfo("鏌ユ壘璐т綅澶辫触", result.msg, Source); - + return result; } #endregion @@ -1551,7 +1567,8 @@ var EndLocs = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == areacode).ToList(); if (EndLocs.Count > 0) { - loc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); + //loc = EndLocs.Find(a => a.N_CURRENT_NUM == 0 && a.N_LOCK_STATE == 0); + loc = FindEndcolByLocList(EndLocs); if (loc != null) { End = loc.S_CODE; @@ -1598,6 +1615,7 @@ result.msg = $"鏍规嵁璧风偣浠撳簱缂栫爜锛歿startloc.S_WH_CODE}鏈壘鍒板搴旈厤缃枃浠�; LogHelper.Info($"Putin==> {result.msg}"); AddErrorInfo("鏌ユ壘搴撳尯澶辫触", result.msg, Source); + return result; } } @@ -2098,7 +2116,23 @@ } return result; } + internal static DeviceInfoModel Device() + { + DeviceInfoModel device = new DeviceInfoModel(); + + List<DeviceInfos> deviceInfos = new List<DeviceInfos>();//鍙犵洏鏈烘姤閿欎俊鎭�+ AgvInfos gvInfos = new AgvInfos();//agv鎶ラ敊淇℃伅 + //鑾峰彇鍐呭瓨涓彔鐩樻満鐨勬姤閿欎俊鎭�+ foreach (var dpjInfo in DeviceProcess.DpjInfoDirectory) + { + deviceInfos.Add(new DeviceInfos() { Device = dpjInfo.Value.DeviceName, DeviceInfo = dpjInfo.Value.ErrorInfo }); + } + device.DeviceInfos = deviceInfos; + + + return device; + } /// <summary> /// 搴撲綅娓呯┖ @@ -2133,8 +2167,8 @@ if (CntrItem != null) { - LocationHelper.UnBindingLoc(loc, new List<string>() { "cntrcode" }); - // db.Deleteable<LocCntrRel>().Where(it => it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); + LocationHelper.UnBindingLoc(loc, new List<string>() { cntrcode }); + // db.Deleteable<LocCntrRel>().Where(it => it.S_LOC_CODE.Trim() == loc).ExecuteCommand(); db.Deleteable<CntrItemDetail>().Where(it => it.S_CNTR_CODE.Trim() == cntrcode).ExecuteCommand(); } @@ -2297,7 +2331,12 @@ #endregion var loc = LocationHelper.GetLocByItemCode(areacode, itemcode, level); LogHelper.Info($"airlift=>鏍规嵁搴撳尯缂栫爜:{areacode}锛岀墿鏂欑紪鐮�{itemcode},鐗╂枡绛夌骇璁$畻鍑烘湁鎵樼洏璐т綅{JsonConvert.SerializeObject(loc)}"); - result = FindStartcolByLoclist(loc); + // result = FindStartcolByLoclist(loc); + if (loc.Count > 0) + { + result = loc.OrderByDescending(a => a.N_COL).First(); + } + LogHelper.Info($"airlift=>鍙敤璐т綅涓猴細{JsonConvert.SerializeObject(result)}"); return result; } @@ -2415,7 +2454,7 @@ /// </summary> /// <param name="locations"></param> /// <returns></returns> - internal static Location FindEndcolByLocList(List<Location> locations, string itemcode) + internal static Location FindEndcolByLocList(List<Location> locations) { try { @@ -2508,6 +2547,28 @@ } } + + /// <summary> + /// 鑾峰彇瀵瑰簲閿欒缂栫爜鐨勫皬杞︽暟閲�+ /// </summary> + /// <param name="Error1">閿欒鐮�</param> + /// <param name="Error2">閿欒鐮�</param> + /// <param name="faildCode"></param> + /// <returns></returns> + internal static int GetAgvQty(string Error1, string Error2 = "0", string faildCode = "0") + { + try + { + var db = new SqlHelper<HangChaAGV>().GetInstance(); + return db.Queryable<HangChaAGV>().Where(a => a.faildCode == faildCode && a.errCode2 == Error2 && a.agvErrCode == Error1).Count(); + } + catch (Exception) + { + + throw; + } + + } #endregion -- Gitblit v1.9.1