From ca426532f1d63f12aaee002a014a4355341ffa9c Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期二, 10 十二月 2024 21:01:46 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/HuaYiZhongHeng/BaiBuLiKu

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs  |    6 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs      |   10 ++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs         |   11 +-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task_Hty.cs            |  152 ++++++++++++++++++++++++++++++++++++++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs        |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs            |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs                        |    2 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs |    2 
 8 files changed, 175 insertions(+), 12 deletions(-)

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
index 7055892..a4ebcc0 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/ProcessParameters/Platform.cs
@@ -90,5 +90,15 @@
         [ExporterHeader(DisplayName = "绔欏彴鐘舵��")]
         [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "绔欏彴鐘舵��")]
         public string Status { get; set; } = "Active";
+
+
+        /// <summary>
+        /// 鐢熶骇浜х嚎
+        /// </summary>
+        [ImporterHeader(Name = "鐢熶骇浜х嚎")]
+        [ExporterHeader(DisplayName = "鐢熶骇浜х嚎")]
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鐢熶骇浜х嚎")]
+        public string ProductionLine { get; set; }
+        
     }
 }
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task_Hty.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task_Hty.cs
new file mode 100644
index 0000000..0335b82
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task_Hty.cs
@@ -0,0 +1,152 @@
+锘�#region << 鐗� 鏈� 娉� 閲� >>
+/*----------------------------------------------------------------
+ * 鍛藉悕绌洪棿锛歐IDESEAWCS_Model.Models.TaskInfo
+ * 鍒涘缓鑰咃細鑳$搴�
+ * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
+ * 鐗堟湰锛歏1.0.0
+ * 鎻忚堪锛�
+ *
+ * ----------------------------------------------------------------
+ * 淇敼浜猴細
+ * 淇敼鏃堕棿锛�
+ * 鐗堟湰锛歏1.0.1
+ * 淇敼璇存槑锛�
+ * 
+ *----------------------------------------------------------------*/
+#endregion << 鐗� 鏈� 娉� 閲� >>
+
+using 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(nameof(Dt_Task_Hty), "浠诲姟鍘嗗彶淇℃伅")]
+    public class Dt_Task_Hty : BaseEntity
+    {
+        /// <summary>
+        /// 涓婚敭
+        /// </summary>
+        [ImporterHeader(Name = "涓婚敭")]
+        [ExporterHeader(DisplayName = "涓婚敭")]
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+        public int TaskId { get; set; }
+
+        /// <summary>
+        /// 浠诲姟鍙�
+        /// </summary>
+        [ImporterHeader(Name = "浠诲姟鍙�")]
+        [ExporterHeader(DisplayName = "浠诲姟鍙�")]
+        [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟鍙�")]
+        public int TaskNum { get; set; }
+
+        /// <summary>
+        /// 鎵樼洏缂栧彿
+        /// </summary>
+        [ImporterHeader(Name = "鎵樼洏缂栧彿")]
+        [ExporterHeader(DisplayName = "鎵樼洏缂栧彿")]
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎵樼洏缂栧彿")]
+        public string PalletCode { get; set; }
+
+        /// <summary>
+        /// 宸烽亾鍙�
+        /// </summary>
+        [ImporterHeader(Name = "宸烽亾鍙�")]
+        [ExporterHeader(DisplayName = "宸烽亾鍙�")]
+        [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "宸烽亾鍙�")]
+        public string Roadway { get; set; }
+
+        /// <summary>
+        /// 浠诲姟绫诲瀷
+        /// </summary>
+        [ImporterHeader(Name = "浠诲姟绫诲瀷")]
+        [ExporterHeader(DisplayName = "浠诲姟绫诲瀷")]
+        [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟绫诲瀷")]
+        public int TaskType { get; set; }
+
+        /// <summary>
+        /// 浠诲姟鐘舵��
+        /// </summary>
+        [ImporterHeader(Name = "浠诲姟鐘舵��")]
+        [ExporterHeader(DisplayName = "浠诲姟鐘舵��")]
+        [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟鐘舵��")]
+        public int TaskState { get; set; }
+
+        /// <summary>
+        /// 璧峰鍦板潃
+        /// </summary>
+        [ImporterHeader(Name = "璧峰鍦板潃")]
+        [ExporterHeader(DisplayName = "璧峰鍦板潃")]
+        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "璧峰鍦板潃")]
+        public string SourceAddress { get; set; }
+
+        /// <summary>
+        /// 鐩爣鍦板潃
+        /// </summary>
+        [ImporterHeader(Name = "鐩爣鍦板潃")]
+        [ExporterHeader(DisplayName = "鐩爣鍦板潃")]
+        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "鐩爣鍦板潃")]
+        public string TargetAddress { get; set; }
+
+        /// <summary>
+        /// 褰撳墠浣嶇疆
+        /// </summary>
+        [ImporterHeader(Name = "褰撳墠浣嶇疆")]
+        [ExporterHeader(DisplayName = "褰撳墠浣嶇疆")]
+        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "褰撳墠浣嶇疆")]
+        public string CurrentAddress { get; set; }
+
+        /// <summary>
+        /// 涓嬩竴鍦板潃
+        /// </summary>
+        [ImporterHeader(Name = "涓嬩竴鍦板潃")]
+        [ExporterHeader(DisplayName = "涓嬩竴鍦板潃")]
+        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "涓嬩竴鍦板潃")]
+        public string NextAddress { get; set; }
+
+        /// <summary>
+        /// 寮傚父淇℃伅
+        /// </summary>
+        [ImporterHeader(Name = "寮傚父淇℃伅")]
+        [ExporterHeader(DisplayName = "寮傚父淇℃伅")]
+        [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "寮傚父淇℃伅")]
+        public string? ExceptionMessage { get; set; }
+
+        /// <summary>
+        /// 浼樺厛绾�
+        /// </summary>
+        [ImporterHeader(Name = "浼樺厛绾�")]
+        [ExporterHeader(DisplayName = "浼樺厛绾�")]
+        [SugarColumn(IsNullable = false, ColumnDescription = "浼樺厛绾�")]
+        public int Grade { get; set; }
+
+        /// <summary>
+        /// WMS浠诲姟涓婚敭
+        /// </summary>
+        [ImporterHeader(Name = "WMS浠诲姟涓婚敭")]
+        [ExporterHeader(DisplayName = "WMS浠诲姟涓婚敭")]
+        [SugarColumn(IsNullable = false, ColumnDescription = "WMS浠诲姟涓婚敭")]
+        public int WMSId { get; set; }
+
+        /// <summary>
+        /// 浠诲姟涓嬪彂鏃堕棿
+        /// </summary>
+        [ImporterHeader(Name = "浠诲姟涓嬪彂鏃堕棿")]
+        [ExporterHeader(DisplayName = "浠诲姟涓嬪彂鏃堕棿")]
+        [SugarColumn(IsNullable = true, ColumnDescription = "浠诲姟涓嬪彂鏃堕棿")]
+        public DateTime? Dispatchertime { get; set; }
+
+        /// <summary>
+        /// 澶囨敞
+        /// </summary>
+        [ImporterHeader(Name = "澶囨敞")]
+        [ExporterHeader(DisplayName = "澶囨敞")]
+        [SugarColumn(IsNullable = true, Length = 255, ColumnDescription = "澶囨敞")]
+        public string Remark { get; set; }
+    }
+}
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 3d35a4a..ade5a33 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -417,7 +417,7 @@
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                 else
                     taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
