From 98cd144e4d58dbfcc09a2ffb0dbb6925519088b3 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 06 十一月 2024 14:12:56 +0800
Subject: [PATCH] 最新代码更改

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/PlatFormRepository.cs                                    |    8 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs                               |    4 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs                                 |   94 ++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs                                    |  293 ++++++++++--
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/AgingInOrOutController.cs                   |    4 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs                   |   58 +-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                                             |   42 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs                                        |    9 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                                           |   17 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs                             |    6 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/IPlatFormRepository.cs                                   |    5 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs                               |  183 +++++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/AgingInOrOutInput/IAgingInOrOutInputService.cs |    4 
 Code Management/WCS/WIDESEAWCS_Client/src/views/Login.vue                                                                   |    6 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfoDetail.cs                                 |   10 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs                             |  476 +++++++++++---------
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs   |   19 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs                                          |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs                                            |    6 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResponeAgingInputDto.cs                                               |   26 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/Dt_EquipmentProcess.cs                                                |   68 ++
 21 files changed, 1,002 insertions(+), 338 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Client/src/views/Login.vue b/Code Management/WCS/WIDESEAWCS_Client/src/views/Login.vue
index c61c0e8..83c86c7 100644
--- a/Code Management/WCS/WIDESEAWCS_Client/src/views/Login.vue
+++ b/Code Management/WCS/WIDESEAWCS_Client/src/views/Login.vue
@@ -95,9 +95,9 @@
     const loading = ref(false);
     const codeImgSrc = ref('');
     const userInfo = reactive({
-      userName: '',
-      password: '',
-      verificationCode: '',
+      userName: 'admin',
+      password: '123456',
+      verificationCode: '1234',
       UUID: undefined
     });
 
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs
index 98a8147..11bc62f 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs
@@ -22,7 +22,7 @@
             {
                 return TaskTypeGroup.OutbondGroup;
             }
-            else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskType.ToString()).ToString(), out result))
+            else if (!int.TryParse(Enum.Parse<TaskInboundTypeEnum>(taskType.ToString()).ToString(), out result))
             {
                 return TaskTypeGroup.InboundGroup;
             }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
index e1698fd..a0dacf7 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
@@ -71,6 +71,12 @@
         /// </summary>
         [Description("绌烘墭鐩樺嚭搴�")]
         OutTray = 104,
+
+        /// <summary>
+        /// 绌烘墭鐩樺嚭搴�
+        /// </summary>
+        [Description("绌烘墭鐩樺嚭搴�")]
+        OutNG = 105,
     }
 
     public enum TaskRelocationTypeEnum
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
index 5cce460..1a50def 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -73,6 +73,23 @@
         /// <returns></returns>
         Dt_Task QueryConveyorLineTask(string deviceNo, string currentAddress);
 
+
+        /// <summary>
+        /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
+        /// </summary>
+        /// <param name="deviceNo">璁惧缂栧彿</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
+        Dt_Task QueryNextConveyorLineTask(string deviceNo, string currentAddress);
+
+        /// <summary>
+        /// 鏍规嵁鎵樼洏鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
+        /// </summary>
+        /// <param name="Barcode">鎵樼洏鍙�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
+        Dt_Task QueryBarCodeConveyorLineTask(string Barcode, string currentAddress);
+
         /// <summary>
         /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
         /// </summary>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs
new file mode 100644
index 0000000..7055892
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs
@@ -0,0 +1,94 @@
+锘縰sing Magicodes.ExporterAndImporter.Core;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.DB.Models;
+
+namespace WIDESEAWCS_Model.Models
+{
+    [SugarTable("Dt_Platform", "璁惧宸ヨ壓鍙傛暟")]
+    public class Platform : BaseEntity
+    {
+        /// <summary>
+        /// 涓婚敭ID
+        /// </summary>
+        [ImporterHeader(Name = "涓婚敭")]
+        [ExporterHeader(DisplayName = "涓婚敭")]
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+        public int Id { get; set; }
+        /// <summary>
+        /// 绔欏彴缂栧彿锛屽敮涓�鏍囪瘑姣忎釜绔欏彴鐨勭紪鍙�
+        /// </summary>
+        [ImporterHeader(Name = "绔欏彴缂栧彿锛屽敮涓�鏍囪瘑姣忎釜绔欏彴鐨勭紪鍙�")]
+        [ExporterHeader(DisplayName = "绔欏彴缂栧彿锛屽敮涓�鏍囪瘑姣忎釜绔欏彴鐨勭紪鍙�")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "绔欏彴缂栧彿锛屽敮涓�鏍囪瘑姣忎釜绔欏彴鐨勭紪鍙�")]
+        public string PlatCode { get; set; }
+
+        /// <summary>
+        /// 绔欏彴鍚嶇О锛岀珯鍙扮殑鍚嶇О鎴栨弿杩�
+        /// </summary>
+        [ImporterHeader(Name = "绔欏彴鍚嶇О")]
+        [ExporterHeader(DisplayName = "绔欏彴鍚嶇О")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "绔欏彴鍚嶇О")]
+        public string PlatformName { get; set; }
+
+        /// <summary>
+        /// 瀵瑰簲鍫嗗灈鏈�
+        /// </summary>
+        [ImporterHeader(Name = "瀵瑰簲鍫嗗灈鏈�")]
+        [ExporterHeader(DisplayName = "瀵瑰簲鍫嗗灈鏈�")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "瀵瑰簲鍫嗗灈鏈�")]
+        public string Stacker { get; set; }
+
+        /// <summary>
+        /// 鎵ц鏂规硶
+        /// </summary>
+        [ImporterHeader(Name = "鎵ц鏂规硶")]
+        [ExporterHeader(DisplayName = "鎵ц鏂规硶")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎵ц鏂规硶")]
+        public string ExecutionMethod { get; set; }
+
+        /// <summary>
+        /// 绔欏彴绫诲瀷锛岀珯鍙扮殑绫诲瀷
+        /// </summary>
+        [ImporterHeader(Name = "绔欏彴绫诲瀷")]
+        [ExporterHeader(DisplayName = "绔欏彴绫诲瀷")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "绔欏彴绫诲瀷")]
+        public string PlatformType { get; set; }
+
+        /// <summary>
+        /// 瀵瑰簲PLC缂栧彿锛屼笌绔欏彴瀵瑰簲鐨凱LC鐨勭紪鍙�
+        /// </summary>
+        [ImporterHeader(Name = "瀵瑰簲PLC缂栧彿")]
+        [ExporterHeader(DisplayName = "瀵瑰簲PLC缂栧彿")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "瀵瑰簲PLC缂栧彿")]
+        public string PLCCode { get; set; }
+
+        /// <summary>
+        /// 绔欏彴浣嶇疆
+        /// </summary>
+        [ImporterHeader(Name = "绔欏彴浣嶇疆")]
+        [ExporterHeader(DisplayName = "绔欏彴浣嶇疆")]
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "绔欏彴浣嶇疆")]
+        public string Location { get; set; }
+
+        /// <summary>
+        /// 绔欏彴瀹归噺
+        /// </summary>
+        [ImporterHeader(Name = "绔欏彴瀹归噺")]
+        [ExporterHeader(DisplayName = "绔欏彴瀹归噺")]
+        [SugarColumn(IsNullable = true, ColumnDescription = "绔欏彴瀹归噺")]
+        public int Capacity { get; set; }
+
+        /// <summary>
+        /// 绔欏彴鐘舵�侊紝榛樿涓�'Active'
+        /// </summary>
+        [ImporterHeader(Name = "绔欏彴鐘舵��")]
+        [ExporterHeader(DisplayName = "绔欏彴鐘舵��")]
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "绔欏彴鐘舵��")]
+        public string Status { get; set; } = "Active";
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/IPlatFormRepository.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/IPlatFormRepository.cs
new file mode 100644
index 0000000..ef03e54
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/IPlatFormRepository.cs
@@ -0,0 +1,5 @@
+锘縩amespace WIDESEAWCS_IProcessRepository;
+
+public interface IPlatFormRepository : IRepository<Platform>
+{
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/PlatFormRepository.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/PlatFormRepository.cs
new file mode 100644
index 0000000..b79f13a
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/PlatFormRepository.cs
@@ -0,0 +1,8 @@
+锘縩amespace WIDESEAWCS_ProcessRepository;
+
+public class PlatFormRepository : RepositoryBase<Platform>, IPlatFormRepository
+{
+    public PlatFormRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+    {
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
index f67ac7c..d0c9f6f 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
@@ -224,7 +224,7 @@
 
             if (devicePro == null)
             {
-                throw new Exception("鏈壘鍒板崗璁俊鎭�");
+                throw new Exception("鏈壘鍒板崗璁俊鎭�:" + deviceChildCode);
             }
             else
             {
@@ -247,7 +247,7 @@
 
             if (devicePro == null)
             {
-                throw new Exception("鏈壘鍒板崗璁俊鎭�");
+                throw new Exception("鏈壘鍒板崗璁俊鎭�:" + deviceChildCode);
             }
             else
             {
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 20a3264..63d8ec4 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -192,6 +192,28 @@
         }
 
         /// <summary>
+        /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
+        /// </summary>
+        /// <param name="deviceNo">璁惧缂栧彿</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
+        public Dt_Task QueryNextConveyorLineTask(string deviceNo, string currentAddress)
+        {
+            return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) && x.NextAddress == currentAddress, TaskOrderBy);
+        }
+
+        /// <summary>
+        /// 鏍规嵁鎵樼洏鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
+        /// </summary>
+        /// <param name="Barcode">鎵樼洏鍙�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
+        public Dt_Task QueryBarCodeConveyorLineTask(string Barcode, string currentAddress)
+        {
+            return BaseDal.QueryFirst(x => (TaskInboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskInStatusEnum.InNew || TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) && x.CurrentAddress == currentAddress && x.PalletCode == Barcode, TaskOrderBy);
+        }
+
+        /// <summary>
         /// 鏍规嵁浠诲姟鍙枫�佷笅涓�鍦板潃鏌ヨ杈撻�佺嚎鎵ц涓殑浠诲姟
         /// </summary>
         /// <param name="taskNum">浠诲姟鍙�</param>
@@ -397,10 +419,20 @@
 
                     if (task.TaskState == (int)TaskInStatusEnum.Line_InFinish)
                     {
-                        Random random = new Random();
-                        task.CurrentAddress = task.NextAddress;
-                        task.NextAddress = $"{random.Next(1, 1).ToString().PadLeft(3, '0')}-{random.Next(1, 1).ToString().PadLeft(3, '0')}-{random.Next(1, 1).ToString().PadLeft(3, '0')}";
-                        task.TargetAddress = task.NextAddress;
+                        if (task.Roadway.Contains("CH"))
+                        {
+                            Random random = new Random();
+                            task.CurrentAddress = task.NextAddress;
+                            task.NextAddress = $"{random.Next(1, 1).ToString().PadLeft(3, '0')}-{random.Next(0, 0).ToString().PadLeft(3, '0')}-{random.Next(1, 1).ToString().PadLeft(3, '0')}";
+                            task.TargetAddress = task.NextAddress;
+                        }
+                        else
+                        {
+                            Random random = new Random();
+                            task.CurrentAddress = task.NextAddress;
+                            task.NextAddress = "002-020-001";
+                            task.TargetAddress = task.NextAddress;
+                        }
 
                         #region 鐪熷疄鏁版嵁
                         // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
@@ -524,7 +556,7 @@
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)
                 {
-                    //todo
+                    //todo 鍚屾鍒癢MS
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                     task.TaskState = nextStatus;
                     task.ModifyDate = DateTime.Now;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index f2b2880..5733764 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -20,13 +20,16 @@
 using AutoMapper;
 using HslCommunication;
 using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
 using Quartz;
 using SqlSugar;
 using System.Reflection;
+using System.Threading.Tasks;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_IProcessRepository;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
@@ -39,24 +42,23 @@
 namespace WIDESEAWCS_Tasks
 {
     [DisallowConcurrentExecution]
-    public class CommonConveyorLineJob : JobBase, IJob
+    public partial class CommonConveyorLineJob : JobBase, IJob
     {
-        private readonly List<string> _deviceCodes1 = new List<string>() { "1063", "1061", "1060" };
-        private readonly List<string> _deviceCodes2 = new List<string>() { "1067", "1069", "1068" };
-        private readonly string[] HCTrayCode = { "1012", "1013" };
-        private readonly ITaskService _taskService;
+        public readonly ITaskService _taskService;
         private readonly ITaskRepository _taskRepository;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
         private readonly IRouterService _routerService;
+        private readonly IPlatFormRepository _platFormRepository;
         private readonly IMapper _mapper;
 
-        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository)
+        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _routerService = routerService;
             _mapper = mapper;
             _taskRepository = taskRepository;
+            _platFormRepository = platFormRepository;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -108,35 +110,49 @@
                                     }
                                 }
                             }
+
+                            Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
+                            if (platform != null)
+                            {
+                                if (command.InteractiveSignal != 2)
+                                {
+                                    MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                                    if (method != null)
+                                    {
+                                        command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                                        int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1;
+                                        method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count });
+                                    }
+                                }
+                                else
+                                {
+                                    if (!string.IsNullOrEmpty(platform.Location))
+                                    {
+                                        var strings = platform.Location.Split(',').ToList();
+                                        foreach (var ite in strings)
+                                        {
+                                            int index = strings.FindIndex(p => p == ite);
+                                            ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
+                                            if (command1.InteractiveSignal != 2)
+                                            {
+                                                MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                                                if (method != null)
+                                                {
+                                                    command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                                                    int count = strings.Count - index;
+                                                    method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count });
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
                         }
                         //});
+
                         //tasks.Add(task);
+                        Task.WaitAll(tasks.ToArray());
                     }
-                    //for (int i = 0; i < _deviceCodes1.Count; i++)
-                    //{
-                    //    ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(_deviceCodes1[i]);
-                    //    if (command.InteractiveSignal != 2)
-                    //    {
-                    //        EmptyTrayReturn(conveyorLine, command, _deviceCodes1[_deviceCodes1.Count - 1], i);
-                    //    }
-                    //}
-                    //for (int i = 0; i < _deviceCodes2.Count; i++)
-                    //{
-                    //    ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(_deviceCodes2[i]);
-                    //    if (command.InteractiveSignal != 2)
-                    //    {
-                    //        EmptyTrayReturn(conveyorLine, command, _deviceCodes2[_deviceCodes1.Count - 1], i);
-                    //    }
-                    //}
-                    foreach (var item in HCTrayCode)
-                    {
-                        ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(item);
-                        if (command.InteractiveSignal != 2)
-                        {
-                            ChuanhuaOutbound(conveyorLine, command, HCTrayCode[0], 0);
-                        }
-                    }
-                    Task.WaitAll(tasks.ToArray());
                 }
             }
             catch (Exception ex)
@@ -148,6 +164,7 @@
                 //WriteDebug("CommonConveyorLineJob", "test");
                 //Console.Out.WriteLine(DateTime.Now);
             }
+
             return Task.CompletedTask;
         }
 
@@ -160,204 +177,139 @@
         /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
         public void RequestInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
