|
|
|
@ -41,45 +41,26 @@ public class PlcClient : ModbusTcpMaster
|
|
|
|
|
{
|
|
|
|
|
PlcMgr.DataValidityTime = DateTime.Now;
|
|
|
|
|
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData);
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec01.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "1");
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec01.Value, it => it.No == "1");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec02.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec02.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "2");
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec02.Value, it => it.No == "2");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec03.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec03.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "3");
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec03.Value, it => it.No == "3");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec04.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec04.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "4");
|
|
|
|
|
else
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec04.Value, it => it.No == "4");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec05.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec05.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "5");
|
|
|
|
|
else
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec05.Value, it => it.No == "5");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec06.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec06.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "6");
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec06.Value, it => it.No == "6");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec07.Value == 1)
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec07.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "7");
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec07.Value, it => it.No == "7");
|
|
|
|
|
|
|
|
|
|
if (PlcMgr.PlcToHostData.MaterialDetec08.Value == 1)
|
|
|
|
|
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec08.Value && it.BatteryNo == "-1" && it.Soc == (decimal)(-1) && it.Soe == (decimal)(-1) && it.Soh == (decimal)(-1), it => it.No == "8");
|
|
|
|
|
else
|
|
|
|
|
_binInfoRepository.Update(it => it.Exists == PlcMgr.PlcToHostData.MaterialDetec08.Value, it => it.No == "8");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|