领胜LDS 键盘AOI检测项目
patrick.xu
2021-08-02 a383b2288dcfb90e9aa1dcf796e41d9c6be1e429
src/Bro.M071.Process/M071Process.cs
@@ -58,25 +58,31 @@
        {
            InitialSetting();
            base.Open();
            if (!Config.IsOfflineMode)
            {
                base.Open();
            InitialMotionCardBaseAxisAlarm();
                InitialMotionCardBaseAxisAlarm();
            SwitchBeep(false);
            SwitchLightGreen(false);
            SwitchLightRed(false);
            SwitchLightYellow(false);
                SwitchBeep(false);
                SwitchLightGreen(false);
                SwitchLightRed(false);
                SwitchLightYellow(false);
            Reset(null, null, null);
            FullReset(null);
                Reset(null, null, null);
                FullReset(null);
            }
            if (Config.Precision > 0)
            {
                _precision = "f" + Config.Precision;
            }
            IncomingCheckMethod = InitialMESWebServiceMethod(IncomingCheckMethodName, out IncomingCheckObj);
            DataUploadMethod = InitialMESWebServiceMethod(DataUploadMethodName, out DataUploadObj);
            if (Config.IsEnableMESUpload)
            {
                IncomingCheckMethod = InitialMESWebServiceMethod(IncomingCheckMethodName, out IncomingCheckObj);
                DataUploadMethod = InitialMESWebServiceMethod(DataUploadMethodName, out DataUploadObj);
            }
            var allowedShiftStr = ConfigurationManager.AppSettings["DataShift"];
            if (!double.TryParse(allowedShiftStr, out _allowedShift))
@@ -268,7 +274,7 @@
                _isdoing = true;
            }
            MachineState = MachineState.Running;
            MeasureState = MachineState = MachineState.Running;
            OnCheckHintUpload?.Invoke(hint, true);
            OnMeasureStart?.Invoke();
@@ -525,6 +531,48 @@
            return new ProcessResponse();
        }
        [ProcessMethod("KeyUnitGenerate", "GenerateKeyUnitByKeyNames", "生成单键配置", InvokeType.TestInvoke)]
        public ProcessResponse GenerateKeyUnitByKeyNames(IOperationConfig opConfig, IDevice invokeDevice, IDevice sourceDevice)
        {
            if (opConfig is KeyUnitGenerateConfig config)
            {
                int i = 1;
                bool isStart = false;
                bool isEnd = false;
                foreach (string k in Config.KeyNameCollection)
                {
                    if (k == config.StartKey)
                    {
                        isStart = true;
                    }
                    else if (k == config.EndKey)
                    {
                        isEnd = true;
                    }
                    if (isStart)
                    {
                        KeyUnit unit = new KeyUnit();
                        unit.Key = unit.AliasName = k;
                        unit.SnapshotPointId = config.SnapshotPointId;
                        unit.KeyAlgorithemId = config.KeyAlgorithemId;
                        unit.KeyResultId = config.KeyResultId;
                        unit.ImageSeq = i;
                        Config.KeyUnitCollection.Add(unit);
                        i++;
                    }
                    if (isEnd)
                    {
                        break;
                    }
                }
            }
            return new ProcessResponse(true);
        }
        #endregion
        #region 私有方法
@@ -648,6 +696,7 @@
                //if (MachineState == MachineState.Running)
                //    MachineState = MachineState.Ready;
                MeasureState = MachineState.Ready;
                if (MachineState != MachineState.Alarm)
                {
                    if (MachineState == MachineState.Pause)
@@ -1438,8 +1487,15 @@
                            keyBindList.ForEach(kb =>
                            {
                                kb.KeyImages.Add(image.ConvertHObjectToHImage());
                                kb.FillKeyValues(resultDict);
                                if (kb.KeyImages != null)
                                {
                                    kb.KeyImages.Add(image.ConvertHObjectToHImage());
                                    kb.FillKeyValues(resultDict);
                                }
                                else
                                {
                                }
                            });
                        });