-            var taskNew = _taskService.QueryCraneConveyorLineTask(command.Barcode.ObjToInt(), childDeviceCode);
-            var Taskout = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-            if (Taskout != null)
+            // 鑾峰彇涓嬩竴涓换鍔�
+            var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
+            //var taskOut = _taskService.QueryNextConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+            //return;
+            // 澶勭悊鍑哄簱浠诲姟
+            HandleTaskOut(conveyorLine, command, childDeviceCode, ProtocalDetailValue, task);
+
+            // 濡傛灉娌℃湁鍑哄簱浠诲姟锛屽鐞嗘柊浠诲姟
+            if (task == null)
             {
-                // 绌烘墭鐩樹换鍔�
-                if (Taskout.TaskType == (int)TaskOutboundTypeEnum.OutTray)
-                {
-                    if (Taskout.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
-                    {
-                        ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(Taskout);
-                        taskCommand.InteractiveSignal = command.InteractiveSignal;
-                        if (command.Barcode == "")
-                        {
-                            taskCommand.TargetAddress = 1092;
-                        }
-                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
-                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
-                        _taskService.UpdateTaskStatusToNext(Taskout);
-                    }
-                    else if (Taskout.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
-                    {
-                        if (command.Barcode == "")
-                        {
-                            ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(Taskout);
-                            taskCommand.InteractiveSignal = command.InteractiveSignal;
-                            taskCommand.TargetAddress = 1092;
-                            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
-                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                            _taskService.UpdateTaskStatusToNext(Taskout);
-                        }
-                    }
-                }
-                else if (Taskout.TaskType == (int)TaskOutboundTypeEnum.Outbound)
-                {
-                    if (Taskout.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
-                    {
-                        ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(Taskout);
-                        taskCommand.InteractiveSignal = command.InteractiveSignal;
-                        if (command.Barcode == "")
-                        {
-                            //todo 娌℃湁鏄庣‘寮傚父鍙o紝閫佸埌鐩爣宸烽亾鐨凬G鍙�
-                            //taskCommand.TargetAddress = 1092;
-                        }
-                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
-                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
-                        _taskService.UpdateTaskStatusToNext(Taskout);
-                    }
-                    else if (Taskout.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
-                    {
-                        if (command.Barcode == "")
-                        {
-                            ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(Taskout);
-                            taskCommand.InteractiveSignal = command.InteractiveSignal;
-                            // todo  閫佸埌鐩爣宸烽亾鐨凬G鍙�
-                            taskCommand.TargetAddress = 1092;
-                            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
-                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                            _taskService.UpdateTaskStatusToNext(Taskout);
-                        }
-                        else
-                        {
-                            // todo 璋冪敤WMS浠诲姟瀹屾垚鎺ュ彛
-                            var x = new { taskNum = Taskout.TaskNum };
-                            var result = HttpHelper.GetAsync("http:127.0.0.1:8098/api/Task/CompleteTaskAsync", x.ToJsonString()).Result;
-                            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-                            if (content.Status)
-                            {
-                                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                                _taskService.UpdateTaskStatusToNext(Taskout);
-                            }
-                        }
-                    }
-                }
+                HandleNewTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
             }
-            if (taskNew == null)
-            {
-                if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
-                {
-                    Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-                    if (task != null)
-                    {
-                        ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
-                        taskCommand.InteractiveSignal = command.InteractiveSignal;
-                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
-                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+            #region 鑰佺増鏈�
 
-                        _taskService.UpdateTaskStatusToNext(task);
-                    }
-                }
-            }
-        }
+            //var taskNew = _taskService.QueryCraneConveyorLineTask(command.Barcode.ObjToInt(), childDeviceCode);
+            //var Taskout = _taskService.QueryNextConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+            //if (Taskout != null)
+            //{
+            //    // 绌烘墭鐩樹换鍔�
+            //    if (Taskout.TaskType == (int)TaskOutboundTypeEnum.OutTray)
+            //    {
+            //        ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(Taskout);
+            //        taskCommand.InteractiveSignal = command.InteractiveSignal;
+            //        if (command.Barcode == "")
+            //        {
+            //            var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == Taskout.TargetAddress).Capacity;
+            //            taskCommand.TargetAddress = NGAddress;
+            //        }
+            //        conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
-        //
-        /// <summary>
-        /// 绌烘墭鐩樺洖娴�
-        /// </summary>
-        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
-        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
-        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        /// <param name="index">璇诲彇鐨勭涓�涓綅缃�</param>
-        public void EmptyTrayReturn(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int index)
-        {
-            var tasks = _taskRepository.QueryData(x => (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) && x.TaskType == (int)TaskOutboundTypeEnum.OutTray);
-            if (tasks.Count <= index)
-            {
-                WMSTaskDTO taskDTO = new WMSTaskDTO()
-                {
-                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
-                    Grade = 1,
-                    PalletCode = DateTime.Now.ToString("yyyyMMddHHmmss"),
-                    RoadWay = "CHSC01",
-                    SourceAddress = "001-001-001",
-                    TargetAddress = childDeviceCode,
-                    TaskState = (int)TaskOutStatusEnum.OutNew,
-                    Id = 0,
-                    TaskType = (int)TaskOutboundTypeEnum.OutTray
-                };
+            //        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
 
-                #region 鐪熷疄鏁版嵁
+            //        _taskService.UpdateTaskStatusToNext(Taskout);
+            //    }
+            //    else if (Taskout.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+            //    {
+            //        ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(Taskout);
+            //        taskCommand.InteractiveSignal = command.InteractiveSignal;
+            //        if (Taskout.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
+            //        {
+            //            if (command.Barcode == "")
+            //            {
+            //                var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == Taskout.TargetAddress).Capacity;
+            //                taskCommand.TargetAddress = NGAddress;
+            //            }
+            //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
-                // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
-                //RequestTaskDto request = new RequestTaskDto()
-                //{
-                //    Position = sourceAddress,
-                //    PalletCode = palletCode,
-                //};
+            //            ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
 
-                //// 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                //var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
+            //            _taskService.UpdateTaskStatusToNext(Taskout);
+            //        }
+            //        else if (Taskout.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+            //        {
+            //            if (command.Barcode == "")
+            //            {
+            //                var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == Taskout.TargetAddress).Capacity;
+            //                taskCommand.TargetAddress = NGAddress;
 
-                //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
-                //WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            //                conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
-                //// 妫�鏌ョ姸鎬佸苟杩斿洖
-                ////if (!content.Status)
-                ////    return content;
+            //                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+            //                _taskService.UpdateTaskStatusToNext(Taskout);
+            //            }
+            //            else
+            //            {
+            //                // todo 璋冪敤WMS浠诲姟瀹屾垚鎺ュ彛
+            //                var x = new { taskNum = Taskout.TaskNum };
+            //                var result = HttpHelper.GetAsync("http:127.0.0.1:8098/api/Task/CompleteTaskAsync", x.ToJsonString()).Result;
+            //                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            //                if (content.Status)
+            //                {
+            //                    ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+            //                    _taskService.UpdateTaskStatusToNext(Taskout);
+            //                }
+            //            }
+            //        }
+            //    }
+            //}
+            //if (taskNew == null)
+            //{
+            //    // 鍖栨垚->闄堝寲绌烘墭鐩樺洖娴�
+            //    if (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016")
+            //    {
+            //        //TODO 璋冪敤WMS鍒涘缓鍖栨垚->闄堝寲绌烘墭鐩樺洖娴�
+            //        WMSTaskDTO taskDTO = new WMSTaskDTO()
+            //        {
+            //            TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
+            //            Grade = 1,
+            //            PalletCode = command.Barcode,
+            //            RoadWay = "CHSC01",
+            //            SourceAddress = childDeviceCode,
+            //            TargetAddress = "CHSC01",
+            //            TaskState = (int)TaskInStatusEnum.InNew,
+            //            Id = 0,
+            //            TaskType = (int)TaskInboundTypeEnum.InTray,
+            //        };
+            //        WebResponseContent content = CreateAndSendTask(taskDTO);
+            //        if (content.Status)
+            //        {
+            //            Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+            //            if (task != null)
+            //            {
+            //                ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
+            //                taskCommand.InteractiveSignal = command.InteractiveSignal;
+            //                conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
-                //// 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                //WMSTaskDTO task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+            //                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
 
-                #endregion
+            //                _taskService.UpdateTaskStatusToNext(task);
+            //            }
+            //        }
+            //    }
+            //    else
+            //    {
+            //        if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
+            //        {
+            //            Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+            //            if (task != null)
+            //            {
+            //                ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
+            //                taskCommand.InteractiveSignal = command.InteractiveSignal;
+            //                conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
-                var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
-                if (content.Status)
-                {
-                    Console.WriteLine("绌烘墭鐩樺懠鍙垚鍔�");
-                }
-            }
-        }
+            //                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
 
-        /// <summary>
-        /// 闄堝寲鍑哄簱
-        /// </summary>
-        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
-        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
-        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        /// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
-        public void ChuanhuaOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int index)
-        {
-            var tasks = _taskRepository.QueryData(x => (x.TaskState == (int)TaskOutStatusEnum.OutNew || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting) && x.TaskType == (int)TaskOutboundTypeEnum.Outbound);
-            if (tasks.Count <= index)
-            {
-                WMSTaskDTO taskDTO = new WMSTaskDTO()
-                {
-                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
-                    Grade = 1,
-                    PalletCode = DateTime.Now.ToString("MMddHHmmss"),
-                    RoadWay = "CHSC01",
-                    SourceAddress = "001-001-001",
-                    TargetAddress = childDeviceCode,
-                    TaskState = (int)TaskOutStatusEnum.OutNew,
-                    Id = 0,
-                    TaskType = (int)TaskOutboundTypeEnum.Outbound,
-                };
+            //                _taskService.UpdateTaskStatusToNext(task);
+            //            }
+            //        }
+            //    }
+            //}
 
-                var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
-                if (content.Status)
-                {
-                    Console.WriteLine("鍑哄簱鍛煎彨鎴愬姛");
-                }
-            }
-            else
-            {
-                Dt_Task task = tasks[index];
-                if (task != null)
-                {
-                    ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
-                    taskCommand.InteractiveSignal = command.InteractiveSignal;
-                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                }
-            }
+            #endregion
         }
 
         /// <summary>
@@ -397,6 +349,7 @@
 
                 //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+
                 Console.Out.WriteLine(content.Serialize());
             }
         }
@@ -407,7 +360,8 @@
         /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
         /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
+        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
             Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
             if (task != null)
@@ -416,6 +370,7 @@
                 taskCommand.InteractiveSignal = command.InteractiveSignal;
                 conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                 _taskService.UpdateTaskStatusToNext(task);
             }
         }
@@ -447,14 +402,99 @@
         /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
         /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
