1
dengjunjie
2025-03-18 9f225bb1f1e26d25c1652d3e1ec2a8f239f69615
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Outbound.cs
@@ -83,7 +83,7 @@
            List<Dt_OutStockLockInfo>? outStockLockInfos = null;
            List<Dt_LocationInfo>? locationInfos = null;
            List<Dt_LocationInfo>? locationInfos1 = null;
            Dt_OutboundOrder outboundOrder = null;
            Dt_OutboundOrder? outboundOrder = null;
            (List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?, Dt_OutboundOrder?) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails);
            if (result.Item1 != null && result.Item1.Count > 0)
@@ -111,7 +111,7 @@
        /// </summary>
        /// <param name="stockInfos"></param>
        /// <returns></returns>
        public (List<Dt_Task>, List<Dt_LocationInfo>, List<Dt_StockInfo>) GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType, List<Dt_LocationInfo> locationInfos)
        public (List<Dt_Task>?, List<Dt_LocationInfo>?, List<Dt_StockInfo>?) GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType, List<Dt_LocationInfo>? locationInfos)
        {
            List<Dt_Task> tasks = new List<Dt_Task>();
            List<Dt_LocationInfo> locations = new List<Dt_LocationInfo>();
@@ -211,45 +211,27 @@
            List<Dt_Task> tasks = new List<Dt_Task>();
            Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId);
            if (outboundOrderDetail == null)
            {
                throw new Exception("未找到出库单明细信息");
            }
            if (outboundOrderDetail == null) throw new Exception("未找到出库单明细信息");
            if (outboundOrderDetail.OrderDetailStatus != OrderDetailStatusEnum.New.ObjToInt())
                throw new Exception("所选出库单明细存在出库中或已完成");
            Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId);
            outboundOrder.Details = new List<Dt_OutboundOrderDetail> { outboundOrderDetail };
            List<Dt_StockInfo>? stockInfos = null;
            Dt_OutboundOrderDetail? orderDetail = null;
            List<Dt_OutStockLockInfo>? outStockLockInfos = null;
            List<Dt_LocationInfo>? locationInfos = null;
            if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
            {
                (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews);
            List<Dt_LocationInfo>? locationInfos1 = null;
            (List<Dt_StockInfo>,  List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrder, stockSelectViews);
                if (result.Item1 != null && result.Item1.Count > 0)
                {
                    tasks = GetTasks(result.Item1);
                    result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt();
                    result.Item3.ForEach(x =>
                    {
                        x.Status = OutStockStatus.出库中.ObjToInt();
                    });
                    stockInfos = result.Item1;
                    orderDetail = result.Item2;
                    outStockLockInfos = result.Item3;
                    locationInfos = result.Item4;
                }
                else
                {
                    throw new Exception("无库存");
                }
            }
            else if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.AssignOverPartial.ObjToInt() || outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.AssignOver.ObjToInt())
            {
                List<Dt_OutStockLockInfo> stockLockInfos = _outboundService.OutboundStockLockInfoService.GetByOrderDetailId(outboundOrderDetail.Id);
                if (stockLockInfos != null && stockLockInfos.Count > 0)
                {
                    List<Dt_StockInfo> stocks = _stockService.StockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList());
                    tasks = GetTasks(stocks);
                }
            }
            return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos);