patrick.xu
2021-06-02 58493dff9629a168168b63fa0c08f7b2a9cb1ad0
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()));
                    }