From 2c4c125072e1b88c994efc9bb6f1ff5ef754d41b Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期四, 14 十一月 2024 10:01:21 +0800
Subject: [PATCH] 忽略项

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/GlobalUsing.cs                                                      |    3 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs                                 |   94 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/AgingInOrOutController.cs                   |    4 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs                                       |   45 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                                             |  207 ++-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                                           |   17 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj.user                                       |    4 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs                             |  410 +++-----
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs   |   25 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs                                            |    6 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/CellStateDto.cs                                             |    0 
 Code Management/WCS/WIDESEAWCS_Client/src/api/http.js                                                                       |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/Dt_EquipmentProcess.cs                                                |  102 ++
 Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.vue                                         |   68 +
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/PlatFormRepository.cs                                    |    8 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs                   |  112 +-
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/IProductionRepository.cs                    |   12 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs                               |  195 ++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/AgingInOrOutInput/IAgingInOrOutInputService.cs |    4 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayCellUnbindDto.cs                                        |    0 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs                                   |   32 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs                                                  |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/UpdateStatusDto.cs                                                  |   21 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs                                               |   21 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs                               |    4 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs                                    |  776 ++++++++++++---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/RequestTaskDto.cs                                                  |   18 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs                         |    9 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs                                                   |   18 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/ProductionService.cs                          |   10 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs                             |  131 --
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/IPlatFormRepository.cs                                   |    5 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/MOM/ProductionModel.cs                                           |   79 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/ProductionController.cs                           |   17 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs                                   |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfoDetail.cs                                 |   10 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayCellsStatusDto.cs                                       |    0 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/ProductionRepository.cs                     |   15 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs                                          |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayUnbindDto.cs                                            |    0 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResponeAgingInputDto.cs                                               |   44 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs             |    6 
 Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js                                                                  |    8 
 Code Management/WCS/WIDESEAWCS_Client/src/extension/quartzJob/deviceInfo.js                                                 |    2 
 Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/Extend/Add.vue                                              |   76 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs                                        |   22 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/ResultTrayCellsStatus.cs                                    |   38 
 Code Management/WCS/WIDESEAWCS_Client/src/views/Login.vue                                                                   |    6 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs                          |    1 
 /dev/null                                                                                                                   |   21 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs                           |   21 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/IProductionService.cs                         |    5 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs                                                  |   21 
 Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.js                                          |   77 +
 54 files changed, 2,053 insertions(+), 785 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js b/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js
index c81ff8f..c648172 100644
--- a/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js
+++ b/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js
@@ -19,7 +19,7 @@
 }
 
 else if (process.env.NODE_ENV == 'production') {
-    axios.defaults.baseURL = 'http://115.159.85.185:9291/';
+    axios.defaults.baseURL = 'http://127.0.0.1:9291/';
 }
 if (!axios.defaults.baseURL.endsWith('/')) {
     axios.defaults.baseURL+="/";
diff --git a/Code Management/WCS/WIDESEAWCS_Client/src/extension/quartzJob/deviceInfo.js b/Code Management/WCS/WIDESEAWCS_Client/src/extension/quartzJob/deviceInfo.js
index e700d90..d882861 100644
--- a/Code Management/WCS/WIDESEAWCS_Client/src/extension/quartzJob/deviceInfo.js
+++ b/Code Management/WCS/WIDESEAWCS_Client/src/extension/quartzJob/deviceInfo.js
@@ -31,7 +31,7 @@
         icon: "el-icon-document", //鎸夐挳鍥炬爣vue2鐗堟湰瑙乮view鏂囨。icon锛寁ue3鐗堟湰瑙乪lement ui鏂囨。icon(娉ㄦ剰涓嶆槸element puls鏂囨。)
         type: "primary", //鎸夐挳鏍峰紡vue2鐗堟湰瑙乮view鏂囨。button锛寁ue3鐗堟湰瑙乪lement ui鏂囨。button
         onClick: function () {
-          this.$Message.success("鐐瑰嚮浜嗘寜閽�");
+          this.$Message.success("寮�鍚湇鍔�");
         },
       });
     },
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_Core/Helper/HttpHelper.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
index dd89d76..d6982b4 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/HttpHelper.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Net.Http.Headers;
+using System.Security.Policy;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -9,16 +10,22 @@
 {
     public class HttpHelper
     {
-        public static async Task<string> GetAsync(string serviceAddress, string contentType = "application/json", Dictionary<string, string>? headers = null)
+        public static async Task<string> GetAsync(string serviceAddress, Dictionary<string, object> parameters, string contentType = "application/json", Dictionary<string, string>? headers = null)
         {
             try
             {
                 string result = string.Empty;
                 using HttpClient httpClient = new HttpClient();
                 httpClient.Timeout = new TimeSpan(0, 0, 60);
+                // 灏嗗弬鏁版嫾鎺ュ埌URL涓�
+                string queryString = string.Join("&", parameters.Select(x => $"{x.Key}={x.Value}"));
+                serviceAddress += "?" + queryString;
 
-                foreach (var header in headers)
-                    httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                if (headers != null)
+                {
+                    foreach (var header in headers)
+                        httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                }
 
                 result = await httpClient.GetAsync(serviceAddress).Result.Content.ReadAsStringAsync();
                 return result;
@@ -41,9 +48,11 @@
                     using HttpClient httpClient = new HttpClient();
                     httpClient.Timeout = new TimeSpan(0, 0, 60);
 
-                    foreach (var header in headers)
-                        httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
-
+                    if (headers != null)
+                    {
+                        foreach (var header in headers)
+                            httpClient.DefaultRequestHeaders.Add(header.Key, header.Value);
+                    }
                     result = await httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync();
                 }
                 return result;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs
new file mode 100644
index 0000000..0cac9cd
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/MOM/RequestEqptRunDto.cs
@@ -0,0 +1,21 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.MOM
+{
+    public class RequestEqptRunDto : BasicDto
+    {
+        /// <summary>
+        /// 浜哄憳瀵嗙爜
+        /// </summary>
+        public string Password { get; set; }
+
+        /// <summary>
+        /// 璁惧妯″紡
+        /// </summary>
+        public string EquipmentModel { get; set; }
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/RequestTaskDto.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/RequestTaskDto.cs
index 80735df..91dc7b9 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/RequestTaskDto.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/RequestTaskDto.cs
@@ -1,10 +1,4 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace WIDESEAWCS_DTO.WMS
+锘縩amespace WIDESEAWCS_DTO.WMS
 {
     public class RequestTaskDto
     {
@@ -17,5 +11,15 @@
         /// 鎵樼洏鍙�
         /// </summary>
         public string PalletCode { get; set; }
+
+        /// <summary>
+        /// 绌烘墭鐩樺彲鍏ュ贩鍒�
+        /// </summary>
+        public string PositionList { get; set; }
+
+        /// <summary>
+        /// 浠诲姟绫诲瀷
+        /// </summary>
+        public string RequestType { get; set; } = string.Empty;
     }
 }
\ No newline at end of file
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_Server/bin/Debug/net6.0/Log_PLCReadWrite/1\345\217\267\345\240\206\345\236\233\346\234\272/Logs_20241029105644.txt" "b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/1\345\217\267\345\240\206\345\236\233\346\234\272/Logs_20241029105644.txt"
deleted file mode 100644
index 18bf97e..0000000
--- "a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/1\345\217\267\345\240\206\345\236\233\346\234\272/Logs_20241029105644.txt"
+++ /dev/null
@@ -1,21 +0,0 @@
-锘�[淇℃伅] 2024-10-29 10:56:44.068 Thread:[013] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[淇℃伅] 2024-10-29 13:44:23.506 Thread:[006] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[鑷村懡] 2024-10-29 13:45:58.521 Thread:[025] 1鍙峰爢鍨涙満 : 鏁版嵁璇诲彇澶辫触锛屾暟鎹被鍨嬶細銆怋yte銆戯紝鍦板潃锛氥�怐B106.3.0銆戯紝閿欒淇℃伅锛氥�怱ocket Exception -> 鐢变簬杩炴帴鏂瑰湪涓�娈垫椂闂村悗娌℃湁姝g‘绛斿鎴栬繛鎺ョ殑涓绘満娌℃湁鍙嶅簲锛岃繛鎺ュ皾璇曞け璐ャ�傘�� : 閿欒淇℃伅锛氭暟鎹鍙栧け璐ワ紝鏁版嵁绫诲瀷锛氥�怋yte銆戯紝鍦板潃锛氥�怐B106.3.0銆戯紝閿欒淇℃伅锛氥�怱ocket Exception -> 鐢变簬杩炴帴鏂瑰湪涓�娈垫椂闂村悗娌℃湁姝g‘绛斿鎴栬繛鎺ョ殑涓绘満娌℃湁鍙嶅簲锛岃繛鎺ュ皾璇曞け璐ャ�傘��
-閿欒婧愶細WIDESEAWCS_Communicator
-閿欒鍫嗘爤锛�   at WIDESEAWCS_Communicator.SiemensS7.GetContent[T](OperateResult`1 operateResult, String address) in D:\Git\BaiBuLiKu\Code Management\WCS\WIDESEAWCS_Server\WIDESEAWCS_Communicator\Siemens\SiemensS7Communicator.cs:line 128
-閿欒绫诲瀷锛歐IDESEAWCS_Communicator.CommunicationException
-閿欒鏂规硶锛歋ystem.Object GetContent[T](HslCommunication.OperateResult`1[T], System.String)
-/=================================================[    Exception    ]================================================/
-[淇℃伅] 2024-10-29 13:57:52.096 Thread:[015] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[鑷村懡] 2024-10-29 16:15:15.195 Thread:[014] 1鍙峰爢鍨涙満 : 鏁版嵁璇诲彇澶辫触锛屾暟鎹被鍨嬶細銆怋yte銆戯紝鍦板潃锛氥�怐B106.2.0銆戯紝閿欒淇℃伅锛氥�怱ocket Exception -> 杩滅▼涓绘満寮鸿揩鍏抽棴浜嗕竴涓幇鏈夌殑杩炴帴銆傘�� : 閿欒淇℃伅锛氭暟鎹鍙栧け璐ワ紝鏁版嵁绫诲瀷锛氥�怋yte銆戯紝鍦板潃锛氥�怐B106.2.0銆戯紝閿欒淇℃伅锛氥�怱ocket Exception -> 杩滅▼涓绘満寮鸿揩鍏抽棴浜嗕竴涓幇鏈夌殑杩炴帴銆傘��
-閿欒婧愶細WIDESEAWCS_Communicator
-閿欒鍫嗘爤锛�   at WIDESEAWCS_Communicator.SiemensS7.GetContent[T](OperateResult`1 operateResult, String address) in D:\Git\BaiBuLiKu\Code Management\WCS\WIDESEAWCS_Server\WIDESEAWCS_Communicator\Siemens\SiemensS7Communicator.cs:line 128
-閿欒绫诲瀷锛歐IDESEAWCS_Communicator.CommunicationException
-閿欒鏂规硶锛歋ystem.Object GetContent[T](HslCommunication.OperateResult`1[T], System.String)
-/=================================================[    Exception    ]================================================/
-[淇℃伅] 2024-10-29 16:28:32.603 Thread:[009] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[淇℃伅] 2024-10-29 16:36:53.574 Thread:[015] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[淇℃伅] 2024-10-29 16:41:42.983 Thread:[004] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[淇℃伅] 2024-10-29 16:42:32.779 Thread:[006] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[淇℃伅] 2024-10-29 16:54:17.155 Thread:[009] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
-[淇℃伅] 2024-10-29 17:36:01.450 Thread:[016] 1鍙峰爢鍨涙満 : PLC杩炴帴鎴愬姛锛孖P锛氥��192.168.0.101銆戯紝Port锛氥��102銆�
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 20a3264..830c4ce 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -22,6 +22,7 @@
 using Newtonsoft.Json;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
+using System.Threading.Tasks;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseServices;
@@ -131,47 +132,55 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                #region 鐪熷疄鏁版嵁
+                #region 璇锋眰鍏ュ簱浠诲姟宸烽亾
                 // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
-                //// 鍒涘缓璇锋眰瀵硅薄
-                //RequestTaskDto request = new RequestTaskDto()
-                //{
-                //    Position = sourceAddress,
-                //    PalletCode = palletCode,
-                //};
-
-                //// 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                //var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
-
-                //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
-                //content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-
-                //// 妫�鏌ョ姸鎬佸苟杩斿洖
-                //if (!content.Status)
-                //    return content;
-
-                //// 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                //WMSTaskDTO task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
-
-                //// 澶勭悊浠诲姟骞惰繑鍥炵粨鏋�
-                //content = ReceiveWMSTask(new List<WMSTaskDTO> { task });
-
-                #endregion
-
-                WMSTaskDTO taskDTO = new WMSTaskDTO()
+                // 鍒涘缓璇锋眰瀵硅薄
+                RequestTaskDto request = new RequestTaskDto()
                 {
-                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
-                    Grade = 1,
+                    Position = sourceAddress,
                     PalletCode = palletCode,
-                    RoadWay = "CHSC01",
-                    SourceAddress = sourceAddress,
-                    TargetAddress = "CHSC01",
-                    TaskState = (int)TaskInStatusEnum.InNew,
-                    Id = 0,
-                    TaskType = (int)TaskInboundTypeEnum.Inbound
                 };
 
-                content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+                // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
+                var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
+
+                // 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
+                content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+                WMSTaskDTO task = new WMSTaskDTO();
+                // 妫�鏌ョ姸鎬佸苟杩斿洖
+                if (!content.Status)
+                {
+                    task = new WMSTaskDTO()
+                    {
+                        TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
+                        Grade = 1,
+                        PalletCode = palletCode,
+                        RoadWay = "CHSC01",
+                        SourceAddress = sourceAddress,
+                        TargetAddress = "1020",
+                        TaskState = (int)TaskOutStatusEnum.Line_OutExecuting,
+                        Id = 0,
+                        TaskType = (int)TaskOutboundTypeEnum.Outbound
+                    };
+
+                    Dt_Task task1 = _mapper.Map<Dt_Task>(task);
+                    task1.CurrentAddress = task.SourceAddress;
+                    task1.NextAddress = "1020";
+                    BaseDal.AddData(task1);
+                    return content.OK();
+                }
+                else
+                {
+                    // 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
+                    task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+                    // 澶勭悊浠诲姟骞惰繑鍥炵粨鏋�
+                    content = ReceiveWMSTask(new List<WMSTaskDTO> { task });
+                }
+
+
+
+                #endregion
             }
             catch (Exception ex)
             {
@@ -189,6 +198,28 @@
         public Dt_Task QueryConveyorLineTask(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.CurrentAddress == currentAddress, TaskOrderBy);
+        }
+
+        /// <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>
@@ -397,36 +428,33 @@
 
                     if (task.TaskState == (int)TaskInStatusEnum.Line_InFinish)
                     {
-                        Random random = new Random();
+
+                        #region 鍏ュ簱璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
+                        // TODO: 璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
+                        // 鍒涘缓璇锋眰瀵硅薄
+                        RequestTaskDto taskDto = new RequestTaskDto()
+                        {
+                            Position = task.NextAddress,
+                            PalletCode = task.PalletCode,
+                        };
+
+                        // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
+                        var abc = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestLocationTaskAsync", taskDto.ToJsonString()).Result;
+                        if (abc == null)
+                            return content.Error();
+                        // 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
+                        content = JsonConvert.DeserializeObject<WebResponseContent>(abc);
+
+                        // 妫�鏌ョ姸鎬佸苟杩斿洖
+                        if (!content.Status)
+                            return content;
+
+                        // 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
+                        WMSTaskDTO taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+
                         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.NextAddress = taskResult.TargetAddress;
                         task.TargetAddress = task.NextAddress;
-
-                        #region 鐪熷疄鏁版嵁
-                        // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
-                        //// 鍒涘缓璇锋眰瀵硅薄
-                        //RequestTaskDto request = new RequestTaskDto()
-                        //{
-                        //    Position = task.NextAddress,
-                        //    PalletCode = task.PalletCode,
-                        //};
-
-                        //// 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                        //var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
-
-                        //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
-                        //content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-
-                        //// 妫�鏌ョ姸鎬佸苟杩斿洖
-                        //if (!content.Status)
-                        //    return content;
-
-                        //// 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                        //WMSTaskDTO taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
-
-                        //task.CurrentAddress = task.NextAddress;
-                        //task.NextAddress = taskResult.TargetAddress;
-                        //task.TargetAddress = task.NextAddress;
                         #endregion
 
                     }
@@ -446,6 +474,16 @@
                 BaseDal.UpdateData(task);
 
                 _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, App.User.UserId > 0 ? $"浜哄伐鎵嬪姩灏嗕换鍔$姸鎬佷粠銆恵oldState}銆戣烦杞埌銆恵task.TaskState}銆�" : $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�");
+
+                #region  鏇存柊浠诲姟鐘舵��
+                object request = new
+                {
+                    TaskNum = task.TaskNum,
+                    TaskState = task.TaskState
+                };
+                var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/UpdateTaskStatus", request.ToJsonString()).Result;
+                content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+                #endregion
 
                 content = WebResponseContent.Instance.OK();
             }
@@ -518,13 +556,13 @@
                     BaseDal.UpdateData(task);
 
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
-                    //todo 鍚屾鍒癢MS
+
 
                     //鏆備笉鑰冭檻澶氫釜鍑哄簱鍙�
                 }
                 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;
@@ -533,24 +571,6 @@
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
 
 
-                    //var x = new { taskNum = taskNum };
-                    //var result = HttpHelper.GetAsync("http:127.0.0.1:8098/api/Task/CompleteTaskAsync", x.ToJsonString()).Result;
-                    //content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-
-                    //WMSTaskDTO taskDTO = new WMSTaskDTO()
-                    //{
-                    //    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
-                    //    Grade = 1,
-                    //    PalletCode = task.PalletCode + "S",
-                    //    RoadWay = "SC01",
-                    //    SourceAddress = task.TargetAddress,
-                    //    TargetAddress = "CLOutAreaA",
-                    //    TaskState = (int)TaskOutStatusEnum.OutNew,
-                    //    Id = 0,
-                    //    TaskType = (int)TaskOutboundTypeEnum.Outbound
-                    //};
-
-                    //content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                 {
@@ -563,6 +583,25 @@
                 {
                     throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
                 }
+
+
+                #region WMS鍚屾浠诲姟瀹屾垚
+                var keys = new Dictionary<string, object>()
+                {
+                    {"taskNum", taskNum}
+                };
+                var result = HttpHelper.GetAsync($"http://127.0.0.1:5000/api/Task/CompleteTaskAsync", keys).Result;
+                content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+                #endregion
+                #region  鏇存柊浠诲姟鐘舵��
+                object request = new
+                {
+                    TaskNum = task.TaskNum,
+                    TaskState = task.TaskState
+                };
+                result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/UpdateTaskStatus", request.ToJsonString()).Result;
+                content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+                #endregion
                 //content = WebResponseContent.Instance.OK();
             }
             catch (Exception ex)
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..3bd8816 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -27,6 +27,7 @@
 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 +40,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 +108,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, platform });
+                                    }
+                                }
+                                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, platform });
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
                         }
                         //});
+
                         //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 +162,7 @@
                 //WriteDebug("CommonConveyorLineJob", "test");
                 //Console.Out.WriteLine(DateTime.Now);
             }
+
             return Task.CompletedTask;
         }
 
@@ -160,205 +175,28 @@
         /// <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)
+            try
             {
-                // 绌烘墭鐩樹换鍔�
-                if (Taskout.TaskType == (int)TaskOutboundTypeEnum.OutTray)
+                // 鑾峰彇涓嬩竴涓换鍔�
+                var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
+                //var taskOut = _taskService.QueryNextConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                //return;
+                // 澶勭悊鍑哄簱浠诲姟
+                HandleTaskOut(conveyorLine, command, childDeviceCode, ProtocalDetailValue, task);
+
+                // 濡傛灉娌℃湁鍑哄簱浠诲姟锛屽鐞嗘柊浠诲姟
+                if (task == null && command.Barcode != "NoRead")
                 {
-                    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)
+            catch (Exception ex)
             {
-                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);
-
-                        _taskService.UpdateTaskStatusToNext(task);
-                    }
-                }
+                return;
             }
         }
 
-        //
-        /// <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
-                };
-
-                #region 鐪熷疄鏁版嵁
-
-                // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
-                //RequestTaskDto request = new RequestTaskDto()
-                //{
-                //    Position = sourceAddress,
-                //    PalletCode = palletCode,
-                //};
-
-                //// 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                //var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
-
-                //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
-                //WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-
-                //// 妫�鏌ョ姸鎬佸苟杩斿洖
-                ////if (!content.Status)
-                ////    return content;
-
-                //// 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                //WMSTaskDTO task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
-
-                #endregion
-
-                var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
-                if (content.Status)
-                {
-                    Console.WriteLine("绌烘墭鐩樺懠鍙垚鍔�");
-                }
-            }
-        }
-
-        /// <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,
-                };
-
-                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);
-                }
-            }
-        }
+        #region 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
 
         /// <summary>
         /// 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
@@ -366,20 +204,22 @@
         /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
         /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
-        {
-            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
-            if (task != null)
-            {
-                Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
-                if (newTask != null)
-                {
-                    ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
-                    taskCommand.InteractiveSignal = command.InteractiveSignal;
-                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                }
-            }
-        }
+        //public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
+        //{
+        //    Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+        //    if (task != null)
+        //    {
+        //        Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+        //        if (newTask != null)
+        //        {
+        //            ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
+        //            taskCommand.InteractiveSignal = command.InteractiveSignal;
+        //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
+        //        }
+        //    }
+        //}
+
+        #endregion
 
         /// <summary>
         /// 杈撻�佺嚎鍏ュ簱瀹屾垚
@@ -397,7 +237,8 @@
 
                 //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
-                Console.Out.WriteLine(content.Serialize());
+
+                //Console.Out.WriteLine(content.Serialize());
             }
         }
 
@@ -407,7 +248,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 +258,7 @@
                 taskCommand.InteractiveSignal = command.InteractiveSignal;
                 conveyorLine.SendCommand(taskCommand, childDeviceCode);
 
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                 _taskService.UpdateTaskStatusToNext(task);
             }
         }
@@ -447,18 +290,101 @@
         /// <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);
-                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
-                Console.Out.WriteLine(content.Serialize());
+                WebResponseContent content = new WebResponseContent();
+                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;
+                }
+                else
+                {
+                    taskCommand.TargetAddress = 0;
+                }
+
+                conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                content = _taskService.UpdateTaskStatusToNext(task);
             }
         }
 
         /// <summary>
+        /// 鐩戞祴绌烘墭鐩樺疄鐩樺嚭搴�
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="index">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        public async void EmptyTrayReturn(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int index, Platform platform)
+        {
+            try
+            {
+                TaskOutboundTypeEnum taskOutboundTypeEnum;
+                if (platform.PlatformType.Contains("OutTray"))
+                    taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
+                else
+                    taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
+                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker.Split(',')[0], platform.Stacker.Split(',').ToList());
+            }
+            catch (Exception)
+            {
+            }
+        }
+
+        /// <summary>
+        /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
+        /// </summary>
+        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null)
+        {
+            var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
+            if (tasks.Count < index)
+            {
+                #region 璋冪敤WMS鑾峰彇鍑哄簱浠诲姟
+
+                WMSTaskDTO taskDTO = new WMSTaskDTO();
+                object dynamic = new
+                {
+                    position = childDeviceCode,
+                    tag = (int)taskType,
+                    areaCdoe = roadWay,
+                    roadways = roadways
+                };
+                var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
+
+                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+                // 妫�鏌ョ姸鎬佸苟杩斿洖
+                if (!content.Status)
+                    return;
+
+                taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+
+                #endregion
+
+                CreateAndSendTask(taskDTO);
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓浠诲姟
+        /// </summary>
+        public 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>
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..78f336f
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -0,0 +1,195 @@
+锘縰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;
+using WIDESEAWCS_DTO.WMS;
+
+namespace WIDESEAWCS_Tasks
+{
+    public 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.OutTray && 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") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048"))
+            {
+                // 璇锋眰WMS绌烘墭鐩樹换鍔�
+                CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
+            }
+            else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") || (conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339"))
+            {
+                // 璇锋眰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 keys = new Dictionary<string, object>()
+                {
+                    {"taskNum", taskOut.TaskNum}
+                };
+            var result = HttpHelper.GetAsync($"http://127.0.0.1:5000/api/Task/CompleteTaskAsync", keys).Result;
+            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            if (content.Status)
+            {
+                // 鏍囪鍙戦�佸畬鎴�
+                ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                // 鏇存柊浠诲姟鐘舵��
+                _taskService.UpdateTaskStatusToNext(taskOut);
+            }
+        }
+
+        /// <summary>
+        /// 鍒涘缓骞跺彂閫佺┖鎵樼洏浠诲姟
+        /// </summary>
+        public 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)
+        {
+            #region 鍚慦MS璇锋眰绌烘墭鐩樹换鍔�
+            WMSTaskDTO wMSTaskDTO = new WMSTaskDTO();
+            RequestTaskDto request = new RequestTaskDto()
+            {
+                Position = childDeviceCode,
+                PalletCode = barcode,
+            };
+            var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestTrayInTaskAsync", request.ToJsonString()).Result;
+            if (result == null)
+                return wMSTaskDTO;
+
+            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+            // 妫�鏌ョ姸鎬佸苟杩斿洖
+            if (!content.Status)
+                return wMSTaskDTO;
+
+            return JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+
+            #endregion 鍚慦MS璇锋眰绌烘墭鐩樹换鍔�
+        }
+
+        /// <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.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
+                if (task != null)
+                {
+                    // 鏄犲皠浠诲姟鍛戒护
+                    ConveyorLineTaskCommand taskCommand = MapTaskCommand(task, command);
+                    // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                    // 鏍囪鍙戦�佸畬鎴�
+                    ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+                    // 鏇存柊浠诲姟鐘舵��
+                    _taskService.UpdateTaskStatusToNext(task);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
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..e9d9278 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -48,9 +48,7 @@
                 CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
                 if (commonStackerCrane != null)
                 {
-                    //EqptRun(commonStackerCrane);
                     //EqptAlive(commonStackerCrane);
-                    //EqptStatus(commonStackerCrane);
                     //Console.Out.WriteLine(commonStackerCrane.DeviceName);
                     if (!commonStackerCrane.IsEventSubscribed)
                     {
@@ -157,6 +155,10 @@
                     task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
                 }
             }
+            else if (task == null)
+            {
+                task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode);
+            }
 
             return task;
         }