+        public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
             Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
             if (task != null)
             {
-                conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
+                ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
+                taskCommand.InteractiveSignal = command.InteractiveSignal;
+                if (task.PalletCode != command.Barcode)
+                {
+                    var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == task.TargetAddress).Capacity;
+                    taskCommand.TargetAddress = NGAddress;
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                }
+                else
+                {
+                    taskCommand.TargetAddress = 0;
+                }
+                // TODO璋冪敤浠诲姟瀹屾垚鎵ц浠诲姟瀹屾垚
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
-                Console.Out.WriteLine(content.Serialize());
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓浠诲姟骞跺彂閫佽姹�
+        /// </summary>
+        private WebResponseContent CreateAndSendTask(WMSTaskDTO taskDTO)
+        {
+            var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+            if (content.Status)
+            {
+                Console.WriteLine($"{taskDTO.TaskType}鍛煎彨鎴愬姛");
+            }
+            return content;
+        }
+
+        /// <summary>
+        /// 闄堝寲绌烘墭鐩樺嚭搴�
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public void EmptyTrayReturn(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int index)
+        {
+            CheckAndCreateTask((int)TaskOutboundTypeEnum.OutTray, childDeviceCode, index, "CHSC01", "001-001-001");
+        }
+
+        /// 闈欑疆绌烘墭鐩樺嚭搴�
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public void EmptyTrayOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int index)
+        {
+            CheckAndCreateTask((int)TaskOutboundTypeEnum.OutTray, childDeviceCode, index, "JZSC01", "002-020-001");
+        }
+
+        /// <summary>
+        /// 闄堝寲鍑哄簱(瀹炵洏)
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public void ChuanhuaOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int index)
+        {
+            CheckAndCreateTask((int)TaskOutboundTypeEnum.Outbound, childDeviceCode, index, "CHSC01", "001-001-001");
+        }
+
+        /// <summary>
+        /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
+        /// </summary>
+        private void CheckAndCreateTask(int taskType, string childDeviceCode, int index, string roadWay, string sourceAddress)
+        {
+            var tasks = _taskRepository.QueryData(x => x.TaskType == taskType && x.TargetAddress == childDeviceCode);
+            if (tasks.Count < index)
+            {
+                var taskDTO = new WMSTaskDTO()
+                {
+                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
+                    Grade = 1,
+                    PalletCode = DateTime.Now.ToString("yyyyMMddHHmmss"),
+                    RoadWay = roadWay,
+                    SourceAddress = sourceAddress,
+                    TargetAddress = childDeviceCode,
+                    TaskState = (int)TaskOutStatusEnum.OutNew,
+                    Id = 0,
+                    TaskType = taskType
+                };
+
+                CreateAndSendTask(taskDTO);
             }
         }
 
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
new file mode 100644
index 0000000..f7f6183
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -0,0 +1,183 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_Core;
+using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_Tasks.ConveyorLineJob;
+using HslCommunication;
+using OfficeOpenXml.ConditionalFormatting;
+
+namespace WIDESEAWCS_Tasks
+{
+    partial class CommonConveyorLineJob
+    {
+        /// <summary>
+        /// 澶勭悊鍑哄簱浠诲姟
+        /// </summary>
+        private void HandleTaskOut(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, Dt_Task taskOut)
+        {
+            // 濡傛灉娌℃湁浠诲姟锛岀洿鎺ヨ繑鍥�
+            if (taskOut == null) return;
+
+            // 鏄犲皠浠诲姟鍛戒护
+            var taskCommand = MapTaskCommand(taskOut, command);
+
+            // 鏍规嵁涓嶅悓鐨勪换鍔$被鍨嬪拰鐘舵�佹墽琛屼笉鍚岀殑閫昏緫
+            bool isOutTray = taskOut.TaskType == (int)TaskOutboundTypeEnum.OutTray;
+            bool isOutboundAndOutFinish = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.SC_OutFinish;
+            bool isOutboundAndLineOutExecuting = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting;
+
+            if (isOutTray || isOutboundAndOutFinish || isOutboundAndLineOutExecuting)
+            {
+                // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+                conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                // 鏍囪鍙戦�佸畬鎴�
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                // 鏇存柊浠诲姟鐘舵��
+                _taskService.UpdateTaskStatusToNext(taskOut);
+            }
+            else if (taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
+            {
+                // 瀹屾垚WMS浠诲姟
+                CompleteWmsTask(taskOut, command, conveyorLine, childDeviceCode, ProtocalDetailValue);
+            }
+        }
+
+        /// <summary>
+        /// 澶勭悊鏂颁换鍔�
+        /// </summary>
+        private void HandleNewTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
+        {
+            // 鐗瑰畾鏉′欢涓嬪垱寤哄苟鍙戦�佺┖鎵樼洏鍏ュ簱浠诲姟
+            if (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016")
+            {
+                CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
+            }
+            else if (conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088")
+            {
+                // 璇锋眰WMS浠诲姟
+                RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
+            }
+            else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1073") || (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1002"))
+            {
+                //TODO 鍙戦�佺洿鎺ュ幓NG鍙d换鍔�
+            }
+        }
+
+        /// <summary>
+        /// 鏄犲皠浠诲姟鍛戒护
+        /// </summary>
+        private ConveyorLineTaskCommand MapTaskCommand(Dt_Task task, ConveyorLineTaskCommand command)
+        {
+            // 浣跨敤mapper鏄犲皠浠诲姟鍛戒护
+            var comm = _mapper.Map<ConveyorLineTaskCommand>(task);
+            comm.InteractiveSignal = command.InteractiveSignal;
+            return comm;
+        }
+
+        /// <summary>
+        /// 瀹屾垚WMS浠诲姟
+        /// </summary>
+        private void CompleteWmsTask(Dt_Task taskOut, ConveyorLineTaskCommand command, CommonConveyorLine conveyorLine, string childDeviceCode, int ProtocalDetailValue)
+        {
+            // 濡傛灉娌℃湁鏉$爜淇℃伅锛屽垯璁剧疆鐩爣鍦板潃涓篘G鍦板潃
+            if (command.Barcode == "NoRead")
+            {
+                var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == taskOut.TargetAddress).Capacity;
+                taskOut.TargetAddress = NGAddress.ToString();
+            }
+
+            // TODO璋冪敤WMS浠诲姟瀹屾垚鎺ュ彛
+            var result = HttpHelper.GetAsync("http://127.0.0.1:8098/api/Task/CompleteTaskAsync", new { taskNum = taskOut.TaskNum }.ToJsonString()).Result;
+            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            if (content.Status)
+            {
+                // 鏍囪鍙戦�佸畬鎴�
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                // 鏇存柊浠诲姟鐘舵��
+                _taskService.UpdateTaskStatusToNext(taskOut);
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓骞跺彂閫佺┖鎵樼洏浠诲姟
+        /// </summary>
+        private void CreateAndSendEmptyTrayTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
+        {
+            if (command.Barcode != "NoRead")
+            {
+                // 鍒涘缓绌烘墭鐩樹换鍔TO
+                WMSTaskDTO taskDTO = CreateEmptyTrayTaskDto(command.Barcode, childDeviceCode);
+                // 鍒涘缓骞跺彂閫佷换鍔�
+                WebResponseContent content = CreateAndSendTask(taskDTO);
+                if (content.Status)
+                {
+                    // 鏌ヨ浠诲姟
+                    Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                    if (task != null)
+                    {
+                        // 鏄犲皠浠诲姟鍛戒护
+                        ConveyorLineTaskCommand taskCommand = MapTaskCommand(task, command);
+                        // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                        // 鏍囪鍙戦�佸畬鎴�
+                        ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                        // 鏇存柊浠诲姟鐘舵��
+                        _taskService.UpdateTaskStatusToNext(task);
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓绌烘墭鐩樹换鍔TO
+        /// </summary>
+        private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode)
+        {
+            // 鍒涘缓骞惰繑鍥炵┖鎵樼洏浠诲姟DTO
+            return new WMSTaskDTO
+            {
+                TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
+                Grade = 1,
+                PalletCode = barcode,
+                RoadWay = "CHSC01",
+                SourceAddress = childDeviceCode,
+                TargetAddress = "CHSC01",
+                TaskState = (int)TaskInStatusEnum.InNew,
+                Id = 0,
+                TaskType = (int)TaskInboundTypeEnum.InTray,
+            };
+        }
+
+        /// <summary>
+        /// 璇锋眰WMS浠诲姟
+        /// </summary>
+        private void RequestWmsTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
+        {
+            // 璇锋眰WMS浠诲姟
+            if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
+            {
+                // 鏌ヨ浠诲姟
+                Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                if (task != null)
+                {
+                    // 鏄犲皠浠诲姟鍛戒护
+                    ConveyorLineTaskCommand taskCommand = MapTaskCommand(task, command);
+                    // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                    // 鏍囪鍙戦�佸畬鎴�
+                    ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                    // 鏇存柊浠诲姟鐘舵��
+                    _taskService.UpdateTaskStatusToNext(task);
+                }
+            }
+        }
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index a28ccda..0335a14 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -157,6 +157,10 @@
                     task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
                 }
             }
+            else if (task == null)
+            {
+                task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
+            }
 
             return task;
         }
@@ -177,7 +181,7 @@
                     CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                     //if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
                     //{
-                        return task;
+                    return task;
                     //}
                 }
                 else
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/Dt_EquipmentProcess.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/Dt_EquipmentProcess.cs
index 294ab7d..58c02df 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/Dt_EquipmentProcess.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/Dt_EquipmentProcess.cs
@@ -2,6 +2,7 @@
 using SqlSugar;
 using System;
 using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -59,4 +60,71 @@
         [SugarColumn(IsNullable = false, Length = int.MaxValue, ColumnDescription = "宸ヨ壓鍙傛暟鍊�")]
         public string ProcessValue { get; set; }
     }
+
+    /// <summary>
+    /// 琛ㄧず宸ヨ壓璺嚎涓婅澶囧弬鏁颁俊鎭殑妯″瀷銆�
+    /// </summary>
+    public class EquipmentParameterInfo
+    {
+        /// <summary>
+        /// 鍙傛暟缂栫爜銆�
+        /// </summary>
+        [Required(ErrorMessage = "鍙傛暟缂栫爜鏄繀濉」銆�")]
+        [StringLength(50, ErrorMessage = "鍙傛暟缂栫爜闀垮害涓嶈兘瓒呰繃50涓瓧绗︺��")]
+        public string ParameterCode { get; set; }
+
+        /// <summary>
+        /// 鍙傛暟绫诲瀷銆�
+        /// </summary>
+        [Required(ErrorMessage = "鍙傛暟绫诲瀷鏄繀濉」銆�")]
+        [StringLength(50, ErrorMessage = "鍙傛暟绫诲瀷闀垮害涓嶈兘瓒呰繃50涓瓧绗︺��")]
+        public string ParameterType { get; set; }
+
+        /// <summary>
+        /// 鎺ㄨ崘鍊笺��
+        /// </summary>
+        [StringLength(50, ErrorMessage = "鎺ㄨ崘鍊奸暱搴︿笉鑳借秴杩�50涓瓧绗︺��")]
+        public string TargetValue { get; set; }
+
+        /// <summary>
+        /// 鍗曚綅銆�
+        /// </summary>
+        public string UOMCode { get; set; }
+
+        /// <summary>
+        /// 鎺у埗涓婇檺鍊笺��
+        /// </summary>
+        [StringLength(50, ErrorMessage = "鎺у埗涓婇檺鍊奸暱搴︿笉鑳借秴杩�50涓瓧绗︺��")]
+        public string UpperControlLimit { get; set; }
+
+        /// <summary>
+        /// 鎺у埗涓嬮檺鍊笺��
+        /// </summary>
+        [StringLength(50, ErrorMessage = "鎺у埗涓嬮檺鍊奸暱搴︿笉鑳借秴杩�50涓瓧绗︺��")]
+        public string LowerControlLimit { get; set; }
+
+        /// <summary>
+        /// 瑙勬牸涓婇檺鍊笺��
+        /// </summary>
+        [StringLength(50, ErrorMessage = "瑙勬牸涓婇檺鍊奸暱搴︿笉鑳借秴杩�50涓瓧绗︺��")]
+        public string UpperSpecificationsLimit { get; set; }
+
+        /// <summary>
+        /// 瑙勬牸涓嬮檺鍊笺��
+        /// </summary>
+        [StringLength(50, ErrorMessage = "瑙勬牸涓嬮檺鍊奸暱搴︿笉鑳借秴杩�50涓瓧绗︺��")]
+        public string LowerSpecificationsLimit { get; set; }
+
+        /// <summary>
+        /// 鍙傛暟鎻忚堪銆�
+        /// </summary>
+        public string Description { get; set; }
+
+        /// <summary>
+        /// 宸ヨ壓璺嚎涓婂綋鍓嶈澶囧弬鏁颁俊鎭槸鍚﹀彲鐢ㄣ��
+        /// TRUE 琛ㄧず鍙敤锛孎ALSE 琛ㄧず涓嶅彲鐢ㄣ��
+        /// </summary>
+        [Required(ErrorMessage = "璁惧鍙傛暟淇℃伅鏄惁鍙敤鏄繀濉」銆�")]
+        public string EquipmentAvailabilityFlag { get; set; }
+    }
 }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResponeAgingInputDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResponeAgingInputDto.cs
new file mode 100644
index 0000000..f209253
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResponeAgingInputDto.cs
@@ -0,0 +1,26 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO.MOM
+{
+    public class ResponeAgingInputDto : BasicResult
+    {
+        /// <summary>
+        /// 鏂欐灞炴�э紝鐢ㄤ簬鏍囪瘑鏂欐鐨勫敮涓�灞炴�с��
+        /// </summary>
+        public string TrayBarcodeProperty { get; set; }
+
+        /// <summary>
+        /// 宸ュ崟缂栫爜鎴栦骇鍝佸瀷鍙凤紝鐢ㄤ簬鍏宠仈鍏蜂綋鐨勭敓浜т换鍔°��
+        /// </summary>
+        public string BindCode { get; set; }
+
+        /// <summary>
+        /// 鍏宠仈宸ュ簭杩斿洖鏃堕棿锛岃褰曟敞娑叉垨闈欑疆鏃堕暱銆�
+        /// </summary>
+        public string LinedProcessFeedbackTime { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/AgingInOrOutInput/IAgingInOrOutInputService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/AgingInOrOutInput/IAgingInOrOutInputService.cs
index 277a814..1e87d41 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/AgingInOrOutInput/IAgingInOrOutInputService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/AgingInOrOutInput/IAgingInOrOutInputService.cs
@@ -10,12 +10,12 @@
     /// </summary>
     /// <param name="input">鍏ュ簱鏁版嵁</param>
     /// <returns></returns>
-    Task<dynamic> GetOCVInputAsync(AgingInputDto input);
+    Task<WebResponseContent> GetOCVInputAsync(AgingInputDto input);
 
     /// <summary>
     /// 闈欑疆\闄堝寲鍑哄簱锛堟暣鎵樼洏锛�
     /// </summary>
     /// <param name="input">鍑哄簱鏁版嵁</param>
     /// <returns></returns>
-    Task<dynamic> GetOCVOutputAsync(AgingOutputDto input);
+    Task<WebResponseContent> GetOCVOutputAsync(AgingOutputDto input);
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfoDetail.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfoDetail.cs
index fcedddb..d55b38a 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfoDetail.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfoDetail.cs
@@ -20,7 +20,7 @@
     public int BoxingInfoId { get; set; }
 
     /// <summary>
-    /// 鐗╂枡缂栫爜
+    /// 鐗╂枡缂栫爜 缁戝畾浠g爜
     /// </summary>
     [Required]
     [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鐗╂枡缂栧彿")]
@@ -34,7 +34,7 @@
     public string MaterielName { get; set; }
 
     /// <summary>
-    /// 鍗曟嵁缂栧彿
+    /// 鍗曟嵁缂栧彿 / 閫氶亾
     /// </summary>
     [Required]
     [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鍗曟嵁缂栧彿")]
@@ -48,7 +48,7 @@
     public string BatchNo { get; set; }
 
     /// <summary>
-    /// 搴忓垪鍙�
+    /// 搴忓垪鍙�(鐢佃姱)
     /// </summary>
     [Required]
     [SugarColumn(IsNullable = false, Length = 100, ColumnDescription = "搴忓垪鍙�")]
@@ -68,14 +68,14 @@
     public decimal OutboundQuantity { get; set; }
 
     /// <summary>
-    /// 缁勭洏鐘舵��
+    /// 缁勭洏鐘舵�� 鐢佃姱鐘舵��
     /// </summary>
     [Required]
     [SugarColumn(IsNullable = false, ColumnDescription = "缁勭洏鐘舵��")]
     public int Status { get; set; }
 
     /// <summary>
-    /// 澶囨敞
+    /// 澶囨敞 // 鏂欐灞炴�son
     /// </summary>
     [SugarColumn(IsNullable = true, ColumnDescription = "澶囨敞")]
     public string Remark { get; set; }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs
index d790bb4..9fab037 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs
@@ -36,11 +36,18 @@
         public bool IsFull { get; set; }
 
         /// <summary>
-        /// 澶囨敞
+        /// 澶囨敞 (闈欏埗)
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDescription = "澶囨敞")]
         public string Remark { get; set; }
 
+
+        /// <summary>
+        /// 鍖哄煙缂栫爜
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "鍖哄煙缂栫爜")]
+        public string AreaCode { get; set; }
+
         /// <summary>
         /// 搴撳瓨鏄庣粏
         /// </summary>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
index 098b029..36d5fa7 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
@@ -1,7 +1,9 @@
 锘縰sing LogLibrary.Log;
 using Masuit.Tools;
 using WIDESEA_Common;
+using WIDESEA_Core;
 using WIDESEA_DTO;
+using WIDESEA_DTO.MOM;
 using WIDESEA_IStoragIntegrationServices;
 
 namespace WIDESEA_StoragIntegrationServices;
@@ -15,8 +17,9 @@
     /// </summary>
     /// <param name="input">鍏ュ簱鏁版嵁</param>
     /// <returns></returns>
-    public async Task<dynamic> GetOCVInputAsync(AgingInputDto input)
+    public async Task<WebResponseContent> GetOCVInputAsync(AgingInputDto input)
     {
+        WebResponseContent content = new WebResponseContent();
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
@@ -26,10 +29,7 @@
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/AgingInput", inputJson);
-            if (x != null)
-            {
-
-            }
+            content.OK(data: x);
 
             LogFactory.GetLog("闈欑疆闄堝寲鍏ュ簱锛堟暣鎵樼洏锛�").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("闈欑疆闄堝寲鍏ュ簱锛堟暣鎵樼洏锛�").Info(true, x);
@@ -40,7 +40,7 @@
             LogFactory.GetLog("闈欑疆闄堝寲鍏ュ簱锛堟暣鎵樼洏锛�").Error(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("闈欑疆闄堝寲鍏ュ簱锛堟暣鎵樼洏锛�").Error(true, err.StackTrace);
         }
-        return Task.FromResult<dynamic>(null);
+        return content;
     }
 
     /// <summary>
@@ -48,8 +48,9 @@
     /// </summary>
     /// <param name="input">鍑哄簱鏁版嵁</param>
     /// <returns></returns>
-    public async Task<dynamic> GetOCVOutputAsync(AgingOutputDto input)
+    public async Task<WebResponseContent> GetOCVOutputAsync(AgingOutputDto input)
     {
+        WebResponseContent content = new WebResponseContent();
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
@@ -61,13 +62,15 @@
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/AgingOutput", inputJson);
             LogFactory.GetLog("闈欑疆闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("闈欑疆闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Info(true, x);
+            content.OK();
         }
         catch (Exception err)
         {
             Console.WriteLine(err.Message.ToString());
             LogFactory.GetLog("闈欑疆/闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Error(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("闈欑疆/闄堝寲鍑哄簱锛堟暣鎵樼洏)").Error(true, err.StackTrace);
+            content.Error(err.Message);
         }
-        return Task.FromResult<dynamic>(null);
+        return content;
     }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
index 3601449..11e418b 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
@@ -94,34 +94,36 @@
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
-            if (x != null)
-            {
-                ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x);
-                DtBoxingInfo boxingInfo = new DtBoxingInfo()
-                {
-                    IsFull = true,
-                    PalletCode = result.TrayBarcode,
-                };
-                var details = new List<DtBoxingInfoDetail>();
-                foreach (var item in result.SerialNos)
-                {
-                    DtBoxingInfoDetail detail = new DtBoxingInfoDetail()
-                    {
-                        SerialNumber = item.SerialNo,
-                        OrderNo = item.PositionNo.ToString(),
-                        Status = item.SerialNoStatus,
-                        Remark = result.TrayBarcodePropertys.ToJsonString(),
-                        MaterielCode = result.BindCode,
-                    };
-                    details.Add(detail);
-                }
-                boxingInfo.BoxingInfoDetails = details;
-                var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
-                if (abc.Status)
-                    content.OK("缁勭洏鎴愬姛", result);
-                else
-                    content.Error("缁勭洏澶辫触");
-            }
+            //if (x != null)
+            //{
+            //    // 鍙嶅簭鍒楀寲ResultTrayCellsStatus瀵硅薄
+            //    ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x);
+
+            //    // 鍒涘缓DtBoxingInfo瀵硅薄
+            //    DtBoxingInfo boxingInfo = new DtBoxingInfo
+            //    {
+            //        IsFull = true,
+            //        PalletCode = result.TrayBarcode,
+            //    };
+
+            //    // 浣跨敤LINQ鍒涘缓DtBoxingInfoDetail瀵硅薄鍒楄〃
+            //    var details = result.SerialNos.Select(item => new DtBoxingInfoDetail
+            //    {
+            //        SerialNumber = item.SerialNo,
+            //        OrderNo = item.PositionNo.ToString(),
+            //        Status = item.SerialNoStatus,
+            //        Remark = result.TrayBarcodePropertys.ToJsonString(),
+            //        MaterielCode = result.BindCode,
+            //    }).ToList();
+
+            //    // 璧嬪�糄tBoxingInfoDetails
+            //    boxingInfo.BoxingInfoDetails = details;
+            //    var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
+            //    if (abc.Status)
+            //        content.OK("缁勭洏鎴愬姛", result);
+            //    else
+            //        content.Error("缁勭洏澶辫触");
+            //}
             LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, x);
         }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index bd89329..8149a7f 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,8 +1,11 @@
 锘縰sing Mapster;
