现场问题修改 --plc注释更新battery信息

zw
lxw 4 months ago
parent c441804284
commit d04f25dc20

@ -52,7 +52,7 @@ public class PlcClient : ModbusTcpMaster
ModbusDecoder.Decode<PlcToHost>(bytes02, PlcMgr.PlcToHostData, EndingConst.ByteSeq.AB,
EndingConst.WordSeq.DC);
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec01.Value, "1");
UpdateBinInfoCache(PlcMgr.PlcToHostData.MaterialDetec01.Value, "1");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec02.Value, "2");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec03.Value, "3");
UpdateBinInfo(PlcMgr.PlcToHostData.MaterialDetec04.Value, "4");
@ -245,4 +245,21 @@ public class PlcClient : ModbusTcpMaster
it => it.No == binNo);
}
private void UpdateBinInfoCache(int exists, string binNo)
{
if (exists == 0)
BinInfoRepository.Update(
it =>
new BinInfo(){
Exists = 0,
},
it => it.No == binNo);
else
BinInfoRepository.Update(it => it.Exists == 1,
it => it.No == binNo);
}
}

Loading…
Cancel
Save