From 7df9475d342d199ae9cc5585d5d3a95888c33208 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期三, 04 二月 2026 08:49:29 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db | 0
WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin | 0
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs | 17 -
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs | 46 ++--
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 483 +++++++++++++++++++++++++++++++++++------------
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cf340d1a-bab8-4f69-a5cd-bf2c9bf7d805.vsidx | 0
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/345cfd9a-4138-4c4a-a9af-c8d22877aeae.vsidx | 0
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aef23139-5f2b-4e2b-b8b1-07914de64bf1.vsidx | 0
WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs | 16
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a7cf8380-9089-4dcc-924e-fb96f612f4aa.vsidx | 0
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/5c4a7e69-693f-412b-ad07-d063fc4e9d3b.vsidx | 0
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs | 33 --
WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db | 0
13 files changed, 403 insertions(+), 192 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin b/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin
index 7bb0ca9..f57a92a 100644
--- a/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin
+++ b/WMS/WIDESEA_WMSServer/.vs/ProjectEvaluation/widesea_wmsserver.strings.v9.bin
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db
index 3137871..e08dcbb 100644
--- a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/CodeChunks.db
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db
index ed0a9b1..35d506b 100644
--- a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.995.13737/SemanticSymbols.db
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/345cfd9a-4138-4c4a-a9af-c8d22877aeae.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/345cfd9a-4138-4c4a-a9af-c8d22877aeae.vsidx
new file mode 100644
index 0000000..70aef67
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/345cfd9a-4138-4c4a-a9af-c8d22877aeae.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/5c4a7e69-693f-412b-ad07-d063fc4e9d3b.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/5c4a7e69-693f-412b-ad07-d063fc4e9d3b.vsidx
new file mode 100644
index 0000000..70aef67
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/5c4a7e69-693f-412b-ad07-d063fc4e9d3b.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a7cf8380-9089-4dcc-924e-fb96f612f4aa.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a7cf8380-9089-4dcc-924e-fb96f612f4aa.vsidx
new file mode 100644
index 0000000..70aef67
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/a7cf8380-9089-4dcc-924e-fb96f612f4aa.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aef23139-5f2b-4e2b-b8b1-07914de64bf1.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aef23139-5f2b-4e2b-b8b1-07914de64bf1.vsidx
new file mode 100644
index 0000000..70aef67
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aef23139-5f2b-4e2b-b8b1-07914de64bf1.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cf340d1a-bab8-4f69-a5cd-bf2c9bf7d805.vsidx b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cf340d1a-bab8-4f69-a5cd-bf2c9bf7d805.vsidx
new file mode 100644
index 0000000..f761c18
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/cf340d1a-bab8-4f69-a5cd-bf2c9bf7d805.vsidx
Binary files differ
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
index dcaf0c6..c5d66e5 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
@@ -30,7 +30,7 @@
/// <summary>
- /// 浣庢俯銆佽嵂姘村簱瀛樺垎閰�
+ /// 鎴愬搧鍒嗛厤
/// </summary>
/// <param name="outboundOrderDetails"></param>
/// <returns></returns>
@@ -114,12 +114,9 @@
}
List<Dt_StockInfo> autoAssignStocks = new List<Dt_StockInfo>();
List<IStockInfoService.residueQuantity> newResidueQuantitys = new List<IStockInfoService.residueQuantity>();
- if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
- {
- autoAssignStocks = _stockService.StockInfoService.CPGetOutboundStocks(stockInfos, dt_OutboundOrderDetails, out List<IStockInfoService.residueQuantity> residueQuantitys);
- newResidueQuantitys.AddRange(residueQuantitys);
- outStocks.AddRange(autoAssignStocks);
- }
+ autoAssignStocks = _stockService.StockInfoService.CPGetOutboundStocks(stockInfos, dt_OutboundOrderDetails, out List<IStockInfoService.residueQuantity> residueQuantitys);
+ newResidueQuantitys.AddRange(residueQuantitys);
+ outStocks.AddRange(autoAssignStocks);
foreach (var residueQuantity in newResidueQuantitys)
{
foreach (var item in dt_OutboundOrderDetails)
@@ -149,11 +146,9 @@
palletAssignQuantity = outStockLockInfos.Where(x => x.MaterielCode == item.MaterielCode && x.PalletCode == autoAssignStocks[j].PalletCode).Sum(x => x.AssignQuantity);//鍑哄簱璇︽儏宸插垎閰嶆暟閲�
}
decimal palletOutboundQuantity = 0;
- if (warehouse.Any(x => x.WarehouseCode.Contains("DW")) || warehouse.Any(x => x.WarehouseCode.Contains("YS")))
- {
- palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.MaterielCode == item.MaterielCode).Sum(x => x.OutboundQuantity);
- }
+ palletOutboundQuantity = autoAssignStocks[j].Details.Where(x => x.MaterielCode == item.MaterielCode).Sum(x => x.OutboundQuantity);
+
if (palletAssignQuantity < palletOutboundQuantity)//濡傛灉鍑哄簱璇︽儏宸插垎閰嶆暟閲忓皬浜庢墭鐩樺凡鍒嗛厤鏁伴噺锛屽垯鍙互缁х画娣诲姞璇ユ墭鐩樺嚭搴撲俊鎭�
{
decimal orderDetailNeedQuantity = details[i].OrderQuantity - detailAssignQuantity;
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
index 189c84f..c5aacc0 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/OutboundOrderDetailService.cs
@@ -671,15 +671,15 @@
return WebResponseContent.Instance.Error("璇ュ嚭搴撳崟鎹潪ERP鎺ㄩ�侊紝鏃犳硶鍙栨秷");
}
string ids ="";
- foreach (var item in outboundOrderDetails)
+ try
{
- ids = item.LinId;
- var postContent = new MultipartFormDataContent();
- postContent.Add(new StringContent(ids), "ids");
- string result = string.Empty;
- HttpClient client = null;
- try
+ foreach (var item in outboundOrderDetails)
{
+ ids = item.LinId;
+ var postContent = new MultipartFormDataContent();
+ postContent.Add(new StringContent(ids), "ids");
+ string result = string.Empty;
+ HttpClient client = null;
using (client = new HttpClient())
{
// 2. 鍙戦�佽姹�
@@ -706,26 +706,24 @@
_outboundRepository.OutboundOrderRepository.DeleteAndMoveIntoHty(outboundOrder, OperateType.浜哄伐鍙栨秷);
}
_unitOfWorkManage.CommitTran();
- // 鍋囪ERP杩斿洖鎴愬姛鏃惰繑鍥炴垚鍔熷搷搴�
- return WebResponseContent.Instance.OK(result);
-
}
- catch (HttpRequestException ex)
- {
- _unitOfWorkManage.RollbackTran();
- // 澶勭悊HTTP璇锋眰鐩稿叧寮傚父
- return WebResponseContent.Instance.Error($"HTTP璇锋眰閿欒: {ex.Message}");
-
- }
- catch (Exception ex)
- {
- _unitOfWorkManage.RollbackTran();
- // 澶勭悊鍏朵粬寮傚父
- return WebResponseContent.Instance.Error($"澶勭悊澶辫触: {ex.Message}");
- }
+ // 鍋囪ERP杩斿洖鎴愬姛鏃惰繑鍥炴垚鍔熷搷搴�
+ return WebResponseContent.Instance.OK();
}
- return WebResponseContent.Instance.OK();
+ catch (HttpRequestException ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ // 澶勭悊HTTP璇锋眰鐩稿叧寮傚父
+ return WebResponseContent.Instance.Error($"HTTP璇锋眰閿欒: {ex.Message}");
+
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ // 澶勭悊鍏朵粬寮傚父
+ return WebResponseContent.Instance.Error($"澶勭悊澶辫触: {ex.Message}");
+ }
}
}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
index ee20837..c5805da 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
@@ -345,10 +345,10 @@
List<Dt_StockInfo> notStocks = new List<Dt_StockInfo>(); ;
foreach (var dt_OutboundOrderDetail in dt_OutboundOrderDetails)
{
- notStocks = stockInfos.Where(x => x.Details.Any(x => x.BatchNo == dt_OutboundOrderDetail.BatchNo && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)).OrderBy(x => x.Id).ToList();
+ notStocks = stockInfos.Where(x => x.Details.Any(x =>x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)).OrderBy(x => x.Id).ToList();
if (notStocks.Count > 0)
{
- decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.BatchNo == dt_OutboundOrderDetail.BatchNo).Sum(v => v.StockQuantity - v.OutboundQuantity);
+ decimal stockTotalQuantity = stockInfos.SelectMany(x => x.Details).Where(d => d.MaterielCode == dt_OutboundOrderDetail.MaterielCode).Sum(v => v.StockQuantity - v.OutboundQuantity);
decimal needQuantity = dt_OutboundOrderDetail.OrderQuantity - dt_OutboundOrderDetail.LockQuantity;
if (stockTotalQuantity >= needQuantity)//搴撳瓨澶�
{
@@ -360,7 +360,7 @@
Dt_StockInfoDetail dt_StockInfoDetail = new Dt_StockInfoDetail();
foreach (var detail in stockInfo.Details)
{
- if (detail.BatchNo == dt_OutboundOrderDetail.BatchNo && detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
+ if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
dt_StockInfoDetail = detail;
}
@@ -370,7 +370,7 @@
{
stockInfo.Details.ForEach(x =>
{
- if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo)
+ if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
x.OutboundQuantity = x.StockQuantity;
}
@@ -382,7 +382,7 @@
stockInfo.Details.ForEach(x =>
{
- if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo)
+ if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
{
@@ -409,7 +409,7 @@
decimal useableStockQuantity = 0;
foreach (var detail in stockInfo.Details)
{
- if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode && detail.BatchNo == dt_OutboundOrderDetail.BatchNo)
+ if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
useableStockQuantity = detail.StockQuantity - detail.OutboundQuantity;
}
@@ -418,7 +418,7 @@
if (useableStockQuantity < needQuantity)
{
stockInfo.Details.ForEach(x => {
- if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo)
+ if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
x.OutboundQuantity = x.StockQuantity;
}
@@ -429,7 +429,7 @@
{
stockInfo.Details.ForEach(x =>
{
- if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode && x.BatchNo == dt_OutboundOrderDetail.BatchNo)
+ if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
{
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs
index 0734036..3f465c6 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs
@@ -41,6 +41,7 @@
}
if (outboundOrderDetails.FirstOrDefault()?.LPNNo == null)
{
+ outboundOrderDetails.Clear();
try
{
List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>();
@@ -63,17 +64,13 @@
}
if (result.Item5 != null && result.Item5.Count > 0)
{
- locationInfos.AddRange(result.Item5);
+ locationInfos.AddRange(result.Item5.DistinctBy(x => x.LocationCode));
}
if (result.Item1 != null && result.Item1.Count > 0)
{
tasks.AddRange(result.Item1);
}
- if (locationInfos.First().RoadwayNo.Contains("DW") || locationInfos.First().RoadwayNo.Contains("YS"))
- {
- break;
- }
-
+ break;
}
WebResponseContent content = NEWGenerateOutboundTaskDataUpdate(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos);
@@ -447,14 +444,14 @@
List<Dt_LocationInfo>? locationInfos = null;
//if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
{
- Dt_OutboundOrder dt_OutboundOrder = _outboundService.OutboundOrderService.Repository.QueryData(x => x.Id == outboundOrderDetails.First().OrderId).First();
+ Dt_NewOutboundOrder dt_OutboundOrder = _outboundService.NewOutboundOrderService.Repository.QueryData(x => x.Id == outboundOrderDetails.First().OrderId).First();
(List<Dt_StockInfo>, List<Dt_NewOutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = new();
result = _outboundService.NewOutboundOrderDetailService.CPAssignStockOutbound(outboundOrderDetails);
if (result.Item1 != null && result.Item1.Count > 0)
{
- Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId);
+ Dt_NewOutboundOrder outboundOrder = _outboundService.NewOutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId);
TaskTypeEnum typeEnum = outboundOrder.OrderType switch
{
(int)OrderTypeEnum.鐢熶骇鍑哄簱鍗� => TaskTypeEnum.Outbound,
@@ -467,24 +464,10 @@
{
x.OrderNo = outboundOrder.OrderNo;
});
- if (dt_OutboundOrder.OutWareHouse.Contains("DW") || dt_OutboundOrder.OutWareHouse.Contains("YS"))
+ result.Item2.ForEach(x =>
{
- result.Item2.ForEach(x =>
- {
- if (x.LockQuantity == x.OrderQuantity)
- {
- x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
- }
- });
- }
- else
- {
- result.Item2.ForEach(x =>
- {
- x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
- });
- }
-
+ x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
+ });
result.Item3.ForEach(x =>
{
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index decc47b..5ba7cfb 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -1688,128 +1688,130 @@
x.LPNNo == stockInfo.PalletCode)
.ToList();
- if (outboundOrderDetails == null || outboundOrderDetails.Count == 0)
+ List<Dt_NewOutboundOrderDetail> outboundOrderDetails1 = _outboundService.NewOutboundOrderDetailService.Db.Queryable<Dt_NewOutboundOrderDetail>()
+ .Where(x => x.OrderId == outboundOrder.Id)
+ .ToList();
+ if ((outboundOrderDetails == null && outboundOrderDetails1 == null) || (outboundOrderDetails.Count == 0 && outboundOrderDetails1.Count == 0))
{
throw new Exception($"鏈壘鍒版墭鐩� {stockInfo.PalletCode} 鍦ㄨ揣浣� {stockInfo.LocationCode} 涓婄殑鍑哄簱鍗曟槑缁�");
}
-
// 鑾峰彇搴撳瓨鏄庣粏
var stockInfoDetails = stockInfo.Details.ToList();
int overCount = outboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
-
- foreach (var stockDetail in stockInfoDetails)
+ if (outboundOrderDetails == null || outboundOrderDetails.Count == 0)
{
- var matchingOrderDetails = outboundOrderDetails
- .Where(x => x.MaterielCode == stockDetail.MaterielCode &&
- x.BatchNo == stockDetail.BatchNo)
- .ToList();
-
- if (matchingOrderDetails.Count == 0)
+ foreach (var stockDetail in stockInfoDetails)
{
- continue;
- }
+ var matchingOrderDetails = outboundOrderDetails1
+ .Where(x => x.MaterielCode == stockDetail.MaterielCode)
+ .ToList();
- // 璁$畻闇�瑕佸垎閰嶇殑鏁伴噺
- decimal remainingStock = stockDetail.OutboundQuantity;
-
- foreach (var orderDetail in matchingOrderDetails)
- {
- if (remainingStock <= 0) break;
-
- if (orderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
- continue;
-
- // 璁$畻鏈鍙互鍒嗛厤鐨勬暟閲�
- decimal availableOrderQty = orderDetail.OrderQuantity - orderDetail.OverOutQuantity;
- decimal allocateQty = Math.Min(remainingStock, availableOrderQty);
-
- if (allocateQty > 0)
+ if (matchingOrderDetails.Count == 0)
{
- orderDetail.OverOutQuantity += allocateQty;
- remainingStock -= allocateQty;
+ continue;
+ }
- // 妫�鏌ユ槸鍚﹀畬鎴�
- if (Math.Abs(orderDetail.OverOutQuantity - orderDetail.OrderQuantity) < 0.001m)
+ // 璁$畻闇�瑕佸垎閰嶇殑鏁伴噺
+ decimal remainingStock = stockDetail.OutboundQuantity;
+
+ foreach (var orderDetail in matchingOrderDetails)
+ {
+ if (remainingStock <= 0) break;
+
+ if (orderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
+ continue;
+
+ // 璁$畻鏈鍙互鍒嗛厤鐨勬暟閲�
+ decimal availableOrderQty = orderDetail.OrderQuantity - orderDetail.OverOutQuantity;
+ decimal allocateQty = Math.Min(remainingStock, availableOrderQty);
+
+ if (allocateQty > 0)
{
- orderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
- overCount++;
+ orderDetail.OverOutQuantity += allocateQty;
+ remainingStock -= allocateQty;
+
+ // 妫�鏌ユ槸鍚﹀畬鎴�
+ if (Math.Abs(orderDetail.OverOutQuantity - orderDetail.OrderQuantity) < 0.001m)
+ {
+ orderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ overCount++;
+ }
}
}
}
- }
- // 鏇存柊璁㈠崟鐘舵��
- if (outboundOrder.Details.Count == overCount)
- {
- outboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
- }
- _unitOfWorkManage.BeginTran();
-
- try
- {
- // 鏇存柊鍑哄簱鍗�
- _outboundService.NewOutboundOrderService.Repository.UpdateData(outboundOrder);
-
- _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
-
-
- AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails);
-
- // 鍖哄垎鍗曟嵁鏁版嵁鏉ユ簮鏇存柊璐т綅鐘舵��
- if (outboundOrder.System == null)
+ // 鏇存柊璁㈠崟鐘舵��
+ if (outboundOrder.Details.Count == overCount)
{
- return WebResponseContent.Instance.Error("鍑哄簱鍗曟暟鎹簮涓虹┖");
+ outboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
}
+ _unitOfWorkManage.BeginTran();
- if (!outboundOrder.System.Equals("SMOM"))
+ try
{
- UpdateLocationStatus(locationInfo);
- }
+ // 鏇存柊鍑哄簱鍗�
+ _outboundService.NewOutboundOrderService.Repository.UpdateData(outboundOrder);
- // 澶勭悊浠诲姟瀹屾垚
- CompleteTask(task);
+ _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails1);
- // 娣诲姞鐘舵�佸彉鏇磋褰�
- AddStatusChangeRecord(task, stockInfo, locationInfo);
- string path = "http://fr.mankun.com:8080/webroot/decision/view/report?viewlet=fr-report\\SMOM/Product/Produce/OutBoundDetileReport.cpt&op=write&format=pdf";
- string fullPath = AppDomain.CurrentDomain.BaseDirectory;
- var url = Path.Combine(fullPath, "wwwroot", "Reports");
- string savePath = Path.Combine(url, "鏈鍑哄簱.pdf");
+ AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails1);
- // ERP绯荤粺鍙嶉
- if (outboundOrder.System.Equals("ERP"))
- {
- // 涓烘瘡涓畬鎴愮殑鏄庣粏鍙嶉ERP
- foreach (var orderDetail in outboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
+ // 鍖哄垎鍗曟嵁鏁版嵁鏉ユ簮鏇存柊璐т綅鐘舵��
+ if (outboundOrder.System == null)
{
- FeedBackOutERP(outboundOrder.OrderNo, orderDetail.LinId);
+ return WebResponseContent.Instance.Error("鍑哄簱鍗曟暟鎹簮涓虹┖");
}
- // 濡傛灉鏈夊畬鎴愮殑鏄庣粏锛屼笅杞芥姤琛�
- if (outboundOrderDetails.Any(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
+ if (!outboundOrder.System.Equals("SMOM"))
{
- DownloadReport(path, savePath, outboundOrderDetails.First().Id);
+ UpdateLocationStatus(locationInfo);
}
- }
- // 鍗曟嵁瀹屾垚鎺ㄩ�丼MOM绯荤粺
- if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.System.Equals("SMOM"))
- {
- var outStockLockInfoList = _outboundService.OutboundStockLockInfoService.Repository
- .QueryData(x => x.OrderNo == outboundOrder.OrderNo);
+ // 澶勭悊浠诲姟瀹屾垚
+ CompleteTask(task);
- if (outStockLockInfoList.Count == 0)
- throw new Exception($"璁㈠崟 {outboundOrder.OrderNo} 鎵樼洏 {stockInfo.PalletCode} 鏈壘鍒板簱瀛橀攣瀹氫俊鎭�");
+ // 娣诲姞鐘舵�佸彉鏇磋褰�
+ AddStatusChangeRecord(task, stockInfo, locationInfo);
- // 閲囪喘鍑哄簱
- if (outboundOrder.OrderType == 1)
+ string path = "http://fr.mankun.com:8080/webroot/decision/view/report?viewlet=fr-report\\SMOM/Product/Produce/OutBoundDetileReport.cpt&op=write&format=pdf";
+ string fullPath = AppDomain.CurrentDomain.BaseDirectory;
+ var url = Path.Combine(fullPath, "wwwroot", "Reports");
+ string savePath = Path.Combine(url, "鏈鍑哄簱.pdf");
+
+ // ERP绯荤粺鍙嶉
+ if (outboundOrder.System.Equals("ERP"))
{
- var passBack = new HouseoutboundPassBack
+ // 涓烘瘡涓畬鎴愮殑鏄庣粏鍙嶉ERP
+ foreach (var orderDetail in outboundOrderDetails1.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
{
- ApiType = "ShippingOrderController",
- Method = "AsrsOutboundSO",
- Parameters = new List<HouseoutboundPassBack.datas>
+ FeedBackOutERP(outboundOrder.OrderNo, orderDetail.LinId);
+ }
+
+ // 濡傛灉鏈夊畬鎴愮殑鏄庣粏锛屼笅杞芥姤琛�
+ if (outboundOrderDetails1.Any(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
+ {
+ DownloadReport(path, savePath, outboundOrderDetails1.First().Id);
+ }
+ }
+
+ //鍗曟嵁瀹屾垚鎺ㄩ�丼MOM绯荤粺
+ if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.System.Equals("SMOM"))
+ {
+ var outStockLockInfoList = _outboundService.OutboundStockLockInfoService.Repository
+ .QueryData(x => x.OrderNo == outboundOrder.OrderNo);
+
+ if (outStockLockInfoList.Count == 0)
+ throw new Exception($"璁㈠崟 {outboundOrder.OrderNo} 鎵樼洏 {stockInfo.PalletCode} 鏈壘鍒板簱瀛橀攣瀹氫俊鎭�");
+
+ // 閲囪喘鍑哄簱
+ if (outboundOrder.OrderType == 1)
+ {
+ var passBack = new HouseoutboundPassBack
+ {
+ ApiType = "ShippingOrderController",
+ Method = "AsrsOutboundSO",
+ Parameters = new List<HouseoutboundPassBack.datas>
{
new HouseoutboundPassBack.datas
{
@@ -1837,33 +1839,33 @@
}
}
}
- };
+ };
- //璋冪敤SMOM鎺ュ彛...
- var authResult = AuthenticateWithWMS();
- if (authResult.IsSuccess)
- {
- passBack.Context = new Dictionary<string, string>
+ //璋冪敤SMOM鎺ュ彛...
+ var authResult = AuthenticateWithWMS();
+ if (authResult.IsSuccess)
+ {
+ passBack.Context = new Dictionary<string, string>
{
{ "Ticket", authResult.Ticket },
{ "InvOrgId", authResult.InvOrgId }
};
- var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
- if (!response.Success)
- {
- throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
+ if (!response.Success)
+ {
+ throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
}
}
- }
- // 璋冩嫧鍑哄簱
- if (outboundOrder.OrderType == 2)
- {
- var allocate = new InventoryAllocate
+ // 璋冩嫧鍑哄簱
+ if (outboundOrder.OrderType == 2)
{
- ApiType = "InventoryAllocateController",
- Method = "AsrsFinishedStockCount",
- Parameters = new List<Allocate>
+ var allocate = new InventoryAllocate
+ {
+ ApiType = "InventoryAllocateController",
+ Method = "AsrsFinishedStockCount",
+ Parameters = new List<Allocate>
{
new Allocate
{
@@ -1894,38 +1896,271 @@
}
}
}
- };
+ };
- // 璋冪敤SMOM鎺ュ彛...
- var authResult = AuthenticateWithWMS();
- if (authResult.IsSuccess)
- {
- allocate.Context = new Dictionary<string, string>
+ // 璋冪敤SMOM鎺ュ彛...
+ var authResult = AuthenticateWithWMS();
+ if (authResult.IsSuccess)
+ {
+ allocate.Context = new Dictionary<string, string>
{
{ "Ticket", authResult.Ticket },
{ "InvOrgId", authResult.InvOrgId }
};
- var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
- if (!response.Success)
+ var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ if (!response.Success)
+ {
+ throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ }
+ }
+ }
+
+ if (outboundOrder.OrderType == 240) // 鐩樼偣鍑哄簱
+ {
+ // 鐩樼偣鍑哄簱鐗规畩澶勭悊閫昏緫
+ }
+
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK();
+ }
+ catch
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw;
+ }
+ }
+ else
+ {
+ foreach (var stockDetail in stockInfoDetails)
+ {
+ var matchingOrderDetails = outboundOrderDetails
+ .Where(x => x.MaterielCode == stockDetail.MaterielCode &&
+ x.BatchNo == stockDetail.BatchNo)
+ .ToList();
+
+ if (matchingOrderDetails.Count == 0)
+ {
+ continue;
+ }
+
+ // 璁$畻闇�瑕佸垎閰嶇殑鏁伴噺
+ decimal remainingStock = stockDetail.OutboundQuantity;
+
+ foreach (var orderDetail in matchingOrderDetails)
+ {
+ if (remainingStock <= 0) break;
+
+ if (orderDetail.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt())
+ continue;
+
+ // 璁$畻鏈鍙互鍒嗛厤鐨勬暟閲�
+ decimal availableOrderQty = orderDetail.OrderQuantity - orderDetail.OverOutQuantity;
+ decimal allocateQty = Math.Min(remainingStock, availableOrderQty);
+
+ if (allocateQty > 0)
+ {
+ orderDetail.OverOutQuantity += allocateQty;
+ remainingStock -= allocateQty;
+
+ // 妫�鏌ユ槸鍚﹀畬鎴�
+ if (Math.Abs(orderDetail.OverOutQuantity - orderDetail.OrderQuantity) < 0.001m)
{
- throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ orderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ overCount++;
}
}
}
}
-
- if (outboundOrder.OrderType == 240) // 鐩樼偣鍑哄簱
+ // 鏇存柊璁㈠崟鐘舵��
+ if (outboundOrder.Details.Count == overCount)
{
- // 鐩樼偣鍑哄簱鐗规畩澶勭悊閫昏緫
+ outboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
}
+ _unitOfWorkManage.BeginTran();
- _unitOfWorkManage.CommitTran();
- return WebResponseContent.Instance.OK();
- }
- catch
+ try
+ {
+ // 鏇存柊鍑哄簱鍗�
+ _outboundService.NewOutboundOrderService.Repository.UpdateData(outboundOrder);
+
+ _outboundService.NewOutboundOrderDetailService.Repository.UpdateData(outboundOrderDetails);
+
+
+ AddCPRetrueOrder(stockInfo, outboundOrder, outboundOrderDetails);
+
+ // 鍖哄垎鍗曟嵁鏁版嵁鏉ユ簮鏇存柊璐т綅鐘舵��
+ if (outboundOrder.System == null)
+ {
+ return WebResponseContent.Instance.Error("鍑哄簱鍗曟暟鎹簮涓虹┖");
+ }
+
+ if (!outboundOrder.System.Equals("SMOM"))
+ {
+ UpdateLocationStatus(locationInfo);
+ }
+
+ // 澶勭悊浠诲姟瀹屾垚
+ CompleteTask(task);
+
+ // 娣诲姞鐘舵�佸彉鏇磋褰�
+ AddStatusChangeRecord(task, stockInfo, locationInfo);
+
+ string path = "http://fr.mankun.com:8080/webroot/decision/view/report?viewlet=fr-report\\SMOM/Product/Produce/OutBoundDetileReport.cpt&op=write&format=pdf";
+ string fullPath = AppDomain.CurrentDomain.BaseDirectory;
+ var url = Path.Combine(fullPath, "wwwroot", "Reports");
+ string savePath = Path.Combine(url, "鏈鍑哄簱.pdf");
+
+ // ERP绯荤粺鍙嶉
+ if (outboundOrder.System.Equals("ERP"))
+ {
+ // 涓烘瘡涓畬鎴愮殑鏄庣粏鍙嶉ERP
+ foreach (var orderDetail in outboundOrderDetails.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
+ {
+ FeedBackOutERP(outboundOrder.OrderNo, orderDetail.LinId);
+ }
+
+ // 濡傛灉鏈夊畬鎴愮殑鏄庣粏锛屼笅杞芥姤琛�
+ if (outboundOrderDetails.Any(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()))
+ {
+ DownloadReport(path, savePath, outboundOrderDetails.First().Id);
+ }
+ }
+
+ //鍗曟嵁瀹屾垚鎺ㄩ�丼MOM绯荤粺
+ if (outboundOrder.OrderStatus == OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.System.Equals("SMOM"))
+ {
+ var outStockLockInfoList = _outboundService.OutboundStockLockInfoService.Repository
+ .QueryData(x => x.OrderNo == outboundOrder.OrderNo);
+
+ if (outStockLockInfoList.Count == 0)
+ throw new Exception($"璁㈠崟 {outboundOrder.OrderNo} 鎵樼洏 {stockInfo.PalletCode} 鏈壘鍒板簱瀛橀攣瀹氫俊鎭�");
+
+ // 閲囪喘鍑哄簱
+ if (outboundOrder.OrderType == 1)
+ {
+ var passBack = new HouseoutboundPassBack
+ {
+ ApiType = "ShippingOrderController",
+ Method = "AsrsOutboundSO",
+ Parameters = new List<HouseoutboundPassBack.datas>
+ {
+ new HouseoutboundPassBack.datas
{
- _unitOfWorkManage.RollbackTran();
- throw;
+ Value = new List<HouseoutboundPassBack.datas.data1>
+ {
+ new HouseoutboundPassBack.datas.data1
+ {
+ No = outboundOrder.OrderNo,
+ OutWareHouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ DetailList = outStockLockInfoList.Select(d => new HouseoutboundPassBack.datas.data1.Inbound
+ {
+ LinId = d.LinId?? "",
+ LPN_No = d.PalletCode,
+ MaterielCode = d.MaterielCode?? "",
+ OrderQuantity = d.OrderQuantity,
+ BatchNo = d.BatchNo,
+ FinishQty = d.OrderQuantity,
+ LocationName = d.LocationCode
+ })
+ .ToList()
+ }
+ }
+ }
+ }
+ };
+
+ //璋冪敤SMOM鎺ュ彛...
+ var authResult = AuthenticateWithWMS();
+ if (authResult.IsSuccess)
+ {
+ passBack.Context = new Dictionary<string, string>
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
+ var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskout, passBack, "绔嬪簱鍑哄簱鏁伴噺鍥炰紶WMS");
+ if (!response.Success)
+ {
+ throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ }
+ }
+
+ // 璋冩嫧鍑哄簱
+ if (outboundOrder.OrderType == 2)
+ {
+ var allocate = new InventoryAllocate
+ {
+ ApiType = "InventoryAllocateController",
+ Method = "AsrsFinishedStockCount",
+ Parameters = new List<Allocate>
+ {
+ new Allocate
+ {
+ Value = new List<Allocate.data1>
+ {
+ new Allocate.data1
+ {
+ No = outboundOrder.OrderNo,
+ InWarehouse = task.Roadway,
+ TransactionCode = outboundOrder.TransactionCode,
+ InoutType = outboundOrder.OrderType,
+ OrderType = outboundOrder.InoutType,
+ ActiveType = 2,
+ DetailList = outStockLockInfoList.Select(item =>
+ {
+ return new Allocate.data1.Inventory
+ {
+ LinId = item.LinId,
+ LPNNo = item.PalletCode,
+ MaterielCode = item.MaterielCode,
+ OrderQuantity = item.OrderQuantity,
+ BatchNo = item.BatchNo,
+ FinishQty = item.OrderQuantity,
+ LocationName = task.SourceAddress
+ };
+ }).ToList()
+ }
+ }
+ }
+ }
+ };
+
+ // 璋冪敤SMOM鎺ュ彛...
+ var authResult = AuthenticateWithWMS();
+ if (authResult.IsSuccess)
+ {
+ allocate.Context = new Dictionary<string, string>
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+ };
+ var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, allocate, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ if (!response.Success)
+ {
+ throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+ }
+ }
+ }
+
+ if (outboundOrder.OrderType == 240) // 鐩樼偣鍑哄簱
+ {
+ // 鐩樼偣鍑哄簱鐗规畩澶勭悊閫昏緫
+ }
+
+ _unitOfWorkManage.CommitTran();
+ return WebResponseContent.Instance.OK();
+ }
+ catch
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw;
+ }
}
}
catch (Exception ex)
--
Gitblit v1.9.3