From a82079b96d13fd8b80a69930e7783d42ff0c850d Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 2 Aug 2023 10:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B0=83=E7=94=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E6=8E=A5=E5=8F=A3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/ChainStatusReportingUpInput.cs | 24 +++++++++++++++++++ .../Dto/Outputs/Result.cs | 4 ++++ .../Tnb.WarehouseMgr/DeviceProviderService.cs | 10 ++++---- .../Tnb.WarehouseMgr/WareHouseService.cs | 16 +++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs new file mode 100644 index 00000000..2eac52e8 --- /dev/null +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +{ + /// + /// 创建任务链输入参数 + /// + public class ChainStatusReportingUpInput + { + /// + /// 任务链编号 + /// + public string taskChainCode { get; set; } + + /// + /// 任务链任务状态 + /// + public string status { get; set; } + } +} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs index 1941562b..7e3012bd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs @@ -17,6 +17,10 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// 响应信息 /// public string msg { get; set; } + /// + /// 错误提示消息 + /// + public string error { get; set; } public DateTime? timestamp { get; set; } /// /// 响应数据 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs index 2fa07bb8..46cfae01 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Senparc.NeuChar.ApiHandlers; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Dto.Outputs; namespace Tnb.WarehouseMgr @@ -12,17 +13,18 @@ namespace Tnb.WarehouseMgr /// /// Wms设备接口提供程序服务类 /// - + public class DeviceProviderService : BaseWareHouseService { /// - /// 创建任务链 + /// 任务链状态上报 /// /// [HttpPost] - public async Task CreateTaskChain() + public async Task ChainStatusReporting(ChainStatusReportingUpInput input) { + return await Task.FromResult(null); - } + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index a8a61455..a6471e96 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Dynamic; using System.Linq; using System.Linq.Expressions; @@ -19,6 +20,7 @@ using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Extras.CollectiveOAuth.Config; using JNPF.FriendlyException; +using JNPF.Logging; using JNPF.Systems.Entitys.Dto.Module; using JNPF.Systems.Interfaces.System; using Mapster; @@ -213,6 +215,7 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task GenTaskExecute() { + Stopwatch sw = Stopwatch.StartNew(); //获取所有未下发的预任务申请 var preTasks = await _db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id) .InnerJoin((a, b, c) => a.area_id == c.id) @@ -316,6 +319,19 @@ namespace Tnb.WarehouseMgr row = await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_YXF_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync(); } + //调用AGV创建任务链接口 + 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 + })); + + dynamic reqBody = new ExpandoObject(); + + sw.Stop(); + Log.Information($"程序运行耗时{sw.ElapsedMilliseconds}ms"); await _db.Ado.CommitTranAsync(); } catch (Exception)