From 092f6e9efb6e4c2bc401ec134391ab0a25773b47 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期五, 21 二月 2025 16:41:38 +0800
Subject: [PATCH] PP仓提升机侧输送线流程

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs |   60 +++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 35 insertions(+), 25 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 92d02fb..b42d17e 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"
@@ -258,7 +258,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_TestToolSync.ToString());
+                Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_MaterialLotaAcept.ToString());
                 MESRoot<MesMaterialLotaAceptModel> root = new MESRoot<MesMaterialLotaAceptModel>()
                 {
                     From = "WMS",
@@ -333,7 +333,16 @@
         {
             try
             {
-                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA57.ToString());
+                string line = string.Empty;
+                if (!model.Line.Contains("SCUTL"))
+                {
+                    line = WarehouseEnum.HA58.ToString();
+                }
+                else
+                {
+                    line = WarehouseEnum.HA57.ToString();
+                }
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == line);
                 if (warehouse == null)
                 {
                     return MesResponseContent.Instance.Error($"浠撳簱鍩虹淇℃伅鏈厤缃�");
@@ -431,17 +440,11 @@
                     return MesResponseContent.Instance.Error($"鏈瘑鍒鎵樼洏绫诲瀷锛岃纭鎵樼洏鍙�");
                 }
 
-                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode == WarehouseEnum.HA57.ToString());
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == palletTypeInfo.WarehouseId);
 
-                Dt_StockInfo stockInfo = new Dt_StockInfo()
-                {
-                    PalletCode = model.CarrierCode,
-                    PalletType = palletTypeInfo.PalletType,
-                    WarehouseId = warehouse.WarehouseId,
-                    StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt()
-                };
 
-                Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.BatchNo == model.MaterialLot && x.MaterielCode == model.MaterialCode);
+                Dt_StockInfo_Hty stockInfo_Hty = _stockRepository.StockInfo_HtyRepository.QueryData(x => x.PalletCode == model.CarrierCode).OrderByDescending(x => x.SourceId).First();
+                Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.StockId == stockInfo_Hty.SourceId);
 
                 Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
                 {
@@ -455,27 +458,34 @@
                     OutboundQuantity = 0,
                     SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0",
                     StockQuantity = model.Quantity,
-                    Status = StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt(),
+                    Status = StockStatusEmun.MES閫�搴�.ObjToInt(),
                     Unit = model.Unit
                 };
-
-                Dt_Task task = new Dt_Task()
+                Dt_StockInfo stockInfo = new Dt_StockInfo()
                 {
-                    PalletCode = stockInfo.PalletCode,
-                    CurrentAddress = "",
-                    NextAddress = "",
-                    PalletType = stockInfo.PalletType,
-                    Roadway = "",
-                    SourceAddress = "",
-                    TargetAddress = "",
-                    TaskStatus = TaskStatusEnum.New.ObjToInt(),
-                    TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(),
-                    WarehouseId = warehouse.WarehouseId
+                    PalletCode = model.CarrierCode,
+                    PalletType = palletTypeInfo.PalletType,
+                    WarehouseId = warehouse.WarehouseId,
+                    StockStatus = StockStatusEmun.MES閫�搴�.ObjToInt(),
+                    Details = new List<Dt_StockInfoDetail> { stockInfoDetail }
                 };
+                //Dt_Task task = new Dt_Task()
+                //{
+                //    PalletCode = stockInfo.PalletCode,
+                //    CurrentAddress = "",
+                //    NextAddress = "",
+                //    PalletType = stockInfo.PalletType,
+                //    Roadway = "RGV01_BC",
+                //    SourceAddress = "RGV01_BC",
+                //    TargetAddress = "",
+                //    TaskStatus = TaskStatusEnum.New.ObjToInt(),
+                //    TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(),
+                //    WarehouseId = warehouse.WarehouseId
+                //};
 
                 _unitOfWorkManage.BeginTran();
                 Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand();
-                BaseDal.AddData(task);
+                //BaseDal.AddData(task);
                 _unitOfWorkManage.CommitTran();
 
                 return MesResponseContent.Instance.OK();

--
Gitblit v1.9.3