From c362218b8ef0af6402d3715fbed040ac1cbe0433 Mon Sep 17 00:00:00 2001
From: duyongjia <adu_555@163.com>
Date: 星期五, 29 十一月 2024 14:32:18 +0800
Subject: [PATCH] 最新上传

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |  401 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 359 insertions(+), 42 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 423a9af..dd4bf5a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -16,10 +16,12 @@
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
 using AutoMapper;
+using Newtonsoft.Json;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using SqlSugar;
 using SqlSugar.Extensions;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Diagnostics.CodeAnalysis;
@@ -53,6 +55,7 @@
         private readonly ILocationInfoRepository _locationInfoRepository;
         private readonly IMapper _mapper;
         private readonly IUnitOfWorkManage _unitOfWorkManage;
+        private readonly ITaskRepository _taskRepository;
 
         private Dictionary<string, OrderByType> _taskOrderBy = new()
             {
@@ -70,7 +73,7 @@
 
         public List<int> TaskOtherboundTypes => typeof(TaskOtherTypeEnum).GetEnumIndexList();
 
-        public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+        public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage, ITaskRepository taskRepository) : base(BaseDal)
         {
             _routerService = routerService;
             _taskExecuteDetailService = taskExecuteDetailService;
@@ -78,6 +81,7 @@
             _mapper = mapper;
             _locationInfoRepository = locationInfoRepository;
             _unitOfWorkManage = unitOfWorkManage;
+            _taskRepository = taskRepository;
         }
 
         /// <summary>
@@ -147,7 +151,9 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-               // ServiceLogger.WriteLogToFile("");
+                string inparam = JsonConvert.SerializeObject(taskDTO);
+                
+                ServiceLogger.WriteDebug("ReceiveTask", $"ReceiveMESTask鏂规硶鍏ュ弬{inparam}"); 
                 Dt_Task task = new Dt_Task();
                 Dt_Task taskinfo = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id);
                 if(taskDTO.cmd==101)//濡傛灉鏄�101鎸夋棫鐨勪换鍔″彿鍘绘煡
@@ -157,6 +163,7 @@
 
                 if (taskDTO.cmd!=3001&& taskDTO.cmd != 101 && taskinfo != null)
                 {
+                    ServiceLogger.WriteDebug("ReceiveTask", $"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
                     return content = WebResponseContent.Instance.Error($"浠诲姟鍙烽噸澶嶏紝浠诲姟鍙凤細{taskDTO.task_id}");
                 }
                 Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.Remark == taskDTO.src_station.ToString());
@@ -175,10 +182,11 @@
                         }
                         else
                         {
+                            ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
                             return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
                         }
                         break;
-                    case 3001://AGV鏀捐揣瀹屾垚 WMS鍙�3001鐨勫悓鏃朵細鍐欐彁鍗囦俊鍙�
+                    case 3001://AGV鏀捐揣瀹屾垚 WMS鍙�3001鐨勫悓鏃禬CS闇�鍦╦ob涓啓鎻愬崌淇″彿
                         if (BaseDal.QueryFirst(x => x.TaskNum == taskDTO.task_id) == null)//鎵嬪姩鍏ュ簱鐩存帴鍙�3001锛岄渶瑕佺敓鎴愪换鍔★紝鍥犱负娌℃湁1001鐜妭
                         {
 
@@ -193,6 +201,7 @@
                             }
                             else
                             {
+                                ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
                                 return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌婧愮珯鐐瑰搴旂殑搴撲綅锛屾簮绔欑偣锛歿taskDTO.dest_station.ToString()}");
                             }
                         }
@@ -202,6 +211,7 @@
                             {
                                 UpdateTaskStatus(taskinfo.TaskId, (int)TaskInStatusEnum.AGV_InExecuting);
                                 _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"AGV鍏ュ簱鎵ц涓�");
