| | |
| | | using ScottPlot.Drawing.Colormaps; |
| | | using Sunny.UI; |
| | | using Sunny.UI.Win32; |
| | | using System; |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.Drawing.Imaging; |
| | |
| | | |
| | | //volatile int _productIndex = 0; |
| | | |
| | | M141Process_Mysql mysqlhelper = new M141Process_Mysql(); |
| | | public M141Process_Mysql mysqlhelper = new M141Process_Mysql(); |
| | | |
| | | public event Action RerefreshBasketcodeUI; |
| | | |
| | | public void RerefreshBasketcode() |
| | | { |
| | | RerefreshBasketcodeUI?.Invoke(); |
| | | } |
| | | |
| | | |
| | | |
| | | public override void InitialProcessMethods() |
| | |
| | | _positionSpecHeads.Clear(); |
| | | |
| | | mysqlhelper.IniDBIP(M141Config.IPforall); |
| | | |
| | | RerefreshBasketcode(); |
| | | } |
| | | |
| | | |
| | |
| | | throw new Exception($"产品{string.Join(",", pidList)}检测{measureBind.GetDisplayText()}未能获取图片对象"); |
| | | } |
| | | |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedMonitorId, resultList); |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedCombineMethodId, resultList); |
| | | |
| | | //检测顺序 ML->自定义检测 |
| | | if (!string.IsNullOrWhiteSpace(measureBind.DetectionId)) |
| | | { |
| | | string detectionName = (ML.InitialConfig as MLInitialConfigBase).DetectionConfigs.FirstOrDefault(u => u.Id == measureBind.DetectionId)?.Name; |
| | | |
| | | |
| | | //List<string> pidList2 = new List<string>();//pidList.Select(u => u.Split('_')[u.Split('_').Length - 1]).ToList(); |
| | | //Dictionary<string, string> dicpid = new Dictionary<string, string>(); |
| | | |
| | | //for (int i = 0; i < pidList.Count; i++) |
| | | //{ |
| | | // var tem = pidList[i].Split('_')[pidList[i].Split('_').Length - 1]; |
| | | // pidList2.Add(tem); |
| | | // dicpid[tem] = pidList[i]; |
| | | //} |
| | | List<DetectResult> detectResults = ML?.RunMLDetectionSync(imgSet, pidList, measureBind.DetectionId, false, null, null, "", products[0].ImagePaths); |
| | | |
| | | //var c=products[0].ImagePaths; |
| | | List<DetectResult> detectResults = ML?.RunMLDetectionSync(imgSet, pidList, measureBind.DetectionId,false,null,null,"", products[0].ImagePaths); |
| | | |
| | | |
| | | if (measureBind.WorkPosition == "P1" && M141Config.StationCode == "S5" && detectResults.GetDefectDescList().Count == 0) |
| | | { |
| | | var defecttem = detectResults.SelectMany(u => u.NetResults.SelectMany(m => m.DetectDetails)).Where(u => u.NetName == M141Config.defectname).ToList(); |
| | | List<Netdefectdetail> Netdefectdetails = mysqlhelper.GetNetdefectdetails(products[0].SEQUENCE); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN} 进入S3S5检测 S3数据{Netdefectdetails.Count} S5数据{defecttem.Count}"); |
| | | |
| | | int num = 0; |
| | | foreach (var item1 in defecttem) |
| | | { |
| | | double x1 = item1.Rect.Point_LU.X + item1.Rect.Width / 2.0; |
| | | double y1 = item1.Rect.Point_LU.Y + item1.Rect.Height / 2.0; |
| | | num++; |
| | | //HOperatorSet.AffineTransPoint2d(new HTuple(products[0].Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | //HOperatorSet.ProjectiveTransPixel(new HTuple(products[0].Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN}原坐标{num} {x1},{y1}"); |
| | | HOperatorSet.ProjectiveTransPixel(new HTuple(products[0].Centermatrix.ToArray()), x1, y1, out HTuple qx, out HTuple qy); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN}新坐标{num} {qx},{qy}"); |
| | | |
| | | |
| | | Netdefectdetail temc = new Netdefectdetail() |
| | | { |
| | | centerX = qx, |
| | | centerY = qy, |
| | | name = M141Config.defectname, |
| | | }; |
| | | if (Netdefectdetails.Any(u => u == temc)) |
| | | { |
| | | item1.IsAbandoned = false; |
| | | item1.FinalResult = ResultState.NG; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"产品{products[0].PID}_{products[0].SEQUENCE}工位{measureBind.WorkPosition} S3S5组合检测检出缺陷:{item1.NetName}"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<DetectResult> ngResults = new List<DetectResult>(); |
| | | |
| | | |
| | | //for (int i = 0; i < detectResults.Count; i++) |
| | | //{ |
| | | // detectResults[i].PID = dicpid[detectResults[i].PID]; |
| | | //} |
| | | |
| | | |
| | | detectResults.GroupBy(u => u.PID).ToList().ForEach(u => |
| | | { |
| | | if (u.ToList().Count > 0 && u.ToList().Any(m => m.ResultState != EnumHelper.ResultState.OK)) |
| | |
| | | detectResults.AddRange(ngResults); |
| | | resultList.AddRange(detectResults); |
| | | } |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedMonitorId, resultList); |
| | | RunCustomizedMethod(products, triggerText, triggerSource, imgSet, measureBind.CustomizedCombineMethodId, resultList); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | if (positionSet.IsLastPosition) |
| | | { |
| | | UpdateProductResultAsync(p); |
| | | mysqlhelper.NewForAll(p, M141Config.StationCode); |
| | | mysqlhelper.NewForAll(p, M141Config.StationCode, M141Config.defectname); |
| | | if (M141Config.IsfinDevice) |
| | | { |
| | | SummaryAllprodata(p); |
| | |
| | | newp.Details.AddRange(item.Details); |
| | | } |
| | | } |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"AllDeviceProductRecord从数据库获取到数据{p.SEQUENCE} plist数量{plist.Count} Details数量{newp.Details.Count}"); |
| | | //LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"AllDeviceProductRecord从数据库获取到数据{p.SEQUENCE} plist数量{plist.Count} Details数量{newp.Details.Count}"); |
| | | |
| | | //newp.Details.AddRange(p.Details); |
| | | |