From 29f20b28392d212c04c0c40a512894f8622cfa53 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 16 四月 2025 09:32:01 +0800
Subject: [PATCH] 合并

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs |  396 ++++++++++++++++++++++----------------------------------
 1 files changed, 158 insertions(+), 238 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
index 3b8909c..eef4783 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -1,8 +1,10 @@
 锘縰sing HslCommunication;
+using HslCommunication.Profinet.OpenProtocol;
 using Mapster;
 using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
 using Microsoft.CodeAnalysis;
 using Microsoft.VisualBasic;
+using MoYu.Logging;
 using Newtonsoft.Json;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
@@ -174,8 +176,8 @@
                         SourceAddress = childDeviceCode,
                         TargetAddress = isTrue,
                         TaskState = (int)TaskOutStatusEnum.SC_OutFinish,
-                        Id = 0,
-                        TaskType = (int)TaskOutboundTypeEnum.TrayInToOut,
+                        Id = 2,
+                        TaskType = (int)TaskOutboundTypeEnum.OutTray,
                         ProductionLine = result.ProductionLine,
                     };
                 }
@@ -294,7 +296,7 @@
                 var Traycontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
                 if (Traycontent.Status)
                 {
-                    ConsoleHelper.WriteSuccessLine("璇锋眰鍥炴祦闈欑疆");
+                    ConsoleHelper.WriteSuccessLine("浜屽皝绌烘璇锋眰鍥炴祦");
                     ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
                 }
             }
@@ -318,9 +320,9 @@
                     RoadWay = childDeviceCode,
                     SourceAddress = childDeviceCode,
                     TargetAddress = isTrue,
-                    TaskState = (int)TaskOutStatusEnum.OutNew,
+                    TaskState = (int)TaskOutStatusEnum.SC_OutFinish,
                     Id = 2,
-                    TaskType = (int)TaskOutboundTypeEnum.InToOut,
+                    TaskType = (int)TaskOutboundTypeEnum.OutTray,
                     ProductionLine = result.ProductionLine,
                 };
                 var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
@@ -338,68 +340,6 @@
                     ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
                 }
             }
-            #region
-
-            //if (Taskcontent.Status)
-            //{
-            //    var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
-            //    if (task != null)
-            //    {
-            //        var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue;
-            //        var valueList = value.Split(',').ToList();
-            //        if (valueList.Contains(task.SourceAddress))
-            //        {
-            //            conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode);
-
-            //            var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵task.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵task.PalletCode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵1000}銆�";
-            //            ConsoleHelper.WriteWarningLine(log);
-
-            //            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
-            //            WriteInfo(conveyorLine.DeviceName, log);
-
-            //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-            //        }
-            //        else if (task.TargetAddress == "1020-1")
-            //        {
-            //            var next = task.NextAddress;
-            //            var taskCommand = MapTaskCommand(task, command);
-            //            task.NextAddress = next;
-
-            //            var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�";
-            //            ConsoleHelper.WriteWarningLine(log);
-
-            //            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
-            //            WriteInfo(conveyorLine.DeviceName, log);
-
-            //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-            //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
-            //            var taskHty = task.Adapt<Dt_Task_Hty>();
-            //            _task_HtyRepository.AddData(taskHty);
-            //            _taskService.DeleteData(task);
-            //        }
-            //        else
-            //        {
-            //            var next = task.NextAddress;
-            //            var taskCommand = MapTaskCommand(task, command);
-            //            task.NextAddress = next;
-
-            //            var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�";
-            //            ConsoleHelper.WriteWarningLine(log);
-
-            //            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
-            //            WriteInfo(conveyorLine.DeviceName, log);
-
-            //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-            //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-            //            _taskService.UpdateTaskStatusToNext(task);
-            //        }
-            //    }
-            //}
-            //else
-            //    WriteInfo(conveyorLine.DeviceName, content.Message);
-
-            #endregion
         }
 
         /// <summary>