+                                ServiceLogger.WriteDebug("ReceiveTask", $"AGV鍏ュ簱鎵ц涓紙鑷姩3001锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
                                 return content = WebResponseContent.Instance.OK($"AGV鍏ュ簱鎵ц涓紙鑷姩3001锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
                             }
                             else
@@ -217,10 +227,12 @@
                             //鏇存柊浠诲姟琛ㄤ腑NextAddress瀛楁涓烘柊鐨勪换鍔″彿   taskDTO.weight-鏃х殑浠诲姟鍙�   taskDTO.task_id-鏂扮殑浠诲姟鍙�
                             UpdateTaskStatus(taskinfo.TaskId, taskDTO.task_id, (int)TaskInStatusEnum.AGV_InFinish);
                             _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"AGV鎼繍瀹屾垚");
+                            ServiceLogger.WriteDebug("ReceiveTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
                             return content = WebResponseContent.Instance.OK($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹垚鍔燂紝浠诲姟鍙凤細{taskinfo.TaskId}");
                         }
                         else
                         {
+                            ServiceLogger.WriteDebug("ReceiveTask", $"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
                             return content = WebResponseContent.Instance.Error($"AGV鎼繍瀹屾垚锛�101锛夋洿鏂扮姸鎬佹椂锛屾煡璇笉鍒颁换鍔″彿");
                         }
                         break;
@@ -252,7 +264,8 @@
                         }
                         else
                         {
-                           return  content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+                            ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
+                            return  content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿taskDTO.dest_station.ToString()}");
                         }
                         break;
                     case 104://缁勭珛鏈轰笂鏂�  鏆傚瓨浣�-->缁勭珛鏈�
@@ -270,7 +283,8 @@
                             }
                             else
                             {
-                              return  content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿task.TargetAddress.ToString()}");
+                                ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿task.TargetAddress.ToString()}");
+                                return  content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌鐩爣绔欑偣瀵瑰簲鐨勫簱浣嶏紝鐩爣绔欑偣锛歿task.TargetAddress.ToString()}");
                             }
                             //鏍规嵁鐩爣鍦板潃锛堢粍绔嬫満锛夋煡璇㈤粯璁ょ殑鎵ц浠诲姟鐨勫皬鍫嗗灈鏈虹紪鍙�
                             Dt_LocationInfo locationtemp2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress.ToString());
@@ -280,6 +294,8 @@
                             }
                             else
                             {
+
+                                ServiceLogger.WriteDebug("ReceiveTask", $"WCS鏈煡璇㈠埌缁勭珛鏈哄搴旂殑榛樿灏忓爢鍨涙満閰嶇疆");
                                 return content = WebResponseContent.Instance.Error($"WCS鏈煡璇㈠埌缁勭珛鏈哄搴旂殑榛樿灏忓爢鍨涙満閰嶇疆");
                             }
                             
@@ -292,7 +308,7 @@
 
                 task.TaskNum = taskDTO.task_id;
                 task.PalletCode = taskDTO.CarId;
