From 3460ffdc967b65ea67c959212c2505a19008401e Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 16 四月 2026 13:39:56 +0800
Subject: [PATCH] 盘点优化,智仓调智仓防呆
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs | 68 ++++++++++++++++++++++++---------
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 6 ++-
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs | 3 +
4 files changed, 57 insertions(+), 22 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
index cf18394..8b787c8 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs"
@@ -92,6 +92,9 @@
[Description("鏅轰粨鍏ユ櫤浠撶粍鐩樻殏瀛�")]
鏅轰粨鍏ユ櫤浠撶粍鐩樻殏瀛� = 15,
+ [Description("鐩樼偣鍑哄簱閿佸畾")]
+ 鐩樼偣鍑哄簱閿佸畾 = 16,
+
[Description("閫佹搴撳瓨瀹屾垚")]
閫佹搴撳瓨瀹屾垚 = 19,
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs"
index 5503ec7..0089f6b 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs"
@@ -358,7 +358,7 @@
_detailRepository.UpdateData(outboundOrderDetails);
if (pickedDetails.Any())
{
- UpdateStockStatus(pickedDetails.Select(x => x.PalletCode).ToList(), StockStatusEmun.鍑哄簱閿佸畾.ObjToInt());
+ UpdateStockStatus(pickedDetails.Select(x => x.PalletCode).ToList(), StockStatusEmun.鍑哄簱閿佸畾.ObjToInt(),outboundOrder);
UpdateLocationStatus(pickedDetails.Select(x => x.LocationCode).ToList(), LocationStatusEnum.Lock.ObjToInt());
}
//閲嶆鍗曚笉鎷i�夛紝鍘绘帀閿佸畾璁板綍鍥炲簱锛屽啀娆$粍鐩樻椂鎵i櫎鍘熸潯鐮�
@@ -984,11 +984,16 @@
}
}
- public bool UpdateStockStatus(List<string> palletCodes, int status)
+ public bool UpdateStockStatus(List<string> palletCodes, int status,Dt_OutboundOrder outOrder)
{
try
{
List<Dt_StockInfo> stockInfos = _stockInfoRepository.QueryData(x => palletCodes.Contains(x.PalletCode));
+ ///鏅轰粨璋冩櫤浠撳崟鎹褰�
+ if(outOrder.OrderType == 117)
+ {
+ stockInfos.ForEach(stockInfo => stockInfo.Remark = outOrder.OrderNo);
+ }
stockInfos.ForEach(stockInfo => stockInfo.StockStatus = status);
_stockInfoRepository.UpdateData(stockInfos);
return true;
@@ -2251,6 +2256,48 @@
return content.Error($"鏈壘鍒版墭鐩榹palletCode}搴撳瓨淇℃伅涓嶅厑璁稿洖搴�");
}
+ var task = await _taskRepository.Db.Queryable<Dt_Task>()
+ .Where(x => x.PalletCode == palletCode)
+ .FirstAsync();
+
+ if (task != null)
+ {
+ return content.Error($"鎵樼洏{palletCode}瀛樺湪浠诲姟鍥炲簱澶辫触!");
+ }
+
+ // 鍒嗛厤鏂拌揣浣�
+ var newLocation = _locationInfoService.AssignLocation(stock.LocationType);
+
+ if (newLocation == null)
+ {
+ return WebResponseContent.Instance.Error("娌℃湁绌洪棽搴撲綅鍙洖搴�");
+ }
+
+ if(stock.Remark !=null && stock.Remark != "")
+ {
+ Dt_OutboundOrder outboundOrder = _outboundRepository.QueryFirst(x => x.OrderNo == stock.Remark && x.OrderType == 117 && x.OrderStatus == OutOrderStatusEnum.鍑哄簱涓�.ObjToInt());
+ if (outboundOrder != null)
+ {
+ // 1. 鏍规嵁璁㈠崟鍙锋煡璇㈣皟鎷ㄧ墿鏂欎俊鎭�
+ List<Dt_AllocateMaterialInfo> allocateMaterialInfos = _allocateMaterialInfoRepository.QueryData(x => x.OrderNo == outboundOrder.OrderNo);
+
+ // 2. 鍒ゆ柇鏄惁瀛樺湪璋冩嫧鐗╂枡锛屾病鏈夊垯鐩存帴璺宠繃鏍¢獙
+ if (allocateMaterialInfos != null && allocateMaterialInfos.Any())
+ {
+ // 3. 鎻愬彇鎵�鏈� Barcode 闆嗗悎
+ List<string> barcodes = allocateMaterialInfos.Select(x => x.Barcode).ToList();
+
+ // 4. 鏍规嵁 Barcode 鎵归噺鏌ヨ搴撳瓨鏄庣粏
+ List<Dt_StockInfoDetail> stockInfoDetails = _stockDetailRepository.QueryData(x => barcodes.Contains(x.Barcode) && x.OrderNo == outboundOrder.OrderNo);
+
+ // 5. 鏁伴噺瀵规瘮锛氫笉鐩哥瓑 鈫� 鏈叏閮ㄧ粍鐩樺畬鎴�
+ if (barcodes.Count != stockInfoDetails.Count)
+ {
+ return WebResponseContent.Instance.Error($"鏅轰粨璋冩櫤浠撳崟鎹畕outboundOrder.OrderNo}灏氭湭鍏ㄩ儴缁勭洏瀹屾垚锛岃鍏堣繘琛岀粍鐩樺啀鍥炲簱鍗曟嵁鐩稿叧鏂欑");
+ }
+ }
+ }
+ }
if (stock.Details.Count <= 0)
{
stock.PalletType = (int)PalletTypeEnum.Empty;
@@ -2354,23 +2401,6 @@
stock.StockStatus = (int)StockStatusEmun.鍏ュ簱纭;
stock.LocationCode = "";
- }
-
- var task = await _taskRepository.Db.Queryable<Dt_Task>()
- .Where(x => x.PalletCode == palletCode)
- .FirstAsync();
-
- if (task != null)
- {
- return content.Error($"鎵樼洏{palletCode}瀛樺湪浠诲姟鍥炲簱澶辫触!");
- }
-
- // 鍒嗛厤鏂拌揣浣�
- var newLocation = _locationInfoService.AssignLocation(stock.LocationType);
-
- if(newLocation == null)
- {
- return WebResponseContent.Instance.Error("娌℃湁绌洪棽搴撲綅鍙洖搴�");
}
var newTask = new Dt_Task()
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 9b7fa57..c49e8af 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -1091,6 +1091,7 @@
stockInfo.LocationCode = locationInfo.LocationCode;
stockInfo.PalletCode = task.PalletCode;
stockInfo.LocationCode = task.TargetAddress;
+ stockInfo.Remark ="";
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
_stockRepository.UpdateData(stockInfo);
@@ -1346,6 +1347,7 @@
// 鏇存柊搴撳瓨淇℃伅
stockInfo.LocationCode = task.TargetAddress;
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ stockInfo.Remark = "";
// 鏇存柊搴撳瓨鏄庣粏鐘舵��
if (stockInfo.Details != null && stockInfo.Details.Any())
@@ -2259,7 +2261,7 @@
{
return content.Error($"鐩樼偣鍗晎task.OrderNo}鐩樼偣宸插畬鎴愭垨鏈紑濮�");
}
- if (stockInfo.StockStatus != StockStatusEmun.鍑哄簱閿佸畾.ObjToInt())
+ if (stockInfo.StockStatus != StockStatusEmun.鐩樼偣鍑哄簱閿佸畾.ObjToInt())
{
return content.Error($"{stockInfo.PalletCode}搴撳瓨鐘舵�佷笉姝g‘");
}
@@ -2351,7 +2353,7 @@
{
_logger.LogInformation($"InEmptyTaskCompleted AddLocationStatusChangeRecord : {ex.Message} ");
}
- return content;
+ return content.OK();
}
catch (Exception ex)
{
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 37dcbc7..936efde 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -1181,7 +1181,7 @@
}
stockInfos.ForEach(x =>
{
- x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ x.StockStatus = StockStatusEmun.鐩樼偣鍑哄簱閿佸畾.ObjToInt();
});
tasks.ForEach(x =>
{
--
Gitblit v1.9.3