| | |
| | | PLCBase Plc2; |
| | | public Thread ThHeartPlc; |
| | | |
| | | public RabbitMQHelper mqtt; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public override void Open() |
| | | { |
| | | base.Open(); |
| | | |
| | | devicestate = true; |
| | | ML = DeviceCollection.FirstOrDefault(u => u is MachineLearningBase) as MachineLearningBase; |
| | | if (ML == null) |
| | |
| | | |
| | | mysqlhelper.IniDBIP(M141Config.IPforall); |
| | | RerefreshBasketcode(); |
| | | |
| | | |
| | | if (M141Config.ISupMES) |
| | | { |
| | | mqtt = new RabbitMQHelper(M141Config.zIP, M141Config.zport, M141Config.zuser, M141Config.zpassword); |
| | | mqtt.Connect(M141Config.MESchannel); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | try |
| | | { |
| | | if (Plc1 != null) |
| | | { |
| | | DateTime dt = DateTime.Now; |
| | | Plc1.WriteSingleAddress(10, dt.Year, out _); |
| | | Plc1.WriteSingleAddress(11, dt.Month, out _); |
| | | Plc1.WriteSingleAddress(12, dt.Day, out _); |
| | | Plc1.WriteSingleAddress(13, dt.Hour, out _); |
| | | Plc1.WriteSingleAddress(14, dt.Minute, out _); |
| | | Plc1.WriteSingleAddress(15, dt.Second, out _); |
| | | Plc1.WriteSingleAddress(16, (int)dt.DayOfWeek, out _); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | |
| | | { |
| | | string detectionName = (ML.InitialConfig as MLInitialConfigBase).DetectionConfigs.FirstOrDefault(u => u.Id == measureBind.DetectionId)?.Name; |
| | | |
| | | |
| | | |
| | | 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(); |
| | | var defecttem = detectResults.SelectMany(u => u.AllNetResults.SelectMany(m => m.DetectDetails)).Where(u => u.ClassName == 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}"); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN} S3S5检测 S3数据{Netdefectdetails.Count} S5数据{defecttem.Count}"); |
| | | |
| | | Netdefectdetails.ForEach(x => |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN} S3S5检测 S3数据{x.name} {x.centerX},{x.centerY} "); |
| | | }); |
| | | |
| | | 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}"); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN} S3S5检测 原坐标{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}"); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Detail, $"{products[0].SN} S3S5检测 新坐标{num} {qx},{qy}"); |
| | | |
| | | |
| | | Netdefectdetail temc = new Netdefectdetail() |
| | |
| | | |
| | | //UpdatePositionResultToDB(detail); |
| | | //var seqData = p.SEQUENCE.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | ReplyPlcData(positionSet, plcresult); |
| | | |
| | | if (M141Config.StationCode == "S4" && isOK) |
| | | { |
| | | ////mysqlhelper.GetS2Result(productList[0].SEQUENCE); |
| | | //Plc1.WriteSingleAddress(1526, mysqlhelper.GetS2Result(productList[0].SEQUENCE) ? 1 : 2, out _); |
| | | |
| | | bool temS2 = mysqlhelper.GetS2Result(p.SEQUENCE); |
| | | ReplyPlcData(positionSet, new List<bool>() { temS2 }); |
| | | if (!temS2) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"{p.SN} S2工站NG抛料"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ReplyPlcData(positionSet, plcresult); |
| | | } |
| | | |
| | | |
| | | |
| | | mysqlhelper.UpdateProduct(p); |
| | | if (positionSet.IsLastPosition) |
| | | { |