1
yangpeixing
2026-03-31 e9fbecd61a9ab8c5d906269150b6cdc8ca86dfdb
1

1
已修改3个文件
47 ■■■■■ 文件已修改
WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/IStockQuantityChangeRecordService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/IStockQuantityChangeRecordService.cs
@@ -15,5 +15,7 @@
        IStockQuantityChangeRecordRepository Repository { get; }
        void AddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType,int? taskNum = null);
        void NEWAddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType, int? taskNum = null);
    }
}
WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
@@ -53,5 +53,37 @@
                throw new Exception(ex.Message);
            }
        }
        public void NEWAddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType, int? taskNum = null)
        {
            try
            {
                List<Dt_StockQuantityChangeRecord> stockQuantityChangeRecords = new List<Dt_StockQuantityChangeRecord>();
                stockQuantityChangeRecords = _mapper.Map<List<Dt_StockQuantityChangeRecord>>(stockInfoDetails);
                int index = 0;
                decimal currentQuantity = 0;
                stockQuantityChangeRecords.ForEach(x =>
                {
                    x.PalleCode = stockInfo.PalletCode;
                    x.BeforeQuantity = beforeQuantity;
                    if (totalQuantity <= beforeQuantity)
                    {
                        x.ChangeQuantity = stockInfoDetails[index].OutboundQuantity;
                        currentQuantity += stockInfoDetails[index].OutboundQuantity;
                        x.AfterQuantity = beforeQuantity - stockInfoDetails[index].OutboundQuantity ;
                    }
                    x.ChangeType = changeType.ObjToInt();
                    beforeQuantity -= x.ChangeQuantity;
                    x.TaskNum = taskNum;
                    index++;
                });
                BaseDal.AddData(stockQuantityChangeRecords);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}
WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -2303,7 +2303,11 @@
                        {
                            Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrderDetail>()
                           .Where(x => x.OrderId == inboundOrder.Id && x.BatchNo == detail.BatchNo).First();
                            outboundOrderDetails.Add(outboundOrderDetail);
                            if(outboundOrderDetail != null)
                            {
                                outboundOrderDetails.Add(outboundOrderDetail);
                            }
                        }
                        for (var i = 0; i < outboundOrderDetails.Count; i++)
@@ -2512,6 +2516,7 @@
                // 添加状态变更记录
                AddStatusChangeRecord(task, stockInfo, locationInfo);
                // 根据订单类型处理不同逻辑
                var outboundOrder = _outboundService.OutboundOrderService.Db.Queryable<Dt_OutboundOrder>()
@@ -2649,6 +2654,12 @@
                StockChangeType.Outbound.ObjToInt(),
                stockInfo.Details.FirstOrDefault()?.OrderNo ?? "",
                task.TaskNum);
            _recordService.StockQuantityChangeRecordService.NEWAddStockChangeRecord(
                stockInfo, stockInfo.Details,
                stockInfo.Details.Sum(x => x.StockQuantity),
                stockInfo.Details.Sum(x => x.OutboundQuantity),
                StockChangeType.Outbound, task.TaskNum);
        }
        private void ProcessNormalOutbound(Dt_Task task, Dt_StockInfo stockInfo,