From de7dbe7cf85aa01abb64040aae1c04dfba74c135 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周二, 01 4月 2025 10:48:50 +0800
Subject: [PATCH] 优化 和plc交互问题

---
 CC/iWareCommon/BusinessHelper/BusinessHelper.cs                                                                 |    2 
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/3、DataProcess_RobotBuffer_FinishTaskForOutbound - 复制.cs |  262 +++++++++++++++++++++
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Inbound/3、DataProcess_RobotBuffer_FinishTask.cs                  |   66 ++++-
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Inbound/2、DataProcess_BZ39_IssueInboundTask.cs                   |   63 +++-
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/2、DataProcess_RobotBuffer_IssueOutboundTask.cs          |   80 ++++--
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/3、DataProcess_RobotBuffer_FinishTaskForOutbound.cs      |    3 
 CC/iWareCC_ASRS/ThreadService/02_BZ39工位(补板后工位)/Outbound/2、DataProcess_RobotBuffer_IssueOutboundTask - 复制.cs     |  185 +++++++++++++++
 CC/iWareCC_ASRS/iWareCC.csproj                                                                                  |    2 
 8 files changed, 600 insertions(+), 63 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_BZ39_IssueInboundTask.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_BZ39_IssueInboundTask.cs"
index 23f784a..2a85f91 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_BZ39_IssueInboundTask.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_BZ39_IssueInboundTask.cs"
@@ -67,28 +67,57 @@
 
 
 
-                            //杩欓噷涓嬪彂 鍏ュ簱搴撲换鍔�
-                            using (StationServiceClient client = new StationServiceClient())
-                            {
+                            ////杩欓噷涓嬪彂 鍏ュ簱搴撲换鍔�
+                            //using (StationServiceClient client = new StationServiceClient())
+                            //{
 
-                                var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode,
-                                   (short)doTask.Length,
-                                   (short)doTask.Width, (short)doTask.Thk, Convert.ToInt32(doTask.TaskNo));
-                                if (!res.result)
-                                {
-                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,WriteInStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
-                                    continue;
-                                }
-                                else
-                                {
-                                    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 鎴愬姛,WriteInStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                                }
-                            }
+                            //    var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode,
+                            //       (short)doTask.Length,
+                            //       (short)doTask.Width, (short)doTask.Thk, Convert.ToInt32(doTask.TaskNo));
+                            //    if (!res.result)
+                            //    {
+                            //        SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,WriteInStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
+                            //        Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-涓嬪彂PLC鍏ュ簱浠诲姟澶辫触 ,WriteInStoreTaskInfoAsync锛岃繑鍥�:{res.resMsg},鍙傛暟: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo}", null);
+                            //        continue;
+                            //    }
+                            //    else
+                            //    {
+                            //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂PLC鍏ュ簱浠诲姟 鎴愬姛,WriteInStoreTaskInfoAsync锛屽弬鏁�: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo}");
+                            //    }
+                            //}
 
                             doTask.TaskStatus = (int)TaskStatusEnum.宸蹭笅鍙�;
                             doTask.IssueTime = DateTime.Now;
 
