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>();
@@ -132,6 +132,8 @@
                            CurrentAddress = stockInfo.LocationCode,
                            Grade = 0,
                            PalletCode = stockInfo.PalletCode,
                            TargetIsPickPlace = false,
                            SourceIsPickPlace = locationInfo.Row == 1 ? false : stockInfo.SerialNumber == locationInfo.MaxQty,
                            NextAddress = "1008",
                            Roadway = locationInfo.RoadwayNo,
                            SourceAddress = stockInfo.LocationCode,
@@ -161,7 +163,7 @@
            {
                var locationInfo1 = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == 2 && x.Column == locationInfo.Column && x.Layer == locationInfo.Layer);
                stockInfos = _stockService.StockInfoService.Repository.QueryData(x => locationInfo1.LocationCode == x.LocationCode).OrderByDescending(x => x.SerialNumber).ToList();
                if (stockInfos == null|| stockInfos.Count < 1)
                if (stockInfos == null || stockInfos.Count < 1)
                {
                    return (dt_Tasks, locationInfos, stockInfos);
                }
@@ -178,7 +180,7 @@
                    {
                        CurrentAddress = item.LocationCode,
                        SourceIsPickPlace = item.SerialNumber == 12,
                        TargetIsPickPlace = i == 12,
                        TargetIsPickPlace = i == 12 ? locationInfo2.Row != 1 : false,
                        Grade = 0,
                        PalletCode = item.PalletCode,
                        NextAddress = locationInfo2.LocationCode,
@@ -209,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);
                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();
                    });
            List<Dt_LocationInfo>? locationInfos1 = null;
                    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_StockInfo>,  List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrder, stockSelectViews);
            if (result.Item1 != null && result.Item1.Count > 0)
            {
                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);
                }
            }
            else
            {
                throw new Exception("无库存");
            }
            return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos);