From 70aa9b5ca249a84e5867912d551cdafbec76e54e Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期五, 05 十二月 2025 09:45:17 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs | 128 ++++++++++++++++++++++++------------------
1 files changed, 74 insertions(+), 54 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 e8415a6..5345170 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"
@@ -32,6 +32,7 @@
using WIDESEA_IInboundService;
using WIDESEA_IOutboundService;
using WIDESEA_IStockService;
+using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Basic;
using WIDESEA_Model.Models.Check;
@@ -63,6 +64,7 @@
private readonly IInboundOrderDetailService _inboundOrderDetailService;
private readonly IRepository<Dt_WarehouseArea> _warehouseAreaRepository;
private readonly IReCheckOrderService _reCheckOrderService;
+ private readonly ITask_HtyService _task_HtyService;
private readonly ILogger<OutboundPickingService> _logger;
private Dictionary<string, string> stations = new Dictionary<string, string>
@@ -82,7 +84,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, IReCheckOrderService reCheckOrderService) : 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, ITask_HtyService task_HtyService) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_stockInfoService = stockInfoService;
@@ -103,6 +105,7 @@
_inboundOrderDetailService = inboundOrderDetailService;
_warehouseAreaRepository = warehouseAreaRepository;
_reCheckOrderService = reCheckOrderService;
+ _task_HtyService = task_HtyService;
}
@@ -1124,7 +1127,7 @@
{
// 鑾峰彇鏈�鏂扮殑璁㈠崟鏄庣粏鏁版嵁锛堝甫閿侊級
var currentOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
- .With(SqlWith.RowLock)
+ //.With(SqlWith.RowLock)
.FirstAsync(x => x.Id == orderDetailId);
decimal newOverOutQuantity = currentOrderDetail.OverOutQuantity - cancelQty;
@@ -1684,14 +1687,29 @@
WarehouseId = originalTask.WarehouseId
};
- // 淇濆瓨鍥炲簱浠诲姟
- await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
+ try
+ {
+ // 淇濆瓨鍥炲簱浠诲姟
+ var insertcount = await _taskRepository.Db.Insertable(returnTask).ExecuteCommandAsync();
+ if (insertcount <= 0)
+ {
+ throw new Exception("鍒涘缓浠诲姟澶辫触锛�");
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogInformation($"CreateReturnTaskAndHandleESS 鍒涘缓浠诲姟澶辫触: {orderNo} 锛� {palletCode}");
+ throw new Exception("鍒涘缓浠诲姟澶辫触锛�");
+ }
var targetAddress = originalTask.TargetAddress;
// 鍒犻櫎鍘熷鍑哄簱浠诲姟
- _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
- await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
-
+ // _taskRepository.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.鑷姩瀹屾垚);
+ var result = _task_HtyService.DeleteAndMoveIntoHty(originalTask, OperateTypeEnum.浜哄伐鍒犻櫎);
+ if (!result)
+ {
+ await _taskRepository.Db.Deleteable(originalTask).ExecuteCommandAsync();
+ }
// 缁� ESS 鍙戦�佹祦鍔ㄤ俊鍙峰拰鍒涘缓浠诲姟
@@ -2093,8 +2111,7 @@
{
// 1. 鍒犻櫎搴撳瓨鏁伴噺涓�0鐨勬槑缁嗚褰�
var deleteDetailCount = await _stockInfoDetailService.Db.Deleteable<Dt_StockInfoDetail>()
- .Where(x => x.StockId == stockId && x.StockQuantity == 0 && (x.Status == StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() || x.Status ==
- StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()))
+ .Where(x => x.StockId == stockId && x.StockQuantity == 0)
.ExecuteCommandAsync();
await _stockInfoService.Db.Deleteable<Dt_StockInfo>()
@@ -2753,15 +2770,15 @@
TaskNum = 0,
Status = (int)OutLockStockStatusEnum.鎷i�夊畬鎴�,
Unit = outboundOrderDetail.Unit,
- SupplyCode = outboundOrderDetail.SupplyCode?? "鏃�",
+ SupplyCode = outboundOrderDetail.SupplyCode ?? "鏃�",
OrderType = outboundOrder.OrderType,
CurrentBarcode = inboundOrderDetail.Barcode,
IsSplitted = 1,
Operator = App.User.UserName,
- lineNo= outboundOrderDetail.lineNo,
+ lineNo = outboundOrderDetail.lineNo,
WarehouseCode = outboundOrderDetail.WarehouseCode ?? "鏃�",
- BarcodeQty=outboundOrderDetail.NoStockOutQty,
- BarcodeUnit =outboundOrderDetail.BarcodeUnit,
+ BarcodeQty = outboundOrderDetail.NoStockOutQty,
+ BarcodeUnit = outboundOrderDetail.BarcodeUnit,
BatchNo = outboundOrderDetail.BatchNo
};
_outStockLockInfoService.AddData(newLockInfo);
@@ -2843,18 +2860,18 @@
var documentNo = UniqueValueGenerator.Generate();
var outfeedmodel = new FeedbackOutboundRequestModel
- {
- reqCode = Guid.NewGuid().ToString(),
- reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
- business_type = outboundOrder.BusinessType,
- factoryArea = outboundOrder.FactoryArea,
- operationType = 1,
- Operator = App.User.UserName,
- orderNo = outboundOrder.UpperOrderNo,
- documentsNO = documentNo,
- status = outboundOrder.OrderStatus,
- details = new List<FeedbackOutboundDetailsModel>()
- };
+ {
+ reqCode = Guid.NewGuid().ToString(),
+ reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+ business_type = outboundOrder.BusinessType,
+ factoryArea = outboundOrder.FactoryArea,
+ operationType = 1,
+ Operator = App.User.UserName,
+ orderNo = outboundOrder.UpperOrderNo,
+ documentsNO = documentNo,
+ status = outboundOrder.OrderStatus,
+ details = new List<FeedbackOutboundDetailsModel>()
+ };
foreach (var detail in outboundOrder.Details)
{
// 鑾峰彇璇ユ槑缁嗗搴旂殑鏉$爜淇℃伅锛堜粠閿佸畾璁板綍锛�
@@ -2864,34 +2881,34 @@
(x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴� || x.Status == (int)OutLockStockStatusEnum.宸插洖搴�))
.ToListAsync();
- var groupdata = detailLocks.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
- .Select(group => new FeedbackOutboundDetailsModel
- {
+ var groupdata = detailLocks.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.BarcodeUnit,
- barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
- {
- barcode = lockInfo.CurrentBarcode,
- supplyCode = lockInfo.SupplyCode,
- batchNo = lockInfo.BatchNo,
- unit = lockInfo.BarcodeUnit,
- qty = lockInfo.PickedQty
- }).ToList()
- }).ToList();
- outfeedmodel.details.AddRange(groupdata);
- }
- var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
- if (result != null && result.code == 200)
- {
- await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
- .SetColumns(x => x.ReturnToMESStatus == 1)
- .Where(x => x.OrderId == outboundOrder.Id)
- .ExecuteCommandAsync();
+ 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.BarcodeUnit,
+ barcodes = group.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = lockInfo.CurrentBarcode,
+ supplyCode = lockInfo.SupplyCode,
+ batchNo = lockInfo.BatchNo,
+ unit = lockInfo.BarcodeUnit,
+ qty = lockInfo.PickedQty
+ }).ToList()
+ }).ToList();
+ outfeedmodel.details.AddRange(groupdata);
+ }
+ var result = await _invokeMESService.FeedbackOutbound(outfeedmodel);
+ if (result != null && result.code == 200)
+ {
+ await _outboundOrderDetailService.Db.Updateable<Dt_OutboundOrderDetail>()
+ .SetColumns(x => x.ReturnToMESStatus == 1)
+ .Where(x => x.OrderId == outboundOrder.Id)
+ .ExecuteCommandAsync();
await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>()
.SetColumns(x => x.ReturnToMESStatus == 1)
@@ -2978,6 +2995,8 @@
{
return content.Error("鍙湁鎷垮埌閲嶆缁撴灉鎵嶈兘鍏ュ簱锛�");
}
+
+
}
// Dt_InboundOrder inboundOrder = GetInboundOrder(materielGroupDTO.OrderNo);
@@ -3003,7 +3022,8 @@
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();
+ var orderno = dbinboundOrderDetails.First().OrderNo;
+ var dbinbound = _inboundOrderRepository.QueryData(x => x.InboundOrderNo == orderno).FirstOrDefault();
if (dbinbound == null)
{
dt_InboundOrder = new Dt_InboundOrder
@@ -3046,7 +3066,7 @@
FactoryArea = item.FactoryArea,
Status = 0,
OrderNo = item.OrderNo,
- BusinessType = InOrderTypeEnum.InternalAllocat.ObjToInt().ToString()
+ BusinessType = materielGroupDTO.orderTypes.ToString()
});
item.WarehouseCode = item.WarehouseCode;
--
Gitblit v1.9.3