From 283a985dede9fd09cb820a79bb603d7ea34050fc Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周一, 23 12月 2024 14:26:17 +0800 Subject: [PATCH] 22 --- CC/iWareCC_ASRS/ThreadService/04_BZ21(搬运整垛机器人)/1、DataProcess_BZ21.cs | 149 ++++++++++++++++++++++++++++--------------------- 1 files changed, 85 insertions(+), 64 deletions(-) diff --git "a/CC/iWareCC_ASRS/ThreadService/04_BZ21\357\274\210\346\220\254\350\277\220\346\225\264\345\236\233\346\234\272\345\231\250\344\272\272\357\274\211/1\343\200\201DataProcess_BZ21.cs" "b/CC/iWareCC_ASRS/ThreadService/04_BZ21\357\274\210\346\220\254\350\277\220\346\225\264\345\236\233\346\234\272\345\231\250\344\272\272\357\274\211/1\343\200\201DataProcess_BZ21.cs" index 8da34c8..075a77a 100644 --- "a/CC/iWareCC_ASRS/ThreadService/04_BZ21\357\274\210\346\220\254\350\277\220\346\225\264\345\236\233\346\234\272\345\231\250\344\272\272\357\274\211/1\343\200\201DataProcess_BZ21.cs" +++ "b/CC/iWareCC_ASRS/ThreadService/04_BZ21\357\274\210\346\220\254\350\277\220\346\225\264\345\236\233\346\234\272\345\231\250\344\272\272\357\274\211/1\343\200\201DataProcess_BZ21.cs" @@ -10,6 +10,7 @@ using iWareSql.WmsDBModel; using Newtonsoft.Json.Linq; using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.Contracts; @@ -22,7 +23,7 @@ { public class DataProcess_BZ21 { - public static void Hander() + public static async void Hander() { var alertMsg = ""; LogType logType = LogType.DataProcess_BZ21; @@ -97,7 +98,17 @@ var upiObj = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == result).FirstOrDefault(); if (upiObj == null) { + //鍐欏叆鎶ヨ淇℃伅 + await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ21_1); + SystemWarningMsg._lbl_alert_DataProcess_BZ21 = $"{rgvLocation.ToString()},鏍规嵁UPI:{result}娌℃湁鎵惧埌瀵硅薄 "; + continue; + } + + var package = wmsDB.mes_package_gather.Where(x => x.PackageCode == upiObj.PackageCode).FirstOrDefault(); + if (package == null) + { + SystemWarningMsg._lbl_alert_DataProcess_BZ21 = $"{rgvLocation.ToString()},鏍规嵁鍖呭彿:{upiObj.PackageCode}娌℃湁鎵惧埌瀵硅薄 "; continue; } @@ -105,12 +116,15 @@ var validteReslt = ValidateIsAllowCut(); if (validteReslt == false) { + //鍐欏叆鎶ヨ淇℃伅 + await MyExtendHelper.WriteBoolPlcDataForWarning(PlcWarningAddressGloble.Num_BZ21_2); + continue; } //string upi = "LS070700101B0001GS"; //璋冪敤鍑虹焊鏈烘帴鍙� - var papercut = ClassHelper.RotationMapping<mes_push_papercut, mes_batchOrderUPI_new>(upiObj); + var papercut = ClassHelper.RotationMapping<mes_push_papercut, mes_package_gather>(package); papercut.Id = Yitter.IdGenerator.YitIdHelper.NextId(); papercut.ApiMessage = ""; papercut.PushNum = 0; @@ -119,41 +133,62 @@ papercut.CreateTime = papercut.UpdateTime = DateTime.Now; wmsDB.mes_push_papercut.Add(papercut); + + AreaCodeEnum setAreaCode = AreaCodeEnum.鍚堝寘瑁佸垏鍖�; + UpiStatusEnum setUpiStatus = UpiStatusEnum.宸插悎鍖�; + + var ngFlag = false; + var queryFlag = (int)UpiFlagEnum.NG; + var upilist = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList(); + var ngCount = upilist.Count(x => x.UpiFlag == queryFlag); + if (ngCount > 0) + { + ngFlag = true; + setUpiStatus = UpiStatusEnum.宸蹭笅绾�; + setAreaCode = AreaCodeEnum.涓嬬嚎鍖哄煙; + } + else + {//涓嶆槸NG + //鏂板mes鎺ㄩ�佽〃 + var putpakegecodeid = Yitter.IdGenerator.YitIdHelper.NextId(); + var putpakegecode = new mes_push_packagecode() + { + Id = putpakegecodeid, + PackageCode = upiObj.PackageCode, + PushStatus = 0, + PushNum = 0, + ApiMessage = "", + CreateTime = DateTime.Now, + CreateUserName = SysGloble.WCSSystem, + UpdateTime = DateTime.Now, + UpdateUserName = SysGloble.WCSSystem + + }; + wmsDB.mes_push_packagecode.Add(putpakegecode); + + //鏂板琛� + var mesinequeue = ClassHelper.RotationMapping<mes_package_linequeue, mes_package_gather>(package); + mesinequeue.Id = Yitter.IdGenerator.YitIdHelper.NextId(); + mesinequeue.CreateTime = mesinequeue.UpdateTime = DateTime.Now; + wmsDB.mes_package_linequeue.Add(mesinequeue); + } + //鏇存柊琛� var mesgather = wmsDB.mes_package_gather.Where(x => x.PackageCode == upiObj.PackageCode).FirstOrDefault(); if (mesgather != null) { - mesgather.AreaCode = (int)AreaCodeEnum.鍚堝寘瑁佸垏鍖�; - mesgather.UpiStatus = (int)UpiStatusEnum.宸插悎鍖�; + mesgather.AreaCode = (int)setAreaCode; + mesgather.UpiStatus = (int)setUpiStatus; } - //var upilist = wmsDB.mes_batchOrderUPI_new.Where(x => x.PackageCode == upiObj.PackageCode).ToList(); - //var upilength = upilist.Max(x => x.Length); - //var upiwidth = upilist.Max(x => x.Width); - //cartonhigh = (short)upiObj.Info3; - //cartonwidth = (short)upiObj.Info2; - upiObj.UpiStatus = (int)UpiStatusEnum.宸插悎鍖�; - upiObj.AreaCode = (int)AreaCodeEnum.鍚堝寘瑁佸垏鍖�; + + upiObj.UpiStatus = (int)setUpiStatus; + upiObj.AreaCode = (int)setAreaCode; //璁板綍浠诲姟 var _id = Yitter.IdGenerator.YitIdHelper.NextId(); - var putpakegecodeid = Yitter.IdGenerator.YitIdHelper.NextId(); - var plcTaskNo = BusinessHelper.CreatePlcTaskIdForSrmTask(); - //鏂板琛� - var mesinequeue = ClassHelper.RotationMapping<mes_package_linequeue, mes_batchOrderUPI_new>(upiObj); - mesinequeue.Id = Yitter.IdGenerator.YitIdHelper.NextId(); - //鏂板mes鎺ㄩ�佽〃 - var putpakegecode = new mes_push_packagecode() - { - Id = putpakegecodeid, - PackageCode = upiObj.PackageCode, - PushStatus = 0, - PushNum = 0, - ApiMessage = "", - CreateTime = DateTime.Now, - CreateUserName = SysGloble.WCSSystem, - UpdateTime = DateTime.Now, - UpdateUserName = SysGloble.WCSSystem - }; + var plcTaskNo = BusinessHelper.CreatePlcTaskId(); + plcTaskNo = MyExtendHelper.GetNewTaskNo(wmsDB, RbTaskTypeEnum.鍚堝寘浠诲姟, plcTaskNo); + //鏂板浠诲姟琛� var task = new wms_rbline_task() { @@ -171,14 +206,14 @@ TaskStatus = (int)TaskStatusEnum.鏂板缓, TaskMsg = "澶规澘", CreateTime = DateTime.Now, - CreateUserName = "CC", + CreateUserName = SysGloble.WCSSystem, UpdateTime = DateTime.Now, - UpdateUserName = "CC", + UpdateUserName = SysGloble.WCSSystem, PlaceCode = place }; //鏂板鎵撳嵃琛� var printid = Yitter.IdGenerator.YitIdHelper.NextId(); - var print = ClassHelper.RotationMapping<wms_record_print, mes_batchOrderUPI_new>(upiObj); + var print = ClassHelper.RotationMapping<wms_record_print, mes_package_gather>(package); print.Id = printid; print.PrintType = (int)PrintTypeEnum.鍖呰鏉$爜; print.PrintSource = (int)PrintSourceEnum.鍖呰鏉$爜鎵撳嵃; @@ -188,24 +223,24 @@ print.IsAllowPrint = true; print.CreateTime = print.UpdateTime = DateTime.Now; wmsDB.wms_record_print.Add(print); - var printtwo = ClassHelper.RotationMapping<wms_record_print, mes_batchOrderUPI_new>(upiObj); - printtwo.PrintType = (int)PrintTypeEnum.鍖呰鏉$爜; - printtwo.PrintSource = (int)PrintSourceEnum.鍖呰鏉$爜鎵撳嵃; - printtwo.PrintSheetNum = 1; - printtwo.PrintNum = 0; - printtwo.PrintStatus = (int)PrintStatuEnum.鏈墦鍗�; - printtwo.IsAllowPrint = true; - printtwo.CreateTime = print.UpdateTime = DateTime.Now; - printtwo.Id = Yitter.IdGenerator.YitIdHelper.NextId(); - wmsDB.wms_record_print.Add(printtwo); + //var printtwo = ClassHelper.RotationMapping<wms_record_print, mes_batchOrderUPI_new>(upiObj); + //printtwo.PrintType = (int)PrintTypeEnum.鍖呰鏉$爜; + //printtwo.PrintSource = (int)PrintSourceEnum.鍖呰鏉$爜鎵撳嵃; + //printtwo.PrintSheetNum = 1; + //printtwo.PrintNum = 0; + //printtwo.PrintStatus = (int)PrintStatuEnum.鏈墦鍗�; + //printtwo.IsAllowPrint = true; + //printtwo.CreateTime = print.UpdateTime = DateTime.Now; + //printtwo.Id = Yitter.IdGenerator.YitIdHelper.NextId(); + //wmsDB.wms_record_print.Add(printtwo); - wmsDB.mes_package_linequeue.Add(mesinequeue); + wmsDB.wms_rbline_task.Add(task); - wmsDB.mes_push_packagecode.Add(putpakegecode); + //澶勭悊琛� mes_order_gather var errmsg = ""; - var package = wmsDB.mes_package_gather.Where(x => x.PackageCode == upiObj.PackageCode).FirstOrDefault(); + var resultAlert = MyExtendHelper.HandlerOrderGather(wmsDB, package, "", "", out errmsg); if (resultAlert == false) { @@ -213,31 +248,17 @@ continue; } - /* - using (StationServiceClient client = new StationServiceClient()) - { - - var plcres = client.WriteSurroundTaskInfo((int)EDevice.Station, rgvLocation, short.Parse(task.TaskNo), - (short)upilength, (short)upiwidth, cartonhigh, cartonwidth, 0, 0); - if (!plcres.result) - { - SystemWarningMsg._lbl_alert_DataProcess_BZ12 = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,WriteInStoreTaskInfoAsync 杩斿洖:{plcres.resMsg}"; - continue; - } - else - { - Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 鎴愬姛,WriteInStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}"); - } - } - //*/ - WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, "BZ21", "鍚堝寘"); - WmsRecordUpiProcessHandler.SaveWmsRecordPackageProcess(wmsDB, upiObj, "BZ21", "鍚堝寘"); + WmsRecordUpiProcessHandler.SaveWmsRecordPackageProcess(wmsDB, package, "BZ21", "鍚堝寘"); wmsDB.SaveChanges(); } } + else + { + SystemWarningMsg._lbl_Alert_DataProcess_BZ21 = $"{rgvLocation.ToString()}-娌℃湁瑕佸鐞嗙殑鏁版嵁"; + } } } catch (Exception ex) -- Gitblit v1.9.3