-                task.Roadway = "SC01";
+             
                 if (string.IsNullOrEmpty(task.SourceAddress))//濡傛灉涓嶆槸绔欑偣锛岀洿鎺ュ彇琛屽垪灞�
                 {
                     task.SourceAddress = $"SC01-{taskDTO.src_rack.ToString().PadLeft(3, '0')}-{taskDTO.src_col.ToString().PadLeft(3, '0')}-{taskDTO.src_row.ToString().PadLeft(3, '0')}";
@@ -310,10 +326,12 @@
                 {
                     if (srcLocation.EnableStatus == (int)EnableStatusEnum.Disable)
                     {
+                        ServiceLogger.WriteDebug("ReceiveTask", $"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
                         return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸茬鐢細{srcLocation.LocationCode}");
                     }
                     if (tarLocation.EnableStatus == (int)EnableStatusEnum.Disable)
                     {
+                        ServiceLogger.WriteDebug("ReceiveTask", $"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
                         return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸茬鐢細{tarLocation.LocationCode}");
                     }
                     if (taskDTO.cmd != 101)//鍏ュ簱鏃朵笉闇�瑕佸垽鏂槸鍚﹂攣瀹氾紝閿佸畾鐘舵�佹槸鍦ㄧ敓鎴愪换鍔℃椂閿佸畾
@@ -323,10 +341,13 @@
                         {
                             if (srcLocation.LocationStatus == (int)LocationStatusEnum.Lock)
                             {
+
+                                ServiceLogger.WriteDebug("ReceiveTask", $"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
                                 return content = WebResponseContent.Instance.Error($"婧愬湴鍧�宸查攣瀹氾細{srcLocation.LocationCode}");
                             }
                             if (tarLocation.LocationStatus == (int)LocationStatusEnum.Lock)
                             {
+                                ServiceLogger.WriteDebug("ReceiveTask", $"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
                                 return content = WebResponseContent.Instance.Error($"鐩爣鍦板潃宸查攣瀹氾細{tarLocation.LocationCode}");
                             }
                         }
@@ -336,6 +357,8 @@
                         //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滅┖闂测�濆苟涓旀湭绂佺敤锛岄攣瀹氬簱浣嶄慨鏀瑰簱浣嶇姸鎬佷负鈥滈攣瀹氣�濓紝鐢熸垚WCS浜у搧鍏ュ簱浠诲姟锛屽姞鍏CS浠诲姟闃熷垪涓��          
                         if (tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
                         {
+
+                            ServiceLogger.WriteDebug("ReceiveTask", $"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
                             return content = WebResponseContent.Instance.Error($"鍏ュ簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{tarLocation.LocationCode}");
                         }
                         //srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -354,10 +377,14 @@
                         //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р�濓紝搴撲綅/鏆傚瓨搴撲綅鏄惁鈥滅┖闂测��
                         if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
                         {
+
+                            ServiceLogger.WriteDebug("ReceiveTask", $"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                             return content = WebResponseContent.Instance.Error($"绉诲簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                         }
                         if(tarLocation.LocationStatus != (int)LocationStatusEnum.Free)
                         {
+
+                            ServiceLogger.WriteDebug("ReceiveTask", $"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
                             return content = WebResponseContent.Instance.Error($"绉诲簱-鐩爣鍦板潃涓嶆槸绌洪棽鐘舵�侊細{srcLocation.LocationCode}");
                         }
                         srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -369,6 +396,8 @@
                         //WCS鏌ヨ搴撲綅鐘舵�佹槸鍚︿负鈥滄湁璐р��
                         if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
                         {
+
+                            ServiceLogger.WriteDebug("ReceiveTask", $"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                             return content = WebResponseContent.Instance.Error($"寮傚父鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                         }
                         srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -384,6 +413,8 @@
                         //WCS鏌ヨ鏆傚瓨搴撲綅鏄惁鈥滄湁璐р��
                         if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
                         {
+
+                            ServiceLogger.WriteDebug("ReceiveTask", $"绌鸿溅鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                             return content = WebResponseContent.Instance.Error($"绌鸿溅鍑哄簱-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                         }
                         //srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -398,6 +429,8 @@
                         //WCS鏌ヨ鏆傚瓨搴撲綅鏄惁鈥滄湁璐р��
                         if (srcLocation.LocationStatus != (int)LocationStatusEnum.InStock)
                         {
+
+                            ServiceLogger.WriteDebug("ReceiveTask", $"涓婃枡浠诲姟-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                             return content = WebResponseContent.Instance.Error($"涓婃枡浠诲姟-婧愬湴鍧�涓嶆槸鏈夎揣鐘舵�侊細{srcLocation.LocationCode}");
                         }
                         //srcLocation.LocationStatus = (int)LocationStatusEnum.Lock;
@@ -408,6 +441,7 @@
                 }
                 else
                 {
+                    ServiceLogger.WriteDebug("ReceiveTask", $"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
                     return content = WebResponseContent.Instance.Error($"搴撲綅鍦板潃涓嶅瓨鍦紝浠诲姟鍙�:{task.TaskNum}");
                 }
 
@@ -431,12 +465,13 @@
                     _unitOfWorkManage.RollbackTran();
                     throw;
                 }
-
-                content = WebResponseContent.Instance.OK("鎴愬姛",task);
+                ServiceLogger.WriteDebug("ReceiveTask", $"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}");
+                content = WebResponseContent.Instance.OK($"鎺ユ敹浠诲姟鎴愬姛锛屼换鍔″彿:{task.TaskNum}", task);
                 
             }
             catch (Exception ex)
             {
+                ServiceLogger.WriteDebug("ReceiveTask", $"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.StackTrace}");
                 content = WebResponseContent.Instance.Error($"浠诲姟鎺ユ敹閿欒,閿欒淇℃伅:{ex.Message}");
             }
             return content;
@@ -646,7 +681,7 @@
 
                 _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, task.ExceptionMessage);
 
-                content = WebResponseContent.Instance.OK();
+               
             }
             catch (Exception ex)
             {
@@ -668,6 +703,245 @@
             task.Modifier = "System";
             task.ModifyDate = DateTime.Now;
             BaseDal.UpdateData(task);
+        }
+
+        /// <summary>
+        /// 浠诲姟寮哄埗瀹屾垚 鍫嗗灈鏈哄疄闄呭凡瀹屾垚浠诲姟锛學CS鏈敹鍒板畬鎴愪俊鍙锋垨鍏朵粬鏈煡鍘熷洜瀵艰嚧WCS浠诲姟鏈畬鎴愶紝鍙互鎵ц璇ユ柟娉曞己鍒跺畬鎴愪换鍔�
+        /// </summary>
+        /// <param name="taskNum"></param>
+        /// <returns></returns>
+        public WebResponseContent ForceCompleteTask(int taskNum)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                bool isBack = false;
+                //1锛屽厛鏌ヨ浠诲姟锛屾牴鎹笉鍚岀殑浠诲姟绫诲瀷鍋氫换鍔″己鍒跺畬鎴愭搷浣�
+                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
+                if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+
+                Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress.ToString());
+                Dt_LocationInfo locationdsc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress.ToString());
+                if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+                {
+                    if (task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)
+                    {
+                        task.TaskState = (int)TaskInStatusEnum.SC_InFinish;
+                        //闇�瑕佸皢鐩爣鍦板潃鏀逛负鏈夎揣鐘舵��
+                        locationdsc.LocationStatus = (int)LocationStatusEnum.InStock;
+
+                        //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+                        UpdateTaskStatus(task.TaskId, task.TaskState);
+                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
+                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟瀹屾垚");
+                        //鏇存柊璐т綅
+                        _locationInfoRepository.UpdateData(locationdsc);
+                        isBack = true;
+
+                    }
+                    else
+                    {
+                        return content = WebResponseContent.Instance.Error("璇ヤ换鍔$洰鍓嶇姸鎬侊紝涓嶅厑璁″己鍒跺畬鎴愶紒");
+                    }
+
+                }
+                else
+                {
+                    if (task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
+                    {
+                      
+                        if (task.TaskType == (int)TaskOutboundTypeEnum.OutInventory || task.TaskType == (int)TaskOutboundTypeEnum.OutPick)//寮傚父鍑哄簱 绌鸿溅鍑哄簱
+                        {
+                            task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+                            //婧愬湴鍧�鏇存柊涓虹┖闂�
+                            locationsrc.LocationStatus = (int)LocationStatusEnum.Free;
+
+                            //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+                            UpdateTaskStatus(task.TaskId, task.TaskState);
+                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
+                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟瀹屾垚");
+                            //鏇存柊璐т綅
+                            _locationInfoRepository.UpdateData(locationsrc);
+                            isBack = true;
+                        }
+                        else if (task.TaskType == (int)TaskRelocationTypeEnum.Relocation)//绉诲簱
+                        {
+                            task.TaskState = (int)TaskOutStatusEnum.OutFinish;
+                            //婧愬湴鍧�鏇存柊涓虹┖闂�
+                            locationsrc.LocationStatus = (int)LocationStatusEnum.Free;
+                            //鐩爣鍦板潃鏇存柊涓烘湁璐�
+                            locationdsc.LocationStatus = (int)LocationStatusEnum.InStock;
+
+
+                            //鏇存柊鐘舵�佷负浠诲姟瀹屾垚
+                            UpdateTaskStatus(task.TaskId, task.TaskState);
+                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
+                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟瀹屾垚");
+                            //鏇存柊璐т綅
+                            _locationInfoRepository.UpdateData(locationsrc);
+                            _locationInfoRepository.UpdateData(locationdsc);
+                            isBack = true;
+
+
+                        }
+                        else
+                        {
+                            return WebResponseContent.Instance.Error($"涓婃枡浠诲姟涓嶅厑璁″己鍒跺畬鎴愶紒");
+                        }
+                    }
+                    else
+                    {
+                        return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽寮哄埗瀹屾垚锛�");
+                    }
+                }
+
+                //浠诲姟寮哄埗瀹屾垚鍥炶皟MES
+                if (isBack)
+                {
+                    
+                    if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)//鍏ュ簱鏃跺洖浼犻渶浼犳柊浠诲姟鍙�
+                    {
+                        task.TaskNum =int.Parse(task.NextAddress);
+                    }
+                    MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+                    MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+                    if (res != null && res.code != 0)
+                    {
+                        ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟寮哄埗瀹屾垚鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                        content = WebResponseContent.Instance.Error($"浠诲姟寮哄埗瀹屾垚鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                    }
+                    else
+                    {
+                        ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟寮哄埗瀹屾垚鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+                        content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
+
+        }
+
+        /// <summary>
+        /// 浠诲姟鍙栨秷
+        /// </summary>
+        /// <param name="taskid"></param>
+        /// <returns></returns>
+        public WebResponseContent CancelTask(int taskNum)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                //1锛屽厛鏌ヨ浠诲姟锛屾牴鎹笉鍚岀殑浠诲姟绫诲瀷鍋氫换鍔″彇娑堟搷浣�
+                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
+                if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
+
+                Dt_LocationInfo locationsrc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress.ToString());
+                Dt_LocationInfo locationdsc = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress.ToString());
+                bool isBack = false;
+                //濡傛灉鏄叆搴撳垎鑷姩鍜屾墜鍔ㄤ袱绉嶆儏鍐靛鐞�
+                if (task.TaskType == (int)TaskInboundTypeEnum.Inbound)
+                {
+                    if (task.WMSId == 0 && task.TaskState == (int)TaskInStatusEnum.InNew)//鑷姩鍏ュ簱锛�1001-AGV璇锋眰鏄惁鍏佽杩涘叆锛屼换鍔$姸鎬佷负鈥滄柊寤哄叆搴撲换鍔�200鈥濅箣鍓嶅彲浠ュ彇娑�
+                    {
+                        task.TaskState = (int)TaskInStatusEnum.InCancel;
+                        //闇�瑕佸皢鐩爣鍦板潃鎭㈠涓虹┖闂茬姸鎬�
+                        locationdsc.LocationStatus = (int)LocationStatusEnum.Free;
+                        //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+                        UpdateTaskStatus(task.TaskId, task.TaskState);
+                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟鍙栨秷");
+                        _locationInfoRepository.UpdateData(locationdsc);
+                        isBack = true;
+                    }
+                    else if (task.WMSId == 1 && task.TaskState == (int)TaskInStatusEnum.AGV_InExecuting)//鎵嬪姩鍏ュ簱锛�3001-AGV鏀捐揣瀹屾垚锛屼换鍔$姸鎬佷负鈥淎GV鍏ュ簱鎵ц涓�210鈥濅箣鍓嶅彲浠ュ彇娑�
+                    {
+                        task.TaskState = (int)TaskInStatusEnum.InCancel;
+                        //闇�瑕佸皢鐩爣鍦板潃鎭㈠绌洪棽鐘舵��
+                        locationdsc.LocationStatus = (int)LocationStatusEnum.Free;
+                        //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+                        UpdateTaskStatus(task.TaskId, task.TaskState);
+                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍏ュ簱浠诲姟鍙栨秷");
+                        _locationInfoRepository.UpdateData(locationdsc);
+                        isBack = true;
+                    }
+                    else
+                    {
+                        return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽鍙栨秷锛�");
+                    }
+                }
+                else//鍏朵粬浠诲姟锛屼换鍔$姸鎬佲�滄柊寤哄嚭搴撲换鍔♀�濅箣鍓嶏紝鎵嶅彲浠ュ彇娑�
+                {
+                    if (task.TaskState == (int)TaskOutStatusEnum.OutNew)
+                    {  
+                        if(task.TaskType == (int)TaskOutboundTypeEnum.OutInventory|| task.TaskType == (int)TaskOutboundTypeEnum.OutPick)//寮傚父鍑哄簱 绌鸿溅鍑哄簱
+                        {
+                            task.TaskState = (int)TaskOutStatusEnum.OutCancel;
+                            //婧愬湴鍧�鎭㈠鍒版湁璐�
+                            locationsrc.LocationStatus = (int)LocationStatusEnum.InStock;
+
+                            //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+                            UpdateTaskStatus(task.TaskId, task.TaskState);
+                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟鍙栨秷");
+                            _locationInfoRepository.UpdateData(locationsrc);
+                            isBack = true;
+                        }
+                        else if(task.TaskType == (int)TaskRelocationTypeEnum.Relocation)//绉诲簱
+                        {
+                            task.TaskState = (int)TaskOutStatusEnum.OutCancel;
+                            //婧愬湴鍧�鎭㈠鍒版湁璐�
+                            locationsrc.LocationStatus = (int)LocationStatusEnum.InStock;
+                            //闇�瑕佸皢鐩爣鍦板潃鎭㈠绌洪棽鐘舵��
+                            locationdsc.LocationStatus = (int)LocationStatusEnum.Free;
+                            //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
+                            UpdateTaskStatus(task.TaskId, task.TaskState);
+                            _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍑哄簱浠诲姟鍙栨秷");
+                            _locationInfoRepository.UpdateData(locationsrc);
+                            _locationInfoRepository.UpdateData(locationdsc);
+                            isBack = true;
+                        }
+                        else
+                        {
+                            return WebResponseContent.Instance.Error($"涓婃枡浠诲姟涓嶅厑璁″彇娑堬紒");
+                        }
+                    }
+                    else
+                    {
+                        return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽鍙栨秷锛�");
+                    }
+                }
+
+
+
+                //浠诲姟鍙栨秷鍥炶皟MES
+                if (isBack)
+                {
+                    MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 3 };
+                    MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+                    if (res != null && res.code != 0)
+                    {
+                        ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟鍙栨秷鍥炰紶MES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                        content = WebResponseContent.Instance.Error($"浠诲姟鍙栨秷鍥炰紶MES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                    }
+                    else
+                    {
+                        ServiceLogger.WriteDebug("ForceCompleteTask", $"浠诲姟鍙栨秷鍥炰紶MES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+                        content = WebResponseContent.Instance.Error($"浠诲姟鍙栨秷鍥炰紶MES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
+                    }
+                }
+                else
+                {
+
+                }
+
+            }
+            catch (Exception ex)
+            {
+                content = WebResponseContent.Instance.Error(ex.Message);
+            }
+            return content;
         }
 
 
@@ -840,17 +1114,34 @@
                         _unitOfWorkManage.CommitTran();
                         //鍑哄簱瀹屾垚锛屽洖浼燱MS
                         //鍥炰紶鍒癢MS
-                        MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
-                        MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
-                        if (res != null && res.code != 0)
+                        if (task.TaskType == (int)TaskOutboundTypeEnum.OutPick)
                         {
-                            content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                            MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+                            MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+                            if (res != null && res.code != 0)
+                            {
+                                ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚绌鸿溅鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                                content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚绌鸿溅鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                            }
+
+                        }
+                        else
+                        {
+                            MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+                            MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+                            if (res != null && res.code != 0)
+                            {
+                                ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                                content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚寮傚父鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                            }
                         }
 
                     }
                     catch (Exception ex)
                     {
                         _unitOfWorkManage.RollbackTran();
+                        //浠诲姟鎵ц澶辫触锛岃揣浣嶇姸鎬佽繕鍘�
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                         content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                     }
 
@@ -880,16 +1171,25 @@
 
                         //鍏ュ簱瀹屾垚锛屽洖浼燤ES  鍏ュ簱瀹屾垚鍥炰紶task.NextAddress 涔嬪墠101璇锋眰鏃跺瓨鐨勬柊浠诲姟鍙�
                         MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = int.Parse(task.NextAddress), status = 6 };
+                        string inparam = JsonConvert.SerializeObject(sendcmd);
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
                         MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                         if (res != null && res.code != 0)
                         {
+
+                            ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
                             content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
+                        }
+                        else
+                        {
+                            ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍏ュ簱浠诲姟鍚庡洖浼燤ES鎴愬姛锛�,浠诲姟鍙�:銆恵taskNum}銆�");
                         }
 
                     }
                     catch (Exception ex)
                     {
                         _unitOfWorkManage.RollbackTran();
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍏ュ簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                         content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍏ュ簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                     }
                 }
@@ -902,7 +1202,7 @@
                         srcLocation.LocationStatus = (int)LocationStatusEnum.Free;
 
                         Dt_LocationInfo tarLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress);
-                        srcLocation.LocationStatus = (int)LocationStatusEnum.InStock;
+                        tarLocation.LocationStatus = (int)LocationStatusEnum.InStock;
                         UpdateTaskStatus(task.TaskId, (int)TaskOutStatusEnum.SC_OutFinish);
                         _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撳畬鎴�");
 
@@ -917,9 +1217,12 @@
                         //绉诲簱瀹屾垚锛屽洖浼燤ES
                         //鍥炰紶鍒癢MS
                         MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+                        string inparam = JsonConvert.SerializeObject(sendcmd);
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES鍏ュ弬:{inparam}");
                         MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                         if (res != null && res.code != 0)
                         {
+                            ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
                             content = WebResponseContent.Instance.Error($"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
                         }
 
@@ -927,6 +1230,7 @@
                     catch (Exception ex)
                     {
                         _unitOfWorkManage.RollbackTran();
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                         content = WebResponseContent.Instance.Error($"澶у爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                     }
                 }
@@ -935,7 +1239,7 @@
                 {
                     try
                     {
-                        Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
+                        //Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
                         //srcLocation.LocationStatus = (int)LocationStatusEnum.Free;
                         
 
@@ -950,59 +1254,72 @@
                         _unitOfWorkManage.CommitTran();
                         //涓婃枡瀹屾垚锛屽洖浼燱MS
                         MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 6 };
+                        string inparam = JsonConvert.SerializeObject(sendcmd);
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟鍥炰紶MES鍏ュ弬{inparam}");
                         MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
                         if (res != null && res.code != 0)
                         {
+                            ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
                             content = WebResponseContent.Instance.Error($"灏忓爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
                         }
-                        else
-                        {
-                            //鍒ゆ柇鏄惁瀹屾垚鐨勬渶鍚庝竴灞傦紝鑷姩鐢熸垚绌鸿溅鍑哄簱浠诲姟
-                            string[] Levels = task.Remark.Split("-");
-                            if (Levels.Length == 2)
-                            {
-                                if (!string.IsNullOrEmpty(Levels[0])&& !string.IsNullOrEmpty(Levels[1]))
-                                {
-                                    //濡傛灉褰撳墠鎻愬彇灞傛暟绛変簬鎬诲眰鏂欙紝鍒欒〃绀烘枡杞︽墍鏈夌殑灞傛暟鍙栧畬
-                                    if(Convert.ToInt16(Levels[0])== Convert.ToInt16(Levels[1]))
-                                    {
-                                        string[] SourceCodes = task.SourceAddress.Split("-");
-                                        string startPlan = "";
-                                        if (SourceCodes.Length == 4)
-                                        {
-                                            startPlan= "101"+ SourceCodes[2].Substring(1,2);
-                                        }
-                                        DeliveryPlan send = new DeliveryPlan { startPlan = startPlan, isQuit = false, CarId = task.PalletCode };
-                                        ApiInvoke.DeliveryPlanCMD(send);//鍥炶皟MES鎺ュ彛鐢熸垚绌鸿溅鍑哄簱浠诲姟
-                                 
-                                    }
-                                   
-                                }
+                        //else
+                        //{
+                        //    //鍒ゆ柇鏄惁瀹屾垚鐨勬渶鍚庝竴灞傦紝鑷姩鐢熸垚绌鸿溅鍑哄簱浠诲姟
+                        //    string[] Levels = task.Remark.Split("-");
+                        //    if (Levels.Length == 2)
+                        //    {
+                        //        if (!string.IsNullOrEmpty(Levels[0])&& !string.IsNullOrEmpty(Levels[1]))
+                        //        {
+                        //            //濡傛灉褰撳墠鎻愬彇灞傛暟绛変簬鎬诲眰鏂欙紝鍒欒〃绀烘枡杞︽墍鏈夌殑灞傛暟鍙栧畬
+                        //            if(Convert.ToInt16(Levels[0])== Convert.ToInt16(Levels[1]))
+                        //            {
+                        //                string[] SourceCodes = task.SourceAddress.Split("-");
+                        //                string startPlan = "";
+                        //                if (SourceCodes.Length == 4)
+                        //                {
+                        //                    startPlan = "101" + SourceCodes[2].Substring(1, 2);
+                        //                }
+                        //                DeliveryPlan send = new DeliveryPlan { startPlan = startPlan, isQuit = false, CarId = task.PalletCode };
+                        //                string inparam2 = JsonConvert.SerializeObject(send);
+                        //                ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟鍥炰紶MES鍏ュ弬{inparam2}");
+                        //                ApiInvoke.DeliveryPlanCMD(send);//鍥炶皟MES鎺ュ彛鐢熸垚绌鸿溅鍑哄簱浠诲姟
+                        //                鎵�鏈夌殑灞傛暟閮藉彇瀹岋紝闇�瑕佹妸鏆傚瓨浣嶇姸鎬佹敼涓虹┖闂茬姸鎬�
+                        //                srcLocation.LocationStatus = (int)LocationStatusEnum.Free;
+                        //                _locationInfoRepository.UpdateData(srcLocation);
+                        //            }
+
+                        //        }
                               
-                            }
-                        }
+                        //    }
+                        //}
 
                     }
                     catch (Exception ex)
                     {
                         _unitOfWorkManage.RollbackTran();
+                        ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.StackTrace}銆�");
                         content = WebResponseContent.Instance.Error($"灏忓爢鍨涙満鎵ц鍑哄簱浠诲姟澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵ex.Message}銆�");
                     }
 
                 }
                 else
                 {
+                    ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
                     throw new Exception($"浠诲姟绫诲瀷閿欒,鏈壘鍒拌浠诲姟绫诲瀷,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟绫诲瀷:銆恵task.TaskType}銆�");
                 }
-                content = WebResponseContent.Instance.OK();
+                ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟瀹屾垚鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
+                content = WebResponseContent.Instance.OK($"浠诲姟瀹屾垚鎴愬姛,浠诲姟鍙�:銆恵taskNum}銆�");
             }
             catch (Exception ex)
             {
-                content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆�");
+                ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆憑ex.Message}");
+                content = WebResponseContent.Instance.Error($"浠诲姟瀹屾垚寮傚父,浠诲姟鍙�:銆恵taskNum}銆憑ex.Message}");
             }
             return content;
         }
 
+
+
         /// <summary>
         /// 鎭㈠鎸傝捣浠诲姟
         /// </summary>

--
Gitblit v1.9.3