From 9bc010fc2b51ff02d1f7d09accc2847e3d925777 Mon Sep 17 00:00:00 2001 From: jace.tang <1536884497@qq.com> Date: 星期五, 17 六月 2022 11:00:01 +0800 Subject: [PATCH] 1.获取高度结果的判断流程修改 --- HeightDetection.cs | 114 +++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 83 insertions(+), 31 deletions(-) diff --git a/HeightDetection.cs b/HeightDetection.cs index 415b929..4f80516 100644 --- a/HeightDetection.cs +++ b/HeightDetection.cs @@ -192,6 +192,31 @@ cellHeightResult = MeasureState.NA; } #endregion + + //淇濆瓨楂樺害鍥剧墖 + if (cellHeightResult == MeasureState.OK) + { + heightResult = MeasureState.OK; + DateTime dt = DateTime.Now; + if (dt.Second >= 10 && dt.Second <= 15) + { + heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); + } + + } + else if (cellHeightResult == MeasureState.NG) + { + heightResult = MeasureState.NG; + heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); + } + else + { + heightResult = MeasureState.NA; + heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); + } + + + } else { @@ -203,15 +228,40 @@ compv = (double)fi.GetValue(opcConfig.compensationZ); batteryHeight[0] += compv; + + cellHeightResult = batteryHeight[0] >= opcConfig.standardHeightLimit.Min + && batteryHeight[0] <= opcConfig.standardHeightLimit.Max ? MeasureState.OK : MeasureState.NG; } //batteryHeight[1] = 999.999; + else + { + cellHeightResult = MeasureState.NA; + } - cellHeightResult = batteryHeight[0] >= opcConfig.standardHeightLimit.Min - && batteryHeight[0] <= opcConfig.standardHeightLimit.Max ? MeasureState.OK : MeasureState.NG; + //淇濆瓨楂樺害鍥剧墖 + if (cellHeightResult == MeasureState.OK) + { + heightResult = MeasureState.OK; + heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); + } + else if (cellHeightResult == MeasureState.NG) + { + heightResult = MeasureState.NG; + heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); + } + else + { + heightResult = MeasureState.NA; + heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); + } + + + } timeStr = DateTime.Now.ToString("hh:mm:ss fff"); + heightResult = cellHeightResult; //淇濆瓨楂樺害鍥剧墖 //if (cellHeightResult == MeasureState.OK) @@ -225,39 +275,41 @@ // heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"_NG\" + tempFileName); //} - heightResult = cellHeightResult; - - if (heightResult != MeasureState.OK) - { + //淇濆瓨浜у搧鍙婃爣鍑嗗潡楂樺害鍥剧墖 + //if (heightResult != MeasureState.OK) + //{ - if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) - { - VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); - } - else - { - heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); - } + // if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) + // { + // heightFileName=VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); + // } + // else + // { + // heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); + // } - } - else - { - if (opcConfig.IsSaveHeightOKImage||CommonUtil.DetectionOption == DetectionOption.doStandardBlock) - { - //DateTime dt = DateTime.Now; - //if (dt.Second >= 10 && dt.Second <= 15) - if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) - { - VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); - } - else - { - VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"_OK\" + tempFileName); - } + //} + //else + //{ + // if (opcConfig.IsSaveHeightOKImage||CommonUtil.DetectionOption == DetectionOption.doStandardBlock) + // { + // if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) + // { + // heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); + // } + // else + // { + // DateTime dt = DateTime.Now; + // if (dt.Second >= 10 && dt.Second <= 15) + // { + // heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"_OK\" + tempFileName); + // } + + // } - } + // } - } + //} CommonUtil.WriteLog(LogType.Inf, string.Format("楂樺害妫�娴嬪畬鎴�,缁撴灉锛歿0} H:{1:F4}, {2:F4}, {3}, {4}", productNo, batteryHeight[0], batteryHeight[1], timeStr, CommonUtil.StepControl.ToString())); -- Gitblit v1.8.0