From e1f772ef890e46813b62a08aa8e77a258f6add2c Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 02 三月 2026 10:04:23 +0800
Subject: [PATCH] 添加任务完成反馈给WMS

---
 .gitignore                                                                    |    1 +
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs          |   32 +++++++++++++++++++++++++++++++-
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj         |    4 ++++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs |    7 +++++--
 4 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 749d54e..473b6f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -259,3 +259,4 @@
 *.2
 *.2
 /浠g爜绠$悊/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/config/applicationhost.config
+/浠g爜绠$悊/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/v17/HierarchyCache.v1.txt
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
index d2a3697..c6df471 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/WMS/WMSController.cs"
@@ -5,6 +5,7 @@
 using System.Threading.Tasks;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_DTO.WMS;
+using WIDESEAWCS_IBasicInfoService;
 using WIDESEAWCS_ITaskInfoService;
 
 namespace WIDESEAWCS_Server.Controllers.WMS
@@ -14,9 +15,11 @@
     public class WMSController : ControllerBase
     {
         private readonly ITaskService _taskService;
-        public WMSController(ITaskService taskService)
+        private readonly IStationMangerService _stationMangerService;
+        public WMSController(ITaskService taskService, IStationMangerService stationMangerService)
         {
             _taskService = taskService;
+            _stationMangerService = stationMangerService;
         }
         /// <summary>
         /// WMS涓嬪彂浠诲姟
@@ -136,7 +139,7 @@
         /// <param name="AreaCode">鍖哄煙鍙�</param>
         /// <returns></returns>
         [HttpPost, Route("LocationInquiry"), AllowAnonymous]
-        public object  LocationInquiry(string AreaCode)
+        public object LocationInquiry(string AreaCode)
         {
             WebResponseContent content = _taskService.LocationInquiry(AreaCode);
             if (!content.Status)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj"
index c164b98..87ccba2 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj"
@@ -76,4 +76,8 @@
 		</Content>
 	</ItemGroup>
 
+	<ItemGroup>
+	  <Folder Include="Log\" />
+	</ItemGroup>
+
 </Project>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index b542669..be32c60 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -14,6 +14,7 @@
 using WIDESEAWCS_Core.Enums;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO;
+using WIDESEAWCS_DTO.WMS;
 using WIDESEAWCS_Model.Models;
 
 namespace WIDESEAWCS_TaskInfoService
@@ -156,10 +157,39 @@
         {
             try
             {
+                WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
+                WMSReturn agvContent = null;
                 dt_Task.TaskState = TaskStatusEnum.Finish.ObjToInt();
+
+                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
+                if (apiInfo == null) dt_Task.ExceptionMessage = "鏈壘鍒板嚭鍏ュ簱瀹屾垚鍙嶉WMS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
+                else
+                {
+                    boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
+                    boundCompleteFeedback.containerCode = dt_Task.PalletCode;
+                    boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
+                    boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
+                    switch (deviceTypeEnum)
+                    {
+                        case DeviceTypeEnum.GALAXIS:
+                            boundCompleteFeedback.businessType = 1;
+                            break;
+                        case DeviceTypeEnum.YuanLiJuHe:
+                            boundCompleteFeedback.businessType = 2;
+                            break;
+                    }
+
+                    boundCompleteFeedback.completeType = 1;
+                    string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
+                    agvContent = response.DeserializeObject<WMSReturn>();
+                    if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
+                }
                 Db.Ado.BeginTran();
                 UpdateLocationStatus(dt_Task.TargetAddress, deviceTypeEnum, LocationStatusEnum.InStock);
-                BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
+                if (agvContent != null && agvContent.code == 0)
+                    BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
+                else
+                    BaseDal.UpdateData(dt_Task);
                 Db.Ado.CommitTran();
                 return WebResponseContent.Instance.OK();
             }

--
Gitblit v1.9.3