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_Common/TaskEnum/TaskStatusEnum.cs              |    2 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |    9 +
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicService/Base/LocationInfoService.cs       |    9 +
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs          |    4 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs               |    2 
 代码管理/WCS/WIDESEAWCS_Client/src/api/http.js                                           |    2 
 代码管理/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js                            |    4 
 代码管理/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue                               |    2 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs      |    6 
 代码管理/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue                          |   52 ++++++--
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                 |  233 ++++++++++++++++++++++++++++++++++----
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj                  |    2 
 12 files changed, 276 insertions(+), 51 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/api/http.js"
index 48c649a..901521e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/api/http.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/api/http.js"
@@ -12,7 +12,7 @@
 let loadingInstance;
 let loadingStatus = false;
 if (process.env.NODE_ENV == 'development') {
-    axios.defaults.baseURL = 'http://127.0.0.1:9291/';
+    axios.defaults.baseURL = 'http://10.0.250.15:9291/';
 }
 else if (process.env.NODE_ENV == 'debug') {
     axios.defaults.baseURL = 'http://10.0.250.15:9291/';
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
index b5dc2a9..e330c74 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/extension/taskinfo/task.js"
@@ -26,7 +26,7 @@
                     console.log("rows"+rows);
                     if (rows.length == 0 || rows.length > 1) return this.$error("璇烽�夋嫨涓�琛屾暟鎹�");
                     this.http
-                        .post("/api/Task/ForceCompleteTask?taskNum=" + rows[0].TaskNum, {}, true)
+                        .post("/api/Task/ForceCompleteTask?taskNum=" + rows[0].taskNum, {}, true)
                         .then((x) => {
                             if (!x.status) return this.$message.error(x.message);
                             this.options = x.data;
@@ -42,7 +42,7 @@
                     console.log("rows"+rows);
                     if (rows.length == 0 || rows.length > 1) return this.$error("璇烽�夋嫨涓�琛屾暟鎹�");
                     this.http
-                        .post("/api/Task/CancelTask?taskNum=" + rows[0].TaskNum, {}, true)
+                        .post("/api/Task/CancelTask?taskNum=" + rows[0].taskNum, {}, true)
                         .then((x) => {
                             if (!x.status) return this.$message.error(x.message);
                             this.options = x.data;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue"
index 75fca33..13fe93b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/basic/locationInfo.vue"
@@ -27,9 +27,12 @@
       sortName: "id",
     });
     const editFormFields = ref({
+      locationCode:"",
+      locationName:"",
       row: "",
       column: "",
       layer: "",
+      roadwayNo:"",
       depth: "",
       locationType: "",
       locationStatus: "",
@@ -39,6 +42,40 @@
     const editFormOptions = ref([
       [
         {
+          title: "璐т綅缂栧彿",
+          required: true,
+          field: "locationCode",
+          type: "string",
+        },
+        {
+          title: "璐т綅鍚嶇О",
+          required: true,
+          field: "locationName",
+          type: "string",
+        },
+         {
+          title: "宸烽亾缂栧彿",
+          required: true,
+          field: "roadwayNo",
+          type: "string",
+        },
+       
+        {
+          title: "璐т綅娣卞害",
+          field: "depth",
+          type: "string",
+          hidden: true,
+        },
+
+         {
+          title: "澶囨敞",
+          field: "remark",
+          type: "string",
+          hidden: true,
+        },
+      ],
+        [
+         {
           title: "璐т綅琛�",
           required: true,
           field: "row",
@@ -56,12 +93,6 @@
           field: "layer",
           type: "string",
         },
-        // {
-        //   title: "璐т綅娣卞害",
-        //   required: true,
-        //   field: "depth",
-        //   type: "string",
-        // },
       ],
       [
         {
@@ -82,17 +113,12 @@
         },
         {
           title: "鍖哄煙涓婚敭",
-          required: true,
+          //required: true,
           field: "areaId",
           type: "string",
           hidden: true,
         },
-        // {
-        //   title: "宸烽亾缂栧彿",
-        //   required: true,
-        //   field: "roadwayNo",
-        //   type: "string",
-        // },
+       
       ],
     ]);
     const searchFormFields = ref({
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue"
index 58e392d..6bffd95 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Client/src/views/taskinfo/task.vue"
@@ -143,7 +143,7 @@
       },
       {
         field: "nextAddress",
-        title: "涓嬩竴浣嶇疆",
+        title: "鍏ュ簱鏂颁换鍔″彿",
         type: "string",
         width: 120,
         align: "left",
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicService/Base/LocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicService/Base/LocationInfoService.cs"
index bd969e6..23f2d7c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicService/Base/LocationInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicService/Base/LocationInfoService.cs"
@@ -35,14 +35,19 @@
             saveModel.MainData.Add(nameof(Dt_LocationInfo.EnableStatus), EnableStatusEnum.Normal.ObjToInt());
             saveModel.MainData.Add(nameof(Dt_LocationInfo.LocationStatus), LocationStatusEnum.Free.ObjToInt());
             Dt_LocationInfo locationInfo = saveModel.MainData.DicToModel<Dt_LocationInfo>();
-            locationInfo.LocationCode = $"R{locationInfo.RoadwayNo.PadLeft(2, '0')}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}";
-            locationInfo.LocationName = $"R{locationInfo.RoadwayNo.PadLeft(2, '0')}宸烽亾{locationInfo.Row.ToString().PadLeft(3, '0')}琛寋locationInfo.Column.ToString().PadLeft(3, '0')}鍒梴locationInfo.Layer.ToString().PadLeft(3, '0')}灞倇locationInfo.Depth.ToString().PadLeft(2, '0')}娣�";
+            //locationInfo.LocationCode = $"R{locationInfo.RoadwayNo.PadLeft(2, '0')}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}";
+            //locationInfo.LocationName = $"R{locationInfo.RoadwayNo.PadLeft(2, '0')}宸烽亾{locationInfo.Row.ToString().PadLeft(3, '0')}琛寋locationInfo.Column.ToString().PadLeft(3, '0')}鍒梴locationInfo.Layer.ToString().PadLeft(3, '0')}灞倇locationInfo.Depth.ToString().PadLeft(2, '0')}娣�";
 
             return base.AddData(locationInfo);
         }
 
         public override WebResponseContent UpdateData(SaveModel saveModel)
         {
+            string locationtype = saveModel.MainData["locationType"].ToString();
+            if (locationtype != "1")
+            {
+                return WebResponseContent.Instance.Error($"璇ヨ揣浣嶇被鍨嬩笉鍏佽淇敼锛�");
+            }
             return base.UpdateData(saveModel);
         }
 
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs"
index cdbea8b..86c7eba 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs"
@@ -128,7 +128,7 @@
         OutFinish = 190,
 
         /// <summary>
-        /// 鍑哄簱浠诲姟鎸傝捣
+        /// 鍑哄簱浠诲姟寮哄埗瀹屾垚
         /// </summary>
         [Description("鍑哄簱浠诲姟鎸傝捣")]
         OutPending = 197,
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs"
index 07e8613..3c67354 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Basic/Dt_LocationInfo.cs"
@@ -14,7 +14,7 @@
         [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
         public int Id { get; set; }
 
-        [SugarColumn(ColumnDescription = "鍖哄煙涓婚敭")]
+        [SugarColumn(IsNullable = true,ColumnDescription = "鍖哄煙涓婚敭")]
         public int AreaId {  get; set; }=0;
 
         [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "璐т綅缂栧彿")]
@@ -35,7 +35,7 @@
         [SugarColumn(IsNullable = false, ColumnDescription = "璐т綅灞�")]
         public int Layer {  get; set; }
 
-        [SugarColumn(IsNullable = false, ColumnDescription = "璐т綅娣卞害")]
+        [SugarColumn(IsNullable = true, ColumnDescription = "璐т綅娣卞害")]
         public int Depth {  get; set; }
 
         //[SugarColumn(IsNullable = false, ColumnDescription = "宸︿晶/鍙充晶")]
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
index 80046c8..2c0fa1f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs"
@@ -44,7 +44,7 @@
         /// </summary>
         [ImporterHeader(Name = "浠诲姟鍙�")]
         [ExporterHeader(DisplayName = "浠诲姟鍙�")]
-        [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟鍙�"), SequenceAttirbute(nameof(SequenceEnum.SeqTaskNum), 6000)]
+        [SugarColumn(IsNullable = false, ColumnDescription = "浠诲姟鍙�")]
         public int TaskNum { get; set; }
 
         /// <summary>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj"
index 6142f1f..dbe8add 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj"
@@ -8,7 +8,7 @@
 
 	<ItemGroup>
 		<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
-		<PackageReference Include="WIDESEAWCS_Core" Version="1.0.6" />
+		<PackageReference Include="WIDESEAWCS_Core" Version="1.0.7" />
 	</ItemGroup>
 
 	<ItemGroup>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index 1ad1b94..a61f151 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -62,7 +62,7 @@
         }
 
         /// <summary>
-        /// 浠诲姟鍙栨秷
+        /// 浠诲姟鍙栨秷(鍫嗗灈鏈哄洖瑙e喅涓嶄簡鐨勬晠闅滈渶娓呴櫎浠诲姟锛屾竻闄や换鍔″悗锛岄渶鍦╓CS涓婂彇娑堜换鍔�)
         /// </summary>
         /// <param name="key"></param>
         /// <returns></returns>
@@ -74,14 +74,14 @@
         }
 
         /// <summary>
-        /// 浠诲姟寮哄埗瀹屾垚
+        /// 浠诲姟寮哄埗瀹屾垚  锛堝爢鍨涙満瀹為檯宸插畬鎴愪换鍔★紝WCS鏈敹鍒板畬鎴愪俊鍙锋垨鍏朵粬鏈煡鍘熷洜瀵艰嚧WCS浠诲姟鏈畬鎴愶紝鍙互鎵ц璇ユ柟娉曞己鍒跺畬鎴愪换鍔★級
         /// </summary>
         /// <param name="taskNum"></param>
         /// <returns></returns>
         [HttpPost, HttpGet, Route("ForceCompleteTask")]
         public WebResponseContent ForceCompleteTask (int taskNum)
         {
-            return null;
+            return Service.ForceCompleteTask(taskNum);
         }
     }
 }
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 dec3bb8..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"
@@ -21,6 +21,7 @@
 using SqlSugar;
 using SqlSugar.Extensions;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Diagnostics.CodeAnalysis;
@@ -705,14 +706,123 @@
         }
 
         /// <summary>
-        /// 浠诲姟寮哄埗瀹屾垚
+        /// 浠诲姟寮哄埗瀹屾垚 鍫嗗灈鏈哄疄闄呭凡瀹屾垚浠诲姟锛學CS鏈敹鍒板畬鎴愪俊鍙锋垨鍏朵粬鏈煡鍘熷洜瀵艰嚧WCS浠诲姟鏈畬鎴愶紝鍙互鎵ц璇ユ柟娉曞己鍒跺畬鎴愪换鍔�
         /// </summary>
         /// <param name="taskNum"></param>
         /// <returns></returns>
         public WebResponseContent ForceCompleteTask(int taskNum)
         {
-            return null;
-        
+            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>
@@ -720,51 +830,112 @@
         /// </summary>
         /// <param name="taskid"></param>
         /// <returns></returns>
-        public WebResponseContent CancelTask(int taskid)
+        public WebResponseContent CancelTask(int taskNum)
         {
             WebResponseContent content = new WebResponseContent();
             try
             {
-                //鍏堟煡璇换鍔★紝鏍规嵁涓嶅悓鐨勪换鍔$被鍨嬪仛浠诲姟鍙栨秷鎿嶄綔
-                bool isAllow = false;
-                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskId == taskid);
-                if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟id:銆恵taskid}銆�");
+                //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鈥濅箣鍓嶅彲浠ュ彇娑�
                     {
-                        isAllow = true;
                         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鈥濅箣鍓嶅彲浠ュ彇娑�
                     {
-                        isAllow = true;
                         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
                     {
-                        isAllow = true;
-                        task.TaskState = (int)TaskOutStatusEnum.OutCancel;
+                        return WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍏佽鍙栨秷锛�");
                     }
                 }
 
-                if (isAllow)//濡傛灉鍏佽鍙栨秷
+
+
+                //浠诲姟鍙栨秷鍥炶皟MES
+                if (isBack)
                 {
-                    //鏇存柊鐘舵�佷负浠诲姟鍙栨秷
-                    UpdateTaskStatus(task.TaskId, task.TaskState);
-                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鎵嬪姩浠诲姟鍙栨秷");
-                    content = WebResponseContent.Instance.OK("鍙栨秷鎴愬姛锛�");
-                    //鍚屾鍥炰紶WMS
+                    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
                 {
-                    content = WebResponseContent.Instance.OK("璇ヤ换鍔$洰鍓嶇姸鎬佷笉鍏呰鍙栨秷锛�");
+
                 }
+
             }
             catch (Exception ex)
             {
@@ -943,12 +1114,26 @@
                         _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)
                         {
-                            ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"澶у爢鍨涙満瀹屾垚鍑哄簱浠诲姟鍚庡洖浼燤ES澶辫触锛�,浠诲姟鍙�:銆恵taskNum}銆�,澶辫触淇℃伅:銆恵res.message}銆�");
-                            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}銆�");
+                            }
                         }
 
                     }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index 6250472..427ab45 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -6,11 +6,13 @@
 using System.Collections.Generic;
 using System.Diagnostics.CodeAnalysis;
 using System.Linq;
+using System.Reflection.Metadata;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEAWCS_Common.ServiceLog;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Communicator;
+using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Enums;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_IBasicRepository;
@@ -89,6 +91,13 @@
                                             _taskService.UpdateTaskStatus(task.TaskId, (int)TaskOutStatusEnum.SC_OutExecuting);
                                             _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄嚭搴撴墽琛屼腑");
                                         }
+
+                                        //绌鸿溅鍑哄簱鍛戒护鍙戦�佹垚鍔熷悗锛屽洖浼� status=1锛�
+                                        if (task.TaskType == (int)TaskOutboundTypeEnum.OutPick)
+                                        {
+                                            MESSendCMD sendcmd = new MESSendCMD { cmd = 201, task_id = task.TaskNum, status = 1 };
+                                            MESResponse res = ApiInvoke.SendTaskCMD(sendcmd);
+                                        }
                                     }
                                     else
                                     {

--
Gitblit v1.9.3