You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
257 lines
8.6 KiB
C#
257 lines
8.6 KiB
C#
using gts;
|
|
using NPOI.SS.Formula.Functions;
|
|
using Rs.Controls;
|
|
using Rs.Framework;
|
|
using Rs.Motion;
|
|
using Rs.MotionPlat.Commom;
|
|
using Rs.MotionPlat.Entitys;
|
|
using Rs.MotionPlat.Flow;
|
|
using Rs.MotionPlat.Flow.Common;
|
|
using Rs.MotionPlat.Flow.NormalFlow;
|
|
using Rs.MotionPlat.Flow.SafePosFlow;
|
|
using Rs.MotionPlat.Flow.SubFlow;
|
|
using Rs.MotionPlat.Vision;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.IO.Ports;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Rs.MotionPlat
|
|
{
|
|
public partial class TestFrm : BaseForm
|
|
{
|
|
public TestFrm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
VisionHelper.Grab(Vision.EVisionScene.NozzleCalib);
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
ThreePointLocationFlow.Instance.Location(ETrayType.Ng);
|
|
}
|
|
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
VisionHelper.OneGrabFour();
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
TestFixture tf = TestFixtureManager.Instance.GetTestFixture(1);
|
|
}
|
|
|
|
|
|
private void button15_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void button16_Click(object sender, EventArgs e)
|
|
{
|
|
Msgbox.ShowTipDialog(EButtonType.Retry, "fasd");
|
|
}
|
|
|
|
private void button17_Click(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() => {
|
|
Msgbox.Show("test", EButtonType.Retry);
|
|
//MethodInvoker ink = new MethodInvoker(() => {
|
|
// TestFrm f = new TestFrm();
|
|
// f.Show();
|
|
//});
|
|
//BeginInvoke(ink);
|
|
});
|
|
|
|
|
|
}
|
|
|
|
private void button18_Click(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() => {
|
|
TestFixtureManager.Instance.GetTestFixture(1).StartTest();
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void button22_Click(object sender, EventArgs e)
|
|
{
|
|
AxisControl.LoadY2.ComparePulse(1, false);
|
|
}
|
|
|
|
bool stop = false;
|
|
private void button24_Click(object sender, EventArgs e)
|
|
{
|
|
int step = 0;
|
|
|
|
int num = 0;
|
|
Task.Run(() => {
|
|
TargetPosition targetPos = new TargetPosition();
|
|
while (true)
|
|
{
|
|
if(stop)
|
|
{
|
|
Thread.Sleep(100);
|
|
continue;
|
|
}
|
|
switch (step)
|
|
{
|
|
case 0:
|
|
num++;
|
|
if(num%2==0)
|
|
{
|
|
//targetPos.X = GlobalVar.Fixture5GrabImageX;// 831;
|
|
targetPos.X = 930;// GlobalVar.Fixture4GrabImageX;// 831;
|
|
targetPos.Y1 = GlobalVar.FixtureSideY1;
|
|
targetPos.Y2 = -320.256;
|
|
}
|
|
else
|
|
{
|
|
//targetPos.X = GlobalVar.Fixture5GrabImageX;// 831;
|
|
targetPos.X = 300;// GlobalVar.Fixture4GrabImageX;// 831;
|
|
targetPos.Y1 = GlobalVar.FixtureSideY1;
|
|
targetPos.Y2 = -329.256;
|
|
}
|
|
if (GroupAxisMove.XY1Y2MovePos(targetPos, GlobalVar.WholeSpeed))
|
|
{
|
|
step++;
|
|
}
|
|
break;
|
|
case 1:
|
|
if(Ops.IsStop("LoadX", "LoadY1", "LoadY2"))
|
|
{
|
|
step++;
|
|
}
|
|
break;
|
|
case 2:
|
|
targetPos.X = GlobalVar.Fixture5GrabImageX;
|
|
targetPos.Y1 = GlobalVar.FixtureSideY1;
|
|
targetPos.Y2 = GlobalVar.Fixture5GrabImageY2;
|
|
if (GroupAxisMove.XY1Y2MovePos(targetPos, GlobalVar.WholeSpeed))
|
|
{
|
|
step++;
|
|
}
|
|
break;
|
|
case 3:
|
|
if (Ops.IsStop("LoadX", "LoadY1", "LoadY2"))
|
|
{
|
|
if(AxisArrived.LoadXY1Y2IsArrived(targetPos.X,targetPos.Y1,targetPos.Y2))
|
|
{
|
|
Thread.Sleep(100);
|
|
string logInfo = $"x:{Ops.GetCurPosition(AxisControl.LoadX)},y1:{Ops.GetCurPosition(AxisControl.LoadY1)},y2:{Ops.GetCurPosition(AxisControl.LoadY2)}";
|
|
MessageQueue.Instance.Insert(logInfo);
|
|
step++;
|
|
}
|
|
//Thread.Sleep(1000);
|
|
|
|
}
|
|
break;
|
|
case 4:
|
|
UpCameraHelper.Grab();
|
|
VisionResult vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct);
|
|
if(vr != null && vr.Result)
|
|
{
|
|
step = 0;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
private void button1_Click_1(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() => {
|
|
FixtureTakeFlow.Instance.Take(5, 1, true);
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
|
|
});
|
|
}
|
|
|
|
private void button2_Click_1(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() => {
|
|
FixturePlaceFlow.Instance.Place(5, 1,true);
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
|
|
});
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
AxisControl.LoadY2.ComparePulse(1, false);
|
|
}
|
|
|
|
static bool bContinueGrab = false;
|
|
private void button5_Click_1(object sender, EventArgs e)
|
|
{
|
|
bContinueGrab=!bContinueGrab;
|
|
if(bContinueGrab)
|
|
{
|
|
Task.Run(() => {
|
|
while (bContinueGrab)
|
|
{
|
|
AxisControl.LoadY2.ComparePulse(1, false);
|
|
Thread.Sleep(500);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
private void button11_Click(object sender, EventArgs e)
|
|
{
|
|
int.TryParse(this.comboBox1.SelectedItem.ToString(), out int fixtureIndex);
|
|
TestFixtureManager.Instance.GetTestFixture(fixtureIndex).StartTest(this.textBox1.Text);
|
|
}
|
|
|
|
private void button13_Click(object sender, EventArgs e)
|
|
{
|
|
Task.Run(() => {
|
|
|
|
foreach (Control item in groupBox1.Controls)
|
|
{
|
|
if(item is RadioButton)
|
|
{
|
|
if(((RadioButton)item).Checked)
|
|
{
|
|
int index = (int.Parse(item.Text)-1)*16+1;
|
|
ProductLocationFlow.Instance.Grab(ETrayType.Input, index);
|
|
ProductLocationResult[] productLocationResult = OneGrabSixteenManager.Instance.GetResults();
|
|
if (productLocationResult != null)
|
|
{
|
|
//foreach (ProductLocationResult item in productLocationResult)
|
|
//{
|
|
// string msg = $"{item.SlotIndex},{item.Result}\r\n";
|
|
// File.AppendAllText("d://flyresult.csv", msg);
|
|
//}
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
private void button1_Click_2(object sender, EventArgs e)
|
|
{
|
|
FiveProductTestFlow.Instance.Init();
|
|
}
|
|
}
|
|
}
|