@@ -177,7 +179,7 @@
                     CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                     //if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
                     //{
-                        return task;
+                    return task;
                     //}
                 }
                 else
@@ -297,52 +299,6 @@
             return stackerCraneTaskCommand;
         }
 
-        /// <summary>
-        /// 璁惧涓嶮OM绯荤粺瀵规帴锛岃澶囦笂绾�
-        /// </summary>
-        /// <param name="commonStackerCrane"></param>
-        public async void EqptRun(CommonStackerCrane commonStackerCrane)
-        {
-            if (!commonStackerCrane.StackerOnline)
-            {
-                BasicDto dto = new BasicDto
-                {
-                    EmployeeNo = "T00001",
-                    EquipmentCode = commonStackerCrane.DeviceCode,
-                    RequestTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
-                    SessionId = Guid.NewGuid().ToString(),
-                    Software = commonStackerCrane.DeviceName,
-                };
-                var respone = await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptRun", dto.ToJsonString());
-                if (respone != null)
-                {
-                    var result = JsonConvert.DeserializeObject<ResponseEqptRunDto>(respone);
-                    if (result != null && result.Success)
-                    {
-                        var process = _processRepository.QueryData(x => x.EquipmentName == commonStackerCrane.DeviceName).FirstOrDefault();
-                        if (process == null)
-                        {
-                            ResponeRunDto runDto = JsonConvert.DeserializeObject<ResponeRunDto>(respone);
-                            process = new Dt_EquipmentProcess()
-                            {
-                                EquipmentName = commonStackerCrane.DeviceCode,
-                                EquipmentType = commonStackerCrane.DeviceName.Substring(commonStackerCrane.DeviceCode.IndexOf("鍫嗗灈鏈�")),
-                                WipOrderNo = runDto.WipOrderNo,
-                                ProductDesc = runDto.ProductDesc,
-                                ProcessValue = JsonConvert.SerializeObject(result)
-                            };
-                            var isResult = await _processRepository.AddDataAsync(process) > 0;
-                        }
-                        else
-                        {
-                            process.ProcessValue = JsonConvert.SerializeObject(result);
-                            var isResult = await _processRepository.UpdateDataAsync(process);
-                        }
-                        commonStackerCrane.StackerOnline = true;
-                    }
-                }
-            }
-        }
 
         /// <summary>
         /// 璁惧蹇冭烦
@@ -375,82 +331,5 @@
             }
         }
 
-        /// <summary>
-        /// 璁惧鐘舵��
-        /// </summary>
-        /// <param name="commonStackerCrane"></param>
-        public async void EqptStatus(CommonStackerCrane commonStackerCrane)
-        {
-            string code = string.Empty;
-            RequestAlertDto requestAlert = new RequestAlertDto()
-            {
-                EmployeeNo = "T00001",
-                EquipmentCode = commonStackerCrane.DeviceCode,
-                RequestTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
-                SessionId = Guid.NewGuid().ToString(),
-                Software = commonStackerCrane.DeviceName,
-                AlertInfo = new List<AlertInfoDto>()
-            };
-            switch (commonStackerCrane.Status)
-            {
-                case DeviceStatus.Idle:
-                    code = "Waiting";
-                    break;
-
-                case DeviceStatus.Working:
-                    code = "Running";
-                    break;
-
-                case DeviceStatus.Fault:
-                    code = "Alerting";
-                    var alert = new AlertInfoDto()
-                    {
-                        AlertCode = "1001",
-                        AlertDescription = commonStackerCrane.StackerCraneStatusDes,
-                        AlertReset = "1"
-                    };
-                    requestAlert.AlertInfo.Add(alert);
-
-                    await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptAlive", requestAlert.ToJsonString());
-
-                    break;
-
-                case DeviceStatus.Unkonw:
-                    code = "Down";
-                    break;
-
-                case DeviceStatus.Offline:
-                    code = "Maintenance";
-                    break;
-
-                default:
-                    break;
-            }
-            if (code != "Alerting")
-            {
-                requestAlert.AlertInfo = new List<AlertInfoDto>();
-                var alert = new AlertInfoDto()
-                {
-                    AlertCode = "1001",
-                    AlertDescription = commonStackerCrane.StackerCraneStatusDes,
-                    AlertReset = "0"
-                };
-                await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptAlive", requestAlert.ToJsonString());
-            }
-            RequestEqptStatusDto requestEqptStatus = new RequestEqptStatusDto()
-            {
-                EmployeeNo = "T00001",
-                EquipmentCode = commonStackerCrane.DeviceCode,
-                RequestTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
-                SessionId = Guid.NewGuid().ToString(),
-                Software = commonStackerCrane.DeviceName,
-                ChangeTime = DateTime.Now.ToString(),
-                Description = commonStackerCrane.StackerCraneStatusDes,
-                LocationID = "NA",
-                ReasonCode = "123",
-                StatusCode = code
-            };
-            var respone = await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptStatus", requestEqptStatus.ToJsonString());
-        }
     }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js b/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js
index dd63472..b0fb6fe 100644
--- a/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js
@@ -216,6 +216,14 @@
     meta: {
       keepAlive: false
     }
+  },
+  {
+    path: '/ProductionModel',
+    name: 'ProductionModel',
+    component: () => import('@/views/widesea_wms/MOM/ProductionModel.vue'),
+    meta: {
+      keepAlive: false
+    }
   }
 ]
 export default tables
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/Extend/Add.vue b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/Extend/Add.vue
new file mode 100644
index 0000000..230e978
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/Extend/Add.vue
@@ -0,0 +1,76 @@
+<template>
+    <div>
+        <vol-box v-model="showDetialBox" :lazy="true" :height="350" :width="600" :padding="15" title="鏂欐灞炴�х淮鎶�">
+            <el-form :inline="true" :model="TrayBarcodePropertys" label-width="auto" class="demo-form-inline">
+                <el-form-item label="鏂欐灞炴��:">
+                    <el-input v-model="TrayBarcodePropertys.TrayBarcodeProperty" placeholder="鏂欐灞炴��" />
+                </el-form-item>
+                <el-form-item label="鎵樼洏瀹归噺:">
+                    <el-input v-model="TrayBarcodePropertys.Capacity" placeholder="鎵樼洏瀹归噺" />
+                </el-form-item>
+                <el-button @click="addProductType" type="primary">娣诲姞浜у搧宸ュ簭</el-button>
+                <el-button @click="save" type="success">鎻愪氦鏁版嵁</el-button>
+                <el-row>
+                    <el-col :span="12">
+                        <el-form-item label="宸ュ簭:" v-for="(input, index) in TrayBarcodePropertys.ProcessCodes"
+                            :key="index">
+                            <el-input v-model="input.ProcessCode" placeholder="宸ュ簭" />
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="12">
+                        <el-form-item label="浜у搧绫诲瀷:" v-for="(input, index) in TrayBarcodePropertys.ProductTypes"
+                            :key="index">
+                            <el-input v-model="input.ProductType" placeholder="浜у搧绫诲瀷" />
+                        </el-form-item>
+                    </el-col>
+                </el-row>
+            </el-form>
+        </vol-box>
+    </div>
+</template>
+
+<script>
+import VolBox from "@/components/basic/VolBox.vue";
+import http from "@/../src/api/http.js";
+export default {
+    components: { VolBox },
+    data() {
+        return {
+            showDetialBox: false,
+            TrayBarcodePropertys: {
+                TrayBarcodeProperty: '',
+                Capacity: 0,
+                ProcessCodes: [{ ProcessCode: '', }],
+                ProductTypes: [{ ProductType: '', }]
+            }
+        }
+    },
+    methods: {
+        addProductType() {
+            this.TrayBarcodePropertys.ProductTypes.push({ ProductType: '' })
+            this.TrayBarcodePropertys.ProcessCodes.push({ ProcessCode: '' })
+        },
+        open() {
+            this.showDetialBox = true
+        },
+        save() {
+            console.log(this.TrayBarcodePropertys)
+            let data = ({...this.TrayBarcodePropertys, ProcessCodes:JSON.stringify(this.TrayBarcodePropertys.ProcessCodes) , ProductTypes:JSON.stringify(this.TrayBarcodePropertys.ProductTypes)});
+            
+            debugger;
+            http.post('api/Production/AddData', data).then(res => {
+                if (res.code == 200) {
+                    // ElMessage.success(res.msg)
+                    this.$message.success('娣诲姞鎴愬姛')
+                    this.$parent.load();
+                } else {
+                    // ElMessage.error(res.msg)
+                    this.$message.error(x.message)
+                }
+            })
+        }
+    }
+}
+</script>
+
+<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.js b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.js
new file mode 100644
index 0000000..85acb05
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.js
@@ -0,0 +1,77 @@
+/*****************************************************************************************
+**  Author:jxx 2022
+**  QQ:283591387
+**瀹屾暣鏂囨。瑙侊細http://v2.volcore.xyz/document/api 銆愪唬鐮佺敓鎴愰〉闈iewGrid銆�
+**甯哥敤绀轰緥瑙侊細http://v2.volcore.xyz/document/vueDev
+**鍚庡彴鎿嶄綔瑙侊細http://v2.volcore.xyz/document/netCoreDev
+*****************************************************************************************/
+//姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
+import gridBody from "./Extend/Add.vue"; //鑷畾涔夋墿灞曟煡璇㈢晫闈腑琛ㄦ牸浣撶粍浠�
+
+let extension = {
+  components: {
+    //鏌ヨ鐣岄潰鎵╁睍缁勪欢
+    gridHeader: '',
+    gridBody: gridBody,
+    gridFooter: '',
+    //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
+    modelHeader: '',
+    modelBody: '',
+    modelFooter: ''
+  },
+  tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓)
+  buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽�
+  methods: {
+     //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
+    onInit() {  //妗嗘灦鍒濆鍖栭厤缃墠锛�
+        //绀轰緥锛氬湪鎸夐挳鐨勬渶鍓嶉潰娣诲姞涓�涓寜閽�
+          this.buttons.unshift({  //涔熷彲浠ョ敤push鎴栬�卻plice鏂规硶鏉ヤ慨鏀筨uttons鏁扮粍
+            name: '鎸夐挳', //鎸夐挳鍚嶇О
+            icon: 'el-icon-document', //鎸夐挳鍥炬爣vue2鐗堟湰瑙乮view鏂囨。icon锛寁ue3鐗堟湰瑙乪lement ui鏂囨。icon(娉ㄦ剰涓嶆槸element puls鏂囨。)
+            type: 'primary', //鎸夐挳鏍峰紡vue2鐗堟湰瑙乮view鏂囨。button锛寁ue3鐗堟湰瑙乪lement ui鏂囨。button
+            onClick: function () {
+              console.log("馃殌 ~ onInit ~ gridBody:", gridBody)
+              this.$refs.gridBody.open();
+            }
+          });
+
+        //绀轰緥锛氳缃慨鏀规柊寤恒�佺紪杈戝脊鍑烘瀛楁鏍囩鐨勯暱搴�
+        this.boxOptions.labelWidth = 150;
+    },
+    onInited() {
+      //妗嗘灦鍒濆鍖栭厤缃悗
+      //濡傛灉瑕侀厤缃槑缁嗚〃,鍦ㄦ鏂规硶鎿嶄綔
+      //this.detailOptions.columns.forEach(column=>{ });
+    },
+    searchBefore(param) {
+      //鐣岄潰鏌ヨ鍓�,鍙互缁檖aram.wheres娣诲姞鏌ヨ鍙傛暟
+      //杩斿洖false锛屽垯涓嶄細鎵ц鏌ヨ
+      return true;
+    },
+    searchAfter(result) {
+      //鏌ヨ鍚庯紝result杩斿洖鐨勬煡璇㈡暟鎹�,鍙互鍦ㄦ樉绀哄埌琛ㄦ牸鍓嶅鐞嗚〃鏍肩殑鍊�
+      return true;
+    },
+    addBefore(formData) {
+      //鏂板缓淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛紝鍙互缁欑粰琛ㄥ崟璁剧疆鍊硷紝鑷繁杈撳嚭鐪媐ormData鐨勫��
+      return true;
+    },
+    updateBefore(formData) {
+      //缂栬緫淇濆瓨鍓峟ormData涓哄璞★紝鍖呮嫭鏄庣粏琛ㄣ�佸垹闄よ鐨処d
+      return true;
+    },
+    rowClick({ row, column, event }) {
+      //鏌ヨ鐣岄潰鐐瑰嚮琛屼簨浠�
+      this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�;
+    },
+    modelOpenAfter(row) {
+      //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁
+      //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add';
+      //(2)缁欏脊鍑烘璁剧疆榛樿鍊�
+      //(3)this.editFormFields.瀛楁='xxx';
+      //濡傛灉闇�瑕佺粰涓嬫媺妗嗚缃粯璁ゅ�硷紝璇烽亶鍘唗his.editFormOptions鎵惧埌瀛楁閰嶇疆瀵瑰簲data灞炴�х殑key鍊�
+      //鐪嬩笉鎳傚氨鎶婅緭鍑虹湅锛歝onsole.log(this.editFormOptions)
+    }
+  }
+};
+export default extension;
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.vue b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.vue
new file mode 100644
index 0000000..1a82e6e
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/views/widesea_wms/MOM/ProductionModel.vue
@@ -0,0 +1,68 @@
+<!--
+*Author锛歫xx
+ *Contact锛�283591387@qq.com
+ *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩�
+ *涓氬姟璇峰湪@/extension/widesea_wms/material/Dt_MaterielInfo.js姝ゅ缂栧啓
+ -->
+ <template>
+    <view-grid ref="grid" :columns="columns" :detail="detail" :editFormFields="editFormFields"
+        :editFormOptions="editFormOptions" :searchFormFields="searchFormFields" :searchFormOptions="searchFormOptions"
+        :table="table" :extend="extend">
+    </view-grid>
+</template>
+<script>
+import extend from "./ProductionModel.js";
+import { ref, defineComponent } from "vue";
+export default defineComponent({
+    setup() {
+        const table = ref({
+            key: 'materielID',
+            footer: "Foots",
+            cnName: '鏂欐灞炴��',
+            name: 'ProductionModel',
+            url: "/Production/",
+            sortName: "MaterielID"
+        });
+        const editFormFields = ref({
+            "TrayBarcodeProperty": "",
+            "Capacity": "",
+
+        });
+        const editFormOptions = ref([
+            [
+                { "title": "鏂欐灞炴��", "field": "TrayBarcodeProperty", type: "text" },
+                { "title": "鎵樼洏瀹归噺", "field": "Capacity", type: "text" },
+            ]
+        ]);
+        const searchFormFields = ref({});
+        const searchFormOptions = ref([
+            [
+                { "title": "鏂欐灞炴��", "field": "TrayBarcodeProperty", type: "text" },
+                { "title": "鎵樼洏瀹归噺", "field": "Capacity", type: "text" },
+            ]
+        ]);
+        const columns = ref([{ field: 'id', title: 'ID', type: 'int', width: 110, hidden: true, readonly: true, require: true, align: 'left' },
+        { field: 'trayBarcodeProperty', title: '鏂欐灞炴��', type: 'string', width: 110, align: 'left', sort: true },
+        { field: 'processCodes', title: '宸ュ簭闆嗗悎', type: 'string', width: 120, align: 'left' },
+        { field: 'productTypes', title: '鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿闆嗗悎', type: 'string', width: 110, align: 'left' },
+        { field: 'capacity', title: '鎵樼洏瀹归噺', type: 'string', width: 110, align: 'left' }]);
+        const detail = ref({
+            cnName: "#detailCnName",
+            table: "#detailTable",
+            columns: [],
+            sortName: "",
+            key: ""
+        });
+        return {
+            table,
+            extend,
+            editFormFields,
+            editFormOptions,
+            searchFormFields,
+            searchFormOptions,
+            columns,
+            detail,
+        };
+    },
+});
+</script>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs
index 7d715d8..2723c74 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/IUnitOfWorkManage.cs
@@ -21,5 +21,6 @@
         void CommitTran(MethodInfo method);
         void RollbackTran();
         void RollbackTran(MethodInfo method);
