|
|
|
@ -35,240 +35,248 @@ namespace Rs.MotionPlat
|
|
|
|
|
int errNum = 0;
|
|
|
|
|
public void RefreshStatus(TestFixture tf)
|
|
|
|
|
{
|
|
|
|
|
string msg = tf.GetLog();
|
|
|
|
|
if(string.IsNullOrEmpty(msg))
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
errNum++;
|
|
|
|
|
if(errNum>=10)
|
|
|
|
|
string msg = tf.GetLog();
|
|
|
|
|
if (string.IsNullOrEmpty(msg))
|
|
|
|
|
{
|
|
|
|
|
if (label5.BackColor != Color.Red)
|
|
|
|
|
label5.BackColor = Color.Red;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//打印日志
|
|
|
|
|
string logDir = $"d:\\log\\Communition\\{DateTime.Now.ToString("yyyyMMdd")}";
|
|
|
|
|
if (!Directory.Exists(logDir))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(logDir);
|
|
|
|
|
}
|
|
|
|
|
string logFileName = $"{logDir}\\{tf.Index}.txt";
|
|
|
|
|
File.WriteAllText(logFileName, $"{msg}\r\n");
|
|
|
|
|
if (label5.BackColor!=Color.Lime)
|
|
|
|
|
{
|
|
|
|
|
label5.BackColor = Color.Lime;
|
|
|
|
|
}
|
|
|
|
|
errNum = 0;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.Text != tf.Status.ToString())
|
|
|
|
|
{
|
|
|
|
|
lblStatus.Text = tf.Status.ToString();
|
|
|
|
|
}
|
|
|
|
|
switch (tf.Status)
|
|
|
|
|
{
|
|
|
|
|
case ETestFixtureStatus.NoConnect:
|
|
|
|
|
if(btnReset.Enabled)
|
|
|
|
|
errNum++;
|
|
|
|
|
if (errNum >= 10)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = false;
|
|
|
|
|
if (label5.BackColor != Color.Red)
|
|
|
|
|
label5.BackColor = Color.Red;
|
|
|
|
|
}
|
|
|
|
|
if(lblStatus.BackColor!=Color.Gray)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Gray;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.IDLE:
|
|
|
|
|
if(!btnReset.Enabled)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
if(lblStatus.BackColor!=Color.Green)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//打印日志
|
|
|
|
|
string logDir = $"d:\\log\\Communition\\{DateTime.Now.ToString("yyyyMMdd")}";
|
|
|
|
|
if (!Directory.Exists(logDir))
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Green;
|
|
|
|
|
Directory.CreateDirectory(logDir);
|
|
|
|
|
}
|
|
|
|
|
//if (tf.Product != null)
|
|
|
|
|
//{
|
|
|
|
|
// if (tf.Product.Result == "true")
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Green;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product.Result == "false")
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Red;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product != null && tf.Product.Result != null && lblResult.Text != tf.Product.Result)
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.Text = tf.Product.Result.ToString();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// lblSN.Text = "";
|
|
|
|
|
// lblFixtureName.BackColor = Color.FromArgb(56, 56, 56);
|
|
|
|
|
//}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.Testing:
|
|
|
|
|
//if (tf.Product != null && lblSN.Text != tf.Product.SN)
|
|
|
|
|
//{
|
|
|
|
|
// lblSN.Text = tf.Product.SN;
|
|
|
|
|
//}
|
|
|
|
|
if (btnReset.Enabled != false)
|
|
|
|
|
string logFileName = $"{logDir}\\{tf.Index}.txt";
|
|
|
|
|
File.WriteAllText(logFileName, $"{msg}\r\n");
|
|
|
|
|
if (label5.BackColor != Color.Lime)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = false;
|
|
|
|
|
label5.BackColor = Color.Lime;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.Blue)
|
|
|
|
|
errNum = 0;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.Text != tf.Status.ToString())
|
|
|
|
|
{
|
|
|
|
|
lblStatus.Text = tf.Status.ToString();
|
|
|
|
|
}
|
|
|
|
|
switch (tf.Status)
|
|
|
|
|
{
|
|
|
|
|
case ETestFixtureStatus.NoConnect:
|
|
|
|
|
if (btnReset.Enabled)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.Gray)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Gray;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.IDLE:
|
|
|
|
|
if (!btnReset.Enabled)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.Green)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
//if (tf.Product != null)
|
|
|
|
|
//{
|
|
|
|
|
// if (tf.Product.Result == "true")
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Green;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product.Result == "false")
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Red;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product != null && tf.Product.Result != null && lblResult.Text != tf.Product.Result)
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.Text = tf.Product.Result.ToString();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// lblSN.Text = "";
|
|
|
|
|
// lblFixtureName.BackColor = Color.FromArgb(56, 56, 56);
|
|
|
|
|
//}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.Testing:
|
|
|
|
|
//if (tf.Product != null && lblSN.Text != tf.Product.SN)
|
|
|
|
|
//{
|
|
|
|
|
// lblSN.Text = tf.Product.SN;
|
|
|
|
|
//}
|
|
|
|
|
if (btnReset.Enabled != false)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.Blue)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Blue;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.Warning:
|
|
|
|
|
if (btnReset.Enabled != true)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.Red)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Red;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.Homing:
|
|
|
|
|
if (btnReset.Enabled != false)
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.YellowGreen)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.YellowGreen;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tf.Product != null)
|
|
|
|
|
{
|
|
|
|
|
if (lblSN.Text != tf.Product.SN)
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Blue;
|
|
|
|
|
lblSN.Text = tf.Product.SN;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.Warning:
|
|
|
|
|
if(btnReset.Enabled!=true)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lblSN.Text = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (lblResult.Text != tf.Result)
|
|
|
|
|
{
|
|
|
|
|
if (tf.Result == "PASS")
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = true;
|
|
|
|
|
lblResult.BackColor = Color.Green;
|
|
|
|
|
}
|
|
|
|
|
if (lblStatus.BackColor != Color.Red)
|
|
|
|
|
else if (tf.Result == "NG")
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.Red;
|
|
|
|
|
lblResult.BackColor = Color.Red;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ETestFixtureStatus.Homing:
|
|
|
|
|
if(btnReset.Enabled!=false)
|
|
|
|
|
if (string.IsNullOrEmpty(tf.Result))
|
|
|
|
|
{
|
|
|
|
|
btnReset.Enabled = false;
|
|
|
|
|
lblResult.BackColor = Color.FromArgb(11, 16, 36);
|
|
|
|
|
lblResult.Text = "";
|
|
|
|
|
}
|
|
|
|
|
if(lblStatus.BackColor!=Color.YellowGreen)
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lblStatus.BackColor = Color.YellowGreen;
|
|
|
|
|
lblResult.Text = tf.Result;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(tf.Product!=null)
|
|
|
|
|
{
|
|
|
|
|
if(lblSN.Text!= tf.Product.SN)
|
|
|
|
|
}
|
|
|
|
|
//if(tf.Product!=null)
|
|
|
|
|
//{
|
|
|
|
|
// if(!string.IsNullOrEmpty(tf.Product.Result) && lblResult.Text!=tf.Product.Result)
|
|
|
|
|
// {
|
|
|
|
|
// if(tf.Product.Result=="PASS")
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Green;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Red;
|
|
|
|
|
// }
|
|
|
|
|
// lblResult.Text = tf.Product.Result;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// if(!string.IsNullOrEmpty(lblResult.Text))
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.Text = "";
|
|
|
|
|
// lblResult.BackColor = Color.FromArgb(11, 16, 36);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//if (tf.Status== ETestFixtureStatus.Testing)
|
|
|
|
|
//{
|
|
|
|
|
// if (tf.Product!=null && lblSN.Text != tf.Product.SN)
|
|
|
|
|
// {
|
|
|
|
|
// lblSN.Text = tf.Product.SN;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else if(tf.Status== ETestFixtureStatus.IDLE)
|
|
|
|
|
//{
|
|
|
|
|
// if (tf.Product != null)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// if (tf.Product.Result == "true" && lblFixtureName.BackColor != Color.Green)
|
|
|
|
|
// {
|
|
|
|
|
// lblFixtureName.BackColor = Color.Green;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product.Result == "false" && lblFixtureName.BackColor != Color.Red)
|
|
|
|
|
// {
|
|
|
|
|
// lblFixtureName.BackColor = Color.Red;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product!=null && tf.Product.Result!=null && lblResult.Text != tf.Product.Result)
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.Text = tf.Product.Result.ToString();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// lblSN.Text = "";
|
|
|
|
|
// lblFixtureName.BackColor = Color.FromArgb(56, 56, 56);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else if(tf.Status== ETestFixtureStatus.Homing)
|
|
|
|
|
//{
|
|
|
|
|
// if(btnReset.Enabled!=false)
|
|
|
|
|
// {
|
|
|
|
|
// btnReset.Enabled = false;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
if (lblName.Text != tf.MachineID)
|
|
|
|
|
{
|
|
|
|
|
lblSN.Text = tf.Product.SN;
|
|
|
|
|
lblName.Text = tf.MachineID;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
lblSN.Text = "";
|
|
|
|
|
}
|
|
|
|
|
//if(lblLotName.Text!= GlobalVar.LotName)
|
|
|
|
|
//{
|
|
|
|
|
// lblLotName.Text = GlobalVar.LotName;
|
|
|
|
|
//}
|
|
|
|
|
//if(lblEnable.Text!=tf.Enable.ToString())
|
|
|
|
|
//{
|
|
|
|
|
// //this.lblFixtureName.Enabled = tf.Enable;
|
|
|
|
|
// lblEnable.Text = tf.Enable.ToString();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
if(lblResult.Text!=tf.Result)
|
|
|
|
|
{
|
|
|
|
|
if(tf.Result=="PASS")
|
|
|
|
|
this.lblYield.Text = $"{(tf.Yield * 100).ToString("0.00")}%";
|
|
|
|
|
|
|
|
|
|
if (this.lblLastCT.Text != double.Parse(tf.LastCT.ToString()).ToString("0.000"))
|
|
|
|
|
{
|
|
|
|
|
lblResult.BackColor = Color.Green;
|
|
|
|
|
this.lblLastCT.Text = double.Parse(tf.LastCT.ToString()).ToString("0.000");
|
|
|
|
|
}
|
|
|
|
|
else if(tf.Result=="NG")
|
|
|
|
|
|
|
|
|
|
if (lblPassCount.Text != tf.PassCount.ToString())
|
|
|
|
|
{
|
|
|
|
|
lblResult.BackColor = Color.Red;
|
|
|
|
|
lblPassCount.Text = tf.PassCount.ToString();
|
|
|
|
|
}
|
|
|
|
|
if(string.IsNullOrEmpty(tf.Result))
|
|
|
|
|
if (lblTotalCount.Text != tf.TotalCount.ToString())
|
|
|
|
|
{
|
|
|
|
|
lblResult.BackColor = Color.FromArgb(11, 16, 36);
|
|
|
|
|
lblResult.Text = "";
|
|
|
|
|
lblTotalCount.Text = tf.TotalCount.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (this.lblFixtureName.Enabled != tf.Enable)
|
|
|
|
|
{
|
|
|
|
|
lblResult.Text = tf.Result;
|
|
|
|
|
this.lblFixtureName.Enabled = tf.Enable;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//if(tf.Product!=null)
|
|
|
|
|
//{
|
|
|
|
|
// if(!string.IsNullOrEmpty(tf.Product.Result) && lblResult.Text!=tf.Product.Result)
|
|
|
|
|
// {
|
|
|
|
|
// if(tf.Product.Result=="PASS")
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Green;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.BackColor = Color.Red;
|
|
|
|
|
// }
|
|
|
|
|
// lblResult.Text = tf.Product.Result;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// if(!string.IsNullOrEmpty(lblResult.Text))
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.Text = "";
|
|
|
|
|
// lblResult.BackColor = Color.FromArgb(11, 16, 36);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//if (tf.Status== ETestFixtureStatus.Testing)
|
|
|
|
|
//{
|
|
|
|
|
// if (tf.Product!=null && lblSN.Text != tf.Product.SN)
|
|
|
|
|
// {
|
|
|
|
|
// lblSN.Text = tf.Product.SN;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else if(tf.Status== ETestFixtureStatus.IDLE)
|
|
|
|
|
//{
|
|
|
|
|
// if (tf.Product != null)
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
|
|
// if (tf.Product.Result == "true" && lblFixtureName.BackColor != Color.Green)
|
|
|
|
|
// {
|
|
|
|
|
// lblFixtureName.BackColor = Color.Green;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product.Result == "false" && lblFixtureName.BackColor != Color.Red)
|
|
|
|
|
// {
|
|
|
|
|
// lblFixtureName.BackColor = Color.Red;
|
|
|
|
|
// }
|
|
|
|
|
// if (tf.Product!=null && tf.Product.Result!=null && lblResult.Text != tf.Product.Result)
|
|
|
|
|
// {
|
|
|
|
|
// lblResult.Text = tf.Product.Result.ToString();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// lblSN.Text = "";
|
|
|
|
|
// lblFixtureName.BackColor = Color.FromArgb(56, 56, 56);
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else if(tf.Status== ETestFixtureStatus.Homing)
|
|
|
|
|
//{
|
|
|
|
|
// if(btnReset.Enabled!=false)
|
|
|
|
|
// {
|
|
|
|
|
// btnReset.Enabled = false;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
if(lblName.Text!=tf.MachineID)
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
lblName.Text = tf.MachineID;
|
|
|
|
|
}
|
|
|
|
|
//if(lblLotName.Text!= GlobalVar.LotName)
|
|
|
|
|
//{
|
|
|
|
|
// lblLotName.Text = GlobalVar.LotName;
|
|
|
|
|
//}
|
|
|
|
|
//if(lblEnable.Text!=tf.Enable.ToString())
|
|
|
|
|
//{
|
|
|
|
|
// //this.lblFixtureName.Enabled = tf.Enable;
|
|
|
|
|
// lblEnable.Text = tf.Enable.ToString();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
this.lblYield.Text = $"{(tf.Yield * 100).ToString("0.00")}%";
|
|
|
|
|
|
|
|
|
|
if(this.lblLastCT.Text != double.Parse(tf.LastCT.ToString()).ToString("0.000"))
|
|
|
|
|
{
|
|
|
|
|
this.lblLastCT.Text = double.Parse(tf.LastCT.ToString()).ToString("0.000");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(lblPassCount.Text != tf.PassCount.ToString())
|
|
|
|
|
{
|
|
|
|
|
lblPassCount.Text = tf.PassCount.ToString();
|
|
|
|
|
}
|
|
|
|
|
if(lblTotalCount.Text != tf.TotalCount.ToString())
|
|
|
|
|
{
|
|
|
|
|
lblTotalCount.Text = tf.TotalCount.ToString();
|
|
|
|
|
}
|
|
|
|
|
if(this.lblFixtureName.Enabled!=tf.Enable)
|
|
|
|
|
{
|
|
|
|
|
this.lblFixtureName.Enabled= tf.Enable;
|
|
|
|
|
LogHelper.Error("RefreshStatus", ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnReset_Click(object sender, EventArgs e)
|
|
|
|
|