From 5e851678cc02257bbbd179446de36082430ca5bc Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 13 四月 2026 15:12:04 +0800
Subject: [PATCH] feat(MES): 添加Mes_Log扩展逻辑
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs | 67 +++++++++++----------------------
1 files changed, 22 insertions(+), 45 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 1c4242a..4abd388 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs
@@ -5,7 +5,6 @@
using WIDESEA_DTO.MES;
using WIDESEA_IStockService;
using WIDESEA_IBasicService;
-using WIDESEA_IMesService;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
using System.Diagnostics;
@@ -22,16 +21,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 +50,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 +138,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 +233,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