liulijun
2025-11-24 9086b238cd9fbb9fbeae7cab11d59576cd9d2853
项目代码/WCS/WCSServices/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs
@@ -2,7 +2,9 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Text;
using System.Text.RegularExpressions;
using WIDESEA_DTO.Agv;
using WIDESEA_External.Model;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Enums;
@@ -70,7 +72,7 @@
                    }
                    else//鍑哄簱鏀捐揣璇锋眰
                    {
                        var content = PutRequest(task.NextAddress, task.PalletType);
                        var content = PutRequest(task.NextAddress, task);
                        if (!content.Status)
                        {
                            throw new Exception(content.Message);
@@ -89,7 +91,7 @@
                    }
                    else//鍏ュ簱鏀捐揣璇锋眰
                    {
                        var content = PutRequest(task.NextAddress, task.TaskNum);
                        var content = PutRequest(task.NextAddress, task);
                        if (!content.Status)
                        {
                            throw new Exception(content.Message);
@@ -312,7 +314,7 @@
        /// <param name="palletType"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("PutRequest"), AllowAnonymous]
        public WebResponseContent PutRequest(string code, int taskNum)
        public WebResponseContent PutRequest(string code, Dt_Task task)
        {
            WebResponseContent content = new WebResponseContent();
            try
@@ -330,14 +332,20 @@
                    {
                        SD_WorkCentreAgvArriveNoticeInfo=new List<AgvArriveNotice> { new AgvArriveNotice()
                        {
                            DispatchPlanMaterialId=409,
                            WorkCentreCode="66",
                            LocationCode="3-ZD-ZJZZ",
                            CallId="4534c242-27a7-4fb6-86f5-460b09db303d"
                            DispatchPlanMaterialId=task.DispatchPlanId,
                            WorkCentreCode=task.WorkCentreCode,
                            LocationCode=code,
                            CallId=Guid.NewGuid().ToString().Replace("-","")
                        } }
                    };
                    WebResponseContent webResponse= _taskService.MESAvgArriveNotice(requestAGVArriveDTO);
                    if (webResponse.Message.Contains("\"obj\": true"))
                    MESResponse response = _taskService.MESAvgArriveNotice(requestAGVArriveDTO).DeserializeObject<MESResponse>() ?? throw new Exception("鏈幏鍙栧埌杩斿洖淇℃伅");
                    if (!response.Result)
                    {
                        throw new Exception($"璋冪敤MES灏忚溅鍏佽鏀捐揣鎶ラ敊,MES杩斿洖淇℃伅"+ Regex.Replace(response.Msg, @"\\u([0-9a-fA-F]{4})", match => {
                            return ((char)Convert.ToInt32(match.Groups[1].Value, 16)).ToString();
                        }));
                    }
                    if (response.Obj)
                    {
                        return content.Error($"鍏佽鍙栨枡");
                    }
@@ -389,7 +397,7 @@
                        bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode);
                        if (!RequestPut)
                        {
                            otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode);
                            otherDevice.SetValue(CoveryorDB.C_InTaskNum, task.TaskNum, stationManger.StationDeviceCode);
                            otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode);
                            Thread.Sleep(1000);
                        }