From e974c93c984188524f15964529203db25ede3170 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 15 三月 2025 16:07:58 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 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..f4369ea 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
 {
@@ -441,6 +442,7 @@
                 tasks.ForEach(x =>
                 {
                     x.TargetAddress = model.Line;
+                    x.OrderNo = mesOutboundOrder.TaskNo;
                 });
                 _unitOfWorkManage.BeginTran();
 
@@ -500,7 +502,7 @@
                     EffectiveDate = model.ExpirationDate,
                     MaterielCode = model.MaterialCode,
                     InboundOrderRowNo = stockInfoDetail_Hty?.InboundOrderRowNo ?? 0,
-                    MaterielName = model.MaterialCode,
+                    MaterielName = stockInfoDetail_Hty.MaterielName,
                     ProductionDate = model.ProductionDate,
                     OrderNo = stockInfoDetail_Hty?.OrderNo ?? "",
                     OutboundQuantity = 0,
@@ -979,7 +981,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 +1031,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)
@@ -1040,6 +1065,7 @@
             }
             return content;
         }
+        //澶栧寘淇℃伅鎺ユ敹
         public MesResponseContent BoxStockin(MesBoxInfoModel boxInfoModel)
         {
             MesResponseContent content = new MesResponseContent();
@@ -1634,9 +1660,5 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-
-
-
-
     }
 }

--
Gitblit v1.9.3