-                            wmsDB.SaveChanges();
+                            int changeNum = wmsDB.SaveChanges();
+                            if (changeNum > 0)
+                            {
+                                //蹇呴』瑕佺粰PLC涓嬪彂鎴愬姛,瑙e喅鍙兘浼氱粰PLC閲嶅涓嬪彂浠诲姟鐨勬儏鍐�
+                                var isRight = true;
+                                while (isRight)
+                                {
+                                    //杩欓噷涓嬪彂 鍏ュ簱搴撲换鍔�
+                                    using (StationServiceClient client = new StationServiceClient())
+                                    {
+
+                                        var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode,
+                                           (short)doTask.Length,
+                                           (short)doTask.Width, (short)doTask.Thk, Convert.ToInt32(doTask.TaskNo));
+                                        if (!res.result)
+                                        {
+                                            SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,WriteInStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
+                                            Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-涓嬪彂PLC鍏ュ簱浠诲姟澶辫触 ,WriteInStoreTaskInfoAsync锛岃繑鍥�:{res.resMsg},鍙傛暟: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},鏉$爜:{doTask.Upi}", null);
+                                            continue;
+                                        }
+                                        else
+                                        {
+                                            Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂PLC鍏ュ簱浠诲姟 鎴愬姛,WriteInStoreTaskInfoAsync锛屽弬鏁�: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},鏉$爜:{doTask.Upi}");
+                                            isRight = false;
+                                        }
+                                    }
+                                    Thread.Sleep(1000);
+                                }
+                            }
                         }
 
                     }
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/3\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/3\343\200\201DataProcess_RobotBuffer_FinishTask.cs"
index dbff601..333df92 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/3\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/3\343\200\201DataProcess_RobotBuffer_FinishTask.cs"
@@ -225,28 +225,58 @@
             var place = StationHandler.GetPlaceByPlaceCode(task.PlaceCode, wmsDB);
             place.PlaceStatus = (int)PlaceStatusEnum.姝e父;
 
-            if (isFlagFinish == false)
-            {
-                //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
-                using (StationServiceClient client = new StationServiceClient())
-                {
-                    var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
-                    if (!res.result)
-                    {
-                        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,InboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
-                        return false;
-                    }
-                    else
-                    {
-                        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 鎴愬姛,InboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                    }
-                }
-            }
+            //if (isFlagFinish == false)
+            //{
+            //    //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
+            //    using (StationServiceClient client = new StationServiceClient())
+            //    {
+            //        var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
+            //        if (!res.result)
+            //        {
+            //            SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,InboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
+            //            return false;
+            //        }
+            //        else
+            //        {
+            //            Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 鎴愬姛,InboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+            //        }
+            //    }
+            //}
 
             var flag = isFlagFinish ? "浜哄伐寮哄埗瀹屾垚" : "锛堣嚜鍔ㄥ畬鎴愶級";
             WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, task.PlaceCode, "缂撳瓨鍏ュ簱瀹屾垚(" + flag + "):" + task.PlaceCode);
 