+using Masuit.Tools;
 using WIDESEA_DTO.MOM;
 using WIDESEA_DTO.WMS;
+using WIDESEA_IStorageBasicRepository;
 using WIDESEA_IStoragIntegrationServices;
 using WIDESEA_StorageBasicRepository;
+using WIDESEA_StoragIntegrationServices;
 
 namespace WIDESEA_StorageOutTaskServices;
 
@@ -12,6 +15,7 @@
     private readonly IUnitOfWorkManage _unitOfWorkManage;
     private readonly IDt_OutOrderRepository _outOrderRepository;
     private readonly IStockInfoRepository _stockInfoRepository;
+    private readonly IStockInfoDetailRepository _stockInfoDetailRepository;
     private readonly IDt_Task_HtyRepository _task_HtyRepository;
     private readonly IDt_OutOrderAndStockRepository _outOrderAndStockRepository;
     private readonly IDt_OutOrderAndStock_HtyRepository _outOrderAndStock_HtyRepository;
@@ -22,10 +26,11 @@
     private readonly IPointStackerRelationRepository _pointStackerRelationRepository;
     private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository;
     private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository;
-    private readonly IBoxingInfoRepository _boxingInfoRepository;
-    private readonly ICellStateService _cellStateService;
-    private readonly IProcessApplyService _processApplyService;
-    private readonly IDt_AreaInfoRepository _areaInfoRepository;
+    private readonly IBoxingInfoRepository _boxingInfoRepository; //缁勭洏
+    private readonly ICellStateService _cellStateService; //鐢佃姱灞炴��
+    private readonly IProcessApplyService _processApplyService; //宸ヨ壓璺嚎
+    private readonly IDt_AreaInfoRepository _areaInfoRepository; //鍖哄煙
+    private readonly IAgingInOrOutInputService _agingInOrOutInputService; //闈欑疆\闄堝寲
 
     public Dt_TaskService(IDt_TaskRepository BaseDal,
                                 IUnitOfWorkManage unitOfWorkManage,
@@ -44,7 +49,9 @@
                                 IBoxingInfoRepository boxingInfoRepository,
                                 ICellStateService cellStateService,
                                 IProcessApplyService processApplyService,
-                                IDt_AreaInfoRepository areaInfoRepository) : base(BaseDal)
+                                IDt_AreaInfoRepository areaInfoRepository,
+                                IAgingInOrOutInputService agingInOrOutInputService,
+                                IStockInfoDetailRepository stockInfoDetailRepository) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
         _outOrderRepository = outOrderRepository;
