|
@@ -14,6 +14,7 @@ using System;
|
|
|
using System.Collections.Concurrent;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
+using System.Diagnostics;
|
|
|
using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
@@ -95,9 +96,13 @@ namespace DefaultEdit.Core
|
|
|
|
|
|
//运行线程
|
|
|
private Thread WorkThread;
|
|
|
+
|
|
|
+ private Stopwatch[] stopwatchs = new Stopwatch[3];
|
|
|
public Management()
|
|
|
{
|
|
|
-
|
|
|
+ stopwatchs[0] = new Stopwatch();
|
|
|
+ stopwatchs[1] = new Stopwatch();
|
|
|
+ stopwatchs[2] = new Stopwatch();
|
|
|
for ( int i = 0; i < 6; i++ )
|
|
|
{
|
|
|
CurrStationRfid.Add("");
|
|
@@ -125,6 +130,7 @@ namespace DefaultEdit.Core
|
|
|
case "1工位离心开始":
|
|
|
if ( value )
|
|
|
{
|
|
|
+ stopwatchs[0].Restart();
|
|
|
if ( RfIDList.Count != 0 )
|
|
|
{
|
|
|
int index= RfIDList.FindIndex(x => x.StationId == 1);
|
|
@@ -139,18 +145,32 @@ namespace DefaultEdit.Core
|
|
|
|
|
|
LogHelper.Info(" 1工位离心开始");
|
|
|
}
|
|
|
+ index = RfIDList.FindIndex(x => x.StationId == 1);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ RfIDList[index].StationId = 2;
|
|
|
+ CurrStationRfid[2] = RfIDList[index].Rfid;
|
|
|
+ LogHelper.Info(RfIDList[index].Rfid + " 1工位离心开始");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ LogHelper.Info(" 1工位离心开始");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case "1工位离心完成":
|
|
|
if ( value )
|
|
|
{
|
|
|
+ stopwatchs[0].Stop();
|
|
|
if ( RfIDList.Count != 0 )
|
|
|
{
|
|
|
int index= RfIDList.FindIndex(x => x.StationId == 2);
|
|
|
if ( index != -1 )
|
|
|
{
|
|
|
- RfIDList[ index ].StationId = 4;
|
|
|
+ RfIDList[ index ].StationId = 3;
|
|
|
LogHelper.Info(CurrStationRfid[ 1 ] + " 1工位离心完成");
|
|
|
}
|
|
|
else
|
|
@@ -158,49 +178,90 @@ namespace DefaultEdit.Core
|
|
|
LogHelper.Info(" 1工位离心完成");
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ index = RfIDList.FindIndex(x => x.StationId == 2);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ RfIDList[index].StationId = 3;
|
|
|
+ LogHelper.Info(CurrStationRfid[2] + " 1工位离心完成");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 1工位离心完成");
|
|
|
+
|
|
|
+ }
|
|
|
+ CurrStationRfid[1] = "";
|
|
|
+ CurrStationRfid[2] = "";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "2工位离心开始":
|
|
|
if ( value )
|
|
|
{
|
|
|
+ stopwatchs[1].Restart();
|
|
|
if ( RfIDList.Count != 0 )
|
|
|
{
|
|
|
- int index= RfIDList.FindIndex(x => x.StationId == 1);
|
|
|
+ int index= RfIDList.FindIndex(x => x.StationId == 3);
|
|
|
if ( index != -1 )
|
|
|
{
|
|
|
- RfIDList[ index ].StationId = 3;
|
|
|
- CurrStationRfid[ 2 ] = RfIDList[ index ].Rfid;
|
|
|
+ RfIDList[ index ].StationId = 4;
|
|
|
+ CurrStationRfid[ 3 ] = RfIDList[ index ].Rfid;
|
|
|
LogHelper.Info(RfIDList[ index ].Rfid + " 2工位离心开始");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
LogHelper.Info( " 2工位离心开始");
|
|
|
}
|
|
|
+ index = RfIDList.FindIndex(x => x.StationId == 1);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ RfIDList[index].StationId = 4;
|
|
|
+ CurrStationRfid[4] = RfIDList[index].Rfid;
|
|
|
+ LogHelper.Info(RfIDList[index].Rfid + " 2工位离心开始");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 2工位离心开始");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "2工位离心完成":
|
|
|
if ( value )
|
|
|
{
|
|
|
+ stopwatchs[1].Stop();
|
|
|
if ( RfIDList.Count != 0 )
|
|
|
{
|
|
|
- int index= RfIDList.FindIndex(x => x.StationId == 3);
|
|
|
+ int index= RfIDList.FindIndex(x => x.StationId == 4);
|
|
|
if ( index != -1 )
|
|
|
{
|
|
|
- RfIDList[ index ].StationId = 4;
|
|
|
- LogHelper.Info(CurrStationRfid[ 2 ] + " 2工位离心完成");
|
|
|
+ RfIDList[ index ].StationId = 5;
|
|
|
+ LogHelper.Info(CurrStationRfid[ 3 ] + " 2工位离心完成");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
LogHelper.Info(" 2工位离心完成");
|
|
|
}
|
|
|
+ index = RfIDList.FindIndex(x => x.StationId == 4);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ RfIDList[index].StationId = 5;
|
|
|
+ LogHelper.Info(CurrStationRfid[4] + " 1工位离心完成");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 1工位离心完成");
|
|
|
+
|
|
|
+ }
|
|
|
+ CurrStationRfid[3] = "";
|
|
|
+ CurrStationRfid[4] = "";
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "脱模开始":
|
|
|
if ( value )
|
|
|
{
|
|
|
+
|
|
|
LogHelper.Info(CurrConfig.Rfid + " 脱模开始");
|
|
|
PlateInPlace(CurrConfig.Rfid);
|
|
|
}
|
|
@@ -208,6 +269,7 @@ namespace DefaultEdit.Core
|
|
|
case "脱模完成":
|
|
|
if ( value )
|
|
|
{
|
|
|
+
|
|
|
LogHelper.Info(CurrConfig.Rfid + " 脱模完成");
|
|
|
PrintInfo(processDataModels[0],"");
|
|
|
}
|
|
@@ -215,28 +277,42 @@ namespace DefaultEdit.Core
|
|
|
case "固化开始":
|
|
|
if ( value )
|
|
|
{
|
|
|
+ stopwatchs[2].Restart();
|
|
|
if ( RfIDList.Count != 0 )
|
|
|
{
|
|
|
- int index= RfIDList.FindIndex(x => x.StationId ==4 );
|
|
|
+ int index= RfIDList.FindIndex(x => x.StationId ==5 );
|
|
|
if ( index != -1 )
|
|
|
{
|
|
|
- RfIDList[ index ].StationId = 5;
|
|
|
- CurrStationRfid[ 3 ] = RfIDList[ index ].Rfid;
|
|
|
+ RfIDList[ index ].StationId = 6;
|
|
|
+ CurrStationRfid[ 5 ] = RfIDList[ index ].Rfid;
|
|
|
LogHelper.Info(RfIDList[ index ].Rfid + " 固化开始");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
LogHelper.Info( " 固化开始");
|
|
|
}
|
|
|
+
|
|
|
+ index = RfIDList.FindIndex(x => x.StationId == 5);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ RfIDList[index].StationId = 6;
|
|
|
+ CurrStationRfid[6] = RfIDList[index].Rfid;
|
|
|
+ LogHelper.Info(RfIDList[index].Rfid + " 固化开始");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 固化开始");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case "固化完成":
|
|
|
if ( value )
|
|
|
{
|
|
|
+ stopwatchs[2].Stop();
|
|
|
if ( RfIDList.Count != 0 )
|
|
|
{
|
|
|
- int index= RfIDList.FindIndex(x => x.StationId ==5 );
|
|
|
+ int index= RfIDList.FindIndex(x => x.StationId ==6 );
|
|
|
if ( index != -1 )
|
|
|
{
|
|
|
RfIDList.RemoveAt(index);
|
|
@@ -246,8 +322,21 @@ namespace DefaultEdit.Core
|
|
|
{
|
|
|
LogHelper.Info( " 固化完成");
|
|
|
}
|
|
|
+
|
|
|
+ index = RfIDList.FindIndex(x => x.StationId == 6);
|
|
|
+ if (index != -1)
|
|
|
+ {
|
|
|
+ RfIDList.RemoveAt(index);
|
|
|
+ LogHelper.Info(RfIDList[index].Rfid + " 固化完成");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 固化完成");
|
|
|
+ }
|
|
|
+ //CurrStationRfid[5] = RfIDList[index].Rfid;
|
|
|
+ //CurrStationRfid[6] = RfIDList[index].Rfid;
|
|
|
int hour= DateTime.Now.Hour;
|
|
|
- ProduceData[ hour ] = ProduceData[ hour ]+1;
|
|
|
+ ProduceData[ hour ] = ProduceData[ hour ]+2;
|
|
|
for ( int i = hour+1; i < ProduceData.Length; i++ )
|
|
|
{
|
|
|
ProduceData[ i ] = 0;
|
|
@@ -299,22 +388,36 @@ namespace DefaultEdit.Core
|
|
|
BoolPairs[ "脱模完成" ] = s7PlcCommunicate.GetBitAt(buff, 2, 1);
|
|
|
BoolPairs[ "固化开始" ] = s7PlcCommunicate.GetBitAt(buff, 3, 0);
|
|
|
BoolPairs[ "固化完成" ] = s7PlcCommunicate.GetBitAt(buff, 3, 1);
|
|
|
- CurrConfig.Speed = s7PlcCommunicate.GetShortAt(buff, 12);
|
|
|
- CurrConfig.Time = s7PlcCommunicate.GetTimeSpanAt(buff, 16);
|
|
|
- CurrConfig.Power1_1 = s7PlcCommunicate.GetShortAt(buff, 20);
|
|
|
- CurrConfig.Power1_2 = s7PlcCommunicate.GetShortAt(buff, 22);
|
|
|
- CurrConfig.Power1_3 = s7PlcCommunicate.GetShortAt(buff, 24);
|
|
|
- CurrConfig.Power1_4 = s7PlcCommunicate.GetShortAt(buff, 26);
|
|
|
- CurrConfig.Pressure1 = s7PlcCommunicate.GetRealAt(buff, 36);
|
|
|
- CurrConfig.PTime1 = s7PlcCommunicate.GetTimeSpanAt(buff, 44);
|
|
|
-
|
|
|
+
|
|
|
+ //固化压力 792.0
|
|
|
+ CurrConfig.Pressure1 = s7PlcCommunicate.GetRealAt(buff, 12);
|
|
|
+ CurrConfig.PTime1 = s7PlcCommunicate.GetTimeSpanAt(buff, 16);
|
|
|
+
|
|
|
+
|
|
|
+ CurrConfig.Speed = s7PlcCommunicate.GetShortAt(buff, 32);
|
|
|
+ CurrConfig.Speed2 = s7PlcCommunicate.GetShortAt(buff, 34);
|
|
|
+ CurrConfig.RealSpeed = s7PlcCommunicate.GetRealAt(buff, 36);
|
|
|
+ CurrConfig.RealSpeed2 = s7PlcCommunicate.GetRealAt(buff, 40);
|
|
|
+ CurrConfig.Time = s7PlcCommunicate.GetTimeSpanAt(buff, 44);
|
|
|
+ CurrConfig.Time = s7PlcCommunicate.GetTimeSpanAt(buff, 48);
|
|
|
+
|
|
|
+ //CurrConfig.Power1_1 = s7PlcCommunicate.GetShortAt(buff, 20);
|
|
|
+ //CurrConfig.Power1_2 = s7PlcCommunicate.GetShortAt(buff, 22);
|
|
|
+ //CurrConfig.Power1_3 = s7PlcCommunicate.GetShortAt(buff, 24);
|
|
|
+ //CurrConfig.Power1_4 = s7PlcCommunicate.GetShortAt(buff, 26);
|
|
|
+
|
|
|
+ CurrConfig.Realtime = (float)(stopwatchs[0].ElapsedMilliseconds / 1000.0);
|
|
|
+ CurrConfig.Realtime2 = (float)(stopwatchs[1].ElapsedMilliseconds / 1000.0);
|
|
|
+ CurrConfig.Realtime3 = (float)(stopwatchs[2].ElapsedMilliseconds / 1000.0);
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
|
|
|
}
|
|
|
-
|
|
|
+ Thread.Sleep(50);
|
|
|
}
|
|
|
}
|
|
|
|