From adbeeccfcddddbba49718136a1ebb3429ab3b7ae Mon Sep 17 00:00:00 2001 From: lss <Lss@HanInfo> Date: 星期三, 04 六月 2025 08:35:50 +0800 Subject: [PATCH] 电梯流程开发 --- HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/LocationHelper.cs | 37 +++++++++++++++++++++++++++++++++---- 1 files changed, 33 insertions(+), 4 deletions(-) diff --git a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/LocationHelper.cs b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/LocationHelper.cs index 1fbc2fc..ada1f10 100644 --- a/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/LocationHelper.cs +++ b/HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/LocationHelper.cs @@ -3,6 +3,7 @@ using NLog.Fluent; using SqlSugar; using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; @@ -262,7 +263,7 @@ } LogHelper.Info($"GetLocByItemCode=>鏃犱綑鏂�鏌ユ壘鍏ㄩ儴{JsonConvert.SerializeObject(queryable.ToList())}"); - + if (string.IsNullOrEmpty(lev)) { locs = queryable.ToList(); @@ -299,6 +300,34 @@ return loc; } + /// <summary> + /// 鍒嗛厤鐢垫璐т綅 + /// </summary> + /// <returns></returns> + internal static Location GetElevatorLoc() + { + var db = new SqlHelper<object>().GetInstance(); + Location location = new Location(); + //鏌ユ壘鍏ㄩ儴鐢垫锛屽垎閰嶄换鍔℃渶灏戠殑鐢垫 + var devices = Settings.deviceInfos.Where(a => a.deviceType == 2 && a.enable == 1).ToList(); + string[] state = new string[] { "鎵ц涓�, "寮�鍙栬揣", "鍙栬揣瀹屾垚" }; + Dictionary<int, string> dics = new Dictionary<int, string>(); + foreach (var deviceInfo in devices) + { + int mst = db.Queryable<WCSTask>().Where(a => a.S_TYPE.Contains("鐢垫") && state.Contains(a.S_B_STATE)).Count(); + dics.Add(mst, deviceInfo.TN_Location); + } + if (dics.Count > 0) + { + var dic = dics.OrderBy(a => a.Key).First(); + location = db.Queryable<Location>().Where(a => a.S_CODE == dic.Value).First(); + if (location == null) + { + LogHelper.Info($"鏍规嵁璐т綅缂栫爜:{dic.Value},鏈壘鍒板搴旇揣浣�); + } + } + return location; + } /// <summary> /// 鏍规嵁鐗╂枡缂栫爜锛屼粨搴撶紪鐮佽幏鍙栨墭鐩樻暟閲� /// </summary> @@ -478,15 +507,15 @@ } /// <summary> - /// 鏍规嵁璐т綅闆嗗悎鑾峰彇 娌℃湁瀹瑰櫒 娌℃湁閿佺殑璐т綅 + /// 鏍规嵁璐т綅鑾峰彇璐т綅淇℃伅 /// </summary> /// <param name="loc"></param> /// <returns></returns> - internal static List<Location> GetLocListEmptyFree(List<string> loc) + internal static Location GetLocByLoc(string loc) { //1.0 鏌ヨ揣浣嶅鍣ㄨ〃 var db = new SqlHelper<object>().GetInstance(); - var list = db.Queryable<Location>().Where(a => loc.Contains(a.S_CODE) && a.N_CURRENT_NUM == 0 && a.S_LOCK_STATE.Trim() == "鏃�).ToList(); + var list = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == loc).First(); return list; } -- Gitblit v1.9.1