diff --git a/Rs.DeweyTester/Controls/UFixture.cs b/Rs.DeweyTester/Controls/UFixture.cs
index 2e85aaf..35d572b 100644
--- a/Rs.DeweyTester/Controls/UFixture.cs
+++ b/Rs.DeweyTester/Controls/UFixture.cs
@@ -54,7 +54,7 @@ namespace Rs.MotionPlat
string logFileName = "";
string regstr = tf.Index+"_(\\d{0,10}).txt";
//打印日志
- string logDir = $"d:\\log\\debug\\{DateTime.Now.ToString("yyyyMMdd")}";
+ string logDir = $"d:\\log\\communication\\{DateTime.Now.ToString("yyyyMMdd")}";
if (!Directory.Exists(logDir))
{
Directory.CreateDirectory(logDir);
diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs
index 6c1c602..b1edc71 100644
--- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs
+++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs
@@ -386,106 +386,122 @@ namespace Rs.MotionPlat.Flow
bool exit = false;
while (!exit)
{
- ProductLocationResult fixtureret = FixedGrabProductFlow.Instance.TakePicture(ETrayType.Input, ret.SlotIndex);
- if (fixtureret.Result == EOneGrabSixteenResult.Ok)
+ //先进行有无料判断
+ ProductLocationResult fixtureret = FixedGrabProductFlow.Instance.TakePicture(ETrayType.Input, ret.SlotIndex,1,true);
+ if (fixtureret.Result == EOneGrabSixteenResult.NoHaveProdut)
{
- if(fixtureret.SN.Length==GlobalVar.BarcodeLength)
- {
- ret.Change(fixtureret.SN, fixtureret.OffsetX, fixtureret.OffsetY);
- //takeSlotIndex++;
- StockTakeFlow.Instance.Take(ETrayType.Input, takeSlotIndex, NozzleManager.GetIdelNozzle().NozzleIndex);
- takeSlotIndex++;
- flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
- exit = true;
- }
- else
- {
- //报警弹框
- alarmEntity = AlarmCollection.Get(AlarmConstID.二维码长度异常报警).Transform(ret.SlotIndex);
- EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
- if (buttonSelect == EButtonType.Retry)
- {
- logInfo = GetClassName() + "选择了重试";
- MessageQueue.Instance.Insert(logInfo);
- }
- }
+ logInfo = GetClassName() + $"视觉检测到穴位{ret.SlotIndex}无料,自动跳过";
+ LogHelper.Debug(logInfo);
+ exit = true;
+ GlobalTray.InputTray.ChangeStatus(ret.SlotIndex, ESlotStatus.NotHave);
+ takeSlotIndex++;
+ flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
}
- else if (fixtureret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)
+ else if (fixtureret.Result == EOneGrabSixteenResult.Slant)
{
- Nozzle idleNozzle = NozzleManager.GetIdelNozzle();
- if(false)
+ logInfo = GetClassName() + $"视觉检测到穴位{ret.SlotIndex}有料";
+ LogHelper.Debug(logInfo);
+ fixtureret = FixedGrabProductFlow.Instance.TakePicture(ETrayType.Input, ret.SlotIndex);
+ if (fixtureret.Result == EOneGrabSixteenResult.Ok)
{
- StockTakeFlow.Instance.Take(ETrayType.Input, ret.SlotIndex, idleNozzle.NozzleIndex);
- //放料
- TraySlot noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
- if (noProductSlot != null)
+ if (fixtureret.SN.Length == GlobalVar.BarcodeLength)
{
- StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
+ ret.Change(fixtureret.SN, fixtureret.OffsetX, fixtureret.OffsetY);
+ //takeSlotIndex++;
+ StockTakeFlow.Instance.Take(ETrayType.Input, takeSlotIndex, NozzleManager.GetIdelNozzle().NozzleIndex);
+ takeSlotIndex++;
+ flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ exit = true;
}
else
{
- Msgbox.ShowTipDialog(EButtonType.Ok, "Retest tray full,please change tray and click ok button", "tip", true);
- GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave);
- ThreePointLocationFlow.Instance.Location(ETrayType.ReTest);
- //放料
- noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
- StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
+ //报警弹框
+ alarmEntity = AlarmCollection.Get(AlarmConstID.二维码长度异常报警).Transform(ret.SlotIndex);
+ EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
+ if (buttonSelect == EButtonType.Retry)
+ {
+ logInfo = GetClassName() + "选择了重试";
+ MessageQueue.Instance.Insert(logInfo);
+ }
}
- takeSlotIndex++;
- flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
- exit = true;
}
- else
+ else if (fixtureret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)
{
- StockTakeFlow.Instance.Take(ETrayType.Input, ret.SlotIndex, idleNozzle.NozzleIndex);
- if(NozzleManager.GetNozzle(idleNozzle.NozzleIndex).Product!=null)
+ Nozzle idleNozzle = NozzleManager.GetIdelNozzle();
+ if (false)
{
- NozzleManager.GetNozzle(idleNozzle.NozzleIndex).Product.SN = "SLK11111111PNK60X";
+ StockTakeFlow.Instance.Take(ETrayType.Input, ret.SlotIndex, idleNozzle.NozzleIndex);
+ //放料
+ TraySlot noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
+ if (noProductSlot != null)
+ {
+ StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
+ }
+ else
+ {
+ Msgbox.ShowTipDialog(EButtonType.Ok, "Retest tray full,please change tray and click ok button", "tip", true);
+ GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave);
+ ThreePointLocationFlow.Instance.Location(ETrayType.ReTest);
+ //放料
+ noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
+ StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
+ }
+ takeSlotIndex++;
+ flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ exit = true;
}
- takeSlotIndex++;
- exit = true;
- flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
- }
-
- }
- else if (fixtureret.Result == EOneGrabSixteenResult.Slant)
- {
- //报警弹框
- alarmEntity = AlarmCollection.Get(AlarmConstID.取料定位失败报警).Transform(ret.SlotIndex);
- EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, true);
- //EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, $"穴位{ret.SlotIndex}定位失败,请把产品手动取走后点击跳过","tip",true);
- if(buttonSelect== EButtonType.Retry)
- {
- logInfo = GetClassName() + "选择了重试";
- MessageQueue.Instance.Insert(logInfo);
- }
- else if (buttonSelect == EButtonType.Skip)
- {
- logInfo = GetClassName() + "选择了跳过";
- MessageQueue.Instance.Insert(logInfo);
- exit = true;
- GlobalTray.InputTray.ChangeStatus(ret.SlotIndex, ESlotStatus.NotHave);
- takeSlotIndex++;
- flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ else
+ {
+ StockTakeFlow.Instance.Take(ETrayType.Input, ret.SlotIndex, idleNozzle.NozzleIndex);
+ if (NozzleManager.GetNozzle(idleNozzle.NozzleIndex).Product != null)
+ {
+ NozzleManager.GetNozzle(idleNozzle.NozzleIndex).Product.SN = "SLK11111111PNK60X";
+ }
+ takeSlotIndex++;
+ exit = true;
+ flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ }
+
}
- else if (buttonSelect == EButtonType.EndInput)
+ else if (fixtureret.Result == EOneGrabSixteenResult.Slant)
{
- logInfo = GetClassName() + "选择了结束上料";
- MessageQueue.Instance.Insert(logInfo);
- exit = true;
- GlobalVar.Clear = true;
- takeSlotIndex++;
- flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ //报警弹框
+ alarmEntity = AlarmCollection.Get(AlarmConstID.取料定位失败报警).Transform(ret.SlotIndex);
+ EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, true);
+ //EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip | EButtonType.Retry | EButtonType.EndInput, $"穴位{ret.SlotIndex}定位失败,请把产品手动取走后点击跳过","tip",true);
+ if (buttonSelect == EButtonType.Retry)
+ {
+ logInfo = GetClassName() + "选择了重试";
+ MessageQueue.Instance.Insert(logInfo);
+ }
+ else if (buttonSelect == EButtonType.Skip)
+ {
+ logInfo = GetClassName() + "选择了跳过";
+ MessageQueue.Instance.Insert(logInfo);
+ exit = true;
+ GlobalTray.InputTray.ChangeStatus(ret.SlotIndex, ESlotStatus.NotHave);
+ takeSlotIndex++;
+ flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ }
+ else if (buttonSelect == EButtonType.EndInput)
+ {
+ logInfo = GetClassName() + "选择了结束上料";
+ MessageQueue.Instance.Insert(logInfo);
+ exit = true;
+ GlobalVar.Clear = true;
+ takeSlotIndex++;
+ flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ }
}
- }
- else if(fixtureret.Result== EOneGrabSixteenResult.NoHaveProdut)
- {
- logInfo =GetClassName()+ $"视觉检测到穴位{ret.SlotIndex}无料,自动跳过";
- exit = true;
- GlobalTray.InputTray.ChangeStatus(ret.SlotIndex, ESlotStatus.NotHave);
- takeSlotIndex++;
- flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ //else if (fixtureret.Result == EOneGrabSixteenResult.NoHaveProdut)
+ //{
+ // logInfo = GetClassName() + $"视觉检测到穴位{ret.SlotIndex}无料,自动跳过";
+ // exit = true;
+ // GlobalTray.InputTray.ChangeStatus(ret.SlotIndex, ESlotStatus.NotHave);
+ // takeSlotIndex++;
+ // flowStep = EDischargeFlowStep.判断是否需要从料仓取料;
+ //}
}
}
diff --git a/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs
index 7635923..06efcb0 100644
--- a/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs
+++ b/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs
@@ -268,10 +268,10 @@ namespace Rs.MotionPlat.Flow
}
break;
case EGrrFlowStep.料仓取料拍照:
- if(VisionHelper.oneGrabOneVision.ClearQueue())
+ if(VisionHelper.oneGrabOneVision.ClearQueue("C"))
{
UpCameraHelper.Grab();
- string msg = VisionHelper.OneGrabOne();//.Grab(EVisionScene.SingleScanBarcode);
+ string msg = VisionHelper.OneGrabOne("M");//.Grab(EVisionScene.SingleScanBarcode);
if(!string.IsNullOrEmpty(msg))
{
vProductResult.Parse(msg);
diff --git a/Rs.DeweyTester/Flow/SubFlow/FiveProductTestFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FiveProductTestFlow.cs
deleted file mode 100644
index e3d856e..0000000
--- a/Rs.DeweyTester/Flow/SubFlow/FiveProductTestFlow.cs
+++ /dev/null
@@ -1,517 +0,0 @@
-using Rs.Controls;
-using Rs.Framework;
-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;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Rs.MotionPlat.Flow.SubFlow
-{
- enum EFiveProductTestFlowStep
- {
- OK盘三点定位,
- 到料仓拍照位上方,
- 等待到料仓拍照位上方,
- 料仓取料拍照,
- 到料仓取料位上方,
- 等待到料仓取料位上方,
- 到料仓取料位下方,
- 等待到料仓取料位下方,
- 料仓取料完成抬起,
- 等待料仓取料完成抬起,
- 料仓取料真空吸检测,
-
-
- 到料仓放料位上方,
- 等待到料仓放料位上方,
- 到料仓放料位下方,
- 等待到料仓放料位下方,
- 料仓放料完成抬起,
- 等待料仓放料完成抬起,
- 料仓放料完成粘料检测
- }
-
- public class FiveProductTestFlow
- {
- private Task mainTask;
- private FiveProductTestFlow() { }
-
- private static FiveProductTestFlow instance;
- public static FiveProductTestFlow Instance
- {
- get
- {
- if (instance == null)
- {
- instance = new FiveProductTestFlow();
- }
- return instance;
- }
- }
- private AlarmEntity alarmEntity;
- Stopwatch timeout = new Stopwatch();
- EFiveProductTestFlowStep flowStep = EFiveProductTestFlowStep.OK盘三点定位;
-
- int scanNum = 0;
- string logInfo = string.Empty;
- string alarmInfo = string.Empty;
-
- private bool stop = true;
- private bool run = true;
- TargetPosition targetPosition = new TargetPosition();
- ErrorCode errCode = ErrorCode.Ok;
- ///
- /// 当前取料穴位
- ///
- TraySlot curTakeSlot = null;
- ///
- /// 当前取料穴位的点位
- ///
- SlotPoint curTakeSlotPoint = null;
- //Nozzle curNozzle = null;
- Nozzle curTakeNozzle = null;
- Nozzle curDumpNozzle = null;
- TestFixture curFixture = null;
- //放料穴位
- TraySlot curDumpSlot = null;
- ///
- /// 最后一次换料的治具编号
- ///
- private int lastFixtureIndex = 0;
- ///
- /// 已经取走的产品数量
- ///
- private int takedNum = 0;
- //相机拍照结果
- VisionResult vResult = new VisionResult();
- ProductLocationResult vProductResult = new ProductLocationResult();
-
- List needGrrFixtureList = new List();
- ///
- /// 测试完成的数量
- ///
- private int testFinishedNum = 0;
-
- private void Reset()
- {
- curTakeSlot = null;
- curTakeSlotPoint = null;
- curTakeNozzle = null;
- curDumpNozzle = null;
- curFixture = null;
- curDumpSlot = null;
- lastFixtureIndex = 0;
- takedNum = 0;
- testFinishedNum = 0;
- VirtualBarCode.Reset();
- }
- bool binit = false;
- public void Init()
- {
- if(binit)
- {
- return;
- }
- binit = true;
- mainTask = new Task(Run);
- mainTask.Start();
- }
-
- public void Deinit()
- {
- run = false;
- }
- int takeNum = 0;
- private void Run()
- {
- while (run)
- {
- if (stop)
- {
- Thread.Sleep(10);
- continue;
- }
- 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)
- {
- curTakeSlotPoint = TrayPointManager.GetSlotPoint(ETrayType.Input, curTakeSlot.Index);
- if (curTakeSlotPoint != null)
- {
- targetPosition.X = curTakeSlotPoint.X;
- targetPosition.Y1 = GlobalVar.StockSideY1;
- targetPosition.Y2 = curTakeSlotPoint.Y;
- //double curLoadX = Ops.GetCurPosition(AxisControl.LoadX);
- //if (curLoadX - GlobalVar.FixtureSafePosX > 50)
- //{
- // DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToStock);
- //}
- if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed, EGoWhichSide.StockSide))
- {
- AxisPosPrint.PrintXY1Y2TargetPos("轴loadx,loady1,loady2已停止运动,", targetPosition, GetClassName());
- flowStep = EFiveProductTestFlowStep.等待到料仓拍照位上方;
- }
- }
- }
- else
- {
- //没有料了,判断是否需要换料
- GlobalTray.GrabTray.ChangeStatus(ESlotStatus.Have);
- }
- break;
- case EFiveProductTestFlowStep.等待到料仓拍照位上方:
- if (Ops.IsStop("LoadX", "LoadY1", "LoadY2"))
- {
- AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName());
- if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
- {
- AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照位上方,", GetClassName());
- flowStep = EFiveProductTestFlowStep.料仓取料拍照;
- }
- else
- {
- flowStep = EFiveProductTestFlowStep.到料仓拍照位上方;
- }
- }
- break;
- case EFiveProductTestFlowStep.料仓取料拍照:
- UpCameraHelper.Grab();
- string msg = VisionHelper.OneGrabOne();//.Grab(EVisionScene.SingleScanBarcode);
- vProductResult.Parse(msg);
- if (vProductResult != null && (vProductResult.Result == EOneGrabSixteenResult.Ok || vProductResult.Result== EOneGrabSixteenResult.LocationOkScanBarcodeFail))
- {
- flowStep = EFiveProductTestFlowStep.到料仓取料位上方;
- }
- else if (vProductResult != null && vProductResult.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)
- {
- GrrScanFailFrm scanFail = new GrrScanFailFrm((act, qrcode) => {
- if (act == 1)
- {
- vProductResult.SN = qrcode;
- flowStep = EFiveProductTestFlowStep.到料仓取料位上方;
- }
- });
- scanFail.ShowDialog();
- //vProductResult.SN = VirtualBarCode.Code;
-
- }
- else
- {
- alarmEntity = AlarmCollection.Get(AlarmConstID.料仓取料拍照失败);
- Msgbox.ShowDialog(alarmEntity, EButtonType.Retry);
- }
- break;
- case EFiveProductTestFlowStep.到料仓取料位上方:
- //获取空闲吸嘴
- //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;
- if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed, EGoWhichSide.StockSide))
- {
- AxisPosPrint.PrintXY1Y2TargetPos("到料仓取料位上方,", targetPosition, GetClassName());
- flowStep = EFiveProductTestFlowStep.等待到料仓取料位上方;
- }
- }
- }
-
- break;
- case EFiveProductTestFlowStep.等待到料仓取料位上方:
- if (Ops.IsStop("LoadX", "LoadY1", "LoadY2") || GlobalVar.VirtualAxis)
- {
- AxisPosPrint.PrintXY1Y2CurrentPos("轴XY1Y2已停止运动,", GetClassName());
- if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
- {
- AxisPosPrint.PrintXY1Y2CurrentPos("已运动到等待到料仓取料位上方,", GetClassName());
- flowStep = EFiveProductTestFlowStep.到料仓取料位下方;
- }
- else
- {
- flowStep = EFiveProductTestFlowStep.到料仓取料位上方;
- }
- }
- break;
- case EFiveProductTestFlowStep.到料仓取料位下方:
- targetPosition.NozzleZ = NozzleManager.GetNozzleToTrayTakeProductPos(ETrayType.Input, curTakeNozzle.NozzleIndex);
- errCode = AxisControl.GetAxis($"NozzleZ{curTakeNozzle.NozzleIndex}").MovePos(targetPosition.NozzleZ, GlobalVar.WholeSpeed);
- if (errCode == ErrorCode.Ok)
- {
- logInfo = $"{GetClassName()}到料仓取料位下方";
- MessageQueue.Instance.Insert(logInfo);
- flowStep = EFiveProductTestFlowStep.等待到料仓取料位下方;
- }
- break;
- case EFiveProductTestFlowStep.等待到料仓取料位下方:
- if (Ops.IsStop($"NozzleZ{curTakeNozzle.NozzleIndex}"))
- {
- logInfo = $"{GetClassName()}已运动到料仓取料位下方";
- MessageQueue.Instance.Insert(logInfo);
- if (GlobalVar.RunSpace)
- {
- flowStep = EFiveProductTestFlowStep.料仓取料完成抬起;
- }
- else
- {
- Ops.On($"吸料真空{curTakeNozzle.NozzleIndex}吸");
- Thread.Sleep(100);
- flowStep = EFiveProductTestFlowStep.料仓取料完成抬起;
- }
- }
- break;
- case EFiveProductTestFlowStep.料仓取料完成抬起:
- if (NozzleManager.GotoSafePos(curTakeNozzle.NozzleIndex))
- {
- logInfo = $"{GetClassName()}料仓取料完成抬起";
- MessageQueue.Instance.Insert(logInfo);
- flowStep = EFiveProductTestFlowStep.等待料仓取料完成抬起;
- }
- break;
- case EFiveProductTestFlowStep.等待料仓取料完成抬起:
- if (Ops.IsStop($"NozzleZ{curTakeNozzle.NozzleIndex}"))
- {
- logInfo = $"{GetClassName()}料仓取料完成已抬起";
- MessageQueue.Instance.Insert(logInfo);
- flowStep = EFiveProductTestFlowStep.料仓取料真空吸检测;
- }
- break;
- case EFiveProductTestFlowStep.料仓取料真空吸检测:
- if (Ops.IsOn($"吸料真空{curTakeNozzle.NozzleIndex}检测") || GlobalVar.RunSpace)
- {
- curTakeNozzle.Product = new TestProduct() { SN = "", FromSlotIndex = curTakeSlot.Index };
- curTakeNozzle.Status = ENozzleStatus.ToUnload;
- GlobalTray.NozzleTray.ChangeStatus(curTakeNozzle.NozzleIndex, ESlotStatus.Have);
- GlobalTray.InputTray.ChangeStatus(curTakeSlot.Index, ESlotStatus.NotHave);
- logInfo = $"{GetClassName()}料仓{curTakeSlot.Index}号穴位取料完成真空检测OK,产品SN:{curTakeNozzle.Product.SN}被吸嘴{curTakeNozzle.NozzleIndex}取走";
- MessageQueue.Instance.Insert(logInfo);
- flowStep = EFiveProductTestFlowStep.到料仓放料位上方;
- }
- else
- {
- alarmEntity = AlarmCollection.Get(AlarmConstID.GRR取料失败报警);
- Msgbox.ShowDialog(alarmEntity, EButtonType.Retry);
- flowStep = EFiveProductTestFlowStep.到料仓取料位上方;
- }
- break;
- #endregion
-
-
-
-
- //料仓放料
-
- case EFiveProductTestFlowStep.到料仓放料位上方:
- //curDumpNozzle = NozzleManager.GetToUnloadNozzle();
- curDumpNozzle = NozzleManager.GetNozzle(1);
- if (curDumpNozzle != null)
- {
- //吸嘴放料,加测吸嘴上的产品的测试结果,决定把料放到哪个料仓
- //目前先都方到OK料仓
- //curDumpSlot = GlobalTray.GrrTray.GetSlot(ESlotStatus.NotHave);
- curDumpSlot = GlobalTray.OkTary.GetSlot(ESlotStatus.NotHave);
- if (curDumpSlot != null)
- {
- //double curLoadX = Ops.GetCurPosition(AxisControl.LoadX);
- //if (curLoadX - GlobalVar.FixtureSafePosX > 50)
- //{
- // DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToStock);
- //}
- targetPosition = NozzleManager.GetToTraySlot(ETrayType.Ok, curDumpSlot.Index, curDumpNozzle.NozzleIndex);
- if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed, EGoWhichSide.StockSide))
- {
- AxisPosPrint.PrintXY1Y2TargetPos("到料仓放料位上方,", targetPosition, GetClassName());
- flowStep = EFiveProductTestFlowStep.等待到料仓放料位上方;
- }
- }
- else
- {
- GlobalTray.GrrTray.ChangeStatus(ESlotStatus.NotHave);
- }
- }
- break;
- case EFiveProductTestFlowStep.等待到料仓放料位上方:
- if (Ops.IsStop("LoadX", "LoadY1", "LoadY2"))
- {
- AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName());
- if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
- {
- AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓放料位上方,", GetClassName());
- flowStep = EFiveProductTestFlowStep.到料仓放料位下方;
- }
- else
- {
- flowStep = EFiveProductTestFlowStep.到料仓放料位上方;
- }
- }
- break;
- case EFiveProductTestFlowStep.到料仓放料位下方:
- targetPosition.NozzleZ = NozzleManager.GetNozzleToTrayTakeProductPos(ETrayType.Ok, curDumpNozzle.NozzleIndex);
- if (NozzleManager.Go(curDumpNozzle, targetPosition.NozzleZ, GlobalVar.WholeSpeed))
- {
- logInfo = $"{GetClassName()}到料仓放料位下方";
- MessageQueue.Instance.Insert(logInfo);
- flowStep = EFiveProductTestFlowStep.等待到料仓放料位下方;
- }
- break;
- case EFiveProductTestFlowStep.等待到料仓放料位下方:
- if (Ops.IsStop($"NozzleZ{curDumpNozzle.NozzleIndex}"))
- {
- logInfo = $"{GetClassName()}已运动到料仓放料位下方";
- MessageQueue.Instance.Insert(logInfo);
- if (GlobalVar.RunSpace)
- {
- flowStep = EFiveProductTestFlowStep.料仓放料完成抬起;
- }
- else
- {
- curDumpNozzle.VacSuction(EIoOperate.Close, GetClassName());
- curDumpNozzle.VacBreak(EIoOperate.Open, GetClassName());
- curDumpNozzle.VacBreak(EIoOperate.Close, GetClassName());
- flowStep = EFiveProductTestFlowStep.料仓放料完成抬起;
- }
- }
- break;
- case EFiveProductTestFlowStep.料仓放料完成抬起:
- if (NozzleManager.GotoSafePos(curDumpNozzle.NozzleIndex))
- {
- logInfo = $"{GetClassName()}料仓放料完成抬起";
- MessageQueue.Instance.Insert(logInfo);
- flowStep = EFiveProductTestFlowStep.等待料仓放料完成抬起;
- }
- break;
- case EFiveProductTestFlowStep.等待料仓放料完成抬起:
- if (Ops.IsStop($"NozzleZ{curDumpNozzle.NozzleIndex}"))
- {
- logInfo = $"{GetClassName()}料仓放料完成已抬起";
- MessageQueue.Instance.Insert(logInfo);
- takedNum++;
- curDumpNozzle.Status = ENozzleStatus.IDLE;
- GlobalTray.OkTary.ChangeStatus(curDumpSlot.Index, ESlotStatus.Have);
-
- if (takedNum < 5)
- {
- flowStep = EFiveProductTestFlowStep.到料仓拍照位上方;
- }
- else
- {
- DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
- stop = true;
- }
- }
- break;
- }
- Thread.Sleep(5);
- }
- }
-
- 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()
- {
- stop = true;
- }
- private string GetClassName()
- {
- return "GrrFlow-";
- }
-
- private double offsetX = 0;
- private double offsetY = 0;
- public void SetOffset(double x,double y)
- {
- offsetX = x;
- offsetY = y;
- }
-
- ///
- /// 获取吸嘴取料取不起来时,吸嘴在原取料位的偏移
- /// 奇数向下偏移
- /// 偶数向上偏移
- ///
- ///
- ///
- private double GetVacOffsetHeight(int fetchNum)
- {
- if (fetchNum == 0) return 0;
- //先判断是奇数还是偶数
- int count = 0;
- int oddOrEven = fetchNum & 0x01;
-
- double offsetDisct = 0.0;
- if (oddOrEven == 1)
- {
- count = (fetchNum / 2) + 1;
- offsetDisct = -0.1 * count;
- }
-
- else if (oddOrEven == 0)
- {
- count = (fetchNum / 2);
- offsetDisct = 0.1 * count;
- }
- return offsetDisct;
- }
-
- public string GetCurStep()
- {
- return flowStep.ToString();
- }
-
- public void VirtualAxisSleep()
- {
- if (GlobalVar.VirtualAxis)
- {
- Thread.Sleep(GlobalVar.VirtualAxisMoveTime);
- }
- }
-
-
- private void GotoNextFixture()
- {
- lastFixtureIndex = ((lastFixtureIndex + 1) % needGrrFixtureList.Count);
- }
-
-
- }
-}
diff --git a/Rs.DeweyTester/Flow/SubFlow/FixedGrabProductFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixedGrabProductFlow.cs
index 3ee0e20..2885789 100644
--- a/Rs.DeweyTester/Flow/SubFlow/FixedGrabProductFlow.cs
+++ b/Rs.DeweyTester/Flow/SubFlow/FixedGrabProductFlow.cs
@@ -41,7 +41,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
bool finished = true;
EFixedGrabProductFlowStep step = EFixedGrabProductFlowStep.到拍照位上方;
- public ProductLocationResult TakePicture(ETrayType trayType,int slotInex,int grabNum=3)
+ public ProductLocationResult TakePicture(ETrayType trayType,int slotInex,int grabNum=3,bool hasProdcutCheck=false)
{
ProductLocationResult result = new ProductLocationResult()
{
@@ -119,43 +119,69 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
break;
case EFixedGrabProductFlowStep.相机拍照处理:
- VisionHelper.oneGrabOneVision.ClearQueue();
- UpCameraHelper.Grab();
- string msg = VisionHelper.OneGrabOne();
- result.Parse(msg);
- //VisionResult vResult = VisionHelper.Grab(EVisionScene.SingleScanBarcode);
- if ((result != null && result.Result== EOneGrabSixteenResult.Ok) || GlobalVar.RunSpace)
+ if(hasProdcutCheck)
{
- finished = true;
- if (GlobalVar.RunSpace)
+ VisionHelper.oneGrabOneVision.ClearQueue("C2");
+ UpCameraHelper.Grab();
+ string msg = VisionHelper.OneGrabOne("M2");
+ result.Parse(msg);
+ //VisionResult vResult = VisionHelper.Grab(EVisionScene.SingleScanBarcode);
+ if ((result != null && result.Result == EOneGrabSixteenResult.Ok) || GlobalVar.RunSpace)
{
- result = new ProductLocationResult() { Result= EOneGrabSixteenResult.Ok};
+ finished = true;
+ if (GlobalVar.RunSpace)
+ {
+ result = new ProductLocationResult() { Result = EOneGrabSixteenResult.Ok };
+ }
+ return result;
+ }
+ else
+ {
+ finished = true;
+ return result;
}
- return result;
}
else
{
- if(curGrabNum<=3)
+ VisionHelper.oneGrabOneVision.ClearQueue("C");
+ UpCameraHelper.Grab();
+ string msg = VisionHelper.OneGrabOne("M");
+ result.Parse(msg);
+ //VisionResult vResult = VisionHelper.Grab(EVisionScene.SingleScanBarcode);
+ if ((result != null && result.Result == EOneGrabSixteenResult.Ok) || GlobalVar.RunSpace)
{
- step = EFixedGrabProductFlowStep.到拍照位上方;
+ finished = true;
+ if (GlobalVar.RunSpace)
+ {
+ result = new ProductLocationResult() { Result = EOneGrabSixteenResult.Ok };
+ }
+ return result;
}
else
{
- AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.料仓取料拍照失败).Transform(grabSlot.Index);
- // EButtonType btn = Msgbox.ShowDialog(alarmEntity, EButtonType.Retry| EButtonType.Cancel);
- //if(btn== EButtonType.Retry)
- //{
- // curGrabNum = 1;
- // step = EFixedGrabProductFlowStep.到拍照位上方;
- //}
- //else if(btn== EButtonType.Cancel)
+ if (curGrabNum <= 3)
+ {
+ step = EFixedGrabProductFlowStep.到拍照位上方;
+ }
+ else
{
- finished=true;
- return result;
+ //AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.料仓取料拍照失败).Transform(grabSlot.Index);
+ // EButtonType btn = Msgbox.ShowDialog(alarmEntity, EButtonType.Retry| EButtonType.Cancel);
+ //if(btn== EButtonType.Retry)
+ //{
+ // curGrabNum = 1;
+ // step = EFixedGrabProductFlowStep.到拍照位上方;
+ //}
+ //else if(btn== EButtonType.Cancel)
+ {
+ finished = true;
+ return result;
+ }
}
+ curGrabNum++;
}
- curGrabNum++;
}
+
break;
}
diff --git a/Rs.DeweyTester/Properties/AssemblyInfo.cs b/Rs.DeweyTester/Properties/AssemblyInfo.cs
index 1c1e6d1..b6e6d00 100644
--- a/Rs.DeweyTester/Properties/AssemblyInfo.cs
+++ b/Rs.DeweyTester/Properties/AssemblyInfo.cs
@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
- [assembly: AssemblyVersion("20.25.24.1")]
+ [assembly: AssemblyVersion("20.25.25.1")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Rs.DeweyTester/Rs.DeweyTester.csproj b/Rs.DeweyTester/Rs.DeweyTester.csproj
index 5c98dfa..add7733 100644
--- a/Rs.DeweyTester/Rs.DeweyTester.csproj
+++ b/Rs.DeweyTester/Rs.DeweyTester.csproj
@@ -164,7 +164,6 @@
DataRecords.cs
-
diff --git a/Rs.DeweyTester/Vision/OneGrabOneVision.cs b/Rs.DeweyTester/Vision/OneGrabOneVision.cs
index 8b51351..d86bdfb 100644
--- a/Rs.DeweyTester/Vision/OneGrabOneVision.cs
+++ b/Rs.DeweyTester/Vision/OneGrabOneVision.cs
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
@@ -25,12 +26,12 @@ namespace Rs.MotionPlat.Vision
else
{
data = Encoding.ASCII.GetString(reciveBuffer.ToArray());
- MessageQueue.Instance.Insert(data);
- if (data == "M,0")
+ //MessageQueue.Instance.Insert(data);
+ if (Regex.IsMatch(data, "M\\d{0,1},0"))//data == "M,0")
{
MessageQueue.Instance.Insert("视觉收到拍照指令");
}
- else if (data == "C,0")
+ else if (Regex.IsMatch( data,"C\\d{0,1},0"))// == "C,0")
{
visionGrabEvent.Set();
MessageQueue.Instance.Insert($" >>> {data}");
@@ -71,10 +72,10 @@ namespace Rs.MotionPlat.Vision
}
}
- public bool ClearQueue(int timeout = 10000)
+ public bool ClearQueue(string cmd,int timeout = 10000)
{
visionGrabEvent.Reset();
- string content = $"C;";
+ string content = $"{cmd};";
int len = vNozzleCalib.Send(content);
//reciveData = true;
if (len > 0)
@@ -103,18 +104,19 @@ namespace Rs.MotionPlat.Vision
///
///
///
- public string OneGrabOne(int timeout = 10000)
+ public string OneGrabOne(string cmd,int timeout = 10000)
{
data = "";
result = null;
NozzleCalibReciveEvent.Reset();
- int len = vNozzleCalib.Send("M;");
+ int len = vNozzleCalib.Send($"{cmd};");
+ LogHelper.Debug($"<<< {cmd};len={len}");
if (len > 0)
{
if (NozzleCalibReciveEvent.WaitOne(timeout))
{
- MessageQueue.Instance.Insert($"收到视觉结果:{data}");
+ MessageQueue.Instance.Insert($">>> {data}");
return data;
}
else
diff --git a/Rs.DeweyTester/Vision/VisionHelper.cs b/Rs.DeweyTester/Vision/VisionHelper.cs
index d7bfd9b..555124d 100644
--- a/Rs.DeweyTester/Vision/VisionHelper.cs
+++ b/Rs.DeweyTester/Vision/VisionHelper.cs
@@ -85,9 +85,9 @@ namespace Rs.MotionPlat.Commom
}
- public static string OneGrabOne()
+ public static string OneGrabOne(string cmd)
{
- return oneGrabOneVision.OneGrabOne();
+ return oneGrabOneVision.OneGrabOne(cmd);
}
}
}