From 53db158b8018fba144a937cf1749cce050855c7a Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期二, 10 十二月 2024 14:49:32 +0800
Subject: [PATCH] 同步

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs     |   11 +
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                              |    5 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs                             |    4 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs                      |    9 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs      |    5 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs             |   43 +++++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                            |    7 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs |  313 ++++++++++++++++++++++++++++++++++++--------
 8 files changed, 331 insertions(+), 66 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
index 8a3f26b..4af744e 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
@@ -73,9 +73,9 @@
         OutTray = 104,
 
         /// <summary>
-        /// 绌烘墭鐩樺嚭搴�
+        /// NG鍑哄簱
         /// </summary>
-        [Description("绌烘墭鐩樺嚭搴�")]
+        [Description("NG鍑哄簱")]
         OutNG = 105,
 
         /// <summary>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
index b2bd4ee..2383651 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -250,5 +250,12 @@
         /// <param name="Roadway"></param>
         /// <returns></returns>
         Dt_Task QueryTaskByPalletCode(string palletCode, string Roadway);
+
+        /// <summary>
+        /// 鏌ヨ褰撳墠璁惧鏄惁鏈夌Щ搴撲换鍔�
+        /// </summary>
+        /// <param name="deviceNo"></param>
+        /// <returns></returns>
+        Dt_Task QueryRelocationTask(string deviceNo);
     }
 }
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
index a4a31d7..0c41a5d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -146,6 +146,15 @@
                     task.NextAddress = stationinfo.stationChildCode;
                     task.TargetAddress = taskDTO.TargetAddress;
                 }
+                else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
+                {
+                    task.TaskState = (int)TaskStatus.Created;
+                    task.SourceAddress = taskDTO.SourceAddress;
+                    task.CurrentAddress = taskDTO.SourceAddress;
+                    task.NextAddress = taskDTO.TargetAddress;
+                    task.TargetAddress = taskDTO.TargetAddress;
+                }
+
                 BaseDal.AddData(task);
 
                 _taskExecuteDetailService.AddTaskExecuteDetail(task.WMSId, "鎺ユ敹WMS浠诲姟");
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 64753c2..2f9ae1f 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -731,5 +731,10 @@
             }
             return content;
         }
