From 7603e93e19891ec2aff0ad67e555fd55d9175b99 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周六, 23 11月 2024 14:55:09 +0800
Subject: [PATCH] 111

---
 CC/iWareCC_ASRS/FormCC.cs                                                                              |   21 +++----
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Inbound/2、DataProcess_RobotBuffer_FinishTask.cs         |    2 
 SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs                                           |   20 +++---
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/2、DataProcess_RobotBuffer_IssueOutboundTask.cs |  115 +++++++++++++++++---------------------
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/1、DataProcess_RobotBuffer_AutoQiTaoOutbound.cs |    9 ++-
 5 files changed, 76 insertions(+), 91 deletions(-)

diff --git a/CC/iWareCC_ASRS/FormCC.cs b/CC/iWareCC_ASRS/FormCC.cs
index ef4c92f..5f5600d 100644
--- a/CC/iWareCC_ASRS/FormCC.cs
+++ b/CC/iWareCC_ASRS/FormCC.cs
@@ -213,26 +213,25 @@
             // rgvService.StartService();
 
 
-            //澶勭悊銆愪笅鍙戜腑銆戠殑鍑哄簱璁″垝浠诲姟
-            // new Thread(OutPlanTaskDecompose.HandlerIssuingTask).Start();
 
-            //浠诲姟鍒嗚В绾跨▼-鍑哄簱
-            // new Thread(MainTaskDecompose.HandlerMainTaskDecompose).Start();
+            new Thread(DataProcess_RobotBuffer_ModeChange.Handler).Start();
 
-            //浠诲姟鍒嗚В绾跨▼-缁勭洏鍏ュ簱
-            // new Thread(MainTaskDecompose_ZPRK.HandlerMainTaskDecompose_ZPRK).Start();
+            new Thread(DataProcess_RobotBuffer_IssueOutboundTask.Handler).Start();
+
+
+            new Thread(DataProcess_RobotBuffer_AutoQiTaoOutbound.Handler).Start();
 
             new Thread(DataProcess_RobotBuffer_FinishTaskForOutbound.Handler).Start();
 
-            //鑷姩缁勭洏浠诲姟
+            
             new Thread(DataProcess_RobotBuffer_FinishTask.Handler).Start();
 
             new Thread(DataProcess_BZ01.Handler).Start();
 
-            //閲嶆柊鑾峰彇鍙戝姩鏈轰俊鎭�
+           
             new Thread(DataProcess_269.Handler).Start();
 
-            //1014搴撲綅杞繍鍒�1020绾跨▼
+           
             new Thread(DataProcess_BZ39.Handler).Start();
 
 
@@ -1594,15 +1593,13 @@
 
             DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_AutoQiTaoOutbound, ckDataProcess_RobotBuffer_AutoQiTaoOutbound);
 
-            DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_IssueOutboundTask, ckEmptySalverTransfer);
-
             DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_BZ39, ck_DataProcess_BZ39);
 
             DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_BZ01, ck_AutoIssueInStoreTask);
 
             DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_269, ck_DataProcess_269);
 
