From cbf06cbb2e7988fdee53507dede034756ebfbf59 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 14 一月 2025 15:47:40 +0800
Subject: [PATCH] 1
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 206 ++++++++++++++++++++++++++++++++-------------------
1 files changed, 129 insertions(+), 77 deletions(-)
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 3c7c036..8a57f20 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"
@@ -119,11 +119,11 @@
List<Dt_InboundOrder> dt_ReceiveOrders = new List<Dt_InboundOrder>();
if (string.IsNullOrEmpty(orderNo))
{
- dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5);
+ dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
}
else
{
- dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).ToPageList(pageNo, 5);
+ dt_ReceiveOrders = Db.Queryable<Dt_InboundOrder>().Where(x => (x.InboundOrderNo.Contains(orderNo)) && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt() && x.WarehouseId == warehouseId).OrderByDescending(x => x.CreateDate).ToPageList(pageNo, 5);
}
content.OK(data: dt_ReceiveOrders);
@@ -407,6 +407,41 @@
_inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.Inbound);
_unitOfWorkManage.CommitTran();
+
+ #region 涓婃姤ERP鍏ュ簱瀹屾垚
+ List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
+ foreach (var item in stockInfo.Details)
+ {
+ 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 eRPInboundModel = new ERPInboundModel()
+ {
+ Code = inboundOrder.InboundOrderNo,
+ 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(eRPInboundModel);
+ #endregion
content.OK();
}
catch (Exception ex)
@@ -726,7 +761,6 @@
}
return content;
}
-
/// <summary>
/// 鍏ュ簱瀹屾垚涓婃姤ERP
/// </summary>
@@ -744,7 +778,6 @@
{
return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟嵁宸插畬鎴�");
}
-
Dt_Warehouse warehouse = _warehouseService.Repository.QueryFirst(x => x.WarehouseId == stockInfo.WarehouseId);
if (warehouse == null)
{
@@ -770,6 +803,7 @@
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
content.Error(ex.Message);
}
return content;
@@ -780,83 +814,83 @@
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
- public WebResponseContent FeedbackInboundOrder(int id)
- {
- try
- {
- Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == id).Includes(x => x.Details).First();
- if (inboundOrder == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟淇℃伅");
- }
- if (inboundOrder.Details == null || inboundOrder.Details.Count == 0)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅");
- }
- if (inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
- {
- return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟嵁宸插畬鎴�");
- }
+ //public WebResponseContent FeedbackInboundOrder(int id)
+ //{
+ // try
+ // {
+ // Dt_InboundOrder inboundOrder = Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == id).Includes(x => x.Details).First();
+ // if (inboundOrder == null)
+ // {
+ // return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟淇℃伅");
+ // }
+ // if (inboundOrder.Details == null || inboundOrder.Details.Count == 0)
+ // {
+ // return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅");
+ // }
+ // if (inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
+ // {
+ // return WebResponseContent.Instance.Error($"鍏ュ簱鍗曟嵁宸插畬鎴�");
+ // }
- List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.InboundOrderNo)).Includes(x => x.Details).ToList();
- List<Dt_Warehouse> warehouses = Db.Queryable<Dt_Warehouse>().ToList();
+ // List<Dt_StockInfo> stockInfos = Db.Queryable<Dt_StockInfo>().Where(x => x.Details.Any(v => v.OrderNo == inboundOrder.InboundOrderNo)).Includes(x => x.Details).ToList();
+ // List<Dt_Warehouse> warehouses = Db.Queryable<Dt_Warehouse>().ToList();
- List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
- foreach (var item in inboundOrder.Details)
- {
- Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(v => v.InboundOrderRowNo == item.RowNo && v.MaterielCode == item.MaterielCode));
- if (stockInfo == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒板簱瀛樹俊鎭�");
- }
+ // List<ERPInboundDetailModel> detailModels = new List<ERPInboundDetailModel>();
+ // foreach (var item in inboundOrder.Details)
+ // {
+ // Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(v => v.InboundOrderRowNo == item.RowNo && v.MaterielCode == item.MaterielCode));
+ // if (stockInfo == null)
+ // {
+ // return WebResponseContent.Instance.Error($"鏈壘鍒板簱瀛樹俊鎭�");
+ // }
- Dt_Warehouse? warehouse = warehouses.FirstOrDefault(x => x.WarehouseId == stockInfo.WarehouseId);
- if (warehouse == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�");
- }
+ // Dt_Warehouse? warehouse = warehouses.FirstOrDefault(x => x.WarehouseId == stockInfo.WarehouseId);
+ // if (warehouse == null)
+ // {
+ // return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�");
+ // }
- ERPInboundDetailModel detailModel = new ERPInboundDetailModel()
- {
- ExpiryDate = stockInfo.Details.FirstOrDefault()?.EffectiveDate ?? "",
- LocationCode = warehouse.WarehouseCode,
- MaterialsCode = item.MaterielCode,
- MfgDate = stockInfo.Details.FirstOrDefault()?.ProductionDate ?? "",
- QtyCustoms = "0",
- Quantity = stockInfo.Details.Sum(x => x.StockQuantity).ToString(),
- Rack = stockInfo.LocationCode,
- ReceiptCode = inboundOrder.UpperOrderNo,
- ReceiptSerNo = item.RowNo.ToString()
- };
- detailModels.Add(detailModel);
- }
- Dt_Warehouse? warehouse2 = warehouses.FirstOrDefault(x => x.WarehouseId == inboundOrder.WarehouseId);
- if (warehouse2 == null)
- {
- return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�");
- }
- ERPInboundModel model = new ERPInboundModel()
- {
- Code = inboundOrder.InboundOrderNo,
- 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 = warehouse2.WarehouseCode,
- Way = 1,
- Details = detailModels
- };
- //娴嬭瘯娉ㄩ噴
- _invokeERPService.InvokeInboundOrderApi(model);
- return WebResponseContent.Instance.OK();
- }
- catch (Exception ex)
- {
- return WebResponseContent.Instance.Error(ex.Message);
- }
- }
+ // ERPInboundDetailModel detailModel = new ERPInboundDetailModel()
+ // {
+ // ExpiryDate = stockInfo.Details.FirstOrDefault()?.EffectiveDate ?? "",
+ // LocationCode = warehouse.WarehouseCode,
+ // MaterialsCode = item.MaterielCode,
+ // MfgDate = stockInfo.Details.FirstOrDefault()?.ProductionDate ?? "",
+ // QtyCustoms = "0",
+ // Quantity = stockInfo.Details.Sum(x => x.StockQuantity).ToString(),
+ // Rack = stockInfo.LocationCode,
+ // ReceiptCode = inboundOrder.UpperOrderNo,
+ // ReceiptSerNo = item.RowNo.ToString()
+ // };
+ // detailModels.Add(detailModel);
+ // }
+ // Dt_Warehouse? warehouse2 = warehouses.FirstOrDefault(x => x.WarehouseId == inboundOrder.WarehouseId);
+ // if (warehouse2 == null)
+ // {
+ // return WebResponseContent.Instance.Error($"鏈壘鍒颁粨搴撲俊鎭�");
+ // }
+ // ERPInboundModel model = new ERPInboundModel()
+ // {
+ // Code = inboundOrder.InboundOrderNo,
+ // 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 = warehouse2.WarehouseCode,
+ // Way = 1,
+ // Details = detailModels
+ // };
+ // //娴嬭瘯娉ㄩ噴
+ // _invokeERPService.InvokeInboundOrderApi(model);
+ // return WebResponseContent.Instance.OK();
+ // }
+ // catch (Exception ex)
+ // {
+ // return WebResponseContent.Instance.Error(ex.Message);
+ // }
+ //}
public int GetPalletType(Dt_Warehouse warehouse, string palletCode, Dt_MaterielInfo materielInfo)
{
@@ -871,6 +905,15 @@
return PalletTypeEnum.LargestPallet.ObjToInt();
}
}
+ else if (warehouse.WarehouseCode == WarehouseEnum.HA153.ObjToString())
+ {
+ Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 1));
+ if (palletTypeInfo == null)
+ {
+ throw new Exception($"鎵樼洏鍙烽敊璇�");
+ }
+ return palletTypeInfo.PalletType;
+ }
else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString())
{
Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2));
@@ -880,6 +923,15 @@
}
return palletTypeInfo.PalletType;
}
+ else if (warehouse.WarehouseCode == WarehouseEnum.HA57.ObjToString())
+ {
+ Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3));
+ if (palletTypeInfo == null)
+ {
+ throw new Exception($"鎵樼洏鍙烽敊璇�");
+ }
+ return palletTypeInfo.PalletType;
+ }
return -1;
}
}
--
Gitblit v1.9.3