From d89c4f466c0922287ff88d4f61bfba71461cdbf0 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 02 十二月 2025 15:37:58 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs | 166 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 116 insertions(+), 50 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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
index fd2dbf8..aaf10c0 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_OutboundService/OutboundPickingService.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_OutboundService/OutboundPickingService.cs"
@@ -27,11 +27,13 @@
using WIDESEA_DTO.Outbound;
using WIDESEA_IAllocateService;
using WIDESEA_IBasicService;
+using WIDESEA_ICheckService;
using WIDESEA_IInboundService;
using WIDESEA_IOutboundService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Basic;
+using WIDESEA_Model.Models.Check;
namespace WIDESEA_OutboundService
{
@@ -59,7 +61,7 @@
private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
private readonly IInboundOrderDetailService _inboundOrderDetailService;
private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
-
+ private readonly IReCheckOrderService _reCheckOrderService;
private readonly ILogger<OutboundPickingService> _logger;
private Dictionary<string, string> stations = new Dictionary<string, string>
@@ -79,7 +81,7 @@
public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService,
IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService,
IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService,
- IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository) : base(BaseDal)
+ IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService, IDailySequenceService dailySequenceService, IAllocateService allocateService, IRepository<Dt_InboundOrder> inboundOrderRepository, IInboundOrderDetailService inboundOrderDetailService, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IReCheckOrderService reCheckOrderService) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_stockInfoService = stockInfoService;
@@ -99,6 +101,7 @@
_inboundOrderRepository = inboundOrderRepository;
_inboundOrderDetailService = inboundOrderDetailService;
_warehouseAreaRepository = warehouseAreaRepository;
+ _reCheckOrderService = reCheckOrderService;
}
@@ -1673,7 +1676,7 @@
// 鍒犻櫎鍘熷鍑哄簱浠诲姟
_taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
- // await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+ await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
@@ -1802,11 +1805,7 @@
_logger.LogInformation($"璁㈠崟鐘舵�佹洿鏂� - OrderNo: {orderNo}, 鏃х姸鎬�: {outboundOrder.OrderStatus}, 鏂扮姸鎬�: {newStatus}");
- // 鍙湁姝e父鍒嗘嫞瀹屾垚鏃舵墠鍚慚ES鍙嶉
- if (allCompleted && newStatus == (int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
- {
- await HandleOrderCompletion(outboundOrder, orderNo);
- }
+
}
}
catch (Exception ex)
@@ -1936,7 +1935,7 @@
{
ReqCode = Guid.NewGuid().ToString(),
ReqTime = DateTime.Now.ToString(),
- BusinessType = "3",
+ BusinessType = "2",
FactoryArea = outboundOrder.FactoryArea,
OperationType = 1,
@@ -2015,25 +2014,25 @@
// 鍙幏鍙栧凡鎷i�夊畬鎴愮殑閿佸畾璁板綍
var lists = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
- .Where(x => x.OrderNo == orderNo && x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
+ .Where(x => x.OrderNo == orderNo && (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
.ToListAsync();
- var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode })
+ var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
.Select(group => new FeedbackOutboundDetailsModel
{
materialCode = group.Key.MaterielCode,
lineNo = group.Key.lineNo,
warehouseCode = group.Key.WarehouseCode,
- qty = group.Sum(x => x.PickedQty),
- currentDeliveryQty = group.Sum(x => x.PickedQty),
- unit = group.Key.Unit,
+ qty = group.Sum(x => x.BarcodeQty),
+ currentDeliveryQty = group.Sum(x => x.BarcodeQty),
+ unit = group.Key.BarcodeUnit,
barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel
{
barcode = row.CurrentBarcode,
supplyCode = row.SupplyCode,
batchNo = row.BatchNo,
- unit = row.Unit,
- qty = row.PickedQty
+ unit = row.BarcodeUnit,
+ qty = row.BarcodeQty
}).ToList()
}).ToList();
@@ -2202,7 +2201,7 @@
_logger.LogInformation($"璁㈠崟 {orderNo} 宸叉爣璁颁负鍑哄簱瀹屾垚");
// 鍚慚ES鍙嶉璁㈠崟瀹屾垚锛堝鏋滈渶瑕侊級
- await HandleOrderCompletion(outboundOrder, orderNo);
+ //await HandleOrderCompletion(outboundOrder, orderNo);
}
}
@@ -2681,7 +2680,7 @@
}
}
- public async Task<WebResponseContent> NoStockOutSubmit(NoStockOutSubmit noStockOutSubmit)
+ public async Task<WebResponseContent> NoStockOutSubmit(NoStockOutSubmit noStockOutSubmit)
{
try
{
@@ -2808,7 +2807,7 @@
business_type = outboundOrder.BusinessType,
factoryArea = outboundOrder.FactoryArea,
operationType = 1,
- Operator = outboundOrder.Operator,
+ Operator = App.User.UserName,
orderNo = outboundOrder.UpperOrderNo,
documentsNO = outboundOrder.OrderNo,
status = outboundOrder.OrderStatus,
@@ -2822,28 +2821,29 @@
var detailLocks = await _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>()
.Where(x => x.OrderNo == outboundOrder.OrderNo &&
x.OrderDetailId == detail.Id &&
- x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
+ (x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
.ToListAsync();
- var detailModel = new FeedbackOutboundDetailsModel
- {
- materialCode = detail.MaterielCode,
- lineNo = detail.lineNo, // 娉ㄦ剰锛氳繖閲屽彲鑳介渶瑕佽皟鏁村瓧娈靛悕
- warehouseCode = detail.WarehouseCode,
- qty = detail.OverOutQuantity, // 浣跨敤璁㈠崟鏄庣粏鐨勫凡鍑哄簱鏁伴噺
- currentDeliveryQty = detail.OverOutQuantity,
- unit = detail.Unit,
- barcodes = detailLocks.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
- {
- barcode = lockInfo.CurrentBarcode,
- supplyCode = lockInfo.SupplyCode,
- batchNo = lockInfo.BatchNo,
- unit = lockInfo.Unit,
- qty = lockInfo.PickedQty // 鏉$爜绾у埆鐨勬暟閲忎粛鐢ㄩ攣瀹氳褰�
- }).ToList()
- };
+ var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
+ .Select(group => new FeedbackOutboundDetailsModel
+ {
- feedmodel.details.Add(detailModel);
+ materialCode = group.Key.MaterielCode,
+ lineNo = group.Key.lineNo,
+ warehouseCode = group.Key.WarehouseCode,
+ qty = group.Sum(x => x.BarcodeQty),
+ currentDeliveryQty = group.Sum(x => x.BarcodeQty),
+ unit = group.Key.BarcodeUnit,
+ barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = lockInfo.CurrentBarcode,
+ supplyCode = lockInfo.SupplyCode,
+ batchNo = lockInfo.BatchNo,
+ unit = lockInfo.BarcodeUnit,
+ qty = lockInfo.BarcodeQty
+ }).ToList()
+ }).ToList();
+ feedmodel.details.AddRange(groupdata);
}
var result = await _invokeMESService.FeedbackOutbound(feedmodel);
if (result != null && result.code == 200)
@@ -2934,10 +2934,21 @@
return content = WebResponseContent.Instance.Error($"浠撳簱涓病鏈夎{materielGroupDTO.WarehouseType}缂栧彿銆�");
}
+ if (materielGroupDTO.orderTypes == InOrderTypeEnum.ReCheck.ObjToInt())
+ {
+ var dborder = _reCheckOrderService.Db.Queryable<Dt_ReCheckOrder>().First(x => x.OrderNo == materielGroupDTO.OrderNo);
+ if (dborder != null && dborder.SignSeq == 0)
+ {
+ return content.Error("鍙湁鎷垮埌閲嶆缁撴灉鎵嶈兘鍏ュ簱锛�");
+ }
+ else
+ {
+ return content.Error("娌℃湁鎵惧埌閲嶆鍗曟嵁鏁版嵁銆�");
+ }
+ }
+ // Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo);
- // Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo);
-
- var dbinboundOrderDetails = Db.Queryable<Dt_PickingRecord>().Where(x=>x.OrderNo== materielGroupDTO.OrderNo && !x.IsCancelled && x.Barcode==materielGroupDTO.Barcodes).ToList();
+ var dbinboundOrderDetails = Db.Queryable<Dt_PickingRecord>().Where(x => x.OrderNo == materielGroupDTO.OrderNo && !x.IsCancelled && x.Barcode == materielGroupDTO.Barcodes).ToList();
if (dbinboundOrderDetails != null && !dbinboundOrderDetails.Any())
{
@@ -2950,13 +2961,38 @@
- (bool, string, object?) result = CheckMaterielGroupParam(materielGroupDTO, materielCodes, stockInfo);
+ (bool, string, object?) result = CheckMaterielGroupParam(materielGroupDTO, materielCodes, stockInfo);
if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2);
if (stockInfo == null)
{
stockInfo = new Dt_StockInfo() { PalletType = (int)PalletTypeEnum.None, LocationType = materielGroupDTO.locationType.ObjToInt() };
stockInfo.Details = new List<Dt_StockInfoDetail>();
+ }
+ var inboindId = 0; Dt_InboundOrder dt_InboundOrder = null;
+ var dbinbound = _inboundOrderRepository.QueryData(x => x.InboundOrderNo == dbinboundOrderDetails.First().OrderNo).First();
+ if (dbinbound == null)
+ {
+ dt_InboundOrder = new Dt_InboundOrder
+ {
+ WarehouseId = 0,
+ InboundOrderNo = dbinboundOrderDetails.First()?.OrderNo,
+ UpperOrderNo = dbinboundOrderDetails.First()?.OrderNo,
+ SupplierId = dbinboundOrderDetails.First()?.SupplyCode,
+ OrderType = materielGroupDTO.orderTypes,
+
+ BusinessType = materielGroupDTO.orderTypes.ToString(),
+
+ FactoryArea = dbinboundOrderDetails.First()?.FactoryArea,
+ Remark = "",
+ Details = new List<Dt_InboundOrderDetail>()
+ };
+ inboindId = _inboundOrderRepository.AddData(dt_InboundOrder);
+ }
+ else
+ {
+ dt_InboundOrder = new Dt_InboundOrder { Details = new List<Dt_InboundOrderDetail>() };
+ inboindId = dbinbound.Id;
}
foreach (var item in dbinboundOrderDetails)
@@ -2976,12 +3012,34 @@
BarcodeUnit = item.BarcodeUnit,
FactoryArea = item.FactoryArea,
Status = 0,
- OrderNo = item.OrderNo,
+ OrderNo = item.OrderNo,
+ BusinessType = InOrderTypeEnum.InternalAllocat.ObjToInt().ToString()
- });
+ });
item.WarehouseCode = item.WarehouseCode;
+
+ dt_InboundOrder.Details.Add(new Dt_InboundOrderDetail
+ {
+ OrderId = inboindId,
+ MaterielCode = item.MaterielCode,
+ MaterielName = "",
+ BatchNo = item.BatchNo,
+ OrderQuantity = item.PickQuantity,
+ ReceiptQuantity = 0,
+ OverInQuantity = 0,
+ Unit = item.BarcodeUnit,
+ RowNo = 0,
+ lineNo = item.lineNo,
+ SupplyCode = item.SupplyCode,
+ WarehouseCode = item.WarehouseCode,
+ Barcode = item.Barcode,
+ OutBoxbarcodes = "",
+ BarcodeQty = (decimal)item.BarcodeQty,
+ BarcodeUnit = item.BarcodeUnit
+ });
}
+ _inboundOrderDetailService.Db.Insertable<Dt_InboundOrderDetail>(dt_InboundOrder.Details);
if (stockInfo.Id == 0)
{
stockInfo.PalletCode = materielGroupDTO.PalletCode;
@@ -2994,7 +3052,7 @@
try
{
_unitOfWorkManage.BeginTran();
-
+
_stockService.StockInfoService.AddMaterielGroup(stockInfo);
_unitOfWorkManage.CommitTran();
return WebResponseContent.Instance.OK();
@@ -3003,7 +3061,7 @@
{
_unitOfWorkManage.RollbackTran();
return WebResponseContent.Instance.Error(ex.Message);
- }
+ }
}
catch (Exception ex)
{
@@ -3016,9 +3074,9 @@
return content;
}
-
- public (bool, string, object?) CheckMaterielGroupParam(BarcodeMaterielGroupDTO materielGroupDTO, List<string> barcodeCodes, Dt_StockInfo stockInfo)
+
+ public (bool, string, object?) CheckMaterielGroupParam(BarcodeMaterielGroupDTO materielGroupDTO, List<string> barcodeCodes, Dt_StockInfo stockInfo)
{
(bool, string, object?) result = ModelValidate.ValidateModelData(materielGroupDTO);
if (!result.Item1) return result;
@@ -3037,8 +3095,8 @@
{
return (false, $"{barcodeCodes[0]} 鏉$爜鍦ㄥ簱瀛樹腑宸插瓨鍦�", materielGroupDTO);
}
-
-
+
+
return (true, "鎴愬姛", materielGroupDTO);
}
@@ -3112,12 +3170,20 @@
public bool HasSplitRecords { get; set; }
public decimal RemainingLocksReturnQty { get; set; }
public decimal PalletStockReturnQty { get; set; }
+
public decimal SplitReturnQty { get; set; }
public decimal TotalReturnQty { get; set; }
+
+ // 鏈垎閰嶇殑閿佸畾璁板綍锛堝鑷姩鎷嗗寘浜х敓鐨勶級
+ public bool HasUnallocatedLocks { get; set; }
+ public List<Dt_OutStockLockInfo> UnallocatedLocks { get; set; } = new List<Dt_OutStockLockInfo>();
+ public decimal UnallocatedLocksReturnQty { get; set; }
+
public List<Dt_OutStockLockInfo> RemainingLocks { get; set; } = new List<Dt_OutStockLockInfo>();
public List<Dt_StockInfoDetail> PalletStockGoods { get; set; } = new List<Dt_StockInfoDetail>();
public List<Dt_SplitPackageRecord> SplitRecords { get; set; } = new List<Dt_SplitPackageRecord>();
+ public List<string> AllBarcodes { get; set; } = new List<string>();
// 绌烘墭鐩樼浉鍏冲睘鎬�
public bool IsEmptyPallet { get; set; }
public bool HasActiveTasks { get; set; }
--
Gitblit v1.9.3