修改plc代码,调整代码结构和plc初始化,修改仓位在位状态的定义和使用,增加了仓位状态入库的逻辑

master
smartwyy 6 months ago
parent f5accdfb73
commit 1d1eb53b10

@ -1,7 +1,4 @@
using System;
using System.Linq;
using System.Text;
using SqlSugar;
using SqlSugar;
namespace Entity.DbModel.Station
{
@ -11,201 +8,200 @@ namespace Entity.DbModel.Station
[SugarTable("bin_info")]
public partial class BinInfo
{
public BinInfo(){
}
/// <summary>
/// Desc:id
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true,ColumnName="id")]
public int Id {get;set;}
/// <summary>
/// Desc:仓位编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="no")]
public string No {get;set;}
/// <summary>
/// Desc:仓位编码
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="code")]
public string Code {get;set;}
/// <summary>
/// Desc:仓位名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="name")]
public string Name {get;set;}
/// <summary>
/// Desc:在位状态0-不在位1-在位2-无效
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="exists")]
public int? Exists {get;set;}
/// <summary>
/// Desc:电池编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="battery_no")]
public string BatteryNo {get;set;}
/// <summary>
/// Desc:充电机编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="charger_no")]
public string ChargerNo {get;set;}
/// <summary>
/// Desc:充电枪编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="charger_gun_no")]
public string ChargerGunNo {get;set;}
/// <summary>
/// Desc:水冷编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="water_cool_no")]
public string WaterCoolNo {get;set;}
/// <summary>
/// Desc:是否有电插头;0-无电插头1-有电插头
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="elec_plugin_flag")]
public int? ElecPluginFlag {get;set;}
/// <summary>
/// Desc:电插头状态;0-未知1-已经连接2-未连接
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="elec_plugin_status")]
public string ElecPluginStatus {get;set;}
/// <summary>
/// Desc:是否有水插头;0-无水插头1-有水插头
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName="water_plugin_flag")]
public string WaterPluginFlag {get;set;}
/// <summary>
/// Desc:预约锁定;0-未锁定1-锁定
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="amt_lock")]
public int AmtLock {get;set;}
/// <summary>
/// Desc:soc
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="soc")]
public decimal? Soc {get;set;}
/// <summary>
/// Desc:soe
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="soe")]
public decimal? Soe {get;set;}
/// <summary>
/// Desc:soh
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="soh")]
public decimal? Soh {get;set;}
/// <summary>
/// Desc:电池入仓顺序
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="battery_enter_seq")]
public int? BatteryEnterSeq {get;set;}
/// <summary>
/// Desc:充电状态;0-未知1-正在充电2-无电池3-禁用
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="charge_status")]
public int? ChargeStatus {get;set;}
/// <summary>
/// Desc:仓位状态;0-禁用1-启用
/// Default:1
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="status")]
public int? Status {get;set;}
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="created_by")]
public string CreatedBy {get;set;}
/// <summary>
/// Desc:创建时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="created_time")]
public DateTime? CreatedTime {get;set;}
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="updated_by")]
public string UpdatedBy {get;set;}
/// <summary>
/// Desc:最后结束充电时间 结束充电后更新
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="last_charge_finish_time")]
public DateTime? LastChargeFinishTime {get;set;}
/// <summary>
/// Desc:更新时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName="updated_time")]
public DateTime? UpdatedTime {get;set;}
public BinInfo()
{
}
/// <summary>
/// Desc:id
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
public int Id { get; set; }
/// <summary>
/// Desc:仓位编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "no")]
public string No { get; set; }
/// <summary>
/// Desc:仓位编码
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "code")]
public string Code { get; set; }
/// <summary>
/// Desc:仓位名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "name")]
public string Name { get; set; }
/// <summary>
/// Desc:在位状态0-不在位1-在位2-无效
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "exists")]
public int Exists { get; set; }
/// <summary>
/// Desc:电池编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "battery_no")]
public string BatteryNo { get; set; }
/// <summary>
/// Desc:充电机编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "charger_no")]
public string ChargerNo { get; set; }
/// <summary>
/// Desc:充电枪编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "charger_gun_no")]
public string ChargerGunNo { get; set; }
/// <summary>
/// Desc:水冷编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "water_cool_no")]
public string WaterCoolNo { get; set; }
/// <summary>
/// Desc:是否有电插头;0-无电插头1-有电插头
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "elec_plugin_flag")]
public int? ElecPluginFlag { get; set; }
/// <summary>
/// Desc:电插头状态;0-未知1-已经连接2-未连接
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "elec_plugin_status")]
public string ElecPluginStatus { get; set; }
/// <summary>
/// Desc:是否有水插头;0-无水插头1-有水插头
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "water_plugin_flag")]
public string WaterPluginFlag { get; set; }
/// <summary>
/// Desc:预约锁定;0-未锁定1-锁定
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "amt_lock")]
public int AmtLock { get; set; }
/// <summary>
/// Desc:soc
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "soc")]
public decimal? Soc { get; set; }
/// <summary>
/// Desc:soe
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "soe")]
public decimal? Soe { get; set; }
/// <summary>
/// Desc:soh
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "soh")]
public decimal? Soh { get; set; }
/// <summary>
/// Desc:电池入仓顺序
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "battery_enter_seq")]
public int? BatteryEnterSeq { get; set; }
/// <summary>
/// Desc:充电状态;0-未知1-正在充电2-无电池3-禁用
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "charge_status")]
public int? ChargeStatus { get; set; }
/// <summary>
/// Desc:仓位状态;0-禁用1-启用
/// Default:1
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "status")]
public int? Status { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_by")]
public string CreatedBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "created_time")]
public DateTime? CreatedTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_by")]
public string UpdatedBy { get; set; }
/// <summary>
/// Desc:最后结束充电时间 结束充电后更新
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "last_charge_finish_time")]
public DateTime? LastChargeFinishTime { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "updated_time")]
public DateTime? UpdatedTime { get; set; }
}
}

@ -4,7 +4,11 @@ public class ScopeAttribute : System.Attribute
{
public readonly string Scope;
public ScopeAttribute(string scope)
/// <summary>
/// 向容器注入bean默认单例模式
/// </summary>
/// <param name="scope"></param>
public ScopeAttribute(string scope = "SingleInstance")
{
Scope = scope;
}

@ -12,7 +12,7 @@ public class ModbusTcpMaster
private static readonly ILog Log = LogManager.GetLogger(typeof(ModbusTcpMaster));
private ModbusTcpNet ModbusTcpNet;
private ModbusTcpNet? ModbusTcpNet;
public string Ip { get; set; } = "127.0.0.1";
@ -23,6 +23,11 @@ public class ModbusTcpMaster
public int Duration { get; set; } = 1000;
public bool Connected { get; set; }
/// <summary>
/// 自动重连开关
/// </summary>
public bool AutoReConnect { get; set; }
public string connectId { get; set; }
public MyReadAction? ReadAction { get; set; }
@ -36,8 +41,8 @@ public class ModbusTcpMaster
public bool Connect()
{
Thread.Sleep(Duration);
GetLog().Info($"begin to connect {Ip}:{Port}");
try
{
if (ModbusTcpNet == null)
@ -55,12 +60,20 @@ public class ModbusTcpMaster
else
{
GetLog().Info($"connect {Ip}:{Port} failed {result.Message}");
if (AutoReConnect)
{
return Connect();
}
}
}
}
catch (Exception e)
{
GetLog().Error($"connect {Ip}:{Port} exception {e.Message}");
if (AutoReConnect)
{
return Connect();
}
}
return Connected;

@ -1,5 +1,4 @@
using System.Linq.Expressions;
using Entity.Base;
using Entity.Dto.Req;
using HybirdFrameworkCore.Entity;
using SqlSugar;
@ -915,6 +914,12 @@ public abstract class BaseRepository<T> where T : class, new()
.AnyAsync(expression);
}
public int Update(Expression<Func<T, bool>> columns,
Expression<Func<T, bool>> expression)
{
return DbBaseClient.Updateable<T>().SetColumns(columns).Where(expression).ExecuteCommand();
}
public async Task<int> UpdateAsync(
Expression<Func<T, bool>> columns,

@ -1,100 +0,0 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkDriver.Session;
using HybirdFrameworkServices.Plc;
using Newtonsoft.Json.Linq;
using Service.Execute.Api;
using Service.Init.Entity;
using Service.Plc;
namespace Service
{
[Scope("SingleInstance")]
public class EquipmentInit
{
/// <summary>
/// 连接所有数据
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
public void Connect()
{
ConnectPlc();
}
/// <summary>
/// 连接PLC
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public int ConnectPlc()
{
Thread thread = new Thread(() => ConnectPlcAsync());
thread.Start();
return 0;
}
/// <summary>
/// 连接PLC
/// </summary>
private void ConnectPlcAsync()
{
bool connected = false;
ModbusTcpMaster master = null;
//PLC连接
while (!connected)
{
master = new ModbusTcpMaster()
{
Ip = "172.0.20.66",
Port = 502,
};
master.ReadAction = BatchReadPlc; //启动线程一直读
master.Duration = 3000;
connected = master.Connect();
if (connected)
{
PlcMgr.ModbusTcpMaster = master;
break;
}
Thread.Sleep(5000);
}
}
/**
*
*/
private static void BatchReadPlc(ModbusTcpMaster master)
{
if (PlcMgr.ModbusTcpMaster!=null)
{
var bytes01 = master.BatchReadHolderRegister(1, 115);
if (bytes01 != null)
{
PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<HostToPlc>(bytes01, PlcMgr.HostToPlcData);
}
var bytes02 = master.BatchReadHolderRegister(201, 222);
if (bytes02 != null)
{
PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData);
}
var bytes03 = master.BatchReadHolderRegister(701, 10);
if (bytes03 != null)
{
PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<PlcFault>(bytes03, PlcMgr.PlcFaultData);
}
//OperateResult<byte[]> result2 = ModbusTcpNet.Read("x=3;201", 222);
}
}
}
}

