From f80938e8a03d9343672b4fb3179836b019f6b9d8 Mon Sep 17 00:00:00 2001 From: 海波 张 <2956280567@qq.com> Date: 星期六, 28 六月 2025 21:38:46 +0800 Subject: [PATCH] 0628 --- wms/LocationHelper.cs | 139 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 137 insertions(+), 2 deletions(-) diff --git a/wms/LocationHelper.cs b/wms/LocationHelper.cs index 1ea748e..531baa1 100644 --- a/wms/LocationHelper.cs +++ b/wms/LocationHelper.cs @@ -1,4 +1,5 @@ 锘縰sing HH.WCS.ZhongCeJinTan; +using HH.WCS.ZhongCeJinTan.dispatch; using HH.WCS.ZhongCeJinTan.util; using HH.WCS.ZhongCeJinTan.wms; using Microsoft.Owin; @@ -85,13 +86,14 @@ } + /// <summary> /// 鑾峰彇璐т綅淇℃伅,鍙傛暟搴撳尯缂栧彿 /// </summary> internal static List<string> GetConnectionList(string S_AREA_CODE) { var db = new SqlHelper<object>().GetInstance(); - var ConnectionList = db.Queryable<Location>().Where(s => s.S_AREA_CODE == S_AREA_CODE && s.C_ENABLE == "Y").OrderBy(a => a.N_ROW).OrderBy(a => a.N_COL).ToList(); + var ConnectionList = db.Queryable<Location>().Where(s => s.S_AREA_CODE == S_AREA_CODE && s.C_ENABLE == "Y").OrderBy(a => a.N_ROW).OrderBy(a => a.N_COL).ToList(); List<string> result = new List<string>(); foreach (var item in ConnectionList) { @@ -123,6 +125,25 @@ } /// <summary> + /// 杩斿洖鎺ラ┏浣嶉泦鍚�+ /// </summary> + internal static List<Location> GetConnectionListByst(List<string> locList) + { + var db = new SqlHelper<object>().GetInstance(); + + List<Location> result = new List<Location>(); + + foreach (var item in locList) + { + + var con = LocationHelper.GetLoc(item); + + result.Add(con); + } + return result; + } + + /// <summary> /// 杩斿洖褰撳墠鎺ラ┏浣嶆墽琛屼换鍔℃暟閲� /// </summary> internal static int GetConnectionTaskCount(string connection) @@ -130,7 +151,7 @@ var db = new SqlHelper<object>().GetInstance(); var ConnectionList = 0; - ConnectionList = db.Queryable<WMSTask>().Where(a => (a.S_END_LOC.Contains(connection) || a.S_START_LOC.Contains(connection)) && a.S_B_STATE != "瀹屾垚" && a.S_B_STATE != "鍙栨秷" && a.S_B_STATE != "澶辫触" && a.S_B_STATE != "宸插畬鎴� && a.S_B_STATE != "鏈墽琛�).ToList().Count(); + ConnectionList = db.Queryable<WMSTask>().Where(a => (a.S_END_LOC.Contains(connection) || a.S_START_LOC.Contains(connection)) && a.S_B_STATE != "瀹屾垚" && a.S_B_STATE != "鍙栨秷" && a.S_B_STATE != "澶辫触" && a.S_B_STATE != "宸插畬鎴� ).ToList().Count(); return ConnectionList; } @@ -333,6 +354,88 @@ /// <summary> + /// 鎵剧粓鐐瑰贩閬撳彲鐢ㄧ┖璐т綅闆嗗悎 鍧囪 + /// </summary> + /// <param name="locations"></param> + /// <returns></returns> + internal static List<Location> FindBalanceEndLocList(List<Location> locations, string endArea, string rodway = "") + { + try + { + var db = new SqlHelper<object>().GetInstance(); + Location end = null; + //鏍规嵁缁堢偣璐т綅鎵剧┖闂茶揣浣�+ var rows = locations.Select(a => a.N_ROW).Distinct().ToList(); + + //浣滀笟娴佺▼鐨勫贩閬�+ var xd = new List<string>(); + + List<RoadWayEnable> rowdwa = null; + + if (!string.IsNullOrEmpty(rodway)) + { + xd = rodway.Split('-').ToList(); + rowdwa = db.Queryable<RoadWayEnable>().Where(x => x.areaCode == endArea && x.status == "0" && xd.Contains(x.roadWay)).ToList(); + } + else + { + //鏌ユ壘鍙敤宸烽亾 + rowdwa = db.Queryable<RoadWayEnable>().Where(x => x.areaCode == endArea && x.status == "0").ToList(); + } + + for (int i = 0; i < rows.Count; i++) + { + var rowList = locations.Where(r => r.N_ROW == rows[i]).ToList(); + + var flag = false; + var flag1 = false; + + foreach (var item in rowdwa) + { + if (rowList.Count(a => a.N_ROADWAY.ToString() == item.roadWay) > 0) + { + flag = true; + break; + } + } + + foreach (var item1 in xd) + { + if (rowList.Count(a => a.N_ROADWAY.ToString() != item1) > 0) + { + flag1 = true; + break; + } + } + + if (flag1 || flag) + { + locations.RemoveAll(a => a.N_ROW == rows[i]); + } + + if (rowList.Count(a => a.N_CURRENT_NUM == 0) == 0) + { + locations.RemoveAll(a => a.N_ROW == rows[i]); + } + } + + //瀵绘壘鍧囪 宸烽亾 + var balanceLocList = RoadWayBalance1(locations); + + + + return balanceLocList; + } + catch (Exception) + { + + throw; + } + + } + + + /// <summary> /// 宸烽亾鍧囪 绛栫暐 /// </summary> /// <param name="lstTrueLocation">鍙敤鐨勮揣浣嶄俊鎭暟鎹�/param> @@ -364,6 +467,38 @@ return location_roadray; } + /// <summary> + /// 宸烽亾鍧囪 绛栫暐 + /// </summary> + /// <param name="lstTrueLocation">鍙敤鐨勮揣浣嶄俊鎭暟鎹�/param> + /// <returns>璁$畻鍚庤繑鍥炵殑瀹炰綋</returns> + public static List<Location> RoadWayBalance1(List<Location> lstTrueLocation) + { + //鎸囧畾璁$畻鍚庤繑鍥炵殑瀹炰綋 + List<Location> location_roadray = new List<Location>(); + + //鎸夌収宸烽亾鍒嗙粍 骞惰幏寰楀贩閬撲腑鍙敤璐т綅鐨勬暟鎹�+ //涔嬪悗杩涜鍊掑彊 鎵惧埌鍙敤璐т綅鏈�鐨勫贩閬�+ var v = lstTrueLocation.GroupBy(x => x.N_ROADWAY).Select(g => (new + { + roadWay = g.Key, + qty = g.Count(p => p.S_LOCK_STATE == "鏃�) + })).OrderByDescending(o => o.qty); + + //鍊掑彊鎺掑垪鍚庣殑宸烽亾 寰幆 + foreach (var item in v) + { + //鍙栧緱宸烽亾鍒楄〃涓彲鐢ㄨ揣浣嶆渶澶氱殑宸烽亾 骞惰幏鍙栧贩閬撲腑鎵�湁璐т綅 + var loclist = lstTrueLocation.Where(o => o.N_ROADWAY == item.roadWay).OrderBy(b => b.N_ROW).OrderBy(b=>b.N_COL).ToList(); + + foreach (var item1 in loclist) + { + location_roadray.Add(item1); + } + } + return location_roadray; + } + /// <summary> /// 鎵剧粓鐐瑰彲鐢ㄧ┖璐т綅鎺掗櫎涓嶅彲鐢ㄥ贩閬� -- Gitblit v1.9.1