+
+        public Dt_Task QueryRelocationTask(string deviceNo)
+        {
+            return BaseDal.QueryFirst(x => x.Roadway == deviceNo && x.TaskType == (int)TaskRelocationTypeEnum.Relocation && x.TaskState == (int)TaskStatus.Created);
+        }
     }
 }
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
index f65a3c1..6b3d16b 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
@@ -116,6 +116,13 @@
         private Dt_Task? GetTask(CommonStackerStationCrane commonStackerCrane)
         {
             Dt_Task task;
+
+            task = _taskService.QueryRelocationTask(commonStackerCrane.DeviceCode);
+            if (task != null)
+            {
+                return task;
+            }
+
             if (commonStackerCrane.LastTaskType == null)
             {
                 task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode);
@@ -207,7 +214,7 @@
             string[] sourceCodes = task.SourceAddress.Split("-");
             if (sourceCodes.Length == 3)
             {
-                stackerCraneTaskCommand.StartRow = (short)(Convert.ToInt16(sourceCodes[0]) % 2 == 0 ? 2:1);
+                stackerCraneTaskCommand.StartRow = (short)(Convert.ToInt16(sourceCodes[0]) % 2 == 0 ? 2 : 1);
                 stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
                 stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
             }
@@ -239,7 +246,7 @@
                 //}
                 //else
                 //{
-                   
+
                 //}
                 stackerCraneTaskCommand.EndRow = (short)(Convert.ToInt16(targetCodes[0]) % 2 == 0 ? 2 : 1);
                 stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs
index 5a7f73a..1632fd3 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/NotifyFinishTest.cs
@@ -37,6 +37,11 @@
 
                 if (location == null) throw new Exception("鏈煡搴撲綅");
 
+                if (_taskRepository.QueryFirst(x => x.SourceAddress == result.LocationID && x.Roadway == location.RoadwayNo) != null)
+                {
+                    throw new Exception("褰撳墠搴撲綅宸插瓨鍦ㄤ换鍔�");
+                }
+
                 Dt_StationManager stationManager;
                 if (result.IsNG == 1)
                 {
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs
index 7efa91a..fde21c1 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MCS/Partial/RequestChangeLocation.cs
@@ -1,4 +1,7 @@
-锘縰sing Newtonsoft.Json;
+锘縰sing AngleSharp.Dom;
+using log4net.Core;
+using Masuit.Tools;
+using Newtonsoft.Json;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -6,7 +9,9 @@
 using System.Threading.Tasks;
 using WIDESEA_Common;
 using WIDESEA_Core;
+using WIDESEA_Core.Const;
 using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
 using WIDESEA_DTO;
 using WIDESEA_DTO.WMS;
 using WIDESEA_Model.Models;
@@ -25,7 +30,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("涓婁紶鍙傛暟涓虹┖");
+                if (string.IsNullOrEmpty(json.ToString())) throw new Exception("璇锋眰鍙傛暟涓虹┖");
 
                 var result = JsonConvert.DeserializeObject<RequestReMove>(json.ToString());
 
@@ -33,72 +38,262 @@
 
                 if (location == null) throw new Exception("鏈煡搴撲綅");
 
-                if (result.MoveType == 5)
+                if (_taskRepository.QueryFirst(x => x.SourceAddress == result.LocationID && x.Roadway == location.RoadwayNo) != null)
                 {
-                    Console.WriteLine($"鍒嗗妫�娴嬫煖鐏瑙﹀彂:搴撲綅{result.LocationID}");
-
-                    //鏌ユ壘娑堥槻绔欏彴
-                    var station = _stationManagerRepository.QueryFirst(t => t.Roadway == location.RoadwayNo
-                         && t.stationType == (int)StationManager.FireStation
-                         /*&& t. == "Enable"*/);
-                    if (station == null)
-                    {
-                        throw new Exception("娑堥槻绔欏彴鏈厤缃�!");
-                    }
-                    //鏌ユ壘搴撳瓨淇℃伅
-                    var barcodeData = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
-                    //鎵樼洏鐮�
-                    string barcode = string.Empty;
-                    if (barcodeData != null)
-                    {
-                        barcode = barcodeData.PalletCode;
-                    }
-                    else
-                    {
-                        //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮�
-                        barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000);
-                    }
-                    int taskNum = _taskRepository.GetTaskNo().Result;
-                    Dt_Task task = new Dt_Task
-                    {
-                        CreateDate = DateTime.Now,
-                        Creater = "HK",
-                        CurrentAddress = result.LocationID,
-                        Grade = 1,
-                        Dispatchertime = DateTime.Now,
-                        PalletCode = result.PalletBarcode,
-                        Roadway = location.RoadwayNo,
-                        SourceAddress = result.LocationID,
-                        TaskState = (int)TaskOutStatusEnum.OutNew,
-                        TaskType = 500,
-                        TargetAddress = station.stationLocation,
-                        NextAddress = station.stationChildCode,
-                        TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
-                        TaskId = 0,
-                    };
-
-                    // 灏濊瘯娣诲姞鏂颁换鍔�
-                    WMSTaskDTO taskDTO = new WMSTaskDTO()
-                    {
-                        TaskNum = task.TaskNum.Value,
-                        Grade = 1,
-                        PalletCode = task.PalletCode,
-                        RoadWay = task.Roadway,
-                        SourceAddress = task.SourceAddress,
-                        TargetAddress = task.TargetAddress,
-                        TaskState = task.TaskState.Value,
-                        Id = 0,
-                        TaskType = 500,
-                    };
+                    throw new Exception("褰撳墠搴撲綅宸插瓨鍦ㄤ换鍔�");
                 }
+
+                switch (result.MoveType)
+                {
+                    case 1:
+                        CreateMoveTask(location);
+                        break;
+                    case 5:
+                        CreateFireTask(location);
+                        break;
+                    default:
+                        throw new Exception("鏃犳晥鐨勭Щ搴撶敵璇风被鍨�");
+                }
+
+                #region 鐏鍑哄簱
+                //if (result.MoveType == 5)
+                //{
+                //    Console.WriteLine($"鍒嗗妫�娴嬫煖鐏瑙﹀彂:搴撲綅{result.LocationID}");
+
+                //    //鏌ユ壘娑堥槻绔欏彴
+                //    var station = _stationManagerRepository.QueryFirst(t => t.Roadway == location.RoadwayNo
+                //         && t.stationType == (int)StationManager.FireStation
+                //         /*&& t. == "Enable"*/);
+                //    if (station == null)
+                //    {
+                //        throw new Exception("娑堥槻绔欏彴鏈厤缃�!");
+                //    }
+                //    //鏌ユ壘搴撳瓨淇℃伅
+                //    var barcodeData = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
+                //    //鎵樼洏鐮�
+                //    string barcode = string.Empty;
+                //    if (barcodeData != null)
+                //    {
+                //        barcode = barcodeData.PalletCode;
+                //    }
+                //    else
+                //    {
+                //        //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮�
+                //        barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000);
+                //    }
+                //    int taskNum = _taskRepository.GetTaskNo().Result;
+                //    Dt_Task task = new Dt_Task
+                //    {
+                //        CreateDate = DateTime.Now,
+                //        Creater = "HK",
+                //        CurrentAddress = result.LocationID,
+                //        Grade = 1,
+                //        Dispatchertime = DateTime.Now,
+                //        PalletCode = barcode,
+                //        Roadway = location.RoadwayNo,
+                //        SourceAddress = result.LocationID,
+                //        TaskState = (int)TaskOutStatusEnum.OutNew,
+                //        TaskType = 500,
+                //        TargetAddress = station.stationLocation,
+                //        NextAddress = station.stationChildCode,
+                //        TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
+                //        TaskId = 0,
+                //    };
+
+                //    // 灏濊瘯娣诲姞鏂颁换鍔�
+                //    WMSTaskDTO taskDTO = new WMSTaskDTO()
+                //    {
+                //        TaskNum = task.TaskNum.Value,
+                //        Grade = 1,
+                //        PalletCode = task.PalletCode,
+                //        RoadWay = task.Roadway,
+                //        SourceAddress = task.SourceAddress,
+                //        TargetAddress = task.TargetAddress,
+                //        TaskState = task.TaskState.Value,
+                //        Id = 0,
+                //        TaskType = 500,
+                //    };
+                //} 
+                #endregion
+
                 LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, $"\r\r--------------------------------------");