@@ -414,127 +354,109 @@
         /// <exception cref="InvalidOperationException"></exception>
         private async Task JZRequestInBound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, Dt_StationManager stationManager)
         {
-
-            ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
-
-            ResultTrayCellsStatus resultTrayCellsStatus = GetResultTrayCellsStatus(command, stationManager);
-
-
-            //todo鍒ゆ柇鏄惁涓虹┖妗�
-            var serialNosError = resultTrayCellsStatus.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList();
-            if (serialNosError.Count > 0)
+            try
             {
-                //NG娴佺▼
-                var platform = _platFormRepository.QueryFirst(x => x.ProductionLine == resultTrayCellsStatus.ProductionLine);
-                ConveyorLineTaskCommand conveyorLineTaskCommand = new ConveyorLineTaskCommand()
+                StaticVariable.isLineRun = false;
+                
+                if (StaticVariable.isStackerRun)
                 {
-                    TaskNum = 1,
-                    TargetAddress=Convert.ToInt32( platform.Capacity),
-                    Barcode= resultTrayCellsStatus.TrayBarcode,
-                };
-                conveyorLine.SendCommand(conveyorLineTaskCommand, childDeviceCode);
-                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                ConsoleHelper.WriteSuccessLine($"MOM鏁版嵁寮傚父,閫佽嚦浜屽皝銆恵resultTrayCellsStatus.ProductionLine}銆戝紓甯稿彛銆恵Convert.ToInt32(platform.Capacity)}銆�");
-                return;
-            }
-            if (resultTrayCellsStatus.SerialNos.Count == 0)
-            {
-                var Traycontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
-                if (Traycontent.Status)
-                {
-                    ConsoleHelper.WriteSuccessLine("鍖栨垚绌烘璇锋眰鍥炴祦闈欑疆");
                     ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
+                }
+
+                ResultTrayCellsStatus resultTrayCellsStatus = GetResultTrayCellsStatus(command, stationManager);
+
+
+                //todo鍒ゆ柇鏄惁涓虹┖妗�
+                var serialNosError = resultTrayCellsStatus.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList();
+                if (serialNosError.Count > 0 || !resultTrayCellsStatus.Success)
+                {
+                    //NG娴佺▼
+                    var platform = _platFormRepository.QueryFirst(x => x.ProductionLine == resultTrayCellsStatus.ProductionLine && x.DeviceCode == "1005");
+                    ConveyorLineTaskCommand conveyorLineTaskCommand = new ConveyorLineTaskCommand()
+                    {
+                        TaskNum = 1,
+                        TargetAddress = Convert.ToInt32(platform.Capacity),
+                        Barcode = resultTrayCellsStatus.TrayBarcode,
+                        InteractiveSignal = command.InteractiveSignal
+                    };
+                    conveyorLine.SendCommand(conveyorLineTaskCommand, childDeviceCode);
+                    var logMessage = $"MOM鏁版嵁寮傚父,閫佽嚦浜屽皝銆恵resultTrayCellsStatus.ProductionLine}銆戝紓甯稿彛銆恵Convert.ToInt32(platform.Capacity)}銆�";
+                    LogAndSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, logMessage, conveyorLineTaskCommand.TargetAddress.ToString());
                     return;
                 }
-            }
-            else
-            {
-                var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
-                var wmsbase = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue;
-                var address = configz.Where(x => x.ConfigKey == SysConfigKeyConst.QueryStockInfoForRealTrayJZAsync).FirstOrDefault()?.ConfigValue;
-                if (wmsbase == null || address == null)
+                if (resultTrayCellsStatus.SerialNos.Count == 0)
                 {
-                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
-                }
-                var wmsIpAddrss = wmsbase + address;
-                var result = await HttpHelper.PostAsync(wmsIpAddrss, new { ProductLine = resultTrayCellsStatus.ProductionLine }.ToJsonString());
-                var StockInfocontent = JsonConvert.DeserializeObject<WebResponseContent>(result);
-                if (StockInfocontent.Status)
-                {
-                    var Taskcontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
-                    if (Taskcontent.Status)
+                    var Traycontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
+                    if (Traycontent.Status)
                     {
-                        var task = _taskRepository.QueryFirst(x => x.Roadway.Contains("JZ") && x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish);
-                        if (task != null && task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+                        ConsoleHelper.WriteSuccessLine("鍖栨垚绌烘璇锋眰鍥炴祦闈欑疆");
+                        if (StaticVariable.isStackerRun)
                         {
-                            ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(stationManager.stationLocation);
-
-                            if (command1.InteractiveSignal != 2)
-                            {
-                                ConsoleHelper.WriteSuccessLine("鍖栨垚瀹炴墭璇锋眰鍏ラ潤缃�");
-                                ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
-                                return;
-                            }
-                            else
-                            {
-                                ConsoleHelper.WriteWarningLine("鍑哄簱浠诲姟鏈畬鎴�");
-                                return;
-                            }
+                            ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
                         }
-                        else if (task != null && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
-                        {
-                            ConsoleHelper.WriteWarningLine("宸插瓨鍦ㄩ潤缃嚭搴撲换鍔�");
-                            return;
-                        }
-                        else
-                        {
-                            var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
-                            if (Task.Status)
-                            {
-                                ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
-                            }
-                            return;
-                        }
-                    }
-                    else
-                    {
-                        WriteInfo(conveyorLine.DeviceName, Taskcontent.Message);
                         return;
                     }
                 }
                 else
                 {
-                    string isTrue = string.Empty;
-
-                    List<string> strings = stationManager.Roadway.Split(",").ToList();
-                    foreach (string item in strings)
+                    var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                    var wmsbase = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue;
+                    var address = configz.Where(x => x.ConfigKey == SysConfigKeyConst.QueryStockInfoForRealTrayJZAsync).FirstOrDefault()?.ConfigValue;
+                    if (wmsbase == null || address == null)
                     {
-                        isTrue = RequestInboundPlatform(item, resultTrayCellsStatus.ProductionLine, false);
-                        if (isTrue != null)
-                        {
-                            break;
-                        }
+                        throw new InvalidOperationException("WMS IP 鏈厤缃�");
                     }
-                    if (isTrue != null && isTrue != string.Empty)
+                    var wmsIpAddrss = wmsbase + address;
+                    var result = await HttpHelper.PostAsync(wmsIpAddrss, new { ProductLine = resultTrayCellsStatus.ProductionLine, PalletCode = command.Barcode }.ToJsonString());
+                    var StockInfocontent = JsonConvert.DeserializeObject<WebResponseContent>(result);
+                    if (StockInfocontent.Status)
                     {
-                        WMSTaskDTO taskDTO = new WMSTaskDTO
-                        {
-                            TaskNum = _taskRepository.GetTaskNo().Result,
-                            Grade = 1,
-                            PalletCode = command.Barcode,
-                            RoadWay = isTrue,
-                            SourceAddress = childDeviceCode,
-                            TargetAddress = isTrue,
-                            TaskState = (int)TaskOutStatusEnum.SC_OutFinish,
-                            Id = 2,
-                            TaskType = (int)TaskOutboundTypeEnum.InToOut,
-                            ProductionLine = resultTrayCellsStatus.ProductionLine,
-                        };
-                        var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+                        var Taskcontent = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
+                        ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(Taskcontent)}");
                         if (Taskcontent.Status)
                         {
-                            ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
-                            return;
+                            if (StaticVariable.isStackerRun)
+                            {
+                                ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
+                            }
+                            #region
+                            //if (task != null && task.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting && task.CurrentAddress == "1537")
+                            //{
+                            //    ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(stationManager.stationLocation);
+
+                            //    if (command1.InteractiveSignal != 2)
+                            //    {
+                            //        ConsoleHelper.WriteSuccessLine("鍖栨垚瀹炴墭璇锋眰鍏ラ潤缃�");
+                            //        if (StaticVariable.isStackerRun == true)
+                            //        {
+                            //            ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
+                            //        }
+                            //        return;
+                            //    }
+                            //    else
+                            //    {
+                            //        ConsoleHelper.WriteWarningLine("鍑哄簱浠诲姟鏈畬鎴�");
+                            //        return;
+                            //    }
+                            //}
+                            //else if (task != null && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
+                            //{
+                            //    ConsoleHelper.WriteWarningLine("宸插瓨鍦ㄩ潤缃嚭搴撲换鍔�");
+                            //    return;
+                            //}
+                            //else
+                            //{
+                            //    var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
+                            //    if (Task.Status)
+                            //    {
+                            //        if (StaticVariable.isStackerRun == true)
+                            //        {
+                            //            ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
+                            //        }
+                            //    }
+                            //    return;
+                            //}
+                            #endregion
                         }
                         else
                         {
@@ -544,76 +466,75 @@
                     }
                     else
                     {
-                        var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
-                        if (Task.Status)
-                        {
-                            ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
-                        }
-                        ConsoleHelper.WriteWarningLine("浜屽皝缂撳瓨浣嶅凡婊�");
-                        return;
-                    }
+                        string isTrue = string.Empty;
 
+                        List<string> strings = stationManager.Roadway.Split(",").ToList();
+                        foreach (string item in strings)
+                        {
+                            isTrue = RequestInboundPlatform(item, resultTrayCellsStatus.ProductionLine, false);
+                            if (isTrue != null)
+                            {
+                                break;
+                            }
+                        }
+                        if (isTrue != null && isTrue != string.Empty)
+                        {
+                            WMSTaskDTO taskDTO = new WMSTaskDTO
+                            {
+                                TaskNum = _taskRepository.GetTaskNo().Result,
+                                Grade = 1,
+                                PalletCode = command.Barcode,
+                                RoadWay = isTrue,
+                                SourceAddress = childDeviceCode,
+                                TargetAddress = isTrue,
+                                TaskState = (int)TaskOutStatusEnum.SC_OutFinish,
+                                Id = 2,
+                                TaskType = (int)TaskOutboundTypeEnum.InToOut,
+                                ProductionLine = resultTrayCellsStatus.ProductionLine,
+                            };
+                            var Taskcontent = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+                            if (Taskcontent.Status)
+                            {
+                                if (StaticVariable.isStackerRun)
+                                {
+                                    ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
+                                }
+                                return;
+                            }
+                            else
+                            {
+                                WriteInfo(conveyorLine.DeviceName, Taskcontent.Message);
+                                return;
+                            }
+                        }
+                        else
+                        {
+                            var Task = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
+                            ConsoleHelper.WriteErrorLine($"{JsonConvert.SerializeObject(Task)}");
+                            if (Task.Status)
+                            {
+                                if (StaticVariable.isStackerRun)
+                                {
+                                    ExecuteConveyorLineTask(conveyorLine, command, ProtocalDetailValue, childDeviceCode);
+                                }
+                            }
+                            ConsoleHelper.WriteWarningLine("浜屽皝缂撳瓨浣嶅凡婊�");
+                            return;
+                        }
+
+                    }
                 }
             }
+            catch (Exception ex)
+            {
+                ConsoleHelper.WriteWarningLine($"{ex.Message}");
+            }
+            finally
+            {
+                StaticVariable.isLineRun = true;
+            }       
         }
