From e4a391c581aaca1fa7b0239bc96375d0c0cb8de6 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期三, 04 二月 2026 08:55:49 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderService.cs | 144 ++++++-
WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs | 1
WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs | 4
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs | 14
WMS/WIDESEA_WMSServer/WIDESEA_Common/NewHouseInboundPassBack.cs | 89 ++++
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 422 ++++++++++++++---------
WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs | 11
WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs | 220 ++++++------
WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_CPInboundOrderDetail.cs | 6
WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/OrderEnum.cs | 12
WMS/WIDESEA_WMSServer/WIDESEA_Common/HouseInbound.cs | 19
WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs | 81 ++--
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs | 1
WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_StockInfoDetailCP.cs | 8
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs | 48 ++
15 files changed, 721 insertions(+), 359 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Common/HouseInbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Common/HouseInbound.cs
index 39eaeae..26ef5e0 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_Common/HouseInbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Common/HouseInbound.cs
@@ -31,8 +31,11 @@
/// <summary>
/// 鍑哄叆搴撶被鍨�
/// </summary>
- public int InoutType { get; set; }
-
+ public decimal InoutType { get; set; }
+ /// <summary>
+ /// 鍒涘缓鑰�
+ /// </summary>
+ public string CreateBy { get; set; }
/// <summary>
/// 鎺ㄥ崟绯荤粺
/// </summary>
@@ -88,7 +91,7 @@
public class BoxList
{
- public float BoxId { get; set; }
+ public double BoxId { get; set; }
public string BoxCode { get; set; }
@@ -96,10 +99,14 @@
public string PartNum { get; set; }
- public float JobId { get; set; }
+ public decimal JobId { get; set; }
- public float QtyOfpcs { get; set; }
+ public decimal QtyOfpcs { get; set; }
- public float QtyOfxout { get; set; }
+ public decimal QtyOfxout { get; set; }
+
+ public string LPNNO { get; set; }
+
+ public string OrinalLocation { get; set; }
}
}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Common/NewHouseInboundPassBack.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Common/NewHouseInboundPassBack.cs
new file mode 100644
index 0000000..0354952
--- /dev/null
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Common/NewHouseInboundPassBack.cs
@@ -0,0 +1,89 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static WIDESEA_Common.NewHouseInboundPassBack.Parame.Syncretism;
+
+namespace WIDESEA_Common
+{
+ public class NewHouseInboundPassBack
+ {
+
+
+
+ public List<Parame> Parameters = new List<Parame>();
+ public string ApiType { get; set; }
+ public string Method { get; set; }
+ public Dictionary<string, string> Context { get; set; }
+ public class Parame
+ {
+ public Syncretism Value = new Syncretism();
+
+ public class Syncretism
+ {
+
+ public string OrderNo { get; set; }
+
+ public List<details> Details = new List<details>();
+
+ public class details
+ {
+ /// <summary>
+ /// 鍘熷LPN
+ /// </summary>
+ public string Lpn { get; set; }
+
+ /// <summary>
+ /// 绉诲簱鍗曠被鍨�
+ /// </summary>
+ public int MoveType { get; set; }
+ /// <summary>
+ /// 浠撳簱 (鍙戣揣浠撳簱)
+ /// </summary>
+ public string WareHouseCode { get; set; }
+
+ /// <summary>
+ /// 鐗╂枡缂栫爜
+ /// </summary>
+ public string ItemCode { get; set; }
+ /// <summary>
+ /// 绉诲簱鏁伴噺
+ /// </summary>
+ public decimal MoveNumber { get; set; }
+ /// <summary>
+ /// 鐗╂枡鎵规
+ /// </summary>
+ public string LotNo { get; set; }
+ /// <summary>
+ /// 鐢熶骇鎵规
+ /// </summary>
+
+ public string WipBatch { get; set; }
+
+
+ /// <summary>
+ /// 鏉ユ簮搴撲綅
+ /// </summary>
+ public string LocationName { get; set; }
+
+
+ /// <summary>
+ /// 鐩爣搴撲綅
+ /// </summary>
+
+ public string TargetLocName { get; set; }
+
+ /// <summary>
+ /// 鐩爣LPN
+ /// </summary>
+
+ public string TargetLpn { get; set; }
+ }
+
+
+ }
+ }
+
+ }
+}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/OrderEnum.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/OrderEnum.cs
index 0ba2f05..62d4154 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/OrderEnum.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/OrderEnum.cs
@@ -225,6 +225,12 @@
/// </summary>
[Description("鐢熶骇鍏ュ簱鍗�")]
works = 2,
+
+ /// <summary>
+ /// 璋冩嫧鍑哄簱鍗�
+ /// </summary>
+ [Description("璋冩嫧鍑哄簱鍗�")]
+ Allocate = 4,
/// <summary>
/// 鐢熶骇杩斿伐鍗�
/// </summary>
@@ -243,11 +249,7 @@
[Description("閲囪喘閫�璐у崟")]
ProcureReturn = 210,
- /// <summary>
- /// 璋冩嫧鍑哄簱鍗�
- /// </summary>
- [Description("璋冩嫧鍑哄簱鍗�")]
- Allocate = 215,
+
/// <summary>
/// 閿�鍞嚭搴撳崟
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs
index 1835fd5..ca6844a 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_IOutboundService/IOutboundOrderService.cs
@@ -20,6 +20,7 @@
WebResponseContent CancelOut(HouseCancelOut houseCancelOut);
+ WebResponseContent NewCancelOut(HouseCancelOut houseCancelOut);
WebResponseContent Save(OutboundOrderAddDTO orderAddDTO);
WebResponseContent GetCodeByWarehouse(int warehouseId);
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
index a30fa86..032d583 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -553,7 +553,7 @@
/// <param name="materielGroupDTO"></param>
/// <returns></returns>
#region
- public WebResponseContent CP1MaterielGroup(SaveModel saveModel)
+ public WebResponseContent CPMaterielGroup(SaveModel saveModel)
{
WebResponseContent content = new WebResponseContent();
try
@@ -762,6 +762,8 @@
QtyOfpcs = item.QtyOfpcs,
QtyOfxout = item.QtyOfxout,
CPStockDetailStatus = (int)StockStatusEmun.缁勭洏鏆傚瓨,
+ LPNNO = item.LPNNO,
+ OrinalLocation = item.OrinalLocation,
Creater = "涓婃父WMS",
};
stockInfoDetailCP.Add(stockInfoDetailCP1);
@@ -854,7 +856,7 @@
#endregion
- public WebResponseContent CPMaterielGroup(SaveModel saveModel)
+ public WebResponseContent CP1MaterielGroup(SaveModel saveModel)
{
WebResponseContent content = new WebResponseContent();
try
@@ -1127,6 +1129,7 @@
}
public string ReceiveWMSTaskin = WIDESEA_Core.Helper.AppSettings.Configuration["ReceiveWMSTaskin"];
+
/// <summary>
/// 缁勭洏鍚堟墭
/// </summary>
@@ -1407,10 +1410,6 @@
}
if (warehouse.WarehouseCode.Contains("CP"))
{
- if (item.SupplierBatch == null)
- {
- return content.Error("渚涘簲鍟嗘壒娆′笉鍙负绌�");
- }
Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First();
if (inboundOrderOld != null)
@@ -1442,6 +1441,8 @@
QtyOfpcs = (float)list.QtyOfpcs,
QtyOfxout = (float)list.QtyOfxout,
CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
+ LPNNO = list.LPNNO,
+ OrinalLocation = list.OrinalLocation,
Creater = "涓婃父WMS",
};
cPInboundOrderDetail.Add(cPInboundOrderDetail1);
@@ -1484,6 +1485,8 @@
QtyOfpcs = (float)list.QtyOfpcs,
QtyOfxout = (float)list.QtyOfxout,
CPOrderDetailStatus = OrderDetailStatusEnum.New.ObjToInt(),
+ LPNNO = list.LPNNO,
+ OrinalLocation = list.OrinalLocation,
Creater = "涓婃父WMS",
};
cPInboundOrderDetail.Add(cPInboundOrderDetail1);
@@ -1506,7 +1509,6 @@
OrinalLocation = item.OrinalLocation,
CPDetails = cPInboundOrderDetail
};
-
Dt_InboundOrder inboundOrder = new Dt_InboundOrder()
{
OrderNo = model.AsnNo,
@@ -1544,10 +1546,10 @@
}
else
{
- if (item.SupplierBatch == null)
- {
- return content.Error("渚涘簲鍟嗘壒娆′笉鍙负绌�");
- }
+ //if (item.SupplierBatch == null)
+ //{
+ // return content.Error("渚涘簲鍟嗘壒娆′笉鍙负绌�");
+ //}
Dt_InboundOrder inboundOrderOld = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == model.AsnNo).Includes(x => x.Details).First();
if (inboundOrderOld != null)
@@ -1974,119 +1976,119 @@
_unitOfWorkManage.BeginTran();
foreach (var item in houseReturnOrder)
{
- int randomNum = random.Next(1, 1000);
- string datePart = DateTime.Now.ToString("yyyyMMdd");
- Dt_ReturnOrder returnOrder = _returnOrderRepository.QueryFirst(x => x.LPNNo == item.LPNNo && x.OrderStatus == InOrderStatusEnum.鏈紑濮�.ObjToInt());
- if (returnOrder == null)
- {
- Dt_ReturnOrder newReturnOrder = new Dt_ReturnOrder
+ int randomNum = random.Next(1, 1000);
+ string datePart = DateTime.Now.ToString("yyyyMMdd");
+ Dt_ReturnOrder returnOrder = _returnOrderRepository.QueryFirst(x => x.LPNNo == item.LPNNo && x.OrderStatus == InOrderStatusEnum.鏈紑濮�.ObjToInt());
+ if (returnOrder == null)
{
- OrderType = OrderTypeEnum.鍙嶆嫞鍥炲簱鍗�.ObjToInt(),
- MaterielCode = item.MaterielCode,
- MaterielName = item.MaterielName,
+ Dt_ReturnOrder newReturnOrder = new Dt_ReturnOrder
+ {
+ OrderType = OrderTypeEnum.鍙嶆嫞鍥炲簱鍗�.ObjToInt(),
+ MaterielCode = item.MaterielCode,
+ MaterielName = item.MaterielName,
MaterieSpec = item.MaterieSpec,
- BatchNo = item.BatchNo,
- OrderQuantity = item.OrderQuantity,
+ BatchNo = item.BatchNo,
+ OrderQuantity = item.OrderQuantity,
Remark = item.Remark,
- LinId = item.LinId,
- LPNNo = item.LPNNo,
+ LinId = item.LinId,
+ LPNNo = item.LPNNo,
LocationCode = item.LocationCode,
WarehouseCode = item.WarehouseCode,
System = item.System,
- OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
- Creater = "SMOM",
- CreateDate = DateTime.Now
- };
- _returnOrderRepository.AddData(newReturnOrder);
- Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo, Dt_StockInfoDetail>((stock, detail) => stock.Id == detail.StockId).Where((stock, detail) => stock.PalletCode == item.LPNNo && stock.LocationCode == item.LocationCode).First();
- Dt_OutboundOrderDetail outboundOrderDetail = new Dt_OutboundOrderDetail();
- Dt_OutboundOrder outboundOrder = new Dt_OutboundOrder();
- if (stockInfo == null)
- {
- Dt_Warehouse warehouse = _warehouseService.Repository.QueryData(x => x.WarehouseCode == item.WarehouseCode).FirstOrDefault();
- if (warehouse == null)
- {
- return WebResponseContent.Instance.Error($"璇ヤ粨搴撶紪鍙穥item.WarehouseCode}鏈厤缃�");
- }
- Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail
- {
- MaterielCode = item.MaterielCode,
- MaterielName = item.MaterielName,
- MaterieSpec = item.MaterieSpec,
- BatchNo = item.BatchNo,
- LinId = item.LinId,
- Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+ OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
Creater = "SMOM",
- CreateDate = DateTime.Now,
- OrderNo = newReturnOrder.OrderNo,
- StockQuantity = item.OrderQuantity,
+ CreateDate = DateTime.Now
};
- Dt_StockInfo stockInfo1 = new Dt_StockInfo
- {
- PalletCode = item.LPNNo,
- WarehouseId = warehouse.WarehouseId,
- BatchNo = item.BatchNo,
- PalletType = GetPalletType(warehouse, item.LPNNo),
- IsFull = true,
- StockStatus = (int)StockStatusEmun.鍙嶆嫞鍏ュ簱,
- Creater = "WMS",
- CreateDate = DateTime.Now,
- MaterialType = (int)InventoryMaterialType.鍘熸潗鏂�,
- Materialweight = 0,
- Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
- Mgeneratetime = DateTime.Now,
- Details = new List<Dt_StockInfoDetail> { stockInfoDetail }
- };
- Db.InsertNav(stockInfo1).Include(x => x.Details).ExecuteCommand();
+ _returnOrderRepository.AddData(newReturnOrder);
+ Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo, Dt_StockInfoDetail>((stock, detail) => stock.Id == detail.StockId).Where((stock, detail) => stock.PalletCode == item.LPNNo && stock.LocationCode == item.LocationCode).First();
+ Dt_OutboundOrderDetail outboundOrderDetail = new Dt_OutboundOrderDetail();
+ Dt_OutboundOrder outboundOrder = new Dt_OutboundOrder();
+ if (stockInfo == null)
+ {
+ Dt_Warehouse warehouse = _warehouseService.Repository.QueryData(x => x.WarehouseCode == item.WarehouseCode).FirstOrDefault();
+ if (warehouse == null)
+ {
+ return WebResponseContent.Instance.Error($"璇ヤ粨搴撶紪鍙穥item.WarehouseCode}鏈厤缃�");
+ }
+ Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail
+ {
+ MaterielCode = item.MaterielCode,
+ MaterielName = item.MaterielName,
+ MaterieSpec = item.MaterieSpec,
+ BatchNo = item.BatchNo,
+ LinId = item.LinId,
+ Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+ Creater = "SMOM",
+ CreateDate = DateTime.Now,
+ OrderNo = newReturnOrder.OrderNo,
+ StockQuantity = item.OrderQuantity,
+ };
+ Dt_StockInfo stockInfo1 = new Dt_StockInfo
+ {
+ PalletCode = item.LPNNo,
+ WarehouseId = warehouse.WarehouseId,
+ BatchNo = item.BatchNo,
+ PalletType = GetPalletType(warehouse, item.LPNNo),
+ IsFull = true,
+ StockStatus = (int)StockStatusEmun.鍙嶆嫞鍏ュ簱,
+ Creater = "WMS",
+ CreateDate = DateTime.Now,
+ MaterialType = (int)InventoryMaterialType.鍘熸潗鏂�,
+ Materialweight = 0,
+ Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
+ Mgeneratetime = DateTime.Now,
+ Details = new List<Dt_StockInfoDetail> { stockInfoDetail }
+ };
+ Db.InsertNav(stockInfo1).Include(x => x.Details).ExecuteCommand();
+ }
+ else
+ {
+ outboundOrderDetail = new Dt_OutboundOrderDetail
+ {
+ MaterielCode = item.MaterielCode,
+ MaterielName = item.MaterielName,
+ MaterieSpec = item.MaterieSpec,
+ BatchNo = item.BatchNo,
+ OrderQuantity = stockInfo.Details.Sum(x => x.StockQuantity),
+ Remark = item.Remark,
+ LinId = item.LinId,
+ LPNNo = item.LPNNo,
+ Creater = "SMOM",
+ CreateDate = DateTime.Now,
+ LocationName = item.LocationCode
+ };
+ outboundOrder = new Dt_OutboundOrder
+ {
+ OrderNo = "FJCK" + $"{datePart}{randomNum}",
+ UpperOrderNo = "WMSFJCK" + $"{datePart}{randomNum}",
+ OrderStatus = OutOrderStatusEnum.鏈紑濮�.ObjToInt(),
+ OrderType = OrderTypeEnum.鍙嶆嫞鍑哄簱鍗�.ObjToInt(),
+ InoutType = InoutTypeEnum.OtherOut.ToString(),
+ System = item.System,
+ Creater = "SMOM",
+ CreateDate = DateTime.Now,
+ CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(),
+ Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail }
+ };
+ Db.InsertNav(outboundOrder).Include(x => x.Details).ExecuteCommand();
+ }
+
}
else
{
- outboundOrderDetail = new Dt_OutboundOrderDetail
- {
- MaterielCode = item.MaterielCode,
- MaterielName = item.MaterielName,
- MaterieSpec = item.MaterieSpec,
- BatchNo = item.BatchNo,
- OrderQuantity = stockInfo.Details.Sum(x => x.StockQuantity),
- Remark = item.Remark,
- LinId = item.LinId,
- LPNNo = item.LPNNo,
- Creater = "SMOM",
- CreateDate = DateTime.Now,
- LocationName = item.LocationCode
- };
- outboundOrder = new Dt_OutboundOrder
- {
- OrderNo = "FJCK" + $"{datePart}{randomNum}",
- UpperOrderNo = "WMSFJCK" + $"{datePart}{randomNum}",
- OrderStatus = OutOrderStatusEnum.鏈紑濮�.ObjToInt(),
- OrderType = OrderTypeEnum.鍙嶆嫞鍑哄簱鍗�.ObjToInt(),
- InoutType = InoutTypeEnum.OtherOut.ToString(),
- System = item.System,
- Creater = "SMOM",
- CreateDate = DateTime.Now,
- CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(),
- Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail }
- };
- Db.InsertNav(outboundOrder).Include(x => x.Details).ExecuteCommand();
- }
-
- }
- else
- {
- Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo, Dt_StockInfoDetail>((stock, detail) => stock.Id == detail.StockId).Where((stock, detail) => stock.PalletCode == item.LPNNo && stock.StockStatus == StockStatusEmun.浣欐枡閫�搴�.ObjToInt()).First();
- stockInfo.StockStatus = StockStatusEmun.鍙嶆嫞鍏ュ簱.ObjToInt();
- returnOrder.LinId = item.LinId;
+ Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo, Dt_StockInfoDetail>((stock, detail) => stock.Id == detail.StockId).Where((stock, detail) => stock.PalletCode == item.LPNNo && stock.StockStatus == StockStatusEmun.浣欐枡閫�搴�.ObjToInt()).First();
+ stockInfo.StockStatus = StockStatusEmun.鍙嶆嫞鍏ュ簱.ObjToInt();
+ returnOrder.LinId = item.LinId;
returnOrder.System = item.System;
returnOrder.WarehouseCode = item.WarehouseCode;
returnOrder.LocationCode = item.LocationCode;
- returnOrder.OrderType = OrderTypeEnum.鍙嶆嫞鍥炲簱鍗�.ObjToInt();
- returnOrder.OrderQuantity += item.OrderQuantity;
- returnOrder.ReceiptQuantity += item.OrderQuantity;
- _returnOrderRepository.UpdateData(returnOrder);
- _stockRepository.StockInfoRepository.UpdateData(stockInfo);
+ returnOrder.OrderType = OrderTypeEnum.鍙嶆嫞鍥炲簱鍗�.ObjToInt();
+ returnOrder.OrderQuantity += item.OrderQuantity;
+ returnOrder.ReceiptQuantity += item.OrderQuantity;
+ _returnOrderRepository.UpdateData(returnOrder);
+ _stockRepository.StockInfoRepository.UpdateData(stockInfo);
- }
+ }
}
_unitOfWorkManage.CommitTran();
return WebResponseContent.Instance.OK();
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_CPInboundOrderDetail.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_CPInboundOrderDetail.cs
index d7bb39c..ff1c2ac 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_CPInboundOrderDetail.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Inbound/Dt_CPInboundOrderDetail.cs
@@ -40,5 +40,11 @@
[SugarColumn(IsNullable = false, ColumnDescription = "鐘舵��")]
public int CPOrderDetailStatus { get; set; }
+
+ [SugarColumn(IsNullable = true, ColumnDescription = "LPNNO")]
+ public string LPNNO { get; set; }
+
+ [SugarColumn(IsNullable = true, ColumnDescription = "WMS婧愬簱浣�")]
+ public string OrinalLocation { get; set; }
}
}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_StockInfoDetailCP.cs b/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_StockInfoDetailCP.cs
index d661863..3a09602 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_StockInfoDetailCP.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/Dt_StockInfoDetailCP.cs
@@ -40,6 +40,12 @@
[SugarColumn(IsNullable = false, ColumnDescription = "鐘舵��")]
public int CPStockDetailStatus { get; set; }
-
+
+ [SugarColumn(IsNullable = true, ColumnDescription = "LPNNO")]
+ public string LPNNO { get; set; }
+
+ [SugarColumn(IsNullable = true, ColumnDescription = "WMS婧愬簱浣�")]
+ public string OrinalLocation { get; set; }
+
}
}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderService.cs
index 4d77cb4..1fa3a06 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Base/OutboundOrderService.cs
@@ -187,6 +187,7 @@
return WebResponseContent.Instance.Error("姝ゅ崟鎹凡寮�濮嬫墽琛岋紝涓嶅厑璁稿彇娑�");
}
oldOutboundOrder.OrderStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
+ _unitOfWorkManage.BeginTran();
BaseDal.UpdateData(oldOutboundOrder);
Dt_OutboundOrder_Hty inboundOrder_Hty = new Dt_OutboundOrder_Hty
@@ -223,31 +224,134 @@
}
BaseDal.DeleteData(oldOutboundOrder);
}
- Dt_NewOutboundOrder dt_NewOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.OrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First();
- if (dt_NewOutboundOrder == null)
- {
- return WebResponseContent.Instance.Error("鏈壘鍒版鍑哄簱鍗曟嵁");
- }
- if (dt_NewOutboundOrder != null)
- {
+ _unitOfWorkManage.CommitTran();
+ //Dt_NewOutboundOrder dt_NewOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.OrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First();
+ //if (dt_NewOutboundOrder == null)
+ //{
+ // return WebResponseContent.Instance.Error("鏈壘鍒版鍑哄簱鍗曟嵁");
+ //}
+ //if (dt_NewOutboundOrder != null)
+ //{
- if (dt_NewOutboundOrder.OrderStatus > OutOrderStatusEnum.鏈紑濮�.ObjToInt())
- {
- return WebResponseContent.Instance.Error("姝ゅ崟鎹凡寮�濮嬫墽琛岋紝涓嶅厑璁稿彇娑�");
- }
- List<Dt_NewOutboundOrderDetail> newOutboundOrderDetail = BaseDal.Db.Queryable<Dt_NewOutboundOrderDetail>().Where(x => x.OrderId == dt_NewOutboundOrder.Id).ToList();
- dt_NewOutboundOrder.OrderStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
- foreach (var item in newOutboundOrderDetail)
- {
- item.OrderDetailStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
- }
- _newOutboundOrderService.UpdateData(dt_NewOutboundOrder);
- _newOutboundOrderDetailService.UpdateData(newOutboundOrderDetail);
- }
+ // if (dt_NewOutboundOrder.OrderStatus > OutOrderStatusEnum.鏈紑濮�.ObjToInt())
+ // {
+ // return WebResponseContent.Instance.Error("姝ゅ崟鎹凡寮�濮嬫墽琛岋紝涓嶅厑璁稿彇娑�");
+ // }
+ // List<Dt_NewOutboundOrderDetail> newOutboundOrderDetail = BaseDal.Db.Queryable<Dt_NewOutboundOrderDetail>().Where(x => x.OrderId == dt_NewOutboundOrder.Id).ToList();
+ // dt_NewOutboundOrder.OrderStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
+ // foreach (var item in newOutboundOrderDetail)
+ // {
+ // item.OrderDetailStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
+ // }
+ // _newOutboundOrderService.UpdateData(dt_NewOutboundOrder);
+ // _newOutboundOrderDetailService.UpdateData(newOutboundOrderDetail);
+ //}
content = WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
+ content = WebResponseContent.Instance.Error(ex.Message);
+ }
+ finally
+ {
+
+ }
+ return content;
+ }
+
+
+ /// <summary>
+ /// 鎴愬搧鍑哄簱鍗曟嵁鍙栨秷
+ /// </summary>
+ /// <param name="houseCancelOut"></param>
+ /// <returns></returns>
+ public WebResponseContent NewCancelOut(HouseCancelOut houseCancelOut)
+ {
+ WebResponseContent content = new();
+ try
+ {
+ OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO();
+ orderAddDTO1.OrderNo = houseCancelOut.No;
+ orderAddDTO1.Details = houseCancelOut.DetailList.DicToIEnumerable<OutboundOrderDetailAddDTO>();
+ Dt_NewOutboundOrder? oldOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.OrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First();
+ if (oldOutboundOrder == null)
+ {
+ return WebResponseContent.Instance.Error("鏈壘鍒版鍑哄簱鍗曟嵁");
+ }
+ if (oldOutboundOrder != null)
+ {
+ Dt_NewOutboundOrderDetail OutboundOrderDetail = BaseDal.Db.Queryable<Dt_NewOutboundOrderDetail>().Where(x => x.OrderId == oldOutboundOrder.Id).First();
+
+ if (oldOutboundOrder.OrderStatus > OutOrderStatusEnum.鏈紑濮�.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error("姝ゅ崟鎹凡寮�濮嬫墽琛岋紝涓嶅厑璁稿彇娑�");
+ }
+ oldOutboundOrder.OrderStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
+ _unitOfWorkManage.BeginTran();
+ _newOutboundOrderService.UpdateData(oldOutboundOrder);
+
+ Dt_OutboundOrder_Hty inboundOrder_Hty = new Dt_OutboundOrder_Hty
+ {
+ OrderStatus = oldOutboundOrder.OrderStatus,
+ CreateType = oldOutboundOrder.CreateType,
+ //SourceId = oldOutboundOrder.SourceId,
+ UpperOrderNo = oldOutboundOrder.UpperOrderNo,
+ OrderNo = oldOutboundOrder.OrderNo,
+ OutWareHouse = oldOutboundOrder.OutWareHouse,
+ TransactionCode = oldOutboundOrder.TransactionCode,
+ InoutType = oldOutboundOrder.InoutType,
+ OrderType = oldOutboundOrder.OrderType,
+ Creater = "WMS",
+ CreateDate = DateTime.Now,
+ };
+ _outboundOrder_HtyService.AddData(inboundOrder_Hty);
+
+ foreach (var item in oldOutboundOrder.Details)
+ {
+ Dt_OutboundOrderDetail_Hty dt_InboundOrderDetail_Hty = new Dt_OutboundOrderDetail_Hty
+ {
+ OrderId = OutboundOrderDetail.OrderId,
+ MaterielCode = OutboundOrderDetail.MaterielCode,
+ MaterielName = OutboundOrderDetail.MaterielName,
+ BatchNo = OutboundOrderDetail.BatchNo,
+ OrderQuantity = OutboundOrderDetail.OrderQuantity,
+ OrderDetailStatus = OutboundOrderDetail.OrderDetailStatus,
+ Creater = "WMS",
+ CreateDate = DateTime.Now,
+ };
+ _outboundOrderDetail_HtyService.AddData(dt_InboundOrderDetail_Hty);
+ _newOutboundOrderDetailService.DeleteData(item);
+ }
+ _newOutboundOrderService.DeleteData(oldOutboundOrder);
+ }
+ _unitOfWorkManage.CommitTran();
+ //Dt_NewOutboundOrder dt_NewOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.OrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First();
+ //if (dt_NewOutboundOrder == null)
+ //{
+ // return WebResponseContent.Instance.Error("鏈壘鍒版鍑哄簱鍗曟嵁");
+ //}
+ //if (dt_NewOutboundOrder != null)
+ //{
+
+ // if (dt_NewOutboundOrder.OrderStatus > OutOrderStatusEnum.鏈紑濮�.ObjToInt())
+ // {
+ // return WebResponseContent.Instance.Error("姝ゅ崟鎹凡寮�濮嬫墽琛岋紝涓嶅厑璁稿彇娑�");
+ // }
+ // List<Dt_NewOutboundOrderDetail> newOutboundOrderDetail = BaseDal.Db.Queryable<Dt_NewOutboundOrderDetail>().Where(x => x.OrderId == dt_NewOutboundOrder.Id).ToList();
+ // dt_NewOutboundOrder.OrderStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
+ // foreach (var item in newOutboundOrderDetail)
+ // {
+ // item.OrderDetailStatus = OutboundStatusEnum.鍙栨秷.ObjToInt();
+ // }
+ // _newOutboundOrderService.UpdateData(dt_NewOutboundOrder);
+ // _newOutboundOrderDetailService.UpdateData(newOutboundOrderDetail);
+ //}
+ content = WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
content = WebResponseContent.Instance.Error(ex.Message);
}
finally
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
index c5d66e5..8690286 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_OutboundService/Service/NewOutboundOrderDetailService.cs
@@ -64,7 +64,7 @@
foreach (var stockInfoDetail in dt_StockInfoDetails)
{
dt_StockInfo = _stockService.StockInfoService.Repository.QueryFirst(x => x.Id == stockInfoDetail.StockId && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt());
- if (dt_StockInfo != null)
+ if (dt_StockInfo != null && !PalletCodes.Any(x => x == dt_StockInfo.PalletCode))
{
PalletCodes.Add(dt_StockInfo.PalletCode);
}
@@ -127,7 +127,7 @@
decimal needQuantity = originalNeedQuantity - item.LockQuantity;
- item.LockQuantity += needQuantity - residueQuantity.NewNeendQuantity;
+ //item.LockQuantity += needQuantity - residueQuantity.NewNeendQuantity;
decimal assignQuantity = needQuantity - residueQuantity.NewNeendQuantity;
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
index c5805da..98407dc 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockInfoService.cs
@@ -342,10 +342,12 @@
{
List<Dt_StockInfo> outStocks = new List<Dt_StockInfo>();
List<IStockInfoService.residueQuantity> newresidueQantity = new List<IStockInfoService.residueQuantity>();
- List<Dt_StockInfo> notStocks = new List<Dt_StockInfo>(); ;
+ List<Dt_StockInfo> notStocks = new List<Dt_StockInfo>();
+
foreach (var dt_OutboundOrderDetail in dt_OutboundOrderDetails)
{
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.MaterielCode == dt_OutboundOrderDetail.MaterielCode).Sum(v => v.StockQuantity - v.OutboundQuantity);
@@ -357,48 +359,51 @@
{
Dt_StockInfo stockInfo = stockInfos[index];
- Dt_StockInfoDetail dt_StockInfoDetail = new Dt_StockInfoDetail();
+ List<Dt_StockInfoDetail> dt_StockInfoDetails = new List<Dt_StockInfoDetail>();
foreach (var detail in stockInfo.Details)
{
if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
- dt_StockInfoDetail = detail;
+ dt_StockInfoDetails.Add(detail);
}
}
- decimal useableStockQuantity = dt_StockInfoDetail.StockQuantity - dt_StockInfoDetail.OutboundQuantity;
- if (useableStockQuantity < needQuantity)
+ foreach(var dt_StockInfoDetail in dt_StockInfoDetails)
{
- stockInfo.Details.ForEach(x =>
+ decimal useableStockQuantity = dt_StockInfoDetail.StockQuantity - dt_StockInfoDetail.OutboundQuantity;
+ if (useableStockQuantity < needQuantity)
{
- if (x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
+ foreach (var item in stockInfo.Details)
{
- x.OutboundQuantity = x.StockQuantity;
- }
- });
- needQuantity -= useableStockQuantity;
- }
- else
- {
-
- stockInfo.Details.ForEach(x =>
- {
- if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
- {
- if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
+ if(item.MaterielCode == dt_OutboundOrderDetail.MaterielCode && dt_StockInfoDetail.BatchNo == item.BatchNo)
{
- x.OutboundQuantity += needQuantity;
- needQuantity = 0;
- }
- else
- {
- needQuantity -= (x.StockQuantity - x.OutboundQuantity);
- x.OutboundQuantity = x.StockQuantity;
+ item.OutboundQuantity = item.StockQuantity;
}
}
- });
+ needQuantity -= useableStockQuantity;
+ }
+ else
+ {
+ foreach (var item in stockInfo.Details)
+ {
+ if(item.StockQuantity > item.OutboundQuantity && item.MaterielCode == dt_StockInfoDetail.MaterielCode && item.BatchNo == dt_StockInfoDetail.BatchNo)
+ {
+ if (item.StockQuantity - item.OutboundQuantity >= needQuantity)
+ {
+ dt_StockInfoDetail.OutboundQuantity += needQuantity;
+ needQuantity = 0;
+ }
+ else
+ {
+ needQuantity -= (item.StockQuantity - item.OutboundQuantity);
+ item.OutboundQuantity = item.StockQuantity;
+ }
+ }
+ }
+ }
+ outStocks.Add(stockInfo);
+ index++;
+ if (needQuantity == 0) break;
}
- outStocks.Add(stockInfo);
- index++;
}
}
else
@@ -411,7 +416,7 @@
{
if (detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
- useableStockQuantity = detail.StockQuantity - detail.OutboundQuantity;
+ useableStockQuantity += detail.StockQuantity - detail.OutboundQuantity;
}
}
@@ -427,22 +432,22 @@
}
else
{
- stockInfo.Details.ForEach(x =>
+ foreach (var detail in stockInfo.Details)
{
- if (x.StockQuantity > x.OutboundQuantity && x.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
+ if(detail.StockQuantity > detail.OutboundQuantity && detail.MaterielCode == dt_OutboundOrderDetail.MaterielCode)
{
- if (x.StockQuantity - x.OutboundQuantity >= needQuantity)
+ if(detail.StockQuantity - detail.OutboundQuantity >= needQuantity)
{
- x.OutboundQuantity += needQuantity;
+ detail.OutboundQuantity += needQuantity;
needQuantity = 0;
}
else
{
- needQuantity -= (x.StockQuantity - x.OutboundQuantity);
- x.OutboundQuantity = x.StockQuantity;
+ needQuantity -= (detail.StockQuantity - detail.OutboundQuantity);
+ detail.OutboundQuantity = detail.StockQuantity;
}
}
- });
+ }
}
outStocks.Add(stockInfo);
}
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs
index 3f465c6..f4ff4bf 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/NewPartialTaskService_Outbound.cs
@@ -39,7 +39,7 @@
{
throw new Exception("鎵�閫夊嚭搴撳崟鏄庣粏瀛樺湪鍑哄簱涓垨宸插畬鎴�");
}
- if (outboundOrderDetails.FirstOrDefault()?.LPNNo == null)
+ if (outboundOrderDetails.FirstOrDefault()?.LPNNo == null || outboundOrderDetails.FirstOrDefault()?.LPNNo == "")
{
outboundOrderDetails.Clear();
try
@@ -405,16 +405,46 @@
//}
var stockdetailbox = BaseDal.Db.Queryable<Dt_StockInfo>().LeftJoin<Dt_StockInfoDetail>((s, d) => s.Id == d.StockId).LeftJoin<Dt_StockInfoDetailCP>((s, d, cp) => d.Id == cp.StockDetailId).Where((s, d, cp) => allBoxCodes.Contains(cp.BoxCode)).Select((s, d, cp) => cp.BoxCode)
- .Distinct()
- .ToList();
+ .Distinct()
+ .ToList();
var stockInfoDetailCPList = _stockInfoDetailCPRepository.QueryData(x => stockdetailbox.Contains(x.BoxCode)).ToList();
if (stockInfoDetailCPList != null)
{
_stockInfoDetailCPRepository.DeleteAndMoveIntoHty(stockInfoDetailCPList, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ foreach(var stockLPNO in houseStockDetail.DetailList)
+ {
+ Dt_StockInfo dt_StockInfo = BaseDal.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == stockLPNO.LPNNo).Includes(x => x.Details).First();
+ for (int i = 0; i<stockInfoDetailCPList.Count(); i++)
+ {
+ foreach (var item1 in dt_StockInfo.Details)
+ {
+ foreach (var batchNos in houseStockDetail.DetailList)
+ {
+ if (stockInfoDetailCPList[i].PartNum == item1.MaterielCode && batchNos.BatchNo == item.BatchNo)
+ {
+ item1.StockQuantity-=(decimal)stockInfoDetailCPList[i].QtyOfpcs;
+ item1.OutboundQuantity = 0;
+ _stockInfoDetailRepository.UpdateData(item1);
+ }
+ if (item1.StockQuantity == 0)
+ {
+ _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(item1, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ }
+ //鍏ㄩ儴閮藉嚭搴� 鍒犻櫎搴撳瓨
+ if (dt_StockInfo.Details.Sum(x => x.StockQuantity) == 0)
+ {
+ _stockService.StockInfoService.Repository.DeleteAndMoveIntoHty(dt_StockInfo, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
+ }
+ }
+ }
+ }
+ }
+
+
}
+ _unitOfWorkManage.CommitTran();
}
- _unitOfWorkManage.CommitTran();
}
catch (Exception ex)
{
@@ -466,11 +496,17 @@
});
result.Item2.ForEach(x =>
{
- x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
+ foreach(var item in result.Item2)
+ {
+ if(item.LockQuantity > 0)
+ {
+ item.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
+ }
+ }
+
});
result.Item3.ForEach(x =>
{
-
x.Status = OutStockStatus.鍑哄簱涓�.ObjToInt();
});
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
index bdc7d83..803d1cb 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs
@@ -26,6 +26,7 @@
public partial class TaskService
{
+
/// <summary>
/// 浠呯敵璇蜂换鍔★紝璁¦CS鏍规嵁璺敱纭畾涓嬩竴鍦板潃
/// </summary>
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
index 93ba00b..c3db79c 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -311,7 +311,7 @@
}
if (warehouse.WarehouseCode.Contains("CP"))
{
-
+
Dt_Production production1 = new Dt_Production();
OutboundOrderAddDTO orderAddDTO1 = new OutboundOrderAddDTO();
orderAddDTO1.OrderNo = orderAddDTO.No;
@@ -333,6 +333,16 @@
inboundOrder.CreateDate = DateTime.Now;
inboundOrder.CreateType = CreateType.UpperSystemPush.ObjToInt();
_unitOfWorkManage.BeginTran();
+
+ Dt_NewOutboundOrder dt_NewOutboundOrder = BaseDal.Db.Queryable<Dt_NewOutboundOrder>().Where(x => x.OrderNo == inboundOrder.OrderNo).Includes(x => x.Details).First();
+ if(dt_NewOutboundOrder != null)
+ {
+ if (dt_NewOutboundOrder.OrderStatus > 0)
+ {
+ return WebResponseContent.Instance.Error($"璇ュ嚭搴撳崟鍦ㄨ繘琛屼腑锛屾棤娉曟洿鏂拌鍑哄簱鍗�");
+ }
+ Db.DeleteNav(dt_NewOutboundOrder).Include(x => x.Details).ExecuteCommand();
+ }
bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
foreach (var item in orderAddDTO1.Details)
@@ -684,7 +694,7 @@
}
}
/// <summary>
- /// 鐢熸垚鍑哄簱浠诲姟
+ /// 鐢熸垚鈥樹换鍔�
/// </summary>
/// <param name="orderDetailId"></param>
/// <param name="stockSelectViews"></param>
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 35e8717..94ef2cb 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -20,20 +20,30 @@
using Microsoft.AspNetCore.SignalR;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Database;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Org.BouncyCastle.Asn1.Tsp;
+using Spire.Pdf;
using SqlSugar;
+using System;
+using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
+using System.Drawing.Printing;
+using System.IO;
using System.Linq;
+using System.Net.Http;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
+using System.Threading.Tasks;
using WIDESEA_BasicRepository;
using WIDESEA_Common;
+using WIDESEA_Common.Log;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.TaskEnum;
using WIDESEA_Core;
@@ -43,6 +53,7 @@
using WIDESEA_Core.Helper;
using WIDESEA_Core.TaskEnum;
using WIDESEA_DTO.Basic;
+using WIDESEA_DTO.ERP;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Stock;
using WIDESEA_DTO.Task;
@@ -50,6 +61,7 @@
using WIDESEA_IBasicService;
using WIDESEA_IInboundRepository;
using WIDESEA_IInboundService;
+using WIDESEA_InboundRepository;
using WIDESEA_IOutboundRepository;
using WIDESEA_IOutboundService;
using WIDESEA_IRecordService;
@@ -59,28 +71,19 @@
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Inbound;
+using WIDESEA_OutboundRepository;
using WIDESEA_StockRepository;
using WIDESEA_TaskInfoRepository;
using static WIDESEA_Common.Authentication;
using static WIDESEA_Common.HouseBackboundPassBack;
using static WIDESEA_Common.HouseInboundPassBack;
+using static WIDESEA_Common.HouseInboundPassBack.data.data1;
using static WIDESEA_Common.HouseoutboundPassBack;
using static WIDESEA_Common.InventoryAllocate;
+using static WIDESEA_Common.NewHouseInboundPassBack;
+using static WIDESEA_Common.NewHouseInboundPassBack.Parame.Syncretism;
using static WIDESEA_ITaskInfoService.ITaskService;
using Parameter = WIDESEA_Common.Parameter;
-using WIDESEA_DTO.ERP;
-using WIDESEA_OutboundRepository;
-using System.ComponentModel.DataAnnotations;
-using System;
-using System.IO;
-using System.Net.Http;
-using System.Threading.Tasks;
-using Spire.Pdf;
-using WIDESEA_InboundRepository;
-using System.Drawing.Printing;
-using System;
-using WIDESEA_Common.Log;
-using static WIDESEA_Common.HouseInboundPassBack.data.data1;
namespace WIDESEA_TaskInfoService
{
@@ -720,6 +723,7 @@
}
if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 0 && inboundOrder.System.Equals("SMOM"))
{
+
List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db
.Queryable<Dt_StockInfo>()
.Includes(x => x.Details, d => d.StockDetails)
@@ -872,7 +876,79 @@
}
}
}
+ else if (inboundOrder.OrderStatus == InboundStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && inboundOrder.OrderType == 5 && inboundOrder.System.Equals("SMOM"))
+ {
+ List<Dt_StockInfo> StockInfos = _stockRepository.StockInfoRepository.Db
+ .Queryable<Dt_StockInfo>()
+ .Includes(x => x.Details, d => d.StockDetails)
+ .Where(x => x.WarehouseId == task.WarehouseId &&
+ x.Details.Any(v => v.OrderNo == inboundOrder.OrderNo))
+ .ToList();
+
+ Dt_InboundOrder? dt_InboundOrder = _inboundService.InbounOrderService.Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderNo == inboundOrder.OrderNo).Includes(x => x.Details).First();
+ if (StockInfos.Count == 0) throw new Exception("鏈壘鍒板簱瀛樹俊鎭�");
+
+ var houseSyncretism = new NewHouseInboundPassBack
+ {
+ ApiType = "InventoryMoveController",
+ Method = "AsrsUnPickingDatas",
+ Parameters = new List<NewHouseInboundPassBack.Parame>
+ {
+ new NewHouseInboundPassBack.Parame
+ {
+
+ Value = new Parame.Syncretism
+ {
+ OrderNo = inboundOrder.OrderNo,
+ Details = StockInfos.SelectMany(stockInfo =>
+
+ stockInfo.Details.Select(g =>
+ {
+ //var InboundOrderde1=dt_InboundOrder.Details.FirstOrDefault;
+
+ return new Parame.Syncretism.details
+ {
+ MoveType = 0,
+ WareHouseCode = warehouse.WarehouseCode,
+ ItemCode = g.MaterielCode,
+ MoveNumber = g.StockQuantity,
+ LotNo = g.BatchNo,
+ WipBatch = g.BatchNo,
+ Lpn = g.StockDetails.FirstOrDefault().LPNNO,
+ LocationName = g.StockDetails.FirstOrDefault().OrinalLocation,
+ TargetLocName = stockInfo.LocationCode, // 娣诲姞null妫�鏌�
+ TargetLpn = stockInfo.PalletCode, // 娣诲姞null妫�鏌�
+ };
+
+
+ })).ToList()
+
+ }
+
+ }
+ }
+ };
+
+ var authResult = AuthenticateWithWMS();
+ if (authResult.IsSuccess)
+ {
+ houseSyncretism.Context = new Dictionary<string, string>
+ {
+ { "Ticket", authResult.Ticket },
+ { "InvOrgId", authResult.InvOrgId }
+
+ };
+
+ var response = HttpHelper.Post<MomRequestContent>(ReceiveWMSTaskin, houseSyncretism, "绔嬪簱鍏ュ簱鏁伴噺鍥炰紶WMS");
+ if (!response.Success)
+ {
+ throw new Exception($"鎿嶄綔澶辫触: {response.Message ?? "鏈彁渚涢敊璇俊鎭�"}");
+ }
+
+ }
+
+ }
_unitOfWorkManage.CommitTran();
return WebResponseContent.Instance.OK();
}
@@ -1686,10 +1762,13 @@
x.LocationName == stockInfo.LocationCode &&
x.LPNNo == stockInfo.PalletCode)
.ToList();
-
- List<Dt_NewOutboundOrderDetail> outboundOrderDetails1 = _outboundService.NewOutboundOrderDetailService.Db.Queryable<Dt_NewOutboundOrderDetail>()
- .Where(x => x.OrderId == outboundOrder.Id)
- .ToList();
+ List<Dt_NewOutboundOrderDetail> outboundOrderDetails1 = new List<Dt_NewOutboundOrderDetail>();
+ if (outboundOrderDetails == null || outboundOrderDetails.Count == 0)
+ {
+ 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} 涓婄殑鍑哄簱鍗曟槑缁�");
@@ -1698,6 +1777,7 @@
var stockInfoDetails = stockInfo.Details.ToList();
int overCount = outboundOrder.Details.Count(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt());
+
if (outboundOrderDetails == null || outboundOrderDetails.Count == 0)
{
foreach (var stockDetail in stockInfoDetails)
@@ -1858,7 +1938,7 @@
}
// 璋冩嫧鍑哄簱
- if (outboundOrder.OrderType == 2)
+ if (outboundOrder.OrderType == 4)
{
var allocate = new InventoryAllocate
{
@@ -2090,7 +2170,7 @@
}
// 璋冩嫧鍑哄簱
- if (outboundOrder.OrderType == 2)
+ if (outboundOrder.OrderType == 4)
{
var allocate = new InventoryAllocate
{
@@ -2177,14 +2257,14 @@
if (inboundOrder == null) return WebResponseContent.Instance.Error("鏈壘鍒板嚭搴撳崟淇℃伅");
List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
- foreach(var detail in stockInfo.Details)
+ foreach (var detail in stockInfo.Details)
{
Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
.Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo).First();
outboundOrderDetails.Add(outboundOrderDetail);
}
- for(var i = 0; i<outboundOrderDetails.Count; i++)
+ for (var i = 0; i<outboundOrderDetails.Count; i++)
{
if (outboundOrderDetails[i].LocationName != null && outboundOrderDetails[i].LocationName != "")
{
@@ -2297,9 +2377,9 @@
// 鏇存柊搴撳瓨鐘舵�� 鍥炲簱鍗�
- AddRetrueOrder(stockInfo, inboundOrder);
-
-
+ AddRetrueOrder(stockInfo, inboundOrder);
+
+
// 鍖哄垎鍗曟嵁鏁版嵁鏉ユ簮鏇存柊璐т綅鐘舵��
if (inboundOrder.System == null)
{
@@ -2394,7 +2474,7 @@
var outboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
.Where(x => x.OrderNo == inboundOrder.OrderNo).First();
- foreach(var outboundOrderDetail in outboundOrderDetails)
+ foreach (var outboundOrderDetail in outboundOrderDetails)
{
var outDetail = _outboundService.OutboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
.Where(x => x.OrderId == outboundOrder.Id && x.BatchNo == outboundOrderDetail.BatchNo).First();
@@ -2498,7 +2578,7 @@
inboundOrder.OrderStatus = OutboundStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
}
}
-
+
}
private void DeleteAndMoveIntoHtStockStatus(Dt_StockInfo stockInfo)
@@ -2954,9 +3034,9 @@
}
}
// 鍙噺鍘诲崟鎹槑缁嗕腑鐨勬暟閲�
- matchedStockDetail.OutboundQuantity = 0;
- matchedStockDetail.StockQuantity = outDetail.OrderQuantity;
- matchedStockDetail.OrderNo = returnOrder.OrderNo;
+ //matchedStockDetail.OutboundQuantity = 0;
+ //matchedStockDetail.StockQuantity = outDetail.OrderQuantity;
+ //matchedStockDetail.OrderNo = returnOrder.OrderNo;
// 鏇存柊鍖归厤鐨勬槑缁�
_stockService.StockInfoDetailService.Repository.UpdateData(matchedStockDetail);
}
@@ -2971,163 +3051,165 @@
else
{
var groupedDetails = outboundOrderDetails
- .GroupBy(d => new { d.MaterielCode, d.BatchNo })
- .ToList();
+ .GroupBy(d => new { d.MaterielCode, d.BatchNo })
+ .ToList();
List<Dt_StockInfoDetail> processedStockDetails = new List<Dt_StockInfoDetail>();
List<Dt_ReturnOrder> returnOrders = new List<Dt_ReturnOrder>();
decimal totalOutboundQuantity = outboundOrderDetails.Sum(x => x.OrderQuantity);
decimal totalStockQuantity = stockInfoDetails.Sum(x => x.StockQuantity);
- foreach (var groupeDetail in groupedDetails)
+ foreach (var detail in stockInfo.Details)
{
- var outboundDetail = groupeDetail.First();
- decimal totalOrderQuantity = groupeDetail.Sum(x => x.OrderQuantity);
- var matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outboundDetail.MaterielCode && x.BatchNo == outboundDetail.BatchNo);
- if (matchedStockDetail == null)
+ foreach (var groupeDetail in groupedDetails)
{
- matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outboundDetail.MaterielCode);
- if (matchedStockDetail == null)
+ var outboundDetail = groupeDetail.First();
+ if (outboundDetail.MaterielCode == detail.MaterielCode)
{
- throw new Exception($"鏈壘鍒板尮閰嶇殑搴撳瓨鏄庣粏淇℃伅锛岀墿鏂�:{outboundDetail.MaterielCode}, 鎵规:{outboundDetail.BatchNo}");
+ decimal totalOrderQuantity = groupeDetail.Sum(x => x.OrderQuantity);
+ var matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outboundDetail.MaterielCode && x.BatchNo == outboundDetail.BatchNo);
+ if (matchedStockDetail == null)
+ {
+ matchedStockDetail = stockInfoDetails.FirstOrDefault(x => x.MaterielCode == outboundDetail.MaterielCode);
+
+ if (matchedStockDetail == null)
+ {
+ throw new Exception($"鏈壘鍒板尮閰嶇殑搴撳瓨鏄庣粏淇℃伅锛岀墿鏂�:{outboundDetail.MaterielCode}, 鎵规:{outboundDetail.BatchNo}");
+ }
+ }
+ // 璁$畻褰撳墠鎵规鐨勫墿浣欐暟閲�
+ decimal remainingQuantity = matchedStockDetail.StockQuantity - totalOrderQuantity;
+
+ if (remainingQuantity > 0)
+ {
+ Dt_ReturnOrder returnOrder = new Dt_ReturnOrder
+ {
+ MaterielCode = matchedStockDetail.MaterielCode,
+ MaterielName = matchedStockDetail.MaterielName,
+ BatchNo = matchedStockDetail.BatchNo,
+ OrderQuantity = remainingQuantity,
+ ReceiptQuantity = remainingQuantity,
+ OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
+ LinId = matchedStockDetail.LinId,
+ LPNNo = stockInfo.PalletCode,
+ Creater = "LK",
+ CreateDate = DateTime.Now,
+ OrderType = OrderTypeEnum.浣欐枡鍥炲簱鍗�.ObjToInt(),
+ System = "WMS",
+ Remark = "澶氭壒娆¤繑搴�" // 娣诲姞澶囨敞鏍囪瘑
+ };
+
+ if (outboundOrder.System == "SMOM" && stockInfo.LocationCode != null)
+ {
+ returnOrder.LocationCode = stockInfo.LocationCode;
+ }
+
+ // 娣诲姞杩斿簱鍗�
+ returnOrders.Add(returnOrder);
+
+ }
+ if (remainingQuantity < 0 && matchedStockDetail.StockQuantity < matchedStockDetail.OutboundQuantity)
+ {
+ throw new Exception($"鍑哄簱鏁伴噺 {outboundDetail.OrderQuantity} 澶т簬搴撳瓨鏁伴噺 {matchedStockDetail.StockQuantity}");
+ }
+ processedStockDetails.Add(matchedStockDetail);
+
+
+ // 澶勭悊鍏朵粬鎵规鐨勫簱瀛樻槑缁嗭紙鍏ㄩ儴杩斿簱锛�
+ var otherBatchDetails = stockInfoDetails
+ .Where(x => !processedStockDetails.Contains(x) && x.StockQuantity > 0 && x.OutboundQuantity == 0)
+ .ToList();
+
+ if (returnOrders == null || returnOrders.Count == 0)
+ {
+ if (otherBatchDetails.Count > 0)
+ {
+ decimal totalOtherQuantity = otherBatchDetails.Sum(x => x.StockQuantity);
+
+ // 涓哄叾浠栨壒娆″垱寤鸿繑搴撳崟锛堝彧鍒涘缓涓�涓紝鍖呭惈鎵�鏈夋壒娆★級
+ var firstOtherDetail = otherBatchDetails.First();
+ Dt_ReturnOrder otherReturnOrder = new Dt_ReturnOrder
+ {
+ MaterielCode = firstOtherDetail.MaterielCode,
+ MaterielName = firstOtherDetail.MaterielName,
+ BatchNo = firstOtherDetail.BatchNo,
+ OrderQuantity = totalOtherQuantity,
+ ReceiptQuantity = totalOtherQuantity,
+ OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
+ LinId = firstOtherDetail.LinId,
+ LPNNo = stockInfo.PalletCode,
+ Creater = "LK",
+ CreateDate = DateTime.Now,
+ OrderType = OrderTypeEnum.浣欐枡鍥炲簱鍗�.ObjToInt(),
+ System = "WMS",
+ Remark = $"澶氭壒娆¤繑搴擄紝鍏眥otherBatchDetails.Count}涓壒娆�"
+ };
+
+ if (outboundOrder.System == "SMOM" && !string.IsNullOrEmpty(stockInfo.LocationCode))
+ {
+ otherReturnOrder.LocationCode = stockInfo.LocationCode;
+ }
+ returnOrders.Add(otherReturnOrder);
+ }
+
+ }
+ else
+ {
+ decimal totalOtherQuantity = otherBatchDetails.Sum(x => x.StockQuantity);
+ foreach (var item in returnOrders)
+ {
+ item.OrderQuantity = totalOrderQuantity;
+ item.ReceiptQuantity = totalOrderQuantity;
+ item.Remark = $"澶氭壒娆¤繑搴擄紝鍏眥otherBatchDetails.Count}涓壒娆�";
+ }
+ }
+
+ // 鎵归噺鏇存柊宸插鐞嗙殑搴撳瓨鏄庣粏
+ var updateDetails = processedStockDetails.Where(x => x.StockQuantity > 0).ToList();
+ if (updateDetails.Any())
+ {
+ _stockService.StockInfoDetailService.Repository.UpdateData(updateDetails);
+ }
+
+ // 娣诲姞杩斿簱鍗�
+ if (returnOrders.Any())
+ {
+ _returnOrderRepository.AddData(returnOrders);
+ }
+
+ // 鏇存柊搴撳瓨涓昏〃鐘舵��
+ decimal returnQuantity = totalStockQuantity - totalOutboundQuantity;
+ if (returnQuantity == 0 || stockInfo.Details.All(x => x.StockQuantity == x.OutboundQuantity))
+ {
+ if (outboundOrder.System == "SMOM" && stockInfo.LocationCode != null)
+ {
+ Dt_LocationInfo dt_LocationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
+ dt_LocationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ _basicRepository.LocationInfoRepository.UpdateData(dt_LocationInfo);
+ }
+ //鍏ㄩ儴鍑哄簱锛屽垹闄ゅ簱瀛�
+ //DeleteAndMoveIntoHtStockStatus(stockInfo);
+ //foreach (var item in stockInfo.Details)
+ //{
+ // BaseDal.Db.Deleteable(item.StockDetails).ExecuteCommand();
+ //}
+ }
+ else if (returnQuantity > 0)
+ {
+ // 鏈変綑鏂欒繑搴�
+ stockInfo.LocationCode = "";
+ stockInfo.StockStatus = StockStatusEmun.浣欐枡閫�搴�.ObjToInt();
+ stockInfo.Remark = $"浣欐枡閫�搴擄紝鍏眥returnOrders.Count}涓繑搴撳崟";
+ _stockService.StockInfoService.Repository.UpdateData(stockInfo);
+ }
}
}
- // 璁$畻褰撳墠鎵规鐨勫墿浣欐暟閲�
- decimal remainingQuantity = matchedStockDetail.StockQuantity - totalOrderQuantity;
- if (remainingQuantity > 0)
- {
- Dt_ReturnOrder returnOrder = new Dt_ReturnOrder
- {
- MaterielCode = matchedStockDetail.MaterielCode,
- MaterielName = matchedStockDetail.MaterielName,
- BatchNo = matchedStockDetail.BatchNo,
- OrderQuantity = remainingQuantity,
- ReceiptQuantity = remainingQuantity,
- OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
- LinId = matchedStockDetail.LinId,
- LPNNo = stockInfo.PalletCode,
- Creater = "LK",
- CreateDate = DateTime.Now,
- OrderType = OrderTypeEnum.浣欐枡鍥炲簱鍗�.ObjToInt(),
- System = "WMS",
- Remark = "澶氭壒娆¤繑搴�" // 娣诲姞澶囨敞鏍囪瘑
- };
-
- if (outboundOrder.System == "SMOM" && stockInfo.LocationCode != null)
- {
- returnOrder.LocationCode = stockInfo.LocationCode;
- }
-
- // 娣诲姞杩斿簱鍗�
- returnOrders.Add(returnOrder);
-
- // 鏇存柊褰撳墠鎵规鏄庣粏锛氬彧淇濈暀鍑哄簱鏁伴噺锛屽叾浣欒繑搴�
- matchedStockDetail.StockQuantity = remainingQuantity;
- matchedStockDetail.OutboundQuantity = outboundDetail.OrderQuantity;
- //matchedStockDetail.OrderNo = returnOrder.OrderNo;
- }
- else if (remainingQuantity == 0)
- {
- // 褰撳墠鎵规姝eソ鍑哄畬
- matchedStockDetail.OutboundQuantity = matchedStockDetail.StockQuantity;
- if (matchedStockDetail.StockQuantity == totalOrderQuantity)
- {
- _stockService.StockInfoDetailService.Repository.DeleteAndMoveIntoHty(
- matchedStockDetail, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
- }
- else
- {
- matchedStockDetail.StockQuantity = 0;
- _stockService.StockInfoDetailService.Repository.UpdateData(matchedStockDetail);
- }
- }
- else
- {
- throw new Exception($"鍑哄簱鏁伴噺 {outboundDetail.OrderQuantity} 澶т簬搴撳瓨鏁伴噺 {matchedStockDetail.StockQuantity}");
- }
- processedStockDetails.Add(matchedStockDetail);
}
- // 澶勭悊鍏朵粬鎵规鐨勫簱瀛樻槑缁嗭紙鍏ㄩ儴杩斿簱锛�
- var otherBatchDetails = stockInfoDetails
- .Where(x => !processedStockDetails.Contains(x) && x.StockQuantity > 0)
- .ToList();
-
- if (otherBatchDetails.Count > 0)
- {
- decimal totalOtherQuantity = otherBatchDetails.Sum(x => x.StockQuantity);
-
- // 涓哄叾浠栨壒娆″垱寤鸿繑搴撳崟锛堝彧鍒涘缓涓�涓紝鍖呭惈鎵�鏈夋壒娆★級
- var firstOtherDetail = otherBatchDetails.First();
- Dt_ReturnOrder otherReturnOrder = new Dt_ReturnOrder
- {
- MaterielCode = firstOtherDetail.MaterielCode,
- MaterielName = firstOtherDetail.MaterielName,
- BatchNo = firstOtherDetail.BatchNo,
- OrderQuantity = totalOtherQuantity,
- ReceiptQuantity = totalOtherQuantity,
- OrderStatus = InOrderStatusEnum.鏈紑濮�.ObjToInt(),
- LinId = firstOtherDetail.LinId,
- LPNNo = stockInfo.PalletCode,
- Creater = "LK",
- CreateDate = DateTime.Now,
- OrderType = OrderTypeEnum.浣欐枡鍥炲簱鍗�.ObjToInt(),
- System = "WMS",
- Remark = $"澶氭壒娆¤繑搴擄紝鍏眥otherBatchDetails.Count}涓壒娆�"
- };
-
- if (outboundOrder.System == "SMOM" && !string.IsNullOrEmpty(stockInfo.LocationCode))
- {
- otherReturnOrder.LocationCode = stockInfo.LocationCode;
- }
-
-
- returnOrders.Add(otherReturnOrder);
- }
-
- // 鎵归噺鏇存柊宸插鐞嗙殑搴撳瓨鏄庣粏
- var updateDetails = processedStockDetails.Where(x => x.StockQuantity > 0).ToList();
- if (updateDetails.Any())
- {
- _stockService.StockInfoDetailService.Repository.UpdateData(updateDetails);
- }
-
- // 娣诲姞杩斿簱鍗�
- if (returnOrders.Any())
- {
- _returnOrderRepository.AddData(returnOrders);
- }
-
- // 鏇存柊搴撳瓨涓昏〃鐘舵��
- decimal returnQuantity = totalStockQuantity - totalOutboundQuantity;
- if (returnQuantity == 0)
- {
- if (outboundOrder.System == "SMOM" && stockInfo.LocationCode != null)
- {
- Dt_LocationInfo dt_LocationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode);
- dt_LocationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
- _basicRepository.LocationInfoRepository.UpdateData(dt_LocationInfo);
- }
- // 鍏ㄩ儴鍑哄簱锛屽垹闄ゅ簱瀛�
- DeleteAndMoveIntoHtStockStatus(stockInfo);
- foreach (var item in stockInfo.Details)
- {
- BaseDal.Db.Deleteable(item.StockDetails).ExecuteCommand();
- }
- }
- else if (returnQuantity > 0)
- {
- // 鏈変綑鏂欒繑搴�
- stockInfo.LocationCode = "";
- stockInfo.StockStatus = StockStatusEmun.浣欐枡閫�搴�.ObjToInt();
- stockInfo.Remark = $"浣欐枡閫�搴擄紝鍏眥returnOrders.Count}涓繑搴撳崟";
- _stockService.StockInfoService.Repository.UpdateData(stockInfo);
- }
-
+ _unitOfWorkManage.CommitTran();
}
- _unitOfWorkManage.CommitTran();
}
catch (Exception ex)
{
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs b/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs
index 8fde075..ce3ce75 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Outbound/OutboundOrderController.cs
@@ -27,6 +27,17 @@
{
return Service.CancelOut(houseCancelOut);
}
+
+ /// <summary>
+ /// 鎴愬搧鍑哄簱鍗曟嵁鍙栨秷
+ /// </summary>
+ /// <param name="houseCancelOut"></param>
+ /// <returns></returns>
+ [HttpPost, Route("NewCancelOut"), AllowAnonymous]
+ public WebResponseContent NewCancelOut([FromBody] HouseCancelOut houseCancelOut)
+ {
+ return Service.NewCancelOut(houseCancelOut);
+ }
[HttpPost, Route("Save"), AllowAnonymous]
public WebResponseContent Save([FromBody] OutboundOrderAddDTO orderAddDTO)
--
Gitblit v1.9.3