-                LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, result);
+                LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, result.ToJsonString());
                 return content.OK();
             }
             catch (Exception ex)
             {
+                LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, $"\r\r--------------------------------------");
+                LogFactory.GetLog("鍒嗗绉诲簱鐢宠").Info(true, ex.Message);
                 return content.Error(ex.Message);
             }
         }
+
+        private void CreateMoveTask(DtLocationInfo location)
+        {
+            Console.WriteLine($"鍒嗗鐢宠绉诲簱:搴撲綅{location.LocationCode}");
+
+            //鏌ユ壘鍙敤搴撲綅
+            DtLocationInfo CanRelocation = _locationRepository.QueryFirst(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == location.RoadwayNo && x.EnalbeStatus == 1 && x.LocationType == 2 && x.Remark == "1");
+
+            if (CanRelocation == null) throw new Exception("鐢宠绉诲簱澶辫触锛氭棤鍙敤搴撲綅");
+
+            //鏌ユ壘搴撳瓨淇℃伅
+            var stockInfo = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
+
+            if (stockInfo == null) throw new Exception("鐢宠绉诲簱澶辫触锛氭棤搴撳瓨璁板綍");
+
+            //淇敼绉诲簱鐩爣搴撲綅鐘舵��
+            CanRelocation.LocationStatus = (int)LocationEnum.FreeDisable;
+
+            int taskNum = _taskRepository.GetTaskNo().Result;
+            Dt_Task task = new Dt_Task
+            {
+                CreateDate = DateTime.Now,
+                Creater = "HK",
+                CurrentAddress = location.LocationCode,
+                Grade = 1,
+                Dispatchertime = DateTime.Now,
+                PalletCode = stockInfo.PalletCode,
+                Roadway = location.RoadwayNo,
+                SourceAddress = location.LocationCode,
+                TaskState = (int)TaskStatus.Created,
+                TaskType = (int)TaskRelocationTypeEnum.Relocation,
+                TargetAddress = CanRelocation.LocationCode,
+                NextAddress = CanRelocation.LocationCode,
+                TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
+                TaskId = 0,
+            };
+
+            // 灏濊瘯娣诲姞鏂颁换鍔�
+            WMSTaskDTO taskDTO = new WMSTaskDTO()
+            {
+                TaskNum = task.TaskNum.Value,
+                Grade = 1,
+                PalletCode = task.PalletCode,
+                RoadWay = task.Roadway,
+                SourceAddress = task.SourceAddress,
+                TargetAddress = task.TargetAddress,
+                TaskState = task.TaskState.Value,
+                Id = 0,
+                TaskType = task.TaskType,
+            };
+
+            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
+            var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSTask)?.ConfigValue;
+            if (ReceiveByWMSTask == null || ipAddress == null)
+            {
+                throw new Exception("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
+
+            var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(taskDTO));   //http://localhost:9291/api/Task/ReceiveTask,
+            if (respon != null)
+            {
+                WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
+                if (respone.Status)
+                {
+                    //娣诲姞WMS浠诲姟 骞朵慨鏀瑰簱浣嶇姸鎬�
+                    var taskId = _taskRepository.AddData(task);
+                    _locationRepository.UpdateData(CanRelocation);
+                }
+                else
+                {
+                    throw new Exception("WCS澶勭悊澶辫触:" + respone.Message);
+                }
+            }
+            else
+            {
+                throw new Exception("WCS澶勭悊澶辫触");
+            }
+        }
+
+
+        private void CreateFireTask(DtLocationInfo location)
+        {
+            Console.WriteLine($"鍒嗗妫�娴嬫煖鐏瑙﹀彂:搴撲綅{location.LocationCode}");
+
+            //鏌ユ壘娑堥槻绔欏彴
+            var station = _stationManagerRepository.QueryFirst(t => t.Roadway == location.RoadwayNo
+                 && t.stationType == (int)StationManager.FireStation
+                 /*&& t. == "Enable"*/);
+            if (station == null)
+            {
+                throw new Exception("娑堥槻绔欏彴鏈厤缃�!");
+            }
+            //鏌ユ壘搴撳瓨淇℃伅
+            var barcodeData = _stockInfoRepository.QueryFirst(t => t.LocationCode == location.LocationCode);
+            //鎵樼洏鐮�
+            string barcode = string.Empty;
+            if (barcodeData != null)
+            {
+                barcode = barcodeData.PalletCode;
+            }
+            else
+            {
+                //鏃犲簱瀛樹俊鎭紝鐢熸垚闅忔満鎵樼洏鐮�
+                barcode = "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000);
+            }
+            int taskNum = _taskRepository.GetTaskNo().Result;
+            Dt_Task task = new Dt_Task
+            {
+                CreateDate = DateTime.Now,
+                Creater = "HK",
+                CurrentAddress = location.LocationCode,
+                Grade = 1,
+                Dispatchertime = DateTime.Now,
+                PalletCode = barcode,
+                Roadway = location.RoadwayNo,
+                SourceAddress = location.LocationCode,
+                TaskState = (int)TaskOutStatusEnum.OutNew,
+                TaskType = 500,
+                TargetAddress = station.stationLocation,
+                NextAddress = station.stationChildCode,
+                TaskNum = taskNum, //_taskRepository.GetTaskNo().Result,
+                TaskId = 0,
+            };
+
+            // 灏濊瘯娣诲姞鏂颁换鍔�
+            WMSTaskDTO taskDTO = new WMSTaskDTO()
+            {
+                TaskNum = task.TaskNum.Value,
+                Grade = 1,
+                PalletCode = task.PalletCode,
+                RoadWay = task.Roadway,
+                SourceAddress = task.SourceAddress,
+                TargetAddress = task.TargetAddress,
+                TaskState = task.TaskState.Value,
+                Id = 0,
+                TaskType = 500,
+            };
+
+            var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
+            var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSTask)?.ConfigValue;
+            if (ReceiveByWMSTask == null || ipAddress == null)
+            {
+                throw new Exception("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
+
+            var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(taskDTO));   //http://localhost:9291/api/Task/ReceiveTask,
+            if (respon != null)
+            {
+                WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
+                if (respone.Status)
+                {
+                    var taskId = _taskRepository.AddData(task);
+                }
+
+                else
+                {
+                    throw new Exception("WCS澶勭悊澶辫触:" + respone.Message);
+                }
+            }
+            else
+            {
+                throw new Exception("WCS澶勭悊澶辫触");
+            }
+        }
     }
 }
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
index de6ff7f..c937a83 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs
@@ -510,8 +510,6 @@
                 TaskType = task.TaskType,
             };
             content.OK(data: taskDTO);
