增加doe测试流程

master
lhiven 11 months ago
parent 251faa8264
commit 7046d25329

@ -4,6 +4,7 @@ using Rs.Motion;
using Rs.MotionPlat.Commom;
using Rs.MotionPlat.Entitys;
using Rs.MotionPlat.Flow.Common;
using Rs.MotionPlat.Flow.NormalFlow;
using Rs.MotionPlat.Flow.SafePosFlow;
using Rs.MotionPlat.Vision;
using System;
@ -18,7 +19,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
{
enum EFiveProductTestFlowStep
{
OK,
,
,
,
@ -59,7 +60,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
private AlarmEntity alarmEntity;
Stopwatch timeout = new Stopwatch();
EFiveProductTestFlowStep flowStep = EFiveProductTestFlowStep.;
EFiveProductTestFlowStep flowStep = EFiveProductTestFlowStep.OK;
int scanNum = 0;
string logInfo = string.Empty;
@ -114,9 +115,14 @@ namespace Rs.MotionPlat.Flow.SubFlow
testFinishedNum = 0;
VirtualBarCode.Reset();
}
bool binit = false;
public void Init()
{
if(binit)
{
return;
}
binit = true;
mainTask = new Task(Run);
mainTask.Start();
}
@ -125,7 +131,6 @@ namespace Rs.MotionPlat.Flow.SubFlow
{
run = false;
}
int takeNum = 0;
private void Run()
{
@ -139,7 +144,16 @@ namespace Rs.MotionPlat.Flow.SubFlow
switch (flowStep)
{
#region 料仓取料
case EFiveProductTestFlowStep.OK:
ThreePointLocationFlow.Instance.Location(ETrayType.Ok);
flowStep = EFiveProductTestFlowStep.;
break;
case EFiveProductTestFlowStep.:
//GlobalTray.InputTray.ChangeStatus(1, ESlotStatus.Have);
//GlobalTray.InputTray.ChangeStatus(2, ESlotStatus.Have);
//GlobalTray.InputTray.ChangeStatus(3, ESlotStatus.Have);
//GlobalTray.InputTray.ChangeStatus(4, ESlotStatus.Have);
//GlobalTray.InputTray.ChangeStatus(5, ESlotStatus.Have);
curTakeSlot = GlobalTray.InputTray.GetSlot(ESlotStatus.Have);
if (curTakeSlot != null)
{
@ -211,14 +225,15 @@ namespace Rs.MotionPlat.Flow.SubFlow
break;
case EFiveProductTestFlowStep.:
//获取空闲吸嘴
curTakeNozzle = NozzleManager.GetIdelNozzle();
//curTakeNozzle = NozzleManager.GetIdelNozzle();
curTakeNozzle = NozzleManager.GetNozzle(1);
if (curTakeNozzle != null)
{
targetPosition = NozzleManager.GetToTraySlot(ETrayType.Input, curTakeSlot.Index, curTakeNozzle.NozzleIndex);
if (curTakeNozzle != null)
{
targetPosition.X += vProductResult.OffsetX + offsetX;
targetPosition.Y2 += vProductResult.OffsetY +offsetY;
targetPosition.Y2 += vProductResult.OffsetY + offsetY;
if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed))
{
AxisPosPrint.PrintXY1Y2TargetPos("到料仓取料位上方,", targetPosition, GetClassName());
@ -289,7 +304,6 @@ namespace Rs.MotionPlat.Flow.SubFlow
case EFiveProductTestFlowStep.:
if (Ops.IsOn($"吸料真空{curTakeNozzle.NozzleIndex}检测") || GlobalVar.RunSpace)
{
takedNum++;
curTakeNozzle.Product = new TestProduct() { SN = "", FromSlotIndex = curTakeSlot.Index };
curTakeNozzle.Status = ENozzleStatus.ToUnload;
GlobalTray.NozzleTray.ChangeStatus(curTakeNozzle.NozzleIndex, ESlotStatus.Have);
@ -313,7 +327,8 @@ namespace Rs.MotionPlat.Flow.SubFlow
//料仓放料
case EFiveProductTestFlowStep.:
curDumpNozzle = NozzleManager.GetToUnloadNozzle();
//curDumpNozzle = NozzleManager.GetToUnloadNozzle();
curDumpNozzle = NozzleManager.GetNozzle(1);
if (curDumpNozzle != null)
{
//吸嘴放料,加测吸嘴上的产品的测试结果,决定把料放到哪个料仓
@ -393,17 +408,20 @@ namespace Rs.MotionPlat.Flow.SubFlow
case EFiveProductTestFlowStep.:
if (Ops.IsStop($"NozzleZ{curDumpNozzle.NozzleIndex}"))
{
logInfo = $"{GetClassName()}料仓放料完成已抬起";
MessageQueue.Instance.Insert(logInfo);
takedNum++;
if(takedNum<5)
curDumpNozzle.Status = ENozzleStatus.IDLE;
GlobalTray.OkTary.ChangeStatus(curDumpSlot.Index, ESlotStatus.Have);
if (takedNum < 5)
{
flowStep = EFiveProductTestFlowStep.;
}
else
{
run = false;
DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.Stock);
stop = true;
}
}
break;
@ -414,6 +432,19 @@ namespace Rs.MotionPlat.Flow.SubFlow
public void Start()
{
GlobalTray.InputTray.ChangeStatus(1, ESlotStatus.Have);
GlobalTray.InputTray.ChangeStatus(2, ESlotStatus.Have);
GlobalTray.InputTray.ChangeStatus(3, ESlotStatus.Have);
GlobalTray.InputTray.ChangeStatus(4, ESlotStatus.Have);
GlobalTray.InputTray.ChangeStatus(5, ESlotStatus.Have);
GlobalTray.OkTary.ChangeStatus(1, ESlotStatus.NotHave);
GlobalTray.OkTary.ChangeStatus(2, ESlotStatus.NotHave);
GlobalTray.OkTary.ChangeStatus(3, ESlotStatus.NotHave);
GlobalTray.OkTary.ChangeStatus(4, ESlotStatus.NotHave);
GlobalTray.OkTary.ChangeStatus(5, ESlotStatus.NotHave);
flowStep = EFiveProductTestFlowStep.OK;
takedNum = 0;
stop = false;
}
public void Stop()

@ -61,6 +61,12 @@
this.textBox2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.textBox4 = new System.Windows.Forms.TextBox();
this.button7 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@ -454,11 +460,75 @@
this.textBox3.Size = new System.Drawing.Size(100, 21);
this.textBox3.TabIndex = 34;
//
// button2
//
this.button2.Location = new System.Drawing.Point(280, 235);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(128, 52);
this.button2.TabIndex = 35;
this.button2.Text = "夹住料盘";
this.button2.UseVisualStyleBackColor = true;
this.button2.Visible = false;
this.button2.Click += new System.EventHandler(this.button2_Click_2);
//
// button3
//
this.button3.Location = new System.Drawing.Point(434, 235);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(128, 52);
this.button3.TabIndex = 35;
this.button3.Text = "松开料盘";
this.button3.UseVisualStyleBackColor = true;
this.button3.Visible = false;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(80, 555);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(198, 91);
this.button6.TabIndex = 36;
this.button6.Text = "button6";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click_1);
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(92, 493);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(100, 21);
this.textBox4.TabIndex = 34;
//
// button7
//
this.button7.Location = new System.Drawing.Point(322, 622);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(75, 23);
this.button7.TabIndex = 37;
this.button7.Text = "button7";
this.button7.UseVisualStyleBackColor = true;
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// button8
//
this.button8.Location = new System.Drawing.Point(434, 623);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(75, 23);
this.button8.TabIndex = 37;
this.button8.Text = "button7";
this.button8.UseVisualStyleBackColor = true;
//
// TestFrm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1336, 854);
this.Controls.Add(this.button8);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label4);
@ -513,5 +583,11 @@
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button8;
}
}

@ -251,6 +251,67 @@ namespace Rs.MotionPlat
private void button1_Click_2(object sender, EventArgs e)
{
FiveProductTestFlow.Instance.Init();
FiveProductTestFlow.Instance.Start();
}
private void button2_Click_2(object sender, EventArgs e)
{
//料仓夹磁气缸{0}夹|料仓夹磁气缸{0}开
IoManager.Instance.WriteOut("料仓夹磁气缸1关", 1);
Thread.Sleep(500);
IoManager.Instance.WriteOut("料仓夹磁气缸1开", 0);
//Ops.Off("料仓夹磁气缸1开");
//Thread.Sleep(500);
//Ops.On("料仓夹磁气缸1关");
//Thread.Sleep(500);
//Ops.On("料仓夹磁气缸2开");
//Thread.Sleep(100);
//Ops.Off("料仓夹磁气缸2关");
}
private void button3_Click(object sender, EventArgs e)
{
Ops.On("料仓夹磁气缸1开");
Thread.Sleep(500);
Ops.Off("料仓夹磁气缸1关");
Thread.Sleep(500);
//Ops.Off("料仓夹磁气缸2开");
//Thread.Sleep(500);
//Ops.On("料仓夹磁气缸2关");
}
bool bStop = false;
private void button6_Click_1(object sender, EventArgs e)
{
//for(int i=1;i<6;i++)
//{
//}
Task.Run(() => {
for(int j=0;j<20;j++)
{
for (int i = 1; i < 6; i++)
{
StockTakeFlow.Instance.Take(ETrayType.Input, i, 1);
DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.Stock);
StockPlaceFlow.Instance.Place(ETrayType.Input, i, 1);
}
}
});
}
private void button7_Click(object sender, EventArgs e)
{
}
}
}

Loading…
Cancel
Save