From 95c865c03a9cb128af51ac4b7d7f9d7149441efd Mon Sep 17 00:00:00 2001 From: lss <2538410689@qq.com> Date: 星期一, 07 七月 2025 17:30:35 +0800 Subject: [PATCH] agv效率开发 --- HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs | 90 +++++++++++++++++++++++++++++++++++--------- 1 files changed, 71 insertions(+), 19 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 2600909..0f89ebf 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs @@ -187,14 +187,7 @@ } } - //else - //{ - // result.code = "1"; - // result.msg = $"鏍规嵁璧风偣{Start},鏈壘鍒版墭鐩樿揣浣嶇粦瀹氬叧绯�; - // AddErrorInfo("鎵樼洏鏌ユ壘澶辫触", result.msg, Source); - // return result; - //} - + } else { @@ -589,6 +582,15 @@ AddErrorInfo("搴撳尯鏌ユ壘澶辫触", result.msg); return result; } + int pri = 1; + var area = Settings.wareLoc.Where(a => a.AreaCode == endloc.S_WH_CODE).First(); + if (area != null) + { + if (area.XbAreaCodes.Contains(endloc.S_AREA_CODE)) + { + pri = 2; + } + } //鍒涘缓wcs浠诲姟 var wcsTask = new WCSTask { @@ -603,7 +605,7 @@ S_END_AREA = endloc.S_AREA_CODE, N_SCHEDULE_TYPE = 1, S_CNTR_CODE = CntrCode, - N_PRIORITY = taskData.priority, + N_PRIORITY = pri, Z_TYPE = n_type, N_START_LAYER = 1, N_END_LAYER = 1, @@ -768,7 +770,7 @@ { //鍒涘缓鎵樼洏鏁版嵁缁戝畾鍏崇郴 - if (ContainerHelper.CreateCntrItem(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty, model.ProductionTime, model.MaturityTime)) + if (ContainerHelper.CreateCntrItemTray(model.Rfid, model.PartNumber, model.PartDesc, model.LotNumber, model.Weight, model.Qty, model.ProductionTime, model.MaturityTime, model.PowderType)) { //鍒涘缓鎴愬姛娴佺▼ } @@ -961,6 +963,7 @@ S_CNTR_CODE = model.Rfid, N_START_LAYER = 1, N_END_LAYER = 1, + N_PRIORITY = 1, Z_TYPE = n_type }; LogHelper.Info("鍒涘缓鍏ュ钩搴撲换鍔★細" + JsonConvert.SerializeObject(wcsTask)); @@ -1090,7 +1093,7 @@ #region 鏍规嵁鐗╂枡缂栫爜璁$畻鍑哄簱璐т綅锛岄�寰�嚎杈逛綅缃� Location Endloc = null; //鏍规嵁鐗╂枡缂栫爜璁$畻鍑哄簱璐т綅 - var loc = airlift(areacode, itemcode, model.PartLevel); + var loc = airlift(areacode, itemcode, model.PartLevel, model.PowderType); if (loc != null) { Start = loc.S_CODE; @@ -1159,6 +1162,7 @@ S_CNTR_CODE = CntrCode, N_START_LAYER = 1, N_END_LAYER = 1, + N_PRIORITY = 1, Z_TYPE = n_type }; @@ -1418,6 +1422,8 @@ S_CNTR_CODE = model.Rfid, N_START_LAYER = 1, N_END_LAYER = endlayer, + N_PRIORITY = 1, + S_B_STATE="绛夊緟鎺ㄩ�", Z_TYPE = 5 }; LogHelper.Info("鍒涘缓绌烘墭鍥炲簱浠诲姟锛� + JsonConvert.SerializeObject(wcsTask)); @@ -1597,6 +1603,7 @@ N_START_LAYER = 1, N_END_LAYER = 1, Z_TYPE = 5, + N_PRIORITY = 1, S_NOTE = "绮夋枡" }; LogHelper.Info("鍒涘缓鍛煎彨绌烘墭浠诲姟锛� + JsonConvert.SerializeObject(wcsTask)); @@ -1821,6 +1828,7 @@ S_CNTR_CODE = model.Rfid, N_START_LAYER = 1, N_END_LAYER = 1, + N_PRIORITY = 1, Z_TYPE = 5 }; @@ -2072,6 +2080,7 @@ S_CNTR_CODE = CntrCode, N_START_LAYER = 1, N_END_LAYER = 1, + N_PRIORITY = 1, // N_TYPE = n_type @@ -2208,6 +2217,7 @@ S_CNTR_CODE = cntr.S_CNTR_CODE, N_END_LAYER = 1, Z_TYPE = 6, + N_PRIORITY = 1, S_B_STATE = "鐢垫鎺ㄩ�" }; @@ -2288,7 +2298,7 @@ } try { - if (model.prepare=="1") + if (model.prepare == "1") { var db = new SqlHelper<object>().GetInstance(); //淇敼瀵瑰簲鐢垫浠诲姟杩涜鎺ㄩ� @@ -2300,9 +2310,9 @@ result.msg = $"涓�ゼ鐢垫鎼繍浠诲姟鎺ㄩ�澶辫触 prepare{model.prepare}涓嶄负1"; LogHelper.Info(result.msg); return result; - } + } } - catch(Exception ex) + catch (Exception ex) { result.code = "1"; result.msg = $"鐢垫浠诲姟鎺ㄩ�澶辫触 閿欒淇℃伅锛歿ex}"; @@ -2478,10 +2488,9 @@ var location = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); if (location != null) { - var loccntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc).ToList(); + var loccntr = db.Queryable<LocCntrRel>().Where(a => a.S_LOC_CODE.Trim() == loc.Trim()).ToList(); if (loccntr.Count > 0) { - var cntrcodes = loccntr.Select(a => a.S_CNTR_CODE.Trim()).ToList(); if (LocationHelper.Clear(loc, cntrcodes)) { @@ -2665,8 +2674,9 @@ /// <param name="areacode"></param> /// <param name="itemcode"></param> /// <param name="level">鐗╂枡绛夌骇</param> + /// <param name="powderType">鏈哄瀷</param> /// <returns></returns> - internal static Location airlift(string areacode, string itemcode, string level = "") + internal static Location airlift(string areacode, string itemcode, string level, string powderType) { var db = new SqlHelper<object>().GetInstance(); Location result = null; @@ -2723,8 +2733,8 @@ //} #endregion - var loc = LocationHelper.GetLocByItemCode(areacode, itemcode, level); - LogHelper.Info($"airlift=>鏍规嵁搴撳尯缂栫爜:{areacode}锛岀墿鏂欑紪鐮�{itemcode},鐗╂枡绛夌骇璁$畻鍑烘湁鎵樼洏璐т綅{JsonConvert.SerializeObject(loc)}"); + var loc = LocationHelper.GetLocByItemCode(areacode, itemcode, level, powderType); + LogHelper.Info($"airlift=>鏍规嵁搴撳尯缂栫爜:{areacode}锛岀墿鏂欑紪鐮�{itemcode},鏈哄瀷{powderType},鐗╂枡绛夌骇璁$畻鍑烘湁鎵樼洏璐т綅{JsonConvert.SerializeObject(loc)}"); // result = FindStartcolByLoclist(loc); if (loc.Count > 0) { @@ -2859,6 +2869,48 @@ } /// <summary> + /// 鍚堣偉浣抽�鎺ュ彛璋冪敤淇℃伅 + /// </summary> + /// <param name="source">绯荤粺鏉ユ簮</param> + /// <param name="name">鎺ュ彛鍚嶇О</param> + /// <param name="type">璇锋眰鍦板潃绫诲瀷</param> + /// <param name="body">璇锋眰鍙傛暟</param> + /// <param name="url">璇锋眰鍦板潃</param> + /// <param name="err">閿欒淇℃伅</param> + /// <returns></returns> + public static bool AddInfo(string source, string name, string body, string err, string type, string url) + { + bool result = false; + var db = new SqlHelper<object>().GetInstance(); + try + { + var error = new GT_Interface_Exc + { + S_SOURCE = source, + S_NAME = name, + S_TYPE = type, + S_URL = url, + S_BODY = body, + S_ERR = err + }; + if (result = db.Insertable<GT_Interface_Exc>(error).ExecuteCommand() > 0) + { + + } + //else + //{ + // //娣诲姞澶辫触閲嶆柊娣诲姞 + // AddErrorInfo(errorInfo, remake, areacode, taskno); + //} + } + catch (Exception ex) + { + LogHelper.Info($"AddInfo Error:{ex.Message}"); + } + return result; + } + + /// <summary> /// 鎵剧粓鐐圭┖璐т綅 /// </summary> /// <param name="locations"></param> -- Gitblit v1.9.1