-            wmsDB.SaveChanges();
+            int changeNum = wmsDB.SaveChanges();
+            if (changeNum > 0)
+            {
+                //蹇呴』瑕佺粰PLC涓嬪彂鎴愬姛,瑙e喅鍙兘浼氱粰PLC閲嶅涓嬪彂浠诲姟鐨勬儏鍐�
+                var isRight = true;
+
+                if (isFlagFinish == false)
+                {
+                    while (isRight)
+                    {
+                        var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
+                        isRight = obj.R_InboundFinish;
+                        //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
+                        using (StationServiceClient client = new StationServiceClient())
+                        {
+                            var res = await client.InboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation);
+                            if (!res.result)
+                            {
+                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTask = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,InboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
+                                Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-瀹屾垚鍏ュ簱浠诲姟鍐欏叆銆恡rue銆� 澶辫触,InboundFinishConfirmAsync锛岃繑鍥�:{res.resMsg}锛屽弬鏁�:TaskNo:{task.TaskNo}, PlaceCode锛歿task.PlaceCode},鏉$爜:{task.Upi}");
+                            }
+                            else
+                            {
+                                Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-瀹屾垚鍏ュ簱浠诲姟鍐欏叆銆恡rue銆� 鎴愬姛,InboundFinishConfirmAsync锛屽弬鏁�:TaskNo:{task.TaskNo}, PlaceCode锛歿task.PlaceCode},鏉$爜:{task.Upi}");
+                                //isRight = false;
+                            }
+                        }
+                        Thread.Sleep(1000);
+                    }
+                }
+            }
 
             return true;
         }
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 - \345\244\215\345\210\266.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 - \345\244\215\345\210\266.cs"
new file mode 100644
index 0000000..0ef53a8
--- /dev/null
+++ "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 - \345\244\215\345\210\266.cs"
@@ -0,0 +1,185 @@
+锘�//using Admin.NET.Application;
+//using iWareCC.Common.Helper;
+//using iWareCC.StationService;
+//using iWareCommon.Common.Globle;
+//using iWareCommon.Utils;
+//using iWareModel;
+//using iWareSql.DataAccess;
+//using iWareSql.DBModel;
+//using iWareSql.WmsDBModel;
+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using System.ServiceModel.Configuration;
+//using System.Text;
+//using System.Threading;
+//using System.Threading.Tasks;
+//using WZ.Useful.Commons;
+//using XiGang.Core.Model;
+
+//namespace iWareCC.ThreadService
+//{
+//    /// <summary>
+//    /// 鏈哄櫒浜虹紦瀛樺矝 鑷姩涓嬪彂鍑哄簱浠诲姟 澶勭悊
+//    /// </summary>
+//    public static class DataProcess_RobotBuffer_IssueOutboundTask
+//    {
+
+//        public static async void Handler()
+//        {
+//            var alertMsg = "";
+//            LogType logType = LogType.DataProcess_RobotBuffer_IssueOutboundTask;
+//            while (true)
+//            {
+//                Thread.Sleep(1000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
+//                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = string.Empty;
+//                try
+//                {//SystemValue.isAllowRuning_DataProcess_RobotBuffer_IssueOutboundTask &&
+//                    if (SystemValue.isStartedModel)
+//                    {
+//                        var rgvLocation = StationLocationEnum.BZ39.ToString();
+//                        /*
+//                         * 1銆佷粠鏁版嵁搴撲腑鍒ゆ柇鏄惁榻愬
+//                         * 2銆佹牴鎹綈濂楃粨鏋滐紝鎺ㄩ�佺粰PLC
+//                         */
+
+//                        using (WmsDBModel wmsDB = new WmsDBModel())
+//                        {
+//                            var noFinishOutTask = TaskHandler.ValidateIssueTaskForNoFinishTaskByOutStore(wmsDB);
+//                            if (noFinishOutTask == true)
+//                            {//琛ㄧず娌℃湁鏈粨鏉熺殑鍑哄簱浠诲姟锛岄偅涔堝氨 鍒濆鍖栬姹傚嚭搴撴寚浠�
+//                                using (StationServiceClient client = new StationServiceClient())
+//                                {
+//                                    var res = await client.WriteOutStoreTaskInfoAsync(true, (int)EDevice.Station, rgvLocation, "", 0);
+//                                    if (!res.result)
+//                                    {
+//                                        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-鍒濆鍖栬姹傚嚭搴撴寚浠� 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
+//                                        continue;
+//                                    }
+//                                    else
+//                                    {
+//                                        //Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鍒濆鍖栬姹傚嚭搴撴寚浠� 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+//                                    }
+//                                }
+//                            }
+
+//                            //瑕佹槸鏈夊凡涓嬪彂鐨勪换鍔★紝灏变笉瑕佹墽琛�
+//                            var isValidate = TaskHandler.ValidateIssueOutTaskForRobotBuffer(wmsDB);
+//                            if (!isValidate)
+//                            {
+//                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-鏈夆�樺凡涓嬪彂鈥欑殑浠诲姟锛屼笉鑳藉鐞�,姝ゆ寰幆缁撴潫";
+//                                continue;
+//                            }
+
+//                            //鍙栧垱寤烘椂闂存渶鏃╃殑閭d釜瑕佸嚭搴撶殑鍖�
+//                            if (string.IsNullOrEmpty(FormCC.currHandlerPackageCodeForIssueOutboundTask))
+//                            {
+//                                var firstTask = wmsDB.wms_rbline_task.Where(x =>
+//                           (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+//                          && x.TaskStatus == (int)TaskStatusEnum.鏂板缓).OrderBy(x => x.CreateTime).FirstOrDefault();
+//                                if (firstTask == null)
+//                                {
+//                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()},鏍规嵁 娌℃湁鎵惧埌 鏂板缓 鐨勪换鍔� ";
+//                                    FormCC.currHandlerPackageCodeForIssueOutboundTask = "";
+//                                    continue;
+//                                }
+//                                FormCC.currHandlerPackageCodeForIssueOutboundTask = firstTask.PackageCode;
+//                            }
+//                            else
+//                            {
+//                                var firstTask = wmsDB.wms_rbline_task.Where(x =>
+//                           (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+//                          && x.TaskStatus == (int)TaskStatusEnum.鏂板缓
+//                          && x.PackageCode == FormCC.currHandlerPackageCodeForIssueOutboundTask
+//                          ).OrderBy(x => x.CreateTime).FirstOrDefault();
+//                                if (firstTask == null)
+//                                {
+//                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()},鏍规嵁 娌℃湁鎵惧埌 鏂板缓 鐨勪换鍔� ";
+//                                    FormCC.currHandlerPackageCodeForIssueOutboundTask = "";
+//                                    continue;
+//                                }
+//                            }
+
+//                            var taskList = wmsDB.wms_rbline_task.Where(x =>
+//                          (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+//                          && x.TaskStatus == (int)TaskStatusEnum.鏂板缓).Where(x => x.PackageCode == FormCC.currHandlerPackageCodeForIssueOutboundTask).OrderBy(x => x.CreateTime).ToList();
+//                            if (taskList == null)
+//                            {
+//                                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, false, rgvLocation);
+//                            //    //if (!res.result)
+//                            //    //{
+//                            //    //    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,OutboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
+//                            //    //    continue;
+//                            //    //}
+//                            //    //else
+//                            //    //{
+//                            //    //    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+//                            //    //}
+
+//                            //    var res = await client.WriteOutStoreTaskInfoAsync(false, (int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
+//                            //    if (!res.result)
+//                            //    {
+//                            //        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
+//                            //        continue;
+//                            //    }
+//                            //    else
+//                            //    {
+//                            //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+//                            //    }
+//                            //}
+
+//                            doTask.TaskStatus = (int)TaskStatusEnum.宸蹭笅鍙�;
+//                            doTask.IssueTime = DateTime.Now;
+
+//                            int changeNum = wmsDB.SaveChanges();
+//                            if (changeNum > 0)
+//                            {
+//                                //蹇呴』瑕佺粰PLC涓嬪彂鎴愬姛,瑙e喅鍙兘浼氱粰PLC閲嶅涓嬪彂浠诲姟鐨勬儏鍐�
+//                                var isRight = true;
+//                                while (isRight)
+//                                {
+//                                    //杩欓噷涓嬪彂 鍑哄簱浠诲姟
+//                                    using (StationServiceClient client = new StationServiceClient())
+//                                    {
+
+//                                        var res = await client.WriteOutStoreTaskInfoAsync(false, (int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
+//                                        if (!res.result)
+//                                        {
+//                                            SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}鍙傛暟: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo}";
+//                                            Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync锛屽弬鏁�: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},鏉$爜:{doTask.Upi}");
+//                                            continue;
+//                                        }
+//                                        else
+//                                        {
+//                                            Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},鏉$爜:{doTask.Upi}");
+//                                            isRight = false;
+//                                        }
+//                                    }
+//                                    Thread.Sleep(1000);
+//                                }
+//                            }
+//                        }
+
+//                    }
+//                }
+//                catch (Exception ex)
+//                {
+//                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask += " 鍑虹幇寮傚父:" + ex.Message + SysGloble.SPLIT_STR;
+//                    Log4NetHelper.WriteErrorLog(logType, " 鍑虹幇寮傚父锛�" + ex.Message, ex);
+//                }
+//            }
+//        }
+
+//    }
+//}
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 cca89f1..fef2874 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"
@@ -67,7 +67,7 @@
                             var isValidate = TaskHandler.ValidateIssueOutTaskForRobotBuffer(wmsDB);
                             if (!isValidate)
                             {
-                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-鏈夆�樺凡涓嬪彂鈥欑殑浠诲姟锛屼笉鑳藉鐞�,姝ゆ寰幆缁撴潫";
+                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $" 褰撳墠鏈夆�樺凡涓嬪彂鈥欑殑鍑哄簱浠诲姟锛屼笉鑳藉啀娆″鐞嗕笅鍙戜换鍔�,姝ゆ寰幆缁撴潫";
                                 continue;
                             }
 
@@ -112,37 +112,63 @@
                             var doTask = taskList.FirstOrDefault();
 
 
-                            //杩欓噷涓嬪彂 鍑哄簱浠诲姟
-                            using (StationServiceClient client = new StationServiceClient())
-                            {
-                                //棣栧厛瑕佹竻鐞�
-                                //var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, false, rgvLocation);
-                                //if (!res.result)
-                                //{
-                                //    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,OutboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
-                                //    continue;
-                                //}
-                                //else
-                                //{
-                                //    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                                //}
+                            ////杩欓噷涓嬪彂 鍑哄簱浠诲姟
+                            //using (StationServiceClient client = new StationServiceClient())
+                            //{
+                            //    //棣栧厛瑕佹竻鐞�
+                            //    //var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, false, rgvLocation);
+                            //    //if (!res.result)
+                            //    //{
+                            //    //    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,OutboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
+                            //    //    continue;
+                            //    //}
+                            //    //else
+                            //    //{
+                            //    //    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+                            //    //}
 
-                                var res = await client.WriteOutStoreTaskInfoAsync(false, (int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
-                                if (!res.result)
-                                {
-                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
-                                    continue;
-                                }
-                                else
-                                {
-                                    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
-                                }
-                            }
+                            //    var res = await client.WriteOutStoreTaskInfoAsync(false, (int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
+                            //    if (!res.result)
+                            //    {
+                            //        SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}";
+                            //        continue;
+                            //    }
+                            //    else
+                            //    {
+                            //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+                            //    }
+                            //}
 
                             doTask.TaskStatus = (int)TaskStatusEnum.宸蹭笅鍙�;
                             doTask.IssueTime = DateTime.Now;
 
-                            wmsDB.SaveChanges();
+                            int changeNum = wmsDB.SaveChanges();
+                            if (changeNum > 0)
+                            {
+                                //蹇呴』瑕佺粰PLC涓嬪彂鎴愬姛,瑙e喅鍙兘浼氱粰PLC閲嶅涓嬪彂浠诲姟鐨勬儏鍐�
+                                var isRight = true;
+                                while (isRight)
+                                {
+                                    //杩欓噷涓嬪彂 鍑哄簱浠诲姟
+                                    using (StationServiceClient client = new StationServiceClient())
+                                    {
+
+                                        var res = await client.WriteOutStoreTaskInfoAsync(false, (int)EDevice.Station, rgvLocation, doTask.PlaceCode, Convert.ToInt32(doTask.TaskNo));
+                                        if (!res.result)
+                                        {
+                                            SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync 杩斿洖:{res.resMsg}鍙傛暟: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo}";
+                                            Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 澶辫触,WriteOutStoreTaskInfoAsync锛屽弬鏁�: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},鏉$爜:{doTask.Upi}");
+                                            continue;
+                                        }
+                                        else
+                                        {
+                                            Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,WriteOutStoreTaskInfoAsync锛屽弬鏁�: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},鏉$爜:{doTask.Upi}");
+                                            isRight = false;
+                                        }
+                                    }
+                                    Thread.Sleep(1000);
+                                }
+                            }
                         }
 
                     }
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 - \345\244\215\345\210\266.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 - \345\244\215\345\210\266.cs"
new file mode 100644
index 0000000..b91cec5
--- /dev/null
+++ "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 - \345\244\215\345\210\266.cs"
@@ -0,0 +1,262 @@
+锘�//using Admin.NET.Application;
+//using iWareCC.StationService;
+//using iWareCommon.Common.Globle;
+//using iWareCommon.Utils;
+//using iWareModel;
+//using iWareSql.DataAccess;
+//using iWareSql.WmsDBModel;
+//using System;
+//using System.Linq;
+//using System.Threading;
+//using System.Threading.Tasks;
+
+//namespace iWareCC.ThreadService
+//{
+//    /// <summary>
+//    /// 鏈哄櫒浜虹紦瀛樺矝鍑哄簱浠诲姟瀹屾垚澶勭悊
+//    /// </summary>
+//    public static class DataProcess_RobotBuffer_FinishTaskForOutbound
+//    {
+//        public static async void Handler()
+//        {
+//            var alertMsg = "";
+//            LogType logType = LogType.DataProcess_RobotBuffer_FinishTaskForOutbound;
+//            while (true)
+//            {
+//                Thread.Sleep(500);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
+//                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = string.Empty;
+//                try
+//                {//SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTaskForOutbound &&
+//                    if (SystemValue.isStartedModel)
+//                    {
+//                        var rgvLocation = StationLocationEnum.BZ39.ToString();
+//                        if (FormCC.stationView == null)
+//                        {
+//                            SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-鑾峰彇PLC瀵硅薄涓簄ull";
+//                            continue;
+//                        }
+//                        var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
+//                        if (obj.R_OutboundFinish)
+//                        {
+//                            //var result = obj.R_OutboundNumber;
+//                            //if (string.IsNullOrEmpty(result))
+//                            //{
+//                            //    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}- 鍑哄簱搴撲綅鍙锋槸绌虹殑,姝ゆ寰幆缁撴潫";
+//                            //    continue;
+//                            //}
+
+//                            var result2 = obj.R_Outbound_TaskID;
+//                            if (result2 == 0)
+//                            {
+//                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}- 鍑哄簱浠诲姟鍙锋槸绌虹殑,姝ゆ寰幆缁撴潫";
+//                                continue;
+//                            }
+
+
+
+//                            using (WmsDBModel wmsDB = new WmsDBModel())
+//                            {
+//                                var task = wmsDB.wms_rbline_task.Where(x =>
+//                                 x.TaskNo == obj.R_Outbound_TaskID.ToString()
+//                                && (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 isSuccess = await HandlerData(wmsDB, task, rgvLocation, logType, false);
+//                                if (isSuccess == false)
+//                                {
+//                                    continue;
+//                                }
+
+//                                //var upiCode = task.Upi;
+//                                //var upiObj = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == upiCode).FirstOrDefault();
+//                                //if (upiObj == null)
+//                                //{
+//                                //    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);
+
+//                                //task.TaskStatus = (int)TaskStatusEnum.宸插畬鎴�;
+//                                //task.FinishedTime = DateTime.Now;
+
+//                                //var place = StationHandler.GetPlaceByPlaceCode(task.PlaceCode, wmsDB);
+//                                //place.PlaceStatus = (int)PlaceStatusEnum.姝e父;
+
+//                                ////缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
+//                                //using (StationServiceClient client = new StationServiceClient())
+//                                //{
+//                                //    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}";
+//                                //        continue;
+//                                //    }
+//                                //    else
+//                                //    {
+//                                //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+//                                //    }
+//                                //}
+
+//                                //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);
+//                            }
+
+//                            using (WmsDBModel wmsDB = new WmsDBModel())
+//                            {
+//                                var task = wmsDB.wms_rbline_task.Where(x =>
+//                                 x.IsFlagFinish == true
+//                               && (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
+//                                && x.TaskStatus == (int)TaskStatusEnum.宸蹭笅鍙�
+//                                ).OrderByDescending(x => x.Id).FirstOrDefault();
+//                                if (task == null)
+//                                {
+//                                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()},娌℃湁鎵惧埌宸蹭笅鍙�,骞朵笖鏍囪寮哄埗瀹屾垚鐨勪换鍔� ";
+//                                    continue;
+//                                }
+
+//                                var isSuccess = await HandlerData(wmsDB, task, rgvLocation, logType, true);
+//                                if (isSuccess == false)
+//                                {
+//                                    continue;
+//                                }
+//                            }
+//                        }
+//                    }
+//                }
+//                catch (Exception ex)
+//                {
+//                    SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound += " 鍑虹幇寮傚父:" + ex.Message + SysGloble.SPLIT_STR;
+//                    Log4NetHelper.WriteErrorLog(logType, " 鍑虹幇寮傚父锛�" + ex.Message, ex);
+//                }
+//            }
+//        }
+
+
+//        public static async Task<bool> HandlerData(WmsDBModel wmsDB, wms_rbline_task task, string rgvLocation, iWareCommon.Utils.LogType logType, bool isFlagFinish)
+//        {
+//            var upiCode = task.Upi;
+//            var upiObj = wmsDB.mes_batchOrderUPI_new.Where(x => x.UPI == upiCode).FirstOrDefault();
+//            if (upiObj == null)
+//            {
+//                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()},鏍规嵁UPI:{upiCode}娌℃湁鎵惧埌瀵硅薄 ";
+//                return false;
+//            }
+//            //鏇存柊鏉夸欢鐨勭姸鎬佸拰鍖哄煙
+//            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);
+
+//            task.TaskStatus = (int)TaskStatusEnum.宸插畬鎴�;
+//            task.FinishedTime = DateTime.Now;
+
+//            var place = StationHandler.GetPlaceByPlaceCode(task.PlaceCode, wmsDB);
+//            place.PlaceStatus = (int)PlaceStatusEnum.姝e父;
+
+//            //if (isFlagFinish == false)
+//            //{
+//            //    //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
+//            //    using (StationServiceClient client = new StationServiceClient())
+//            //    {
+//            //        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}";
+//            //            return false;
+//            //        }
+//            //        else
+//            //        {
+//            //            Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-涓嬪彂鍑哄簱浠诲姟 鎴愬姛,OutboundFinishConfirmAsync锛屽弬鏁�: 绔欑偣{rgvLocation}");
+//            //        }
+//            //    }
+//            //}
+
+//            var flag = isFlagFinish ? "浜哄伐寮哄埗瀹屾垚" : "锛堣嚜鍔ㄥ畬鎴愶級";
+//            WmsRecordUpiProcessHandler.SaveWmsRecordUpiProcess(wmsDB, upiObj, task.PlaceCode, $"鍑虹紦瀛樺簱锛歿task.PlaceCode}(" + flag + ")," + task.TaskMsg);
+
+//            int changeNum = wmsDB.SaveChanges();
+//            if (changeNum > 0)
+//            {
+//                //蹇呴』瑕佺粰PLC涓嬪彂鎴愬姛,瑙e喅鍙兘浼氱粰PLC閲嶅涓嬪彂浠诲姟鐨勬儏鍐�
+//                var isRight = true;
+
+//                if (isFlagFinish == false)
+//                {
+//                    while (isRight)
+//                    {
+//                        var obj = FormCC.stationView.R_StationForReadCommList.Where(x => x.StationCode == rgvLocation.ToString()).FirstOrDefault();
+//                        isRight = obj.R_OutboundFinish;
+//                        //缁橮LC鎺ㄩ�佷换鍔″畬鎴愮‘璁や俊鍙�
+//                        using (StationServiceClient client = new StationServiceClient())
+//                        {
+//                            var res = await client.OutboundFinishConfirmAsync((int)EDevice.Station, true, rgvLocation, true);
+//                            if (!res.result)
+//                            {
+//                                SystemWarningMsg._lbl_Alert_DataProcess_RobotBuffer_FinishTaskForOutbound = $"{rgvLocation.ToString()}-涓嬪彂鍏ュ簱浠诲姟 澶辫触,InboundFinishConfirmAsync 杩斿洖:{res.resMsg}";
+//                                Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-瀹屾垚鍑哄簱浠诲姟銆恡rue銆� 澶辫触,OutboundFinishConfirmAsync锛岃繑鍥�:{res.resMsg}锛屽弬鏁�:TaskNo:{task.TaskNo}, PlaceCode锛歿task.PlaceCode},鏉$爜:{task.Upi}");
+//                            }
+//                            else
+//                            {
+//                                Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-瀹屾垚鍑哄簱浠诲姟銆恡rue銆� 鎴愬姛,OutboundFinishConfirmAsync锛岋紝鍙傛暟:TaskNo:{task.TaskNo}, PlaceCode锛歿task.PlaceCode},鏉$爜:{task.Upi}");
+//                                //isRight = false;
+//                            }
+//                        }
+//                        Thread.Sleep(1000);
+//                    }
+//                }
+//            }
+
+//            return true;
+//        }
+
+//    }
+//}
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 7da8129..d5b63ec 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"
@@ -58,6 +58,9 @@
                             {
                                 var task = wmsDB.wms_rbline_task.Where(x =>
                                  x.TaskNo == obj.R_Outbound_TaskID.ToString()
+                                //澧炲姞杩欎袱涓檺鍒舵潯浠� 銆怑ditby shaocx,2025-03-27銆�
+                                && x.TaskStatus == (int)TaskStatusEnum.宸蹭笅鍙�
+                                && (x.IsFlagFinish == false)
                                 && (x.RbTaskType == (int)RbTaskTypeEnum.榻愬寘鍑哄簱浠诲姟 || x.RbTaskType == (int)RbTaskTypeEnum.寮哄埗鍑哄簱浠诲姟)
                                 ).OrderByDescending(x => x.Id).FirstOrDefault();
                                 if (task == null)
diff --git a/CC/iWareCC_ASRS/iWareCC.csproj b/CC/iWareCC_ASRS/iWareCC.csproj
index 5bf2ba5..21bf0fa 100644
--- a/CC/iWareCC_ASRS/iWareCC.csproj
+++ b/CC/iWareCC_ASRS/iWareCC.csproj
@@ -171,6 +171,8 @@
     <Compile Include="ThreadService\01_BZ01宸ヤ綅锛堟竻鐏帮紝娲楁澘鍚庡伐浣嶏級\DataProcess_BZ01.cs" />
     <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡DataProcess_RobotBuffer_ModeChange.cs" />
     <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡Inbound\2銆丏ataProcess_BZ39_IssueInboundTask.cs" />
+    <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡Outbound\2銆丏ataProcess_RobotBuffer_IssueOutboundTask - 澶嶅埗.cs" />
+    <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡Outbound\3銆丏ataProcess_RobotBuffer_FinishTaskForOutbound - 澶嶅埗.cs" />
     <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡Outbound\5銆丏ataProcess_RobotBuffer_PesonOutbound.cs" />
     <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡Outbound\4銆丏ataProcess_RobotBuffer_ForceOutbound.cs" />
     <Compile Include="ThreadService\02_BZ39宸ヤ綅锛堣ˉ鏉垮悗宸ヤ綅锛塡Outbound\CC_DataProcess_RobotBuffer_ForceOutbound.cs" />
diff --git a/CC/iWareCommon/BusinessHelper/BusinessHelper.cs b/CC/iWareCommon/BusinessHelper/BusinessHelper.cs
index b241c06..73ec00c 100644
--- a/CC/iWareCommon/BusinessHelper/BusinessHelper.cs
+++ b/CC/iWareCommon/BusinessHelper/BusinessHelper.cs
@@ -136,7 +136,7 @@
         {
             int iSeed = 9999;
             //浠�101-9999锛屼负浠�涔堣浠�101寮�濮嬶紝鍥犱负1-100浣滀负鎵嬪姩浠诲姟涓嬪彂銆傘�怑ditBy shaocx,2022-05-10銆�
-            return new Random(Guid.NewGuid().GetHashCode()).Next(101, iSeed).ToString();
+            return new Random(Guid.NewGuid().GetHashCode()).Next(100, iSeed).ToString();
         }
     }
 }

--
Gitblit v1.9.3