From 26676bd2c481d67e856f683a1431910bf351f740 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 14:20:26 +0800
Subject: [PATCH] feat(TaskService): InboundFinishTaskTrayAsync添加任务和库存历史保存
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 2657c1b..c253b80 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -232,8 +232,6 @@
if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock, targetStock }, "鎹㈢洏")) <= 0)
return content.Error("鎹㈢洏鍘嗗彶璁板綍淇濆瓨澶辫触");
- detailEntities.ForEach(d => d.StockId = targetStock.Id);
-
// 璋冪敤MES瑙g粦婧愭墭鐩樼數鑺�
var unbindRequest = new UnBindContainerRequest
{
@@ -249,6 +247,7 @@
return content.Error($"鎹㈢洏鎴愬姛锛屼絾MES瑙g粦澶辫触: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "鏈煡閿欒"}");
}
+ detailEntities.ForEach(d => d.StockId = targetStock.Id);
var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities);
if (!result) return content.Error("鎹㈢洏澶辫触");
@@ -316,6 +315,21 @@
if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock }, "鎷嗙洏")) <= 0)
return content.Error("鎷嗙洏鍘嗗彶璁板綍淇濆瓨澶辫触");
+ // 璋冪敤MES瑙g粦鐢佃姱
+ var unbindRequest = new UnBindContainerRequest
+ {
+ EquipmentCode = "STK-GROUP-001",
+ ResourceCode = "STK-GROUP-001",
+ LocalTime = DateTime.Now,
+ ContainCode = stock.SourcePalletNo,
+ SfcList = detailEntities.Select(d => d.SerialNumber).ToList()
+ };
+ var unbindResult = _mesService.UnBindContainer(unbindRequest);
+ if (unbindResult == null || unbindResult.Data == null || !unbindResult.Data.IsSuccess)
+ {
+ return content.Error($"鎷嗙洏鎴愬姛锛屼絾MES瑙g粦澶辫触: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "鏈煡閿欒"}");
+ }
+
var result = await StockInfoDetailService.Repository.DeleteDataAsync(detailEntities);
if (!result) return content.Error("鎷嗙洏澶辫触");
return content.OK("鎷嗙洏鎴愬姛");
--
Gitblit v1.9.3