@@ -63,14 +70,16 @@
         _cellStateService = cellStateService;
         _processApplyService = processApplyService;
         _areaInfoRepository = areaInfoRepository;
+        _agingInOrOutInputService = agingInOrOutInputService;
+        _stockInfoDetailRepository = stockInfoDetailRepository;
     }
 
     #region 澶栭儴鎺ュ彛鏂规硶
 
-    #region 鍫嗗灈鏈哄嚭搴撲换鍔″畬鎴�
+    #region 鍑哄簱浠诲姟瀹屾垚
 
     /// <summary>
-    /// 鍫嗗灈鏈哄嚭搴撲换鍔″畬鎴�
+    /// 鍑哄簱浠诲姟瀹屾垚
     /// </summary>
     /// <param name="saveModel">浠诲姟鏁版嵁鍚堥泦</param>
     /// <returns>杩斿洖缁撴灉闆�</returns>
@@ -79,17 +88,48 @@
         WebResponseContent content = new WebResponseContent();
         try
         {
-            // 鏇存柊搴撳瓨鐘舵��
-            // 璁剧疆搴撲綅鐘舵�佷负绌洪棽
-            stock.LocationInfo.LocationStatus = LocationEnum.Free.ObjToInt();
-            // 璁剧疆搴撳瓨鐘舵�佷负鍑哄簱
-            stock.StockInfoDetails.ForEach(x =>
+            if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
             {
-                x.Status = 2;
-            });
+                var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
+                     .FirstAsync(x => x.EquipmentName == task.Roadway);
+                EquipmentParameterInfo info = JsonConvert.DeserializeObject<EquipmentParameterInfo>(process.ProcessValue);
+                AgingOutputDto agingOutputDto = new AgingOutputDto()
+                {
+                    OpFlag = 1,
+                    EquipmentCode = stock.LocationInfo.RoadwayNo,
+                    TrayBarcode = stock.PalletCode,
+                    SerialNos = stock.StockInfoDetails.Select(x => new SerialNoOutDto()
+                    {
+                        SlotNo = x.OrderNo.ToInt32(),
+                        SerialNo = x.SerialNumber,
+                        SerialNoResult = true,
+                        ParameterInfo = new List<ParameterInfo>()
+                        {
+                             new ParameterInfo()
+                             {
+                                  LowerLomit =info.LowerControlLimit,
+                                   UpperLimit = info.UpperControlLimit,
+                                   ParameterResult = info.EquipmentAvailabilityFlag,
+                                   ParameterCode = info.ParameterCode,
+                                    ParameterDesc = info.Description,
+                                     TargetValue = info.TargetValue,
+                                      Value = info.TargetValue,
+                                       DefectCode = info.UOMCode
+                             }
+                        }
+                    }).ToList()
+                };
+            }
+            // 鏇存柊搴撳瓨鐘舵��
+            var loation = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+            var detail = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
+
+            // 璁剧疆搴撲綅鐘舵�佷负绌洪棽
+            loation.LocationStatus = LocationEnum.Free.ObjToInt();
+
 
             // 鏇存柊浠诲姟鐘舵��
-            task.TaskState = TaskOutStatusEnum.SC_OutFinish.ObjToInt();
+            task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
             task.CurrentAddress = task.NextAddress;
             task.NextAddress = task.TargetAddress;
 
@@ -98,13 +138,15 @@
             // 浜嬪姟澶勭悊
             // 寮�濮嬩簨鍔�
             _unitOfWorkManage.BeginTran();
-            // 鏇存柊搴撳瓨淇℃伅
-            var isStockUpdated = _stockInfoRepository.UpdateData(stock);
-            // 鏇存柊浠诲姟淇℃伅
-            var isTaskUpdated = await Update(task);
+            // 鍒犻櫎搴撳瓨淇℃伅
+            var isStockUpdated = _stockInfoRepository.DeleteDataById(stock.Id);
+            // 鍒犻櫎搴撳瓨淇℃伅
+            var isStockDetailUpdated = _stockInfoDetailRepository.DeleteDataByIds(detail.Select(x => (object)x.Id).ToArray());
+            // 鍒犻櫎浠诲姟淇℃伅
+            var isTaskUpdated = BaseDal.DeleteDataById(task.TaskId);
 
             // 濡傛灉搴撳瓨淇℃伅鍜屼换鍔′俊鎭兘鏇存柊鎴愬姛
-            if (isStockUpdated && isTaskUpdated)
+            if (isStockUpdated && isTaskUpdated && isStockDetailUpdated)
             {
                 // 璁板綍鏃ュ織
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", $"浜嬪姟澶勭悊瀹屾垚锛屽簱瀛樼姸鎬佹洿鏂帮細{isStockUpdated}锛屼换鍔$姸鎬佹洿鏂�:{isTaskUpdated}");
@@ -179,28 +221,66 @@
         try
         {
             var boxing = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
+            var locationInf = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress);
 
-            var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>();
-            // 鍒涘缓搴撳瓨瀹炰緥妯″瀷
-            DtStockInfo stock = new DtStockInfo()
-            {
-                PalletCode = task.PalletCode,
-                LocationCode = task.TargetAddress,
-                CreateDate = DateTime.Now,
-                Creater = "system",
-                IsFull = boxing.IsFull,
-                StockInfoDetails = boxDetail,
-                LocationInfo = new DtLocationInfo()
-            };
+            locationInf.LocationStatus = (int)LocationEnum.InStock;
 
             // 鍒涘缓鍘嗗彶浠诲姟瀹炰緥妯″瀷
             var taskHty = CreateHistoricalTask(task);
 
-            // 淇敼璐т綅淇℃伅涓烘湁璐�
-            var locationInf = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress);
-            locationInf.LocationStatus = (int)LocationEnum.InStock;
+            // 鍒涘缓搴撳瓨瀹炰緥妯″瀷
+            DtStockInfo stock;
+            if (boxing == null)
+            {
+                // 绌烘墭鐩�
 
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟瀹屾垚", $"璐т綅鍦板潃锛歿task.TargetAddress},淇敼鍚庤揣浣嶆暟鎹細{locationInf}");
+                stock = new DtStockInfo()
+                {
+                    PalletCode = task.PalletCode,
+                    LocationCode = task.TargetAddress,
+                    CreateDate = DateTime.Now,
+                    Creater = "system",
+                    IsFull = boxing.IsFull,
+                    StockInfoDetails = new List<DtStockInfoDetail>()
+                    {
+                        new DtStockInfoDetail()
+                        {
+                             MaterielCode = "绌烘墭鐩�",
+                             Id = 0,
+                        }
+                    }
+                };
+            }
+            else
+            {
+                // 瀹炵洏
+                var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>();
+                // 鍒涘缓搴撳瓨瀹炰緥妯″瀷
+                stock = new DtStockInfo()
+                {
+                    PalletCode = task.PalletCode,
+                    LocationCode = task.TargetAddress,
+                    CreateDate = DateTime.Now,
+                    Creater = "system",
+                    IsFull = boxing.IsFull,
+                    StockInfoDetails = boxDetail,
+                };
+
+                AgingInputDto agingInputDto = new AgingInputDto()
+                {
+                    SerialNos = boxing.BoxingInfoDetails
+                        .Select(item => new SerialNoInDto { SerialNo = item.SerialNumber, PositionNo = item.OrderNo })
+                        .ToList(),
+                    TrayBarcode = task.PalletCode,
+                    OpFlag = 1
+                };
+                var result = await _agingInOrOutInputService.GetOCVInputAsync(agingInputDto);
+                stock.Remark = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString()).LinedProcessFeedbackTime;
+
+
+                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟瀹屾垚", $"璐т綅鍦板潃锛歿task.TargetAddress},淇敼鍚庤揣浣嶆暟鎹細{locationInf}");
+
+            }
 
             // 鎵ц鏁版嵁搴撲簨鍔�
             bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId);
@@ -249,10 +329,15 @@
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟", "");
                 return await CompleteInboundTaskAsync(task);
             }
+            else if (task.TaskType == (int)TaskInboundTypeEnum.InTray)
+            {
+                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "绌烘墭鐩樺叆搴�", "");
+                return await CompleteInboundTaskAsync(task);
+            }
             else
             {
-                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "搴撳瓨涓嶅瓨鍦ㄤ篃涓嶆槸鍏ュ簱浠诲姟", "");
-                return content.Error("搴撳瓨涓嶅瓨鍦�");
+                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "浠诲姟鐘舵�佸紓甯�", "");
+                return content.Error("浠诲姟鐘舵�佸紓甯�");
             }
         }
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉搴撳瓨鏄惁瀛樺湪", JsonConvert.SerializeObject(stock));
@@ -260,15 +345,20 @@
         if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
         {
             LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
-            if (task.TaskState == TaskOutStatusEnum.SC_OutExecuting.ObjToInt())
+            if (task.TaskState == TaskOutStatusEnum.Line_OutFinish.ObjToInt())
             {
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", "");
                 return await CompleteStackTaskAsync(task, stock);
             }
-            else
+            else if (task.TaskState == TaskOutStatusEnum.SC_OutExecuting.ObjToInt())
             {
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "搴撳瓨涓嶅瓨鍦ㄤ篃涓嶆槸鍏ュ簱浠诲姟", "");
                 return content.Error("搴撳瓨涓嶅瓨鍦�");
+            }
+            else
+            {
+                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "浠诲姟鐘舵�佸紓甯�", "");
+                return content.Error("浠诲姟鐘舵�佸紓甯�");
             }
         }
         else if (task.TaskType == (int)TaskTypeEnum.RelocationIn)
@@ -310,8 +400,14 @@
             // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖content
             if (!content.Status) return content;
 
-            // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹虹敵璇�
-            ProcessApplyDto process = await GetProcessApplyAsync(content);
+            // 娣诲姞缁勭洏淇℃伅
+            // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄
+            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.ToString());
+            var boxing = await CreateBoxingInfo(result, input.PalletCode);
+
+            // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾�
+            ProcessApplyDto process = await GetProcessApplyAsync(result);
+
             // 濡傛灉process涓簄ull锛屽垯杩斿洖content
             if (process == null) return content;
 
