From c2e78e3b0c11026a6374a8dac05c94f65b8c54a6 Mon Sep 17 00:00:00 2001 From: xcd <834800634@qq.com> Date: 星期二, 30 六月 2020 16:22:13 +0800 Subject: [PATCH] 添加IImageSet接口,修改CameraBase图片保存操作。添加Gocator驱动的图片保存操作,gocator图片使用HImage保存 --- src/Bro.M071.Process/M071Process.cs | 49 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs index 13fde83..fbdd8fe 100644 --- a/src/Bro.M071.Process/M071Process.cs +++ b/src/Bro.M071.Process/M071Process.cs @@ -10,6 +10,7 @@ using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace Bro.M071.Process @@ -138,8 +139,6 @@ //} #endregion - //Dictionary<string, ProductionMeasurement> MeasureDict = new Dictionary<string, ProductionMeasurement>(); - private string barCode = ""; public string BarCode { @@ -168,17 +167,7 @@ measurements.ForEach(m => { m.InitialKeyUnitMeasureChanged(); - //m.KeyUnitCollection.ForEach(k => k.InitialMeasureValueDictPropertyChanged()); }); - - //MeasureDict[BarCode] = new ProductionMeasurement() - //{ - // Barcode = BarCode, - // Measurements = measurements, - //}; - - //MeasureDict[BarCode].InitialMeasurementsPropertyChanged(); - //MeasureDict[BarCode].PropertyChanged += MeasureProduction_PropertyChanged; var pMeasure = new ProductionMeasurement() { @@ -191,6 +180,8 @@ Config.SnapshotPointCollection.Where(u => u.IsEnabled).ToList().ForEach(s => { + _pauseHandle.WaitHandle.WaitOne(); + IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == s.MotionDevice); if (device == null) throw new ProcessException($"{s.Name}鎷嶇収鐐逛綅鏈缃繍鍔ㄨ澶�"); @@ -220,6 +211,39 @@ return new ProcessResponse(true); } + /// <summary> + /// 鏆傚仠鏍囧織 + /// WaitHandle 鏆傚仠鍙ユ焺 榛樿涓洪潪闃诲 鍙墽琛� + /// WaitResult 鏆傚仠鏍囧織 true 姝e父鎵ц 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 绉佹湁鏂规硶 private void MeasureProduction_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (sender is ProductionMeasurement pMeasure) @@ -384,5 +408,6 @@ imgSet.HImage.Dispose(); }); } + #endregion } } -- Gitblit v1.8.0