dengjunjie
2025-03-27 bb56b2b6f21acb7c69c02585e5bc534d2f67715f
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs
@@ -1,4 +1,5 @@
using Magicodes.IE.Core;
using MailKit.Search;
using System;
using System.Threading.Tasks;
using WIDESEA_Core;
@@ -29,12 +30,24 @@
                if (stockInfo != null) throw new Exception($"托盘【{productionlineDTO.Barcode}】已存在库存信息");
                stockInfo = new Dt_StockInfo();
                stockInfo.Details = new List<Dt_StockInfoDetail>();
                var OrderNo = productionlineDTO.batchNo.Split('T')[0];
                Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(OrderNo);
                if (inboundOrder == null) throw new Exception($"未找到入库单【{OrderNo}】");
                Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == productionlineDTO.batchNo);
                if (inboundOrderDetail == null) throw new Exception($"未找到批号【{productionlineDTO.batchNo}】的入库详情");
                if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1) throw new Exception($"批号【{productionlineDTO.batchNo}】组盘数量超出");
                #region MyRegion
                Dt_InboundOrderDetail inboundOrderDetail = _inboundService.InboundOrderDetailService.Repository.QueryFirst(x => x.BatchNo == productionlineDTO.batchNo);
                if (inboundOrderDetail == null)
                    throw new Exception($"未找到批号【{productionlineDTO.batchNo}】的入库详情");
                if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1)
                    throw new Exception($"批号【{productionlineDTO.batchNo}】组盘数量超出");
                Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.Repository.QueryFirst(x => x.Id == inboundOrderDetail.OrderId);
                if (inboundOrder == null) throw new Exception($"未找到批号【{productionlineDTO.batchNo}】的入库头表");
                inboundOrder.Details = new List<Dt_InboundOrderDetail>() { inboundOrderDetail };
                #endregion
                #region MyRegion
                //var OrderNo = productionlineDTO.batchNo.Split('T')[0];
                //Dt_InboundOrder inboundOrder = _inboundService.InbounOrderService.GetInboundOrder(OrderNo);
                //if (inboundOrder == null) throw new Exception($"未找到入库单【{OrderNo}】");
                //Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.FirstOrDefault(x => x.BatchNo == productionlineDTO.batchNo);
                //if (inboundOrderDetail == null) throw new Exception($"未找到批号【{productionlineDTO.batchNo}】的入库详情");
                //if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1) throw new Exception($"批号【{productionlineDTO.batchNo}】组盘数量超出");
                #endregion
                Dt_Task dt_Task = new Dt_Task()
                {
@@ -45,8 +58,8 @@
                    Creater = "System",
                    PalletCode = productionlineDTO.Barcode,
                    Roadway = "SC01",
                    OrderNo = OrderNo,
                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
                    OrderNo = inboundOrder.OrderNo,
                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                    TaskState = InTaskStatusEnum.InNew.ObjToInt(),
                    TaskType = TaskTypeEnum.Inbound.ObjToInt(),
                    //TaskType = productionlineDTO.traytype == 2 ? TaskTypeEnum.PalletInbound.ObjToInt() : TaskTypeEnum.PalletReturnInbound.ObjToInt(),
@@ -199,7 +212,7 @@
                    PalletCode = lineDTO.Barcode,
                    OrderNo = StockInfoDetails.Count() == 1 ? StockInfoDetails.First().OrderNo : null,
                    Roadway = "SC01",
                    TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
                    TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                    TaskState = InTaskStatusEnum.InNew.ObjToInt(),
                    TaskType = TaskTypeEnum.Inbound.ObjToInt(),
                };