+        Task UseTranAsync(Func<Task> action);
     }
 }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
index 81607a6..4b550f4 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/UnitOfWorks/UnitOfWorkManage.cs
@@ -190,5 +190,26 @@
                 }
             }
         }
+
+        public async Task UseTranAsync(Func<Task> action)
+        {
+            // 寮�濮嬩簨鍔�
+            _sqlSugarClient.Ado.BeginTran();
+
+            try
+            {
+                // 鎵ц浼犲叆鐨勬搷浣�
+                await action();
+
+                // 鎻愪氦浜嬪姟
+                await _sqlSugarClient.Ado.CommitTranAsync();
+            }
+            catch (Exception ex)
+            {
+                // 鍥炴粴浜嬪姟
+                await _sqlSugarClient.Ado.RollbackTranAsync();
+                throw new Exception (ex.Message); // 閲嶆柊鎶涘嚭寮傚父锛屼互渚胯皟鐢ㄦ柟鍙互澶勭悊
+            }
+        }
     }
 }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs
index 3436324..81bb1a4 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/DB/Models/BaseEntity.cs
@@ -50,7 +50,7 @@
         [ImporterHeader(Name = "鍒涘缓鑰�")]
         [ExporterHeader(DisplayName = "鍒涘缓鑰�")]
         [SugarColumn(IsNullable = false, IsOnlyIgnoreUpdate = true, ColumnDescription = "鍒涘缓鑰�")]
