S2和S4结果联动.S2抛条码NG,其余NG到S4抛料
| | |
| | | [Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))] |
| | | public string ImageFolder { get; set; } |
| | | |
| | | [Category("启动配置")] |
| | | [Description("true:启动离线测试 false:停止离线测试")] |
| | | [DisplayName("测试开关")] |
| | | public bool IsStart { get; set; } = true; |
| | | |
| | | |
| | | [Category("检测功能")] |
| | |
| | | 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; |
| | |
| | | } while (true); |
| | | |
| | | |
| | | var Defaultclass = M141Config.DefectClassCollection.FirstOrDefault(u => u.IsDefault); |
| | | productList.ForEach(p => |
| | | var Defaultclass = M141Config.DefectClassCollection.FirstOrDefault(u => u.ClassName == productList[0].Result); |
| | | |
| | | if (M141Config.StationCode == "S4" && productList[0].Result == "OK") |
| | | { |
| | | if (Defaultclass == null) |
| | | { |
| | | if (string.IsNullOrEmpty(p.Result)) |
| | | { |
| | | p.Result = "NG"; |
| | | } |
| | | ////mysqlhelper.GetS2Result(productList[0].SEQUENCE); |
| | | Plc1.WriteSingleAddress(1526, mysqlhelper.GetS2Result(productList[0].SEQUENCE) ? 1 : 2, out _); |
| | | } |
| | | else |
| | | { |
| | | if (string.IsNullOrEmpty(p.Result)) |
| | | { |
| | | p.Result = Defaultclass.ClassName; |
| | | } |
| | | Plc1.WriteSingleAddress(1526, Defaultclass?.ClassValue ?? 2, out _); |
| | | } |
| | | |
| | | Plc1.WriteSingleAddress(1526, p.Result.ToUpper().Contains("NG") ? 2 : 1, out _); |
| | | }); |
| | | Plc1.WriteSingleAddress(1516, 1, out _); |
| | | |
| | | return msg; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public bool GetS2Result(string plcnum) |
| | | { |
| | | try |
| | | { |
| | | string mysqlstr = $"select data from forall where plcnum='{plcnum}' && device='S2' order by id desc limit 1"; |
| | | string str = selectmysql(mysqlstr, connStrAll); |
| | | if (string.IsNullOrEmpty(str)) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | ProductModel p = null; |
| | | p = JsonConvert.DeserializeObject<ProductModel>(str, new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }); |
| | | |
| | | return p.Result=="OK"; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"数据库forlocal获取对象异常 {e.ToString()}"); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public string Getbasketcode(string plcnum, out string sn) |
| | | { |
| | | sn = "Noread"; |