| | |
| | | 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) |
| | |
| | | /// </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>(); |
| | |
| | | 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, |
| | |
| | | { |
| | | 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); |
| | | } |
| | |
| | | { |
| | | 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, |
| | |
| | | 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); |