-        public string Creater { get; set; }
+        public string Creater { get; set; } = "Systeam";
 
         /// <summary>
         /// 鍒涘缓鏃堕棿
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs
index 21bbef2..fe41350 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs
@@ -49,7 +49,7 @@
                 {
                     // 浣跨敤 myScopedService 鎵ц浠诲姟
 
-                    //await DBSeed.SeedAsync(_dbContext, _webRootPath);
+                    await DBSeed.SeedAsync(_dbContext, _webRootPath);
 
                     //澶氱鎴� 鍚屾
                     //await DBSeed.TenantSeedAsync(_dbContext);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
index 525996e..63a5ce1 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
@@ -11,4 +11,22 @@
     /// 鎵樼洏鍙�
     /// </summary>
     public string PalletCode { get; set; }
+
+    /// <summary>
+    /// 绌烘墭鐩樺彲鍏ュ贩鍒�
+    /// </summary>
+    public string PositionList { get; set; }
+
+    /// <summary>
+    /// 浠诲姟绫诲瀷
+    /// </summary>
+    public string RequestType { get; set; } = string.Empty;
+}
+
+public class RequestOutTaskDto
+{
+    public string   Position { get; set; }
+    public int Tag { get; set; }
+    public string AreaCdoe { get; set; }
+    public List<string> Roadways { get; set; }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/UpdateStatusDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/UpdateStatusDto.cs
new file mode 100644
index 0000000..2b109c5
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/UpdateStatusDto.cs
@@ -0,0 +1,21 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO
+{
+    public class UpdateStatusDto
+    {
+        /// <summary>
+        /// 浠诲姟鍙�
+        /// </summary>
+        public int TaskNum { get; set; }
+
+        /// <summary>
+        /// 浠诲姟鐘舵��
+        /// </summary>
+        public int TaskState { get; set; }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellStateDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/CellStateDto.cs
similarity index 100%
rename from Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellStateDto.cs
rename to Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/CellStateDto.cs
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/ResultTrayCellsStatus.cs
similarity index 64%
rename from Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs
rename to Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/ResultTrayCellsStatus.cs
index 841ba73..48d00df 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResultTrayCellsStatus.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/ResultTrayCellsStatus.cs
@@ -1,5 +1,8 @@
 锘縩amespace WIDESEA_DTO.MOM
 {
+    /// <summary>
+    /// 鎵樼洏鐢佃姱鐘舵��
+    /// </summary>
     public class ResultTrayCellsStatus : BasicResult
     {
         /// <summary>
@@ -16,6 +19,16 @@
         /// 缁戝畾浠g爜
         /// </summary>
         public string BindCode { get; set; }
+
+        /// <summary>
+        /// 鐢熶骇浜х嚎
+        /// </summary>
+        public string ProductionLine { get; set; }
+
+        /// <summary>
+        /// 褰撳墠宸ヨ壓宸ュ簭浠g爜
+        /// </summary>
+        public string ProcessCode { get; set; }
 
         /// <summary>
         /// 鏂欐灞炴�у垪琛�
@@ -38,6 +51,8 @@
         /// </summary>
         public int PositionNo { get; set; }
 
+        //public string BindCode { get; set; }
+
         /// <summary>
         /// 鐢佃姱鐘舵��
         /// </summary>
@@ -57,9 +72,30 @@
         /// <summary>
         /// 宸ュ簭
         /// </summary>
-        public string ProcessCode { get; set; }
+        public List<ProcessCodes> ProcessCodes { get; set; } = new List<ProcessCodes>();
 
         /// <summary>
+        /// 鎵樼洏瀹归噺
+        /// </summary>
+        public double Capacity { get; set; }
+
+        /// <summary>
+        /// 閫傜敤鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿
+        /// </summary>
+        public List<ProductTypes> ProductType { get; set; } = new List<ProductTypes>();
+    }
+
+    public class ProcessCodes
+    {
+        /// <summary>
+        /// 宸ュ簭
+        /// </summary>
+        public string ProcessCode { get; set; }
+    }
+
+    public class ProductTypes
+    {
+        /// <summary>
         /// 閫傜敤鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿
         /// </summary>
         public string ProductType { get; set; }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/TrayCellUnbindDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayCellUnbindDto.cs
similarity index 100%
rename from Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/TrayCellUnbindDto.cs
rename to Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayCellUnbindDto.cs
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/TrayCellsStatusDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayCellsStatusDto.cs
similarity index 100%
rename from Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/TrayCellsStatusDto.cs
rename to Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayCellsStatusDto.cs
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/TrayUnbindDto.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayUnbindDto.cs
similarity index 100%
rename from Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/TrayUnbindDto.cs
rename to Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/CellState/TrayUnbindDto.cs
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..15c9ae6 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,105 @@
         [SugarColumn(IsNullable = false, Length = int.MaxValue, ColumnDescription = "宸ヨ壓鍙傛暟鍊�")]
         public string ProcessValue { get; set; }
     }
+
+    /// <summary>
+    /// 琛ㄧず宸ヨ壓璺嚎涓婅澶囧弬鏁颁俊鎭殑妯″瀷銆�
+    /// </summary>
+    public class EBParameterInfo
+    {
+        /// <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; }
+    }
+
+
+    public class ResponseEqptRunDto : BasicResult
+    {
+        /// <summary>
+        /// 浜у搧鍚嶇О
+        /// </summary>
+        public string ProductDesc { get; set; }
+
+        /// <summary>
+        /// 棣栦欢鏁伴噺
+        /// </summary>
+        public string FirstArticleNum { get; set; }
+
+        /// <summary>
+        /// 璋冩満鏁伴噺
+        /// </summary>
+        public string DebugNum { get; set; }
+
+        /// <summary>
+        /// 鍙傛暟鐗堟湰淇℃伅
+        /// </summary>
+        public string ParamVersion { get; set; }
+
+        /// <summary>
+        /// 鏄惁闇�瑕佽鍙栧弬鏁�
+        /// </summary>
+        public bool ParamRefreshFlag { get; set; }
+
+        /// <summary>
+        /// 鍙傛暟淇℃伅
+        /// </summary>
+        public List<EBParameterInfo> ParameterInfo { 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..5881e68
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MOM/ResponeAgingInputDto.cs
@@ -0,0 +1,44 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO.MOM
+{
+    /// <summary>
+    /// 鍏ュ簱
+    /// </summary>
+    public class ResponeAgingInputDto : BasicResult
+    {
+        /// <summary>
+        /// 鏂欐灞炴�э紝鐢ㄤ簬鏍囪瘑鏂欐鐨勫敮涓�灞炴�с��
+        /// </summary>
+        public string TrayBarcodeProperty { get; set; }
+
+        /// <summary>
+        /// 宸ュ崟缂栫爜鎴栦骇鍝佸瀷鍙凤紝鐢ㄤ簬鍏宠仈鍏蜂綋鐨勭敓浜т换鍔°��
+        /// </summary>
+        public string BindCode { get; set; }
+
+        /// <summary>
+        /// 鐢熶骇浜х嚎
+        /// </summary>
+        public string ProductionLine { get; set; }
+
+        /// <summary>
+        /// 鍏宠仈宸ュ簭杩斿洖鏃堕棿锛岃褰曟敞娑叉垨闈欑疆鏃堕暱銆�
+        /// </summary>
+        public string LinedProcessFeedbackTime { get; set; }
+
+        /// <summary>
+        /// 鐗瑰緛鍙傛暟杩斿洖(闈欑疆鏃堕暱)
+        /// </summary>
+        public string SpecialParameterDuration { get; set; }
+
+        /// <summary>
+        /// 鍗曚綅
+        /// </summary>
+        public string UomCode { 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_IStorageTaskService/Task/IDt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
index 7a0af69..c63e2d2 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
@@ -124,7 +124,7 @@
     Task<WebResponseContent> CompleteAsync(int taskNum);
 
     /// <summary>
-    /// 璇锋眰浠诲姟
+    /// 璇锋眰浠诲姟宸烽亾
     /// </summary>
     /// <param name="position"></param>
     /// <param name="areaCode"></param>
@@ -134,9 +134,35 @@
     Task<WebResponseContent> RequestTaskAsync(RequestTaskDto input);
 
     /// <summary>
+    /// 璇锋眰浠诲姟璐т綅
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    Task<WebResponseContent> UpdateExistingTask(RequestTaskDto input);
+
+    /// <summary>
     /// 璇锋眰绌烘墭鐩樹换鍔�
     /// </summary>
-    /// <param name="position"></param>
+    /// <param name="input"></param>
     /// <returns></returns>
-    Task<WebResponseContent> RequestTrayTaskAsync(string position);
+    Task<WebResponseContent> RequestTrayInTaskAsync(RequestTaskDto input);
+
+    /// <summary>
+    /// 璇锋眰鎵樼洏浠诲姟
+    /// </summary>
+    /// <param name="position">鐩爣浣嶇疆</param>
+    /// <param name="tag">鎵樼洏绫诲瀷锛�1锛氬疄鐩橈紝2锛氱┖鐩橈級</param>
+    /// <param name="areaCode">鍖哄煙缂栫爜</param>
+    /// <param name="roadways">宸烽亾鍒楄〃</param>
+    /// <returns>杩斿洖缁撴灉闆�</returns>
+    Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> roadways);
+
+
+    /// <summary>
+    /// 浠诲姟鐘舵�佷慨鏀�
+    /// </summary>
+    /// <param name="input">璇锋眰鏁版嵁</param>
+    /// <returns></returns>
+    Task<WebResponseContent> UpdateTaskStatus(int taskNum, int taskState);
+
 }
\ 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..bd089e8 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,10 +36,26 @@
         public bool IsFull { get; set; }
 
         /// <summary>
-        /// 澶囨敞
+        /// 澶囨敞 (闈欏埗\闄堝寲鏃堕棿)
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDescription = "澶囨敞")]
         public string Remark { get; set; }
+
+        /// <summary>
+        /// 鍏宠仈宸ュ簭杩斿洖鏃堕棿锛堟敞娑瞈闈欑疆鏃堕暱锛�
+        /// </summary>
+        public string LinedProcessFeedbackTime { get; set; }
+
+        /// <summary>
+        /// 鐗瑰緛鍙傛暟杩斿洖(闈欑疆鏃堕暱)
+        /// </summary>
+        public string SpecialParameterDuration { get; set; }
+
+        /// <summary>
+        /// 鍖哄煙缂栫爜
+        /// </summary>
+        [SugarColumn(IsNullable = true, ColumnDescription = "鍖哄煙缂栫爜")]
+        public string AreaCode { get; set; }
 
         /// <summary>
         /// 搴撳瓨鏄庣粏
@@ -52,7 +68,7 @@
         /// 璐т綅鏁版嵁
         /// </summary>
         [SugarColumn(ColumnName = "LocationInfo")]
-        [Navigate(NavigateType.OneToOne,nameof(LocationCode), nameof(DtLocationInfo.LocationCode))]
+        [Navigate(NavigateType.OneToOne, nameof(LocationCode), nameof(DtLocationInfo.LocationCode))]
         public DtLocationInfo? LocationInfo { get; set; }
     }
-}
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/MOM/ProductionModel.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/MOM/ProductionModel.cs
new file mode 100644
index 0000000..082f39f
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/MOM/ProductionModel.cs
@@ -0,0 +1,79 @@
+锘縰sing Newtonsoft.Json;
+using SqlSugar;
+using WIDESEA_Core.DB.Models;
+
+namespace WIDESEA_Model.Models
+{
+    /// <summary>
+    /// 琛ㄧず鐢熶骇杩囩▼涓殑鏂欐灞炴�у拰鐩稿叧宸ュ簭淇℃伅鐨勬ā鍨嬨��
+    /// </summary>
+    [SugarTable("ProductionModel", "鏂欐灞炴��")]
+    public class ProductionModel : BaseEntity
+    {
+        /// <summary>
+        /// 澶�  娉�:涓婚敭锛岃嚜鍔ㄥ闀�
+        /// </summary>
+        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭锛岃嚜鍔ㄥ闀�")]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 鏂欐灞炴�э紝鐢ㄤ簬鏍囪瘑鏂欐鐨勫敮涓�灞炴�с��
+        /// </summary>
+        [SugarColumn(ColumnName = "TrayBarcodeProperty", ColumnDescription = "鏂欐灞炴��", IsNullable = false)]
+        public string TrayBarcodeProperty { get; set; }
+
+        /// <summary>
+        /// 宸ュ簭闆嗗悎锛屽寘鍚墍鏈夌浉鍏崇殑宸ュ簭浠g爜銆�
+        /// </summary>
+        [SugarColumn(ColumnName = "ProcessCodes", ColumnDescription = "宸ュ簭闆嗗悎", IsNullable = false, Length = int.MaxValue)]
+        public string ProcessCodes { get; set; }
+
+        /// <summary>
+        /// 閫傜敤鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿闆嗗悎锛屽寘鍚墍鏈夌浉鍏崇殑鐗╂枡缂栫爜鎴栧伐鑹哄瀷鍙枫��
+        /// </summary>
+        [SugarColumn(ColumnName = "ProductTypes", ColumnDescription = "閫傜敤鐗╂枡缂栫爜", IsNullable = false, Length = int.MaxValue)]
+        public string ProductTypes { get; set; }
+
+        /// <summary>
+        /// 鎵樼洏瀹归噺锛岃〃绀烘枡妗嗗彲浠ユ壙杞界殑鏈�澶х墿鍝佹暟閲忋��
+        /// </summary>
+        [SugarColumn(ColumnName = "Capacity", ColumnDescription = "鎵樼洏瀹归噺", IsNullable = false)]
+        public int Capacity { get; set; }
+
+        /// <summary>
+        /// 鑾峰彇鎴栬缃伐搴忛泦鍚堬紝鍙嶅簭鍒楀寲JSON瀛楃涓蹭负List<ProcessCodes>銆�
+        /// </summary>
+        [SugarColumn(IsIgnore = true)]
+        public List<ProcessCodesDTO> GetProcessCodes
+        {
+            get { return JsonConvert.DeserializeObject<List<ProcessCodesDTO>>(ProcessCodes); }
+            set { ProcessCodes = JsonConvert.SerializeObject(value); }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎴栬缃�傜敤鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿闆嗗悎锛屽弽搴忓垪鍖朖SON瀛楃涓蹭负List<string>銆�
+        /// </summary>
+        [SugarColumn(IsIgnore = true)]
+        public List<ProductTypesDTO> GetProductTypes
+        {
+            get { return JsonConvert.DeserializeObject<List<ProductTypesDTO>>(ProductTypes); }
+            set { ProductTypes = JsonConvert.SerializeObject(value); }
+        }
+    }
+
+    public class ProcessCodesDTO
+    {
+        /// <summary>
+        /// 宸ュ簭
+        /// </summary>
+        public string ProcessCode { get; set; }
+    }
+
+    public class ProductTypesDTO
+    {
+        /// <summary>
+        /// 閫傜敤鐗╂枡缂栫爜/宸ヨ壓鍨嬪彿
+        /// </summary>
+        public string ProductType { get; set; }
+    }
+}
\ No newline at end of file
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..b33d0ed 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,21 +17,17 @@
     /// </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();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
             input.EmployeeNo = "T00001";
             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 +38,7 @@
             LogFactory.GetLog("闈欑疆闄堝寲鍏ュ簱锛堟暣鎵樼洏锛�").Error(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("闈欑疆闄堝寲鍏ュ簱锛堟暣鎵樼洏锛�").Error(true, err.StackTrace);
         }
-        return Task.FromResult<dynamic>(null);
+        return content;
     }
 
     /// <summary>
@@ -48,17 +46,17 @@
     /// </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();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
             input.EmployeeNo = "T00001";
-            input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); ;
+            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/AgingOutput", inputJson);
+            content.OK(data: x);
             LogFactory.GetLog("闈欑疆闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("闈欑疆闄堝寲鍑哄簱锛堟暣鎵樼洏锛�").Info(true, x);
         }
@@ -67,7 +65,8 @@
             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..1459cc2 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
@@ -1,13 +1,10 @@
 锘縰sing LogLibrary.Log;
 using Masuit.Tools;
-using Newtonsoft.Json;
 using WIDESEA_Common;
 using WIDESEA_Core;
 using WIDESEA_DTO;
-using WIDESEA_DTO.MOM;
 using WIDESEA_IStorageBasicService;
 using WIDESEA_IStoragIntegrationServices;
-using WIDESEA_Model.Models;
 
 namespace WIDESEA_StoragIntegrationServices;
 
@@ -33,40 +30,42 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
             input.EmployeeNo = "T00001";
             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/CellState", inputJson);
-            if (x != null)
-            {
-                ResultCellState result = JsonConvert.DeserializeObject<ResultCellState>(x);
-                DtBoxingInfo boxingInfo = new DtBoxingInfo()
-                {
-                    IsFull = true,
-                    PalletCode = "",
-                };
-                var details = new List<DtBoxingInfoDetail>();
-                foreach (var item in result.SerialNos)
-                {
-                    DtBoxingInfoDetail detail = new DtBoxingInfoDetail()
-                    {
-                        SerialNumber = item.SerialNo,
-                        OrderNo = item.BindCode,
-                        Status = item.SerialNoStatus,
-                    };
-                    details.Add(detail);
-                }
-                boxingInfo.BoxingInfoDetails = details;
-                var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
-                if (abc.Status)
-                    return content.OK("缁勭洏鎴愬姛");
-                else
-                    return content.Error("缁勭洏澶辫触");
-            }
+            #region
+            //if (x != null)
+            //{
+            //    ResultCellState result = JsonConvert.DeserializeObject<ResultCellState>(x);
+            //    DtBoxingInfo boxingInfo = new DtBoxingInfo()
+            //    {
+            //        IsFull = true,
+            //        PalletCode = "",
+            //    };
+            //    var details = new List<DtBoxingInfoDetail>();
+            //    foreach (var item in result.SerialNos)
+            //    {
+            //        DtBoxingInfoDetail detail = new DtBoxingInfoDetail()
+            //        {
+            //            SerialNumber = item.SerialNo,
+            //            OrderNo = item.BindCode,
+            //            Status = item.SerialNoStatus,
+            //        };
+            //        details.Add(detail);
+            //    }
+            //    boxingInfo.BoxingInfoDetails = details;
+            //    var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo);
+            //    if (abc.Status)
+            //        return content.OK("缁勭洏鎴愬姛");
+            //    else
+            //        return content.Error("缁勭洏澶辫触");
+            //}
+            #endregion
+
             LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Info(true, x);
+            return x;
         }
         catch (Exception err)
         {
@@ -88,39 +87,36 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
             input.EmployeeNo = "T00001";
             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("缁勭洏澶辫触");
+                // 鍙嶅簭鍒楀寲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);
+                    content.OK("缁勭洏鎴愬姛", x);
             }
             LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Info(true, x);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
index 1e1d970..2a36c02 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
@@ -24,16 +24,14 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
             input.EmployeeNo = "T00001";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputIson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/ProcessApply", inputIson);
             if (x != null)
             {
-                var ResultProcess = JsonConvert.DeserializeObject<ResultProcessApply>(x);
-                content.OK(data: ResultProcess);
+                //var ResultProcess = JsonConvert.DeserializeObject<ResultProcessApply>(x);
+                content.OK(data: x);
             }
             LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Info(true, $"\r\r--------------------------------------");
             LogFactory.GetLog("宸ヨ壓璺嚎鐢宠").Info(true, x);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
index b883ec0..f4f8c6e 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
@@ -26,12 +26,11 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
+            input.Software = "WMS";
+            input.EquipmentCode = "ECH001-B";
             input.EmployeeNo = "T00001";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
-            Console.WriteLine();
             LogFactory.GetLog("鎵樼洏鍗曠數鑺В缁�1").Info(true, JsonConvert.SerializeObject(inputJson));
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/TrayCellUnbind", inputJson);
             LogFactory.GetLog("鎵樼洏鍗曠數鑺В缁�").Info(true, $"\r\r--------------------------------------");
@@ -56,8 +55,8 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.Software = "闄堝寲鏈�";
-            input.EquipmentCode = "P1K10040";
+            input.Software = "WMS";
+            input.EquipmentCode = "ECH001-B";
             input.EmployeeNo = "T00001";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/IProductionRepository.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/IProductionRepository.cs
new file mode 100644
index 0000000..62463d0
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/IProductionRepository.cs
@@ -0,0 +1,12 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_StorageBasicRepository
+{
+    public interface IProductionRepository : IRepository<ProductionModel>
+    {
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/ProductionRepository.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/ProductionRepository.cs
new file mode 100644
index 0000000..a58f43f
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/Production/ProductionRepository.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_StorageBasicRepository
+{
+    public class ProductionRepository : RepositoryBase<ProductionModel>, IProductionRepository
+    {
+        public ProductionRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+        {
+        }
+    }
+}
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/IProductionService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/IProductionService.cs
new file mode 100644
index 0000000..edb2e8d
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/IProductionService.cs
@@ -0,0 +1,5 @@
+锘縩amespace WIDESEA_StorageBasicServices;
+
+public interface IProductionService : IService<ProductionModel>
+{
+}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/ProductionService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/ProductionService.cs
new file mode 100644
index 0000000..2724493
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Production/ProductionService.cs
@@ -0,0 +1,10 @@
+锘縰sing WIDESEA_StorageBasicRepository;
+
+namespace WIDESEA_StorageBasicServices;
+
+public class ProductionService : ServiceBase<ProductionModel, IProductionRepository>, IProductionService
+{
+    public ProductionService(IProductionRepository BaseDal) : base(BaseDal)
+    {
+    }
+}
\ No newline at end of file
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..856cbac 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,14 @@
-锘縰sing Mapster;
+锘縰sing log4net.Core;
+using Mapster;
+using Masuit.Tools;
 using WIDESEA_DTO.MOM;
 using WIDESEA_DTO.WMS;
+using WIDESEA_IStorageBasicRepository;
 using WIDESEA_IStoragIntegrationServices;
+using WIDESEA_Model.Models;
 using WIDESEA_StorageBasicRepository;
+using WIDESEA_StorageTaskRepository;
+using WIDESEA_StoragIntegrationServices;
 
 namespace WIDESEA_StorageOutTaskServices;
 
@@ -12,6 +18,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 +29,12 @@
     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; //闈欑疆\闄堝寲
+    private readonly IProductionRepository _productionRepository; //鐢熶骇
 
     public Dt_TaskService(IDt_TaskRepository BaseDal,
                                 IUnitOfWorkManage unitOfWorkManage,
@@ -44,7 +53,10 @@
                                 IBoxingInfoRepository boxingInfoRepository,
                                 ICellStateService cellStateService,
                                 IProcessApplyService processApplyService,
-                                IDt_AreaInfoRepository areaInfoRepository) : base(BaseDal)
+                                IDt_AreaInfoRepository areaInfoRepository,
+                                IAgingInOrOutInputService agingInOrOutInputService,
+                                IStockInfoDetailRepository stockInfoDetailRepository,
+                                IProductionRepository productionRepository) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
         _outOrderRepository = outOrderRepository;
@@ -63,75 +75,143 @@
         _cellStateService = cellStateService;
         _processApplyService = processApplyService;
         _areaInfoRepository = areaInfoRepository;
+        _agingInOrOutInputService = agingInOrOutInputService;
+        _stockInfoDetailRepository = stockInfoDetailRepository;
+        _productionRepository = productionRepository;
     }
 
     #region 澶栭儴鎺ュ彛鏂规硶
 
-    #region 鍫嗗灈鏈哄嚭搴撲换鍔″畬鎴�
+    #region 鍑哄簱浠诲姟瀹屾垚
 
-    /// <summary>
-    /// 鍫嗗灈鏈哄嚭搴撲换鍔″畬鎴�
-    /// </summary>
-    /// <param name="saveModel">浠诲姟鏁版嵁鍚堥泦</param>
-    /// <returns>杩斿洖缁撴灉闆�</returns>
+
     public async Task<WebResponseContent> CompleteStackTaskAsync(Dt_Task task, DtStockInfo stock)
     {
         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);
+                var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue);
 
