|
|
|
@ -7,6 +7,7 @@ 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.Tasks;
|
|
|
|
@ -52,6 +53,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
finished = false;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
Stopwatch stopwatch = Stopwatch.StartNew();
|
|
|
|
|
flowStep = EProductLocationFlowStep.到料仓拍照起始位;
|
|
|
|
|
string logInfo = string.Empty;
|
|
|
|
|
TargetPosition targetPosition = new TargetPosition();
|
|
|
|
@ -148,6 +150,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
|
|
|
|
|
{
|
|
|
|
|
AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照结束位,", GetClassName());
|
|
|
|
|
stopwatch.Restart();
|
|
|
|
|
flowStep = EProductLocationFlowStep.拍照结果处理;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -166,38 +169,56 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
string vmsg = VisionHelper.loadTakeProductVision.OneGrabSixteen(10000);
|
|
|
|
|
string[] msgs = vmsg.Split(new string[] { "#," }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(vmsg)&& vmsg.TrimEnd(new char[] { '#', ',' }).Split('#').Length==16)
|
|
|
|
|
if (!string.IsNullOrEmpty(vmsg) && msgs.Length == 16)
|
|
|
|
|
if (stopwatch.ElapsedMilliseconds<10000)
|
|
|
|
|
{
|
|
|
|
|
List<string> snList = new List<string>();
|
|
|
|
|
foreach (string msg in msgs)
|
|
|
|
|
if (VisionHelper.loadTakeProductVision.Num == 16)
|
|
|
|
|
{
|
|
|
|
|
string[] items = msg.Split(new char[] { ',' });
|
|
|
|
|
if (items[1] == "0")
|
|
|
|
|
string vmsg = VisionHelper.loadTakeProductVision.OneGrabSixteen(10000);
|
|
|
|
|
if(vmsg != null)
|
|
|
|
|
{
|
|
|
|
|
snList.Add(items[2]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (snList.GroupBy(a => a).Where(k => k.Count() >= 2).Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
reTakePicNum = 0;
|
|
|
|
|
OneGrabSixteenManager.Instance.ParseResult(vmsg, slotIndex);
|
|
|
|
|
finished = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Duplicate barcode");
|
|
|
|
|
reTakePicNum++;
|
|
|
|
|
if (reTakePicNum > 4)
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowTipDialog(EButtonType.Retry, "Duplicate barcode alarm", "alarm", true);
|
|
|
|
|
reTakePicNum = 0;
|
|
|
|
|
string[] msgs = vmsg.Split(new string[] { "#," }, StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(vmsg)&& vmsg.TrimEnd(new char[] { '#', ',' }).Split('#').Length==16)
|
|
|
|
|
if (!string.IsNullOrEmpty(vmsg) && msgs.Length == 16)
|
|
|
|
|
{
|
|
|
|
|
List<string> snList = new List<string>();
|
|
|
|
|
foreach (string msg in msgs)
|
|
|
|
|
{
|
|
|
|
|
string[] items = msg.Split(new char[] { ',' });
|
|
|
|
|
if (items[1] == "0")
|
|
|
|
|
{
|
|
|
|
|
snList.Add(items[2]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (snList.GroupBy(a => a).Where(k => k.Count() >= 2).Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
reTakePicNum = 0;
|
|
|
|
|
OneGrabSixteenManager.Instance.ParseResult(vmsg, slotIndex);
|
|
|
|
|
finished = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageQueue.Instance.Warn("Duplicate barcode");
|
|
|
|
|
reTakePicNum++;
|
|
|
|
|
if (reTakePicNum > 4)
|
|
|
|
|
{
|
|
|
|
|
Msgbox.ShowTipDialog(EButtonType.Retry, "Duplicate barcode alarm", "alarm", true);
|
|
|
|
|
reTakePicNum = 0;
|
|
|
|
|
}
|
|
|
|
|
flowStep = EProductLocationFlowStep.到料仓拍照起始位;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
alarmEntity = AlarmCollection.Get(AlarmConstID.一拍十六拍照失败报警);
|
|
|
|
|
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
|
|
|
|
|
//Msgbox.ShowTipDialog(EButtonType.Retry, "一拍十六拍照失败,请处理后点击重试","grab fail",true);
|
|
|
|
|
flowStep = EProductLocationFlowStep.到料仓拍照起始位;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
flowStep = EProductLocationFlowStep.到料仓拍照起始位;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -206,6 +227,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
|
|
|
|
|
//Msgbox.ShowTipDialog(EButtonType.Retry, "一拍十六拍照失败,请处理后点击重试","grab fail",true);
|
|
|
|
|
flowStep = EProductLocationFlowStep.到料仓拍照起始位;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|