|
@@ -29,10 +29,10 @@ namespace PLCS7
|
|
}
|
|
}
|
|
public abstract class AbstractPLCLinker : IPLCS7
|
|
public abstract class AbstractPLCLinker : IPLCS7
|
|
{
|
|
{
|
|
- //protected const int mainBlockOffset = 52;
|
|
|
|
- protected const int parkingSpaceOffset = 18;
|
|
|
|
- protected const int terminalLength = 46;
|
|
|
|
- protected const int parkingSpaceLength = 48;
|
|
|
|
|
|
+ protected const int mainBlockOffset = 52;
|
|
|
|
+ protected const int parkingSpaceOffset = 22;
|
|
|
|
+ protected const int terminalLength = 50;
|
|
|
|
+ protected const int parkingSpaceLength = 56;
|
|
/// <summary>
|
|
/// <summary>
|
|
/// PLC 连接状态flag
|
|
/// PLC 连接状态flag
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -350,7 +350,7 @@ namespace PLCS7
|
|
if (ts.licenseCodeC != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 16 + offset, BitConverter.GetBytes(BytesRevert(ts.licenseCodeC))); }
|
|
if (ts.licenseCodeC != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 16 + offset, BitConverter.GetBytes(BytesRevert(ts.licenseCodeC))); }
|
|
if (ts.licenseCodeD != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 20 + offset, BitConverter.GetBytes(BytesRevert(ts.licenseCodeD))); }
|
|
if (ts.licenseCodeD != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 20 + offset, BitConverter.GetBytes(BytesRevert(ts.licenseCodeD))); }
|
|
if (ts.receiptNum != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 24 + offset, BitConverter.GetBytes(BytesRevert(ts.receiptNum))); }
|
|
if (ts.receiptNum != -1) { plc.WriteBytes(DataType.DataBlock, terminalDB, 24 + offset, BitConverter.GetBytes(BytesRevert(ts.receiptNum))); }
|
|
- if (ts.termHeartbeat != 0) { plc.WriteBytes(DataType.DataBlock, terminalDB, 44 + offset, BitConverter.GetBytes(BytesRevert(ts.termHeartbeat))); }
|
|
|
|
|
|
+ if (ts.termHeartbeat != 0) { plc.WriteBytes(DataType.DataBlock, terminalDB, 48 + offset, BitConverter.GetBytes(BytesRevert(ts.termHeartbeat))); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (msg.abstractPLCMsg.GetType().Equals(typeof(MainBlockStru)) && msg.whoami.Equals(PLCDataType.central))
|
|
else if (msg.abstractPLCMsg.GetType().Equals(typeof(MainBlockStru)) && msg.whoami.Equals(PLCDataType.central))
|
|
@@ -358,10 +358,10 @@ namespace PLCS7
|
|
//只允许中控写入
|
|
//只允许中控写入
|
|
MainBlockStru mbs = (MainBlockStru)msg.abstractPLCMsg;
|
|
MainBlockStru mbs = (MainBlockStru)msg.abstractPLCMsg;
|
|
//byte[] temp = BitConverter.GetBytes(BytesRevert(mbs.licenseReceived));
|
|
//byte[] temp = BitConverter.GetBytes(BytesRevert(mbs.licenseReceived));
|
|
- if (mbs.centralHearbeat != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 60, BitConverter.GetBytes(BytesRevert(mbs.centralHearbeat))); }
|
|
|
|
- if (mbs.licenseReceived != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 52, BitConverter.GetBytes(BytesRevert(mbs.licenseReceived))); }
|
|
|
|
- if (mbs.bookParkCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 48, BitConverter.GetBytes(BytesRevert(mbs.bookParkCmd))); }
|
|
|
|
- if (mbs.bookFetchCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 50, BitConverter.GetBytes(BytesRevert(mbs.bookFetchCmd))); }
|
|
|
|
|
|
+ if (mbs.centralHearbeat != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset + 8, BitConverter.GetBytes(BytesRevert(mbs.centralHearbeat))); }
|
|
|
|
+ if (mbs.licenseReceived != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, BitConverter.GetBytes(BytesRevert(mbs.licenseReceived))); }
|
|
|
|
+ if (mbs.bookParkCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset - 4, BitConverter.GetBytes(BytesRevert(mbs.bookParkCmd))); }
|
|
|
|
+ if (mbs.bookFetchCmd != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset - 2, BitConverter.GetBytes(BytesRevert(mbs.bookFetchCmd))); }
|
|
if (mbs.processCompleted != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 16, BitConverter.GetBytes(BytesRevert(mbs.processCompleted))); }
|
|
if (mbs.processCompleted != (short)-1) { plc.WriteBytes(DataType.DataBlock, centralDB, 16, BitConverter.GetBytes(BytesRevert(mbs.processCompleted))); }
|
|
//ErrorCode ec = plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, temp);
|
|
//ErrorCode ec = plc.WriteBytes(DataType.DataBlock, centralDB, mainBlockOffset, temp);
|
|
//if (!ec.Equals(ErrorCode.NoError)) { return false; }
|
|
//if (!ec.Equals(ErrorCode.NoError)) { return false; }
|