| | |
| | | InitialSetting(); |
| | | |
| | | base.Open(); |
| | | |
| | | CheckMachineState(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 检查设备状态 |
| | | /// </summary> |
| | | private void CheckMachineState() |
| | | { |
| | | throw new NotImplementedException(); |
| | | } |
| | | |
| | | private void InitialSetting() |
| | |
| | | if (keyRespone.Count == 0) |
| | | throw new ProcessException($"{u.GetDisplayText()}对应的单键不存在或不可用"); |
| | | |
| | | if (b.KeyResult == "All") |
| | | if (b.KeyResultId == "All") |
| | | { |
| | | keyRespone.SelectMany(kr => kr.KeyResultList).ToList().ForEach(r => |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | b.MeasureValueDict[b.KeyResult] = null; |
| | | b.MeasureValueDict[b.KeyResultId] = null; |
| | | } |
| | | }); |
| | | }); |
| | |
| | | throw new ProcessException("未输入产品条码,请勿开始测量"); |
| | | } |
| | | |
| | | //检查产品放置OK |
| | | |
| | | //气缸推动压板移动到产品上方 |
| | | |
| | | //压板压紧产品 |
| | | |
| | | OnMeasureStart?.BeginInvoke(null, null); |
| | | |
| | | var measurements = Config.MeasurementUnitCollection.Where(u => u.IsEnabled).ToList().DeepSerializeClone(); |
| | |
| | | { |
| | | _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; |
| | |
| | | |
| | | BarCode = ""; |
| | | |
| | | |
| | | |
| | | return new ProcessResponse(true); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 暂停标志 |
| | | /// WaitHandle 暂停句柄 默认为非阻塞 可执行 |
| | | /// WaitResult 暂停标志 true 正常执行 false 暂停中 |
| | | /// </summary> |
| | | ManualWaitConfirm _pauseHandle = new ManualWaitConfirm() |
| | | { |
| | | WaitHandle = new ManualResetEvent(true), |
| | | WaitResult = true, |
| | | }; |
| | | |
| | | [ProcessMethod("", "PauseJob", "暂停流程", InvokeType.TestInvoke)] |
| | | public ProcessResponse PauseJob(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | | if (_pauseHandle.WaitResult) |
| | | { |
| | | #region 板卡暂停动作 |
| | | #endregion |
| | | |
| | | _pauseHandle.WaitHandle.Reset(); |
| | | } |
| | | else |
| | | { |
| | | #region 板卡恢复动作 |
| | | #endregion |
| | | |
| | | _pauseHandle.WaitHandle.Set(); |
| | | } |
| | | |
| | | _pauseHandle.WaitResult = !_pauseHandle.WaitResult; |
| | | return new ProcessResponse(_pauseHandle.WaitResult); |
| | | } |
| | | |
| | | #region 私有方法 |