|
@@ -97,8 +97,7 @@ namespace DefaultEdit.Core
|
|
|
private Thread WorkThread;
|
|
|
public Management()
|
|
|
{
|
|
|
- s7PlcCommunicate = new S7PlcCommunicate(CurentApplicationSettings.PlcIP);
|
|
|
- s7PlcCommunicate.OpenPlc();
|
|
|
+
|
|
|
for ( int i = 0; i < 6; i++ )
|
|
|
{
|
|
|
CurrStationRfid.Add("");
|
|
@@ -112,7 +111,13 @@ namespace DefaultEdit.Core
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void ConnectPlc()
|
|
|
+ {
|
|
|
+
|
|
|
+ s7PlcCommunicate = new S7PlcCommunicate(CurentApplicationSettings.PlcIP);
|
|
|
+ s7PlcCommunicate.OpenPlc();
|
|
|
|
|
|
+ }
|
|
|
private void Management_RuningToWorkEvent(string key, bool value)
|
|
|
{
|
|
|
switch ( key )
|
|
@@ -279,7 +284,7 @@ namespace DefaultEdit.Core
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- if ( s7PlcCommunicate.IsConnected )
|
|
|
+ if (s7PlcCommunicate!=null&& s7PlcCommunicate.IsConnected )
|
|
|
{
|
|
|
byte []buff= s7PlcCommunicate.ReadByte(25, 780, 74);
|
|
|
int actuallength=buff[53];
|
|
@@ -300,14 +305,9 @@ namespace DefaultEdit.Core
|
|
|
CurrConfig.Power1_2 = s7PlcCommunicate.GetShortAt(buff, 22);
|
|
|
CurrConfig.Power1_3 = s7PlcCommunicate.GetShortAt(buff, 24);
|
|
|
CurrConfig.Power1_4 = s7PlcCommunicate.GetShortAt(buff, 26);
|
|
|
- CurrConfig.Power2_1 = s7PlcCommunicate.GetShortAt(buff, 28);
|
|
|
- CurrConfig.Power2_2 = s7PlcCommunicate.GetShortAt(buff, 30);
|
|
|
- CurrConfig.Power2_3 = s7PlcCommunicate.GetShortAt(buff, 32);
|
|
|
- CurrConfig.Power2_4 = s7PlcCommunicate.GetShortAt(buff, 34);
|
|
|
CurrConfig.Pressure1 = s7PlcCommunicate.GetRealAt(buff, 36);
|
|
|
- CurrConfig.Pressure2 = s7PlcCommunicate.GetRealAt(buff, 40);
|
|
|
CurrConfig.PTime1 = s7PlcCommunicate.GetTimeSpanAt(buff, 44);
|
|
|
- CurrConfig.PTime2 = s7PlcCommunicate.GetTimeSpanAt(buff, 48);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
catch
|