From 4f3b0a6727ecfa555892ebea64bd76e5a07cd6fb Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期二, 17 三月 2026 10:01:38 +0800
Subject: [PATCH] feat: 新增WMS异常上报自动恢复异常按钮

---
 项目代码/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs |   81 ++++++++++++++++++++++------------------
 1 files changed, 44 insertions(+), 37 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
index d3f1524..cb04891 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_TaskInfoService/InvokeAGVService.cs"
@@ -1,9 +1,11 @@
 锘縰sing Autofac.Core;
-using Newtonsoft.Json.Serialization;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Serialization;
+using Org.BouncyCastle.Asn1.Ocsp;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection.Metadata;
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_DTO.Agv;
@@ -12,9 +14,8 @@
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.Agv;
-using System.Reflection.Metadata;
-using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_Model.Models;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -30,10 +31,12 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
+                
                 string? apiAddress = _apiInfoRepository.QueryFirst(x => x.ApiCode == SendTask.ToString())?.ApiAddress;
                 if (string.IsNullOrEmpty(apiAddress)) throw new Exception($"鏈壘鍒板彂閫丄GV浠诲姟鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�");
                 string request = JsonConvert.SerializeObject(taskModel, settings);
                 string response = HttpHelper.Post(apiAddress, request);
+                WriteLog.Write_Log("AGV鍏ュ簱浠诲姟涓嬪彂", "鍑哄簱浠诲姟涓嬪彂鎺ュ彛", "璇锋眰浠诲姟", $"璇锋眰锛歿request},鍥炰紶锛歿response}");
                 AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>() ?? throw new Exception("AGV浠诲姟鍙戦�佹湭杩斿洖缁撴灉");
                 if (agvContent.Success)
                 {
@@ -55,6 +58,7 @@
         /// </summary>
         public void AgvSearchStatus1(Dt_ErrorInfo e2)
         {
+            WriteLog.Write_Log("AGV鏌ヨ璋冪敤鍙奧MS鏁呴殰涓婃姤", "AGV鏌ヨ璋冪敤鍙奧MS鏁呴殰鎺ュ彛", "璇锋眰", $"璇锋眰锛歿e2.ToJson()}");
             if (e2 != null)
             {
                 // 鏌ヨ鏄惁鏈夐敊璇病鏈夊氨娣诲姞锛屾湁灏卞彇娑�
@@ -64,50 +68,53 @@
 
                 string? ErrorBack = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMSErrorBack.ToString())?.ApiAddress;
                 if (string.IsNullOrEmpty(ErrorBack))
-                    throw new Exception($"鏈壘鍒癢MS鏁呴殰涓婃姤鎺ュ彛,璇锋鏌ユ帴鍙i厤缃�");
-
-                // 濡傛灉鏄晠闅滀笂鎶�(e2.ErrorType == 2)
-                if (e2.ErrorType == 2)
                 {
-                    // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鏈哄櫒浜虹殑鏁呴殰璁板綍
-                    if (existingErrors.Count == 0)
+                    return;
+                }else{
+                    // 濡傛灉鏄晠闅滀笂鎶�(e2.ErrorType == 2)
+                    if (e2.ErrorType == 2)
                     {
-                        _errorInfoRepository.AddData(e2);
-                        // 鍙戦�佺粰WMS - 鏁呴殰涓婃姤
-                        TaskError taskError = new TaskError()
+                        // 妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鏈哄櫒浜虹殑鏁呴殰璁板綍
+                        if (existingErrors.Count == 0)
                         {
-                            MsgID = e2.Id,
-                            StationCode = e2.StationCode,
-                            MsgCode = 1, // 1琛ㄧず鏁呴殰
-                            Msg = e2.Message
-                        };
-                        string reqErrorBack = JsonConvert.SerializeObject(taskError, settings);
-                        HttpHelper.Post(ErrorBack, reqErrorBack);
-                    }
-                    // 濡傛灉宸插瓨鍦ㄦ晠闅滆褰曪紝鍒欎笉閲嶅娣诲姞
-                }
-                // 濡傛灉鏄甯哥姸鎬�(e2.ErrorType == 0)涓斿瓨鍦ㄦ晠闅滆褰曪紝鍒欐墽琛屾晠闅滄仮澶�
-                else if (e2.ErrorType == 0 && existingErrors.Count > 0)
-                {
-                    // 鍒犻櫎鏁呴殰璁板綍
-                    if (_errorInfoRepository.DeleteData(existingErrors))
-                    {
-                        // 鍙戦�佺粰WMS - 鏁呴殰鎭㈠
-                        foreach (var error in existingErrors)
-                        {
+                            _errorInfoRepository.AddData(e2);
+                            // 鍙戦�佺粰WMS - 鏁呴殰涓婃姤
                             TaskError taskError = new TaskError()
                             {
-                                MsgID = error.Id,
-                                StationCode = error.StationCode,
-                                MsgCode = 0, // 0琛ㄧず鎭㈠
-                                Msg = "鏁呴殰鎭㈠"
+                                MsgID = e2.Id,
+                                StationCode = e2.StationCode,
+                                MsgCode = 1, // 1琛ㄧず鏁呴殰
+                                Msg = e2.Message
                             };
                             string reqErrorBack = JsonConvert.SerializeObject(taskError, settings);
                             HttpHelper.Post(ErrorBack, reqErrorBack);
                         }
+                        // 濡傛灉宸插瓨鍦ㄦ晠闅滆褰曪紝鍒欎笉閲嶅娣诲姞
                     }
+                    // 濡傛灉鏄甯哥姸鎬�(e2.ErrorType == 0)涓斿瓨鍦ㄦ晠闅滆褰曪紝鍒欐墽琛屾晠闅滄仮澶�
+                    else if (e2.ErrorType == 0 && existingErrors.Count > 0)
+                    {
+                        // 鍒犻櫎鏁呴殰璁板綍
+                        if (_errorInfoRepository.DeleteData(existingErrors))
+                        {
+                            // 鍙戦�佺粰WMS - 鏁呴殰鎭㈠
+                            foreach (var error in existingErrors)
+                            {
+                                TaskError taskError = new TaskError()
+                                {
+                                    MsgID = error.Id,
+                                    StationCode = error.StationCode,
+                                    MsgCode = 0, // 0琛ㄧず鎭㈠
+                                    Msg = "鏁呴殰鎭㈠"
+                                };
+                                string reqErrorBack = JsonConvert.SerializeObject(taskError, settings);
+                                HttpHelper.Post(ErrorBack, reqErrorBack);
+                            }
+                        }
+                    }
+                    return;
                 }
-                return;
+  
             }
         }
         /// <summary>
@@ -178,7 +185,7 @@
                 _errorInfoRepository.DeleteData(delErrorInfos);
                 _errorInfoRepository.AddData(addErrorInfos);
                 _unitOfWorkManage.CommitTran();
-                List<Dt_ErrorInfo> newErrInfos = _errorInfoRepository.QueryData(x=>x.Id > errorId && x.ErrorType == 2);
+                List<Dt_ErrorInfo> newErrInfos = _errorInfoRepository.QueryData(x=>x.Id > errorId && x.ErrorType == 1);
                 if (delErrorInfos.Count>0)
                 {
                     foreach (var item in delErrorInfos)

--
Gitblit v1.9.3