From ce50ae86a0120433c1bc0728223294acfd77dda4 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周五, 13 12月 2024 09:32:23 +0800 Subject: [PATCH] 222 --- CC/iWareCC_ASRS/ThreadService/01_BZ01工位(清灰,洗板后工位)/DataProcess_BZ01.cs | 183 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 182 insertions(+), 1 deletions(-) diff --git "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" index 0697162..48372aa 100644 --- "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" +++ "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" @@ -93,6 +93,64 @@ continue; } + //澧炲姞瀵瑰弬鏁伴厤缃殑绠$悊 銆怑ditby shaocx,2024-12-13銆� + var sysConfig = wmsDB.SysConfig.Where(x => x.Code == "LastUpi_BZ01").FirstOrDefault(); + if (sysConfig == null) + { + SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"娌℃湁鑾峰彇鍒� LastUpi_BZ01鐨勯厤缃俊鎭� "; + continue; + } + var config_value = sysConfig.Value; + if (config_value.IndexOf('|') > -1) + {//鏍煎紡涓� 鍖呭彿|UPI|娆″簭|榻愬寘鐘舵�� + var arr = config_value.Split('|'); + var lastPackageCode = arr[0]; + var lastUpi_BZ01 = arr[1]; + var lastShelf = Convert.ToInt32(arr[2]); + var lastQitaoReault = arr[3]; + + if (upiObj.PackageCode == lastPackageCode) + { + if (upiObj.Shelf == (lastShelf + 1)) + { + //榻愬寘鐘舵�� + if (lastQitaoReault == "榻愬寘") + { + qitaoReault = true; + } + else + { + qitaoReault = false; + } + } + else + {//涓嶉綈鍖� + qitaoReault = false; + } + } + else + {//璇存槑鏄崲浜嗗寘鍙凤紝閲嶆柊楠岃瘉 榻愬寘鐘舵�� + #region 璁$畻鏄惁榻愬寘 + qitaoReault = ValidateQiBao(wmsDB, upiObj); + #endregion + } + } + else + {//琛ㄧず杩樻病鏈夐厤缃� 锛岄噸鏂伴獙璇� 榻愬寘鐘舵�� + #region 璁$畻鏄惁榻愬寘 + qitaoReault = ValidateQiBao(wmsDB, upiObj); + #endregion + } + + if (qitaoReault == false) + { + upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�; + } + else + { + upiObj.AreaCode = (int)AreaCodeEnum.鐮佸灈鍖哄煙; + } + //鏌ヨ鏄惁榻愬寘 var allList = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList(); var isQiTaoList = allList.Where(x => x.AreaCode == (int)AreaCodeEnum.寰呯紦瀛樺垎鎷e尯 @@ -230,6 +288,19 @@ } } + var str_qitaoReault = (qitaoReault ? "榻愬寘" : "涓嶉綈鍖�"); + //璁板綍涓嬬粨鏋� + sysConfig.Value = upiObj.PackageCode + "|" + upiObj.UPI + "|" + upiObj.Shelf + "|" + str_qitaoReault; + + //鍒犻櫎璇PI鐨勭紦瀛橀槦鍒楁暟鎹� + int queryAreaCode2 = (int)AreaCodeEnum.寰呯紦瀛樺垎鎷e尯; + var curUpiLineQueue = wmsDB.mes_upi_linequeue.Where(x => x.Upi == upiObj.UPI && x.AreaCode == queryAreaCode2) + .FirstOrDefault(); + if (curUpiLineQueue != null) + { + wmsDB.mes_upi_linequeue.Remove(curUpiLineQueue); + } + //鏇存柊UPI鐘舵�� var upiObjList = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == upiCode).ToList(); foreach (var item in upiObjList) @@ -249,7 +320,7 @@ rbRunMode.OrderId = upiObj.OrderId; rbRunMode.PackageCode = upiObj.PackageCode; - WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "BZ01", "榻愬寘楠岃瘉:" + (qitaoReault ? "榻愬寘" : "涓嶉綈鍖�")); + WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "BZ01", "榻愬寘楠岃瘉:" + str_qitaoReault); wmsDB.SaveChanges(); } @@ -350,5 +421,115 @@ return true; } + /// <summary> + /// 鍒ゆ柇鏄惁榻愬寘 + /// </summary> + /// <param name="wmsDB"></param> + /// <param name="upiObj"></param> + /// <returns></returns> + private static bool ValidateQiBao(WmsDBModel wmsDB, mes_batchOrderUPI_new upiObj) + { + //鏌ヨ鏄惁榻愬寘 + var allList = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList(); + var isQiTaoList = allList.Where(x => x.AreaCode == (int)AreaCodeEnum.寰呯紦瀛樺垎鎷e尯 + || + x.AreaCode == (int)AreaCodeEnum.鐮佸灈鍖哄煙 + ).ToList(); + if (isQiTaoList.Count() != allList.Count()) + {//涓嶉綈鍖� + return false; + } + else + {//榻愬寘 + //杩欓噷鍐嶅鍔犱釜閫昏緫锛屽繀椤绘槸鎸夌収娆″簭杩涘叆鐨勬墠鐪熸鐨勭畻榻愬寘 [Editby shaocx,2024-12-06] + //瀵绘壘鏈寘鍐呯殑鍓嶄竴鍧楁澘鐨勪綅缃� + int queryAreaCode = (int)AreaCodeEnum.寰呯紦瀛樺垎鎷e尯; + var lastUpiLineQueue = wmsDB.mes_upi_linequeue.Where(x => x.PackageCode == upiObj.PackageCode && x.AreaCode == queryAreaCode) + .OrderBy(x => x.Id).FirstOrDefault();//鏌ヨ璇ュ寘闃熷垪鐨勭涓�鍧楁澘 + if (lastUpiLineQueue == null) + {//璇存槑 闃熷垪涓病鏈夎鍖呯殑鏁版嵁 + return false; + } + else + { + if (lastUpiLineQueue.Shelf != upiObj.Shelf) + { + return false; + } + else + { + var isJiXuValidate = true; + if (upiObj.Shelf != 1) + { + var qianmianList = allList.Where(x => x.Shelf < upiObj.Shelf).ToList(); + //鐪嬩互鍓嶇殑鏉垮湪鍝噷锛屽繀椤婚兘鍦� 鐮佸灈鍖哄煙 + var yiqianQuyu = AreaCodeEnum.鐮佸灈鍖哄煙; + var count_MD = qianmianList.Where(x => x.AreaCode == (int)yiqianQuyu).Count(); + if (count_MD != qianmianList.Count()) + { + isJiXuValidate = false; + return false; + } + } + + if (isJiXuValidate) + {//鏄惁缁х画楠岃瘉 + //杩橀渶瑕侀獙璇佸湪杩欎簺鍖哄煙涓紝鏄惁姝g‘鎺掗槦锛屽鏋滄病鏈夋纭帓闃燂紝閭d箞灏辫涓轰笉榻愬 銆怑ditby shaocx,2024-12-12銆� + var queueList = wmsDB.mes_upi_linequeue.Where(x => x.PackageCode == upiObj.PackageCode && x.AreaCode == queryAreaCode) + .OrderBy(x => x.Id).ToList(); + var fisrtId = queueList.OrderBy(x => x.Id).First().Id; + var endId = queueList.OrderByDescending(x => x.Id).First().Id; + //缁х画鏌ヨ杩欎釜鏃堕棿娈靛唴鐨勯槦鍒楁暟鎹� + //閲嶅啓璇ラ槦鍒� + queueList = wmsDB.mes_upi_linequeue.Where(x => x.Id >= fisrtId && x.Id <= endId).OrderBy(x => x.Id).ToList(); + var syCount = allList.Where(x => x.Shelf >= upiObj.Shelf).Count(); + if (queueList.Count() != syCount) + { + return false; + } + else + { + //鍒ゆ柇鏄惁涔卞簭 + bool isLuanXuan = false; + int temp_shelf = 0; + for (int i = 0; i < queueList.Count; i++) + { + if (i == 0) + { + temp_shelf = queueList[i].Shelf; + if (temp_shelf != upiObj.Shelf) + { + isLuanXuan = true; + return false; + } + if (queueList[i].Upi != upiObj.UPI) + { + isLuanXuan = true; + return false; + } + } + else + { + temp_shelf = temp_shelf + 1; + if (temp_shelf != queueList[i].Shelf) + {//璁や负涔卞簭浜� + isLuanXuan = true; + return false; + } + } + } + + if (isLuanXuan == false) + { + return true; + } + } + } + } + } + } + + return false; + } } } -- Gitblit v1.9.3