From 82f304c4a93fc53b55c805ba8ad4a3c46a263202 Mon Sep 17 00:00:00 2001 From: lhiven Date: Wed, 4 Sep 2024 09:25:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E9=87=8D=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E9=98=B2=E5=91=86=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=9C=89?= =?UTF-8?q?=E9=87=8D=E7=A0=81=E5=88=99=E9=87=8D=E6=89=AB=EF=BC=8C=E9=87=8D?= =?UTF-8?q?=E6=89=AB3=E6=AC=A1=E5=90=8E=E8=BF=98=E6=9C=89=E9=87=8D?= =?UTF-8?q?=E7=A0=81=E5=88=99=E6=8A=A5=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Flow/SubFlow/ProductLocationFlow.cs | 50 ++++++++++++++++--- 1 file changed, 43 insertions(+), 7 deletions(-) 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; }