From 295d30b49f8aa674a14e828bd27e85573490c5c6 Mon Sep 17 00:00:00 2001 From: 820689062 <820689062@qq.com> Date: Wed, 24 Jul 2024 13:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E5=85=A5=E6=B5=81=E7=A8=8B=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HisenceYoloDetection/MainForm.cs | 70 ++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/HisenceYoloDetection/MainForm.cs b/HisenceYoloDetection/MainForm.cs index 987bcca..231911f 100644 --- a/HisenceYoloDetection/MainForm.cs +++ b/HisenceYoloDetection/MainForm.cs @@ -1328,11 +1328,7 @@ namespace HisenceYoloDetection xKNow = GetModeFromBar(OcrBar);//从数据库中查询到这个条码的四轴的值 - if (xKNow == null) - { - myLog("数据库没有条码匹配" + m_sKEYENCEBar, DateTime.Now); - // break; - } + if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$")) { @@ -1394,7 +1390,10 @@ namespace HisenceYoloDetection //Cam1.Snapshot(); MoveToP(5815, YPos, ZPos); melsecPLCTCPDriver.WriteInt("550", 0);//方行 - //Thread.Sleep(300);//洗衣机可能过不去 + + + + Thread.Sleep(1000);//洗衣机可能过不去 //if (xKNow != null) //{ @@ -1604,24 +1603,24 @@ namespace HisenceYoloDetection //melsecPLCTCPDriver.WriteInt("550", 0);//方行 //2第一次拍照 //if (IfCam2Triger) - { + //{ //根据条码数据库比对 _runHandleAfter.Reset(); - if (xKNow == null) - { - myLog("未匹配条码", DateTime.Now); - break; - } + //if (xKNow == null) + //{ + // myLog("未匹配条码", DateTime.Now); + // break; + //} - if (xKNow.OcrBar == null) - { - myLog("未匹配成功" + xKNow.OcrBar, DateTime.Now); - myLog("开始插入模板", DateTime.Now); - Insert_auto(true, Cam1ImgOne, m_sKEYENCEBar, 8974, 0, 0); + //if (xKNow.OcrBar == null) + //{ + // myLog("未匹配成功" + xKNow.OcrBar, DateTime.Now); + // myLog("开始插入模板", DateTime.Now); + // Insert_auto(true, Cam1ImgOne, m_sKEYENCEBar, 8974, 0, 0); - break; - } + // break; + //} string IOcrBAr = xKNow.OcrBar; //xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值 //这里改成和海信的对接需求 @@ -1647,10 +1646,10 @@ namespace HisenceYoloDetection - } + //} //相机1第二次拍照 // if (IfCam1TwoTriger && bBarTriger) - { + //{ //初始化板 Defet_OnDetectionDone(whiteMat, 1); @@ -1832,7 +1831,7 @@ namespace HisenceYoloDetection } - } + //} } @@ -1915,7 +1914,7 @@ namespace HisenceYoloDetection } - return XK_hisence; + return null; } @@ -2136,9 +2135,28 @@ namespace HisenceYoloDetection meachineState = MeachineState.machine_opening; TriggerCameral2();//光电触发拍照 根据SN获取型号 从数据库中得到块值 - ReadyDetect();//相机拍照后检测线程 - //ThreadPost();//相机拍照后获取当日的型号 - myLog("开启流程成功", DateTime.Now); + if (xKNow == null) + { + myLog("数据库没有条码匹配" + m_sKEYENCEBar, DateTime.Now); + myLog("开始插入模板", DateTime.Now); + Insert_auto(true, Cam1ImgOne, m_sKEYENCEBar, 8974, 0, 0); + Thread.Sleep(5000); + xKNow = GetModeFromBar(m_sKEYENCEBar); // 重新获取 + if(xKNow!=null) + { + myLog("插入模板成功!", DateTime.Now); + ReadyDetect();//相机拍照后检测线程 + } + + + } + else { + ReadyDetect();//相机拍照后检测线程 + + } + + //ThreadPost();//相机拍照后获取当日的型号 + myLog("开启流程成功", DateTime.Now); } private void RefeshData_Click(object sender, EventArgs e)