@ -1,9 +1,9 @@
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkServices.Plc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Service.Cloud.Msg.Cloud.Req;
using Service.Init.Entity;
using Service.Plc;
using Service.Plc.Client;
namespace Service.Execute.Api;

@ -1,11 +1,11 @@
using DotNetty.Codecs.Mqtt.Packets;
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkDriver.Session;
using HybirdFrameworkServices.Plc;
using Newtonsoft.Json.Linq;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Pipelines.Sockets.Unofficial.Arenas;
using System.Net.NetworkInformation;
using Service.Plc.Msg;
namespace Service.Init.Entity
{

@ -0,0 +1,57 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using Repository.Station;
using Service.Plc.Msg;
namespace Service.Plc.Client;
/// <summary>
///
/// </summary>
[Scope]
public class PlcClient : ModbusTcpMaster
{
private BinInfoRepository _binInfoRepository;
public PlcClient(BinInfoRepository binInfoRepository)
{
ReadAction = BatchRead;
Ip = "172.0.20.66";
Port = 502;
Duration = 2000;
AutoReConnect = true;
_binInfoRepository = binInfoRepository;
}
private void BatchRead(ModbusTcpMaster master)
{
var bytes01 = master.BatchReadHolderRegister(1, 115);
if (bytes01 != null)
{
PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<HostToPlc>(bytes01, PlcMgr.HostToPlcData);
}
var bytes02 = master.BatchReadHolderRegister(201, 222);
if (bytes02 != null)
{
PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData);
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value, it => it.No == "1");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec02.Value, it => it.No == "2");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec03.Value, it => it.No == "3");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec04.Value, it => it.No == "4");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec05.Value, it => it.No == "5");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec06.Value, it => it.No == "6");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec07.Value, it => it.No == "7");
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec08.Value, it => it.No == "8");
}
var bytes03 = master.BatchReadHolderRegister(701, 10);
if (bytes03 != null)
{
PlcMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<PlcFault>(bytes03, PlcMgr.PlcFaultData);
}
}
}

