|
|
|
@ -33,14 +33,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool IsRemote()
|
|
|
|
|
{
|
|
|
|
|
if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds)
|
|
|
|
|
{
|
|
|
|
|
return PlcMgr.PlcToHostData.RemoteLocalControlState.Value == 1010 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return PlcMgr.IsRemote();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -49,14 +42,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool EntranceRadar()
|
|
|
|
|
{
|
|
|
|
|
if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds)
|
|
|
|
|
{
|
|
|
|
|
return PlcMgr.PlcToHostData.RadarStatesIn.Value == 1000 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return PlcMgr.EntranceRadar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -65,14 +51,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool ExitRadar()
|
|
|
|
|
{
|
|
|
|
|
if ((DateTime.Now - DataValidityTime).Seconds <= DataTimeSeconds)
|
|
|
|
|
{
|
|
|
|
|
return PlcMgr.PlcToHostData.RadarStatesOut.Value == 1000 ? true : false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return PlcMgr.ExitRadar();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -85,7 +64,6 @@ public class PlcApi
|
|
|
|
|
public static bool WriteEntranceLamp(int data)
|
|
|
|
|
{
|
|
|
|
|
return PlcMgr.WriteEntranceLamp((byte)data);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -97,13 +75,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool WriteExistLamp(int data)
|
|
|
|
|
{
|
|
|
|
|
/*if (master != null)
|
|
|
|
|
{
|
|
|
|
|
HostToPlc writeHostToPlc = new HostToPlc();
|
|
|
|
|
writeHostToPlc.LightOut.Value = (ushort)data;
|
|
|
|
|
return master.WriteValue(writeHostToPlc.LightIn);
|
|
|
|
|
}*/
|
|
|
|
|
return false;
|
|
|
|
|
return PlcMgr.WriteExistLamp(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -114,16 +86,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool DistributeSelectPack(string inBinNo, string outBinNo)
|
|
|
|
|
{
|
|
|
|
|
/*if (master != null)
|
|
|
|
|
{
|
|
|
|
|
HostToPlc writeHostToPlc = new HostToPlc();
|
|
|
|
|
writeHostToPlc.EntrySelection.Value = Convert.ToUInt16(inBinNo);
|
|
|
|
|
writeHostToPlc.ExitSelection.Value = Convert.ToUInt16(outBinNo);
|
|
|
|
|
bool write1 = master.WriteValue(writeHostToPlc.EntrySelection);
|
|
|
|
|
bool write2 = master.WriteValue(writeHostToPlc.ExitSelection);
|
|
|
|
|
return write1 && write2;
|
|
|
|
|
}*/
|
|
|
|
|
return false;
|
|
|
|
|
return PlcMgr.DistributeSelectPack(inBinNo, outBinNo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -133,19 +96,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool StartSwapping()
|
|
|
|
|
{
|
|
|
|
|
/*if (master != null)
|
|
|
|
|
{
|
|
|
|
|
if (plcToHost.TaskType.Value == 0)//是否允许换电
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
HostToPlc writeHostToPlc = new HostToPlc();
|
|
|
|
|
writeHostToPlc.TaskType.Value = (ushort)1;
|
|
|
|
|
writeHostToPlc.TaskEnablement.Value = (ushort)1000;
|
|
|
|
|
bool write1 = master.WriteValue(writeHostToPlc.TaskType);
|
|
|
|
|
bool write2 = master.WriteValue(writeHostToPlc.TaskEnablement);
|
|
|
|
|
return write1 && write2;
|
|
|
|
|
}*/
|
|
|
|
|
return false;
|
|
|
|
|
return PlcMgr.StartSwapping();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -154,7 +105,7 @@ public class PlcApi
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static byte ChannelStatus()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
return PlcMgr.ChannelStatus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -164,11 +115,7 @@ public class PlcApi
|
|
|
|
|
/// <returns>6未连接</returns>
|
|
|
|
|
public static int ReadPlcTaskStatus()
|
|
|
|
|
{
|
|
|
|
|
/*if (master != null)
|
|
|
|
|
{
|
|
|
|
|
return plcToHost.TaskType.Value;
|
|
|
|
|
}*/
|
|
|
|
|
return (-1);
|
|
|
|
|
return PlcMgr.ReadPlcTaskStatus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|