From 1181f9f764b14abd6e9f598f89f8507b4bbfad0d Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 三月 2026 09:47:10 +0800
Subject: [PATCH] 设置登录默认值;添加数据传输对象;更新服务器作业

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs |  131 ++++++-------------------------------------
 1 files changed, 19 insertions(+), 112 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
index ae00347..0ba6a33 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/ConveyorLineDispatchHandler.cs
@@ -19,6 +19,7 @@
 
 using AutoMapper;
 using System.Data;
+using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_ITaskInfoService;
@@ -96,11 +97,7 @@
                 if (string.Equals(task.NextAddress, ConstraintMachineName, StringComparison.Ordinal))
                 {
                     ConstraintMachine? constraint = devices.OfType<ConstraintMachine>().FirstOrDefault(d => d.DeviceName == ConstraintMachineName);
-                    if (constraint == null)
-                    {
-                        // 处理 processing 为空的情况(可根据实际业务需求添加处理逻辑)
-                        return;
-                    }
+                    if (constraint == null) return;
 
                     ProcessDeviceRequest(conveyorLine, constraint, childDeviceCode,
                     () => constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper),
@@ -110,11 +107,7 @@
                 else if (string.Equals(task.NextAddress, PinMachineName, StringComparison.Ordinal))
                 {
                     PinMachine? pinMachine = devices.OfType<PinMachine>().FirstOrDefault(d => d.DeviceName == PinMachineName);
-                    if (pinMachine == null)
-                    {
-                        // 处理 pinMachine 为空的情况(可根据实际业务需求添加处理逻辑)
-                        return;
-                    }
+                    if (pinMachine == null) return;
 
                     ProcessDeviceRequest(conveyorLine, pinMachine, childDeviceCode,
                     () => pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper),
@@ -123,10 +116,13 @@
                 }
 
                 Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
-                //if (newTask != null)
-                //{
-                //    _taskService.UpdateTaskStatusToNext(task);
-                //}
+                if (newTask != null)
+                {
+                    if (_taskService.UpdateTaskStatusToNext(newTask).Status && newTask.TaskState == (int)TaskInStatusEnum.Line_InFinish)
+                    {
+                        conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_STB, 1, childDeviceCode);
+                    }
+                }
             }
         }
 
@@ -158,9 +154,14 @@
             Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
             if (task != null)
             {
-                ConveyorLineTaskCommandNew taskCommand = _mapper.Map<ConveyorLineTaskCommandNew>(task);
-                taskCommand.WCS_ACK = command.WCS_ACK;
-                conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                //ConveyorLineTaskCommandNew taskCommand = _mapper.Map<ConveyorLineTaskCommandNew>(task);
+                //taskCommand.WCS_ACK = command.WCS_ACK;
+                //conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+                conveyorLine.SetValue(ConveyorLineDBNameNew.TaskNo, task.TaskNum, childDeviceCode);
+                conveyorLine.SetValue(ConveyorLineDBNameNew.Barcode, task.PalletCode, childDeviceCode);
+                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, task.TargetAddress, childDeviceCode);
+                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
 
                 _taskService.UpdateTaskStatusToNext(task);
             }
@@ -210,6 +211,7 @@
                 }
 
                 Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+
             }
         }
 
@@ -227,101 +229,6 @@
                 conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
                 Console.Out.WriteLine(content.Serialize());
-            }
-        }
-
-        /// <summary>
-        /// 入库拘束机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="constraint"></param>
-        /// <param name="childDeviceCode"></param>
-        public void InboundConstraintMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, ConstraintMachine? constraint, string childDeviceCode)
-        {
-            //入库拘束机请求处理逻辑
-            bool materialReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestUpper);
-            bool outputReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestUpper);
-
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                constraint.SetValue(ConstraintMachineDBName.ConstraintTrayOutputReadyUpper, outputReq ? 1 : 0);
-            }
-        }
-
-        /// <summary>
-        /// 入库插拔钉机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="pinMachine"></param>
-        /// <param name="childDeviceCode"></param>
-        public void InboundPinMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, PinMachine? pinMachine, string childDeviceCode)
-        {
-            //入库插拔钉机请求处理逻辑
-            bool materialReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestUpper);
-            bool outputReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestUpper);
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                pinMachine.SetValue(PinMachineDBName.PlugPinTrayOutputReadyUpper, outputReq ? 1 : 0);
-            }
-        }
-
-        /// <summary>
-        /// 出库拘束机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="constraint"></param>
-        /// <param name="childDeviceCode"></param>
-        public void OutConstraintMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, ConstraintMachine? constraint, string childDeviceCode)
-        {
-            //出库拘束机请求处理逻辑
-
-            bool materialReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.MaterialRequestLower);
-            bool outputReq = constraint.GetValue<ConstraintMachineDBName, bool>(ConstraintMachineDBName.OutputRequestLower);
-
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                constraint.SetValue(ConstraintMachineDBName.ConstraintTrayOutputReadyLower, outputReq ? 1 : 0);
-            }
-        }
-
-        /// <summary>
-        /// 出库插拔钉机请求处理
-        /// </summary>
-        /// <param name="conveyorLine"></param>
-        /// <param name="command"></param>
-        /// <param name="pinMachine"></param>
-        /// <param name="childDeviceCode"></param>
-        public void OutPinMachineRequest(CommonConveyorLine conveyorLine, ConveyorLineTaskCommandNew command, PinMachine? pinMachine, string childDeviceCode)
-        {
-            //出库插拔钉机请求处理逻辑
-            bool materialReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.MaterialRequestLower);
-            bool outputReq = pinMachine.GetValue<PinMachineDBName, bool>(PinMachineDBName.OutputRequestLower);
-            if (materialReq)
-            {
-                conveyorLine.SetValue(ConveyorLineDBNameNew.Target, 1, childDeviceCode);
-                conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 1, childDeviceCode);
-            }
-            else
-            {
-                pinMachine.SetValue(PinMachineDBName.PlugPinTrayOutputReadyLower, outputReq ? 1 : 0);
             }
         }
 

--
Gitblit v1.9.3