From 7278264f027d62664a0209699d0f66a22fd06a8e Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 13 四月 2026 10:24:04 +0800
Subject: [PATCH] feat: 更新依赖版本并优化MES接口调用

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/WIDESEAWCS_Core.csproj                           |    3 
 Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs |   66 +++++++--------------
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/WIDESEAWCS_RedisService.csproj           |    4 
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs  |    3 +
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs               |   25 ++++----
 Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs       |   36 ++++--------
 6 files changed, 54 insertions(+), 83 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/WIDESEAWCS_Core.csproj b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/WIDESEAWCS_Core.csproj
index 9e54046..51e1b73 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/WIDESEAWCS_Core.csproj
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/WIDESEAWCS_Core.csproj
@@ -57,10 +57,11 @@
 		<PackageReference Include="Mapster.DependencyInjection" Version="1.0.1" />
 		<PackageReference Include="Magicodes.IE.EPPlus" Version="2.7.5.1" />
 		<PackageReference Include="Magicodes.IE.Excel" Version="2.7.5.1" />
+		<PackageReference Include="Masuit.Tools.Core" Version="2026.1.3" />
 		<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.29" />
 		<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
 		<PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.3.8" />
-		<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
+		<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
 		<PackageReference Include="OfficeOpenXml.Core.ExcelPackage" Version="1.0.0" />
 		<PackageReference Include="Serilog" Version="4.3.1" />
 		<PackageReference Include="Serilog.AspNetCore" Version="6.0.0" />
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/WIDESEAWCS_RedisService.csproj b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/WIDESEAWCS_RedisService.csproj
index e6d27f6..fd6f127 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/WIDESEAWCS_RedisService.csproj
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_RedisService/WIDESEAWCS_RedisService.csproj
@@ -8,8 +8,8 @@
 
 	<ItemGroup>
 		<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
-		<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
-		<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
+		<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
+		<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.5" />
 		<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="6.0.0" />
 		<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
 	</ItemGroup>
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index 0017804..e9c6ad5 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -167,6 +167,7 @@
                                 continue;
                             }
 
+                            #region 妫�娴嬫槸鍚﹂渶瑕佺┖鎵樼洏
 
                             // ========== 妫�鏌ョ壒瀹氫綅缃槸鍚︽湁鎵樼洏 ==========
                             // 浠庨厤缃腑璇诲彇闇�瑕佹鏌ユ墭鐩樼殑浣嶇疆鍒楄〃
@@ -206,6 +207,8 @@
                                 }
                             }
 
+                            #endregion
+
                             // ========== 妫�鏌� PLC_STB 鏍囧織 ==========
                             // 鍙湁褰� PLC_STB 涓� 1 鏃舵墠澶勭悊浠诲姟
                             if (command.PLC_STB != 1)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
index 0a1f053..b68c724 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/WCS/TaskService_Inbound.cs
@@ -4,6 +4,7 @@
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
+using WIDESEA_DTO.MES;
 using WIDESEA_DTO.Task;
 using WIDESEA_Model.Models;
 
@@ -150,18 +151,18 @@
                     if (!updateLocationResult || !updateStockResult)
                         return WebResponseContent.Instance.Error("浠诲姟瀹屾垚澶辫触");
                     // 璋冪敤MES鎵樼洏杩涚珯
-                    //var inboundRequest = new InboundInContainerRequest
-                    //{
-                    //    EquipmentCode = "STK-GROUP-001",
-                    //    ResourceCode = "STK-GROUP-001",
-                    //    LocalTime = DateTime.Now,
-                    //    ContainerCode = taskDto.PalletCode
-                    //};
-                    //var inboundResult = _mesService.InboundInContainer(inboundRequest);
-                    //if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
-                    //{
-                    //    return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
-                    //}
+                    var inboundRequest = new InboundInContainerRequest
+                    {
+                        EquipmentCode = "STK-GROUP-001",
+                        ResourceCode = "STK-GROUP-001",
+                        LocalTime = DateTime.Now,
+                        ContainerCode = taskDto.PalletCode
+                    };
+                    var inboundResult = _mesService.InboundInContainer(inboundRequest);
+                    if (inboundResult == null || inboundResult.Data == null || !inboundResult.Data.IsSuccess)
+                    {
+                        return content.Error($"浠诲姟瀹屾垚澶辫触锛歁ES杩涚珯澶辫触: {inboundResult?.Data?.Msg ?? inboundResult?.ErrorMessage ?? "鏈煡閿欒"}");
+                    }
                     return await CompleteTaskAsync(task, "鍏ュ簱瀹屾垚");
                 });
             }
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
index 1d4292c..1483686 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
@@ -82,28 +82,22 @@
                     return response.Error($"褰撳墠搴撳瓨鐘舵�佷笉鍏佽杩涚珯鎿嶄綔锛屽綋鍓嶇姸鎬侊細{stockInfo.StockStatus}");
                 }
 
