using JSMachine.WMS.Common; using JSMachine.WMS.Infrastructure.AppConfiguration; using Microsoft.AspNetCore.Builder; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JSMachine.WMS.PLC.ModbusImpl.Elevator.Exstension { /// /// 电梯 PLC 的 ASP.NET Core 应用构建扩展。 /// public static class ElevatorPlcExstension { /// /// 按配置异步初始化每台电梯的 PLC 连接。 /// /// 当前应用构建器。 public static void UseElevatorPlc(this IApplicationBuilder app) { foreach (ElevatorConfig elevatorConfig in Global.AppSettings.ElevatorConfig) { Task.Run(() => { new ElevatorPlc().Init(elevatorConfig.IP, elevatorConfig.Port); }); } } } }