From 607fa9a9dec5ff4fe780231d635bbd62e1740f37 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 02 12月 2024 18:37:27 +0800
Subject: [PATCH] 1

---
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Inbound/2、DataProcess_RobotBuffer_FinishTask.cs |   54 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 46 insertions(+), 8 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/2\343\200\201DataProcess_RobotBuffer_FinishTask.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/2\343\200\201DataProcess_RobotBuffer_FinishTask.cs"
index 0748d2f..5ab0229 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/2\343\200\201DataProcess_RobotBuffer_FinishTask.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/2\343\200\201DataProcess_RobotBuffer_FinishTask.cs"
@@ -30,20 +30,28 @@
             LogType logType = LogType.DataProcess_RobotBuffer_FinishTask;
             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_FinishTask = string.Empty;
                 try
                 {
-                    if (SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTask && SystemValue.isStartedModel)
+                    if ( SystemValue.isStartedModel)//SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTask &&
                     {
                         var rgvLocation = StationLocationEnum.BZ39.ToString();
                         var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
                         if (obj.R_InboundFinish)
+                        //if (true)//妯℃嫙
                         {
-                            var result = obj.R_InboundNumber;
-                            if (string.IsNullOrEmpty(result))
+                            //var result = obj.R_InboundNumber;
+                            //if (string.IsNullOrEmpty(result))
+                            //{
+                            //    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}- 鍏ュ簱搴撲綅鍙锋槸绌虹殑,姝ゆ寰幆缁撴潫";
+                            //    continue;
+                            //}
+                            //obj.R_Inbound_TaskID = 17797;//妯℃嫙
+                            var result2 = obj.R_Inbound_TaskID;
+                            if (result2 == 0)
                             {
-                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}- 鍏ュ簱搴撲綅鍙锋槸绌虹殑,姝ゆ寰幆缁撴潫";
+                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}- 鍏ュ簱浠诲姟鍙锋槸绌虹殑,姝ゆ寰幆缁撴潫";
                                 continue;
                             }
 
@@ -51,13 +59,26 @@
                             var qitaoReault = false;
                             using (WmsDBModel wmsDB = new WmsDBModel())
                             {
-                                var task = wmsDB.wms_rbline_task.Where(x => x.PlaceCode == obj.R_InboundNumber
+                                var task = wmsDB.wms_rbline_task.Where(x =>
+                                 x.TaskNo == obj.R_Inbound_TaskID.ToString()
                                 && x.RbTaskType == (int)RbTaskTypeEnum.鍏ュ簱浠诲姟
-                                && x.TaskStatus == (int)TaskStatusEnum.宸蹭笅鍙�).FirstOrDefault();
+                                ).OrderByDescending(x=>x.Id).FirstOrDefault();
                                 if (task == null)
                                 {
                                     SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()},鏍规嵁 R_InboundNumber:{obj.R_InboundNumber}娌℃湁鎵惧埌宸蹭笅鍙戠殑浠诲姟 ";
                                     continue;
+                                }
+                                else 
+                                {
+                                    if (task.TaskStatus == (int)TaskStatusEnum.宸插畬鎴�)
+                                    {
+                                        using (StationServiceClient client = new StationServiceClient())
+                                        {
+                                            var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
+                             
+                                        }
+                                        continue;
+                                    }
                                 }
 
                                 var upiCode = task.UPI;
@@ -73,11 +94,14 @@
                                     Id = Yitter.IdGenerator.YitIdHelper.NextId(),
                                     Upi = upiCode,
                                     PlanNo = task.PlanNo,
+                                    DetailName = upiObj.DetailName,
+                                    OrderId = task.OrderId,
                                     CreateTime = DateTime.Now,
                                     CreateUserName = "CC",
                                     InTime = DateTime.Now,
                                     OperReason = "鍏ュ簱",
                                     PackageCode = task.PackageCode,
+                                    Length = task.Length,
                                     Width = task.Width,
                                     Thk = task.Thk,
                                     PlaceCode = task.PlaceCode,
@@ -98,7 +122,7 @@
                                 //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
                                 using (StationServiceClient client = new StationServiceClient())
                                 {
-                                    var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, rgvLocation);
+                                    var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
                                     if (!res.result)
                                     {
                                         SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,InboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
@@ -110,9 +134,23 @@
                                     }
                                 }
 
+                                WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, task.PlaceCode, "缂撳瓨鍏ュ簱瀹屾垚");
+
                                 wmsDB.SaveChanges();
                             }
                         }
+                        else
+                        {
+                            //涓嶅啀鎷︽埅 
+
+                            //棣栧厛鍏堟竻鐞�
+                            using (StationServiceClient client = new StationServiceClient())
+                            {
+                                var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, false, rgvLocation);
+
+                            }
+
+                        }
                     }
                 }
                 catch (Exception ex)

--
Gitblit v1.9.3