-                // 4. 鑾峰彇绯荤粺閰嶇疆 - 鐩存帴浠庢暟鎹簱鏌ヨ
-                var configs = _sysDictionaryService.GetVueDictionary(new[] { "MES_EquipmentCode", "MES_ResourceCode" });
-
-                string equipmentCode = GetConfigValue(configs, "MES_EquipmentCode", "WCS_001");
-                string resourceCode = GetConfigValue(configs, "MES_ResourceCode", "RESOURCE_001");
-
-                // 5. 鏋勯�燤ES璇锋眰
+                // 4. 鏋勯�燤ES璇锋眰
                 var mesRequest = new InboundInContainerRequest
                 {
-                    EquipmentCode = equipmentCode,
-                    ResourceCode = resourceCode,
+                    EquipmentCode = "STK-GROUP-001",
+                    ResourceCode = "STK-GROUP-001",
                     LocalTime = DateTime.Now,
                     ContainerCode = dto.PalletCode
                 };
 
                 string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest);
 
-                // 6. 璋冪敤MES鎺ュ彛锛堝悓姝ユ柟娉曪級
+                // 5. 璋冪敤MES鎺ュ彛锛堝悓姝ユ柟娉曪級
                 var mesResult = _mesService.InboundInContainer(mesRequest);
                 stopwatch.Stop();
 
-                // 7. 璁板綍鏃ュ織
+                // 6. 璁板綍鏃ュ織
                 await _mesLogService.LogAsync(new MesApiLogDto
                 {
                     ApiType = "InboundInContainer",
@@ -115,7 +109,7 @@
                     Creator = App.User.UserName
                 });
 
-                // 8. 杩斿洖缁撴灉
+                // 7. 杩斿洖缁撴灉
                 if (mesResult.IsSuccess)
                 {
                     return response.OK("鎵樼洏杩涚珯鎴愬姛");
@@ -182,17 +176,11 @@
                     return response.Error($"褰撳墠搴撳瓨鐘舵�佷笉鍏佽鍑虹珯鎿嶄綔锛屽綋鍓嶇姸鎬侊細{stockInfo.StockStatus}");
                 }
 
