| | |
| | | public int RepeatTimes { get; set; } = 1; |
| | | } |
| | | |
| | | [Device("KeyUnitGenerate", "单键生成配置", EnumHelper.DeviceAttributeType.OperationConfig)] |
| | | public class KeyUnitGenerateConfig : OperationConfigBase |
| | | { |
| | | [Category("键名配置")] |
| | | [Description("开始键")] |
| | | [TypeConverter(typeof(KeyNameDictConverter))] |
| | | public string StartKey { get; set; } |
| | | |
| | | [Category("键名配置")] |
| | | [Description("结束键")] |
| | | [TypeConverter(typeof(KeyNameDictConverter))] |
| | | public string EndKey { get; set; } |
| | | |
| | | [Category("图像来源")] |
| | | [Description("拍照点位")] |
| | | [TypeConverter(typeof(SnapshotPointConverter))] |
| | | public string SnapshotPointId { get; set; } |
| | | |
| | | [Category("算法配置")] |
| | | [Description("单键检测配置算法类型")] |
| | | [TypeConverter(typeof(KeyAlgorithemConverter))] |
| | | public string KeyAlgorithemId { get; set; } |
| | | |
| | | [Category("算法配置")] |
| | | [Description("单键检测配置结果类型")] |
| | | [TypeConverter(typeof(KeyResultConverter))] |
| | | public string KeyResultId { get; set; } |
| | | } |
| | | |
| | | public class OperationCombination : IComplexDisplay, IHalconToolPath |
| | | { |
| | | [Category("运动机构配置")] |
| | |
| | | |
| | | return new ProcessResponse(); |
| | | } |
| | | |
| | | [ProcessMethod("KeyUnitGenerate", "GenerateKeyUnitByKeyNames", "生成单键配置", InvokeType.TestInvoke)] |
| | | public ProcessResponse GenerateKeyUnitByKeyNames(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | | if (opConfig is KeyUnitGenerateConfig config) |
| | | { |
| | | int i = 1; |
| | | bool isStart = false; |
| | | bool isEnd = false; |
| | | foreach (string k in Config.KeyNameCollection) |
| | | { |
| | | if (k == config.StartKey) |
| | | { |
| | | isStart = true; |
| | | } |
| | | else if (k == config.EndKey) |
| | | { |
| | | isEnd = true; |
| | | } |
| | | |
| | | if (isStart) |
| | | { |
| | | KeyUnit unit = new KeyUnit(); |
| | | unit.Key = unit.AliasName = k; |
| | | unit.SnapshotPointId = config.SnapshotPointId; |
| | | unit.KeyAlgorithemId = config.KeyAlgorithemId; |
| | | unit.KeyResultId = config.KeyResultId; |
| | | unit.ImageSeq = i; |
| | | |
| | | Config.KeyUnitCollection.Add(unit); |
| | | i++; |
| | | } |
| | | |
| | | if (isEnd) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return new ProcessResponse(true); |
| | | } |
| | | #endregion |
| | | |
| | | #region 私有方法 |
| | |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace Bro.M071.Process |
| | | { |
| | |
| | | LogAsync(DateTime.Now, $"{pMeasure.Barcode}产品检测数据上传", JsonConvert.SerializeObject(paras)); |
| | | } |
| | | |
| | | string result = "-3"; |
| | | string result = "-1"; |
| | | |
| | | int repeatTime = 3; |
| | | do |
| | |
| | | repeatTime--; |
| | | |
| | | Thread.Sleep(100); |
| | | result = "-3"; |
| | | result = "-1"; |
| | | } |
| | | } while (repeatTime > 0); |
| | | |
| | |
| | | LogAsync(DateTime.Now, $"{barcode}产品检测数据上传,{result}|{mesReturn.ToString()}", $"耗时:{sw.ElapsedMilliseconds}ms"); |
| | | |
| | | OnCheckHintUpload?.Invoke("检测数据" + mesReturn.ToString(), mesReturn != MESUploadReturn.上传成功); |
| | | |
| | | if (mesReturn != MESUploadReturn.上传成功) |
| | | { |
| | | MessageBox.Show($"{barcode}产品数据上传失败,{mesReturn.ToString()}\r\n请检查网络连接或确认问题后重新检测", "上传异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| | | } |
| | | } |
| | | |
| | | private string GetMESAlignmentData(ProductionMeasurement pMeasure) |
| | |
| | | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 |
| | | //通过使用 "*",如下所示: |
| | | // [assembly: AssemblyVersion("1.0.*")] |
| | | [assembly: AssemblyVersion("1.0.6.0")] |
| | | [assembly: AssemblyFileVersion("1.0.6.0")] |
| | | [assembly: AssemblyVersion("1.0.7.0")] |
| | | [assembly: AssemblyFileVersion("1.0.7.0")] |
| | |
| | | Config.MeasurementUnitCollection.Add(mUnitDown); |
| | | } |
| | | break; |
| | | case "Blind": |
| | | case "Blind1": |
| | | case "BlindExist": |
| | | case "BlindNotExist": |
| | | { |
| | | for (int i = startIndex; i <= endIndex; i++) |
| | | { |