From 5bf1b91009a182188d6d2245aa71653801eea60b Mon Sep 17 00:00:00 2001 From: wells <123> Date: 星期日, 12 七月 2020 18:09:54 +0800 Subject: [PATCH] debug --- src/Bro.M071.Process/M071Process.cs | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Bro.M071.Process/M071Process.cs b/src/Bro.M071.Process/M071Process.cs index 5b63bbf..300a146 100644 --- a/src/Bro.M071.Process/M071Process.cs +++ b/src/Bro.M071.Process/M071Process.cs @@ -5,6 +5,7 @@ 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; @@ -12,6 +13,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; +using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; @@ -59,6 +61,7 @@ Reset(null, null, null); FullReset(null); + } private void InitialMotionCardBaseAxisAlarm() @@ -72,7 +75,7 @@ private void MotionCard_OnAxisAlarmRaised(int axisIndex, string alarmMsg) { - RaisedAlarm(alarmMsg); + RaisedAlarm(alarmMsg); MachineState = MachineState.Alarm; } @@ -178,6 +181,11 @@ [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); @@ -368,7 +376,9 @@ 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); @@ -404,10 +414,10 @@ { } - //Excel鎶ヨ〃杈撳嚭 锛堝崟涓骇鍝佺殑excel瀵煎嚭锛� - ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet); - //鏁版嵁搴撲繚瀛� - SaveProductionData(measurementUnitResultAndKeyUnitDataSet); + ////Excel鎶ヨ〃杈撳嚭 锛堝崟涓骇鍝佺殑excel瀵煎嚭锛� + //ExportProductionExcel(measurementUnitResultAndKeyUnitDataSet); + ////鏁版嵁搴撲繚瀛� + //SaveProductionData(measurementUnitResultAndKeyUnitDataSet); SaveWholeImage(pMeasure); @@ -589,7 +599,7 @@ 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) { @@ -718,7 +728,7 @@ { _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}", ""); -- Gitblit v1.8.0