pan
2025-11-29 fcdbb4d6cc8eb3629b871a4945ff2da599d64107
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs
@@ -637,7 +637,7 @@
        /// <summary>
        /// åˆ†æ‰¹åˆ†é…åº“å­˜
        /// </summary>
        public async Task<WebResponseContent> BatchAllocateStock(string orderNo, int orderDetailId, decimal batchQuantity, string outStation)
        public async Task<WebResponseContent> GenerateOutboundBatchTasksAsync(int orderDetailId, decimal batchQuantity, string outStation)
        {
            try
            {
@@ -647,7 +647,7 @@
                List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
                List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = await BatchAllocateStockDataHandle(orderNo, orderDetailId, batchQuantity, outStation);
                (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = await BatchAllocateStockDataHandle(orderDetailId, batchQuantity, outStation);
                if (result.Item2 != null && result.Item2.Count > 0)
                {
@@ -676,7 +676,7 @@
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                _logger.LogError($"分批分配库存失败 - OrderNo: {orderNo}, OrderDetailId: {orderDetailId}, Quantity: {batchQuantity}, Error: {ex.Message}");
                _logger.LogError($"分批分配库存失败 -  OrderDetailId: {orderDetailId}, Quantity: {batchQuantity}, Error: {ex.Message}");
                return WebResponseContent.Instance.Error($"分批分配失败:{ex.Message}");
            }
        }
@@ -685,7 +685,7 @@
        /// åˆ†æ‰¹åˆ†é…åº“存数据处理
        /// </summary>
        public async Task<(List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?)>
            BatchAllocateStockDataHandle(string orderNo, int orderDetailId, decimal batchQuantity, string outStation)
            BatchAllocateStockDataHandle( int orderDetailId, decimal batchQuantity, string outStation)
        {
            List<Dt_Task> tasks = new List<Dt_Task>();
@@ -697,7 +697,11 @@
            {
                throw new Exception("未找到出库单明细信息");
            }
            var  outboundOrder = await _outboundOrderService.Db.Queryable<Dt_OutboundOrder>().FirstAsync(x => x.Id == outboundOrderDetail.OrderId);
            if(outboundOrder == null)
            {
                throw new Exception("未找到出库单信息");
            }
            // éªŒè¯è®¢å•明细状态
            if (outboundOrderDetail.OrderDetailStatus > OrderDetailStatusEnum.New.ObjToInt() &&
                outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.AssignOverPartial.ObjToInt())
@@ -732,9 +736,8 @@
            if (allocateResult.Item1 != null && allocateResult.Item1.Count > 0)
            {
                // åˆ›å»ºåˆ†æ‰¹è®°å½•
                await CreateBatchRecord(orderNo, orderDetailId, batchQuantity, batchNo);
                await CreateBatchRecord(outboundOrder.OrderNo, orderDetailId, batchQuantity, batchNo);
                Dt_OutboundOrder outboundOrder = await _outboundOrderService.Repository.QueryFirstAsync(x => x.Id == outboundOrderDetail.OrderId);
                TaskTypeEnum typeEnum = outboundOrder.OrderType switch
                {
                    (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound,