From 71f890c1c7f40d2605f9eabfe787e5ac287162fc Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周一, 23 12月 2024 18:58:48 +0800 Subject: [PATCH] 333 --- CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Inbound/1、DataProcess_BZ39.cs | 70 ++++++++++++++++++++++------------- 1 files changed, 44 insertions(+), 26 deletions(-) diff --git "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Inbound/1\343\200\201DataProcess_BZ39.cs" "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Inbound/1\343\200\201DataProcess_BZ39.cs" index 12475a8..8f7cae5 100644 --- "a/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Inbound/1\343\200\201DataProcess_BZ39.cs" +++ "b/CC/iWareCC_ASRS/ThreadService/02_BZ39\345\267\245\344\275\215\357\274\210\350\241\245\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/Inbound/1\343\200\201DataProcess_BZ39.cs" @@ -9,6 +9,7 @@ using iWareSql.WmsDBModel; using System; using System.Collections.Generic; +using System.Diagnostics.Eventing.Reader; using System.Linq; using System.ServiceModel.Configuration; using System.Text; @@ -30,17 +31,22 @@ LogType logType = LogType.DataProcess_BZ39; while (true) { - Thread.Sleep(2000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆� + Thread.Sleep(1000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆� SystemWarningMsg._lbl_alert_DataProcess_BZ39 = string.Empty; try { - if (SystemValue.isAllowRuning_DataProcess_BZ39 && SystemValue.isStartedModel) + if (SystemValue.isStartedModel)//SystemValue.isAllowRuning_DataProcess_BZ39 && { var rgvLocation = StationLocationEnum.BZ39.ToString(); /* * 1銆佷粠鏁版嵁搴撲腑鍒ゆ柇鏄惁榻愬 * 2銆佹牴鎹綈濂楃粨鏋滐紝鎺ㄩ�佺粰PLC */ + if (FormCC.stationView == null) + { + SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-鑾峰彇PLC瀵硅薄涓簄ull"; + continue; + } var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault(); if (obj.R_ReqParseData) { @@ -54,51 +60,58 @@ var qitaoReault = false; using (WmsDBModel wmsDB = new WmsDBModel()) { + //涓嶅啀鎷︽埅 + //瑕佹槸鏈夊凡涓嬪彂鐨勪换鍔★紝灏变笉瑕佹墽琛� - var isValidate = TaskHandler.ValidateIssueTaskForRobotBuffer(wmsDB); + var isValidate = TaskHandler.ValidateIssueTaskForNoFinishTaskByUpi(wmsDB, upiCode, false); if (!isValidate) { - SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-鏈夆�樺凡涓嬪彂鈥欑殑浠诲姟锛屼笉鑳藉鐞�,姝ゆ寰幆缁撴潫"; + SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}- upi:{upiCode}鏈夆�樻湭缁撴潫鈥欑殑浠诲姟锛屼笉鑳藉鐞�,姝ゆ寰幆缁撴潫"; continue; } + // var upiObj = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == upiCode).FirstOrDefault(); if (upiObj == null) { + //鍐欏叆鎶ヨ淇℃伅 + await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ39_2); + SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌瀵硅薄 "; continue; } + //鍒ゆ柇浠栨槸鍚﹀湪搴撻噷闈� + var stock = wmsDB.wms_stock_quan.Where(x => x.Upi == upiObj.UPI).FirstOrDefault(); + if (stock != null) + { + //鍐欏叆鎶ヨ淇℃伅 + await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ39_1); + + SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()},UPI:{upiCode}宸茬粡鍦ㄧ紦瀛樺簱涓簡 "; + continue; + } + //浜嗚В浠栫殑闀裤�佸銆侀珮锛屽鎵剧┖搴撲綅 var place = StationHandlerV2.FindBestEmptyPlace(wmsDB, upiObj); if (place == null) { + //鍐欏叆鎶ヨ淇℃伅 + await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ39_3); + SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌缂撳瓨鍖哄矝鐨勭┖搴撲綅 "; continue; } - using (StationServiceClient client = new StationServiceClient()) - { - var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, place.PlaceCode, (short)upiObj.Length, - (short)upiObj.Width, (short)upiObj.Thk); - if (!res.result) - { - SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,WriteInStoreTaskInfoAsync 杩斿洖:{res.resMsg}"; - continue; - } - else - { - Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 鎴愬姛,WriteInStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}"); - } - } //璁板綍浠诲姟 var _id = Yitter.IdGenerator.YitIdHelper.NextId(); - var plcTaskNo = BusinessHelper.CreatePlcTaskIdForSrmTask(); + var plcTaskNo = BusinessHelper.CreatePlcTaskId(); + plcTaskNo = MyExtendHelper.GetNewTaskNo(wmsDB, RbTaskTypeEnum.鍏ュ簱浠诲姟, plcTaskNo); + var task = new wms_rbline_task() { Id = _id, TaskNo = plcTaskNo, - - UPI = upiObj.UPI, + Upi = upiObj.UPI, Length = upiObj.Length, Width = upiObj.Width, Thk = upiObj.Thk, @@ -108,25 +121,30 @@ PackageCode = upiObj.PackageCode, PlaceCode = place.PlaceCode, RbTaskType = (int)RbTaskTypeEnum.鍏ュ簱浠诲姟, - RbTaskTypeEnumName = RbTaskTypeEnum.鍏ュ簱浠诲姟.ToString(), - TaskStatus = (int)TaskStatusEnum.宸蹭笅鍙�, - TaskStatusName = TaskStatusEnum.宸蹭笅鍙�.ToString(), + TaskStatus = (int)TaskStatusEnum.鏂板缓, TaskMsg = "鍏ュ簱", CreateTime = DateTime.Now, - CreateUserName = "CC", + CreateUserName = SysGloble.WCSSystem, UpdateTime = DateTime.Now, - UpdateUserName = "CC", + UpdateUserName = SysGloble.WCSSystem, }; wmsDB.wms_rbline_task.Add(task); + place.PlaceStatus = (int)PlaceStatusEnum.閿佸畾; + + WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "BZ39", "缂撳瓨鍏ュ簱锛�" + place.PlaceCode); wmsDB.SaveChanges(); } } + else + { + SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-娌℃湁瑕佸鐞嗙殑鏁版嵁"; + } } } catch (Exception ex) -- Gitblit v1.9.3