From 91443c26b77da527c0dfc4d6c3e45e349e581ecf Mon Sep 17 00:00:00 2001 From: 杨前锦 <1010338399@qq.com> Date: 星期四, 15 五月 2025 17:23:06 +0800 Subject: [PATCH] 印尼佳通人工出入库问题修复 --- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs | 27 ++----------- HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs | 2 HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs | 40 ++++++++++++++------ 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs index bc50dfc..cb0e21e 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/api/ApiHelper.cs @@ -506,7 +506,7 @@ ReturnResult result = new ReturnResult(); try { - Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode , model.endLoc); + Location startLoc = WMSHelper.GetoutStockStartLoc(model.itemCode,model.trayCode , model.endLoc); Location endLoc = LocationHelper.GetLoc(model.endLoc); if (startLoc != null) @@ -777,27 +777,9 @@ ReturnResult result = new ReturnResult(); try { - Location startLoc = LocationHelper.GetLoc(Settings.baseTrayInBufferLoc); + Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0, 1); Location endLoc = LocationHelper.GetLoc(loc); var agvJBLoc = Settings.getAgvJBLoc(loc); - - if (startLoc != null && startLoc.N_CURRENT_NUM == 1 && agvJBLoc.type == 1) - { - var locCntrRels = LocationHelper.GetLocCntrRel(startLoc.S_CODE); - if (locCntrRels.Count > 0) - { - var container = ContainerHelper.GetCntr(locCntrRels[0].S_CNTR_CODE); - if (container.N_TYPE != 0) - { - startLoc = null; - } - } - } - - if(startLoc == null || startLoc.N_CURRENT_NUM != 1) - { - startLoc = WMSHelper.GetEmptyTrayStartLoc(0); - } if (startLoc != null) { @@ -885,7 +867,7 @@ var mst = WMSHelper.GetWmsTask(wmsTaskNo); if (mst != null && mst.N_B_STATE < 2) { - Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0); + Location startLoc = WMSHelper.GetEmptyTrayStartLoc(0,0); Location endLoc = LocationHelper.GetLoc(loc); if (startLoc != null) @@ -1004,7 +986,7 @@ if(mst.N_B_STATE != 2) { // 鍒涘缓涓嬩釜浠诲姟 - if (cst.S_TYPE.Contains("鍑哄簱") && !cst.S_TYPE.Contains("姣嶆嫋")) + if (cst.S_TYPE.Contains("鍑哄簱") && !cst.S_TYPE.Contains("姣嶆嫋") && !cst.S_TYPE.Contains("浜哄伐")) { WCSCore.createLastTask(cst.S_END_LOC, mst, 2); } @@ -1290,6 +1272,7 @@ public class CreateOutOrderModel { public string taskNo { get; set; } // 浠诲姟鍙�+ public string trayCode { get; set; } // 浠诲姟鍙� public string itemCode { get; set; } // 鐗╂枡缂栫爜 public string endLoc { get; set; } // 缁堢偣璐т綅 public int priority { get; set; } = 0; // 浼樺厛绾�榛樿0 diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs index dedb372..ff5032e 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/core/Monitor.cs @@ -33,7 +33,7 @@ var cst = WCSHelper.GetTaskByStartAndEnd(endLoc.S_CODE); if (cst == null) { - ApiHelper.baseTrayOutStock(endLoc.S_CODE, null); + ApiHelper.baseTrayOutStockAgv(endLoc.S_CODE, null); } } } diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs index cefdf93..f3dcc70 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.YNJT_BZP/wms/WMSHelper.cs @@ -419,25 +419,35 @@ return result; } - /// <summary> - /// 鑾峰彇绌烘墭寮�璐т綅 - /// </summary> - /// <param name="trayType"></param> - /// <returns></returns> - public static Location GetEmptyTrayStartLoc(int trayType) + /// <summary> + /// 鑾峰彇绌烘墭寮�璐т綅 + /// </summary> + /// <param name="trayType"></param> + /// <param name="exclude">鏄惁鎺掗櫎姣嶆嫋缂撳瓨浣�0.涓嶆帓闄�1.鎺掗櫎</param> + /// <returns></returns> + public static Location GetEmptyTrayStartLoc(int trayType ,int exclude = 1) { Location result = null; try { // 1銆佹煡璇㈠綋鍓嶅簱鍖�鎺�鐗╂枡 鏈夋墭鐩樼殑璐т綅 var db = new SqlHelper<object>().GetInstance(); - result = db.Queryable<Location>() + var query = db.Queryable<Location>() .LeftJoin<LocCntrRel>((a, b) => a.S_CODE == b.S_LOC_CODE) .LeftJoin<Container>((a, b, c) => b.S_CNTR_CODE == c.S_CODE) - .LeftJoin<CntrItemRel>((a,b,c,d) => c.S_CODE == d.S_CNTR_CODE) - .Where((a, b, c, d) => a.S_AREA_CODE == Settings.storeAreaCode && (trayType == 0 && a.N_CURRENT_NUM == 1 || trayType > 0 && a.N_CURRENT_NUM > 0) && a.N_LOCK_STATE == 0 && (a.C_ENABLE != "绂佺敤" && a.C_ENABLE != "N") && c.N_TYPE == trayType && d.S_ITEM_CODE == null) - .OrderByDescending((a, b, c, d) => a.N_LAYER) - .First(); + .LeftJoin<CntrItemRel>((a, b, c, d) => c.S_CODE == d.S_CNTR_CODE) + .Where((a, b, c, d) => a.S_AREA_CODE == Settings.storeAreaCode && (trayType == 0 && a.N_CURRENT_NUM == 1 || trayType > 0 && a.N_CURRENT_NUM > 0) && a.N_LOCK_STATE == 0 && (a.C_ENABLE != "绂佺敤" && a.C_ENABLE != "N") && c.N_TYPE == trayType && d.S_ITEM_CODE == null); + + if (exclude == 1) + { + query = query.Where((a, b, c, d) => a.S_CODE != Settings.baseTrayInBufferLoc); + } + else + { + query = query.OrderByDescending((a, b, c, d) => a.S_CODE == Settings.baseTrayInBufferLoc); + } + + result = query.OrderByDescending((a, b, c, d) => a.N_LAYER).First(); } catch (Exception ex) { @@ -488,8 +498,9 @@ /// </summary> /// <param name="itemCode"></param> /// <param name="jbLoc"></param> + /// <param name="trayCode"></param> /// <returns></returns> - public static Location GetoutStockStartLoc(string itemCode ,string jbLoc = null) + public static Location GetoutStockStartLoc(string itemCode ,string trayCode = null ,string jbLoc = null) { LogHelper.Info("銆愯幏鍙栧嚭搴撳紑濮嬭揣浣嶃�", "WMS"); var db = new SqlHelper<object>().GetInstance(); @@ -511,6 +522,11 @@ && c.S_EXPIRATION_TIME != null ); + if (trayCode != null) + { + query = query.Where((a, b, c) => c.S_CNTR_CODE == trayCode); + } + if (jbLoc != null) { List<int> roadwayList = new List<int>(); -- Gitblit v1.9.1