-            DoCommonCheckedChanged(ref SystemValue.isAllowRuning_Place1014To1020Task, ck_DataProcess_RobotBuffer_IssueOutboundTask);
+            DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_IssueOutboundTask, ck_DataProcess_RobotBuffer_IssueOutboundTask);
 
             DoCommonCheckedChanged(ref SystemValue.isAllowRuning_OutTaskRetryToMes, checkBox_OutTaskRetryToMes);
         }
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 9424fc2..8158e17 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,7 +30,7 @@
             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
                 {
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/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.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/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.cs"
index da14603..4b24ca0 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/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.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/1\343\200\201DataProcess_RobotBuffer_AutoQiTaoOutbound.cs"
@@ -43,8 +43,11 @@
                                 if (allCount == group.ToList().Count())
                                 {
                                     //婊¤冻榻愬锛屽嚭搴�
-                                    group.ToList().ForEach(x =>
+                                    //娉ㄦ剰锛氭帓搴忎弗鏍兼寜鐓� 娆″簭 杩涜鎺掑簭銆� 锛侊紒锛侊紒锛侊紒锛侊紒
+                                    var doList = upiList.Where(x => x.PackageCode == packageCode).OrderBy(x => x.Shelf).ToList();
+                                    foreach (var item in doList)
                                     {
+                                        var x = group.ToList().Find(b => b.Upi == item.UPI);
                                         x.StockStatus = (int)StockStatusEnum.榻愬寘寰呭嚭搴�;
 
                                         //鐢熸垚鍑哄簱浠诲姟
@@ -69,7 +72,7 @@
                                             RbTaskTypeEnumName = RbTaskTypeEnum.鍑哄簱浠诲姟.ToString(),
                                             TaskStatus = (int)TaskStatusEnum.鏂板缓,
                                             TaskStatusName = TaskStatusEnum.鏂板缓.ToString(),
-                                            TaskMsg = "鍏ュ簱",
+                                            TaskMsg = "鍑哄簱浠诲姟",
 
 
                                             CreateTime = DateTime.Now,
@@ -82,7 +85,7 @@
 
                                         var place = StationHandler.GetPlaceByPlaceCode(x.PlaceCode, wmsDB);
                                         place.PlaceStatus = (int)PlaceStatusEnum.閿佸畾;
-                                    });
+                                    }
                                 }
                             }
 
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/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.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/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.cs"
index cfc9068..350b79c 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/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.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/2\343\200\201DataProcess_RobotBuffer_IssueOutboundTask.cs"
@@ -41,77 +41,64 @@
                          * 1銆佷粠鏁版嵁搴撲腑鍒ゆ柇鏄惁榻愬
                          * 2銆佹牴鎹綈濂楃粨鏋滐紝鎺ㄩ�佺粰PLC
                          */
-                        var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
-                        if (obj.R_ReqParseData)
+
+                        using (WmsDBModel wmsDB = new WmsDBModel())
                         {
-                            var result = obj.R_ReadCodeResult;
-                            if (string.IsNullOrEmpty(result))
+                            //瑕佹槸鏈夊凡涓嬪彂鐨勪换鍔★紝灏变笉瑕佹墽琛�
+                            var isValidate = TaskHandler.ValidateIssueTaskForRobotBuffer(wmsDB);
+                            if (!isValidate)
                             {
-                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-璇锋眰浜嗚В鐮侊紝浣嗘槸缁撴灉鏄┖鐨�,姝ゆ寰幆缁撴潫";
+                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-鏈夆�樺凡涓嬪彂鈥欑殑浠诲姟锛屼笉鑳藉鐞�,姝ゆ寰幆缁撴潫";
                                 continue;
                             }
-                            var upiCode = result;
-                            var qitaoReault = false;
-                            using (WmsDBModel wmsDB = new WmsDBModel())
+
+
+
+                            var taskList = wmsDB.wms_rbline_task.Where(x =>
+                           x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
+                          && x.TaskStatus == (int)TaskStatusEnum.鏂板缓).OrderBy(x => x.PackageCode).ToList();
+                            if (taskList == null)
                             {
-                                //瑕佹槸鏈夊凡涓嬪彂鐨勪换鍔★紝灏变笉瑕佹墽琛�
-                                var isValidate = TaskHandler.ValidateIssueTaskForRobotBuffer(wmsDB);
-                                if (!isValidate)
-                                {
-                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-鏈夆�樺凡涓嬪彂鈥欑殑浠诲姟锛屼笉鑳藉鐞�,姝ゆ寰幆缁撴潫";
-                                    continue;
-                                }
-
-
-
-                                var taskList = wmsDB.wms_rbline_task.Where(x => x.PlaceCode == obj.R_OutboundNumber
-                              && x.RbTaskType == (int)RbTaskTypeEnum.鍑哄簱浠诲姟
-                              && x.TaskStatus == (int)TaskStatusEnum.鏂板缓).OrderBy(x => x.PackageCode).ToList();
-                                if (taskList == null)
-                                {
-                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()},鏍规嵁 R_OutboundNumber:{obj.R_OutboundNumber}娌℃湁鎵惧埌宸蹭笅鍙戠殑浠诲姟 ";
-                                    continue;
-                                }
-
-                                var doTask = taskList.FirstOrDefault();
-
-                                var upiObj = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == upiCode).FirstOrDefault();
-                                if (upiObj == null)
-                                {
-                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌瀵硅薄 ";
-                                    continue;
-                                }
-
-                                //杩欓噷鏀逛负 涓嬪彂 鍑哄簱浠诲姟
-                                using (StationServiceClient client = new StationServiceClient())
-                                {
-                                    //棣栧厛瑕佹竻鐞�
-                                    var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
-                                    if (!res.result)
-                                    {
-                                        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,OutboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
-                                        continue;
-                                    }
-                                    else
-                                    {
-                                        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                                    }
-
-                                    res = await client.WriteOutStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
-                                    if (!res.result)
-                                    {
-                                        SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
-                                        continue;
-                                    }
-                                    else
-                                    {
-                                        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                                    }
-                                }
-
-                                wmsDB.SaveChanges();
+                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()},鏍规嵁 娌℃湁鎵惧埌 鏂板缓 鐨勪换鍔� ";
+                                continue;
                             }
