From 86215107267c319e41a81fa59a382c8f1eed3d67 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期三, 15 一月 2025 19:09:40 +0800
Subject: [PATCH] 入库上报更改
---
/dev/null | 0
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 79 +++++++++++++++++++++++++-
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/62270761-b26c-48fb-a87f-f738612ec707.vsidx | 0
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs | 6 +
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs | 9 ++
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 34 ++++++-----
6 files changed, 108 insertions(+), 20 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/62270761-b26c-48fb-a87f-f738612ec707.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/62270761-b26c-48fb-a87f-f738612ec707.vsidx"
new file mode 100644
index 0000000..c8711bc
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/62270761-b26c-48fb-a87f-f738612ec707.vsidx"
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx"
deleted file mode 100644
index 85a4f21..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/fda87ddb-3aec-4e38-98c3-9b80d5e108a6.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs"
index aef15d7..8e849dc 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Common/OrderEnum/OrderDetailStatusEnum.cs"
@@ -20,7 +20,11 @@
/// </summary>
[Description("缁勭洏鍏ュ簱")]
GroupAndInbound = 10,
-
+ /// <summary>
+ /// 鍏ュ簱涓�
+ /// </summary>
+ [Description("鍏ュ簱涓�")]
+ Inbounding = 20,
/// <summary>
/// 鍑哄簱閮ㄥ垎鍒嗛厤瀹屾垚
/// </summary>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
index edec038..9822d8b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IInboundService/IInboundOrderService.cs"
@@ -27,9 +27,16 @@
WebResponseContent MaterielGroup(SaveModel saveModel);
/// <summary>
+ /// 鍏ュ簱瀹屾垚涓婃姤 寮冪敤
+ /// </summary>
+ /// <returns></returns>
+ #region 寮冪敤
+ WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels);
+ #endregion
+ /// <summary>
/// 鍏ュ簱瀹屾垚涓婃姤
/// </summary>
/// <returns></returns>
- WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo,Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels);
+ WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder,List<Dt_StockInfoDetail> stockInfoDetails);
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index 5508525..42c0d58 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -513,7 +513,7 @@
return WebResponseContent.Instance.Error($"鏈壘鍒拌鐗╂枡鐨勪俊鎭�");
}
- List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCode).ToList();
+ List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details.Where(x => x.MaterielCode == materielCode && x.BatchNo==(models.FirstOrDefault()?.LotNo ?? "")).ToList();
if (inboundOrderDetails == null || inboundOrderDetails.Count <= 0)
{
@@ -766,9 +766,10 @@
return content;
}
/// <summary>
- /// 鍏ュ簱瀹屾垚涓婃姤ERP
+ /// 鍏ュ簱瀹屾垚涓婃姤ERP 寮冪敤
/// </summary>
/// <returns></returns>
+ #region 寮冪敤
public WebResponseContent FeedbackInboundOrder(Dt_StockInfo stockInfo, Dt_InboundOrder inboundOrder, List<ERPInboundDetailModel> detailModels)
{
WebResponseContent content = new WebResponseContent();
@@ -812,7 +813,79 @@
}
return content;
}
-
+ #endregion
+ /// <summary>
+ /// 鍏ュ簱瀹屾垚涓婃姤ERP
+ /// </summary>
+ /// <returns></returns>
+ public WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder, List<Dt_StockInfoDetail> stockInfoDetails)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ if (inboundOrder.Details.Count == 0)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅");
+ }
+ if (stockInfoDetails.Count==0)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒板簱瀛樻槑缁嗕俊鎭�");
+ }
+ Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == inboundOrder.WarehouseId);
+ if (warehouse == null)
+ {
+ return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�");
+ }
+ List<ERPInboundDetailModel>? detailModels = null;
+ foreach (var item in stockInfoDetails)
+ {
+ Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.Id == item.StockId);
+ if (detailModels!=null && detailModels.FirstOrDefault(x=>x.Rack==stockInfo.LocationCode)!=null)
+ {
+ var detailModel = detailModels.FirstOrDefault(x => x.Rack == stockInfo.LocationCode);
+ detailModel.Quantity = (Convert.ToDouble(detailModel.Quantity) + item.StockQuantity).ToString();
+ }
+ else
+ {
+ ERPInboundDetailModel detailModel = new ERPInboundDetailModel()
+ {
+ ExpiryDate = item.EffectiveDate ?? "",
+ LocationCode = warehouse.WarehouseCode,
+ MaterialsCode = item.MaterielCode,
+ MfgDate = item.ProductionDate ?? "",
+ QtyCustoms = "0",
+ Quantity = item.StockQuantity.ToString(),
+ Rack = stockInfo.LocationCode,
+ ReceiptCode = inboundOrder.UpperOrderNo,
+ ReceiptSerNo = item.InboundOrderRowNo.ToString()
+ };
+ detailModels.Add(detailModel);
+ }
+ }
+ ERPInboundModel model = new ERPInboundModel()
+ {
+ Code = CreateCodeByRule(nameof(RuleCodeEnum.RLCodeRule)),
+ CreatorCode = inboundOrder.Creater,//娴嬭瘯
+ EntDate = inboundOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
+ StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ SuppliersId = inboundOrder.SupplierId,
+ Type = "S",
+ UniqueTag = inboundOrder.Id.ToString(),
+ WarehouseCode = warehouse.WarehouseCode,
+ Way = 1,
+ Details = detailModels
+ };
+ //鎺ㄩ�丒RP 娴嬭瘯娉ㄩ噴
+ _invokeERPService.InvokeInboundOrderApi(model);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
static object lock_code = new object();
public string CreateCodeByRule(string ruleCode)
{
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index c41e69f..1501360 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -214,7 +214,7 @@
#endregion
Dt_InboundOrder? inboundOrder = _inboundRepository.InboundOrderRepository.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == stockInfo.Details.FirstOrDefault().OrderNo).Includes(x => x.Details).First();
- List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>();
+ Dt_InboundOrderDetail? inboundOrderDetail = null;
List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
if (stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
{
@@ -222,9 +222,11 @@
{
return WebResponseContent.Instance.Error($"瀵瑰簲鍏ュ簱鍗曚笉瀛樺湪");
}
+ //鏌ヨ鍘熷畬鎴愮殑鍏ュ簱鏄庣粏鏁伴噺
+ int overCount = inboundOrder.Details.Where(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
+ inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == stockInfo.Details.FirstOrDefault()?.InboundOrderRowNo);
foreach (var item in stockInfo.Details)
{
- Dt_InboundOrderDetail? inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.RowNo == item.InboundOrderRowNo);
if (inboundOrderDetail == null)
{
continue;
@@ -241,24 +243,22 @@
ReceiptCode = inboundOrder.UpperOrderNo,
ReceiptSerNo = item.InboundOrderRowNo.ToString()
};
- inboundOrderDetail.OverInQuantity += detailModel.Quantity.ObjToInt();
+ inboundOrderDetail.OverInQuantity += item.StockQuantity;
if (inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity)
{
inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
+ overCount += 1;
}
- inboundOrderDetails.Add(inboundOrderDetail);
+ else if(inboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
+ {
+ inboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Inbounding.ObjToInt();
+ }
detailModels.Add(detailModel);
}
-
- //鍏ュ簱鏄庣粏鏂板瀹屾垚鏁伴噺
- int newCount = inboundOrderDetails.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
- //鍏ュ簱鏄庣粏鍘熷畬鎴愭暟閲�
- int oldCount = inboundOrder.Details.Select(x => x.OrderDetailStatus == OrderDetailStatusEnum.Over.ObjToInt()).ToList().Count;
- if (inboundOrder.Details.Count == (newCount + oldCount))
+ if (inboundOrder.Details.Count == overCount)
{
inboundOrder.OrderStatus = InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt();
}
-
}
if ((stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
@@ -294,13 +294,17 @@
_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum);
if (inboundOrder != null)
{
- _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetails);
_inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
+ if (inboundOrderDetail!=null)
+ {
+ _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail);
+ }
}
_unitOfWorkManage.CommitTran();
- if (stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+ if (stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() && inboundOrder.OrderStatus== InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
{
- _inboundOrderService.FeedbackInboundOrder(stockInfo, inboundOrder, detailModels);
+ List<Dt_StockInfoDetail> stockInfoDetails = _stockRepository.StockInfoDetailRepository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo);
+ _inboundOrderService.FeedbackInboundOrder(inboundOrder, stockInfoDetails);
}
return WebResponseContent.Instance.OK();
}
@@ -368,7 +372,7 @@
Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == item.OrderDetailId);
if (outboundOrderDetail != null)
{
- outboundOrderDetail.OverOutQuantity = item.AssignQuantity;
+ outboundOrderDetail.OverOutQuantity += item.AssignQuantity;
if (outboundOrderDetail.OverOutQuantity == outboundOrderDetail.OrderQuantity)
{
outboundOrderDetail.OrderDetailStatus = OrderDetailStatusEnum.Over.ObjToInt();
--
Gitblit v1.9.3