diff --git a/Service/EquipmentInit.cs b/Service/EquipmentInit.cs index 30fde60..40b83cd 100644 --- a/Service/EquipmentInit.cs +++ b/Service/EquipmentInit.cs @@ -2,6 +2,7 @@ using HybirdFrameworkDriver.ModbusTcpMaster; using HybirdFrameworkDriver.Session; using HybirdFrameworkServices.Plc; +using Newtonsoft.Json.Linq; using Service.Init.Entity; namespace Service @@ -53,6 +54,8 @@ namespace Service if (connected) { + PlcStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo); + plcInfo.Connected = true; break; } @@ -64,7 +67,7 @@ namespace Service SessionMgr.RegisterModbusSession(master.connectId, modbusSession); SessionMgr.SetAttrModbus(modbusSession, "eqm_sn", 1); PlcInfo waterColdInfo = new PlcInfo(master.connectId, 1); - ChargerStaticInfo.PlcInfos.TryAdd(1, waterColdInfo); + PlcStaticInfo.PlcInfos.TryAdd(1, waterColdInfo); } /** @@ -72,69 +75,43 @@ namespace Service */ private static void BatchReadPlc(ModbusTcpMaster master) { - while (true) - { - int sn = 3; //(int)SessionMgr.GetAttrModbus(master.connectId, "eqm_sn"); + //这里不设置while。 + int sn = 3; //(int)SessionMgr.GetAttrModbus(master.connectId, "eqm_sn"); - ChargerStaticInfo.PlcInfos.TryGetValue(sn, out PlcInfo plcInfo); - if (plcInfo != null) + PlcStaticInfo.PlcInfos.TryGetValue(sn, out PlcInfo plcInfo); + if (plcInfo != null) + { + var bytes01 = master.BatchRead(1, 115); + if (bytes01 != null) { - var bytes01 = master.BatchRead(1, 115); - if (bytes01 != null) - { - ModbusDecoder.Decode(bytes01, plcInfo.hostToPlc); - } - - var bytes02 = master.BatchRead(201, 222); - if (bytes02 != null) - { - ModbusDecoder.Decode(bytes02, plcInfo.plcToHost); - } - - var bytes03 = master.BatchRead(701, 10); - if (bytes03 != null) - { - ModbusDecoder.Decode(bytes03, plcInfo.plcFault); - } - //OperateResult result2 = ModbusTcpNet.Read("x=3;201", 222); + ModbusDecoder.Decode(bytes01, plcInfo.hostToPlc); } - /* - if (plcInfo != null) - { - byte[]? bytes01 = master.BatchRead(0, 22); - if (bytes01 != null) - { - ModbusDecoder.DecodeByT(bytes01, plcInfo.PlcReadAndWritten2); - } - byte[]? bytes02 = master.BatchRead(256, 170); - if (bytes02 != null) - { - ModbusDecoder.DecodeByT(bytes02, plcInfo.PlcReadonly); - } - byte[]? bytes03 = master.BatchRead(39424, 108); - if (bytes03 != null) - { - ModbusDecoder.DecodeByT(bytes03, plcInfo.PlcTurnsRatio); - } - byte[]? bytes04 = master.BatchRead(40960, 3);//写编程使能。本机modbus地址。波特率 - byte[]? bytes05 = master.BatchRead(2566, 1);//校验位 - byte[]? bytes06 = master.BatchRead(42, 1);//秒脉冲/无功电能选择 - byte[]? bytes07 = master.BatchRead(48, 1);//电流接线反向 - byte[]? bytes08 = master.BatchRead(4576, 1);//电表清零 + var bytes02 = master.BatchRead(201, 222); + if (bytes02 != null) + { + ModbusDecoder.Decode(bytes02, plcInfo.plcToHost); + plcInfo.RemoteNot = plcInfo.plcToHost.RemoteLocalControlState.Value == 1010 ? true : false; + plcInfo.EntranceRadar = plcInfo.plcToHost.RadarStatesOut.Value == 1000 ? true : false; + plcInfo.ChannelLocationState = plcInfo.plcToHost.ChannelLocationState.Value == 1000 ? true : false; - if (bytes04 != null) - { - ModbusDecoder.DecodeByT(bytes04, plcInfo.PlcReadAndWritten1); - } - plcInfo.PlcReadAndWritten1.CheckBit = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes05, 0); - plcInfo.PlcReadAndWritten1.PulsePerSecond = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes06, 0); - plcInfo.PlcReadAndWritten1.CurrentReversal = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes07, 0); - plcInfo.PlcReadAndWritten1.MeterReset = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes08, 0); + plcInfo.BatteryDisassembly = plcInfo.plcToHost.TaskStates.Value == 1002 ? true : false; + plcInfo.StorageBatteries = plcInfo.plcToHost.TaskStates.Value == 1003 ? true : false; + plcInfo.BatteryDelivery = plcInfo.plcToHost.TaskStates.Value == 1004 ? true : false; + plcInfo.BatteryInstallation = plcInfo.plcToHost.TaskStates.Value == 1005 ? true : false; + plcInfo.BatteryInstallationComplete = plcInfo.plcToHost.TaskStates.Value == 1006 ? true : false; + plcInfo.SetExitLightGreen = (plcInfo.plcToHost.LightOut.Value == 1000 || plcInfo.plcToHost.LightOut.Value == 1010) ? true : false; + plcInfo.ExitRadarSensingTrigger = plcInfo.plcToHost.RadarStatesOut.Value == 1000 ? true : false; + } - } - */ + var bytes03 = master.BatchRead(701, 10); + if (bytes03 != null) + { + ModbusDecoder.Decode(bytes03, plcInfo.plcFault); + } + //OperateResult result2 = ModbusTcpNet.Read("x=3;201", 222); } + } } } \ No newline at end of file diff --git a/Service/Init/Entity/PlcInfo.cs b/Service/Init/Entity/PlcInfo.cs index 7af99c0..242d45f 100644 --- a/Service/Init/Entity/PlcInfo.cs +++ b/Service/Init/Entity/PlcInfo.cs @@ -1,6 +1,9 @@ -using HybirdFrameworkDriver.ModbusTcpMaster; +using DotNetty.Codecs.Mqtt.Packets; +using HybirdFrameworkDriver.ModbusTcpMaster; using HybirdFrameworkDriver.Session; using HybirdFrameworkServices.Plc; +using Newtonsoft.Json.Linq; +using System.Net.NetworkInformation; namespace Service.Init.Entity { @@ -58,6 +61,338 @@ namespace Service.Init.Entity public PlcToHost plcToHost = new PlcToHost(); public PlcFault plcFault = new PlcFault(); + #region + int DataTimeSeconds = 2; + DateTime DataValidityTime = DateTime.Now; + + /// + /// plc是否连接 + /// + public bool Connected { get; set; } + /// + /// plc是否处于远程模式 + /// + public bool RemoteNot + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds) + { + return RemoteNot; + } + else + { + return false; + } + } + set + { + RemoteNot = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读入口雷达是否感应触发 + /// + public bool EntranceRadar + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return EntranceRadar; + } + else + { + return false; + } + } + set + { + EntranceRadar = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读取通道定位状态(拍照是否OK) + /// + public bool ChannelLocationState + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return ChannelLocationState; + } + else + { + return false; + } + } + set + { + ChannelLocationState = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读取plc任务状态电池拆卸中 + /// + public bool BatteryDisassembly + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return BatteryDisassembly; + } + else + { + return false; + } + } + set + { + BatteryDisassembly = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读取plc任务状态电池入库搬运中 + /// + public bool StorageBatteries + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return StorageBatteries; + } + else + { + return false; + } + } + set + { + StorageBatteries = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读取plc任务状态电池出库搬运中 + /// + public bool BatteryDelivery + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return BatteryDelivery; + } + else + { + return false; + } + } + set + { + BatteryDelivery = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读取plc任务状态电池安装中 + /// + public bool BatteryInstallation + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return BatteryInstallation; + } + else + { + return false; + } + } + set + { + BatteryInstallation = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读取plc任务状态电池安装完成 + /// + public bool BatteryInstallationComplete + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return BatteryInstallationComplete; + } + else + { + return false; + } + } + set + { + BatteryInstallationComplete = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 设置出口灯:绿灯(通知车辆可以驶离) + /// + public bool SetExitLightGreen + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return SetExitLightGreen; + } + else + { + return false; + } + } + set + { + SetExitLightGreen = value; + DataValidityTime = DateTime.Now; + } + } + /// + /// 读出口雷达是否感应触发 + /// + public bool ExitRadarSensingTrigger + { + get + { + if ((DateTime.Now - DataValidityTime).Seconds <= 2) + { + return ExitRadarSensingTrigger; + } + else + { + return false; + } + } + set + { + ExitRadarSensingTrigger = value; + DataValidityTime = DateTime.Now; + } + } + + /// + /// 写入口灯绿 + /// + /// + public bool SendLightGreen() + { + bool bResult = false; + if (Connected) + { + hostToPlc.LightIn.Value = 1000; + bResult = WriteUint16(hostToPlc.LightIn); + } + return bResult; + } + + /// + /// 下发选包数据给plc(入仓位 + /// + /// 1:缓存位舱位号 2-20 电池存储舱位 + /// + public bool SendSelectRuleIn(ushort loc) + { + bool bResult = false; + if (Connected) + { + hostToPlc.EntrySelection.Value = loc; + bResult = WriteUint16(hostToPlc.EntrySelection); + } + return bResult; + } + /// + /// 下发选包数据给plc(出仓位 + /// + /// 1:缓存位舱位号 2-20 电池存储舱位 + /// + public bool SendSelectRuleOut(ushort loc) + { + bool bResult = false; + if (Connected) + { + hostToPlc.ExitSelection.Value = loc; + bResult = WriteUint16(hostToPlc.ExitSelection); + } + return bResult; + } + + /// + /// 写入口灯:红灯 + /// + /// + public bool SendLightRed() + { + bool bResult = false; + if (Connected) + { + hostToPlc.LightIn.Value = 1020; + bResult = WriteUint16(hostToPlc.LightIn); + } + return bResult; + } + /// + /// 下发plc开启换电任务 + /// + /// + public bool SendTaskType() + { + bool bResult = false; + if (Connected) + { + hostToPlc.TaskType.Value = 1; + bResult = WriteUint16(hostToPlc.TaskType); + } + return bResult; + } + /// + /// 设置出口灯:绿灯 + /// + /// + public bool SendLightOutGreen() + { + bool bResult = false; + if (Connected) + { + hostToPlc.LightOut.Value = 1000; + bResult = WriteUint16(hostToPlc.LightOut); + } + return bResult; + } + /// + /// 设置出口灯:红灯 + /// + /// + public bool SendLightOutRed() + { + bool bResult = false; + if (Connected) + { + hostToPlc.LightOut.Value = 1020; + bResult = WriteUint16(hostToPlc.LightOut); + } + return bResult; + } + #endregion public PlcInfo(string channelId, int eqmSn) { diff --git a/Service/Init/Entity/ChargerStaticInfo.cs b/Service/Init/Entity/PlcStaticInfo.cs similarity index 88% rename from Service/Init/Entity/ChargerStaticInfo.cs rename to Service/Init/Entity/PlcStaticInfo.cs index 28267db..542caa9 100644 --- a/Service/Init/Entity/ChargerStaticInfo.cs +++ b/Service/Init/Entity/PlcStaticInfo.cs @@ -2,7 +2,7 @@ namespace Service.Init.Entity { - public class ChargerStaticInfo + public class PlcStaticInfo { /// /// PLC管理 diff --git a/Service/Plc/HostToPlc.cs b/Service/Plc/HostToPlc.cs index 88eae77..fa6ba5e 100644 --- a/Service/Plc/HostToPlc.cs +++ b/Service/Plc/HostToPlc.cs @@ -13,75 +13,375 @@ namespace HybirdFrameworkServices.Plc public ModbusProperty ProtocolVersion1 { get; set; } = new(40001); // 协议版本 public ModbusProperty ProtocolVersion2 { get; set; } = new(40002); // 协议版本 public ModbusProperty ProtocolVersion3 { get; set; } = new(40003); // 协议版本 - public ModbusProperty CommunicationDiagnosis { get; set; } = new(40004); // 通讯诊断 - public ModbusProperty ModeControl { get; set; } = new(40005); // 模式控制 - public ModbusProperty EquipmentControl { get; set; } = new(40006); // 设备控制 - public ModbusProperty ExhaustFanControl { get; set; } = new(40007); // 排风扇控制 - public ModbusProperty LightingControl { get; set; } = new(40008); // 灯光控制 + /// + /// 通讯诊断 + /// 站控PC心跳(0、1 跳变) + /// + public ModbusProperty CommunicationDiagnosis { get; set; } = new(40004); // + /// + /// 模式控制 + /// 0:无操作 + /// 1000:自动 + /// 1010:手动 + /// + public ModbusProperty ModeControl { get; set; } = new(40005); // + /// + /// 设备控制 + /// 0:无操作 + /// 1000:复位 + /// 1010:启动 + /// 1020:暂停 + /// 1030:急停 + /// 1050:整站断电 + /// + public ModbusProperty EquipmentControl { get; set; } = new(40006); // + /// + /// 排风扇控制 + /// 0:无操作 + /// 1000:全部打开 + /// 1010:全部关闭 + /// 1020:预留 + /// + public ModbusProperty ExhaustFanControl { get; set; } = new(40007); // + /// + /// 灯光控制 + /// 0:无操作 + /// 1000:全部打开 + /// 1010:全部关闭 + /// + public ModbusProperty LightingControl { get; set; } = new(40008); // + public ModbusProperty Standby1 { get; set; } = new(40009); // 备用 public ModbusProperty Standby2 { get; set; } = new(40010); // 备用 - public ModbusProperty Seconds { get; set; } = new(40011); // 对时时钟:秒 - public ModbusProperty Points { get; set; } = new(40012); // 对时时钟:分 - public ModbusProperty Hour { get; set; } = new(40013); // 对时时钟:时 - public ModbusProperty Day { get; set; } = new(40014); // 对时时钟:天 - public ModbusProperty Month { get; set; } = new(40015); // 对时时钟:月 - public ModbusProperty Years { get; set; } = new(40016); // 对时时钟:年 + /// + /// 对时时钟:秒 + /// + public ModbusProperty Seconds { get; set; } = new(40011); + /// + /// 对时时钟:分 + /// + public ModbusProperty Points { get; set; } = new(40012); + /// + /// 对时时钟:时 + /// + public ModbusProperty Hour { get; set; } = new(40013); + /// + /// 对时时钟:天 + /// + public ModbusProperty Day { get; set; } = new(40014); + /// + /// 对时时钟:月 + /// + public ModbusProperty Month { get; set; } = new(40015); + /// + /// 对时时钟:年 + /// + public ModbusProperty Years { get; set; } = new(40016); public ModbusProperty Standby3 { get; set; } = new(40017, length: 4); // 备用3 - public ModbusProperty ChargingStatus { get; set; } = new(40021, length: 40); // 仓位充电状态 - public ModbusProperty ChargingStatus01 { get; set; } = new(40021); // 仓位充电状态 - public ModbusProperty ChargingStatus02 { get; set; } = new(40022); // 仓位充电状态 - public ModbusProperty ChargingStatus03 { get; set; } = new(40023); // 仓位充电状态 - public ModbusProperty ChargingStatus04 { get; set; } = new(40024); // 仓位充电状态 - public ModbusProperty ChargingStatus05 { get; set; } = new(40025); // 仓位充电状态 - public ModbusProperty ChargingStatus06 { get; set; } = new(40026); // 仓位充电状态 - public ModbusProperty ChargingStatus07 { get; set; } = new(40027); // 仓位充电状态 - public ModbusProperty ChargingStatus08 { get; set; } = new(40028); // 仓位充电状态 - public ModbusProperty ChargingStatus09 { get; set; } = new(40029); // 仓位充电状态 - public ModbusProperty ChargingStatus10 { get; set; } = new(40030); // 仓位充电状态 - public ModbusProperty ChargingStatus11 { get; set; } = new(40031); // 仓位充电状态 - public ModbusProperty ChargingStatus12 { get; set; } = new(40032); // 仓位充电状态 - public ModbusProperty ChargingStatus13 { get; set; } = new(40033); // 仓位充电状态 - public ModbusProperty ChargingStatus14 { get; set; } = new(40034); // 仓位充电状态 - public ModbusProperty ChargingStatus15 { get; set; } = new(40035); // 仓位充电状态 - public ModbusProperty ChargingStatus16 { get; set; } = new(40036); // 仓位充电状态 - public ModbusProperty ChargingStatus17 { get; set; } = new(40037); // 仓位充电状态 - public ModbusProperty ChargingStatus18 { get; set; } = new(40038); // 仓位充电状态 - public ModbusProperty ChargingStatus19 { get; set; } = new(40039); // 仓位充电状态 - public ModbusProperty ChargingStatus20 { get; set; } = new(40040); // 仓位充电状态 - public ModbusProperty BatteryType { get; set; } = new(40061, length: 40); // 仓位所在电池型号 - - public ModbusProperty BatteryType01 { get; set; } = new(40061); // 仓位所在电池型号 - public ModbusProperty BatteryType02 { get; set; } = new(40062); // 仓位所在电池型号 - public ModbusProperty BatteryType03 { get; set; } = new(40063); // 仓位所在电池型号 - public ModbusProperty BatteryType04 { get; set; } = new(40064); // 仓位所在电池型号 - public ModbusProperty BatteryType05 { get; set; } = new(40065); // 仓位所在电池型号 - public ModbusProperty BatteryType06 { get; set; } = new(40066); // 仓位所在电池型号 - public ModbusProperty BatteryType07 { get; set; } = new(40067); // 仓位所在电池型号 - public ModbusProperty BatteryType08 { get; set; } = new(40068); // 仓位所在电池型号 - public ModbusProperty BatteryType09 { get; set; } = new(40069); // 仓位所在电池型号 - public ModbusProperty BatteryType10 { get; set; } = new(40070); // 仓位所在电池型号 - public ModbusProperty BatteryType11 { get; set; } = new(40071); // 仓位所在电池型号 - public ModbusProperty BatteryType12 { get; set; } = new(40072); // 仓位所在电池型号 - public ModbusProperty BatteryType13 { get; set; } = new(40073); // 仓位所在电池型号 - public ModbusProperty BatteryType14 { get; set; } = new(40074); // 仓位所在电池型号 - public ModbusProperty BatteryType15 { get; set; } = new(40075); // 仓位所在电池型号 - public ModbusProperty BatteryType16 { get; set; } = new(40076); // 仓位所在电池型号 - public ModbusProperty BatteryType17 { get; set; } = new(40077); // 仓位所在电池型号 - public ModbusProperty BatteryType18 { get; set; } = new(40078); // 仓位所在电池型号 - public ModbusProperty BatteryType19 { get; set; } = new(40079); // 仓位所在电池型号 - public ModbusProperty BatteryType20 { get; set; } = new(40080); // 仓位所在电池型号 + //public ModbusProperty ChargingStatus { get; set; } = new(40021, length: 40); // 仓位充电状态 + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus01 { get; set; } = new(40021); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus02 { get; set; } = new(40022); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus03 { get; set; } = new(40023); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus04 { get; set; } = new(40024); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus05 { get; set; } = new(40025); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus06 { get; set; } = new(40026); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus07 { get; set; } = new(40027); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus08 { get; set; } = new(40028); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus09 { get; set; } = new(40029); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus10 { get; set; } = new(40030); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus11 { get; set; } = new(40031); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus12 { get; set; } = new(40032); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus13 { get; set; } = new(40033); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus14 { get; set; } = new(40034); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus15 { get; set; } = new(40035); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus16 { get; set; } = new(40036); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus17 { get; set; } = new(40037); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus18 { get; set; } = new(40038); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus19 { get; set; } = new(40039); + /// + /// 仓位充电状态 + /// 0:未知 + /// 1000:空闲 + /// 1010:充电 + /// + public ModbusProperty ChargingStatus20 { get; set; } = new(40040); + //public ModbusProperty BatteryType { get; set; } = new(40061, length: 40); // 仓位所在电池型号 + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType01 { get; set; } = new(40061); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType02 { get; set; } = new(40062); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType03 { get; set; } = new(40063); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType04 { get; set; } = new(40064); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType05 { get; set; } = new(40065); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType06 { get; set; } = new(40066); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType07 { get; set; } = new(40067); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType08 { get; set; } = new(40068); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType09 { get; set; } = new(40069); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType10 { get; set; } = new(40070); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType11 { get; set; } = new(40071); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType12 { get; set; } = new(40072); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType13 { get; set; } = new(40073); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType14 { get; set; } = new(40074); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType15 { get; set; } = new(40075); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType16 { get; set; } = new(40076); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType17 { get; set; } = new(40077); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType18 { get; set; } = new(40078); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType19 { get; set; } = new(40079); + /// + /// 仓位所在电池型号 + /// + public ModbusProperty BatteryType20 { get; set; } = new(40080); - public ModbusProperty VehicleParkingLocation { get; set; } = new(40101); // 车辆驻车位置 - public ModbusProperty VehicleParkingStatus { get; set; } = new(40102); // 车辆驻车状态 - public ModbusProperty LightIn { get; set; } = new(40103); // "三色灯控制整站状态(入口)" - public ModbusProperty LightOut { get; set; } = new(40104); // "三色灯控制整站状态(出口)" - public ModbusProperty StopCommand { get; set; } = new(40105); // 电池包锁止异常,暂停命令 + /// + /// 车辆驻车位置 + /// 0 无效 + /// 2=2#换电位 + /// 3=3#换电位 + /// 4=4#换电位 + /// 5=5#换电位 + /// 6=6#换电位 + /// + public ModbusProperty VehicleParkingLocation { get; set; } = new(40101); + /// + /// 车辆驻车状态 + /// 0=车辆状态未知 + /// 1=车辆运动中 + /// 2=车辆停止、驻停 + /// + public ModbusProperty VehicleParkingStatus { get; set; } = new(40102); + /// + /// 三色灯控制整站状态(入口) + /// 0:无效值 + /// 1000:绿灯 + /// 1010:绿灯闪烁 + /// 1020:红灯 + /// 1030:红灯闪烁 + /// 1040:黄灯 + /// 1050:黄灯闪烁 + /// 1100:所有灯亮 + /// + public ModbusProperty LightIn { get; set; } = new(40103); + /// + /// 三色灯控制整站状态(出口) + /// 0:无效值 + /// 1000:绿灯 + /// 1010:绿灯闪烁 + /// 1020:红灯 + /// 1030:红灯闪烁 + /// 1040:黄灯 + /// 1050:黄灯闪烁 + /// 1100:所有灯亮 + /// + public ModbusProperty LightOut { get; set; } = new(40104); + /// + /// 电池包锁止异常,暂停命令 0:无命令;1000:暂停使能 + /// + public ModbusProperty StopCommand { get; set; } = new(40105); public ModbusProperty Standby4 { get; set; } = new(40106, length: 5); // 备用4 - public ModbusProperty TaskType { get; set; } = new(40111); // 任务类型 - public ModbusProperty EntrySelection { get; set; } = new(40112); // 入仓位选择 - public ModbusProperty ExitSelection { get; set; } = new(40113); // 出仓仓位选择 - public ModbusProperty BatteryPackType { get; set; } = new(40114); // 电池包类型 - public ModbusProperty TaskEnablement { get; set; } = new(40115); // 任务使能 + /// + /// 任务类型 + /// 0.无任务 + /// 1.换电任务 + /// 2.移舱任务 + /// 3.移出任务 + /// 4.移入任务 + /// 5.消防任务 + /// + public ModbusProperty TaskType { get; set; } = new(40111); + /// + /// 入仓位选择 + /// 0:无操作 + /// 范围:1-20 + /// 1:缓存位舱位号 + /// 2-20 电池存储舱位 + /// + public ModbusProperty EntrySelection { get; set; } = new(40112); + /// + /// 出仓仓位选择 + /// 0:无操作 + /// 范围:1-20 + /// 1:缓存位舱位号 + /// 2-20 电池存储舱位 + /// + public ModbusProperty ExitSelection { get; set; } = new(40113); + /// + /// 电池包类型 + /// + public ModbusProperty BatteryPackType { get; set; } = new(40114); + /// + /// 0:无操作 + /// 1000:任务使能 + /// + public ModbusProperty TaskEnablement { get; set; } = new(40115); } } diff --git a/Service/Plc/PlcToHost.cs b/Service/Plc/PlcToHost.cs index 3345a61..1162ee3 100644 --- a/Service/Plc/PlcToHost.cs +++ b/Service/Plc/PlcToHost.cs @@ -17,9 +17,21 @@ namespace HybirdFrameworkServices.Plc public ModbusProperty ProtocolVersion1 { get; set; } = new(40201); // 协议版本 public ModbusProperty ProtocolVersion2 { get; set; } = new(40202); // 协议版本 public ModbusProperty ProtocolVersion3 { get; set; } = new(40203); // 协议版本 - public ModbusProperty CommunicationDiagnosis { get; set; } = new(40204); // 通讯诊断 - public ModbusProperty ModeControl { get; set; } = new(40205); // 模式状态 - public ModbusProperty DeviceSystemStatus { get; set; } = new(40206); // 设备系统状态 + /// + /// 通讯诊断 站控PC心跳(0、1 跳变) + /// + public ModbusProperty CommunicationDiagnosis { get; set; } = new(40204); + /// + /// 模式状态 + /// 0:无效值 + /// 1000:手动模式 + /// 1010:自动模式 + /// + public ModbusProperty ModeControl { get; set; } = new(40205); + /// + /// 设备系统状态 + /// + public ModbusProperty DeviceSystemStatus { get; set; } = new(40206); //public ModbusProperty type00 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT0:复位 //public ModbusProperty type01 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT1:启动 @@ -30,37 +42,297 @@ namespace HybirdFrameworkServices.Plc //public ModbusProperty type06 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT6:自动运行中 //public ModbusProperty type07 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT7:PLC停机报警 //public ModbusProperty type08 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT8:PLC提示预警 - - public ModbusProperty RemoteLocalControlState { get; set; } = new(40207); // 遥本控状态 - public ModbusProperty LightStatus { get; set; } = new(40208); // 灯光状态 - public ModbusProperty ExhaustFanStatus { get; set; } = new(40209); // 排风扇状态 - public ModbusProperty WaterStatusStation { get; set; } = new(40210); // 站内积水状态 - public ModbusProperty value09 { get; set; } = new(40211, length: 30); // 备用 - public ModbusProperty InPosition { get; set; } = new(40241, length: 40); // 在位状态 - public ModbusProperty value11 { get; set; } = new(40281, length: 20); // 备用 - public ModbusProperty CarStatus { get; set; } = new(40301); // 载行车设备状态 + /// + /// 遥本控状态 + /// 0:无效值 + /// 1000:本地控制 + /// 1010:远程控制 + /// + public ModbusProperty RemoteLocalControlState { get; set; } = new(40207); + /// + /// 灯光状态 + /// 0:无状态 + /// 1000:已全部打开 + /// 1010:已全部关闭 + /// + public ModbusProperty LightStatus { get; set; } = new(40208); + /// + /// 排风扇状态 + /// 0:无状态 + /// 1000:已全部打开 + /// 1010:已全部关闭 + /// + public ModbusProperty ExhaustFanStatus { get; set; } = new(40209); + /// + /// 站内积水状态 + /// BIT0:积水预警 + /// BIT1:积水报警 + /// + public ModbusProperty WaterStatusStation { get; set; } = new(40210); + /// + /// 备用 + /// + public ModbusProperty value09 { get; set; } = new(40211, length: 30); + /// + /// 在位状态 + /// + public ModbusProperty InPosition { get; set; } = new(40241, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition01 { get; set; } = new(40241, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition02 { get; set; } = new(40242, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition03 { get; set; } = new(40243, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition04 { get; set; } = new(40244, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition05 { get; set; } = new(40245, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition06 { get; set; } = new(40246, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition07 { get; set; } = new(40247, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition08 { get; set; } = new(40248, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition09 { get; set; } = new(40249, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition10 { get; set; } = new(40250, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition11 { get; set; } = new(40251, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition12 { get; set; } = new(40252, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition13 { get; set; } = new(40253, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition14 { get; set; } = new(40254, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition15 { get; set; } = new(40255, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition16 { get; set; } = new(40256, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition17 { get; set; } = new(40257, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition18 { get; set; } = new(40258, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition19 { get; set; } = new(40259, length: 40); + /// + /// 在位状态 + /// Bit0:有料检测 + /// Bit1:有料检测开关故障" + /// + public ModbusProperty InPosition20 { get; set; } = new(40260, length: 40); + /// + /// 备用 + /// + public ModbusProperty value11 { get; set; } = new(40281, length: 20); + /// + /// 载行车设备状态 + /// 0:无效值 + /// 1000:待机中 + /// 1001:定位识别中 + /// 1100:取电池中 + /// 1101:取电池完成 + /// 1102:取电池动作故障 + /// 1200:放电池中 + /// 1201:放电池完成 + /// 1202:放电池动作故障 + /// + public ModbusProperty CarStatus { get; set; } = new(40301); public ModbusProperty value13 { get; set; } = new(40302); // 备用 public ModbusProperty value14 { get; set; } = new(40303); // 备用 public ModbusProperty value15 { get; set; } = new(40304); // 备用 public ModbusProperty value16 { get; set; } = new(40305); // 备用 - public ModbusProperty PercentageTorqueX { get; set; } = new(40306); // x轴扭矩百分比 - public ModbusProperty PercentageTorqueY { get; set; } = new(40307); // y轴扭矩百分比 - public ModbusProperty PercentageTorqueZ { get; set; } = new(40308); // z轴扭矩百分比 + /// + /// x轴扭矩百分比 + /// + public ModbusProperty PercentageTorqueX { get; set; } = new(40306); + /// + /// y轴扭矩百分比 + /// + public ModbusProperty PercentageTorqueY { get; set; } = new(40307); + /// + /// z轴扭矩百分比 + /// + public ModbusProperty PercentageTorqueZ { get; set; } = new(40308); public ModbusProperty value20 { get; set; } = new(40309, length: 92); // 备用 - public ModbusProperty RadarStatesIn{ get; set; } = new(40401); // " 入口雷达状态" - public ModbusProperty RadarStatesOut { get; set; } = new(40402); // " 出口雷达状态" - public ModbusProperty SpotPhotoelectricSignal { get; set; } = new(40403); // 到位光电信号 - public ModbusProperty PhysicalButtonState { get; set; } = new(40404); // 实体按钮状态 - public ModbusProperty LightIn { get; set; } = new(40405); // "三色灯控制通道状态(入口)" - public ModbusProperty LightOut { get; set; } = new(40406); // "三色灯控制通道状态(出口)" - public ModbusProperty TaskType { get; set; } = new(40407); // "任务类型状态(是否允许允许执行任务)" - public ModbusProperty TaskStates { get; set; } = new(40408); // 任务状态 - public ModbusProperty OperationalTrainNumber { get; set; } = new(40409); // 执行任务行车号 - public ModbusProperty ChannelLocationState { get; set; } = new(40410); // 通道定位状态 - public ModbusProperty DeviationX { get; set; } = new(40411); // x偏差 - public ModbusProperty DeviationY { get; set; } = new(40412); // y偏差 - public ModbusProperty DeviationZ { get; set; } = new(40413); // z偏差 + /// + /// 入口雷达状态 + /// 0:未触发 + /// 1000:感应触发 + /// + public ModbusProperty RadarStatesIn { get; set; } = new(40401); + /// + /// 出口雷达状态 + /// 0:未触发 + /// 1000:感应触发 + /// + public ModbusProperty RadarStatesOut { get; set; } = new(40402); + /// + /// 到位光电信号 + /// 1000:到位 + /// 其它值:未到位 + /// + public ModbusProperty SpotPhotoelectricSignal { get; set; } = new(40403); + /// + /// 实体按钮状态 + /// 0:无状态 + /// 1000:已拍按钮 + /// + public ModbusProperty PhysicalButtonState { get; set; } = new(40404); + /// + /// 三色灯控制通道状态(入口) + /// 0:无颜色 + /// 1000:绿灯 + /// 1010:绿灯闪烁 + /// 1020:红灯 + /// 1030:红灯闪烁 + /// 1040:黄灯 + /// 1050:黄灯闪烁 + /// 1100:所有灯亮 + /// + public ModbusProperty LightIn { get; set; } = new(40405); + /// + /// 三色灯控制通道状态(出口) + /// 0:无颜色 + /// 1000:绿灯 + /// 1010:绿灯闪烁 + /// 1020:红灯 + /// 1030:红灯闪烁 + /// 1040:黄灯 + /// 1050:黄灯闪烁 + /// 1100:所有灯亮 + /// + public ModbusProperty LightOut { get; set; } = new(40406); + /// + /// 任务类型状态(是否允许允许执行任务) + /// 0.无任务 (不允许换电) + /// 1.换电任务 + /// 2.移舱任务 + /// 3.移出任务 + /// 4.移入任务 + /// 5.消防任务 + /// + public ModbusProperty TaskType { get; set; } = new(40407); + /// + /// 任务状态 + /// 0:无效值 + /// 1000:准备中(Not Ready) + /// 1001:待机中(Ready) + /// 1002:电池拆卸中 + /// 1003:电池入库搬运中 + /// 1004:电池出库搬运中 + /// 1005:电池安装中 + /// 1006:电池安装完成 + /// 1007:航车回归至安全位置 + /// 1008: 缓存-放仓位, 移仓状态 + /// 1100:消防任务 执行中 + /// 1101:消防任务 出现异常 + /// 1200:移仓任务 执行中 + /// 1201:移仓任务 出现异常 + /// 9000:任务完成 + /// + public ModbusProperty TaskStates { get; set; } = new(40408); + /// + /// 执行任务行车号 + /// + public ModbusProperty OperationalTrainNumber { get; set; } = new(40409); + /// + /// 通道定位状态 + /// 0:无效值 + /// 1000;拍照OK + /// 1010;拍照NG + /// 1020;拍照超限,请移车 + /// + public ModbusProperty ChannelLocationState { get; set; } = new(40410); + /// + /// x偏差 + /// + public ModbusProperty DeviationX { get; set; } = new(40411); + /// + /// y偏差 + /// + public ModbusProperty DeviationY { get; set; } = new(40412); + /// + /// z偏差 + /// + public ModbusProperty DeviationZ { get; set; } = new(40413); public ModbusProperty value44 { get; set; } = new(40414, length: 7); // 备用 diff --git a/WinFormStarter/FrmPlc.cs b/WinFormStarter/FrmPlc.cs index 105783f..ef90ab6 100644 --- a/WinFormStarter/FrmPlc.cs +++ b/WinFormStarter/FrmPlc.cs @@ -36,7 +36,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -54,7 +54,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -72,7 +72,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -90,7 +90,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -108,7 +108,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -126,7 +126,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -144,7 +144,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -162,7 +162,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -180,7 +180,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -198,7 +198,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -216,7 +216,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -239,7 +239,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -257,7 +257,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -280,7 +280,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -298,7 +298,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -320,7 +320,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -338,7 +338,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -360,7 +360,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -378,7 +378,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -396,7 +396,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -414,7 +414,7 @@ namespace WinFormStarter MessageBox.Show("请输入有效值"); return; } - ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo); if (plcInfo == null) { MessageBox.Show("PLC未连接"); @@ -430,7 +430,7 @@ namespace WinFormStarter bool bConvert2 = short.TryParse(this.txtValue02.Text, out short iValue2); bool bConvert3 = short.TryParse(this.txtValue03.Text, out short iValue3); - ChargerStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo); if (plcInfo != null) { HostToPlc hostToPlc = new HostToPlc(); @@ -450,7 +450,7 @@ namespace WinFormStarter /// private void BtnCollectionAssignment_Click(object sender, EventArgs e) { - ChargerStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo); + PlcStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo); if (plcInfo != null) { lblValue01.Text = plcInfo.plcToHost.ProtocolVersion1.Value + "." + diff --git a/WinFormStarter/bin/Debug/net6.0-windows/SqlSugar.dll b/WinFormStarter/bin/Debug/net6.0-windows/SqlSugar.dll index d892921..5946740 100644 Binary files a/WinFormStarter/bin/Debug/net6.0-windows/SqlSugar.dll and b/WinFormStarter/bin/Debug/net6.0-windows/SqlSugar.dll differ diff --git a/WinFormStarter/bin/Debug/net6.0-windows/WinFormStarter.runtimeconfig.json b/WinFormStarter/bin/Debug/net6.0-windows/WinFormStarter.runtimeconfig.json index f9988b2..42dbb6d 100644 --- a/WinFormStarter/bin/Debug/net6.0-windows/WinFormStarter.runtimeconfig.json +++ b/WinFormStarter/bin/Debug/net6.0-windows/WinFormStarter.runtimeconfig.json @@ -9,6 +9,10 @@ { "name": "Microsoft.WindowsDesktop.App", "version": "6.0.0" + }, + { + "name": "Microsoft.AspNetCore.App", + "version": "6.0.0" } ] } diff --git a/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.deps.json b/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.deps.json index 2653014..9fefc19 100644 --- a/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.deps.json +++ b/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.deps.json @@ -29,6 +29,17 @@ } } }, + "AutoMapper/12.0.1": { + "dependencies": { + "Microsoft.CSharp": "4.7.0" + }, + "runtime": { + "lib/netstandard2.1/AutoMapper.dll": { + "assemblyVersion": "12.0.0.0", + "fileVersion": "12.0.1.0" + } + } + }, "DotNetty.Buffers/0.7.5": { "dependencies": { "DotNetty.Common": "0.7.5", @@ -130,7 +141,7 @@ } } }, - "Microsoft.CSharp/4.5.0": {}, + "Microsoft.CSharp/4.7.0": {}, "Microsoft.Data.SqlClient/2.1.4": { "dependencies": { "Microsoft.Data.SqlClient.SNI.runtime": "2.1.1", @@ -206,6 +217,7 @@ } } }, + "Microsoft.Extensions.ApiDescription.Server/6.0.5": {}, "Microsoft.Extensions.Configuration/7.0.0": { "dependencies": { "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", @@ -408,7 +420,7 @@ }, "Microsoft.IdentityModel.Tokens/6.8.0": { "dependencies": { - "Microsoft.CSharp": "4.5.0", + "Microsoft.CSharp": "4.7.0", "Microsoft.IdentityModel.Logging": "6.8.0", "System.Security.Cryptography.Cng": "4.5.0" }, @@ -421,6 +433,14 @@ }, "Microsoft.NETCore.Platforms/5.0.0": {}, "Microsoft.NETCore.Targets/1.1.0": {}, + "Microsoft.OpenApi/1.2.3": { + "runtime": { + "lib/netstandard2.0/Microsoft.OpenApi.dll": { + "assemblyVersion": "1.2.3.0", + "fileVersion": "1.2.3.0" + } + } + }, "Microsoft.Win32.Registry/4.7.0": { "dependencies": { "System.Security.AccessControl": "6.0.0", @@ -723,7 +743,7 @@ } } }, - "SqlSugarCore/5.1.4.95": { + "SqlSugarCore/5.1.4.115": { "dependencies": { "Microsoft.Data.SqlClient": "2.1.4", "Microsoft.Data.Sqlite": "7.0.5", @@ -738,8 +758,8 @@ }, "runtime": { "lib/netstandard2.1/SqlSugar.dll": { - "assemblyVersion": "5.1.4.94", - "fileVersion": "5.1.4.94" + "assemblyVersion": "5.1.4.115", + "fileVersion": "5.1.4.115" } } }, @@ -774,6 +794,44 @@ } } }, + "Swashbuckle.AspNetCore/6.5.0": { + "dependencies": { + "Microsoft.Extensions.ApiDescription.Server": "6.0.5", + "Swashbuckle.AspNetCore.Swagger": "6.5.0", + "Swashbuckle.AspNetCore.SwaggerGen": "6.5.0", + "Swashbuckle.AspNetCore.SwaggerUI": "6.5.0" + } + }, + "Swashbuckle.AspNetCore.Swagger/6.5.0": { + "dependencies": { + "Microsoft.OpenApi": "1.2.3" + }, + "runtime": { + "lib/net6.0/Swashbuckle.AspNetCore.Swagger.dll": { + "assemblyVersion": "6.5.0.0", + "fileVersion": "6.5.0.0" + } + } + }, + "Swashbuckle.AspNetCore.SwaggerGen/6.5.0": { + "dependencies": { + "Swashbuckle.AspNetCore.Swagger": "6.5.0" + }, + "runtime": { + "lib/net6.0/Swashbuckle.AspNetCore.SwaggerGen.dll": { + "assemblyVersion": "6.5.0.0", + "fileVersion": "6.5.0.0" + } + } + }, + "Swashbuckle.AspNetCore.SwaggerUI/6.5.0": { + "runtime": { + "lib/net6.0/Swashbuckle.AspNetCore.SwaggerUI.dll": { + "assemblyVersion": "6.5.0.0", + "fileVersion": "6.5.0.0" + } + } + }, "System.Collections/4.3.0": { "dependencies": { "Microsoft.NETCore.Platforms": "5.0.0", @@ -1286,6 +1344,13 @@ "path": "autofac.extensions.dependencyinjection/8.0.0", "hashPath": "autofac.extensions.dependencyinjection.8.0.0.nupkg.sha512" }, + "AutoMapper/12.0.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-hvV62vl6Hp/WfQ24yzo3Co9+OPl8wH8hApwVtgWpiAynVJkUcs7xvehnSftawL8Pe8FrPffBRM3hwzLQqWDNjA==", + "path": "automapper/12.0.1", + "hashPath": "automapper.12.0.1.nupkg.sha512" + }, "DotNetty.Buffers/0.7.5": { "type": "package", "serviceable": true, @@ -1342,12 +1407,12 @@ "path": "log4net/2.0.15", "hashPath": "log4net.2.0.15.nupkg.sha512" }, - "Microsoft.CSharp/4.5.0": { + "Microsoft.CSharp/4.7.0": { "type": "package", "serviceable": true, - "sha512": "sha512-kaj6Wb4qoMuH3HySFJhxwQfe8R/sJsNJnANrvv8WdFPMoNbKY5htfNscv+LHCu5ipz+49m2e+WQXpLXr9XYemQ==", - "path": "microsoft.csharp/4.5.0", - "hashPath": "microsoft.csharp.4.5.0.nupkg.sha512" + "sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", + "path": "microsoft.csharp/4.7.0", + "hashPath": "microsoft.csharp.4.7.0.nupkg.sha512" }, "Microsoft.Data.SqlClient/2.1.4": { "type": "package", @@ -1377,6 +1442,13 @@ "path": "microsoft.data.sqlite.core/7.0.5", "hashPath": "microsoft.data.sqlite.core.7.0.5.nupkg.sha512" }, + "Microsoft.Extensions.ApiDescription.Server/6.0.5": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Ckb5EDBUNJdFWyajfXzUIMRkhf52fHZOQuuZg/oiu8y7zDCVwD0iHhew6MnThjHmevanpxL3f5ci2TtHQEN6bw==", + "path": "microsoft.extensions.apidescription.server/6.0.5", + "hashPath": "microsoft.extensions.apidescription.server.6.0.5.nupkg.sha512" + }, "Microsoft.Extensions.Configuration/7.0.0": { "type": "package", "serviceable": true, @@ -1524,6 +1596,13 @@ "path": "microsoft.netcore.targets/1.1.0", "hashPath": "microsoft.netcore.targets.1.1.0.nupkg.sha512" }, + "Microsoft.OpenApi/1.2.3": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Nug3rO+7Kl5/SBAadzSMAVgqDlfGjJZ0GenQrLywJ84XGKO0uRqkunz5Wyl0SDwcR71bAATXvSdbdzPrYRYKGw==", + "path": "microsoft.openapi/1.2.3", + "hashPath": "microsoft.openapi.1.2.3.nupkg.sha512" + }, "Microsoft.Win32.Registry/4.7.0": { "type": "package", "serviceable": true, @@ -1643,12 +1722,12 @@ "path": "sqlsugar.ioc/2.0.0", "hashPath": "sqlsugar.ioc.2.0.0.nupkg.sha512" }, - "SqlSugarCore/5.1.4.95": { + "SqlSugarCore/5.1.4.115": { "type": "package", "serviceable": true, - "sha512": "sha512-7+xQXOZhe0dHplO6AJC3V9VAcO7XPhprrgpjMsrj+LUUJ/k1yVrbag8vHVFZyPyC3PfvHTcpJsepuTJMruUPEw==", - "path": "sqlsugarcore/5.1.4.95", - "hashPath": "sqlsugarcore.5.1.4.95.nupkg.sha512" + "sha512": "sha512-D/1b4vxR0rECaRsIDqk3tkkAwf7wEEkO1+VAAnHLECu5mbPESS6T5o+l/DCDvdWDgD0koCHgKhlU1c/SYR9Sig==", + "path": "sqlsugarcore/5.1.4.115", + "hashPath": "sqlsugarcore.5.1.4.115.nupkg.sha512" }, "SqlSugarCore.Dm/1.2.0": { "type": "package", @@ -1671,6 +1750,34 @@ "path": "stackexchange.redis/2.7.33", "hashPath": "stackexchange.redis.2.7.33.nupkg.sha512" }, + "Swashbuckle.AspNetCore/6.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-FK05XokgjgwlCI6wCT+D4/abtQkL1X1/B9Oas6uIwHFmYrIO9WUD5aLC9IzMs9GnHfUXOtXZ2S43gN1mhs5+aA==", + "path": "swashbuckle.aspnetcore/6.5.0", + "hashPath": "swashbuckle.aspnetcore.6.5.0.nupkg.sha512" + }, + "Swashbuckle.AspNetCore.Swagger/6.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-XWmCmqyFmoItXKFsQSwQbEAsjDKcxlNf1l+/Ki42hcb6LjKL8m5Db69OTvz5vLonMSRntYO1XLqz0OP+n3vKnA==", + "path": "swashbuckle.aspnetcore.swagger/6.5.0", + "hashPath": "swashbuckle.aspnetcore.swagger.6.5.0.nupkg.sha512" + }, + "Swashbuckle.AspNetCore.SwaggerGen/6.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-Y/qW8Qdg9OEs7V013tt+94OdPxbRdbhcEbw4NiwGvf4YBcfhL/y7qp/Mjv/cENsQ2L3NqJ2AOu94weBy/h4KvA==", + "path": "swashbuckle.aspnetcore.swaggergen/6.5.0", + "hashPath": "swashbuckle.aspnetcore.swaggergen.6.5.0.nupkg.sha512" + }, + "Swashbuckle.AspNetCore.SwaggerUI/6.5.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OvbvxX+wL8skxTBttcBsVxdh73Fag4xwqEU2edh4JMn7Ws/xJHnY/JB1e9RoCb6XpDxUF3hD9A0Z1lEUx40Pfw==", + "path": "swashbuckle.aspnetcore.swaggerui/6.5.0", + "hashPath": "swashbuckle.aspnetcore.swaggerui.6.5.0.nupkg.sha512" + }, "System.Collections/4.3.0": { "type": "package", "serviceable": true, diff --git a/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.runtimeconfig.json b/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.runtimeconfig.json index 1749421..d29738c 100644 --- a/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.runtimeconfig.json +++ b/WinFormStarter/obj/Debug/net6.0-windows/WinFormStarter.designer.runtimeconfig.json @@ -9,6 +9,10 @@ { "name": "Microsoft.WindowsDesktop.App", "version": "6.0.0" + }, + { + "name": "Microsoft.AspNetCore.App", + "version": "6.0.0" } ], "additionalProbingPaths": [