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/wms/WMSHelper.cs | 40 ++++++++++++++++++++++++++++------------ 1 files changed, 28 insertions(+), 12 deletions(-) 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