From 37454e625df68d40897112b2e8c2e3cf4d7163e3 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期三, 25 三月 2026 11:43:10 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 58 +++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 47 insertions(+), 11 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
index c2eb77e..418c05f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs"
@@ -50,9 +50,10 @@
private readonly IBasicService _basicService;
private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
private readonly IRepository<Dt_OutboundOrder> _outboundOrderRepository;
+ private readonly IRepository<Dt_OutboundOrderDetail> _outboundOrderDetailRepository;
public IRepository<Dt_InboundOrder> Repository => BaseDal;
- public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService, IBasicService basicService, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_OutboundOrder> outboundOrderRepository) : base(BaseDal)
+ public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService, IBasicService basicService, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_OutboundOrder> outboundOrderRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository) : base(BaseDal)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -71,6 +72,7 @@
_locationInfoRepository = locationInfoRepository;
_allocateOrderRepository = allocateOrderRepository;
_outboundOrderRepository = outboundOrderRepository;
+ _outboundOrderDetailRepository = outboundOrderDetailRepository;
}
public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType)
@@ -703,9 +705,10 @@
{
_unitOfWorkManage.BeginTran();
- // 鏅鸿兘璇嗗埆杈撳叆绫诲瀷
+
string palletCode = null;
string barcode = null;
+ int stockStatus = 0;
// 1. 鍏堝皾璇曟寜鎵樼洏鍙锋煡璇�
var stockByPallet = _stockRepository.Db.Queryable<Dt_StockInfo>()
@@ -718,10 +721,17 @@
{
// 璇嗗埆涓烘墭鐩樺彿
palletCode = code;
- var task =_taskRepository.Db.Queryable<Dt_Task>().Where(t => t.PalletCode == palletCode).ToList();
- if(task!=null && task.Any())
+ stockStatus = stockByPallet.StockStatus;
+
+ var task = _taskRepository.Db.Queryable<Dt_Task>().Where(t => t.PalletCode == palletCode).ToList();
+ if (task != null && task.Any())
{
return WebResponseContent.Instance.Error($"鎵樼洏鍙� {palletCode} 瀛樺湪鏈畬鎴愮殑浠诲姟锛屾棤娉曟挙閿�");
+ }
+
+ if (stockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+ {
+ return WebResponseContent.Instance.Error($"鎵樼洏鍙� {palletCode} 澶勪簬鍏ュ簱纭鐘舵�侊紝绂佹鏁存墭鐩樻挙閿�锛岃鍗曠嫭鎾ら攢鏉$爜");
}
}
else
@@ -732,13 +742,14 @@
{
var stockInfo = _stockRepository
.Db.Queryable<Dt_StockInfo>()
- .Where(s => s.Id == detail.StockId&& (s.StockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨 || s.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt()))
+ .Where(s => s.Id == detail.StockId && (s.StockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨 || s.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt()))
.First();
if (stockInfo != null)
{
barcode = code;
palletCode = stockInfo.PalletCode;
+ stockStatus = stockInfo.StockStatus;
}
}
else
@@ -771,6 +782,16 @@
return WebResponseContent.Instance.Error($"鎵樼洏 {palletCode} 涓嬫湭鎵惧埌鏉$爜 {barcode} 鐨勬槑缁嗚褰�");
}
+ if (stockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt())
+ {
+ var totalDetails = stock.Details?.Count ?? 0;
+ if (totalDetails <= 1)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error($"鎵樼洏 {palletCode} 澶勪簬鍏ュ簱纭鐘舵�侊紝褰撳墠浠呭墿浣欐渶鍚�1鏉℃槑缁嗭紝绂佹鎾ら攢锛堝繀椤讳繚鐣欒嚦灏�1鏉″簱瀛樻槑缁嗭級");
+ }
+ }
+
ResetInboundOrderStatus(new List<string> { targetDetail.OrderNo }, new List<string> { targetDetail.Barcode });
_stockDetailRepository.DeleteData(targetDetail);
@@ -780,10 +801,13 @@
if (!remainingDetails.Any())
{
- ResetInboundOrderStatus(stock.Details.Select(d => d.OrderNo).Distinct().ToList());
- _stockRepository.DeleteData(stock);
+ if (stockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨)
+ {
+ ResetInboundOrderStatus(stock.Details.Select(d => d.OrderNo).Distinct().ToList());
+ _stockRepository.DeleteData(stock);
+ }
_unitOfWorkManage.CommitTran();
- return WebResponseContent.Instance.OK($"鏉$爜 {barcode} 鎾ら攢鎴愬姛锛屾墭鐩樻棤鍓╀綑鏄庣粏锛屽凡鍒犻櫎鎵樼洏骞堕噸缃叧鑱斿叆搴撳崟鐘舵��");
+ return WebResponseContent.Instance.OK($"鏉$爜 {barcode} 鎾ら攢鎴愬姛锛屾墭鐩樻棤鍓╀綑鏄庣粏锛屽凡閲嶇疆鍏宠仈鍏ュ簱鍗曠姸鎬�");
}
_unitOfWorkManage.CommitTran();
@@ -791,7 +815,6 @@
}
else
{
- // ===== 鎾ら攢鏁翠釜鎵樼洏 =====
var stock = _stockRepository.Db.Queryable<Dt_StockInfo>()
.Includes(o => o.Details)
.First(x => x.PalletCode == palletCode
@@ -996,7 +1019,7 @@
}
var locationTypeDesc = _locationTypeRepository.Db.Queryable<Dt_LocationType>().Where(x => string.Equals(x.LocationTypeDesc, warehouseAreaName.Name, StringComparison.OrdinalIgnoreCase)).First();
- return WebResponseContent.Instance.OK(data:locationTypeDesc.LocationTypeDesc);
+ return WebResponseContent.Instance.OK(data:locationTypeDesc.LocationType);
}
public WebResponseContent HandCloseOrder(List<string> orderNos)
@@ -1031,10 +1054,23 @@
}
else if (outbound != null)
{
- if(outbound.OrderStatus !=(int)OutOrderStatusEnum.鏈紑濮� && outbound.OrderStatus != (int)OutOrderStatusEnum.鍑哄簱涓�)
+ if(outbound.OrderStatus ==(int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
{
return WebResponseContent.Instance.Error($"璇ュ崟鎹姸鎬佷笉鍙互鍏抽棴");
}
+ if(outbound.OrderStatus == (int)OutOrderStatusEnum.鍑哄簱涓�)
+ {
+ var outboundDetails = _outboundOrderDetailRepository.QueryData(x => x.OrderId == outbound.Id);
+ if (outboundDetails == null)
+ {
+ return WebResponseContent.Instance.Error("璇ュ崟鎹姸鎬佷笉鑳藉叧闂�");
+ }
+ var detailStatus = outboundDetails.All(x => x.LockQuantity == x.OverOutQuantity);
+ if (!detailStatus)
+ {
+ return WebResponseContent.Instance.Error("璇ュ崟鎹湁姝e湪鍑哄簱鐨勭墿鏂欙紝涓嶈兘鍏抽棴");
+ }
+ }
outbound.OrderStatus = (int)OutOrderStatusEnum.鍏抽棴;
outbound.Operator = App.User.UserName;
_outboundOrderRepository.UpdateData(outbound);
--
Gitblit v1.9.3