From 0aed9c9ee65bd8a17837d83ec05e756d11fab297 Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期二, 21 四月 2026 15:29:48 +0800
Subject: [PATCH] Merge branch 'dev' of http://115.159.85.185:8098/r/SuZhouGuanHong/ShanMeiXinNengYuan into dev

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs |   91 +++++++++++++++++++++++----------------------
 1 files changed, 47 insertions(+), 44 deletions(-)

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 1b3f335..a3cf0df 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
@@ -1,14 +1,14 @@
-锘縰sing Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using WIDESEA_Core;
-using WIDESEA_Core.BaseController;
-using WIDESEA_DTO.MES;
-using WIDESEA_IStockService;
-using WIDESEA_IBasicService;
-using WIDESEA_ISystemService;
-using WIDESEA_Model.Models;
+锘縰sing Microsoft.AspNetCore.Mvc;
 using WIDESEA_Common.Constants;
 using WIDESEA_Common.StockEnum;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseController;
+using WIDESEA_Core.Helper;
+using WIDESEA_DTO.MES;
+using WIDESEA_IBasicService;
+using WIDESEA_IStockService;
+using WIDESEA_ISystemService;
+using WIDESEA_Model.Models;
 
 namespace WIDESEA_WMSServer.Controllers.Stock
 {
@@ -52,22 +52,22 @@
 
             try
             {
-                // 1. 鍙傛暟楠岃瘉
-                if (dto.SfcList == null || !dto.SfcList.Any())
-                {
-                    return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
-                }
+                //// 1. 鍙傛暟楠岃瘉
+                //if (dto.SfcList == null || !dto.SfcList.Any())
+                //{
+                //    return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
+                //}
 
                 // 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁哥粦瀹氾級
-                var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
-                if (stockDetail != null && stockDetail.Status == 99)
-                {
-                    return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岀粦瀹氭搷浣�");
-                }
-                var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
+                //var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
+                //if (stockDetail != null && stockDetail.Status == 99)
+                //{
+                //    return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岀粦瀹氭搷浣�");
+                //}
+                var stockInfo = await _stockInfoService.Repository.QueryDataNavFirstAsync(x => x.PalletCode == dto.PalletCode);
 
                 // 3. 鍔ㄦ�佽幏鍙朚ES鍑瘉
-                var mesConfig = _mesDeviceConfigService.GetByDeviceName("缁勭洏鏈烘鎵�");
+                var mesConfig = _mesDeviceConfigService.GetByDeviceName(dto.DeviceName);
                 string equipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE;
                 string resourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE;
                 string token = mesConfig?.Token;
@@ -79,10 +79,10 @@
                     ResourceCode = resourceCode,
                     LocalTime = DateTime.Now,
                     ContainerCode = stockInfo.PalletCode,
-                    ContainerSfcList = dto.SfcList.Select(sfc => new ContainerSfcItem
+                    ContainerSfcList = stockInfo.Details.Select(sfc => new ContainerSfcItem
                     {
-                        Sfc = sfc,
-                        Location = dto.Location ?? ""
+                        Sfc = sfc.SerialNumber,
+                        Location = sfc.InboundOrderRowNo.ToString() ?? ""
                     }).ToList(),
                     OperationType = dto.OperationType
                 };
@@ -101,9 +101,10 @@
                             ? _mesService.BindContainer(mesRequest)
                             : _mesService.BindContainer(mesRequest, token);
                         return (
-                            result?.IsSuccess ?? false,
+                            result?.Data?.IsSuccess ?? false,
                             System.Text.Json.JsonSerializer.Serialize(result),
-                            result?.ErrorMessage ?? "鏈煡閿欒"
+                            result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒",
+                            _mesService.BuildConfig(token ?? string.Empty).ToJson()
                         );
                     },
                     App.User.UserName);
@@ -130,21 +131,21 @@
             try
             {
                 // 1. 鍙傛暟楠岃瘉
-                if (dto.SfcList == null || !dto.SfcList.Any())
-                {
-                    return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
-                }
+                //if (dto.SfcList == null || !dto.SfcList.Any())
+                //{
+                //    return response.Error("鐢佃姱鐮佸垪琛ㄤ笉鑳戒负绌�");
+                //}
 
-                // 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁歌В缁戯級
-                var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
-                if (stockDetail != null && stockDetail.Status == 99)
-                {
-                    return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岃В缁戞搷浣�");
-                }
-                var stockInfo = await _stockInfoService.Repository.QueryFirstAsync(x => stockDetail.StockId == x.Id);
+                //// 2. 楠岃瘉鐢佃姱鐘舵�侊紙闈�'宸查攣瀹�'鐘舵�佸厑璁歌В缁戯級
+                //var stockDetail = await Service.Repository.QueryFirstAsync(x => dto.SfcList.Contains(x.SerialNumber));
+                //if (stockDetail != null && stockDetail.Status == 99)
+                //{
+                //    return response.Error("褰撳墠搴撳瓨鏄庣粏鍖呭惈宸查攣瀹氱姸鎬侊紝涓嶅厑璁告墽琛岃В缁戞搷浣�");
+                //}
+                var stockInfo = await _stockInfoService.Repository.QueryDataNavFirstAsync(x => dto.PalletCode == x.PalletCode);
 
                 // 3. 鍔ㄦ�佽幏鍙朚ES鍑瘉
-                var mesConfig = _mesDeviceConfigService.GetByDeviceName("缁勭洏鏈烘鎵�");
+                var mesConfig = _mesDeviceConfigService.GetByDeviceName(dto.DeviceName);
                 string equipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE;
                 string resourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE;
                 string token = mesConfig?.Token;
@@ -156,7 +157,7 @@
                     ResourceCode = resourceCode,
                     LocalTime = DateTime.Now,
                     ContainCode = stockInfo.PalletCode,
-                    SfcList = dto.SfcList
+                    SfcList = stockInfo.Details.Select(x => x.SerialNumber).ToList(),
                 };
 
                 string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest);
@@ -173,9 +174,10 @@
                             ? _mesService.UnBindContainer(mesRequest)
                             : _mesService.UnBindContainer(mesRequest, token);
                         return (
-                            result?.IsSuccess ?? false,
+                            result?.Data?.IsSuccess ?? false,
                             System.Text.Json.JsonSerializer.Serialize(result),
-                            result?.ErrorMessage ?? "鏈煡閿欒"
+                            result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒",
+                            _mesService.BuildConfig(token ?? string.Empty).ToJson()
                         );
                     },
                     App.User.UserName);
@@ -254,9 +256,10 @@
                     {
                         var result = _mesService.ContainerNgReport(mesRequest);
                         return (
-                            result?.IsSuccess ?? false,
+                            result?.Data?.IsSuccess ?? false,
                             System.Text.Json.JsonSerializer.Serialize(result),
-                            result?.ErrorMessage ?? "鏈煡閿欒"
+                            result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒",
+                            _mesService.BuildConfig(mesConfig?.Token ?? string.Empty).ToJson()
                         );
                     },
                     App.User.UserName);
@@ -315,4 +318,4 @@
             return defaultValue;
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3