-                // 4. 鑾峰彇绯荤粺閰嶇疆
-                var configs = _sysDictionaryService.GetVueDictionary(new[] { "MES_EquipmentCode", "MES_ResourceCode" });
-
-                string equipmentCode = GetConfigValue(configs, "MES_EquipmentCode", "WCS_001");
-                string resourceCode = GetConfigValue(configs, "MES_ResourceCode", "RESOURCE_001");
-
-                // 5. 鏋勯�燤ES璇锋眰
+                // 4. 鏋勯�燤ES璇锋眰
                 var mesRequest = new OutboundInContainerRequest
                 {
-                    EquipmentCode = equipmentCode,
-                    ResourceCode = resourceCode,
+                    EquipmentCode = "STK-GROUP-001",
+                    ResourceCode = "STK-GROUP-001",
                     LocalTime = DateTime.Now,
                     ContainerCode = dto.PalletCode,
                     ParamList = dto.ParamList?.Select(p => new ParamItem
@@ -205,11 +193,11 @@
 
                 string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest);
 
-                // 6. 璋冪敤MES鎺ュ彛锛堝悓姝ユ柟娉曪級
+                // 5. 璋冪敤MES鎺ュ彛锛堝悓姝ユ柟娉曪級
                 var mesResult = _mesService.OutboundInContainer(mesRequest);
                 stopwatch.Stop();
 
-                // 7. 璁板綍鏃ュ織
+                // 6. 璁板綍鏃ュ織
                 await _mesLogService.LogAsync(new MesApiLogDto
                 {
                     ApiType = "OutboundInContainer",
@@ -221,7 +209,7 @@
                     Creator = App.User.UserName
                 });
 
-                // 8. 杩斿洖缁撴灉
+                // 7. 杩斿洖缁撴灉
                 if (mesResult.IsSuccess)
                 {
                     return response.OK("鎵樼洏鍑虹珯鎴愬姛");
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
index 1c4242a..eca38b2 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
@@ -22,16 +22,19 @@
         private readonly IMesLogService _mesLogService;
         private readonly IMesService _mesService;
         private readonly ISys_DictionaryService _sysDictionaryService;
+        private readonly IStockInfoService _stockInfoService;
 
         public StockInfoDetailController(
             IStockInfoDetailService service,
             IMesLogService mesLogService,
             IMesService mesService,
-            ISys_DictionaryService sysDictionaryService) : base(service)
+            ISys_DictionaryService sysDictionaryService,
+            IStockInfoService stockInfoService) : base(service)
         {
             _mesLogService = mesLogService;
             _mesService = mesService;
             _sysDictionaryService = sysDictionaryService;
+            _stockInfoService = stockInfoService;
         }
 
         /// <summary>
@@ -48,36 +51,26 @@
             try
             {
                 // 1. 鍙傛暟楠岃瘉
-                if (string.IsNullOrWhiteSpace(dto.PalletCode))
-                {
-                    return response.Error("鎵樼洏缂栧彿涓嶈兘涓虹┖");
-                }
-
                 if (dto.SfcList == null || !dto.SfcList.Any())
                 {
                     return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
                 }
 
                 // 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁哥粦瀹氾級
-                var stockDetails = await Service.Repository.QueryDataAsync(x => dto.SfcList.Contains(x.SerialNumber));
-                if (stockDetails != null && stockDetails.Any(d => d.Status == 99))
+                var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
+                if (stockDetail != null && stockDetail.Status == 99)
                 {
                     return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岀粦瀹氭搷浣�");
                 }
-
-                // 3. 鑾峰彇绯荤粺閰嶇疆
-                var configs = _sysDictionaryService.GetVueDictionary(new[] { "MES_EquipmentCode", "MES_ResourceCode" });
-
-                string equipmentCode = GetConfigValue(configs, "MES_EquipmentCode", "WCS_001");
-                string resourceCode = GetConfigValue(configs, "MES_ResourceCode", "RESOURCE_001");
+                var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
 
                 // 3. 鏋勯�燤ES璇锋眰 - 灏嗙數鑺垪琛ㄨ浆鎹负ContainerSfcItem鏍煎紡
                 var mesRequest = new BindContainerRequest
                 {
-                    EquipmentCode = equipmentCode,
-                    ResourceCode = resourceCode,
+                    EquipmentCode = "STK-GROUP-001",
+                    ResourceCode = "STK-GROUP-001",
                     LocalTime = DateTime.Now,
-                    ContainerCode = dto.PalletCode,
+                    ContainerCode = stockInfo.PalletCode,
                     ContainerSfcList = dto.SfcList.Select(sfc => new ContainerSfcItem
                     {
                         Sfc = sfc,
@@ -146,36 +139,26 @@
             try
             {
                 // 1. 鍙傛暟楠岃瘉
-                if (string.IsNullOrWhiteSpace(dto.PalletCode))
-                {
-                    return response.Error("鎵樼洏缂栧彿涓嶈兘涓虹┖");
-                }
-
                 if (dto.SfcList == null || !dto.SfcList.Any())
                 {
                     return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
                 }
 
                 // 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁歌В缁戯級
-                var stockDetails = await Service.Repository.QueryDataAsync(x => dto.SfcList.Contains(x.SerialNumber));
-                if (stockDetails != null && stockDetails.Any(d => d.Status == 99))
+                var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
+                if (stockDetail != null && stockDetail.Status == 99)
                 {
                     return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岃В缁戞搷浣�");
                 }
-
-                // 3. 鑾峰彇绯荤粺閰嶇疆
-                var configs = _sysDictionaryService.GetVueDictionary(new[] { "MES_EquipmentCode", "MES_ResourceCode" });
-
-                string equipmentCode = GetConfigValue(configs, "MES_EquipmentCode", "WCS_001");
-                string resourceCode = GetConfigValue(configs, "MES_ResourceCode", "RESOURCE_001");
+                var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
 
                 // 3. 鏋勯�燤ES璇锋眰
                 var mesRequest = new UnBindContainerRequest
                 {
-                    EquipmentCode = equipmentCode,
-                    ResourceCode = resourceCode,
+                    EquipmentCode = "STK-GROUP-001",
+                    ResourceCode = "STK-GROUP-001",
                     LocalTime = DateTime.Now,
-                    ContainCode = dto.PalletCode,
+                    ContainCode = stockInfo.PalletCode,
                     SfcList = dto.SfcList
                 };
 
@@ -251,25 +234,20 @@
 
                 // 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁窷G涓婃姤锛�
                 var sfcList = dto.NgSfcList.Select(x => x.Sfc).ToList();
-                var stockDetails = await Service.Repository.QueryDataAsync(x => sfcList.Contains(x.SerialNumber));
-                if (stockDetails != null && stockDetails.Any(d => d.Status == 99))
+                var stockDetail = await Service.Repository.QueryFirstAsync(x => sfcList.Contains(x.SerialNumber));
+                if (stockDetail != null && stockDetail.Status == 99)
                 {
                     return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛孨G涓婃姤鎿嶄綔");
                 }
-
-                // 3. 鑾峰彇绯荤粺閰嶇疆
-                var configs = _sysDictionaryService.GetVueDictionary(new[] { "MES_EquipmentCode", "MES_ResourceCode" });
-
-                string equipmentCode = GetConfigValue(configs, "MES_EquipmentCode", "WCS_001");
-                string resourceCode = GetConfigValue(configs, "MES_ResourceCode", "RESOURCE_001");
+                var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
 
                 // 3. 鏋勯�燤ES璇锋眰 - 灏咲TO鏍煎紡杞崲涓篗ES璇锋眰鏍煎紡
                 var mesRequest = new ContainerNgReportRequest
                 {
-                    EquipmentCode = equipmentCode,
-                    ResourceCode = resourceCode,
+                    EquipmentCode = "STK-GROUP-001",
+                    ResourceCode = "RESOURCE-001",
                     LocalTime = DateTime.Now,
-                    ContainerCode = dto.PalletCode,
+                    ContainerCode = stockInfo.PalletCode,
                     NgSfcList = dto.NgSfcList.Select(ng => new NgSfcItem
                     {
                         Sfc = ng.Sfc,

--
Gitblit v1.9.3