Esempio n. 1
0
        private SendResultParameter GetNeedleFindResultAnalysis()
        {
            SendResultParameter _SendResParam = new SendResultParameter();

            _SendResParam.ID          = ID;
            _SendResParam.NgType      = eNgType.GOOD;
            _SendResParam.IsGood      = true;
            _SendResParam.ProjectItem = ProjectItem;

            for (int iLoopCount = 0; iLoopCount < AlgoResultParamList.Count; ++iLoopCount)
            {
                if (eAlgoType.C_NEEDLE_FIND == AlgoResultParamList[iLoopCount].ResultAlgoType)
                {
                    var _AlgoResultParam = AlgoResultParamList[iLoopCount].ResultParam as CogNeedleFindResult;
                    SendNeedleAlignResult _SendResult = new SendNeedleAlignResult();

                    _SendResult.AlignX = (_AlgoResultParam.IsGood == true) ? _AlgoResultParam.CenterXReal : 0;
                    _SendResult.AlignY = (_AlgoResultParam.IsGood == true) ? _AlgoResultParam.CenterYReal : 0;

                    _SendResParam.IsGood    &= _AlgoResultParam.IsGood;
                    _SendResParam.SendResult = _SendResult;
                    if (_SendResParam.NgType == eNgType.GOOD)
                    {
                        _SendResParam.NgType = (_AlgoResultParam.IsGood == true) ? eNgType.GOOD : eNgType.NDL_CENTER;
                    }
                }

                else if (eAlgoType.C_BLOB_REFER == AlgoResultParamList[iLoopCount].ResultAlgoType)
                {
                    var          _AlgoResultParam = AlgoResultParamList[iLoopCount].ResultParam as CogBlobReferenceResult;
                    SendIDResult _SendResult      = new SendIDResult();

                    _SendResParam.IsGood &= _AlgoResultParam.IsGood;
                    if (_SendResParam.NgType == eNgType.GOOD)
                    {
                        _SendResParam.NgType = (_AlgoResultParam.BlobCount > 0) ? eNgType.GOOD : eNgType.NDL_FIND;
                    }
                }

                else if (eAlgoType.C_PATTERN == AlgoResultParamList[iLoopCount].ResultAlgoType)
                {
                    var _AlgoResultParam = AlgoResultParamList[iLoopCount].ResultParam as CogPatternResult;
                    SendNeedleAlignResult _SendResult = new SendNeedleAlignResult();
                    _SendResParam.IsGood = _AlgoResultParam.IsGood;
                    _SendResult.AlignX   = (_AlgoResultParam.IsGood == true) ? _AlgoResultParam.OriginPointX[0] : 0;
                    _SendResult.AlignY   = (_AlgoResultParam.IsGood == true) ? _AlgoResultParam.OriginPointY[0] : 0;
                }
            }

            return(_SendResParam);
        }
Esempio n. 2
0
        public override bool SendResultData(SendResultParameter _ResultParam)
        {
            bool _Result = true;

            if (_ResultParam.ProjectItem == eProjectItem.NEEDLE_ALIGN)
            {
                string _VisionString, _ResultString;
                _VisionString = String.Format("V{0}", _ResultParam.ID + 1);

                if (_ResultParam.IsGood)
                {
                    _ResultString = "OK";
                }
                else
                {
                    _ResultString = "NG";
                }

                var _SendResult = _ResultParam.SendResult as SendNeedleAlignResult;

                if (_SendResult == null)
                {
                    _SendResult        = new SendNeedleAlignResult();
                    _SendResult.AlignX = 0;
                    _SendResult.AlignY = 0;
                    _ResultString      = "NG";
                }

                //LDH, 2018.09.04, TILab 프로토콜 생성
                string[] _DataStringAlign  = ChangeResult(_SendResult.AlignX, _SendResult.AlignY);
                string   _ResultDataString = string.Format("{0},{1},{2},{3}", _VisionString, _ResultString, _DataStringAlign[0], _DataStringAlign[1]);
                EthernetServWnd.SendResultData(_ResultDataString);
                AckStructs[_ResultParam.ID].Initialize();
            }

            else if (_ResultParam.ProjectItem == eProjectItem.LEAD_INSP)
            {
                string _VisionString, _ResultString;
                _VisionString = String.Format("V{0}", _ResultParam.ID + 1);

                if (_ResultParam.IsGood)
                {
                    _ResultString = "OK";
                }
                else
                {
                    _ResultString = "NG";
                }

                var _SendResult = _ResultParam.SendResult as SendLeadResult;

                if (_SendResult == null)
                {
                    _SendResult   = new SendLeadResult();
                    _ResultString = "NG";
                }

                string _ResultDataString = string.Format("{0},{1},00000,00000", _VisionString, _ResultString);
                EthernetServWnd.SendResultData(_ResultDataString);
                AckStructs[_ResultParam.ID].Initialize();
            }

            return(_Result);
        }