From 419159c8611dca81b94b3103cdeaeb9272aed5ea Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 23 四月 2026 16:40:32 +0800
Subject: [PATCH] feat(机器人任务): 实现本地创建机器人任务功能
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 4e7212c..03fa684 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("鎹㈢洏鎴愬姛");
});
}
@@ -315,6 +323,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("鎷嗙洏鎴愬姛");
});
}
--
Gitblit v1.9.3