| | |
| | | timeStr, CommonUtil.StepControl.ToString())); |
| | | |
| | | HObject hImage = null; |
| | | string tempFileName = ""; |
| | | try |
| | | { |
| | | Thread.Sleep(50); |
| | |
| | | { |
| | | return; |
| | | } |
| | | string tempFileName = GetCurrentProductSN(detectID); |
| | | tempFileName = GetCurrentProductSN(detectID); |
| | | string productNo = GetProductNo(detectID); |
| | | |
| | | int times = 3; |
| | |
| | | } |
| | | else |
| | | { |
| | | Type t = opcConfig.standardCompensationL.GetType(); |
| | | Type t = opcConfig.compensationL.GetType(); |
| | | FieldInfo fi = t.GetField(string.Format("station{0}", CommonUtil.mainForm.PlateID)); |
| | | compL = (double)fi.GetValue(opcConfig.standardCompensationL); |
| | | compL = (double)fi.GetValue(opcConfig.compensationL); |
| | | |
| | | t = opcConfig.standardCompensationW.GetType(); |
| | | t = opcConfig.compensationW.GetType(); |
| | | fi = t.GetField(string.Format("station{0}", CommonUtil.mainForm.PlateID)); |
| | | compW = (double)fi.GetValue(opcConfig.standardCompensationW); |
| | | compW = (double)fi.GetValue(opcConfig.compensationW); |
| | | |
| | | btyLength += compL; |
| | | btyWidth += compW; |
| | |
| | | if (lengthMeasureState == MeasureState.OK && widthMeasureState == MeasureState.OK) |
| | | { |
| | | ms = MeasureState.OK; |
| | | //VisionDetect.SaveImageAs(hImage, CommonUtil.ScreenshotsDir + @"\" + tempFileName); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | catch (Exception ex) |
| | | { |
| | | CommonUtil.WriteLog(LogType.Exc, string.Format("产品尺寸检测出现异常:{0}", ex.Message)); |
| | | fileName = VisionDetect.SaveImageAs(hImage, $"{CommonUtil.ProductSizeImageDir}_NA\\{tempFileName}"); |
| | | } |
| | | finally |
| | | { |
| | |
| | | { |
| | | GregorianCalendar gc = new GregorianCalendar(); |
| | | int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday); |
| | | |
| | | var weekPlusStr = ConfigurationManager.AppSettings["WeekPlus"]; |
| | | int weekPlus = 0; |
| | | if (!int.TryParse(weekPlusStr, out weekPlus)) |
| | | { |
| | | weekPlus = 0; |
| | | } |
| | | weekOfYear += weekPlus; |
| | | string week = weekOfYear.ToString().Length == 1 ? "0" + weekOfYear.ToString() : weekOfYear.ToString(); |
| | | |
| | | var yearPlusStr = ConfigurationManager.AppSettings["YearPlus"]; |
| | | int yearPlus = 0; |
| | | if (!int.TryParse(yearPlusStr, out yearPlus)) |
| | | { |
| | | yearPlus = 0; |
| | | } |
| | | string year = dt.Year.ToString().Substring(dt.Year.ToString().Length - 1, 1); |
| | | year = (int.Parse(year) + yearPlus).ToString(); |
| | | |
| | | return year + week; |
| | | } |
| | | } |