| | |
| | | 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 |
| | | { |
| | |
| | | compv = (double)fi.GetValue(opcConfig.compensationZ); |
| | | |
| | | batteryHeight[0] += compv; |
| | | } |
| | | |
| | | //batteryHeight[1] = 999.999; |
| | | |
| | | cellHeightResult = batteryHeight[0] >= opcConfig.standardHeightLimit.Min |
| | | && batteryHeight[0] <= opcConfig.standardHeightLimit.Max ? MeasureState.OK : MeasureState.NG; |
| | | } |
| | | |
| | | //batteryHeight[1] = 999.999; |
| | | else |
| | | { |
| | | cellHeightResult = MeasureState.NA; |
| | | } |
| | | |
| | | //保存高度图片 |
| | | 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) |
| | |
| | | // heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"_NG\" + tempFileName); |
| | | //} |
| | | |
| | | heightResult = cellHeightResult; |
| | | //保存产品及标准块高度图片 |
| | | //if (heightResult != MeasureState.OK) |
| | | //{ |
| | | |
| | | if (heightResult != MeasureState.OK) |
| | | { |
| | | // if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) |
| | | // { |
| | | // heightFileName=VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); |
| | | // } |
| | | // else |
| | | // { |
| | | // heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); |
| | | // } |
| | | |
| | | if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) |
| | | { |
| | | VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); |
| | | } |
| | | else |
| | | { |
| | | heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (opcConfig.IsSaveHeightOKImage||CommonUtil.DetectionOption == DetectionOption.doStandardBlock) |
| | | { |
| | | //} |
| | | //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) |
| | | if (CommonUtil.DetectionOption == DetectionOption.doStandardBlock) |
| | | { |
| | | VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"\" + tempFileName); |
| | | } |
| | | else |
| | | { |
| | | VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"_OK\" + tempFileName); |
| | | } |
| | | // { |
| | | // 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())); |