|
|
|
@ -21,6 +21,7 @@ using NewLife.Caching;
|
|
|
|
|
using NewLife.Collections;
|
|
|
|
|
using System.IO.Ports;
|
|
|
|
|
using NewLife.Log;
|
|
|
|
|
using NewLife.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace NDSD_Screwdriver
|
|
|
|
|
{
|
|
|
|
@ -184,6 +185,18 @@ namespace NDSD_Screwdriver
|
|
|
|
|
private void InitButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
InitTable();
|
|
|
|
|
if (cancellationTokenSource != null)
|
|
|
|
|
{
|
|
|
|
|
cancellationTokenSource.Cancel();
|
|
|
|
|
cancellationTokenSource.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i <=16; i++)
|
|
|
|
|
{
|
|
|
|
|
DOperateInfo.DClose(i);
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StartLongRunningTask();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -558,19 +571,29 @@ namespace NDSD_Screwdriver
|
|
|
|
|
|
|
|
|
|
if (FlashIndex < monitorEntitiesCount)
|
|
|
|
|
{
|
|
|
|
|
// if (FlashIndex > 0)
|
|
|
|
|
// {
|
|
|
|
|
// SetQian(FlashIndex-1);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
monitorEntities[FlashIndex].RFIDState = 1;
|
|
|
|
|
RefreshRoll();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
quClient2.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var total = DateTime.Now - dateTime;
|
|
|
|
|
if (total.TotalSeconds > 2)
|
|
|
|
|
if (total.TotalSeconds > 1)
|
|
|
|
|
{
|
|
|
|
|
quClient2.Close();
|
|
|
|
|
dateTime = DateTime.Now;
|
|
|
|
@ -601,6 +624,8 @@ namespace NDSD_Screwdriver
|
|
|
|
|
int step = 0;
|
|
|
|
|
timer.Elapsed += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Set(FlashIndex);
|
|
|
|
|
RefreshRoll();
|
|
|
|
|
};
|
|
|
|
@ -612,6 +637,8 @@ namespace NDSD_Screwdriver
|
|
|
|
|
int step1 = 0;
|
|
|
|
|
public void Set(int id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var monitorEntitiesCount = monitorEntities.Count;
|
|
|
|
|
if (id < monitorEntitiesCount)
|
|
|
|
@ -627,10 +654,10 @@ namespace NDSD_Screwdriver
|
|
|
|
|
if (RFIDState == 2)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DOperateInfo.DClose(monitorEntities[id].Green);
|
|
|
|
|
// Thread.Sleep(300);
|
|
|
|
|
XTrace.WriteLine("亮黄灯延迟");
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
DOperateInfo.DTimeOpen(monitorEntities[id].Yellow, 1);
|
|
|
|
|
monitorEntities[id].RowEntitys[2].Color = Brushes.Yellow;
|
|
|
|
|
}
|
|
|
|
@ -639,7 +666,7 @@ namespace NDSD_Screwdriver
|
|
|
|
|
if (RFIDState == 1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timer.Stop();
|
|
|
|
|
if ((id+1) < monitorEntitiesCount)
|
|
|
|
|
{
|
|
|
|
|
monitorEntities[id + 1].RFIDState = 2;
|
|
|
|
@ -647,52 +674,58 @@ namespace NDSD_Screwdriver
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dictionary.ContainsKey(monitorEntities[id].RFIDValue))
|
|
|
|
|
{
|
|
|
|
|
var i = dictionary[monitorEntities[id].RFIDValue];
|
|
|
|
|
dictionary[monitorEntities[id].RFIDValue] = i + 1;
|
|
|
|
|
if (i >3)
|
|
|
|
|
{
|
|
|
|
|
monitorEntities[id].RFIDState = 3;
|
|
|
|
|
dictionary[monitorEntities[id].RFIDValue] = 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dictionary[monitorEntities[id].RFIDValue] = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (dictionary.ContainsKey(monitorEntities[id].RFIDValue))
|
|
|
|
|
// {
|
|
|
|
|
// var i = dictionary[monitorEntities[id].RFIDValue];
|
|
|
|
|
// dictionary[monitorEntities[id].RFIDValue] = i + 1;
|
|
|
|
|
// if (i >3)
|
|
|
|
|
// {
|
|
|
|
|
// monitorEntities[id].RFIDState = 3;
|
|
|
|
|
// dictionary[monitorEntities[id].RFIDValue] = 3;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// dictionary[monitorEntities[id].RFIDValue] = 1;
|
|
|
|
|
// }
|
|
|
|
|
XTrace.WriteLine("读取Rfid 亮黄灯");
|
|
|
|
|
//状态修改
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(200);
|
|
|
|
|
DOperateInfo.DOpen(monitorEntities[FlashIndex].Yellow);
|
|
|
|
|
timer.Start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
monitorEntities[id].RowEntitys[2].Color = Brushes.Yellow;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SetQian(FlashIndex);
|
|
|
|
|
|
|
|
|
|
timer.Start();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RFIDState = monitorEntities[id].RFIDState;
|
|
|
|
|
if (RFIDState == 3)
|
|
|
|
|
{
|
|
|
|
|
timer.Stop();
|
|
|
|
|
|
|
|
|
|
quClient2.Close();
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
DOperateInfo.DClose(monitorEntities[id].Yellow);
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
DOperateInfo.DOpen(monitorEntities[id].Green);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
monitorEntities[id].RowEntitys[2].Color = Brushes.Green;
|
|
|
|
|
monitorEntities[id].RFIDState=100;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FlashIndex += 1;
|
|
|
|
|
timer.Start();
|
|
|
|
|
}
|
|
|
|
|
// if (RFIDState == 3)
|
|
|
|
|
// {
|
|
|
|
|
// timer.Stop();
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// Thread.Sleep(300);
|
|
|
|
|
// DOperateInfo.DClose(monitorEntities[id].Yellow);
|
|
|
|
|
// Thread.Sleep(300);
|
|
|
|
|
// DOperateInfo.DOpen(monitorEntities[id].Green);
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// monitorEntities[id].RowEntitys[2].Color = Brushes.Green;
|
|
|
|
|
// monitorEntities[id].RFIDState=100;
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// FlashIndex += 1;
|
|
|
|
|
// timer.Start();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -706,12 +739,72 @@ namespace NDSD_Screwdriver
|
|
|
|
|
monitorEntities[id].RowEntitys[2].Color = Brushes.Transparent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void SetQian(int no)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ssss = quClient2.gitResult;
|
|
|
|
|
|
|
|
|
|
var quClient2TighteningStatus = -1;
|
|
|
|
|
if (ssss.IsOk)
|
|
|
|
|
{
|
|
|
|
|
quClient2TighteningStatus = ssss.TighteningStatus;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var monitorEntitiesCount = monitorEntities.Count;
|
|
|
|
|
if (no < monitorEntitiesCount)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
XTrace.WriteLine(ssss.ToJson());
|
|
|
|
|
|
|
|
|
|
if (quClient2TighteningStatus == 1)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
DOperateInfo.DClose(monitorEntities[no].Yellow);
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
DOperateInfo.DClose(monitorEntities[no].Red);
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
DOperateInfo.DOpen(monitorEntities[no].Green);
|
|
|
|
|
|
|
|
|
|
monitorEntities[no].RowEntitys[2].Color = Brushes.Green;
|
|
|
|
|
FlashIndex += 1;
|
|
|
|
|
quClient2.Close();
|
|
|
|
|
ssss.msg = "";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (quClient2TighteningStatus == 0)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
DOperateInfo.DClose(monitorEntities[no].Yellow);
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
|
|
|
|
|
DOperateInfo.DClose(monitorEntities[no].Green);
|
|
|
|
|
Thread.Sleep(300);
|
|
|
|
|
|
|
|
|
|
DOperateInfo.DOpen(monitorEntities[no].Red);
|
|
|
|
|
|
|
|
|
|
monitorEntities[no].RowEntitys[2].Color = Brushes.Red;
|
|
|
|
|
// FlashIndex += 1;
|
|
|
|
|
ssss.msg = "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private int step2 = 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|