From 58493dff9629a168168b63fa0c08f7b2a9cb1ad0 Mon Sep 17 00:00:00 2001 From: patrick.xu <patrick.xu@broconcentric.com> Date: 星期三, 02 六月 2021 18:02:51 +0800 Subject: [PATCH] 1. 添加高度OK图片保存开关和动作 --- HeightDetection.cs | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-) diff --git a/HeightDetection.cs b/HeightDetection.cs index c237cda..2df4a4a 100644 --- a/HeightDetection.cs +++ b/HeightDetection.cs @@ -125,7 +125,10 @@ CommonUtil.mainForm.Invoke(new Action(() => CommonUtil.mainForm.AppendDetectionData(productNo))); int detectID = CommonUtil.StepControl.GetDetectHeightID(); - string tempFileName = CommonUtil.mainForm.PlateID.ToString() + "_" + productNo.Trim().Replace("/", "").Replace("\"", "'") + "_" + DateTime.Now.ToString("HHmmssff") + "_" + detectID.ToString(); + + int slotNum = (CommonUtil.mainForm.PlateID + 1) % 5 + 1; + + string tempFileName = slotNum.ToString() + "_" + productNo.Trim().Replace("/", "").Replace("\"", "'") + "_" + DateTime.Now.ToString("HHmmssff") + "_" + detectID.ToString(); if (productNo.Trim().Length == CommonUtil.ProductNoLength) { string productNoFileName = CommonUtil.ProductNoImageDir + @"\" + productNo + "_" + detectID.ToString(); @@ -165,7 +168,7 @@ double compv = 0.0; Type t = opcConfig.compensationZ.GetType(); - int slotNum = (CommonUtil.mainForm.PlateID + 1) % 5 + 1; + FieldInfo fi = t.GetField(string.Format("station{0}", slotNum)); compv = (double)fi.GetValue(opcConfig.compensationZ); @@ -227,6 +230,20 @@ { heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); } + else + { + if (opcConfig.IsSaveHeightOKImage) + { + //DateTime dt = DateTime.Now; + + //if (dt.Second >= 10 && dt.Second <= 15) + { + 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