| | |
| | | |
| | | Reset(null, null, null); |
| | | FullReset(null); |
| | | |
| | | } |
| | | |
| | | private void InitialMotionCardBaseAxisAlarm() |
| | |
| | | private void InitialSetting() |
| | | { |
| | | //数据库迁移检查 |
| | | DatabaseInitialize.Initialize(); |
| | | //DatabaseInitialize.Initialize(); |
| | | |
| | | MotionCardSettingCheck(); |
| | | |
| | |
| | | } |
| | | |
| | | MachineState = MachineState.Running; |
| | | OnMeasureStart?.BeginInvoke(null, null); |
| | | OnMeasureStart?.Invoke(); |
| | | |
| | | var measurements = Config.MeasurementUnitCollection.Where(u => u.IsEnabled).ToList().DeepSerializeClone(); |
| | | measurements.ForEach(m => |
| | |
| | | |
| | | Config.SnapshotPointCollection.Where(u => u.IsEnabled).ToList().ForEach(s => |
| | | { |
| | | _pauseHandle.WaitHandle.WaitOne(); |
| | | _pausedHandle.Wait(); |
| | | |
| | | if (MachineState != MachineState.Running) |
| | | if (MachineState == MachineState.Ready) |
| | | return; |
| | | |
| | | if (MachineState != MachineState.Running && MachineState != MachineState.Pause) |
| | | { |
| | | throw new ProcessException("机台状态不在运行中,退出检测"); |
| | | } |
| | |
| | | { |
| | | if (sender is ProductionMeasurement pMeasure) |
| | | { |
| | | lock (pMeasure) |
| | | var production = productionList.FirstOrDefault(u => u.Barcode == pMeasure.Barcode); |
| | | if (production == null) |
| | | return; |
| | | |
| | | lock (production) |
| | | { |
| | | //检查是否全部完成 |
| | | pMeasure.Measurements.ForEach(m => |
| | | pMeasure.Measurements?.ForEach(m => |
| | | { |
| | | if (m.KeyUnitCollection.All(k => k.IsDone != null)) |
| | | { |
| | |
| | | indicator.ResultState = m.Spec.MeasureResult; |
| | | pMeasure.ElementList.Add(indicator); |
| | | //输出图形基元到界面 |
| | | OnElementUpdated?.BeginInvoke(indicator, null, null); |
| | | OnElementUpdated?.Invoke(indicator); |
| | | |
| | | SaveKeyImages(pMeasure.Barcode, m); |
| | | |
| | |
| | | MeasurementUnitResult measurementUnitResult = new MeasurementUnitResult(); |
| | | measurementUnitResult.ProductionMeasurementRecordsId = productionMeasurementRecords.ID; |
| | | measurementUnitResult.ProductionBarcode = productionMeasurementRecords.ProductionBarcode; |
| | | measurementUnitResult.MeasurementName = measurementUnit.Name; |
| | | measurementUnitResult.MeasurementName = measurementUnit.GetDisplayText(); |
| | | measurementUnitResult.MeasurementType = measurementUnit.MeasureType; |
| | | measurementUnitResult.MeasurementValue = measurementUnit.Spec.ActualValue.ToString(); |
| | | measurementUnitResult.MeasurementResult = measurementUnit.Spec.MeasureResult.Value ? "OK" : "NG"; |
| | |
| | | }); |
| | | } |
| | | |
| | | string dir = Path.Combine(Config.ImageSaveFolder, "Clips", $"{snapshotName}_{DateTime.Now.ToString("HHmmss")}"); |
| | | string dir = Path.Combine(Config.ImageSaveFolder, "Clips", $"{DateTime.Now.ToString("yyyyMMdd")}", $"{snapshotName}_{DateTime.Now.ToString("HHmmss")}"); |
| | | if (!Directory.Exists(dir)) |
| | | { |
| | | Directory.CreateDirectory(dir); |
| | | } |
| | | |
| | | Parallel.For(1, count.I + 1, (i) => |
| | | //for (int i = 1; i <= count.I; i++) |
| | | //Parallel.For(1, count.I + 1, (i) => |
| | | for (int i = 1; i <= count.I; i++) |
| | | { |
| | | HOperatorSet.SelectObj(images, out HObject image, i); |
| | | |
| | |
| | | var results = _halconToolDict[keyToolKey].GetResultTuple("OUTPUT_Results").HTupleToDouble(); |
| | | if (results.Count == 0 || results.Any(u => u < 0)) |
| | | { |
| | | LogAsync(DateTime.Now, $"{k.AliasName}检测结果异常", ""); |
| | | LogAsync(DateTime.Now, $"{k.AliasName}原始数据异常", ""); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, $"{k.AliasName}原始数据", $"{string.Join(" ", results)}"); |
| | | resultDict = k.KeyResultList.ToDictionary(u => u, u => |
| | | { |
| | | int index = k.KeyResultList.IndexOf(u); |
| | |
| | | |
| | | //image.Dispose(); |
| | | } |
| | | ); |
| | | //); |
| | | |
| | | //if (count.I != 1) |
| | | //{ |