Ejemplo n.º 1
0
        //LDH, 2018.08.13, History 추가용 함수
        private void InspectionHistory(int _ID, string _Result)
        {
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("InspectionHistory Start"), CLogManager.LOG_LEVEL.LOW);

            DateTime dateTime           = DateTime.Now;
            string   InspScreenshotPath = @"D:\VisionInspectionData\CIPOSLeadInspection\HistoryData\Screenshot\";
            string   ImageSaveFolder    = String.Format("{0}{1:D4}\\{2:D2}\\{3:D2}", InspScreenshotPath, dateTime.Year, dateTime.Month, dateTime.Day);

            if (false == Directory.Exists(ImageSaveFolder))
            {
                Directory.CreateDirectory(ImageSaveFolder);
            }

            string ImageSaveFile;

            ImageSaveFile = String.Format("{0}\\{1:D2}{2:D2}{3:D2}{4:D3}.bmp", ImageSaveFolder, dateTime.Hour, dateTime.Minute, dateTime.Second, dateTime.Millisecond);

            //LDH, 2018.08.13, 프로젝트별로 DB에 해당하는 history 내역을 string 배열로 전달
            HistoryParam[0] = LastRecipeName;
            HistoryParam[1] = _ID.ToString();
            HistoryParam[2] = _Result;
            HistoryParam[3] = ImageSaveFile;

            CHistoryManager.AddHistory(HistoryParam);
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("InspectionHistory End"), CLogManager.LOG_LEVEL.LOW);

            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("Screenshot Start"), CLogManager.LOG_LEVEL.LOW);
            var _ScreenshotEvent = ScreenshotEvent;

            _ScreenshotEvent?.Invoke(ImageSaveFile);
            //ScreenshotEvent(ImageSaveFile);
            CLogManager.AddInspectionLog(CLogManager.LOG_TYPE.INFO, String.Format("Screenshot End"), CLogManager.LOG_LEVEL.LOW);
        }
