| | |
| | | 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; |
| | |
| | | } |
| | | else//鍑哄簱鏀捐揣璇锋眰 |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.PalletType); |
| | | var content = PutRequest(task.NextAddress, task); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | |
| | | } |
| | | else//鍏ュ簱鏀捐揣璇锋眰 |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.TaskNum); |
| | | var content = PutRequest(task.NextAddress, task); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | |
| | | /// <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 |
| | |
| | | { |
| | | 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($"鍏佽鍙栨枡"); |
| | | } |
| | |
| | | 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); |
| | | } |