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

master
smartwyy 6 months ago
parent f5accdfb73
commit 1d1eb53b10

@ -1,7 +1,4 @@
using System; using SqlSugar;
using System.Linq;
using System.Text;
using SqlSugar;
namespace Entity.DbModel.Station namespace Entity.DbModel.Station
{ {
@ -11,10 +8,10 @@ namespace Entity.DbModel.Station
[SugarTable("bin_info")] [SugarTable("bin_info")]
public partial class BinInfo public partial class BinInfo
{ {
public BinInfo(){ public BinInfo()
{
} }
/// <summary> /// <summary>
/// Desc:id /// Desc:id
/// Default: /// Default:
@ -53,7 +50,7 @@ namespace Entity.DbModel.Station
/// Nullable:True /// Nullable:True
/// </summary> /// </summary>
[SugarColumn(ColumnName = "exists")] [SugarColumn(ColumnName = "exists")]
public int? Exists {get;set;} public int Exists { get; set; }
/// <summary> /// <summary>
/// Desc:电池编号 /// Desc:电池编号
@ -206,6 +203,5 @@ namespace Entity.DbModel.Station
/// </summary> /// </summary>
[SugarColumn(ColumnName = "updated_time")] [SugarColumn(ColumnName = "updated_time")]
public DateTime? UpdatedTime { get; set; } public DateTime? UpdatedTime { get; set; }
} }
} }

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

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

@ -1,5 +1,4 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using Entity.Base;
using Entity.Dto.Req; using Entity.Dto.Req;
using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.Entity;
using SqlSugar; using SqlSugar;
@ -915,6 +914,12 @@ public abstract class BaseRepository<T> where T : class, new()
.AnyAsync(expression); .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( public async Task<int> UpdateAsync(
Expression<Func<T, bool>> columns, 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 HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkServices.Plc;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Service.Cloud.Msg.Cloud.Req; using Service.Cloud.Msg.Cloud.Req;
using Service.Init.Entity; using Service.Init.Entity;
using Service.Plc; using Service.Plc;
using Service.Plc.Client;
namespace Service.Execute.Api; namespace Service.Execute.Api;

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

@ -1,12 +1,6 @@
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkDriver.ModbusTcpMaster;
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 HostToPlc public class HostToPlc
{ {

@ -1,11 +1,6 @@
using HybirdFrameworkDriver.ModbusTcpMaster; 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 public class PlcFault
{ {

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

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

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

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

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

Loading…
Cancel
Save