From bb56b2b6f21acb7c69c02585e5bc534d2f67715f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 27 三月 2025 17:13:35 +0800
Subject: [PATCH] WMS首页优化,WCS优化AGV和产线、输送线交互逻辑

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs"
index d5700e7..d7ac7e0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_ProductionLine.cs"
@@ -1,4 +1,5 @@
 锘縰sing 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(),
                 };

--
Gitblit v1.9.3