-            // 鏇存柊浠诲姟鐘舵��
-            task.TaskState = TaskOutStatusEnum.SC_OutFinish.ObjToInt();
-            task.CurrentAddress = task.NextAddress;
-            task.NextAddress = task.TargetAddress;
+                var agingOutputDto = MapToAgingOutputDto(stock, info);
+                content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+                ValidateResponse(content);
+            }
 
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", "鏇存柊搴撳瓨鐘舵�佷笌浠诲姟鐘舵��");
+            // 鏇存柊搴撳瓨鐘舵�佸拰浠诲姟鐘舵��
+            (var loc, var tas) = UpdateStockAndTaskStatus(stock, task);
 
             // 浜嬪姟澶勭悊
-            // 寮�濮嬩簨鍔�
-            _unitOfWorkManage.BeginTran();
-            // 鏇存柊搴撳瓨淇℃伅
-            var isStockUpdated = _stockInfoRepository.UpdateData(stock);
-            // 鏇存柊浠诲姟淇℃伅
-            var isTaskUpdated = await Update(task);
+            await _unitOfWorkManage.UseTranAsync(async () =>
+            {
+                await UpdateLocationAsync(loc);
+                await DeleteStockInfoAsync(stock.Id);
+                await DeleteStockInfoDetailsAsync(stock.StockInfoDetails);
+                //await DeleteTaskAsync(task.TaskId);
+            });
 
-            // 濡傛灉搴撳瓨淇℃伅鍜屼换鍔′俊鎭兘鏇存柊鎴愬姛
-            if (isStockUpdated && isTaskUpdated)
-            {
-                // 璁板綍鏃ュ織
-                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", $"浜嬪姟澶勭悊瀹屾垚锛屽簱瀛樼姸鎬佹洿鏂帮細{isStockUpdated}锛屼换鍔$姸鎬佹洿鏂�:{isTaskUpdated}");
-                // 鎻愪氦浜嬪姟
-                _unitOfWorkManage.CommitTran();
-                // 杩斿洖鎴愬姛缁撴灉
-                return content.OK("浠诲姟瀹屾垚鎴愬姛");
-            }
-            else
-            {
-                // 璁板綍鏃ュ織
-                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", $"浜嬪姟澶勭悊澶辫触锛屽簱瀛樼姸鎬佹洿鏂帮細{isStockUpdated}锛屼换鍔$姸鎬佹洿鏂�:{isTaskUpdated}");
-                // 鍥炴粴浜嬪姟
-                _unitOfWorkManage.RollbackTran();
-                // 杩斿洖澶辫触缁撴灉
-                return content.Error("浠诲姟鎴栧簱瀛樻洿鏂板け璐�");
-            }
+            return content.OK("浠诲姟瀹屾垚鎴愬姛");
         }
         catch (Exception err)
         {
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, $"绯荤粺寮傚父锛屽紓甯镐俊鎭細{err.Message}", "");
-            Console.WriteLine(err.Message);
+            LogFactory.GetLog("浠诲姟瀹屾垚").Error(true, $"绯荤粺寮傚父锛屽紓甯镐俊鎭細{err.Message}");
             return content.Error(err.Message);
         }
     }
 
-    #endregion 鍫嗗灈鏈哄嚭搴撲换鍔″畬鎴�
+    private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto info)
+    {
+        // TODO Value鍊兼牴鎹甅OM涓嬪彂鐨勯潤缃椂闂村埌褰撳墠鏃堕棿鐨勫垎閽熸暟
+        return new AgingOutputDto
+        {
+            OpFlag = 1,
+            Software = "WMS",
+            EquipmentCode = "ECH001-B",
+            TrayBarcode = stock.PalletCode,
+            SerialNos = stock.StockInfoDetails.Select(x => new SerialNoOutDto
+            {
+                SlotNo = x.OrderNo.ToInt32(),
+                SerialNo = x.SerialNumber,
+                SerialNoResult = true,
+                ParameterInfo = info.ParameterInfo.Select(y => new ParameterInfo()
+                {
+                    LowerLomit = y.LowerControlLimit,
+                    UpperLimit = y.UpperControlLimit,
+                    ParameterResult = y.EquipmentAvailabilityFlag,
+                    ParameterCode = y.ParameterCode,
+                    ParameterDesc = y.Description,
+                    TargetValue = y.TargetValue,
+                    Value = ( DateTime.Parse(stock.LinedProcessFeedbackTime, null, System.Globalization.DateTimeStyles.RoundtripKind).ToLocalTime() - stock.CreateDate).TotalMinutes.ToString(),
+                    DefectCode = y.UOMCode
+                }).ToList()
+            }).ToList()
+        };
+    }
+
+    private void ValidateResponse(WebResponseContent content)
+    {
+        var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
+        if (!result.Success)
+        {
+            throw new Exception(result.MOMMessage);
+        }
+    }
+
+    private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(DtStockInfo stock, Dt_Task task)
+    {
+        var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+        var details = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
+
+        location.LocationStatus = (int)LocationEnum.Free;
+        task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+        //task.CurrentAddress = task.NextAddress;
+        //task.NextAddress = task.TargetAddress;
+
+        LogFactory.GetLog("浠诲姟瀹屾垚").Info(true, "鏇存柊搴撳瓨鐘舵�佷笌浠诲姟鐘舵��");
+        return (location, task);
+    }
+
+    private async Task DeleteStockInfoAsync(int stockId)
+    {
+        var isStockUpdated = await _stockInfoRepository.DeleteDataByIdAsync(stockId);
+        if (!isStockUpdated)
+        {
+            throw new Exception("搴撳瓨淇℃伅鏇存柊澶辫触");
+        }
+    }
+
+    private async Task UpdateLocationAsync(DtLocationInfo info)
+    {
+        var isStockUpdated = await _locationRepository.UpdateDataAsync(info);
+        if (!isStockUpdated)
+        {
+            throw new Exception("搴撳瓨淇℃伅鏇存柊澶辫触");
+        }
+    }
+
+    private async Task DeleteStockInfoDetailsAsync(IEnumerable<DtStockInfoDetail> details)
+    {
+        var ids = details.Select(x => (object)x.Id).ToArray();
+        var isStockDetailUpdated = await _stockInfoDetailRepository.DeleteDataByIdsAsync(ids);
+        if (!isStockDetailUpdated)
+        {
+            throw new Exception("搴撳瓨璇︽儏淇℃伅鏇存柊澶辫触");
+        }
+    }
+
+    private async Task DeleteTaskAsync(int taskId)
+    {
+        var isTaskUpdated = await BaseDal.DeleteDataByIdAsync(taskId);
+        if (!isTaskUpdated)
+        {
+            throw new Exception("浠诲姟淇℃伅鏇存柊澶辫触");
+        }
+    }
+
+    #endregion 鍑哄簱浠诲姟瀹屾垚
 
     #region 绉诲簱浠诲姟瀹屾垚
 
@@ -169,51 +249,110 @@
     #region 鍏ュ簱浠诲姟瀹屾垚
 
     /// <summary>
-    /// 鍏ュ簱浠诲姟瀹屾垚
+    /// 瀹屾垚鍏ュ簱浠诲姟
     /// </summary>
     /// <param name="task">浠诲姟鏁版嵁鍚堥泦</param>
     /// <returns>杩斿洖缁撴灉闆�</returns>
     public async Task<WebResponseContent> CompleteInboundTaskAsync(Dt_Task task)
     {
+        // 鍒濆鍖栧搷搴斿唴瀹�
         WebResponseContent content = new WebResponseContent();
         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;
-
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟瀹屾垚", $"璐т綅鍦板潃锛歿task.TargetAddress},淇敼鍚庤揣浣嶆暟鎹細{locationInf}");
+            // 鏍规嵁鏄惁鏈夌粍鐩樹俊鎭垱寤哄簱瀛樺疄渚嬫ā鍨�
+            DtStockInfo stock = boxing == null ? CreateEmptyPalletStock(task, locationInf) : CreateFullPalletStock(task, locationInf, boxing);
 
             // 鎵ц鏁版嵁搴撲簨鍔�
             bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId);
             if (isResult)
+            {
                 content.OK("鍏ュ簱浠诲姟瀹屾垚鎴愬姛");
+            }
             else
+            {
                 content.Error("鍏ュ簱浠诲姟瀹屾垚澶辫触");
+            }
         }
         catch (Exception err)
         {
+            // 璁板綍寮傚父淇℃伅鍒版帶鍒跺彴鍜屾棩蹇�
             Console.WriteLine(err.Message.ToString());
+            LogFactory.GetLog("浠诲姟瀹屾垚").Error(true, err);
         }
         return content;
+    }
+
+    /// <summary>
+    /// 鍒涘缓绌烘墭鐩樼殑搴撳瓨瀹炰緥妯″瀷
+    /// </summary>
+    private DtStockInfo CreateEmptyPalletStock(Dt_Task task, DtLocationInfo locationInf)
+    {
+        return new DtStockInfo()
+        {
+            PalletCode = task.PalletCode,
+            LocationCode = task.TargetAddress,
+            CreateDate = DateTime.Now,
+            Creater = "system",
+            IsFull = false,
+            AreaCode = task.Roadway,
+            StockInfoDetails = new List<DtStockInfoDetail>()
+            {
+                new DtStockInfoDetail()
+                {
+                    MaterielCode = "绌烘墭鐩�",
+                    Id = 0,
+                }
+            }
+        };
+    }
+
+    /// <summary>
+    /// 鍒涘缓瀹炵洏鐨勫簱瀛樺疄渚嬫ā鍨嬪苟璋冪敤MOM鍏ュ簱
+    /// </summary>
+    private DtStockInfo CreateFullPalletStock(Dt_Task task, DtLocationInfo locationInf, DtBoxingInfo boxing)
+    {
+        var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>();
+        var stock = new DtStockInfo()
+        {
+            PalletCode = task.PalletCode,
+            LocationCode = task.TargetAddress,
+            CreateDate = DateTime.Now,
+            Creater = "system",
+            IsFull = boxing.IsFull,
+            AreaCode = task.Roadway,
+            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,
+            EquipmentCode = "ECH001-B",
+            Software = "WMS"
+        };
+        var result = _agingInOrOutInputService.GetOCVInputAsync(agingInputDto).Result;
+        var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString());
+        stock.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime;
+        stock.SpecialParameterDuration = respone.SpecialParameterDuration;
+
+        // 璁板綍鏃ュ織
+        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟瀹屾垚", $"璐т綅鍦板潃锛歿task.TargetAddress},淇敼鍚庤揣浣嶆暟鎹細{locationInf}");
+
+        return stock;
     }
 
     #endregion 鍏ュ簱浠诲姟瀹屾垚
@@ -221,13 +360,15 @@
     #region 浠诲姟瀹屾垚
 
     /// <summary>
