From 26807a70f3e2c7780ad82cbb12721ea0134a032e Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期三, 15 一月 2025 14:24:21 +0800
Subject: [PATCH] AGV储位绑定重发

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs          |   19 +++++++++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs |   26 +++++++++++++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs           |    7 +++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs    |    3 +
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvPodBerthAndMatDTO.cs     |   48 ++++++++++++++++++++++++
 5 files changed, 102 insertions(+), 1 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs"
index 87f2e46..f5ef2f3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/APIEnum/APIEnum.cs"
@@ -43,6 +43,11 @@
         /// WMS鏄惁绉诲簱鍒ゆ柇
         /// </summary>
         [Description("WMS鏄惁绉诲簱鍒ゆ柇")]
-        WMSIsReloaction
+        WMSIsReloaction,
+        /// <summary>
+        /// AGV鍌ㄤ綅缁戝畾鏌ヨ
+        /// </summary>
+        [Description("AGV鍌ㄤ綅缁戝畾鏌ヨ")]
+        Agv_CSJPodBerthAndMat
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvPodBerthAndMatDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvPodBerthAndMatDTO.cs"
new file mode 100644
index 0000000..9c42a4e
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/Agv/AgvPodBerthAndMatDTO.cs"
@@ -0,0 +1,48 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_DTO.Agv
+{
+    public class AgvPodBerthAndMatDTO
+    {
+        /// <summary>
+        /// 璇锋眰缂栧彿
+        /// </summary>
+        public string ReqCode { get; set; }
+        /// <summary>
+        /// 璇锋眰鏃堕棿鎴�
+        /// </summary>
+        public string ReqTime { get; set; }
+        /// <summary>
+        /// 瀹㈡埛绔紪鍙�
+        /// </summary>
+        public string ClientCode { get; set; }
+        /// <summary>
+        /// 浠ょ墝鍙�
+        /// </summary>
+        public string TokenCode { get; set; }
+        /// <summary>
+        /// 璐ф灦缂栧彿
+        /// </summary>
+        public string PodCode { get; set; }
+        /// <summary>
+        /// 鐗╂枡鎵规
+        /// </summary>
+        public string MaterialLot { get; set; }
+        /// <summary>
+        /// 浣嶇疆缂栧彿
+        /// </summary>
+        public string PositionCode { get; set; }
+        /// <summary>
+        /// 鍖哄煙缂栧彿
+        /// </summary>
+        public string AreaCode { get; set; }
+        /// <summary>
+        /// 鍦板浘绠�绉�
+        /// </summary>
+        public string MapShortName { get; set; }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
index 94f4966..08daff0 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs"
@@ -28,6 +28,7 @@
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseServices;
 using WIDESEAWCS_Core.Enums;
+using WIDESEAWCS_DTO.Agv;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_Model.Models;
 
@@ -227,5 +228,7 @@
         /// <param name="roadwayNos"></param>
         /// <returns></returns>
         WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos);
+
+        WebResponseContent AgvPodBerthAndMat(AgvPodBerthAndMatDTO agvPodModel, APIEnum PodBerthAndMat = APIEnum.Agv_CSJPodBerthAndMat);
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
index 5fa9778..153dccf 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
@@ -9,6 +9,7 @@
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_DTO.Agv;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -90,5 +91,30 @@
         {
             return new AgvResponseContent();
         }
+        public WebResponseContent AgvPodBerthAndMat(AgvPodBerthAndMatDTO agvPodModel, APIEnum PodBerthAndMat = APIEnum.Agv_CSJPodBerthAndMat)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == PodBerthAndMat.ToString())?.ApiAddress;
+                if (string.IsNullOrEmpty(apiAddress))
+                    return WebResponseContent.Instance.Error($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�");
+                string response = HttpHelper.Post(apiAddress, agvPodModel.Serialize());
+                AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>();
+                if (agvContent.Code == "0")
+                {
+                    content.OK(agvContent.Message);
+                }
+                else
+                {
+                    content.Error(agvContent.Message);
+                }
+            }
+            catch (Exception ex)
+            {
+                content.Error(ex.Message);
+            }
+            return content;
+        }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs"
index a56bf1b..c3ae198 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs"
@@ -11,6 +11,7 @@
 using WIDESEAWCS_Model.Models;
 using static Dm.net.buffer.ByteArrayBuffer;
 using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_DTO.Agv;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -71,6 +72,24 @@
                     }
                 }
                 _taskService.UpdateData(newTasks);
+                //鍑哄簱缁戝畾鏌ヨ
+                Dt_Task outBound = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.Exception.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode) && x.TaskType==TaskTypeEnum.Outbound.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x=>x.CreateDate).First();
+                if (outBound != null)
+                {
+                    AgvPodBerthAndMatDTO andMatDTO = new AgvPodBerthAndMatDTO()
+                    {
+                        ReqCode = Guid.NewGuid().ToString().Replace("-", ""),
+                        PositionCode=outBound.TargetAddress
+                    };
+                    WebResponseContent content = _taskService.AgvPodBerthAndMat(andMatDTO);
+                    if (content.Status)
+                    {
+                        outBound.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt();
+                        outBound.ExceptionMessage = "";
+                        //agvTask.Remark = content.Data.ObjToString();
+                        _taskService.UpdateTask(outBound, TaskStatusEnum.AGV_Execute);
+                    }
+                }
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3