From 06d6ba0da4d9036bf3eeab8a7cbef8df89565606 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周一, 16 12月 2024 17:19:05 +0800 Subject: [PATCH] BZ01 齐包优化 --- CC/iWareCC_ASRS/ThreadService/00_269工位/DataProcess_269.cs | 81 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 78 insertions(+), 3 deletions(-) diff --git "a/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs" "b/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs" index 5eb3170..aed2520 100644 --- "a/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs" +++ "b/CC/iWareCC_ASRS/ThreadService/00_269\345\267\245\344\275\215/DataProcess_269.cs" @@ -30,17 +30,23 @@ LogType logType = LogType.DataProcess_269; 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_269 = string.Empty; try { - if (SystemValue.isAllowRuning_DataProcess_269 && SystemValue.isStartedModel) + //if (SystemValue.isAllowRuning_DataProcess_269 && SystemValue.isStartedModel) + if (SystemValue.isStartedModel) { var rgvLocation = StationLocationEnum.棣栨鎵爜宸ヤ綅.ToString(); /* * 1銆佷粠鏁版嵁搴撲腑鍒ゆ柇鏄惁榻愬 * 2銆佹牴鎹綈濂楃粨鏋滐紝鎺ㄩ�佺粰PLC */ + if (FormCC.stationView == null) + { + SystemWarningMsg._lbl_alert_DataProcess_269 = $"{rgvLocation.ToString()}-鑾峰彇PLC瀵硅薄涓簄ull"; + continue; + } var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault(); if (obj.R_ReqParseData) { @@ -56,14 +62,82 @@ var upiObj = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == upiCode).FirstOrDefault(); if (upiObj == null) { + //鎺ㄩ�乸lc 浜哄伐鏀捐 + using (StationServiceClient client = new StationServiceClient()) + { + var res = await client.WriteStation_PersonAllowAsync((int)EDevice.Station, false, rgvLocation); + if (!res.result) + { + SystemWarningMsg._lbl_alert_DataProcess_269 = $"{rgvLocation.ToString()}- 鎺ㄩ�乸lc 浜哄伐鏀捐 澶辫触,WriteStation_PersonAllowAsync 杩斿洖:{res.resMsg}"; + continue; + } + else + { + Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鎺ㄩ�乸lc 浜哄伐鏀捐 鎴愬姛,WriteStation_PersonAllowAsync锛屽弬鏁�: 绔欑偣{rgvLocation}"); + } + } + + //鍐欏叆鎶ヨ淇℃伅 + await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_269_1); + SystemWarningMsg._lbl_alert_DataProcess_269 = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌瀵硅薄 "; continue; + //*/ } - upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�; + //鎺ㄩ�乸lc瑙f瀽瀹屾垚 + using (StationServiceClient client = new StationServiceClient()) + { + var res = await client.WriteQiTaoInfoAsync((int)EDevice.Station, rgvLocation, true); + if (!res.result) + { + SystemWarningMsg._lbl_alert_DataProcess_269 = $"{rgvLocation.ToString()}- 鎺ㄩ�乸lc瑙f瀽瀹屾垚 澶辫触,WriteQiTaoInfoAsync杩斿洖:{res.resMsg}"; + continue; + } + else + { + Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鎺ㄩ�乸lc瑙f瀽瀹屾垚 鎴愬姛,WriteQiTaoInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}"); + } + } + + upiObj.AreaCode = (int)AreaCodeEnum.寰呯紦瀛樺垎鎷e尯; + + //璁板綍鏉夸欢闃熷垪琛� + var queueData = wmsDB.mes_upi_linequeue.Where(x => x.Upi == upiObj.UPI).FirstOrDefault(); + if (queueData != null) + { + wmsDB.mes_upi_linequeue.Remove(queueData); + } + mes_upi_linequeue addUpiLineQueue = ClassHelper.RotationMapping<mes_upi_linequeue, mes_batchOrderUPI_new>(upiObj); + addUpiLineQueue.Id = Yitter.IdGenerator.YitIdHelper.NextId(); + addUpiLineQueue.Location = "269"; + addUpiLineQueue.AreaCode = (int)AreaCodeEnum.寰呯紦瀛樺垎鎷e尯; + addUpiLineQueue.Upi = upiObj.UPI; + addUpiLineQueue.UpiFlag = (int)UpiFlagEnum.姝e父; + addUpiLineQueue.UpiStatus = (int)UpiStatusEnum.鍒濆; + addUpiLineQueue.CreateTime = DateTime.Now; + addUpiLineQueue.CreateUserName = SysGloble.WCSSystem; + wmsDB.mes_upi_linequeue.Add(addUpiLineQueue); + + WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "269", "棣栨鎵爜"); + + ////鏇存柊閰嶇疆 269_LastPackageUpi + //var bz30Config = wmsDB.SysConfig.Where(x => x.Code == "269_LastPackageUpi").FirstOrDefault(); + //if (bz30Config == null) + //{ + // SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"娌℃湁閰嶇疆 269_LastPackageUpi 鍊�"; + // continue; + //} + //bz30Config.Value = upiObj.PackageCode + "|" + upiObj.UPI; + FormCC.Globle_269_LastPackageUpi = upiObj.PackageCode + "|" + upiObj.UPI + "|" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); wmsDB.SaveChanges(); + //*/ } + } + else + { + SystemWarningMsg._lbl_alert_DataProcess_269 = $"{rgvLocation.ToString()}-娌℃湁瑕佸鐞嗙殑鏁版嵁"; } } } @@ -75,5 +149,6 @@ } } + } } -- Gitblit v1.9.3