-    /// 浠诲姟瀹屾垚
+    /// 瀹屾垚浠诲姟
     /// </summary>
-    /// <param name="taskNum">浠诲姟鍙�</param>
-    /// <returns></returns>
+    /// <param name="taskNum">浠诲姟缂栧彿</param>
+    /// <returns>杩斿洖缁撴灉闆�</returns>
     public async Task<WebResponseContent> CompleteAsync(int taskNum)
     {
+        // 鍒濆鍖栧搷搴斿唴瀹�
         WebResponseContent content = new WebResponseContent();
+
         // 鎻愬彇浠诲姟鏁版嵁
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鎻愬彇浠诲姟鏁版嵁", $"浠诲姟鍙凤細{taskNum}");
 
@@ -240,55 +381,32 @@
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
 
         // 楠岃瘉搴撳瓨鏄惁瀛樺湪
-        var stock = await _stockInfoRepository.QueryFirstAsync(x => x.PalletCode == task.PalletCode);
-        if (stock == null)
+        var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
+
+        // 鏍规嵁浠诲姟绫诲瀷璋冪敤鐩稿簲鐨勫畬鎴愪换鍔℃柟娉�
+        switch (task.TaskType)
         {
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "搴撳瓨涓嶅瓨鍦ㄥ瓨鍦紝鍒ゆ柇鏄惁鏄叆搴撲换鍔�", $"{task.TaskType}");
-            if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
-            {
+            case (int)TaskInboundTypeEnum.Inbound:
+            case (int)TaskInboundTypeEnum.InTray:
                 LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍏ュ簱浠诲姟", "");
                 return await CompleteInboundTaskAsync(task);
-            }
-            else
-            {
-                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "搴撳瓨涓嶅瓨鍦ㄤ篃涓嶆槸鍏ュ簱浠诲姟", "");
-                return content.Error("搴撳瓨涓嶅瓨鍦�");
-            }
-        }
-        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉搴撳瓨鏄惁瀛樺湪", JsonConvert.SerializeObject(stock));
 
-        if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
-        {
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
-            if (task.TaskState == TaskOutStatusEnum.SC_OutExecuting.ObjToInt())
-            {
-                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", "");
+            case (int)TaskOutboundTypeEnum.OutTray:
+            case (int)TaskOutboundTypeEnum.Outbound:
+                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍑哄簱浠诲姟", "");
                 return await CompleteStackTaskAsync(task, stock);
-            }
-            else
-            {
-                LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "搴撳瓨涓嶅瓨鍦ㄤ篃涓嶆槸鍏ュ簱浠诲姟", "");
-                return content.Error("搴撳瓨涓嶅瓨鍦�");
-            }
-        }
-        else if (task.TaskType == (int)TaskTypeEnum.RelocationIn)
-        {
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "绉诲簱浠诲姟瀹屾垚", "");
-            return await CompleteTransferTaskAsync(task, stock);
-        }
-        else
-        {
-            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, $"浠诲姟鐘舵�佸紓甯�", "鏃犲弬鏁�");
-            return content.Error("浠诲姟鐘舵�佸紓甯�");
+
+            default:
+                return content.Error("浠诲姟绫诲瀷涓嶅瓨鍦�");
         }
     }
 
     #endregion 浠诲姟瀹屾垚
 
-    #region 璇锋眰浠诲姟
+    #region 璇锋眰浠诲姟鍏ュ簱
 
     /// <summary>
-    /// 璇锋眰浠诲姟
+    /// 璇锋眰浠诲姟宸烽亾
     /// </summary>
     /// <param name="input">璇锋眰妯″瀷</param>
     /// <returns>鍖呭惈浠诲姟淇℃伅鐨勫搷搴斿唴瀹�</returns>
@@ -299,10 +417,34 @@
 
         try
         {
+            // 璋冪敤BaseDal.QueryFirstAsync鏂规硶锛屾煡璇换鍔�
+            var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            if (task != null)
+            {
+                //if (task.TaskState == (int)TaskInStatusEnum.InNew)
+                {
+                    // 鍒涘缓WMS浠诲姟
+                    WMSTaskDTO taskDTO = new WMSTaskDTO()
+                    {
+                        TaskNum = task.TaskNum.Value,
+                        Grade = 1,
+                        PalletCode = task.PalletCode,
+                        RoadWay = task.Roadway,
+                        SourceAddress = task.SourceAddress,
+                        TargetAddress = task.Roadway,
+                        TaskState = task.TaskState.Value,
+                        Id = 0,
+                        TaskType = task.TaskType,
+                    };
+                    return content.OK(data: taskDTO);
+                }
+            }
             // 鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪��
             TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
             {
-                TrayBarcode = input.PalletCode
+                Software = "WMS",
+                TrayBarcode = input.PalletCode,
+                EquipmentCode = "ECH001-B"
             };
 
             // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺�
@@ -310,18 +452,44 @@
             // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖content
             if (!content.Status) return content;
 
-            // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹虹敵璇�
-            ProcessApplyDto process = await GetProcessApplyAsync(content);
+            // 娣诲姞缁勭洏淇℃伅
+            // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄
+            var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+            if (result.SerialNos.Count <= 0)
+                return content.Error(result.MOMMessage);
+
+            // TODO 鑾峰彇鏈湴鏂欐灞炴�т笌鏁寸洏鐢佃姱灞炴�ц幏鍙栫殑鍊艰繘琛屽姣旓紝濡傛灉涓�鑷村垯缁х画锛屽惁鍒欒繑鍥為敊璇俊鎭�
+            var productions = await _productionRepository.QueryDataAsync(x => result.TrayBarcodePropertys.Select(x => x.TrayBarcodeProperty).ToList().Contains(x.TrayBarcodeProperty));
+            if (productions.Count <= 0)
+                return content.Error("鏂欐灞炴�т笉瀛樺湪");
+
+            // 璋冪敤CreateBoxingInfo鏂规硶锛屽垱寤虹粍鐩樹俊鎭�
+
+            var boxing = await CreateBoxingInfo(result, input.PalletCode);
+            if (boxing == null) return content.Error("缁勭洏澶辫触");
+
+            // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾�
+            ProcessApplyDto process = await GetProcessApplyAsync(result);
+
             // 濡傛灉process涓簄ull锛屽垯杩斿洖content
             if (process == null) return content;
 
-            // 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
-            var processResponse = await GetProcessResponseAsync(process, input.Position);
+            // 璋冪敤_processApplyService.GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹虹敵璇�
+            content = await _processApplyService.GetProcessApplyAsync(process);
 
-            // 璋冪敤BaseDal.QueryFirstAsync鏂规硶锛屾煡璇换鍔�
-            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);
+            // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖null
+            if (!content.Status) return content.Error("宸ヨ壓鐢宠澶辫触");
+
+            //// 璋冪敤GetProcessResponseAsync鏂规硶锛岃幏鍙栧伐鑹哄搷搴�
+            //var processResponse = await GetProcessResponseAsync(process, input.Position);
+
+            List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+            // 璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
+            content =  await CreateNewTask(input, strings);
+            if (content.Status)
+            {
+                var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
+            }
         }
         catch (Exception err)
         {
@@ -334,6 +502,70 @@
         return content;
     }
 
+    /// <summary>
+    /// 鏇存柊浠诲姟璐т綅
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<WebResponseContent> UpdateExistingTask(RequestTaskDto input)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            if (task == null)
+                return content.Error($"鏆傛湭鎵惧埌銆恵input.PalletCode}銆戠殑浠诲姟");
+
+            return content = await UpdateExistingTask(input, task);
+
+        }
+        catch (Exception err)
+        {
+
+            throw;
+        }
+    }
+
+    /// <summary>
+    /// 绌烘墭鐩樺叆搴撶敵璇�
+    /// </summary>
+    /// <param name="input"></param>
+    /// <returns></returns>
+    public async Task<WebResponseContent> RequestTrayInTaskAsync(RequestTaskDto input)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+
+            // 璋冪敤BaseDal.QueryFirstAsync鏂规硶锛屾煡璇换鍔�
+            var task = await BaseDal.QueryFirstAsync(x => x.PalletCode == input.PalletCode);
+            if (task != null && task.TaskState == (int)TaskInStatusEnum.InNew)
+            {
+                // 鍒涘缓WMS浠诲姟
+                WMSTaskDTO taskDTO = new WMSTaskDTO()
+                {
+                    TaskNum = task.TaskNum.Value,
+                    Grade = 1,
+                    PalletCode = task.PalletCode,
+                    RoadWay = task.Roadway,
+                    SourceAddress = task.SourceAddress,
+                    TargetAddress = task.Roadway,
+                    TaskState = task.TaskState.Value,
+                    Id = 0,
+                    TaskType = task.TaskType,
+                };
+                return content.OK(data: task);
+            }
+
+            return await CreateNewTask(input, null, 1);
+        }
+        catch (Exception)
+        {
+
+            throw;
+        }
+    }
+
     // 鑾峰彇鎵樼洏鍗曞厓鏍肩姸鎬�
     private async Task<WebResponseContent> GetTrayCellStatusAsync(TrayCellsStatusDto trayCells)
     {
@@ -341,19 +573,34 @@
         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
+            EquipmentCode = "ECH001-B",
+            Software = "WMS",
+            //WipOrderNo = result.BindCode,
+            SerialNos = content.SerialNos.Select(item => new SerialNos
             {
                 SerialNo = item.SerialNo
             }).ToList()
@@ -378,7 +625,13 @@
         {
             case "1088":
                 return SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
-                    .Where(x => x.EquipmentType == "闄堝寲" && x.WipOrderNo == apply.WipOrderNo && x.ProductDesc == apply.ProductNo)
+                    .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:
@@ -386,64 +639,208 @@
         }
     }
 
-    #endregion 璇锋眰浠诲姟
+    #endregion 璇锋眰浠诲姟鍏ュ簱
 
-    #region 璇锋眰绌烘墭鐩�
+    #region 璇锋眰鍑哄簱锛堝疄鐩�&绌虹洏锛�
 
-    public async Task<WebResponseContent> RequestTrayTaskAsync(string position)
+    /// <summary>
+    /// 璇锋眰鎵樼洏浠诲姟
+    /// </summary>
+    /// <param name="position">鐩爣浣嶇疆</param>
+    /// <param name="tag">鎵樼洏绫诲瀷锛�1锛氬疄鐩橈紝2锛氱┖鐩橈級</param>
+    /// <param name="areaCode">鍖哄煙缂栫爜</param>
+    /// <param name="roadways">宸烽亾缂栫爜闆嗗悎</param>
+    /// <returns>杩斿洖缁撴灉闆�</returns>
+    public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> roadways)
     {
         WebResponseContent content = new WebResponseContent();
         try
         {
-            var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == "CH");
+            // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
+            DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
+                ? QueryStockInfoForRealTray(areaCode, roadways)
+                : QueryStockInfoForEmptyTray(areaCode, roadways);
 
-            var stockInfo = _stockInfoRepository.QueryData(x => x.Remark == area.AreaCode && x.StockInfoDetails.Any(z => z.MaterielCode == "绌烘墭鐩�")).OrderBy(x => x.CreateDate).FirstOrDefault();
-            // 鍒涘缓鏂颁换鍔″疄渚�
-            var task = new Dt_Task
+            if (stockInfo == null)
             {
-                CurrentAddress = stockInfo.LocationCode,
-                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"
-            };
+                return content.Error("搴撳瓨淇℃伅涓嶅瓨鍦�");
+            }
 
+            // 鍒涘缓鏂颁换鍔″疄渚�
+            var task = CreateTask(stockInfo, position, tag);
             var taskId = await BaseDal.AddDataAsync(task);
             bool isResult = taskId > 0;
