From 43d2d040be7416230db1c562526f2743e87d75ea Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期六, 22 十一月 2025 10:56:56 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/SplitPackageService.cs | 6 +
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs | 31 +++++-----
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 4 +
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs | 20 +++++-
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm | 0
项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm | 0
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 74 ++++++++++++++++++++++--
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Outbound/Dt_OutboundLockInfo.cs | 3 +
8 files changed, 109 insertions(+), 29 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
index 184b599..281e03c 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/CodeChunks.db-shm"
Binary files differ
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
index 890e021..5c3038d 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.878.3237/SemanticSymbols.db-shm"
Binary files differ
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_Model/Models/Outbound/Dt_OutboundLockInfo.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_Model/Models/Outbound/Dt_OutboundLockInfo.cs"
index 29b6b66..02db493 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_Model/Models/Outbound/Dt_OutboundLockInfo.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_Model/Models/Outbound/Dt_OutboundLockInfo.cs"
@@ -128,6 +128,9 @@
public int? ParentLockId { get; set; }
+ [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鎿嶄綔鑰�")]
+ public string Operator { get; set; }
+
[Navigate(NavigateType.OneToOne, nameof(StockInfo))]//涓�瀵逛竴 SchoolId鏄疭tudentA绫婚噷闈㈢殑
public Dt_StockInfo StockInfo { get; set; } //涓嶈兘璧嬪�煎彧鑳芥槸null
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/OutStockLockInfoService.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/OutStockLockInfoService.cs"
index b259d4d..ab718be 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/OutStockLockInfoService.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/OutStockLockInfoService.cs"
@@ -57,20 +57,22 @@
// 纭畾鏉$爜
string targetBarcode;
+ var firstAvailableDetail=new Dt_StockInfoDetail();
if (!string.IsNullOrEmpty(barcode))
{
// 楠岃瘉鎸囧畾鐨勬潯鐮佹槸鍚﹀瓨鍦�
- var specifiedBarcodeDetail = stockDetails.FirstOrDefault(x => x.Barcode == barcode);
- if (specifiedBarcodeDetail == null)
+ firstAvailableDetail = stockDetails.FirstOrDefault(x => x.Barcode == barcode);
+ if (firstAvailableDetail == null)
{
throw new Exception($"鎸囧畾鐨勬潯鐮乕{barcode}]鍦ㄥ簱瀛樹腑涓嶅瓨鍦�");
}
+
targetBarcode = barcode;
}
else
{
// 浣跨敤绗竴涓彲鐢ㄦ潯鐮�
- var firstAvailableDetail = stockDetails
+ firstAvailableDetail = stockDetails
.Where(x => x.StockQuantity > x.OutboundQuantity)
.OrderBy(x => x.CreateDate)
.FirstOrDefault();
@@ -83,13 +85,9 @@
}
return new Dt_OutStockLockInfo()
- {
- lineNo= outboundOrderDetail.lineNo,
-
+ {
PalletCode = outStock.PalletCode,
- AssignQuantity = assignQuantity,
- MaterielCode = outboundOrderDetail.MaterielCode,
- BatchNo = outboundOrderDetail.BatchNo ?? outStock.Details.FirstOrDefault()?.BatchNo,
+ AssignQuantity = assignQuantity,
LocationCode = outStock.LocationCode,
MaterielName = outboundOrderDetail.MaterielName,
OrderDetailId = outboundOrderDetail.Id,
@@ -99,16 +97,19 @@
.Where(x => x.MaterielCode == outboundOrderDetail.MaterielCode)
.Sum(x => x.StockQuantity),
Status = (int)OutLockStockStatusEnum.宸插垎閰�,
- StockId = outStock.Id,
- Unit = outboundOrderDetail.Unit,
- FactoryArea = outboundOrder.FactoryArea,
+ StockId = outStock.Id,
OrderType=outboundOrder.OrderType,
- SupplyCode = outboundOrderDetail.SupplyCode,
- WarehouseCode = outboundOrderDetail.WarehouseCode,
+ SupplyCode = firstAvailableDetail.SupplyCode,
+ WarehouseCode = firstAvailableDetail.WarehouseCode,
// 鏂板瀛楁
CurrentBarcode = targetBarcode,
OriginalLockQuantity = assignQuantity,
- IsSplitted = 0
+ IsSplitted = 0,
+ MaterielCode = outboundOrderDetail.MaterielCode,
+ BatchNo = firstAvailableDetail.BatchNo,
+ Unit = firstAvailableDetail.Unit,
+ FactoryArea = firstAvailableDetail.FactoryArea,
+ lineNo = firstAvailableDetail.InboundOrderRowNo,
};
}
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/OutboundPickingService.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/OutboundPickingService.cs"
index b1b0548..df1fcf7 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/OutboundPickingService.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/OutboundPickingService.cs"
@@ -473,6 +473,7 @@
// 5. 鏇存柊鍘熼攣瀹氫俊鎭�
lockInfo.AssignQuantity = remainingStockQty;
lockInfo.PickedQty = 0;
+ lockInfo.Operator = App.User.UserName;
await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
// 6. 璁剧疆缁撴灉
@@ -493,6 +494,7 @@
// 2. 鏇存柊閿佸畾淇℃伅
lockInfo.PickedQty += actualQty;
lockInfo.Status = (int)OutLockStockStatusEnum.鎷i�夊畬鎴�;
+ lockInfo.Operator = App.User.UserName;
await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
}
@@ -511,6 +513,7 @@
// 2. 鏇存柊閿佸畾淇℃伅
lockInfo.PickedQty += stockOutQty;
lockInfo.AssignQuantity = remainingAssignQty;
+ lockInfo.Operator = App.User.UserName;
await _outStockLockInfoService.Db.Updateable(lockInfo).ExecuteCommandAsync();
// 3. 鏇存柊鎷嗗寘璁板綍鐘舵��
@@ -1097,10 +1100,13 @@
private async Task HandlePalletStockGoodsReturn(List<Dt_StockInfoDetail> palletStockGoods)
{
+ _logger.LogInformation($"鍥炲簱鎿嶄綔锛氬彂鐜皗palletStockGoods.Count}涓簱瀛樻槑缁嗛渶瑕佸洖搴擄紝绛夊緟AGV鎼繍");
foreach (var stockGood in palletStockGoods)
{
- // 鎭㈠搴撳瓨鐘舵��
- stockGood.OutboundQuantity = 0;
+ _logger.LogInformation($"寰呭洖搴撹揣鐗� - 鏉$爜: {stockGood.Barcode}, 鏁伴噺: {stockGood.StockQuantity}, 褰撳墠鐘舵��: {stockGood.Status}");
+
+ // 鎭㈠搴撳瓨鐘舵��
+ stockGood.OutboundQuantity = 0;
stockGood.Status = StockStatusEmun.鍏ュ簱纭.ObjToInt();
await _stockInfoDetailService.Db.Updateable(stockGood).ExecuteCommandAsync();
@@ -1121,6 +1127,7 @@
private async Task UpdateStockInfoStatus(Dt_StockInfo stockInfo)
{
+ _logger.LogInformation($"鍥炲簱鎿嶄綔锛氭墭鐩榹stockInfo.PalletCode}绛夊緟AGV鍥炲簱鎼繍");
// 鏇存柊搴撳瓨涓昏〃鐘舵��
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
await _stockInfoService.Db.Updateable(stockInfo).ExecuteCommandAsync();
@@ -1337,7 +1344,7 @@
business_type = outboundOrder.BusinessType,
factoryArea = outboundOrder.FactoryArea,
operationType = 1,
- Operator = outboundOrder.Operator,
+ Operator = App.User.UserName,
orderNo = outboundOrder.UpperOrderNo,
status = outboundOrder.OrderStatus,
details = new List<FeedbackOutboundDetailsModel>()
@@ -1422,7 +1429,12 @@
CurrentBarcode = newBarcode,
OriginalLockQuantity = quantity,
IsSplitted = 1,
- ParentLockId = originalLock.Id
+ ParentLockId = originalLock.Id,
+ Operator= App.User.UserName,
+ FactoryArea=originalLock.FactoryArea,
+ lineNo=originalLock.lineNo,
+ WarehouseCode=originalLock.WarehouseCode,
+
};
var newLockId = await _outStockLockInfoService.Db.Insertable(newLockInfo).ExecuteReturnIdentityAsync();
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/SplitPackageService.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/SplitPackageService.cs"
index 62ef0f2..3c4b50b 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/SplitPackageService.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/SplitPackageService.cs"
@@ -134,7 +134,11 @@
CurrentBarcode = newBarcode,
OriginalLockQuantity = request.SplitQuantity,
IsSplitted = 1,
- ParentLockId = lockInfo.Id
+ ParentLockId = lockInfo.Id,
+ Operator = App.User.UserName,
+ FactoryArea = lockInfo.FactoryArea,
+ lineNo = lockInfo.lineNo,
+ WarehouseCode = lockInfo.WarehouseCode,
};
await _outStockLockInfoService.Db.Insertable(newLockInfo).ExecuteCommandAsync();
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 f3e6e0a..8682865 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"
@@ -454,7 +454,7 @@
}
}
- public WebResponseContent InPickTaskCompleted(Dt_Task task)
+ public async Task<WebResponseContent> InPickTaskCompleted(Dt_Task task)
{
_logger.LogInformation($"TaskService InPickTaskCompleted: {task.TaskNum}");
//鏌ュ簱瀛�
@@ -467,7 +467,12 @@
{
return WebResponseContent.Instance.Error($"鏈壘鍒拌鎵樼洏搴撳瓨鏄庣粏淇℃伅");
}
-
+ //鏌ヨ揣浣�
+ Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
+ if (locationInfo == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
+ }
// 鑾峰彇鎵�鏈夊洖搴撲腑鐨勫嚭搴撻攣瀹氳褰�
var returnLocks = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
.Where(it => it.OrderNo == task.OrderNo && it.PalletCode == task.PalletCode && it.Status == (int)OutLockStockStatusEnum.鍥炲簱涓�)
@@ -479,12 +484,8 @@
}
_outStockLockInfoService.Db.Updateable(returnLocks).ExecuteCommand();
- //鏌ヨ揣浣�
- Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
- if (locationInfo == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑缁堢偣璐т綅淇℃伅");
- }
+ await DeleteZeroQuantityStockDetails(stockInfo.Id);
+
stockInfo.LocationCode = task.TargetAddress;
stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
stockInfo.Details.ForEach(x =>
@@ -493,6 +494,9 @@
});
_stockService.StockInfoService.Repository.UpdateData(stockInfo);
_stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
+ await ProcessStockDetailsForReturn(task, stockInfo.Id);
+
+
if (stockInfo.PalletType == PalletTypeEnum.Empty.ObjToInt())
{
@@ -511,6 +515,60 @@
return WebResponseContent.Instance.OK();
}
+ /// <summary>
+ /// 鍒犻櫎搴撳瓨鏁颁负0鐨勫簱瀛樻槑缁嗚褰�
+ /// </summary>
+ private async Task DeleteZeroQuantityStockDetails(int stockId)
+ {
+ try
+ {
+ // 鍒犻櫎搴撳瓨鏁伴噺涓�0鐨勮褰�
+ var deleteCount = await _stockService.StockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>()
+ .Where(x => x.StockId == stockId &&
+ x.StockQuantity == 0 &&
+ (x.Status==StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt()|| x.Status==
+ StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt())) // 鍙垹闄ゅ凡瀹屾垚鐘舵�佺殑闆跺簱瀛�
+ .ExecuteCommandAsync();
+
+ if (deleteCount > 0)
+ {
+ _logger.LogInformation($"鍒犻櫎{deleteCount}鏉¢浂搴撳瓨鏄庣粏璁板綍 - StockId: {stockId}");
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning($"鍒犻櫎闆跺簱瀛樿褰曞け璐� - StockId: {stockId}, Error: {ex.Message}");
+ // 娉ㄦ剰锛氬垹闄ゅけ璐ヤ笉搴旇褰卞搷涓绘祦绋嬶紝璁板綍鏃ュ織鍚庣户缁�
+ }
+ }
+ /// <summary>
+ /// 澶勭悊鍥炲簱鐩稿叧鐨勬墍鏈夊簱瀛樻槑缁嗙姸鎬佸彉鏇�
+ /// </summary>
+ private async Task ProcessStockDetailsForReturn(Dt_Task returnTask, int stockId)
+ {
+ // 鑾峰彇璇ユ墭鐩樹笅鎵�鏈夐渶瑕佸洖搴撶殑搴撳瓨鏄庣粏
+ var stockDetails = await _stockService.StockInfoDetailService.Db.Queryable<Dt_StockInfoDetail>()
+ .Where(x => x.StockId == stockId &&
+ x.StockQuantity > 0 &&
+ ( x.Status == StockStatusEmun.鍑哄簱閿佸畾.ObjToInt()|| x.Status==
+ StockStatusEmun.鍏ュ簱纭.ObjToInt())) // 鍖呮嫭鍑哄簱閿佸畾鍜屽叆搴撶‘璁ょ殑
+ .ToListAsync();
+
+ foreach (var detail in stockDetails)
+ {
+
+ detail.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ detail.OutboundQuantity = 0; // 娓呯┖鍑哄簱鏁伴噺
+
+ _logger.LogInformation($"鏇存柊搴撳瓨鏄庣粏鐘舵�� - 鏉$爜: {detail.Barcode}, 鏁伴噺: {detail.StockQuantity}");
+ }
+
+ if (stockDetails.Any())
+ {
+ await _stockService.StockInfoDetailService.Db.Updateable(stockDetails).ExecuteCommandAsync();
+ _logger.LogInformation($"鍏辨洿鏂皗stockDetails.Count}涓簱瀛樻槑缁嗙姸鎬佷负鍏ュ簱瀹屾垚");
+ }
+ }
public async Task<WebResponseContent> OutEmptyTaskCompleted(Dt_Task task)
{
WebResponseContent content = new WebResponseContent();
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 1e7699c..c2f08d2 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"
@@ -206,7 +206,7 @@
if (stockInfos != null && stockInfos.Count > 0 && outboundOrderDetails != null && outboundOrderDetails.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0)
{
stockInfos.ForEach(x =>
- {
+ {
x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
});
outboundOrderDetails.ForEach(x =>
@@ -218,6 +218,8 @@
{
_outboundOrderService.Repository.UpdateData(outboundOrder);
}
+ outboundOrder.Operator = App.User.UserName;
+ _outboundOrderService.Repository.UpdateData(outboundOrder);
WebResponseContent content = _outboundOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks);
if (!content.Status)
--
Gitblit v1.9.3