From 446c4e45c87c973e9b8d2e8b312cf00ed1aa080c Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 8 Aug 2023 15:15:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B0=83=E7=94=A8Agv?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BB=BB=E5=8A=A1=E9=93=BE=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.WarehouseMgr/WareHouseService.cs | 18 +++++++++--------- .../Configurations/AgvRequestCfgUrl.json | 4 ++-- apihost/Tnb.API.Entry/Startup.cs | 2 -- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index e779085e..7dc4b672 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -7,10 +7,10 @@ using System.Linq.Expressions; using System.Reflection; using System.Runtime.InteropServices; using System.Text; +using System.Text.Encodings.Web; using System.Threading.Tasks; using Aop.Api.Domain; using Aspose.Cells.Drawing; -using Dm; using JNPF; using JNPF.Common.Contracts; using JNPF.Common.Core.Manager; @@ -29,9 +29,6 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; using Newtonsoft.Json; -using NPOI.HPSF; -using NPOI.OpenXmlFormats.Wordprocessing; -using NPOI.SS.Formula.Functions; using Polly.Timeout; using Senparc.NeuChar.Helpers; using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; @@ -331,19 +328,21 @@ namespace Tnb.WarehouseMgr } sw.Stop(); - JNPF.Logging.Log.Information($"程序运行耗时{sw.ElapsedMilliseconds}ms"); + Log.Information($"程序运行耗时{sw.ElapsedMilliseconds}ms"); await db.Ado.CommitTranAsync(); //调用AGV创建任务链接口 var requestCfg = App.Configuration.Build(); + var url = requestCfg.AgvRequestUrls.CreateTaskChainUrl; var taskChainCodeDic = disTasks.Where(t => !t.groups.IsNullOrWhiteSpace()).GroupBy(g => g.groups!) .ToDictionary(x => x.Key, x => x.Select(it => new { taskCode = it.bill_code, - sourceName = it.startlocation_code, - targetName = it.endlocation_code + sourceName = it.startpoint_code, + targetName = it.endpoint_code })); + Log.Information($"请求地址:{url}"); foreach (var (k, v) in taskChainCodeDic) { dynamic reqBody = new ExpandoObject(); @@ -352,8 +351,9 @@ namespace Tnb.WarehouseMgr reqBody.sequential = false; reqBody.taskChainPriority = 0; reqBody.taskList = v; - await HttpClientHelper.PostStreamAsync(requestCfg.AgvRequestUrls.CreateTaskChainUrl, reqBody, CancellationToken.None); - //await HttpClientHelper.HttpPostAsync(url, JsonConvert.SerializeObject(reqBody)); + Log.Information($"请求参数:{JsonConvert.SerializeObject(reqBody)}"); + var respBody = await HttpClientHelper.PostStreamAsync(url, reqBody, CancellationToken.None); + JNPF.Logging.Log.Information($"调用Agv接口响应结果:{respBody}"); } } } diff --git a/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json b/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json index 2f799d66..a15fe34b 100644 --- a/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json +++ b/apihost/Tnb.API.Entry/Configurations/AgvRequestCfgUrl.json @@ -1,6 +1,6 @@ { "AgvRequestUrls": { - "CreateTaskChainUrl": "http://192.168.11.104:1880/localhost/api/task‑chain/create", - "CancelTaskChainUrl": "http://192.168.11.104:1880/api/task‑chain/cancel" + "CreateTaskChainUrl": "http://192.168.11.104:1880/api/task-chain/create", + "CancelTaskChainUrl": "http://192.168.11.104:1880/api/task-chain/cancel" } } \ No newline at end of file diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs index d7748aae..9cc6b27e 100644 --- a/apihost/Tnb.API.Entry/Startup.cs +++ b/apihost/Tnb.API.Entry/Startup.cs @@ -63,10 +63,8 @@ public class Startup : AppStartup services.AddOverideVisualDev(); - #if !DEBUG //定时任务 services.AddHostedService(); - #endif } public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions senparcSetting, IOptions senparcWeixinSetting)