From 75ef0dfecf2331c0828a1a182b1d3243d3041c51 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 21 四月 2026 13:19:44 +0800
Subject: [PATCH] refactor: 统一日志组件为Serilog并优化相关功能
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs | 71 +++++++++++++++++------------------
1 files changed, 35 insertions(+), 36 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..de85b5f 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,13 @@
-锘縰sing Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
+锘縰sing Microsoft.AspNetCore.Mvc;
+using WIDESEA_Common.Constants;
+using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseController;
using WIDESEA_DTO.MES;
-using WIDESEA_IStockService;
using WIDESEA_IBasicService;
+using WIDESEA_IStockService;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
-using WIDESEA_Common.Constants;
-using WIDESEA_Common.StockEnum;
namespace WIDESEA_WMSServer.Controllers.Stock
{
@@ -52,19 +51,19 @@
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("缁勭洏鏈烘鎵�");
@@ -79,10 +78,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 +100,9 @@
? _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 ?? "鏈煡閿欒"
);
},
App.User.UserName);
@@ -130,18 +129,18 @@
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("缁勭洏鏈烘鎵�");
@@ -156,7 +155,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 +172,9 @@
? _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 ?? "鏈煡閿欒"
);
},
App.User.UserName);
@@ -315,4 +314,4 @@
return defaultValue;
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3