| | |
| | | using Bro.M071.DBManager; |
| | | using Bro.M071.Model; |
| | | using Bro.M071.Model.Model; |
| | | using Bro.M071.Process.UI; |
| | | using Bro.Process; |
| | | using HalconDotNet; |
| | | using Newtonsoft.Json; |
| | |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Drawing; |
| | | using System.Drawing.Imaging; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | |
| | | Reset(null, null, null); |
| | | FullReset(null); |
| | | |
| | | } |
| | | |
| | | private void InitialMotionCardBaseAxisAlarm() |
| | |
| | | |
| | | private void MotionCard_OnAxisAlarmRaised(int axisIndex, string alarmMsg) |
| | | { |
| | | RaisedAlarm(alarmMsg); |
| | | RaisedAlarm(alarmMsg); |
| | | MachineState = MachineState.Alarm; |
| | | } |
| | | |
| | |
| | | [ProcessMethod("", "StartJob", "开始扫描", InvokeType.TestInvoke)] |
| | | public ProcessResponse StartJob(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | | if (!IsAllowedWork) |
| | | { |
| | | throw new ProcessException(SafetyMsg, null, ExceptionLevel.Fatal); |
| | | } |
| | | |
| | | if (MachineState != MachineState.Ready) |
| | | throw new ProcessException("机台未就绪,请勿开始测量", null, ExceptionLevel.Fatal); |
| | | |
| | |
| | | Config.SnapshotPointCollection.Where(u => u.IsEnabled).ToList().ForEach(s => |
| | | { |
| | | _pauseHandle.WaitHandle.WaitOne(); |
| | | |
| | | if (MachineState != MachineState.Running) |
| | | { |
| | | throw new ProcessException("机台状态不在运行中,退出检测"); |
| | | } |
| | | |
| | | IDevice device = DeviceCollection.FirstOrDefault(u => u.Id == s.MotionOp.Device); |
| | | if (device == null) |
| | |
| | | |
| | | LogAsync(DateTime.Now, $"{m.GetDisplayText()}检测结果", $"{((m.Spec.MeasureResult ?? false) ? "OK" : "NG")}"); |
| | | |
| | | IShapeElement indicator = null; |
| | | KeyIndicator indicator = new KeyIndicator(m.Id, m.DisplayLocation); |
| | | indicator.Text = (m.Spec.ActualValue == null || m.Spec.ActualValue == -999) ? "NA" : m.Spec.ActualValue.Value.ToString("f2"); |
| | | indicator.ResultState = m.Spec.MeasureResult; |
| | | pMeasure.ElementList.Add(indicator); |
| | | //输出图形基元到界面 |
| | | OnElementUpdated?.BeginInvoke(indicator, null, null); |
| | |
| | | { |
| | | } |
| | | |
| | | //Excel报表输出 (单个产品的excel导出) |
| | | ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet); |
| | | //数据库保存 |
| | | SaveProductionData(measurementUnitResultAndKeyUnitDataSet); |
| | | ////Excel报表输出 (单个产品的excel导出) |
| | | //ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet); |
| | | ////数据库保存 |
| | | //SaveProductionData(measurementUnitResultAndKeyUnitDataSet); |
| | | |
| | | SaveWholeImage(pMeasure); |
| | | |
| | |
| | | Directory.CreateDirectory(dir); |
| | | } |
| | | |
| | | map.Save(Path.Combine(dir, $"{pMeasure.Barcode}_{DateTime.Now.ToString("HHmmss")}.bmp")); |
| | | map.Save(Path.Combine(dir, $"{pMeasure.Barcode}_{pMeasure.PResult}_{DateTime.Now.ToString("HHmmss")}.png"), ImageFormat.Png); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | _halconToolDict[keyToolKey].InputImageDic["INPUT_Image"] = image; |
| | | _halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_X"] = scanParam.Resolution_X; |
| | | _halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_Z"] = scanParam.Resolution_Z; |
| | | //_halconToolDict[keyToolKey].InputTupleDic["INPUT_Resolution_Z"] = scanParam.Resolution_Z; |
| | | if (!_halconToolDict[keyToolKey].RunProcedure(out string error)) |
| | | { |
| | | LogAsync(DateTime.Now, $"{k.AliasName}检测算法异常,{error}", ""); |