| | |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | PalletType=stockInfo.PalletType, |
| | | OrderNo = stockInfoDetail.OrderNo, |
| | | CurrentAddress = locationInfo.LocationCode, |
| | | Grade = 0, |
| | |
| | | TaskStatus = OutTaskStatusEnum.OutNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | Depth = locationInfo.Depth, |
| | | WarehouseId=stockInfo.WarehouseId, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)) |
| | | }; |
| | | tasks.Add(task); |
| | |
| | | |
| | | } |
| | | return tasks; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 出库任务数据处理 |
| | | /// </summary> |
| | | /// <param name="orderDetailId"></param> |
| | | /// <param name="stockSelectViews"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int[] keys) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = _outboundService.OutboundOrderDetailService.Repository.QueryData(x => keys.Contains(x.Id)); |
| | | |
| | | if (outboundOrderDetails == null || outboundOrderDetails.Count == 0) |
| | | { |
| | | throw new Exception("未找到出库单明细信息"); |
| | | } |
| | | if (outboundOrderDetails.FirstOrDefault(x => x.OrderDetailStatus > OrderDetailStatusEnum.New.ObjToInt() && x.OrderDetailStatus != OrderDetailStatusEnum.AssignOverPartial.ObjToInt()) != null) |
| | | { |
| | | throw new Exception("所选出库单明细存在出库中或已完成"); |
| | | } |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | List<Dt_OutboundOrderDetail>? orderDetails = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | //if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | (List<Dt_StockInfo>, List<Dt_OutboundOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutboundOrderDetailService.AssignStockOutbound(outboundOrderDetails); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | Dt_OutboundOrder outboundOrder = _outboundService.OutboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetails.FirstOrDefault().OrderId); |
| | | TaskTypeEnum typeEnum = outboundOrder.OrderType switch |
| | | { |
| | | (int)OutOrderTypeEnum.Issue => TaskTypeEnum.Outbound, |
| | | (int)OutOrderTypeEnum.Allocate => TaskTypeEnum.OutAllocate, |
| | | (int)OutOrderTypeEnum.Quality => TaskTypeEnum.OutQuality, |
| | | _ => new TaskTypeEnum() |
| | | }; |
| | | tasks = GetTasks(result.Item1); |
| | | tasks.ForEach(x => |
| | | { |
| | | x.OrderNo = outboundOrder.UpperOrderNo; |
| | | }); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | }); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | |
| | | x.Status = OutStockStatus.出库中.ObjToInt(); |
| | | }); |
| | | |
| | | stockInfos = result.Item1; |
| | | orderDetails = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("无库存"); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // List<Dt_OutStockLockInfo> stockLockInfos = _outboundService.OutboundStockLockInfoService.GetByOrderDetailId(outboundOrderDetail.OrderId, OutLockStockStatusEnum.已分配); |
| | | // 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, orderDetails, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | inboundOrder.CreateDate = DateTime.Now; |
| | | _unitOfWorkManage.BeginTran(); |
| | | bool a = BaseDal.Db.InsertNav(inboundOrder).Include(x => x.Details).ExecuteCommand(); |
| | | Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First(); |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.OrderId == oldOutboundOrder.Id); |
| | | List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | | StockSelectViewDTO stockSelectViewDTO = new() |
| | | { |
| | | OrderNo = orderAddDTO1.OrderNo, |
| | | MaterielCode = outboundOrderDetail.MaterielCode, |
| | | MaterielName = outboundOrderDetail.MaterielName, |
| | | UseableQuantity = outboundOrderDetail.OrderQuantity, |
| | | BatchNo = outboundOrderDetail.BatchNo, |
| | | LinId = outboundOrderDetail.LinId, |
| | | PalletCode = outboundOrderDetail.LPNNo, |
| | | }; |
| | | //Dt_OutboundOrder oldOutboundOrder = BaseDal.Db.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == orderAddDTO1.OrderNo).Includes(x => x.Details).First(); |
| | | //Dt_OutboundOrderDetail outboundOrderDetail = _outboundService.OutboundOrderDetailService.Repository.QueryFirst(x => x.OrderId == oldOutboundOrder.Id); |
| | | //List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | | //StockSelectViewDTO stockSelectViewDTO = new() |
| | | //{ |
| | | // OrderNo = orderAddDTO1.OrderNo, |
| | | // MaterielCode = outboundOrderDetail.MaterielCode, |
| | | // MaterielName = outboundOrderDetail.MaterielName, |
| | | // UseableQuantity = outboundOrderDetail.OrderQuantity, |
| | | // BatchNo = outboundOrderDetail.BatchNo, |
| | | // LinId = outboundOrderDetail.LinId, |
| | | // PalletCode = outboundOrderDetail.LPNNo, |
| | | //}; |
| | | |
| | | |
| | | stockSelectViews.Add(stockSelectViewDTO); |
| | | GenerateOutboundTasks(oldOutboundOrder.Id, stockSelectViews); |
| | | //stockSelectViews.Add(stockSelectViewDTO); |
| | | //GenerateOutboundTasks(oldOutboundOrder.Id, stockSelectViews); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | |
| | | // return content; |
| | | //} |
| | | //BaseDal.AddData(tasks); |
| | | |
| | | if (stockInfos != null && outboundOrderDetails != null && outStockLockInfos != null && locationInfos != null) |
| | | { |
| | | content = _outboundService.OutboundOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks); |
| | |
| | | /// </summary> |
| | | /// <param name="keys"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GenerateOutboundTask(int[] keys) |
| | | public WebResponseContent WMSGenerateOutboundTask(int[] keys) |
| | | { |
| | | try |
| | | { |
| | |
| | | foreach (int key in keys) |
| | | { |
| | | |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(key, stockSelectViews); |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(keys); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item2); |