| @@ -409,9 +409,9 @@ namespace MaiMuAOI.ImageProcessing | |||
| stopwatch.Start(); | |||
| IDisposableReadOnlyCollection<DisposableNamedOnnxValue>[] results = yolo2.RunModlel(_onnxSession2, task.tensors); | |||
| liStep = 1; | |||
| //if (task.modelType == "rj") | |||
| // task.informationList = yolo2.ScreeningResults_YD_RJ(results, task.bmps_resize, task.thresholds, task.thresholdsClass, task.recAreaThreshold); | |||
| //else | |||
| if (task.modelType == "rj") | |||
| task.informationList = yolo2.ScreeningResults_YD_RJ(results, task.bmps_resize, task.thresholds, task.thresholdsClass, task.recAreaThreshold); | |||
| else | |||
| task.informationList = yolo2.ScreeningResults_YD(results, task.bmps_resize, task.thresholds, task.thresholdsClass, task.recAreaThreshold); | |||
| liStep = 2; | |||
| @@ -488,9 +488,9 @@ namespace MaiMuAOI.ImageProcessing | |||
| stopwatch.Start(); | |||
| IDisposableReadOnlyCollection<DisposableNamedOnnxValue>[] results = yolo3.RunModlel(_onnxSession3, task.tensors); | |||
| liStep = 1; | |||
| //if(task.modelType == "rj") | |||
| // task.informationList = yolo3.ScreeningResults_YD_RJ(results, task.bmps_resize, task.thresholds, task.thresholdsClass, task.recAreaThreshold); | |||
| //else | |||
| if(task.modelType == "rj") | |||
| task.informationList = yolo3.ScreeningResults_YD_RJ(results, task.bmps_resize, task.thresholds, task.thresholdsClass, task.recAreaThreshold); | |||
| else | |||
| task.informationList = yolo3.ScreeningResults_YD(results, task.bmps_resize, task.thresholds, task.thresholdsClass, task.recAreaThreshold); | |||
| liStep = 2; | |||
| @@ -1489,9 +1489,13 @@ namespace MaiMuAOI | |||
| #region 料号和产品编码选择 | |||
| private void txtProductCode_DoubleClick(object sender, EventArgs e) | |||
| { | |||
| string pdtName = SysMgr.Instance.SelectProduct(); | |||
| if (!string.IsNullOrWhiteSpace(pdtName)) | |||
| this.cbProductCode.Text = pdtName; | |||
| try | |||
| { | |||
| string pdtName = SysMgr.Instance.SelectProduct(); | |||
| if (!string.IsNullOrWhiteSpace(pdtName)) | |||
| this.cbProductCode.Text = pdtName; | |||
| } | |||
| catch { } | |||
| } | |||
| private void txtProductCode_TextChanged(object sender, EventArgs e) | |||
| @@ -1517,14 +1521,17 @@ namespace MaiMuAOI | |||
| private void LoadPdtList(List<string> list) | |||
| { | |||
| this.cbProductCode.Items.Clear(); | |||
| this.pdtlistData = list.ToArray(); | |||
| cbProductCode.Items.AddRange(pdtlistData);//比使用DataSource速度要快一些 | |||
| cbProductCode.TextUpdate += cobList_TextUpdate;//重新绑定事件 | |||
| cbProductCode.KeyDown += CobList_KeyDown; | |||
| this.cbProductCode.Text = ""; | |||
| cbProductCode.Focus(); | |||
| cbProductCode.SelectAll(); | |||
| try | |||
| { | |||
| this.cbProductCode.Items.Clear(); | |||
| this.pdtlistData = list.ToArray(); | |||
| cbProductCode.Items.AddRange(pdtlistData);//比使用DataSource速度要快一些 | |||
| cbProductCode.TextUpdate += cobList_TextUpdate;//重新绑定事件 | |||
| cbProductCode.KeyDown += CobList_KeyDown; | |||
| this.cbProductCode.Text = ""; | |||
| cbProductCode.Focus(); | |||
| cbProductCode.SelectAll(); | |||
| }catch { } | |||
| } | |||
| private void LoadSNList(List<string> list) | |||
| @@ -3210,6 +3210,7 @@ namespace MaiMuAOI.SysCtrl | |||
| { | |||
| try | |||
| { | |||
| #region 工序加载 | |||
| //记录当前index | |||
| this.CurrProcessIndex = stepIndex; | |||
| OnAutoRuning(new RunEventArgs(stepIndex)); | |||
| @@ -3252,7 +3253,7 @@ namespace MaiMuAOI.SysCtrl | |||
| else | |||
| Log($"{stepIndex + 1}-{processName}", $"使用 高级流程 默认配方:{jsonParams}"); | |||
| } | |||
| #endregion | |||
| //加载工序参数 | |||
| JObject processParam = JObject.Parse(jsonParams); | |||
| TestCnt = 0; | |||
| @@ -4358,7 +4359,7 @@ namespace MaiMuAOI.SysCtrl | |||
| OnAutoRuning(new RunEventArgs(liStatocStepIndex, | |||
| $"源图索引:{res.index},缺陷数:{res.defectCount},处理时间(ms):{string.Join("->", res.stopwatch.Select(i => i.ToString()).ToArray())}")); | |||
| Log($"{res.stepIndex + 1}-{res.processName}", $"缺陷检测完成(源图索引:{res.index}),缺陷数:{res.defectCount},处理时间(ms):{string.Join("->", res.stopwatch.Select(i => i.ToString()).ToArray())}"); | |||
| string path; | |||
| string path = ""; | |||
| if (res.defectCount > 0) | |||
| { | |||
| //UI显示小图 (含统计缺陷类型数量) | |||
| @@ -4430,6 +4431,40 @@ namespace MaiMuAOI.SysCtrl | |||
| //res.bmps_tag[i].Save(path + $"{indexList[i]}.bmp", ImageFormat.Bmp); | |||
| } | |||
| } | |||
| //保存原始小图 | |||
| if (confMgr.SysConfigParams.DefectSrcSmallImag.SavePath != "" && Directory.Exists(confMgr.SysConfigParams.DefectSrcSmallImag.SavePath)) | |||
| { | |||
| Log($"{res.stepIndex + 1}-{res.processName}", $"原始小图保存"); | |||
| string sinfo = ""; | |||
| int sterr = 0; | |||
| try | |||
| { | |||
| for (int i = 0; i < res.defectInfor2RestorationDesk.Count(); i++) | |||
| { | |||
| sterr = 1; | |||
| sinfo = JsonConvert.SerializeObject(res.defectInfor2RestorationDesk[i]); | |||
| int indext = int.Parse(res.defectInfor2RestorationDesk[i][0]); | |||
| double thres = double.Parse(res.defectInfor2RestorationDesk[i][4]); | |||
| if (thres >= confMgr.SysConfigParams.Defect_SrcSmall_Thres) | |||
| { | |||
| path = Util.CreateSubDir(confMgr.SysConfigParams.DefectSrcSmallImag.SavePath, | |||
| new List<string> { order.CreateTime.ToString("yyyyMMdd"), | |||
| model.MainGrid == 1?"主栅":model.DefectModelFile.IndexOf("rj") >= 0?"rj":model.DefectModelFile.IndexOf("pi") >= 0?"pi" : "其他", | |||
| order.SN, | |||
| res.defectInfor2RestorationDesk[i][3]}); | |||
| sterr = 2; | |||
| path += $"Defect_SN{order.SN}_I{res.index}_X{res.Xmm}_Y{res.Ymm}_{model.StepInfo.Name}"; | |||
| res.bmps_cut[indext].ImWrite(path + $"_i{i}.bmp"); | |||
| sterr = 3; | |||
| } | |||
| } | |||
| } | |||
| catch (Exception ex) | |||
| { | |||
| Log($"{res.stepIndex + 1}-{res.processName}", $"原始小图保存出错{sterr}-{sinfo}-{path}:{ex.Message}"); | |||
| } | |||
| } | |||
| //保存压缩大图 -- 用于修复台调用 | |||
| if (confMgr.SysConfigParams.DefectRepairImag.SavePath != "" && Directory.Exists(confMgr.SysConfigParams.DefectRepairImag.SavePath)) | |||
| @@ -7849,6 +7884,7 @@ namespace MaiMuAOI.SysCtrl | |||
| //保存原始小图 | |||
| if (confMgr.SysConfigParams.DefectSrcSmallImag.SavePath != "" && Directory.Exists(confMgr.SysConfigParams.DefectSrcSmallImag.SavePath)) | |||
| { | |||
| Log($"{res.stepIndex + 1}-{res.processName}", $"原始小图保存"); | |||
| string sinfo = ""; | |||
| int sterr = 0; | |||
| try | |||
| @@ -8219,14 +8255,17 @@ namespace MaiMuAOI.SysCtrl | |||
| #region 硬盘检测 | |||
| public static bool CheckDisk(IWin32Window owner, int max = 10) | |||
| { | |||
| string path = ConfMgr.Instance.SysConfigParams.DefectBigImag.SavePath; | |||
| string volume = path.Substring(0, path.IndexOf(':')); | |||
| long freespace = DiskAPI.GetHardDiskSpace(volume); | |||
| if (freespace < max) | |||
| if (!string.IsNullOrEmpty(ConfMgr.Instance.SysConfigParams.DefectBigImag.SavePath)) | |||
| { | |||
| string tip = $"当前{volume}硬盘容量:{freespace}GB,小于{max}GB。注意清理!!"; | |||
| FrmDialog.ShowDialog(owner, tip, "警告", true); | |||
| return false; | |||
| string path = ConfMgr.Instance.SysConfigParams.DefectBigImag.SavePath; | |||
| string volume = path.Substring(0, path.IndexOf(':')); | |||
| long freespace = DiskAPI.GetHardDiskSpace(volume); | |||
| if (freespace < max) | |||
| { | |||
| string tip = $"当前{volume}硬盘容量:{freespace}GB,小于{max}GB。注意清理!!"; | |||
| FrmDialog.ShowDialog(owner, tip, "警告", true); | |||
| return false; | |||
| } | |||
| } | |||
| return true; | |||
| } | |||
| @@ -79,6 +79,8 @@ namespace MaiMuAOI.SysCtrl | |||
| "\t10.优化老流程的兼容性\r\n" + | |||
| "\t11.修复缺陷计数查询无数据问题\r\n" + | |||
| "\t12.不同客户解析图纸功能\r\n" + | |||
| "\t13.原始小图保存\r\n"; | |||
| "\t13.原始小图保存\r\n" + | |||
| "\t14.新流程界面显示数据改为小数点后4位\r\n" + | |||
| "\t15.新增mark点类型\r\n"; | |||
| } | |||
| } | |||
| @@ -84,7 +84,7 @@ namespace MaiMuAOI.SysUI.ProcessStep.Ctrl | |||
| set | |||
| { | |||
| stepData = value; | |||
| this.RelData.Text = stepData.ToString("0.000"); | |||
| this.RelData.Text = stepData.ToString("0.0000"); | |||
| base.Refresh(); | |||
| } | |||
| } | |||
| @@ -98,7 +98,7 @@ namespace MaiMuAOI.SysUI.ProcessStep.Ctrl | |||
| set | |||
| { | |||
| stepMax = value; | |||
| this.MaxValue.Text = stepMax.ToString("0.000"); | |||
| this.MaxValue.Text = stepMax.ToString("0.0000"); | |||
| base.Refresh(); | |||
| } | |||
| } | |||
| @@ -111,7 +111,7 @@ namespace MaiMuAOI.SysUI.ProcessStep.Ctrl | |||
| set | |||
| { | |||
| stepMin = value; | |||
| this.MinValue.Text = stepMin.ToString("0.000"); | |||
| this.MinValue.Text = stepMin.ToString("0.0000"); | |||
| base.Refresh(); | |||
| } | |||
| } | |||
| @@ -806,7 +806,7 @@ | |||
| "实心圆带栅线", | |||
| "空心圆带栅线", | |||
| "矩形", | |||
| "候补1", | |||
| "实心圆位于栅线内部", | |||
| "候补2"}); | |||
| this.cbMarkType.Location = new System.Drawing.Point(117, 78); | |||
| this.cbMarkType.Margin = new System.Windows.Forms.Padding(2); | |||