-            if (isResult)
+            if (!isResult)
             {
-                WMSTaskDTO taskDTO = new WMSTaskDTO()
+                return content.Error("浠诲姟鍒涘缓澶辫触");
+            }
+
+            // 鍒涘缓浠诲姟DTO
+            WMSTaskDTO taskDTO = CreateTaskDTO(task);
+            //if (tag == 1)
+            {
+                // 鏇存柊搴撳瓨浣嶇疆鐘舵�佷负涓嶅彲鐢�
+                stockInfo.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable;
+                await _locationRepository.UpdateDataAsync(stockInfo.LocationInfo);
+            }
+
+            // 杩斿洖鎴愬姛鍝嶅簲
+            return content.OK(data: taskDTO);
+        }
+        catch (Exception ex)
+        {
+            // 璁板綍寮傚父淇℃伅骞舵姏鍑�
+            LogFactory.GetLog("璇锋眰鎵樼洏浠诲姟").Error(true, ex);
+            return content.Error(ex.Message);
+        }
+    }
+
+    /// <summary>
+    /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
+    /// </summary>
+    private DtStockInfo QueryStockInfoForRealTray(string areaCode, List<string> roadways)
+    {
+        // TODO鏃堕棿鏍规嵁MOM绯荤粺閰嶇疆鐨勫嚭搴撴椂闂存潵鑾峰彇,鏆傛椂涓嶇煡閬揗OM杩斿洖鐨勬椂闂存槸浠�涔堟墍浠ヨ繖閲屾祴璇曟椂鍊欏湪鏀�
+        return _stockInfoRepository.Db.Queryable<DtStockInfo>().Where(x => x.AreaCode == areaCode && Convert.ToDateTime(x.LinedProcessFeedbackTime) < DateTime.Now && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo))
+                                   .Includes(x => x.LocationInfo)
+                                   .Includes(x => x.StockInfoDetails)
+                                   .OrderBy(x => x.CreateDate)
+                                   .First();
+    }
+
+    /// <summary>
+    /// 鏌ヨ绌虹洏搴撳瓨淇℃伅
+    /// </summary>
+    private DtStockInfo QueryStockInfoForEmptyTray(string areaCode, List<string> roadways)
+    {
+        return _stockInfoRepository.Db.Queryable<DtStockInfo>().Where(x => x.AreaCode == areaCode && x.StockInfoDetails.Any(z => z.MaterielCode == "绌烘墭鐩�") && roadways.Contains(x.LocationInfo.RoadwayNo))
+                                   .Includes(x => x.LocationInfo)
+                                   .Includes(x => x.StockInfoDetails)
+                                   .OrderBy(x => x.CreateDate)
+                                   .First();
+    }
+
+    /// <summary>
+    /// 鍒涘缓浠诲姟瀹炰緥
+    /// </summary>
+    private Dt_Task CreateTask(DtStockInfo stockInfo, string position, int tag)
+    {
+        return 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,
+            CurrentAddress = stockInfo.LocationCode,
+            TaskState = (int)TaskOutStatusEnum.OutNew,
+            TaskType = tag == (int)TaskOutboundTypeEnum.Outbound ? (int)TaskOutboundTypeEnum.Outbound : (int)TaskOutboundTypeEnum.OutTray,
+            TaskNum = BaseDal.GetTaskNo().Result,
+            Creater = "System" // 淇鎷煎啓閿欒
+        };
+    }
+
+    /// <summary>
+    /// 鍒涘缓浠诲姟DTO
+    /// </summary>
+    private WMSTaskDTO CreateTaskDTO(Dt_Task task)
+    {
+        return new WMSTaskDTO
+        {
+            TaskNum = task.TaskNum.Value,
+            Grade = 1,
+            PalletCode = task.PalletCode,
+            RoadWay = task.Roadway,
+            SourceAddress = task.SourceAddress,
+            TargetAddress = task.TargetAddress,
+            TaskState = task.TaskState.Value,
+            Id = 0,
+            TaskType = task.TaskType,
+        };
+    }
+
+    #endregion 璇锋眰鍑哄簱
+
+    #region 浠诲姟鐘舵�佹洿鏀�
+
+    /// <summary>
+    /// 鏇存柊浠诲姟鐘舵��&鍑哄簱瑙g洏
+    /// </summary>
+    /// <param name="taskNum"></param>
+    /// <param name="taskState"></param>
+    /// <returns></returns>
+    public async Task<WebResponseContent> UpdateTaskStatus(int taskNum, int taskState)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            var task = await BaseDal.QueryFirstAsync(x => x.TaskNum == taskNum);
+            if (task == null)
+                return content.Error("鏈壘鍒颁换鍔�");
+
+            if (taskState == (int)TaskOutStatusEnum.Line_OutFinish)
+            {
+                var taskHty = CreateHistoricalTask(task);
+                await _unitOfWorkManage.UseTranAsync(async () =>
                 {
-                    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
-                };
-                content.OK(data: taskDTO);
+                    var asb = await BaseDal.DeleteDataByIdAsync(task.TaskId);
+                    var asbHty = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
+                    if (asb && asbHty)
+                        content.OK();
+                    else
+                        throw new Exception();
+                });
+                content.OK();
+            }
+            else
+            {
+                task.TaskState = taskState;
+                var asb = await BaseDal.UpdateDataAsync(task);
+                if (asb)
+                    content.OK();
+                else
+                    content.Error();
             }
         }
         catch (Exception ex)
         {
-            throw;
+            content.Error(ex.Message);
         }
         return content;
     }
 
-    #endregion 璇锋眰绌烘墭鐩�
+    #endregion
+
+    #region 鍑哄簱瑙g洏
+
+    /// <summary>
+    /// 鍑哄簱瑙g洏鎺ュ彛
+    /// </summary>
+    /// <param name="taskNum"></param>
+    /// <returns></returns>
+    public async Task<WebResponseContent> OutUnblockInterface(int taskNum)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            var task = await BaseDal.QueryFirstAsync(x => x.TaskNum == taskNum);
+            if (task == null)
+                return content.Error("鏈壘鍒颁换鍔�");
+            task.TaskState = (int)TaskOutStatusEnum.Line_OutFinish;
+            var taskHty = CreateHistoricalTask(task);
+        }
+        catch (Exception ex)
+        {
+            content.Error(ex.Message);
+        }
+        return content;
+    }
+
+    #endregion
 
     #endregion 澶栭儴鎺ュ彛鏂规硶
 
@@ -693,6 +1090,8 @@
                 isUpdateStock = await _stockInfoRepository.AddDataNavAsync(stock);
             }
 
+
+
             // 娣诲姞鍘嗗彶浠诲姟
             var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
 
@@ -745,15 +1144,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 +1152,8 @@
 
         // 鏇存柊璐т綅淇℃伅
         location.LocationStatus = (int)LocationEnum.Lock;
-        //}
 
         // 鏇存柊浠诲姟淇℃伅
-        //task.SourceAddress = input.Position;
         task.CurrentAddress = input.Position;
         task.TargetAddress = toAddress;
         task.NextAddress = toAddress;
@@ -818,12 +1206,12 @@
     /// <param name="areaId">鍖哄煙ID</param>
     /// <param name="content">鍝嶅簲鍐呭</param>
     /// <returns></returns>
-    private async Task<WebResponseContent> CreateNewTask(List<Dt_EquipmentProcess> process, RequestTaskDto input)
+    private async Task<WebResponseContent> CreateNewTask(RequestTaskDto input, List<string> process = null, int flag = 0)
     {
         WebResponseContent content = new WebResponseContent();
-        List<string> strings = process.Select(x => x.EquipmentName).ToList();
+
         // 鑾峰彇鐩爣鍦板潃
-        string ToAddress = await GetRoadWayAsync(strings);
+        string ToAddress = await GetRoadWayAsync(process);
 
         // 鍒涘缓鏂颁换鍔″疄渚�
         var task = new Dt_Task
@@ -839,10 +1227,11 @@
             PalletCode = input.PalletCode,
             SourceAddress = input.Position,
             TaskState = (int)TaskInStatusEnum.InNew,
-            TaskType = (int)TaskTypeEnum.Inbound,
+            TaskType = flag == 0 ? (int)TaskInboundTypeEnum.Inbound : (int)TaskInboundTypeEnum.InTray,
             TaskNum = await BaseDal.GetTaskNo(),
             Creater = "Systeam"
         };
+
         // 灏濊瘯娣诲姞鏂颁换鍔�
         var taskId = await BaseDal.AddDataAsync(task);
         bool isResult = taskId > 0;
@@ -852,17 +1241,18 @@
             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,
+                    TaskNum = task.TaskNum.Value,
                     Grade = 1,
-                    PalletCode = DateTime.Now.ToString("MMddHHmmss"),
+                    PalletCode = task.PalletCode,
                     RoadWay = task.Roadway,
-                    SourceAddress = input.Position,
+                    SourceAddress = task.SourceAddress,
                     TargetAddress = task.Roadway,
-                    TaskState = (int)TaskInStatusEnum.InNew,
+                    TaskState = task.TaskState.Value,
                     Id = 0,
-                    TaskType = (int)TaskInboundTypeEnum.Inbound,
+                    TaskType = task.TaskType,
                 };
                 content.OK(data: taskDTO);
             }
@@ -915,6 +1305,22 @@
     {
         var minGroup = _locationRepository.QueryData(x => process.Contains(x.RoadwayNo) && x.LocationStatus == (int)LocationEnum.Free)
             .GroupBy(x => x.RoadwayNo)
+             .OrderByDescending(g => g.Count()) // 鏍规嵁姣忎釜缁勭殑鍏冪礌鏁伴噺鎺掑簭
+             .First(); // 鍙栧嚭鏁伴噺鏈�澶氱殑缁�
+
+        string minRoadwayNo = minGroup.Key; // 鏁伴噺鏈�澶氱殑缁勭殑Key
+
+        return minRoadwayNo;
+    }
+
+    /// <summary>
+    /// 鑾峰彇宸烽亾鎴栫珯鍙�
+    /// </summary>
+    /// <returns></returns>
+    public async Task<string> GetRoadWayAsync(int areaCode)
+    {
+        var minGroup = _locationRepository.QueryData(x => x.AreaId == areaCode && x.LocationStatus == (int)LocationEnum.Free)
+            .GroupBy(x => x.RoadwayNo)
              .OrderBy(g => g.Count()) // 鏍规嵁姣忎釜缁勭殑鍏冪礌鏁伴噺鎺掑簭
              .First(); // 鍙栧嚭鏁伴噺鏈�灏戠殑缁�
 
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/ProductionController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/ProductionController.cs
new file mode 100644
index 0000000..b6fb594
--- /dev/null
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/ProductionController.cs
@@ -0,0 +1,17 @@
+锘�
+namespace WIDESEA_WMSServer.Controllers
+{
+    [Route("api/[controller]")]
+    [ApiController]
+    public class ProductionController : ApiBaseController<IProductionService, ProductionModel>
+    {
+        public ProductionController(IProductionService service) : base(service)
+        {
+        }
+
+        public override ActionResult AddData([FromBody] ProductionModel options)
+        {
+            return base.AddData(options);
+        }
+    }
+}
\ No newline at end of file
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);
     }
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
index e8ceb08..c804cb4 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
@@ -1,4 +1,5 @@
 锘縰sing WIDESEA_DTO;
+using static WIDESEA_DTO.RequestTaskDto;
 
 namespace WIDESEA_WMSServer.Controllers;
 
@@ -45,7 +46,7 @@
     }
 
     /// <summary>
-    /// 浠诲姟璇锋眰
+    /// 璇锋眰浠诲姟宸烽亾
     /// </summary>
     /// <param name="input">璇锋眰鏁版嵁</param>
     /// <returns></returns>
@@ -56,13 +57,47 @@
     }
 
     /// <summary>
-    /// 绌烘墭鐩樿姹�
+    /// 璇锋眰浠诲姟璐т綅
     /// </summary>
     /// <param name="input">璇锋眰鏁版嵁</param>
     /// <returns></returns>
-    [HttpPost, AllowAnonymous, Route("RequestTrayTaskAsync")]
-    public async Task<WebResponseContent> RequestTrayTaskAsync([FromBody] string position)
+    [HttpPost, AllowAnonymous, Route("RequestLocationTaskAsync")]
+    public async Task<WebResponseContent> UpdateExistingTask([FromBody] RequestTaskDto input)
     {
-        return await Service.RequestTrayTaskAsync(position);
+        return await Service.UpdateExistingTask(input);
     }
+
+    /// <summary>
+    /// 绌烘墭鐩樺叆搴撹姹�
+    /// </summary>
+    /// <param name="input">璇锋眰鏁版嵁</param>
+    /// <returns></returns>
+    [HttpPost, AllowAnonymous, Route("RequestTrayInTaskAsync")]
+    public async Task<WebResponseContent> RequestTrayInTaskAsync([FromBody] RequestTaskDto input)
+    {
+        return await Service.RequestTrayInTaskAsync(input);
+    }
+
+    /// <summary>
+    /// 绌烘墭鐩�&婊$洏鍑哄簱璇锋眰
+    /// </summary>
+    /// <param name="input">璇锋眰鏁版嵁</param>
+    /// <returns></returns>
+    [HttpPost, AllowAnonymous, Route("RequestTrayOutTaskAsync")]
+    public async Task<WebResponseContent> RequestTrayOutTaskAsync([FromBody] RequestOutTaskDto request)
+    {
+        return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.Roadways);
+    }
+
+    /// <summary>
+    /// 浠诲姟鐘舵�佷慨鏀�
+    /// </summary>
+    /// <param name="input">璇锋眰鏁版嵁</param>
+    /// <returns></returns>
+    [HttpPost, AllowAnonymous, Route("UpdateTaskStatus")]
+    public async Task<WebResponseContent> UpdateTaskStatus([FromBody] UpdateStatusDto input)
+    {
+        return await Service.UpdateTaskStatus(input.TaskNum, input.TaskState);
+    }
+
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/GlobalUsing.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/GlobalUsing.cs
index aa2f49c..16392e6 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/GlobalUsing.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/GlobalUsing.cs
@@ -12,4 +12,5 @@
 global using WIDESEA_Model.Models.System;
 global using WIDESEA_Core.Authorization;
 global using WIDESEA_Core.Utilities;
-global using WIDESEA_Model;
\ No newline at end of file
+global using WIDESEA_Model;
+global using WIDESEA_StorageBasicServices;
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj.user b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj.user
index 8814900..c3bce0e 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj.user
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj.user
@@ -1,8 +1,8 @@
 锘�<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
-    <Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
+    <Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
+    <Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
     <NameOfLastUsedPublishProfile>D:\Git\BaiBuLiKu\Code Management\WMS\WIDESEA_WMSServer\WIDESEA_WMSServer\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
   </PropertyGroup>
 </Project>
\ No newline at end of file

--
Gitblit v1.9.3