-        #region
-        //public void ExecuteConveyorLineTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, int ProtocalDetailValue ,string childDeviceCode)
-        //{
-        //    var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
-        //    if (task != null)
-        //    {
-        //        var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue;
-        //        var valueList = value.Split(',').ToList();
-        //        if (valueList.Contains(task.SourceAddress))
-        //        {
-        //            conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode);
 
-        //            var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵task.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵task.PalletCode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵1000}銆�";
-        //            ConsoleHelper.WriteWarningLine(log);
-
-        //            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
-        //            WriteInfo(conveyorLine.DeviceName, log);
-
-        //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-        //        }
-        //        else if (task.TargetAddress == "1020-1")
-        //        {
-        //            var next = task.NextAddress;
-        //            var taskCommand = MapTaskCommand(task, command);
-        //            task.NextAddress = next;
-
-        //            var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�";
-        //            ConsoleHelper.WriteWarningLine(log);
-
-        //            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
-        //            WriteInfo(conveyorLine.DeviceName, log);
-
-        //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-        //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
-        //            var taskHty = task.Adapt<Dt_Task_Hty>();
-        //            _task_HtyRepository.AddData(taskHty);
-        //            _taskService.DeleteData(task);
-        //        }
-        //        else
-        //        {
-        //            var next = task.NextAddress;
-        //            var taskCommand = MapTaskCommand(task, command);
-        //            task.NextAddress = next;
-
-        //            var log = $"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣姹傛壂鐮佸叆搴�(瀹炵洏),涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�";
-        //            ConsoleHelper.WriteWarningLine(log);
-
-        //            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
-        //            WriteInfo(conveyorLine.DeviceName, log);
-
-        //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-        //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-        //            _taskService.UpdateTaskStatusToNext(task);
-        //        }
-        //    }
-        //}
-        #endregion
         /// <summary>
         /// 鎵ц杈撻�佺嚎浠诲姟
         /// </summary>
@@ -648,11 +569,10 @@
             {
                 // 鏌ヨ鏄惁瀛樺湪闈欑疆鍑哄簱浠诲姟
                 var outJZTask = _taskRepository.QueryData(x => x.Roadway == task.Roadway &&
-                    (x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting ||
-                     x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting ||
-                     x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish));
+                    (x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting ||
+                     x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish || x.TaskState == (int)TaskOutStatusEnum.OutNew));
 
-                if (outJZTask.IsNullOrEmpty())
+                if (!outJZTask.Any())
                 {
                     // 鏄犲皠浠诲姟鍛戒护
                     var taskCommand = MapTaskCommand(task, command);

--
Gitblit v1.9.3