From 2e7937ca43b0712ddf96b29b04cc7baf34fa1305 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 25 四月 2026 18:40:00 +0800
Subject: [PATCH] feat: 添加托盘库存明细查询功能并优化机械手任务处理
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 47 +++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 1e37368..2a154b9 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -247,6 +247,14 @@
var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities);
if (!result) return content.Error("鎹㈢洏澶辫触");
+ // 妫�鏌ユ簮鎵樼洏鏄惁杩樻湁鍓╀綑搴撳瓨鏄庣粏锛岃嫢鏃犲垯鍒犻櫎婧愭墭鐩樺簱瀛樺ご
+ var remainingSourceDetails = StockInfoDetailService.Repository.QueryData(d => d.StockId == sourceStock.Id);
+ if (!remainingSourceDetails.Any())
+ {
+ if (await StockInfoService.Repository.Db.Deleteable<Dt_StockInfo>().Where(s => s.Id == sourceStock.Id).ExecuteCommandAsync() <= 0)
+ return content.Error("鍒犻櫎婧愭墭鐩樺簱瀛樺け璐�");
+ }
+
return content.OK("鎹㈢洏鎴愬姛");
});
}
@@ -314,6 +322,19 @@
if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock }, "鎷嗙洏")) <= 0)
return content.Error("鎷嗙洏鍘嗗彶璁板綍淇濆瓨澶辫触");
+
+ // 鍒犻櫎宸叉媶鍑虹殑搴撳瓨鏄庣粏
+ var detailIds = detailEntities.Select(d => d.Id).ToList();
+ if (await StockInfoDetailService.Repository.Db.Deleteable<Dt_StockInfoDetail>().In(detailIds).ExecuteCommandAsync() <= 0)
+ return content.Error("鍒犻櫎搴撳瓨鏄庣粏澶辫触");
+
+ // 妫�鏌ユ簮鎵樼洏鏄惁杩樻湁鍓╀綑搴撳瓨鏄庣粏锛岃嫢鏃犲垯鍒犻櫎婧愭墭鐩樺簱瀛樺ご
+ var remainingSourceDetails = StockInfoDetailService.Repository.QueryData(d => d.StockId == sourceStock.Id);
+ if (!remainingSourceDetails.Any())
+ {
+ if (await StockInfoService.Repository.Db.Deleteable<Dt_StockInfo>().Where(s => s.Id == sourceStock.Id).ExecuteCommandAsync() <= 0)
+ return content.Error("鍒犻櫎婧愭墭鐩樺簱瀛樺け璐�");
+ }
return content.OK("鎷嗙洏鎴愬姛");
});
@@ -463,7 +484,8 @@
return (
result?.Data?.IsSuccess ?? false,
System.Text.Json.JsonSerializer.Serialize(result),
- result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒"
+ result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒",
+ _mesService.BuildConfig(token ?? string.Empty).ToJson()
);
});
@@ -548,7 +570,8 @@
return (
result?.Data?.IsSuccess ?? false,
System.Text.Json.JsonSerializer.Serialize(result),
- result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒"
+ result?.Data?.Msg ?? result?.ErrorMessage ?? "鏈煡閿欒",
+ _mesService.BuildConfig(token ?? string.Empty).ToJson()
);
});
@@ -561,6 +584,26 @@
}
/// <summary>
+ /// 鏍规嵁鎵樼洏鍙锋煡璇㈠簱瀛樻槑缁嗘暟閲�
+ /// </summary>
+ /// <param name="palletCode">鎵樼洏鍙�</param>
+ /// <returns>搴撳瓨鏄庣粏鏁伴噺</returns>
+ public async Task<WebResponseContent> GetStockDetailCountByPalletCodeAsync(string palletCode)
+ {
+ WebResponseContent content = new WebResponseContent();
+ if (string.IsNullOrWhiteSpace(palletCode))
+ return content.Error("鎵樼洏鍙蜂笉鑳戒负绌�");
+
+ var stockInfo = StockInfoService.Repository.QueryFirst(s => s.PalletCode == palletCode);
+ if (stockInfo == null)
+ return content.Error("鎵樼洏涓嶅瓨鍦�");
+
+ var count = await StockInfoDetailService.Repository.Db.Queryable<Dt_StockInfoDetail>()
+ .CountAsync(d => d.StockId == stockInfo.Id);
+ return content.OK("鏌ヨ鎴愬姛", new { PalletCode = palletCode, DetailCount = count });
+ }
+
+ /// <summary>
/// 鏍规嵁璁惧鍚嶇О鍜屾墭鐩樺彿瑙f瀽MES璁惧閰嶇疆
/// </summary>
/// <param name="deviceName">璁惧鍚嶇О</param>
--
Gitblit v1.9.3