@ -1,11 +1,12 @@
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkServices.Plc;
using Autofac;
using HybirdFrameworkCore.Autofac;
using Service.Plc.Msg;
namespace Service.Plc;
namespace Service.Plc.Client;
public abstract class PlcMgr
public class PlcMgr
{
public static ModbusTcpMaster ModbusTcpMaster;
public static PlcClient? PlcClient;
public static readonly HostToPlc HostToPlcData = new HostToPlc();
public static readonly PlcToHost PlcToHostData = new PlcToHost();
public static readonly PlcFault PlcFaultData = new PlcFault();
@ -14,28 +15,38 @@ public abstract class PlcMgr
/// <summary>
/// 数据有效时间。单位秒
/// </summary>
static int DataTimeSeconds = 2;
static int DataTimeSeconds = 3;
/// <summary>
/// 数据刷新时间
/// </summary>
public static DateTime DataValidityTime = DateTime.Now;
public static bool Init()
{
if (PlcClient == null)
{
PlcClient = AppInfo.Container.Resolve<PlcClient>();
}
return PlcClient.Connect();
}
/// <summary>
/// 写入口灯
/// 红灯1020
/// 绿灯1000
/// </summary>
/// <param name="data"></param>
/// <param name="value"></param>
/// <returns></returns>
public static bool WriteEntranceLamp(byte value)
{
if (ModbusTcpMaster != null)
if (PlcClient != null)
{
HostToPlcData.LightIn.Value = value;
return ModbusTcpMaster.WriteValue(HostToPlcData.LightIn);
return PlcClient.WriteValue(HostToPlcData.LightIn);
}
return false;
}
@ -96,12 +107,13 @@ public abstract class PlcMgr
/// <returns></returns>
public static bool WriteExistLamp(int data)
{
if (ModbusTcpMaster != null)
if (PlcClient != null)
{
HostToPlc writeHostToPlc = new HostToPlc();
writeHostToPlc.LightOut.Value = (ushort)data;
return ModbusTcpMaster.WriteValue(writeHostToPlc.LightIn);
return PlcClient.WriteValue(writeHostToPlc.LightIn);
}
return false;
}
@ -113,15 +125,16 @@ public abstract class PlcMgr
/// <returns></returns>
public static bool DistributeSelectPack(string inBinNo, string outBinNo)
{
if (ModbusTcpMaster != null)
if (PlcClient != null)
{
HostToPlc writeHostToPlc = new HostToPlc();
writeHostToPlc.EntrySelection.Value = Convert.ToUInt16(inBinNo);
writeHostToPlc.ExitSelection.Value = Convert.ToUInt16(outBinNo);
bool write1 = ModbusTcpMaster.WriteValue(writeHostToPlc.EntrySelection);
bool write2 = ModbusTcpMaster.WriteValue(writeHostToPlc.ExitSelection);
bool write1 = PlcClient.WriteValue(writeHostToPlc.EntrySelection);
bool write2 = PlcClient.WriteValue(writeHostToPlc.ExitSelection);
return write1 && write2;
}
return false;
}
@ -132,18 +145,19 @@ public abstract class PlcMgr
/// <returns></returns>
public static bool StartSwapping()
{
if (ModbusTcpMaster != null)
if (PlcClient != null)
{
if (PlcToHostData.TaskType.Value == 0)//是否允许换电
if (PlcToHostData.TaskType.Value == 0) //是否允许换电
return false;
HostToPlc writeHostToPlc = new HostToPlc();
writeHostToPlc.TaskType.Value = (ushort)1;
writeHostToPlc.TaskEnablement.Value = (ushort)1000;
bool write1 = ModbusTcpMaster.WriteValue(writeHostToPlc.TaskType);
bool write2 = ModbusTcpMaster.WriteValue(writeHostToPlc.TaskEnablement);
bool write1 = PlcClient.WriteValue(writeHostToPlc.TaskType);
bool write2 = PlcClient.WriteValue(writeHostToPlc.TaskEnablement);
return write1 && write2;
}
return false;
}
@ -163,10 +177,11 @@ public abstract class PlcMgr
/// <returns>6未连接</returns>
public static int ReadPlcTaskStatus()
{
if (ModbusTcpMaster != null)
if (PlcClient != null)
{
return PlcToHostData.TaskType.Value;
}
return (-1);
}
}

