| | |
| | | using Bro.Common.Helper; |
| | | using Bro.Common.Interface; |
| | | using Bro.Common.Model; |
| | | using Bro.DataBase.Model; |
| | | using Bro.M135.Common; |
| | | using Bro.M135.DBManager; |
| | | using HalconDotNet; |
| | |
| | | |
| | | return msg; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } while (true); |
| | | |
| | | |
| | | var Defaultclass = M141Config.DefectClassCollection.FirstOrDefault(u => u.IsDefault); |
| | | productList.ForEach(p => |
| | | { |
| | | if (Defaultclass == null) |
| | | { |
| | | if (string.IsNullOrEmpty(p.Result)) |
| | | { |
| | | p.Result = "NG"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (string.IsNullOrEmpty(p.Result)) |
| | | { |
| | | p.Result = Defaultclass.ClassName; |
| | | } |
| | | } |
| | | var Defaultclass = M141Config.DefectClassCollection.FirstOrDefault(u => u.ClassName == productList[0].Result); |
| | | |
| | | Plc1.WriteSingleAddress(1526, p.Result.ToUpper().Contains("NG") ? 2 : 1, out _); |
| | | }); |
| | | if (M141Config.StationCode == "S4" && productList[0].Result == "OK") |
| | | { |
| | | ////mysqlhelper.GetS2Result(productList[0].SEQUENCE); |
| | | Plc1.WriteSingleAddress(1526, mysqlhelper.GetS2Result(productList[0].SEQUENCE) ? 1 : 2, out _); |
| | | } |
| | | else |
| | | { |
| | | Plc1.WriteSingleAddress(1526, Defaultclass?.ClassValue ?? 2, out _); |
| | | } |
| | | |
| | | Plc1.WriteSingleAddress(1516, 1, out _); |
| | | |
| | | return msg; |
| | |
| | | return new ResponseMessage(); |
| | | } |
| | | |
| | | private async void OfflineDemoAsync(string imageFolder,bool isok,int saveimagetime) |
| | | private async void OfflineDemoAsync(string imageFolder, bool isok, int saveimagetime) |
| | | { |
| | | await Task.Run(() => |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | if (imageFile.EndsWith("OK")& isok == false) |
| | | if (imageFile.EndsWith("OK") & isok == false) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | { |
| | | continue; |
| | | } |
| | | var nameDatas = imageFile.Split(new char[] { '_'}, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | var nameDatas = imageFile.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries).ToList(); |
| | | if (nameDatas.Count != 5) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"文件{imageFile}命名不符合规范,不执行离线测试"); |
| | |
| | | var sn = nameDatas[0]; |
| | | var imageSeq = nameDatas[2][^1].ToString(); |
| | | var measureBind = M141Config.MeasureBindCollection.FirstOrDefault(u => u.ImageSaveSeq == imageSeq); |
| | | |
| | | if (measureBind == null || !measureBind.IsFixed) |
| | | |
| | | if (measureBind == null || !measureBind.IsFixed) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"离线测试,工位{(measureBind == null ? "未匹配" : $"{measureBind.WorkPosition}未开启")}"); |
| | | continue; |
| | |
| | | Thread.Sleep(saveimagetime); |
| | | imgSet.HImage?.Dispose(); |
| | | imgSet.HImage = null; |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | [ProcessMethod("printer", "printer", "打印机打印", InvokeType.TestInvoke)] |
| | |
| | | |
| | | UpdateDefectAsync(defects); |
| | | var defectClass = GetDefectClassFromDefectList(defects); |
| | | UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, "",p.ImagePaths); |
| | | UpdateResult(DateTime.Now, p.SN, defectClass.ClassName, "", p.ImagePaths); |
| | | |
| | | //产品序号+1 |
| | | //Interlocked.Increment(ref _productIndex); |