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 +++++++++++++++++++++++++++----------
SizeDetection.cs | 41 ++++++++++++-
2 files changed, 119 insertions(+), 36 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()));
diff --git a/SizeDetection.cs b/SizeDetection.cs
index 8bd934c..79e2658 100644
--- a/SizeDetection.cs
+++ b/SizeDetection.cs
@@ -290,6 +290,7 @@
tupleDictionary.Add("OUTPUT_RectArea", new HTuple());
tupleDictionary.Add("INPUT_Rect", rectROI);
tupleDictionary.Add("INPUT_RectThreshold", rectThreshold);
+ tupleDictionary.Add("INPUT_Type", CommonUtil.DetectionOption == DetectionOption.doStandardBlock ? 2 : 1);
#endregion
_tool.SetDictionary(tupleDictionary, imageDictionary);
@@ -411,15 +412,45 @@
if (lengthMeasureState == MeasureState.OK && widthMeasureState == MeasureState.OK)
{
- ms = MeasureState.OK;
- VisionDetect.SaveImageAs(hImage, CommonUtil.ScreenshotsDir + @"\" + tempFileName);
+ //ms = MeasureState.OK;
+ //VisionDetect.SaveImageAs(hImage, CommonUtil.ScreenshotsDir + @"\" + tempFileName);
VisionDetect.SaveImageAs(hImage, CommonUtil.ProductSizeImageDir + @"\" + tempFileName);
}
else
{
- ms = MeasureState.NG;
- fileName = VisionDetect.SaveImageAs(hImage, CommonUtil.ScreenshotsDir + @"_NG\" + tempFileName);
- VisionDetect.SaveImageAs(hImage, CommonUtil.ProductSizeImageDir + @"\" + tempFileName);
+ //if (btyLength >= MaxLength || btyLength <= MinLength)
+ //{
+ // lengthMeasureState = MeasureState.NA;
+ // ms = MeasureState.NA;
+ //}
+ //if (btyWidth >= MaxWidth || btyWidth <= MinWidth)
+ //{
+ // widthMeasureState = MeasureState.NA;
+ // ms = MeasureState.NA;
+ //}
+
+ //if (ms != MeasureState.NA)
+ //{
+ // if (!isNA)
+ // {
+ // ms = MeasureState.NG;
+ // fileName=VisionDetect.SaveImageAs(hImage, CommonUtil.ProductSizeImageDir + @"\" + tempFileName);
+ // }
+ // else
+ // {
+ // lengthMeasureState = MeasureState.NA;
+ // widthMeasureState = MeasureState.NA;
+ // ms = MeasureState.NA;
+ // fileName=VisionDetect.SaveImageAs(hImage, CommonUtil.ProductSizeImageDir + $"_{ms.ToString()}\\{ tempFileName}");
+ // }
+ //}
+
+
+
+
+ //ms = MeasureState.NG;
+ //fileName = VisionDetect.SaveImageAs(hImage, CommonUtil.ScreenshotsDir + @"_NG\" + tempFileName);
+ fileName = VisionDetect.SaveImageAs(hImage, CommonUtil.ProductSizeImageDir + @"\" + tempFileName);
}
}
--
Gitblit v1.8.0