diff --git a/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs b/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs index 9815ee2..9a26fd3 100644 --- a/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/ProductLocationFlow.cs @@ -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 snList = new List(); + 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; }