增加对重码的防呆,如果有重码则重扫,重扫3次后还有重码则报警

master
lhiven 1 year ago
parent 7ab3cb19d2
commit 82f304c4a9

@ -44,6 +44,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
}
int reTakePicNum = 0;
AlarmEntity alarmEntity = new AlarmEntity();
public void Grab(ETrayType trayType, int slotIndex)
{
@ -158,18 +159,53 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
break;
case EProductLocationFlowStep.:
string vmsg = VisionHelper.loadTakeProductVision.OneGrabSixteen(10000);
if(!string.IsNullOrEmpty(vmsg)&& vmsg.TrimEnd(new char[] { '#', ',' }).Split('#').Length==16)
if (GlobalVar.RunSpace)
{
OneGrabSixteenManager.Instance.ParseResult(vmsg, slotIndex);
reTakePicNum = 0;
finished = true;
}
else
{
alarmEntity = AlarmCollection.Get(AlarmConstID.);
Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true);
//Msgbox.ShowTipDialog(EButtonType.Retry, "一拍十六拍照失败,请处理后点击重试","grab fail",true);
flowStep = EProductLocationFlowStep.;
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)
{
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.;
}
}
break;
}

Loading…
Cancel
Save