From 7ee7d61dfc380bab6a3b70040743eca0ef47c442 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Tue, 15 Aug 2023 10:48:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BPA.MES.Base.Application.xml | 14 +++++ .../Services/AGVThirdPartyService.cs | 59 +++++++++++++++++++ .../Services/IAGVThirdPartyService.cs | 12 ++++ .../BPA.MES.Base.Core.csproj | 1 + backend/BPA.MES.Base.Web.Core/Startup.cs | 18 +++++- 5 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 backend/BPA.MES.Base.Application/Services/AGVService/Services/AGVThirdPartyService.cs create mode 100644 backend/BPA.MES.Base.Application/Services/AGVService/Services/IAGVThirdPartyService.cs diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml index 3eb8738..94500a3 100644 --- a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml +++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml @@ -1662,6 +1662,20 @@ + + + 下发任务 + + + + + + + 取消任务 + + + + 名 称 :AGV点位管理 diff --git a/backend/BPA.MES.Base.Application/Services/AGVService/Services/AGVThirdPartyService.cs b/backend/BPA.MES.Base.Application/Services/AGVService/Services/AGVThirdPartyService.cs new file mode 100644 index 0000000..82e1e9f --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/AGVService/Services/AGVThirdPartyService.cs @@ -0,0 +1,59 @@ +using BPA.AGV; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.MES.Base.Application.Services.AGVService.Services +{ + + [ApiDescriptionSettings("AGV管理", Name = "AgvThirdParty", Tag = "AGV第三方api", KeepName = true, SplitCamelCase = true, KeepVerb = true)] + public class AGVThirdPartyService:IAGVThirdPartyService, ITransient, IDynamicApiController + { + private readonly AGVHandler _aGVHandler; + public AGVThirdPartyService(AGVHandler aGVHandler) + { + _aGVHandler = aGVHandler; + } + + /// + /// 下发任务 + /// + /// + /// + [HttpPost] + public async Task ExecuteAsync(KCExecuteRequest cExecuteRequest) + { + if (cExecuteRequest.JobData != null) + cExecuteRequest = new KCExecuteRequest + { + Url = cExecuteRequest.Url, + RobotJobId = Guid.NewGuid().ToString(), + WarehouseId = cExecuteRequest.WarehouseId, + JobPriority = cExecuteRequest.JobPriority, + JobPriorityType = cExecuteRequest.JobPriorityType, + JobData = new KCJobDataRequest + { + StartPoint = cExecuteRequest.JobData.StartPoint, + + EndPoint = cExecuteRequest.JobData.EndPoint, + } + }; + return await _aGVHandler.ExecuteAsync(cExecuteRequest); + } + + /// + /// 取消任务 + /// + /// + /// + [HttpPost] + public async Task CancelAsync(KCCancelRequest kCCancelRequest) + { + return await _aGVHandler.CancelAsync(kCCancelRequest); + } + + + } +} diff --git a/backend/BPA.MES.Base.Application/Services/AGVService/Services/IAGVThirdPartyService.cs b/backend/BPA.MES.Base.Application/Services/AGVService/Services/IAGVThirdPartyService.cs new file mode 100644 index 0000000..9db9328 --- /dev/null +++ b/backend/BPA.MES.Base.Application/Services/AGVService/Services/IAGVThirdPartyService.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.MES.Base.Application.Services.AGVService.Services +{ + public class IAGVThirdPartyService + { + } +} diff --git a/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj b/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj index 58e025d..9d3d482 100644 --- a/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj +++ b/backend/BPA.MES.Base.Core/BPA.MES.Base.Core.csproj @@ -13,6 +13,7 @@ + diff --git a/backend/BPA.MES.Base.Web.Core/Startup.cs b/backend/BPA.MES.Base.Web.Core/Startup.cs index c34c1d9..f8c14c9 100644 --- a/backend/BPA.MES.Base.Web.Core/Startup.cs +++ b/backend/BPA.MES.Base.Web.Core/Startup.cs @@ -1,4 +1,5 @@ -using BPA.MES.Base.Application; +using BPA.AGV; +using BPA.MES.Base.Application; using BPA.MES.Base.Application.Subscriber; using BPA.MES.Base.Core; using Furion; @@ -30,6 +31,21 @@ public class Startup : AppStartup builder.AddSubscriber(typeof(ToDoEventSubscriber)); }); services.AddRemoteRequest(); + services.AddAGV(op => + { + op = new AGVOptions() + { + Header=new KCOption() + { + AppKey="43", + AppSecret="12", + RequestId= "43", + Timestamp= "2234234324", + Version= "2.9" + } + }; + }); + services.AddControllers() .AddInjectWithUnifyResult(); }