Ejemplo n.º 2
0
        private void Initialize()
        {
            LoadDefaultRibbonTheme();

            #region Ribbon Menu Setting
            //LDH, 2019.01.10, 다중 RecipeName 사용으로 표시 생략
            //UpdateRibbonRecipeName(ParamManager.SystemParam.LastRecipeName);
            if ((int)eProjectType.NONE == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible  = false;
                rbSerial.Visible = false;
                rbConfig.Visible = false;
                rbFolder.Visible = false;
            }

            else if ((int)eProjectType.DISPENSER == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible     = false;
                rbSerial.Visible    = false;
                rbConfig.Visible    = false;
                rbLabelCode.Visible = false;
                rbFolder.Visible    = false;
                rbMapData.Visible   = false;
            }

            else if ((int)eProjectType.BLOWER == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible   = false;
                rbConfig.Visible  = false;
                rbMapData.Visible = false;
            }

            else if ((int)eProjectType.SORTER == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible     = false;
                rbLabelCode.Visible = false;
            }

            else if ((int)eProjectType.TRIM == ParamManager.SystemParam.ProjectType)
            {
                rbAlign.Visible     = false;
                rbSerial.Visible    = false;
                rbConfig.Visible    = false;
                rbFolder.Visible    = false;
                rbLabelCode.Visible = false;
            }
            #endregion Ribbon Menu Setting

            #region Log Window Initialize
            LogWnd = new CLogManager(ProjectName);
            CLogManager.LogSystemSetting(@"D:\VisionInspectionData\" + ProjectName + @"\Log\SystemLog");
            CLogManager.LogInspectionSetting(@"D:\VisionInspectionData\" + ProjectName + @"\Log\InspectionLog");
            CLogManager.AddSystemLog(CLogManager.LOG_TYPE.INFO, String.Format("MainProcess : {0} program run!!", ProjectName));
            #endregion Log Window Initialize

            #region SubWindow 생성 및 Event 등록
            #region Recipe Window Initialize
            //Recipe Initialize
            RecipeWnd = new RecipeWindow((eProjectType)ParamManager.SystemParam.ProjectType, ProjectName, ParamManager.SystemParam.LastRecipeName, ParamManager.SystemParam.IsTotalRecipe);
            RecipeWnd.RecipeChangeEvent += new RecipeWindow.RecipeChangeHandler(RecipeChange);
            RecipeWnd.RecipeCopyEvent   += new RecipeWindow.RecipeCopyHandler(RecipeCopy);
            #endregion Recipe Window Initialize

            #region Result Window Initialize
            //Result Initialize
            ResultBaseWnd = new MainResultBase(ParamManager.SystemParam.LastRecipeName);
            ResultBaseWnd.Initialize(this, ParamManager.SystemParam.ProjectType);
            ResultBaseWnd.SetWindowLocation(ParamManager.SystemParam.ResultWindowLocationX, ParamManager.SystemParam.ResultWindowLocationY);
            ResultBaseWnd.SetWindowSize(ParamManager.SystemParam.ResultWindowWidth, ParamManager.SystemParam.ResultWindowHeight);
            if (ParamManager.SystemParam.ProjectType == Convert.ToInt32(eProjectType.BLOWER))
            {
                ResultBaseWnd.ReadLOTNumEvent += new MainResultBase.ReadLOTNumHandler(SetBarcodeTextbox);
                ResultBaseWnd.EventInitialize();
                ResultBaseWnd.ClearResultData("", ParamManager.SystemParam.InDataFolderPath, ParamManager.SystemParam.OutDataFolderPath);
            }

            else
            {
                ResultBaseWnd.ClearResultData();
            }
            #endregion Result Window Initialize

            #region Light Window Initialize
            //Light Initialize
            LightControlManager = new CLightManager();
            LightControlManager.Initialize(ParamManager.SystemParam.LastRecipeName, ParamManager.SystemParam.IsTotalRecipe, ParamManager.SystemParam.IsSimulationMode);
            #endregion Light Window Initialize

            #region History Window Initialize
            HistoryManager = new CHistoryManager(ProjectName, ((eProjectType)ParamManager.SystemParam.ProjectType).ToString());
            #endregion History Window Initialize

            FolderPathWnd = new FolderPathWindow(ParamManager.SystemParam.IsSimulationMode);
            FolderPathWnd.SetDataPathEvent += new FolderPathWindow.SetDataPathHandler(SetDataFolderPath);
            FolderPathWnd.LOTChangeEvent   += new FolderPathWindow.LOTChangeHandler(MainProcessLOTChange);

            System.Threading.Thread.Sleep(100);
            #endregion SubWindow 생성 및 Event 등록

            #region Project 별 MainProcess Setting
            if ((int)eProjectType.NONE == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessDefault();
            }
            else if ((int)eProjectType.DISPENSER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessDispensor();
            }
            else if ((int)eProjectType.BLOWER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessID();
            }
            else if ((int)eProjectType.SORTER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessSorter();
            }
            else if ((int)eProjectType.TRIM == ParamManager.SystemParam.ProjectType)
            {
                MainProcess = new MainProcessTrimForm();
            }
            else
            {
                MainProcess = new MainProcessBase();
            }

            MainProcess.MainProcessCommandEvent += new MainProcessBase.MainProcessCommandHandler(MainProcessCommandEventFunction);
            MainProcess.Initialize(@"D:\VisionInspectionData\Common\");
            #endregion MainProcess Setting

            #region InspSysManager Initialize
            ISMModuleCount = ParamManager.SystemParam.InspSystemManagerCount;
            InspSysManager = new CInspectionSystemManager[ISMModuleCount];
            for (int iLoopCount = 0; iLoopCount < ISMModuleCount; ++iLoopCount)
            {
                InspSysManager[iLoopCount] = new CInspectionSystemManager(iLoopCount, "Vision" + (iLoopCount + 1), ParamManager.SystemParam.IsSimulationMode);
                InspSysManager[iLoopCount].InspSysManagerEvent += new CInspectionSystemManager.InspSysManagerHandler(InspectionSystemManagerEventFunction);
                InspSysManager[iLoopCount].Initialize(this, ParamManager.SystemParam.ProjectType, ParamManager.InspSysManagerParam[iLoopCount], ParamManager.InspParam[iLoopCount], ParamManager.SystemParam.LastRecipeName[iLoopCount]);

                //MapData 사용 여부 Check
                if ((int)eProjectType.NONE == ParamManager.SystemParam.ProjectType || (int)eProjectType.SORTER == ParamManager.SystemParam.ProjectType)
                {
                    InspSysManager[iLoopCount].SetMapDataParameter(ParamManager.InspMapDataParam[iLoopCount]);
                }
            }

            TimerShowWindow.Tick    += new EventHandler(TimerShowWindowTick);
            TimerShowWindow.Interval = 500;
            #endregion InspSysManager Initialize

            //LDH, 2018.09.19
            if ((int)eProjectType.BLOWER == ParamManager.SystemParam.ProjectType)
            {
                MainProcess.SendSerialData(eMainProcCmd.REQUEST);
                MainProcess.SendSerialData(eMainProcCmd.REQUEST, "LOT");
            }
        }