|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkCore.Const;
|
|
|
|
|
using HybirdFrameworkDriver.ModbusTcpMaster;
|
|
|
|
|
using Repository.Station;
|
|
|
|
|
using Service.Execute.Api;
|
|
|
|
|
using Service.Plc.Msg;
|
|
|
|
|
|
|
|
|
|
namespace Service.Plc.Client;
|
|
|
|
@ -33,14 +33,14 @@ public class PlcClient : ModbusTcpMaster
|
|
|
|
|
{
|
|
|
|
|
PlcMgr.DataValidityTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
ModbusDecoder.Decode<HostToPlc>(bytes01, PlcMgr.HostToPlcData);
|
|
|
|
|
ModbusDecoder.Decode<HostToPlc>(bytes01, PlcMgr.HostToPlcData, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bytes02 = master.BatchReadHolderRegister(201, 222);
|
|
|
|
|
if (bytes02 != null)
|
|
|
|
|
{
|
|
|
|
|
PlcMgr.DataValidityTime = DateTime.Now;
|
|
|
|
|
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData);
|
|
|
|
|
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value, it => it.No == "1");
|
|
|
|
|
|
|
|
|
@ -68,7 +68,7 @@ public class PlcClient : ModbusTcpMaster
|
|
|
|
|
if (bytes03 != null)
|
|
|
|
|
{
|
|
|
|
|
PlcMgr.DataValidityTime = DateTime.Now;
|
|
|
|
|
ModbusDecoder.Decode<PlcFault>(bytes03, PlcMgr.PlcFaultData);
|
|
|
|
|
ModbusDecoder.Decode<PlcFault>(bytes03, PlcMgr.PlcFaultData, EndingConst.ByteSeq.AB, EndingConst.WordSeq.DC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|