+
+                            var doTask = taskList.FirstOrDefault();
+                            
+
+                            //杩欓噷涓嬪彂 鍑哄簱浠诲姟
+                            using (StationServiceClient client = new StationServiceClient())
+                            {
+                                //棣栧厛瑕佹竻鐞�
+                                var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
+                                if (!res.result)
+                                {
+                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,OutboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
+                                    continue;
+                                }
+                                else
+                                {
+                                    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+                                }
+
+                                res = await client.WriteOutStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
+                                if (!res.result)
+                                {
+                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
+                                    continue;
+                                }
+                                else
+                                {
+                                    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+                                }
+                            }
+
+                            doTask.TaskStatus = (int)TaskStatusEnum.宸蹭笅鍙�;
+                            doTask.TaskStatusName = TaskStatusEnum.宸蹭笅鍙�.ToString();
+
+                            wmsDB.SaveChanges();
                         }
+
                     }
                 }
                 catch (Exception ex)
diff --git a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
index 9eaee7b..cedc0d7 100644
--- a/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
+++ b/SDA/iWareSda/Devices/4-Station/StationModel/StationEntity.cs
@@ -403,20 +403,11 @@
                 var stationObj = this.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
 
                 var view_stationObj = this.View.W_StationForWriteCommList.Where(x => x.StationCode == stationCode).FirstOrDefault();
-                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_Outbound_TaskID, true, view_stationObj.W_Outbound_TaskID);
+                MessageModel b2 = this.plcService.WriteValuePoint(stationObj.W_Outbound_TaskID, outbound_TaskID, view_stationObj.W_Outbound_TaskID);
                 if (!b2.result)
                 {
-                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 鍑哄簱浠诲姟鍙� " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 鍑哄簱浠诲姟鍙� " + outbound_TaskID + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
                        stationObj.W_Outbound_TaskID);
-                    return false;
-                }
-
-
-                b2 = this.plcService.WriteValuePoint(stationObj.W_ReqOut, true, view_stationObj.W_ReqOut);
-                if (!b2.result)
-                {
-                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 璇锋眰鍑哄簱 " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
-                      stationObj.W_ReqOut);
                     return false;
                 }
 
@@ -428,6 +419,13 @@
                     return false;
                 }
 
+                b2 = this.plcService.WriteValuePoint(stationObj.W_ReqOut, true, view_stationObj.W_ReqOut);
+                if (!b2.result)
+                {
+                    msg = string.Format("鍚慡tation鍦板潃{0} 鍐� 璇锋眰鍑哄簱 " + true + "澶辫触,杩斿洖缁撴灉:" + b2.resMsg,
+                      stationObj.W_ReqOut);
+                    return false;
+                }
 
                 return true;
             }

--
Gitblit v1.9.3