From 2f8a8a7b31c7e311d1824c76e2a67e2a128bc65b Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 06 三月 2025 17:34:04 +0800
Subject: [PATCH] 成品入库任务,货位

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 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 aee204f..5039413 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
 {
@@ -76,7 +77,7 @@
                       (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut));
                     if (locationInfo == null)
                     {
-                        return responseContent.Error($"娴嬭瘯鏋惰揣浣�:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
+                        return responseContent.Error($"娴嬭瘯鏋惰揣浣嶃�傘�傘�傘�傘�傘�傘�傘�傘��:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
                     }
                     //鐢熸垚娴嬭瘯鏋跺嚭搴撲换鍔� 閿佸畾搴撳瓨 鏇存敼璐т綅鐘舵��
                     Dt_Task taskOut = new()
@@ -975,7 +976,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)
                 {
@@ -1020,13 +1026,36 @@
                     PalletCode = bagInfoModel.BatchNo,
                     PalletType = 1,
                     WarehouseId = warehouse.WarehouseId,
-                    StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+                    StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(),
                     proStockInfoDetails = proStockInfoDetails
                 };
+                //鍒嗛厤璐т綅
+                locationInfo = _basicService.LocationInfoService.AssignLocation(locationInfo.RoadwayNo, ((PalletTypeEnum)proStockInfo.PalletType).ObjToInt(), proStockInfo.WarehouseId);
+                Dt_Task newTask = new Dt_Task()
+                {
+                    CurrentAddress = bagInfoModel.WorkCenter,
+                    Grade = 0,
+                    NextAddress = locationInfo.LocationCode,
+                    PalletCode = proStockInfo.PalletCode,
+                    Roadway = locationInfo.RoadwayNo,
+                    SourceAddress = bagInfoModel.WorkCenter,
+                    TargetAddress = locationInfo.LocationCode,
+                    TaskType = TaskTypeEnum.InProduct.ObjToInt(),
+                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                    WarehouseId = warehouse.WarehouseId,
+                    PalletType = proStockInfo.PalletType
+                };
+                locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
+                
                 _unitOfWorkManage.BeginTran();
+                int taskId = BaseDal.AddData(newTask);
+                newTask.TaskId = taskId;
+                _basicRepository.LocationInfoRepository.UpdateData(locationInfo);
                 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)
@@ -1618,9 +1647,5 @@
                 return WebResponseContent.Instance.Error(ex.Message);
             }
         }
-
-
-
-
     }
 }

--
Gitblit v1.9.3