From abf9b6bb33fcfad5b56a17a5d3e99b49782a7316 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 04 12月 2024 15:19:00 +0800
Subject: [PATCH] 22

---
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/3、DataProcess_RobotBuffer_FinishTaskForOutbound.cs |   45 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 39 insertions(+), 6 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/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.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/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.cs"
index 62d38cd..7319dcb 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/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.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/Outbound/3\343\200\201DataProcess_RobotBuffer_FinishTaskForOutbound.cs"
@@ -22,11 +22,11 @@
             LogType logType = LogType.DataProcess_RobotBuffer_FinishTaskForOutbound;
             while (true)
             {
-                Thread.Sleep(2000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
+                Thread.Sleep(500);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
                 SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = string.Empty;
                 try
-                {
-                    if (SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTaskForOutbound && SystemValue.isStartedModel)
+                {//SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTaskForOutbound &&
+                    if (SystemValue.isStartedModel)
                     {
                         var rgvLocation = StationLocationEnum.BZ39.ToString();
                         var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
@@ -52,12 +52,24 @@
                             {
                                 var task = wmsDB.wms_rbline_task.Where(x =>
                                  x.TaskNo == obj.R_Outbound_TaskID.ToString()
-                                && x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
-                                && x.TaskStatus == (int)TaskStatusEnum.宸蹭笅鍙�).FirstOrDefault();
+                                && (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+                                ).OrderByDescending(x => x.Id).FirstOrDefault();
                                 if (task == null)
                                 {
                                     SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()},鏍规嵁 R_OutboundNumber:{obj.R_OutboundNumber}娌℃湁鎵惧埌宸蹭笅鍙戠殑浠诲姟 ";
                                     continue;
+                                }
+                                else
+                                {
+                                    if (task.TaskStatus == (int)TaskStatusEnum.宸插畬鎴�)
+                                    {
+                                        using (StationServiceClient client = new StationServiceClient())
+                                        {
+                                            var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation, false);
+                                        }
+                                        continue;
+                                    }
+
                                 }
 
                                 var upiCode = task.UPI;
@@ -67,6 +79,18 @@
                                     SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌瀵硅薄 ";
                                     continue;
                                 }
+                                //鏇存柊鏉夸欢鐨勭姸鎬佸拰鍖哄煙
+                                if (task.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟)
+                                {
+                                    upiObj.UpiStatus = (int)UpiStatusEnum.宸查綈鍖�;
+                                    upiObj.AreaCode = (int)AreaCodeEnum.鐮佸灈鍖哄煙;
+                                }
+                                else if (task.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+                                {
+                                    upiObj.UpiStatus = (int)UpiStatusEnum.宸蹭笅绾�;
+                                    upiObj.AreaCode = (int)AreaCodeEnum.涓嬬嚎鍖哄煙;
+                                }
+
                                 //搴撳瓨鍑忓皯
                                 wms_stock_quan qun = wmsDB.wms_stock_quan.Where(x => x.PlaceCode == task.PlaceCode).FirstOrDefault();
                                 wmsDB.wms_stock_quan.Remove(qun);
@@ -81,7 +105,7 @@
                                 //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
                                 using (StationServiceClient client = new StationServiceClient())
                                 {
-                                    var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
+                                    var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation, true);
                                     if (!res.result)
                                     {
                                         SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,OutboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
@@ -93,9 +117,18 @@
                                     }
                                 }
 
+                                WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, task.PlaceCode, $"鍑虹紦瀛樺簱锛歿task.PlaceCode}," + task.TaskMsg);
+
                                 wmsDB.SaveChanges();
                             }
                         }
+                        else
+                        {
+                            using (StationServiceClient client = new StationServiceClient())
+                            {
+                                var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, false, rgvLocation, false);
+                            }
+                        }
                     }
                 }
                 catch (Exception ex)

--
Gitblit v1.9.3