From 2ecf5dfa71bf0c553c30ced6f68a81fa3be6a93f Mon Sep 17 00:00:00 2001
From: xiaoyang <xiaoyang@hnkhzn.com>
Date: 星期五, 08 十一月 2024 20:03:58 +0800
Subject: [PATCH] 11.08-1

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs |  122 ++++------------------------------------
 1 files changed, 12 insertions(+), 110 deletions(-)

diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index 5901b8a..cd77752 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -81,105 +81,6 @@
 
     #region 鍑哄簱浠诲姟瀹屾垚
 
-    /// <summary>
-    /// 鍑哄簱浠诲姟瀹屾垚
-    /// </summary>
-    /// <param name="saveModel">浠诲姟鏁版嵁鍚堥泦</param>
-    /// <returns>杩斿洖缁撴灉闆�</returns>
-    //public async Task<WebResponseContent> CompleteStackTaskAsync(Dt_Task task, DtStockInfo stock)
-    //{
-    //    WebResponseContent content = new WebResponseContent();
-    //    try
-    //    {
-    //        if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
-    //        {
-    //            var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
-    //                 .FirstAsync(x => x.EquipmentName == task.Roadway);
-    //            EquipmentParameterInfo info = JsonConvert.DeserializeObject<EquipmentParameterInfo>(process.ProcessValue);
-    //            AgingOutputDto agingOutputDto = new AgingOutputDto()
-    //            {
-    //                OpFlag = 1,
-    //                EquipmentCode = stock.LocationInfo.RoadwayNo,
-    //                TrayBarcode = stock.PalletCode,
-    //                SerialNos = stock.StockInfoDetails.Select(x => new SerialNoOutDto()
-    //                {
-    //                    SlotNo = x.OrderNo.ToInt32(),
-    //                    SerialNo = x.SerialNumber,
-    //                    SerialNoResult = true,
-    //                    ParameterInfo = new List<ParameterInfo>()
-    //                    {
-    //                        new ParameterInfo()
-    //                        {
-    //                            LowerLomit =info.LowerControlLimit,
-    //                            UpperLimit = info.UpperControlLimit,
-    //                            ParameterResult = info.EquipmentAvailabilityFlag,
-    //                            ParameterCode = info.ParameterCode,
-    //                            ParameterDesc = info.Description,
-    //                            TargetValue = info.TargetValue,
-    //                            Value = info.TargetValue,
-    //                            DefectCode = info.UOMCode
-    //                        }
-    //                    }
-    //                }).ToList()
-    //            };
-    //            content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
-    //            var result = JsonConvert.DeserializeObject<BasicResult>(content.ToString());
-    //            if (!result.Success)
-    //            {
-    //                throw new Exception(result.MOMMessage);
-    //            }
-    //        }
-    //        // 鏇存柊搴撳瓨鐘舵��
-    //        var loation = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
-    //        var detail = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
-
-    //        // 璁剧疆搴撲綅鐘舵�佷负绌洪棽
-    //        loation.LocationStatus = LocationEnum.Free.ObjToInt();
-
-    //        // 鏇存柊浠诲姟鐘舵��
-    //        task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
-    //        task.CurrentAddress = task.NextAddress;
-    //        task.NextAddress = task.TargetAddress;
-
-    //        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", "鏇存柊搴撳瓨鐘舵�佷笌浠诲姟鐘舵��");
-
-    //        // 浜嬪姟澶勭悊
-    //        // 寮�濮嬩簨鍔�
-    //        _unitOfWorkManage.BeginTran();
-    //        // 鍒犻櫎搴撳瓨淇℃伅
-    //        var isStockUpdated = _stockInfoRepository.DeleteDataById(stock.Id);
-    //        // 鍒犻櫎搴撳瓨淇℃伅
-    //        var isStockDetailUpdated = _stockInfoDetailRepository.DeleteDataByIds(detail.Select(x => (object)x.Id).ToArray());
-    //        // 鍒犻櫎浠诲姟淇℃伅
-    //        var isTaskUpdated = BaseDal.DeleteDataById(task.TaskId);
-
-    //        // 濡傛灉搴撳瓨淇℃伅鍜屼换鍔′俊鎭兘鏇存柊鎴愬姛
-    //        if (isStockUpdated && isTaskUpdated && isStockDetailUpdated)
-    //        {
-    //            // 璁板綍鏃ュ織
-    //            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", $"浜嬪姟澶勭悊瀹屾垚锛屽簱瀛樼姸鎬佹洿鏂帮細{isStockUpdated}锛屼换鍔$姸鎬佹洿鏂�:{isTaskUpdated}");
-    //            // 鎻愪氦浜嬪姟
-    //            _unitOfWorkManage.CommitTran();
-    //            // 杩斿洖鎴愬姛缁撴灉
-    //            return content.OK("浠诲姟瀹屾垚鎴愬姛");
-    //        }
-    //        else
-    //        {
-    //            // 璁板綍鏃ュ織
-    //            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "鍫嗗灈鏈哄嚭搴撳畬鎴�", $"浜嬪姟澶勭悊澶辫触锛屽簱瀛樼姸鎬佹洿鏂帮細{isStockUpdated}锛屼换鍔$姸鎬佹洿鏂�:{isTaskUpdated}");
-    //            // 鍥炴粴浜嬪姟
-    //            _unitOfWorkManage.RollbackTran();
-    //            // 杩斿洖澶辫触缁撴灉
-    //            return content.Error("浠诲姟鎴栧簱瀛樻洿鏂板け璐�");
-    //        }
-    //    }
-    //    catch (Exception err)
-    //    {
-    //        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, $"绯荤粺寮傚父锛屽紓甯镐俊鎭細{err.Message}", "");
-    //        Console.WriteLine(err.Message);
-    //        return content.Error(err.Message);
-    //    }
-    //}
 
     public async Task<WebResponseContent> CompleteStackTaskAsync(Dt_Task task, DtStockInfo stock)
     {
@@ -190,7 +91,7 @@
             {
                 var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
                     .FirstAsync(x => x.EquipmentName == task.Roadway);
-                var info = JsonConvert.DeserializeObject<List<EquipmentParameterInfo>>(process.ProcessValue);
+                var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue);
 
                 var agingOutputDto = MapToAgingOutputDto(stock, info);
                 content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
@@ -206,7 +107,7 @@
                 await UpdateLocationAsync(loc);
                 await DeleteStockInfoAsync(stock.Id);
                 await DeleteStockInfoDetailsAsync(stock.StockInfoDetails);
-                await DeleteTaskAsync(task.TaskId);
+                //await DeleteTaskAsync(task.TaskId);
             });
 
             return content.OK("浠诲姟瀹屾垚鎴愬姛");
@@ -218,19 +119,20 @@
         }
     }
 
-    private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, List<EquipmentParameterInfo> info)
+    private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto info)
     {
         return new AgingOutputDto
         {
             OpFlag = 1,
-            EquipmentCode = stock.LocationInfo.RoadwayNo,
+            Software = "WMS",
+            EquipmentCode = "ECH001-B",
             TrayBarcode = stock.PalletCode,
             SerialNos = stock.StockInfoDetails.Select(x => new SerialNoOutDto
             {
                 SlotNo = x.OrderNo.ToInt32(),
                 SerialNo = x.SerialNumber,
                 SerialNoResult = true,
-                ParameterInfo = info.Select(x => new ParameterInfo()
+                ParameterInfo = info.ParameterInfo.Select(x => new ParameterInfo()
                 {
                     LowerLomit = x.LowerControlLimit,
                     UpperLimit = x.UpperControlLimit,
@@ -247,7 +149,7 @@
 
     private void ValidateResponse(WebResponseContent content)
     {
-        var result = JsonConvert.DeserializeObject<BasicResult>(content.ToString());
+        var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
         if (!result.Success)
         {
             throw new Exception(result.MOMMessage);
@@ -259,10 +161,10 @@
         var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
         var details = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
 
-        location.LocationStatus = LocationEnum.Free.ObjToInt();
-        task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
-        task.CurrentAddress = task.NextAddress;
-        task.NextAddress = task.TargetAddress;
+        location.LocationStatus = (int)LocationEnum.Free;
+        task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+        //task.CurrentAddress = task.NextAddress;
+        //task.NextAddress = task.TargetAddress;
 
         LogFactory.GetLog("浠诲姟瀹屾垚").Info(true, "鏇存柊搴撳瓨鐘舵�佷笌浠诲姟鐘舵��");
         return (location, task);
@@ -474,7 +376,7 @@
         LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "楠岃瘉浠诲姟鏄惁瀛樺湪", JsonConvert.SerializeObject(task));
 
         // 楠岃瘉搴撳瓨鏄惁瀛樺湪
-        var stock = await _stockInfoRepository.QueryFirstAsync(x => x.PalletCode == task.PalletCode);
+        var stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
 
         // 鏍规嵁浠诲姟绫诲瀷璋冪敤鐩稿簲鐨勫畬鎴愪换鍔℃柟娉�
         switch (task.TaskType)

--
Gitblit v1.9.3