@@ -322,6 +418,10 @@
             var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
             // 濡傛灉task涓嶄负null锛屽垯璋冪敤UpdateExistingTask鏂规硶锛屾洿鏂颁换鍔★紱鍚﹀垯璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
             content = task != null ? await UpdateExistingTask(input, task) : await CreateNewTask(processResponse, input);
+            if (content.Status)
+            {
+                var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
+            }
         }
         catch (Exception err)
         {
@@ -341,19 +441,32 @@
         return await _cellStateService.GetTrayCellStatusAsync(trayCells);
     }
 
-    // 鑾峰彇宸ヨ壓鐢宠
-    private async Task<ProcessApplyDto> GetProcessApplyAsync(WebResponseContent content)
+    // 鑾峰彇缁勭洏淇℃伅
+    private async Task<DtBoxingInfo> CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
     {
-        // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖null
-        if (!content.Status) return null;
+        return new DtBoxingInfo
+        {
+            PalletCode = palletCode,
+            IsFull = true,
+            BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail
+            {
+                SerialNumber = serialNoObj.SerialNo,
+                OrderNo = serialNoObj.PositionNo.ToString(),
+                Status = serialNoObj.SerialNoStatus,
+                MaterielCode = result.BindCode,
+                Remark = result.TrayBarcodePropertys.ToJsonString(),
+            }).ToList()
+        };
+    }
 
-        // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄
-        var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+    // 鑾峰彇宸ヨ壓鐢宠
+    private async Task<ProcessApplyDto> GetProcessApplyAsync(ResultTrayCellsStatus content)
+    {
         // 鍒涘缓涓�涓狿rocessApplyDto瀵硅薄锛屽苟璧嬪��
         return new ProcessApplyDto()
         {
-            WipOrderNo = result.BindCode,
-            SerialNos = result.SerialNos.Select(item => new SerialNos
+            //WipOrderNo = result.BindCode,
+            SerialNos = content.SerialNos.Select(item => new SerialNos
             {
                 SerialNo = item.SerialNo
             }).ToList()
@@ -381,6 +494,12 @@
                     .Where(x => x.EquipmentType == "闄堝寲" && x.WipOrderNo == apply.WipOrderNo && x.ProductDesc == apply.ProductNo)
                     .ToList();
 
+            case "1339":
+            case "1406":
+                return SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
+                    .Where(x => x.EquipmentType == "闈欑疆" && x.WipOrderNo == apply.WipOrderNo && x.ProductDesc == apply.ProductNo)
+                    .ToList();
+
             default:
                 return new List<Dt_EquipmentProcess>();
         }
@@ -397,7 +516,7 @@
         {
             var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == "CH");
 
-            var stockInfo = _stockInfoRepository.QueryData(x => x.Remark == area.AreaCode && x.StockInfoDetails.Any(z => z.MaterielCode == "绌烘墭鐩�")).OrderBy(x => x.CreateDate).FirstOrDefault();
+            var stockInfo = _stockInfoRepository.QueryData(x => x.LocationInfo.AreaId == area.AreaID && x.StockInfoDetails.Any(z => z.MaterielCode == "绌烘墭鐩�")).OrderBy(x => x.CreateDate).FirstOrDefault();
             // 鍒涘缓鏂颁换鍔″疄渚�
             var task = new Dt_Task
             {
@@ -444,6 +563,65 @@
     }
 
     #endregion 璇锋眰绌烘墭鐩�
+
+    #region 闄堝寲璇锋眰鍑哄簱
+
+    // 闄堝寲璇锋眰鍑哄簱
+    public async Task<WebResponseContent> OutTrayByCh(string position)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            var area = _areaInfoRepository.QueryFirst(x => x.AreaName == "闄堝寲鍖�");
+            // 鏌ヨ搴撳瓨淇℃伅
+
+            var stockInfo = _stockInfoRepository.QueryData(x => x.AreaCode == area.AreaCode && Convert.ToDateTime(x.Remark) < DateTime.Now && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).OrderBy(x => x.CreateDate).FirstOrDefault();
+            // 鍒涘缓鏂颁换鍔″疄渚�
+            var task = new Dt_Task()
+            {
+                Grade = 1,
+                Roadway = stockInfo.LocationInfo.RoadwayNo,
+                TargetAddress = position,
+                Dispatchertime = DateTime.Now,
+                MaterialNo = "",
+                NextAddress = position,
+                OrderNo = null,
+                PalletCode = stockInfo.PalletCode,
+                SourceAddress = stockInfo.LocationCode,
+                TaskState = (int)TaskOutStatusEnum.OutNew,
+                TaskType = (int)TaskOutboundTypeEnum.OutTray,
+                TaskNum = await BaseDal.GetTaskNo(),
+                Creater = "Systeam"
+            };
+            var taskId = await BaseDal.AddDataAsync(task);
+            bool isResult = taskId > 0;
+            if (isResult)
+            {
+                WMSTaskDTO taskDTO = new WMSTaskDTO()
+                {
+                    TaskNum = task.TaskNum.Value,
+                    Grade = 1,
+                    PalletCode = DateTime.Now.ToString("MMddHHmmss"),
+                    RoadWay = task.Roadway,
+                    SourceAddress = stockInfo.LocationCode,
+                    TargetAddress = task.Roadway,
+                    TaskState = (int)TaskOutStatusEnum.OutNew,
+                    Id = 0,
+                    TaskType = (int)TaskOutboundTypeEnum.OutTray
+                };
+                stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable;
+                _locationRepository.UpdateData(stockInfo.LocationInfo);
+                content.OK(data: taskDTO);
+            }
+        }
+        catch (Exception ex)
+        {
+            throw;
+        }
+        return content;
+    }
+
+    #endregion 闄堝寲璇锋眰鍑哄簱
 
     #endregion 澶栭儴鎺ュ彛鏂规硶
 
@@ -745,15 +923,6 @@
         DtLocationInfo location = new DtLocationInfo();
         int beforeStatus = 0;
 
-        // 鏍规嵁浠诲姟绫诲瀷鍒ゆ柇鏄嚭搴撲换鍔¤繕鏄叆搴撲换鍔�
-        //if (input.Type == (int)TaskTypeEnum.Outbound)
-        //{
-        //    // 澶勭悊鍑哄簱浠诲姟
-        //    toAddress = await GetRoadWayAsync(areaId, task.Roadway, input.Direction, input.Area, input.Type);
-        //    taskState = (int)TaskOutStatusEnum.SC_OutFinish;
-        //}
-        //else
-        //{
         // 澶勭悊鍏ュ簱浠诲姟
         location = await GetLocationDistributeAsync(task.Roadway);
         toAddress = location.LocationCode;
@@ -762,10 +931,8 @@
 
         // 鏇存柊璐т綅淇℃伅
         location.LocationStatus = (int)LocationEnum.Lock;
-        //}
 
         // 鏇存柊浠诲姟淇℃伅
-        //task.SourceAddress = input.Position;
         task.CurrentAddress = input.Position;
         task.TargetAddress = toAddress;
         task.NextAddress = toAddress;
@@ -843,6 +1010,7 @@
             TaskNum = await BaseDal.GetTaskNo(),
             Creater = "Systeam"
         };
+
         // 灏濊瘯娣诲姞鏂颁换鍔�
         var taskId = await BaseDal.AddDataAsync(task);
         bool isResult = taskId > 0;
@@ -852,6 +1020,7 @@
             isResult = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(input.PalletCode, input.Position, ToAddress, TaskInStatusEnum.InNew.GetIntegralRuleTypeEnumDesc()));
             if (isResult)
             {
+                // 鍒涘缓WMS浠诲姟
                 WMSTaskDTO taskDTO = new WMSTaskDTO()
                 {
                     TaskNum = 0,
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/AgingInOrOutController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/AgingInOrOutController.cs
index e323a76..38b1b15 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/AgingInOrOutController.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/AgingInOrOutController.cs
@@ -19,7 +19,7 @@
     /// <returns></returns>
     // POST: api/AgingInOrOut/OCVInput
     [HttpPost("OCVInput")]
-    public Task<dynamic> GetOCVInputAsync([FromBody] AgingInputDto input)
+    public Task<WebResponseContent> GetOCVInputAsync([FromBody] AgingInputDto input)
     {
         return _agingInOrOutInputService.GetOCVInputAsync(input);
     }
@@ -31,7 +31,7 @@
     /// <returns></returns>
     // POST: api/AgingInOrOut/OCVOutput
     [HttpPost("OCVOutput")]
-    public Task<dynamic> GetOCVOutputAsync([FromBody] AgingOutputDto input)
+    public Task<WebResponseContent> GetOCVOutputAsync([FromBody] AgingOutputDto input)
     {
         return _agingInOrOutInputService.GetOCVOutputAsync(input);
     }

--
Gitblit v1.9.3