wms电梯设定,新增开关电梯控制接口
This commit is contained in:
@@ -4,12 +4,14 @@ using DingTalk.Api.Request;
|
||||
using JNPF;
|
||||
using JNPF.Common.Extension;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Tnb.Common.Extension;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.WarehouseMgr.Entities.Configs;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
@@ -24,11 +26,14 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly BackgroundService _agvHeartbeatMonitor;
|
||||
private static readonly Dictionary<string, Func<BackgroundService, bool>> _fetchStartedStausValue = new();
|
||||
private readonly bool isFrontDoorBit = false; //是否到前门位
|
||||
private readonly IServiceProvider _sp;
|
||||
private readonly BackgroundService _backgudSvc;
|
||||
|
||||
public ElevatorControlService()
|
||||
public ElevatorControlService(IServiceProvider sp, BackgroundService bgSvc)
|
||||
{
|
||||
_elevatorCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
//_agvHeartbeatMonitor = agvHeartbeatMonitorService;
|
||||
_sp = sp;
|
||||
_backgudSvc = bgSvc;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -402,5 +407,39 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
return isSuccefuly;
|
||||
}
|
||||
|
||||
private List<Task<dynamic>> ParallelWriteTagAsync(CloseElevatorInput input)
|
||||
{
|
||||
var tasks = new List<Task<dynamic>>(input.devNames.Count());
|
||||
foreach (var devName in input.devNames)
|
||||
{
|
||||
tasks.Add(WriteTagAsync(devName, ElevatorConsts.AGVControl, input.value));
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public async Task CloseElevatorControl(CloseElevatorInput input)
|
||||
{
|
||||
if (input.devNames == null || !input.devNames.Any())
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input.devNames));
|
||||
}
|
||||
var tasks = ParallelWriteTagAsync(input);
|
||||
await Task.WhenAll(tasks);
|
||||
var timedTaskSvc = _backgudSvc as TimedTaskBackgroundService;
|
||||
if (timedTaskSvc != null)
|
||||
{
|
||||
if (input.flag.Equals("close", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_ = timedTaskSvc.CloseAgvHeartbeat(input.devNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = timedTaskSvc.OpenAgvHeartbeat(input.devNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user