@ -1,12 +1,6 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HybirdFrameworkDriver.ModbusTcpMaster;
namespace HybirdFrameworkServices.Plc
namespace Service.Plc.Msg
{
public class HostToPlc
{

@ -1,11 +1,6 @@
using HybirdFrameworkDriver.ModbusTcpMaster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Plc
namespace Service.Plc.Msg
{
public class PlcFault
{

@ -1,13 +1,6 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HybirdFrameworkDriver.ModbusTcpMaster;
namespace HybirdFrameworkServices.Plc
namespace Service.Plc.Msg
{
/// <summary>
///
@ -77,46 +70,26 @@ namespace HybirdFrameworkServices.Plc
#region 舱位状态 bit0:有料检测 Bit1有料检测开关故障
public ModbusProperty<bool> MaterialDetec01 { get; set; } = new(40241,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec02 { get; set; } = new(40242,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec03 { get; set; } = new(40243,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec04 { get; set; } = new(40244,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec05 { get; set; } = new(40245,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec06 { get; set; } = new(40246,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec07 { get; set; } = new(40247,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec08 { get; set; } = new(40248,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec09 { get; set; } = new(40249,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec10 { get; set; } = new(40250,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec11 { get; set; } = new(40251,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec12 { get; set; } = new(40252,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec13 { get; set; } = new(40253,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec14 { get; set; } = new(40254,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec15 { get; set; } = new(40255,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec16 { get; set; } = new(40256,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec17 { get; set; } = new(40257,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec18 { get; set; } = new(40258,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec19 { get; set; } = new(40259,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetec20 { get; set; } = new(40260,0,0,ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault01 { get; set; } = new(40241, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault02 { get; set; } = new(40242, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault03 { get; set; } = new(40243, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault04 { get; set; } = new(40244, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault05 { get; set; } = new(40245, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault06 { get; set; } = new(40246, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault07 { get; set; } = new(40247, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault08 { get; set; } = new(40248, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault09 { get; set; } = new(40249, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault10 { get; set; } = new(40250, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault11 { get; set; } = new(40251, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault12 { get; set; } = new(40252, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault13 { get; set; } = new(40253, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault14 { get; set; } = new(40254, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault15 { get; set; } = new(40255, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault16 { get; set; } = new(40256, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault17 { get; set; } = new(40257, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault18 { get; set; } = new(40258, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault19 { get; set; } = new(40259, 0, 0, ModbusDataType.Bit);
public ModbusProperty<bool> MaterialDetecSwitchFault20 { get; set; } = new(40260, 0, 0, ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec01 { get; set; } = new(40241,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec02 { get; set; } = new(40242,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec03 { get; set; } = new(40243,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec04 { get; set; } = new(40244,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec05 { get; set; } = new(40245,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec06 { get; set; } = new(40246,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec07 { get; set; } = new(40247,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec08 { get; set; } = new(40248,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec09 { get; set; } = new(40249,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec10 { get; set; } = new(40250,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec11 { get; set; } = new(40251,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec12 { get; set; } = new(40252,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec13 { get; set; } = new(40253,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec14 { get; set; } = new(40254,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec15 { get; set; } = new(40255,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec16 { get; set; } = new(40256,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec17 { get; set; } = new(40257,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec18 { get; set; } = new(40258,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec19 { get; set; } = new(40259,0,2,ModbusDataType.Bit);
public ModbusProperty<byte> MaterialDetec20 { get; set; } = new(40260,0,2,ModbusDataType.Bit);
#endregion 舱位状态

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Service.Cloud.Client;
using Service.Execute;
using Service.Plc.Client;
using SqlSugar;
using SqlSugar.IOC;
@ -147,8 +148,12 @@ app.MapControllers();
AppInfo.Container = app.Services.GetAutofacRoot();
//云平台
CloudClientMgr.Init();
//PLC
PlcMgr.Init();
//启动换电流程
StationSoftMgr.SwappingStateMachineStart();

@ -1,6 +1,6 @@
{
"Version": 1,
"Hash": "zLyz6C3YNcAfQ4a3PqNREUoaDzuSSMCXv5JiEIrUCxU=",
"Hash": "6L5ya4V2yXT6SrMz9lvVeF6F81dXoy4XMjFW1sVbQpk=",
"Source": "WebStarter",
"BasePath": "_content/WebStarter",
"Mode": "Default",
@ -10,17 +10,17 @@
{
"Name": "WebStarter\\wwwroot",
"Source": "WebStarter",
"ContentRoot": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\",
"ContentRoot": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"Pattern": "**"
}
],
"Assets": [
{
"Identity": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\20240523\\0.jpg",
"Identity": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\20240523\\0.jpg",
"SourceId": "WebStarter",
"SourceType": "Discovered",
"ContentRoot": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\",
"ContentRoot": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"RelativePath": "20240523/0.jpg",
"AssetKind": "All",
@ -34,10 +34,10 @@
"OriginalItemSpec": "wwwroot\\20240523\\0.jpg"
},
{
"Identity": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\20240524\\0.jpg",
"Identity": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\20240524\\0.jpg",
"SourceId": "WebStarter",
"SourceType": "Discovered",
"ContentRoot": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\",
"ContentRoot": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"RelativePath": "20240524/0.jpg",
"AssetKind": "All",
@ -51,10 +51,10 @@
"OriginalItemSpec": "wwwroot\\20240524\\0.jpg"
},
{
"Identity": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\20240524\\0.png",
"Identity": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\20240524\\0.png",
"SourceId": "WebStarter",
"SourceType": "Discovered",
"ContentRoot": "D:\\项目文件\\项目报表\\19焕能后背式站控\\04项目源码\\主服务\\WebStarter\\wwwroot\\",
"ContentRoot": "D:\\vsproject\\hn_back_main\\WebStarter\\wwwroot\\",
"BasePath": "_content/WebStarter",
"RelativePath": "20240524/0.png",
"AssetKind": "All",

@ -10,7 +10,6 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkServices.Plc;
using HybirdFrameworkDriver.TcpServer;
using Newtonsoft.Json.Linq;
using Service.Init.Entity;

@ -1,7 +1,6 @@
using Autofac;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using HybirdFrameworkServices;
using log4net.Config;
using Service;
using SqlSugar;
@ -52,10 +51,7 @@ internal static class Program
// 构建容器
Container = builder.Build();
AppInfo.Container = Container.BeginLifetimeScope("root");
EquipmentInit equipmentInit = AppInfo.Container.Resolve<EquipmentInit>();
equipmentInit.Connect();
Application.Run(AppInfo.Container.ResolveNamed<Form>("Form2"));
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs ex)

Loading…
Cancel
Save