-
-           
         }
         else
             content.Error("娣诲姞浠诲姟澶辫触");
@@ -764,7 +762,6 @@
         }
     }
 
-
     #region 鐩存帴鍑哄簱浠诲姟瀹屾垚
     public async Task<WebResponseContent> CompleteInToOutTaskAsync(Dt_Task task)
     {
@@ -787,6 +784,46 @@
     #endregion
 
 
+    #region MyRegion
+    //private async Task<bool> ExecuteTransaction(DtStockInfo stock, Dt_Task_Hty taskHty, DtLocationInfo locationInfo, int taskId)
+    //{
+    //    _unitOfWorkManage.BeginTran();
+    //    try
+    //    {
+    //        var isUpdateStock = true;
+
+    //        // 娣诲姞鍘嗗彶浠诲姟
+    //        var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;
+
+    //        // 淇敼绉诲簱鍓嶈揣浣嶇姸鎬�
+    //        var isUpdateLoc = _locationRepository.UpdateData(locationInfo);
+
+    //        // 鍒犻櫎浠诲姟鏁版嵁
+    //        var isTaskDelete = await Delete(taskId);
+
+    //        // 鎻愪氦鎴栧洖婊氫簨鍔�
+    //        if (isUpdateStock && isTaskHtyAdd && isTaskDelete && isUpdateLoc)
+    //        {
+    //            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "浠诲姟瀹屾垚", $"浜嬪姟澶勭悊瀹屾垚,鎻愪氦浜嬪姟銆傛坊鍔犲巻鍙蹭换鍔★細{isTaskHtyAdd},鍒犻櫎浠诲姟鏁版嵁锛歿isTaskDelete},鏇存柊鎴栨坊鍔犲簱瀛橈細{isUpdateStock},淇敼绉诲簱鍓嶈揣浣嶇姸鎬侊細{isUpdateLoc}");
+    //            _unitOfWorkManage.CommitTran();
+    //            return true;
+    //        }
+    //        else
+    //        {
+    //            LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, "浠诲姟瀹屾垚", $"鏁版嵁澶勭悊澶辫触,璇锋鏌ユ暟鎹槸鍚︽纭�,鏁版嵁鍥炴粴銆傛坊鍔犲巻鍙蹭换鍔★細{isTaskHtyAdd},鍒犻櫎浠诲姟鏁版嵁锛歿isTaskDelete},鏇存柊搴撳瓨锛歿isUpdateStock},淇敼绉诲簱鍓嶈揣浣嶇姸鎬侊細{isUpdateLoc}");
+    //            _unitOfWorkManage.RollbackTran();
+    //            return false;
+    //        }
+    //    }
+    //    catch (Exception err)
+    //    {
+    //        LogFactory.GetLog("浠诲姟瀹屾垚").InfoFormat(true, $"浠诲姟瀹屾垚,绯荤粺寮傚父锛屽紓甯镐俊鎭細{err.Message}", "鏃犲弬鏁�");
+    //        _unitOfWorkManage.RollbackTran();
+    //        throw; // 鎶涘嚭寮傚父浠ヤ究澶栭儴鎹曡幏
+    //    }
+    //}
+    #endregion
+
     #region 妫�娴嬮珮娓╁簱鏄惁鏈夊彲鍑哄簱搴撳瓨
 
     public WebResponseContent StockCheckingAsync()

--
Gitblit v1.9.3