From 7d173d42cba04b4243f13c6ce013b04e1be4dc95 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 07 三月 2025 16:59:34 +0800
Subject: [PATCH] 成品输送线

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
index c344da4..cc46e19 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
@@ -29,6 +29,7 @@
 using WIDESEA_DTO.Task;
 using WIDESEA_DTO.Stock;
 using SqlSugar;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
 
 namespace WIDESEA_TaskInfoService
 {
@@ -979,7 +980,12 @@
                 {
                     return content.Error("鏈壘鍒颁粨搴撲俊鎭�");
                 }
-                //鍒ゆ柇鏄惁MES鍐呭寘淇℃伅鏄惁閲嶅
+                Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouse.WarehouseId);
+                if (locationInfo==null)
+                {
+                    return content.Error($"鏈壘鍒皗warehouse.WarehouseCode}璐т綅淇℃伅");
+                }
+                //鍐呭寘淇℃伅缁勭洏
                 List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>();
                 foreach (var item in bagInfoModel.BagDetails)
                 {
@@ -1024,13 +1030,31 @@
                     PalletCode = bagInfoModel.BatchNo,
                     PalletType = 1,
                     WarehouseId = warehouse.WarehouseId,
-                    StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+                    StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
                     proStockInfoDetails = proStockInfoDetails
                 };
+                Dt_Task newTask = new Dt_Task()
+                {
+                    CurrentAddress = bagInfoModel.WorkCenter,
+                    Grade = 0,
+                    NextAddress = "",
+                    PalletCode = proStockInfo.PalletCode,
+                    Roadway = locationInfo.RoadwayNo,
+                    SourceAddress = bagInfoModel.WorkCenter,
+                    TargetAddress = "",
+                    TaskType = TaskTypeEnum.InProduct.ObjToInt(),
+                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                    WarehouseId = warehouse.WarehouseId,
+                    PalletType = proStockInfo.PalletType
+                };
                 _unitOfWorkManage.BeginTran();
+                int taskId = BaseDal.AddData(newTask);
+                newTask.TaskId = taskId;
                 Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand();
                 Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand();
                 _unitOfWorkManage.CommitTran();
+                //鎺ㄩ�佷换鍔�
+                PushTasksToWCS(new List<Dt_Task> { newTask });
                 return content.OK("鎺ユ敹鎴愬姛");
             }
             catch (Exception ex)
@@ -1634,9 +1658,5 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-
-
-
-
     }
 }

--
Gitblit v1.9.3