-                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker);
+                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
             }
             catch (Exception)
             {
@@ -427,7 +427,7 @@
         /// <summary>
         /// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
         /// </summary>
-        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null)
+        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
         {
             var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
             if (tasks.Count < index)
@@ -448,7 +448,7 @@
                 var wmsIpAddress = wmsBase + requestTrayOutTask;
 
 
-                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString());
+                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString());
                 //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
 
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
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 49ce3ee..9b90299 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/RequestTaskDto.cs
@@ -34,5 +34,5 @@
     public string Position { get; set; }
     public int Tag { get; set; }
     public string AreaCdoe { get; set; }
-    public List<string> Roadways { get; set; }
+    public string ProductionLine { get; set; }
 }
\ 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 2b4bd9a..ade833c 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
@@ -165,7 +165,7 @@
     /// <param name="areaCode">鍖哄煙缂栫爜</param>
     /// <param name="roadways">宸烽亾鍒楄〃</param>
     /// <returns>杩斿洖缁撴灉闆�</returns>
-    Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> roadways);
+    Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, string productionLine);
 
 
     /// <summary>
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 35417c1..49943b4 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
@@ -980,15 +980,15 @@
     /// <param name="areaCode">鍖哄煙缂栫爜</param>
     /// <param name="roadways">宸烽亾缂栫爜闆嗗悎</param>
     /// <returns>杩斿洖缁撴灉闆�</returns>
-    public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, List<string> roadways)
+    public async Task<WebResponseContent> RequestTrayOutTaskAsync(string position, int tag, string areaCode, string productionLine)
     {
         WebResponseContent content = new WebResponseContent();
         try
         {
             // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
             DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
-                ? QueryStockInfoForRealTrayAsync(areaCode, roadways).Result
-                : QueryStockInfoForEmptyTrayAsync(areaCode, roadways).Result;
+                ? QueryStockInfoForRealTrayAsync(areaCode, productionLine).Result
+                : QueryStockInfoForEmptyTrayAsync(areaCode).Result;
 
             if (stockInfo == null)
             {
@@ -1035,7 +1035,7 @@
     /// <summary>
     /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
     /// </summary>
-    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> roadways)
+    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine)
     {
         var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode);
 
@@ -1043,6 +1043,7 @@
             .Includes(x => x.LocationInfo) // 棰勫姞杞絃ocationInfo
             .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
             .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
+            .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
             .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
             .OrderBy(x => x.OutboundTime) // 鎺掑簭
             .FirstAsync(); // 鑾峰彇绗竴涓厓绱�
@@ -1056,7 +1057,7 @@
     /// <summary>
     /// 鏌ヨ绌虹洏搴撳瓨淇℃伅
     /// </summary>
-    private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, List<string> roadways)
+    private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode)
     {
         var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode);
 
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index b039dd0..ca3da85 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -1033,7 +1033,7 @@
 
                 var location = locations.OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault();
 
-                var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1", new List<string>());
+                var stockInfo = await QueryStockInfoForEmptyTrayAsync("CWSC1");
 
                 if (stockInfo != null)
                 {
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 1eaba1b..8aee765 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
@@ -108,7 +108,7 @@
     [HttpPost, AllowAnonymous, Route("RequestTrayOutTaskAsync")]
     public async Task<WebResponseContent> RequestTrayOutTaskAsync([FromBody] RequestOutTaskDto request)
     {
-        return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.Roadways);
+        return await Service.RequestTrayOutTaskAsync(request.Position, request.Tag, request.AreaCdoe, request.ProductionLine);
     }
 
     /// <summary>

--
Gitblit v1.9.3