| | |
| | | InitialSetting(); |
| | | |
| | | base.Open(); |
| | | |
| | | CheckMachineState(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检查设备状态 |
| | | /// </summary> |
| | | private void CheckMachineState() |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | private void InitialSetting() |
| | |
| | | } |
| | | } |
| | | |
| | | List<ProductionMeasurement> productionList = new List<ProductionMeasurement>(); |
| | | |
| | | [ProcessMethod("", "StartJob", "开始扫描", InvokeType.TestInvoke)] |
| | | public ProcessResponse StartJob(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | |
| | | Measurements = measurements, |
| | | }; |
| | | |
| | | var existedProduction = productionList.FirstOrDefault(u => u.Barcode == pMeasure.Barcode); |
| | | if (existedProduction != null) |
| | | { |
| | | productionList.Remove(existedProduction); |
| | | existedProduction.Dispose(); |
| | | existedProduction = null; |
| | | } |
| | | |
| | | productionList.Add(pMeasure); |
| | | |
| | | pMeasure.InitialMeasurementsPropertyChanged(); |
| | | pMeasure.PropertyChanged += MeasureProduction_PropertyChanged; |
| | | |
| | |
| | | { |
| | | _pauseHandle.WaitHandle.WaitOne(); |
| | | |
| | | IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == s.MotionDevice); |
| | | IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == s.MotionOp.Device); |
| | | if (device == null) |
| | | throw new ProcessException($"{s.Name}拍照点位未设置运动设备"); |
| | | |
| | | IMotion motionDevice = device as IMotion; |
| | | IMotionCard motionDevice = device as IMotionCard; |
| | | |
| | | if (motionDevice == null) |
| | | throw new ProcessException($"{s.Name}拍照点位设置{device.Name}不是运动设备"); |
| | | |
| | | if (!motionDevice.MoveToPoint(null)) |
| | | var response = motionDevice.Run(s.MotionOp.OpConfig); |
| | | if (!response.Result) |
| | | { |
| | | throw new ProcessException("运动中止", null, ExceptionLevel.Info); |
| | | throw new ProcessException($"{device.Name}异常,{response.Message}", null, ExceptionLevel.Info); |
| | | } |
| | | |
| | | CameraBase camera = DeviceCollection.FirstOrDefault(u => u.Id == s.CameraOp.Device) as CameraBase; |
| | | if (camera == null) |
| | | return; |
| | | |
| | | //IImageSet imgSet = camera.Snapshot(s.CameraOp.OpConfig); |
| | | //if (imgSet == null) |
| | | // return; |
| | | |
| | | HImage hImage = CollectHImage(camera, s.CameraOp.OpConfig, out string imgSetId); |
| | | if (string.IsNullOrWhiteSpace(imgSetId)) |
| | |
| | | }); |
| | | |
| | | BarCode = ""; |
| | | |
| | | return new ProcessResponse(true); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | LogAsync(DateTime.Now, $"{m.GetDisplayText()}检测结果", $"{((m.Spec.MeasureResult ?? false) ? "OK" : "NG")}"); |
| | | |
| | | IShapeElement indicator = null; |
| | | pMeasure.ElementList.Add(indicator); |
| | | //输出图形基元到界面 todo |
| | | OnElementUpdated?.BeginInvoke(null, null, null); |
| | | OnElementUpdated?.BeginInvoke(indicator, null, null); |
| | | |
| | | SaveKeyImages(pMeasure.Barcode, m); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | //MES输出 todo |
| | | |
| | | //Excel报表输出 todo |
| | |
| | | //数据库保存 todo |
| | | |
| | | SaveWholeImage(pMeasure); |
| | | |
| | | productionList.RemoveAll(p => p.Barcode == pMeasure.Barcode); |
| | | pMeasure.Dispose(); |
| | | } |
| | | } |