From 894f6a1d5204ee40ef41c61da32820bd1178021e Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 09:50:29 +0800
Subject: [PATCH] fix(StockService): GroupPalletAsync正确调用MES BindContainer并检查结果
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 8e3c669..d5f16e0 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -1,7 +1,9 @@
锘縰sing SqlSugar;
using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
+using WIDESEA_DTO.MES;
using WIDESEA_DTO.Stock;
+using WIDESEA_IBasicService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -33,6 +35,11 @@
public IStockInfo_HtyService StockInfo_HtyService { get; }
/// <summary>
+ /// Mes鎺ュ彛鏈嶅姟
+ /// </summary>
+ public IMesService _mesService { get; }
+
+ /// <summary>
/// 鏋勯�犲嚱鏁�
/// </summary>
/// <param name="stockInfoDetailService">搴撳瓨鏄庣粏鏈嶅姟</param>
@@ -43,12 +50,14 @@
IStockInfoDetailService stockInfoDetailService,
IStockInfoService stockInfoService,
IStockInfoDetail_HtyService stockInfoDetail_HtyService,
- IStockInfo_HtyService stockInfo_HtyService)
+ IStockInfo_HtyService stockInfo_HtyService,
+ IMesService mesService)
{
StockInfoDetailService = stockInfoDetailService;
StockInfoService = stockInfoService;
StockInfoDetail_HtyService = stockInfoDetail_HtyService;
StockInfo_HtyService = stockInfo_HtyService;
+ _mesService = mesService;
}
/// <summary>
@@ -120,6 +129,20 @@
Status = StockStatusEmun.缁勭洏鏆傚瓨.GetHashCode(),
}).ToList();
+ var bindRequest = new BindContainerRequest
+ {
+ ContainerCode = stock?.TargetPalletNo,
+ EquipmentCode = "STK-GROUP-001",
+ ResourceCode = "STK-GROUP-001",
+ LocalTime = now,
+ OperationType = 0, // 0浠h〃缁勭洏
+ ContainerSfcList = details.Select(d => new ContainerSfcItem
+ {
+ Sfc = d.SerialNumber,
+ Location = d.InboundOrderRowNo.ToString(),
+ }).ToList()
+ };
+
return await ExecuteWithinTransactionAsync(async () =>
{
var existingStock = StockInfoService.Repository.QueryFirst(s => s.PalletCode == stock.TargetPalletNo);
@@ -140,6 +163,11 @@
Creater = "system",
Details = details
};
+ var mesResult = _mesService.BindContainer(bindRequest);
+ if (mesResult == null || !mesResult.IsSuccess)
+ {
+ return content.Error($"缁勭洏鎴愬姛锛屼絾MES缁戝畾澶辫触: {mesResult?.ErrorMessage ?? "鏈煡閿欒"}");
+ }
result = StockInfoService.Repository.AddData(entity, x => x.Details);
return result ? content.OK("缁勭洏鎴愬姛") : content.Error("缁勭洏澶辫触");
--
Gitblit v1.9.3