Esempio n. 1
0
        private static void UpdateButton()
        {
            if (m_iStep != EN_SEQ_STEP.Idle)
            {
                InspectHomeDone();
                if (!OM.CmnOptn.bIgnrDoor)
                {
                    InspectDoor();
                }
            }

            //Local Var.
            bool isErr     = ML.ER_IsErr();
            bool isHomeEnd = ML.MT_GetHomeDoneAll();

            //vision manual button.
            //CDelayTimer tmVisnCycle ;
            //if(IO_GetX(xETC_LStopSw)&& m_iSeqStat == ssStop ){
            //if(tmVisnCycle.OnDelay(true , 1000)) {
            //    tmVisnCycle.Clear();
            //    if(MM.GetManNo() == mcNoneCycle) {
            //        MM.SetManCycle(mcVSN_CycleWork);
            //    }
            //}
            //}
            //else {
            //tmVisnCycle.Clear();
            //}

            bool bStartSw = ML.IO_GetXUp(xi.ETC_LStartSw) || ML.IO_GetXUp(xi.ETC_RStartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ;
            bool bStopSw  = ML.IO_GetXUp(xi.ETC_LStopSw) || ML.IO_GetXUp(xi.ETC_RStopSw) || m_bBtnStop;    // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop  ;
            bool bResetSw = ML.IO_GetXUp(xi.ETC_LResetSw) || ML.IO_GetXUp(xi.ETC_RResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ;
            bool bAirSw   = ML.IO_GetXUp(xi.ETC_LAirSw) || ML.IO_GetXUp(xi.ETC_RAirSw) || m_bBtnAir;
            bool bInitSw  = ML.IO_GetXUp(xi.ETC_LInitSw) || ML.IO_GetXUp(xi.ETC_RInitSw);
            bool bVisnSw  = ML.IO_GetXUp(xi.ETC_LVisnSw) || ML.IO_GetXUp(xi.ETC_RVisnSw);


            if (m_bBtnStart)
            {
                Log.Trace("m_bBtnStart", "true");
            }
            if (bStartSw)
            {
                Log.Trace("bStartSw", "Started");

                if (MM.GetManNo() != (int)mc.NoneCycle)
                {
                    Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString()));
                    bStartSw = false;
                }
            }

            //Update Switch's Lamp
            bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick;

            //버튼 클릭시나
            ML.IO_SetY(yi.ETC_LStartLp, ML.IO_GetX(xi.ETC_LStartSw) || m_bRun);
            ML.IO_SetY(yi.ETC_RStartLp, ML.IO_GetX(xi.ETC_RStartSw) || m_bRun);
            ML.IO_SetY(yi.ETC_LStopLp, ML.IO_GetX(xi.ETC_LStopSw) || !m_bRun || bStopBtnFlick);
            ML.IO_SetY(yi.ETC_RStopLp, ML.IO_GetX(xi.ETC_RStopSw) || !m_bRun || bStopBtnFlick);
            ML.IO_SetY(yi.ETC_LResetLp, ML.IO_GetX(xi.ETC_LResetSw) || (m_bFlick && isErr));
            ML.IO_SetY(yi.ETC_RResetLp, ML.IO_GetX(xi.ETC_RResetSw) || (m_bFlick && isErr));
            ML.IO_SetY(yi.ETC_LAirLp, ML.IO_GetX(xi.ETC_LAirSw) || ML.IO_GetY(yi.ETC_MainAirOnOff));
            ML.IO_SetY(yi.ETC_RAirLp, ML.IO_GetX(xi.ETC_RAirSw) || ML.IO_GetY(yi.ETC_MainAirOnOff));
            ML.IO_SetY(yi.ETC_LInitLp, ML.IO_GetX(xi.ETC_LInitSw));
            ML.IO_SetY(yi.ETC_RInitLp, ML.IO_GetX(xi.ETC_RInitSw));
            ML.IO_SetY(yi.ETC_LVisnLp, ML.IO_GetX(xi.ETC_LVisnSw));
            ML.IO_SetY(yi.ETC_RVisnLp, ML.IO_GetX(xi.ETC_RVisnSw));

            //Center Man Button
            m_bBtnStart = false;
            m_bBtnStop  = false;
            m_bBtnReset = false;
            m_bBtnAir   = false;


            //Init. Button Flags.
            if (bStartSw)
            {
                if (!isHomeEnd)
                {
                    Log.ShowMessage("Error", "Machine Needed Initial"); bStartSw = false;
                }
                if (!LOT.GetLotOpen() && LOT.GetNextMgz() == "")
                {
                    Log.ShowMessage("Error", "Machine Need to Lot "); bStartSw = false;
                }                                                                                                                         //기존 랏오픈 패턴
                //if(LOT.GetNextMgz()=="") { Log.ShowMessage("Error" , "Machine Needed Lot List Registration"  ); bStartSw = false ; } //기존 랏오픈 패턴

                if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn)
                {
                    Reset();
                }
            }

            if (bInitSw)
            {
                if (!ML.IO_GetY(yi.ETC_MainAirOnOff))
                {
                    ML.ER_SetErr(ei.ETC_MainAir, "Check Main Air");
                    return;
                }

                MM.SetManCycle(mc.AllHome);
            }

            //Vision버튼 추가. 진섭
            if (bVisnSw)
            {
                if (!isHomeEnd)
                {
                    Log.ShowMessage("Error", "Machine Needed Initial");
                    //ML.ER_SetErr(ei.MTR_HomeEnd, "Machine Needed Initial");
                    return;
                }
                if (m_iSeqStat == EN_SEQ_STAT.Running || m_iSeqStat == EN_SEQ_STAT.Manual)
                {
                    Log.ShowMessage("Error", "Machine is not stopped.");
                    //ML.ER_SetErr(ei.)
                    return;
                }
                MM.SetManCycle(mc.VSNZ_Insp);
            }

            //Air Switch.
            if (bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init)
            {
                ML.IO_SetY(yi.ETC_MainAirOnOff, !ML.IO_GetY(yi.ETC_MainAirOnOff));
            }

            //Buzzer Off.
            if (isErr && bStopSw)
            {
                ML.TL_SetBuzzOff(true);
            }

            //Set Condition Flags.
            if (bStartSw)   //스타트버튼 안눌리는것 때문에 테스트.
            {
                Log.Trace("isErr", isErr ? "true":"false");
                Log.Trace("ManualMan.GetManNo()", string.Format(MM.GetManNo().ToString()));
            }
            if (bStopSw)
            {
                if (!_bRun && !MM.Working())
                {
                    ML.IO_SetY(yi.RAIL_FeedingAC1, false);
                    ML.IO_SetY(yi.RAIL_FeedingAC2, false);
                    ML.IO_SetY(yi.RAIL_FeedingAC3, false);
                }
                MM.Stop = true;
                Log.Trace("Stop", "Stop");
            }

            bool isStopCon  = bStopSw || (isErr && !m_bReqStop && m_bRun);
            bool isRunCon   = bStartSw && !isErr /*&& ManualMan.GetManNo() == mcNone*/;
            bool isResetCon = bResetSw && !m_bRun;

            //Run.
            if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle))
            {
                m_iStep = EN_SEQ_STEP.ToStartCon;
                ML.TL_SetBuzzOff(false);
                ML.ER_SetDisp(true);
            }
            if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트.
            {
                Log.Trace("isRunCon && m_iStep", string.Format(m_iStep.ToString()));
            }
            if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle))   //스타트버튼 안눌리는것 때문에 테스트.
            {
                Log.Trace("isStopCon  &&  m_iStep", string.Format(m_iStep.ToString()));
                Log.Trace("bStopSw", bStopSw    ? "True" : "False");
                Log.Trace("isErr", isErr      ? "True" : "False");
                Log.Trace("m_bReqStop", m_bReqStop ? "True" : "False");
                Log.Trace("m_bRun", m_bRun     ? "True" : "False");

                m_bReqStop = true;
            }

            if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle))
            {
                Reset();
            }

            if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 10000))
            {
                //Trace Log.
                string Msg;
                Msg = string.Format("ToStrtTimeOut : m_iStep=", m_iStep.ToString());
                Log.Trace("SEQ", Msg);
                ML.ER_SetErr(ei.ETC_ToStartTO);
                m_iStep = EN_SEQ_STEP.Idle;
                m_bRun  = false;
            }
            //CDelayTimer StopBtn = null;
            //StopBtn = new CDelayTimer();
            //if(m_iStep == EN_SEQ_STEP.scToStopCon)
            //{
            //    if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000))
            //    {
            //        Log.Trace("SEQ","Forced Stop");
            //        m_bRun = false ;
            //        m_iStep    = EN_SEQ_STEP.scIdle;
            //        m_bReqStop = false;
            //    }
            //}
            //else
            //{
            //    StopBtn.Clear();
            //}

            bool bVisnInsp = VSNZ.GetSeqStep() == (int)VisnZone.sc.Insp;

            if (m_tmToStop.OnDelay((m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && !bVisnInsp, 10000))
            {
                //Trace Log.
                string Msg;
                Msg = string.Format("ToStopTimeOut : m_iStep=", m_iStep.ToString());
                Log.Trace("SEQ", Msg);
                m_bRun = false;

                ML.ER_SetErr(ei.ETC_ToStopTO);
                m_iStep    = EN_SEQ_STEP.Idle;
                m_bReqStop = false;
            }

            EN_SEQ_STEP iPreStep = m_iStep;

            if (iPreStep != m_iStep)
            {
                string sMsg = "";
                sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString());
                Log.Trace("SEQ", sMsg);
            }
            iPreStep = m_iStep;


            //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠.
            bool bPreLotEnd = LOT.GetLotEnd();

            if (LOT.GetLotEnd() != bPreLotEnd)
            {
                Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False");
            }
            bPreLotEnd = LOT.GetLotEnd();

            //Running Step.
            switch (m_iStep)
            {
            case EN_SEQ_STEP.Idle:
                return;

            case EN_SEQ_STEP.ToStartCon:
                if (!ToStartCon())
                {
                    return;
                }
                m_iStep = EN_SEQ_STEP.ToStart;
                Log.Trace("SEQ", "scToStartCon END");
                return;

            case EN_SEQ_STEP.ToStart:
                if (!ToStart())
                {
                    return;
                }
                m_bRun     = true;
                m_bRunEdge = true;
                m_iStep    = EN_SEQ_STEP.Run;
                Log.Trace("SEQ", "scToStart END");
                return;

            case EN_SEQ_STEP.Run:
                if (!m_bReqStop)
                {
                    if (Autorun())
                    {
                        //랏엔드 상황.
                        LOT.LotEnd();
                        Log.ShowMessage("Checked", "Lot Ended.");
                        Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd");
                        m_bRunEnd = true;
                        m_iStep   = EN_SEQ_STEP.ToStopCon;
                    }
                    return;
                }
                m_bReqStop = false;
                m_iStep    = EN_SEQ_STEP.ToStopCon;
                Log.Trace("SEQ", "scRun END");
                return;

            case EN_SEQ_STEP.ToStopCon:
                if (!ToStopCon())
                {
                    if (Autorun())
                    {
                        //랏엔드 상황.
                        LOT.LotEnd();
                        Log.Trace("SEQ", "scToStopCon LotEnd");
                    }
                    return;
                }
                m_bRun  = false;
                m_iStep = EN_SEQ_STEP.ToStop;
                Log.Trace("SEQ", "scToStopCon END");
                return;

            case EN_SEQ_STEP.ToStop:
                if (!ToStop())
                {
                    return;
                }
                m_iStep    = EN_SEQ_STEP.Idle;
                m_bReqStop = false;

                DM.SaveMap();
                Log.Trace("SEQ", "scToStop END");

                return;
            }
        }
Esempio n. 2
0
        private static void UpdateButton()
        {
            //Check Inspect.
            //if (!OM.CmnOptn.bIgnrDoor)
            InspectDoor();

            if (m_iStep != EN_SEQ_STEP.Idle)
            {
                InspectHomeDone();
            }

            if (m_iStep == EN_SEQ_STEP.Idle)
            {
                InspectLightGrid();
            }
            //Local Var.
            bool isErr    = ML.ER_IsErr();
            bool bStartSw = ML.IO_GetXUp(xi.ETC_StartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ;
            bool bStopSw  = ML.IO_GetXUp(xi.ETC_StopSw) || m_bBtnStop;   // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop  ;
            bool bResetSw = ML.IO_GetXUp(xi.ETC_ResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ;
            bool bAirSw   = false;                                       //ML.IO_GetXUp(xi.ETC_AirSw  ) || m_bBtnAir ;
            bool bInitSw  = false;                                       //ML.IO_GetXUp(xi.ETC_InitSw ) ;
            bool bMotorSw = ML.IO_GetXUp(xi.ETC_MotorSw);

            if (m_bBtnStart)
            {
                Log.Trace("m_bBtnStart", "true");
            }
            if (bStartSw)
            {
                Log.Trace("bStartSw", "Started");

                if (m_iSeqStat == EN_SEQ_STAT.Init)
                {
                    Log.Trace("SeqStat", "ssInit   ");
                }
                if (m_iSeqStat == EN_SEQ_STAT.WorkEnd)
                {
                    Log.Trace("SeqStat", "ssWorkEnd");
                }
                if (m_iSeqStat == EN_SEQ_STAT.Error)
                {
                    Log.Trace("SeqStat", "ssError  ");
                }
                if (m_iSeqStat == EN_SEQ_STAT.Running)
                {
                    Log.Trace("SeqStat", "ssRunning");
                }
                if (m_iSeqStat == EN_SEQ_STAT.Stop)
                {
                    Log.Trace("SeqStat", "ssStop   ");
                }
                if (m_iSeqStat == EN_SEQ_STAT.RunWarn)
                {
                    Log.Trace("SeqStat", "ssRunWarn");
                }

                if (MM.GetManNo() != (int)mc.NoneCycle)
                {
                    Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString()));
                    bStartSw = false;
                }
            }


            //Update Switch's Lamp
            bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick;


            //버튼 클릭시나
            ML.IO_SetY(yi.ETC_StartLp, ML.IO_GetX(xi.ETC_StartSw) || m_bRun);
            ML.IO_SetY(yi.ETC_StopLp, ML.IO_GetX(xi.ETC_StopSw) || !m_bRun || bStopBtnFlick);
            ML.IO_SetY(yi.ETC_ResetLp, ML.IO_GetX(xi.ETC_ResetSw) || (m_bFlick && isErr));
            //ML.IO_SetY(yi.ETC_AirLp    , ML.IO_GetX(xi.ETC_AirSw   ) || ML.IO_GetY(yi.ETC_MainAirSol       ));
            //ML.IO_SetY(yi.ETC_InitLp   , ML.IO_GetX(xi.ETC_InitSw  )                                        );

            ML.IO_SetY(yi.ETC_MotorLp, ML.MT_GetServo(mi.OUT_TRelT));

            //Center Man Button
            m_bBtnStart = false;
            m_bBtnStop  = false;
            m_bBtnReset = false;
            m_bBtnAir   = false;


            //Init. Button Flags.
            bool isHomeEnd = ML.MT_GetHomeDoneAll();

            if (bStartSw)
            {
                if (!isHomeEnd)
                {
                    Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false;
                }
                //if(!LOT.GetLotOpen     ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; }
                //if(!InspectStripDispr  ()) { m_bInspDispr = true ; bStartSw = false ; }
                //if(!InspectStripUnknown()) { m_bInspUnkwn = true ; bStartSw = false ; }

                if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn)
                {
                    Reset();
                }
            }

            if (bInitSw)
            {
                MM.SetManCycle(mc.AllHome);
            }

            if (bMotorSw)
            {
                if (ML.MT_GetServo(mi.OUT_TRelT))
                {
                    ML.MT_SetServo(mi.OUT_TRelT, false);
                    ML.MT_SetServo(mi.OUT_TRelB, false);
                }
                else
                {
                    ML.MT_SetServo(mi.OUT_TRelT, true);
                    ML.MT_SetServo(mi.OUT_TRelB, true);

                    ML.MT_SetHomeDone(mi.OUT_TRelT, true);
                    ML.MT_SetHomeDone(mi.OUT_TRelB, true);
                }
            }

            //Air Switch.
            //if(bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init)
            //{
            //    ML.IO_SetY(yi.ETC_MainAirSol , !ML.IO_GetY(yi.ETC_MainAirSol )) ;
            //}

            //Buzzer Off.
            if (isErr && bStopSw)
            {
                ML.TL_SetBuzzOff(true);
            }

            bool isStopCon  = bStopSw || (isErr && !m_bReqStop && m_bRun);
            bool isRunCon   = bStartSw && !isErr;
            bool isResetCon = bResetSw && !m_bRun;

            //Run.
            if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle))
            {
                m_iStep = EN_SEQ_STEP.ToStartCon;
                ML.TL_SetBuzzOff(false);
                ML.ER_SetDisp(true);
            }

            if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle))    //스타트버튼 안눌리는것 때문에 테스트.
            {
                m_bReqStop = true;
            }

            if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle))
            {
                Reset();
            }

            if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 10000))
            {
                //Trace Log.
                string Msg;
                Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep);
                Log.Trace("SEQ", Msg);
                ML.ER_SetErr(ei.ETC_ToStartTO);
                m_iStep = EN_SEQ_STEP.Idle;
                m_bRun  = false;
            }

            //CDelayTimer StopBtn = null;
            //StopBtn = new CDelayTimer();
            //if(m_iStep == EN_SEQ_STEP.scToStopCon)
            //{
            //    if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000))
            //    {
            //        Log.Trace("SEQ","Forced Stop");
            //        m_bRun = false ;
            //        m_iStep    = EN_SEQ_STEP.scIdle;
            //        m_bReqStop = false;
            //    }
            //}
            //else
            //{
            //    StopBtn.Clear();
            //}


            if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 10000))        //  20000)) {
            {
                //Trace Log.
                string Msg;
                Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep);
                Log.Trace("SEQ", Msg);
                m_bRun = false;

                ML.ER_SetErr(ei.ETC_ToStopTO);
                m_iStep    = EN_SEQ_STEP.Idle;
                m_bReqStop = false;
            }

            EN_SEQ_STEP iPreStep = m_iStep;

            if (iPreStep != m_iStep)
            {
                string sMsg = "";
                sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString());
                Log.Trace("SEQ", sMsg);
            }
            iPreStep = m_iStep;


            //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠.
            bool bPreLotEnd = LOT.GetLotEnd();

            if (LOT.GetLotEnd() != bPreLotEnd)
            {
                Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False");
            }
            bPreLotEnd = LOT.GetLotEnd();



            //Running Step.
            switch (m_iStep)
            {
            case EN_SEQ_STEP.Idle: return;

            case EN_SEQ_STEP.ToStartCon: if (!ToStartCon())
                {
                    return;
                }
                m_iStep = EN_SEQ_STEP.ToStart;
                Log.Trace("SEQ", "scToStartCon END");
                return;

            case EN_SEQ_STEP.ToStart: if (!ToStart())
                {
                    return;
                }
                m_bRun     = true;
                m_bRunEdge = true;
                m_iStep    = EN_SEQ_STEP.Run;
                Log.Trace("SEQ", "scToStart END");
                return;

            case EN_SEQ_STEP.Run: if (!m_bReqStop)
                {
                    if (Autorun())
                    {
                        //랏엔드 상황.
                        LOT.LotEnd();
                        Log.ShowMessage("Checked", "Lot Ended.");
                        Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd");
                        m_bRunEnd = true;
                        m_iStep   = EN_SEQ_STEP.ToStopCon;
                    }
                    return;
                }
                m_bReqStop = false;
                m_iStep    = EN_SEQ_STEP.ToStopCon;
                Log.Trace("SEQ", "scRun END");
                return;

            case EN_SEQ_STEP.ToStopCon:  if (!ToStopCon())
                {
                    if (Autorun())
                    {
                        //랏엔드 상황.
                        LOT.LotEnd();
                        Log.Trace("SEQ", "scToStopCon LotEnd");
                    }
                    return;
                }
                m_bRun  = false;
                m_iStep = EN_SEQ_STEP.ToStop;
                Log.Trace("SEQ", "scToStopCon END");
                return;

            case EN_SEQ_STEP.ToStop:  if (!ToStop())
                {
                    return;
                }
                m_iStep    = EN_SEQ_STEP.Idle;
                m_bReqStop = false;

                DM.SaveMap();
                Log.Trace("SEQ", "scToStop END");

                return;
            }
        }
Esempio n. 3
0
        private void tmUpdate_Tick(object sender, EventArgs e)
        {
            tmUpdate.Enabled = false;
            //로그인/로그아웃 방식
            if (SM.FrmLogOn.GetLevel() == (int)EN_LEVEL.LogOff)
            {
                btOperator.Text = "  LOG IN";

                pnManual.Enabled = false;
            }
            else
            {
                btOperator.Text = "  " + SM.FrmLogOn.GetLevel().ToString();

                pnManual.Enabled = true;
            }

            //if (SML.FrmLogOn.GetLevel() != (int)EN_LEVEL.LogOff)
            //{
            //    btStart.Enabled = LOT.GetLotOpen();
            //}

            SPC.LOT.DispLotInfo(lvLotInfo);
            SPC.DAY.DispDayInfo(lvDayInfo);

            string Str;
            int    iPreErrCnt  = 0;
            int    iCrntErrCnt = 0;

            for (int i = 0; i < ML.ER_MaxCount(); i++)
            {
                if (ML.ER_GetErr((ei)i))
                {
                    iCrntErrCnt++;
                }
            }
            if (iPreErrCnt != iCrntErrCnt)
            {
                lbErr.Items.Clear();
                int iErrNo = ML.ER_GetLastErr();
                for (int i = 0; i < ML.ER_MaxCount(); i++)
                {
                    if (ML.ER_GetErr((ei)i))
                    {
                        Str  = string.Format("[ERR{0:000}]", i);
                        Str += ML.ER_GetErrName(i) + " " + ML.ER_GetErrSubMsg((ei)i);
                        lbErr.Items.Add(Str);
                    }
                }
            }
            if (SEQ._iSeqStat != EN_SEQ_STAT.Error)
            {
                lbErr.Items.Clear();
            }
            iPreErrCnt = iCrntErrCnt;

            if (!ML.MT_GetHomeDoneAll())
            {
                btAllHome.ForeColor = SEQ._bFlick ? Color.Black : Color.Red;
            }
            else
            {
                btAllHome.ForeColor = Color.Black;
            }

            if (LOT.GetLotOpen() && !SEQ._bRun)
            {
                btLotOpen.Text = "WORK ING";
                //btLotOpen.Enabled = true;
                btLotEnd.Enabled = true;
            }
            else
            {
                btLotOpen.Text = "WORK STT";
                //btLotOpen.Enabled = true ;
                btLotEnd.Enabled = false;
            }

            //결과 색 이름 표기
            pnC0.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor0); lbC0.Text = OM.CmnOptn.sRsltName0; lbCnt0.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt0].ToString();
            pnC1.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor1); lbC1.Text = OM.CmnOptn.sRsltName1; lbCnt1.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt1].ToString();
            pnC2.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor2); lbC2.Text = OM.CmnOptn.sRsltName2; lbCnt2.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt2].ToString();
            pnC3.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor3); lbC3.Text = OM.CmnOptn.sRsltName3; lbCnt3.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt3].ToString();
            pnC4.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor4); lbC4.Text = OM.CmnOptn.sRsltName4; lbCnt4.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt4].ToString();
            pnC5.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor5); lbC5.Text = OM.CmnOptn.sRsltName5; lbCnt5.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt5].ToString();
            pnC6.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor6); lbC6.Text = OM.CmnOptn.sRsltName6; lbCnt6.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt6].ToString();
            pnC7.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor7); lbC7.Text = OM.CmnOptn.sRsltName7; lbCnt7.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt7].ToString();
            pnC8.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor8); lbC8.Text = OM.CmnOptn.sRsltName8; lbCnt8.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt8].ToString();
            pnC9.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor9); lbC9.Text = OM.CmnOptn.sRsltName9; lbCnt9.Text = OM.EqpStat.iRsltCnts[(int)cs.Rslt9].ToString();
            pnCA.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorA); lbCA.Text = OM.CmnOptn.sRsltNameA; lbCntA.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltA].ToString();
            pnCB.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorB); lbCB.Text = OM.CmnOptn.sRsltNameB; lbCntB.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltB].ToString();
            pnCC.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorC); lbCC.Text = OM.CmnOptn.sRsltNameC; lbCntC.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltC].ToString();
            pnCD.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorD); lbCD.Text = OM.CmnOptn.sRsltNameD; lbCntD.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltD].ToString();
            pnCE.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorE); lbCE.Text = OM.CmnOptn.sRsltNameE; lbCntE.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltE].ToString();
            pnCF.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorF); lbCF.Text = OM.CmnOptn.sRsltNameF; lbCntF.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltF].ToString();
            pnCG.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorG); lbCG.Text = OM.CmnOptn.sRsltNameG; lbCntG.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltG].ToString();
            pnCH.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorH); lbCH.Text = OM.CmnOptn.sRsltNameH; lbCntH.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltH].ToString();
            pnCI.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorI); lbCI.Text = OM.CmnOptn.sRsltNameI; lbCntI.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltI].ToString();
            pnCJ.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorJ); lbCJ.Text = OM.CmnOptn.sRsltNameJ; lbCntJ.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltJ].ToString();
            pnCK.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorK); lbCK.Text = OM.CmnOptn.sRsltNameK; lbCntK.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltK].ToString();
            pnCL.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorL); lbCL.Text = OM.CmnOptn.sRsltNameL; lbCntL.Text = OM.EqpStat.iRsltCnts[(int)cs.RsltL].ToString();

            C0.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor0);   T0.Text = OM.CmnOptn.sRsltName0;     N0.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt0].ToString();
            C1.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor1);   T1.Text = OM.CmnOptn.sRsltName1;     N1.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt1].ToString();
            C2.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor2);   T2.Text = OM.CmnOptn.sRsltName2;     N2.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt2].ToString();
            C3.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor3);   T3.Text = OM.CmnOptn.sRsltName3;     N3.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt3].ToString();
            C4.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor4);   T4.Text = OM.CmnOptn.sRsltName4;     N4.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt4].ToString();
            C5.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor5);   T5.Text = OM.CmnOptn.sRsltName5;     N5.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt5].ToString();
            C6.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor6);   T6.Text = OM.CmnOptn.sRsltName6;     N6.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt6].ToString();
            C7.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor7);   T7.Text = OM.CmnOptn.sRsltName7;     N7.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt7].ToString();
            C8.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor8);   T8.Text = OM.CmnOptn.sRsltName8;     N8.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt8].ToString();
            C9.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColor9);   T9.Text = OM.CmnOptn.sRsltName9;     N9.Text = OM.EqpStat.iPreRsltCnts[(int)cs.Rslt9].ToString();
            CA.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorA);   TA.Text = OM.CmnOptn.sRsltNameA;     NA.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltA].ToString();
            CB.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorB);   TB.Text = OM.CmnOptn.sRsltNameB;     NB.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltB].ToString();
            CC.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorC);   TC.Text = OM.CmnOptn.sRsltNameC;     NC.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltC].ToString();
            CD.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorD);   TD.Text = OM.CmnOptn.sRsltNameD;     ND.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltD].ToString();
            CE.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorE);   TE.Text = OM.CmnOptn.sRsltNameE;     NE.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltE].ToString();
            CF.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorF);   TF.Text = OM.CmnOptn.sRsltNameF;     NF.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltF].ToString();
            CG.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorG);   TG.Text = OM.CmnOptn.sRsltNameG;     NG.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltG].ToString();
            CH.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorH);   TH.Text = OM.CmnOptn.sRsltNameH;     NH.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltH].ToString();
            CI.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorI);   TI.Text = OM.CmnOptn.sRsltNameI;     NI.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltI].ToString();
            CJ.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorJ);   TJ.Text = OM.CmnOptn.sRsltNameJ;     NJ.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltJ].ToString();
            CK.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorK);   TK.Text = OM.CmnOptn.sRsltNameK;     NK.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltK].ToString();
            CL.BackColor = Color.FromArgb(OM.CmnOptn.iRsltColorL);   TL.Text = OM.CmnOptn.sRsltNameL;     NL.Text = OM.EqpStat.iPreRsltCnts[(int)cs.RsltL].ToString();


            //인풋
            lbPREB_PkgInDetect.BackColor = ML.IO_GetX(xi.PREB_PkgInDetect) ? Color.Lime : Color.Gray; lbPREB_PkgInDetect.Text = ML.IO_GetX(xi.PREB_PkgInDetect) ? "ON" : "OFF";
            lbPREB_StrpDetect.BackColor  = ML.IO_GetX(xi.PREB_StrpDetect) ? Color.Lime : Color.Gray; lbPREB_StrpDetect.Text = ML.IO_GetX(xi.PREB_StrpDetect) ? "ON" : "OFF";
            lbRAIL_Vsn1Detect.BackColor  = ML.IO_GetX(xi.RAIL_Vsn1Detect) ? Color.Lime : Color.Gray; lbRAIL_Vsn1Detect.Text = ML.IO_GetX(xi.RAIL_Vsn1Detect) ? "ON" : "OFF";
            lbRAIL_Vsn2Detect.BackColor  = ML.IO_GetX(xi.RAIL_Vsn2Detect) ? Color.Lime : Color.Gray; lbRAIL_Vsn2Detect.Text = ML.IO_GetX(xi.RAIL_Vsn2Detect) ? "ON" : "OFF";
            lbRAIL_Vsn3Detect.BackColor  = ML.IO_GetX(xi.RAIL_Vsn3Detect) ? Color.Lime : Color.Gray; lbRAIL_Vsn3Detect.Text = ML.IO_GetX(xi.RAIL_Vsn3Detect) ? "ON" : "OFF";
            lbPSTB_MarkDetect.BackColor  = ML.IO_GetX(xi.PSTB_MarkDetect) ? Color.Lime : Color.Gray; lbPSTB_MarkDetect.Text = ML.IO_GetX(xi.PSTB_MarkDetect) ? "ON" : "OFF";
            lbPSTB_PkgDetect1.BackColor  = ML.IO_GetX(xi.PSTB_PkgDetect1) ? Color.Lime : Color.Gray; lbPSTB_PkgDetect1.Text = ML.IO_GetX(xi.PSTB_PkgDetect1) ? "ON" : "OFF";
            lbPSTB_PkgDetect2.BackColor  = ML.IO_GetX(xi.PSTB_PkgDetect2) ? Color.Lime : Color.Gray; lbPSTB_PkgDetect2.Text = ML.IO_GetX(xi.PSTB_PkgDetect2) ? "ON" : "OFF";

            //실린더
            lbPREB_StprUpDn.BackColor     = ML.CL_GetCmd(ci.PREB_StprUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbPREB_StprUpDn.Text = ML.CL_GetCmd(ci.PREB_StprUpDn) == fb.Fwd ? "UP" : "DN";
            lbRAIL_Vsn1StprUpDn.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn1StprUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn1StprUpDn.Text = ML.CL_GetCmd(ci.RAIL_Vsn1StprUpDn) == fb.Fwd ? "UP" : "DN";
            lbRAIL_Vsn2StprUpDn.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn2StprUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn2StprUpDn.Text = ML.CL_GetCmd(ci.RAIL_Vsn2StprUpDn) == fb.Fwd ? "UP" : "DN";
            lbRAIL_Vsn3StprUpDn.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn3StprUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn3StprUpDn.Text = ML.CL_GetCmd(ci.RAIL_Vsn3StprUpDn) == fb.Fwd ? "UP" : "DN";
            lbPSTB_MarkStprUpDn.BackColor = ML.CL_GetCmd(ci.PSTB_MarkStprUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbPSTB_MarkStprUpDn.Text = ML.CL_GetCmd(ci.PSTB_MarkStprUpDn) == fb.Fwd ? "UP" : "DN";

            lbPSTB_PusherFwBw.BackColor = ML.CL_GetCmd(ci.PSTB_PusherFwBw) == fb.Fwd ? Color.Aqua : Color.Yellow; lbPSTB_PusherFwBw.Text = ML.CL_GetCmd(ci.PSTB_PusherFwBw) == fb.Fwd ? "FW" : "BW";

            lbRAIL_Vsn1AlignFwBw.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn1AlignFwBw) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn1AlignFwBw.Text = ML.CL_GetCmd(ci.RAIL_Vsn1AlignFwBw) == fb.Fwd ? "FW" : "BW";
            lbRAIL_Vsn2AlignFwBw.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn2AlignFwBw) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn2AlignFwBw.Text = ML.CL_GetCmd(ci.RAIL_Vsn2AlignFwBw) == fb.Fwd ? "FW" : "BW";
            lbRAIL_Vsn3AlignFwBw.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn3AlignFwBw) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn3AlignFwBw.Text = ML.CL_GetCmd(ci.RAIL_Vsn3AlignFwBw) == fb.Fwd ? "FW" : "BW";
            lbPSTB_MarkAlignFWBw.BackColor = ML.CL_GetCmd(ci.PSTB_MarkAlignFWBw) == fb.Fwd ? Color.Aqua : Color.Yellow; lbPSTB_MarkAlignFWBw.Text = ML.CL_GetCmd(ci.PSTB_MarkAlignFWBw) == fb.Fwd ? "FW" : "BW";

            lbRAIL_Vsn1SttnUpDn.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn1SttnUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn1SttnUpDn.Text = ML.CL_GetCmd(ci.RAIL_Vsn1SttnUpDn) == fb.Fwd ? "UP" : "DN";
            lbRAIL_Vsn2SttnUpDn.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn2SttnUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn2SttnUpDn.Text = ML.CL_GetCmd(ci.RAIL_Vsn2SttnUpDn) == fb.Fwd ? "UP" : "DN";
            lbRAIL_Vsn3SttnUpDn.BackColor = ML.CL_GetCmd(ci.RAIL_Vsn3SttnUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbRAIL_Vsn3SttnUpDn.Text = ML.CL_GetCmd(ci.RAIL_Vsn3SttnUpDn) == fb.Fwd ? "UP" : "DN";
            lbPSTB_MarkSttnUpDn.BackColor = ML.CL_GetCmd(ci.PSTB_MarkSttnUpDn) == fb.Fwd ? Color.Aqua : Color.Yellow; lbPSTB_MarkSttnUpDn.Text = ML.CL_GetCmd(ci.PSTB_MarkSttnUpDn) == fb.Fwd ? "UP" : "DN";

            //아웃풋.
            lbRAIL_FeedingAC1.BackColor = ML.IO_GetY(yi.RAIL_FeedingAC1) ? Color.Lime : Color.Gray; lbRAIL_FeedingAC1.Text = ML.IO_GetY(yi.RAIL_FeedingAC1) ? "ON" : "OFF";
            lbRAIL_FeedingAC2.BackColor = ML.IO_GetY(yi.RAIL_FeedingAC2) ? Color.Lime : Color.Gray; lbRAIL_FeedingAC2.Text = ML.IO_GetY(yi.RAIL_FeedingAC2) ? "ON" : "OFF";
            lbRAIL_FeedingAC3.BackColor = ML.IO_GetY(yi.RAIL_FeedingAC3) ? Color.Lime : Color.Gray; lbRAIL_FeedingAC3.Text = ML.IO_GetY(yi.RAIL_FeedingAC3) ? "ON" : "OFF";
            lbMainAir.BackColor         = ML.IO_GetY(yi.ETC_MainAirOnOff) ? Color.Lime : Color.Gray; lbMainAir.Text = ML.IO_GetY(yi.ETC_MainAirOnOff) ? "ON" : "OFF";

            PanelRefresh();

            //Strip Check
            bool Strip1 = !DM.ARAY[ri.PREB].CheckAllStat(cs.None); bool Sensor1 = ML.IO_GetX(xi.PREB_StrpDetect);
            bool Strip2 = !DM.ARAY[ri.VSN1].CheckAllStat(cs.None); bool Sensor2 = ML.IO_GetX(xi.RAIL_Vsn1Detect);
            bool Strip3 = !DM.ARAY[ri.VSN2].CheckAllStat(cs.None); bool Sensor3 = ML.IO_GetX(xi.RAIL_Vsn2Detect);
            bool Strip4 = !DM.ARAY[ri.VSN3].CheckAllStat(cs.None); bool Sensor4 = ML.IO_GetX(xi.RAIL_Vsn3Detect);
            bool Strip5 = !DM.ARAY[ri.PSTB].CheckAllStat(cs.None); bool Sensor5 = ML.IO_GetX(xi.PSTB_MarkDetect) || ML.IO_GetX(xi.PSTB_PkgDetect1) || ML.IO_GetX(xi.PSTB_PkgDetect2);

            bool Lift1Dn = ML.CL_Complete(ci.RAIL_Vsn1SttnUpDn, fb.Bwd);
            bool Lift2Dn = ML.CL_Complete(ci.RAIL_Vsn2SttnUpDn, fb.Bwd);
            bool Lift3Dn = ML.CL_Complete(ci.RAIL_Vsn3SttnUpDn, fb.Bwd);
            bool Lift4Dn = ML.CL_Complete(ci.PSTB_MarkSttnUpDn, fb.Bwd);

            if (Strip1 && Sensor1)
            {
                s1.Visible = true;
            }
            else if (!Strip1 && !Sensor1)
            {
                s1.Visible = false;
            }
            else
            {
                s1.Visible = SEQ._bFlick ? true : false;
            }
            if (Strip2 && Sensor2)
            {
                s2.Visible = true;
            }
            else if (Strip2 && !Sensor2 && !Lift1Dn)
            {
                s2.Visible = true;
            }
            else if (!Strip2 && !Sensor2)
            {
                s2.Visible = false;
            }
            else
            {
                s2.Visible = SEQ._bFlick ? true : false;
            }
            if (Strip3 && Sensor3)
            {
                s3.Visible = true;
            }
            else if (Strip3 && !Sensor3 && !Lift2Dn)
            {
                s3.Visible = true;
            }
            else if (!Strip3 && !Sensor3)
            {
                s3.Visible = false;
            }
            else
            {
                s3.Visible = SEQ._bFlick ? true : false;
            }
            if (Strip4 && Sensor4)
            {
                s4.Visible = true;
            }
            else if (Strip4 && !Sensor4 && !Lift3Dn)
            {
                s4.Visible = true;
            }
            else if (!Strip4 && !Sensor4)
            {
                s4.Visible = false;
            }
            else
            {
                s4.Visible = SEQ._bFlick ? true : false;
            }
            if (Strip5 && Sensor5)
            {
                s5.Visible = true;
            }
            else if (Strip5 && !Sensor5 && !Lift4Dn)
            {
                s5.Visible = true;
            }
            else if (!Strip5 && !Sensor5)
            {
                s5.Visible = false;
            }
            else
            {
                s5.Visible = SEQ._bFlick ? true : false;
            }



            //Sensor
            RA1.BackColor = ML.IO_GetX(xi.PREB_PkgInDetect) ? Color.Lime : SystemColors.ActiveCaption;
            RA2.BackColor = ML.IO_GetX(xi.PREB_StrpDetect) ? Color.Lime : SystemColors.ActiveCaption;
            RB1.BackColor = ML.IO_GetX(xi.RAIL_Vsn1Detect) ? Color.Lime : SystemColors.ActiveCaption;
            RC1.BackColor = ML.IO_GetX(xi.RAIL_Vsn2Detect) ? Color.Lime : SystemColors.ActiveCaption;
            RD1.BackColor = ML.IO_GetX(xi.RAIL_Vsn3Detect) ? Color.Lime : SystemColors.ActiveCaption;
            RE1.BackColor = ML.IO_GetX(xi.PSTB_MarkDetect) ? Color.Lime : SystemColors.ActiveCaption;
            RF1.BackColor = ML.IO_GetX(xi.PSTB_PkgDetect1) ? Color.Lime : SystemColors.ActiveCaption;
            RF2.BackColor = ML.IO_GetX(xi.PSTB_PkgDetect2) ? Color.Lime : SystemColors.ActiveCaption;

            tmUpdate.Enabled = true;
        }
Esempio n. 4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            tmUpdate.Enabled = false;

            //Information
            lbDevice.Text = OM.GetCrntDev().ToString();
            lbLotNo.Text  = LOT.GetLotNo();

            btStart.Enabled  = LOT.GetLotOpen();
            btLotEnd.Enabled = LOT.GetLotOpen();

            bool bRet = false;

            IsWow64Process(System.Diagnostics.Process.GetCurrentProcess().Handle, out bRet);
            //if (bRet) label3.Text = "32BIt";
            //else label3.Text = "64BIt";

            //패스워드만 쓰는 방식
            //int iLevel = (int)FormPassword.GetLevel();
            //switch (iLevel)
            //{
            //    case (int)EN_LEVEL.Operator: btOperator.Text = "OPERATOR"; break;
            //    case (int)EN_LEVEL.Engineer: btOperator.Text = "ENGINEER"; break;
            //    case (int)EN_LEVEL.Master  : btOperator.Text = " ADMIN  "; break;
            //    default                    : btOperator.Text = " ERROR  "; break;
            //}

            //로그인/로그아웃 방식
            if (SM.FrmLogOn.GetLevel() == (int)EN_LEVEL.LogOff)
            {
                btOperator.Text = "  LOG IN";

                pnULDR.Enabled = false;
                pnPSHR.Enabled = false;
                pnPICK.Enabled = false;
                pnPULD.Enabled = false;
                pnTULD.Enabled = false;
                pnTMRK.Enabled = false;
                pnTRJM.Enabled = false;
                pnTVSN.Enabled = false;
                pnTLDR.Enabled = false;
                pnTRJV.Enabled = false;
                pnPLDR.Enabled = false;
                pnLODR.Enabled = false;

                //pnDataMap .Enabled = false;
                //pnDayInfo .Enabled = false;
                pnLotInfo.Enabled = false;
                pnError.Enabled   = false;
                pnOperMan.Enabled = false;
                //pnWorkInfo.Enabled = false;
                pnLotOpen.Enabled = false;
                //btStart   .Enabled = LOT.LotList.Count == 0 || !LOT.LotOpened;
                btStart.Enabled    = false;
                btStop.Enabled     = false;
                btReset.Enabled    = false;
                btHome.Enabled     = false;
                btOperator.Enabled = true;
            }
            else
            {
                pnULDR.Enabled = true;
                pnPSHR.Enabled = true;
                pnPICK.Enabled = true;
                pnPULD.Enabled = true;
                pnTULD.Enabled = true;
                pnTMRK.Enabled = true;
                pnTRJM.Enabled = true;
                pnTVSN.Enabled = true;
                pnTLDR.Enabled = true;
                pnTRJV.Enabled = true;
                pnPLDR.Enabled = true;
                pnLODR.Enabled = true;

                btOperator.Text = "  " + SM.FrmLogOn.GetLevel().ToString();

                //pnDataMap .Enabled = true;
                //pnDayInfo .Enabled = true;
                pnLotInfo.Enabled = true;
                pnError.Enabled   = true;
                pnOperMan.Enabled = true;
                //pnWorkInfo.Enabled = true;
                pnLotOpen.Enabled = true;
                //btStart   .Enabled = LOT.LotList.Count != 0 || LOT.LotOpened;
                //btStart   .Enabled = true;
                btStop.Enabled  = true;
                btReset.Enabled = true;
                btHome.Enabled  = true;
            }

            //if (SML.FrmLogOn.GetLevel() != (int)EN_LEVEL.LogOff)
            //{
            //    btStart.Enabled = LOT.GetLotOpen();
            //}

            TimeSpan Span;

            try{
                Span = TimeSpan.FromMilliseconds(SPC.LOT.Data.RunTime);
            }
            catch (Exception ex) {
                Span = TimeSpan.FromMilliseconds(0);
            }

            //SPC.LOT.DispLotInfo(lvLotInfo);
            //SPC.DAY.DispDayInfo(lvDayInfo);

            string Str;
            int    iPreErrCnt  = 0;
            int    iCrntErrCnt = 0;

            for (int i = 0; i < ML.ER_MaxCount(); i++)
            {
                if (ML.ER_GetErr((ei)i))
                {
                    iCrntErrCnt++;
                }
            }
            if (iPreErrCnt != iCrntErrCnt)
            {
                lbErr.Items.Clear();
                int iErrNo = ML.ER_GetLastErr();
                for (int i = 0; i < ML.ER_MaxCount(); i++)
                {
                    if (ML.ER_GetErr((ei)i))
                    {
                        Str  = string.Format("[ERR{0:000}]", i);
                        Str += ML.ER_GetErrName(i) + " " + ML.ER_GetErrSubMsg((ei)i);
                        lbErr.Items.Add(Str);
                    }
                }
            }
            if (SEQ._iSeqStat != EN_SEQ_STAT.Error)
            {
                lbErr.Items.Clear();
            }
            iPreErrCnt = iCrntErrCnt;


            WorkInfo();
            string sCycleTimeSec;
            int    iCycleTimeMs;


            //Door Sensor.  나중에 찾아보자
            //bool isAllCloseDoor = SM.IO.GetX((int)EN_INPUT_ID.xETC_DoorFt) &&
            //                      SM.IO.GetX((int)EN_INPUT_ID.xETC_DoorLt) &&
            //                      SM.IO.GetX((int)EN_INPUT_ID.xETC_DoorRt) &&
            //                      SM.IO.GetX((int)EN_INPUT_ID.xETC_DoorRr) ;
            //if (FormPassword.GetLevel() != EN_LEVEL.lvOperator && isAllCloseDoor && CMachine._bRun)
            //{
            //    //FM_SetLevel(lvOperator);
            //}

            if (!ML.MT_GetHomeDoneAll())
            {
                btAllHome.ForeColor = SEQ._bFlick ? Color.Black : Color.Red;
            }
            else
            {
                btAllHome.ForeColor = Color.Black;
            }

            SPC.LOT.DispLotInfo(lvLotInfo);

            //Refresh();
            //Invalidate(true);
            pnULDR.Invalidate(true);
            pnPSHR.Invalidate(true);
            pnPICK.Invalidate(true);
            pnPULD.Invalidate(true);
            pnTULD.Invalidate(true);
            pnTMRK.Invalidate(true);
            pnTRJM.Invalidate(true);
            pnTVSN.Invalidate(true);
            pnTLDR.Invalidate(true);
            pnTRJV.Invalidate(true);
            pnPLDR.Invalidate(true);
            pnLODR.Invalidate(true);
            //pnLODR.Update();


            if (ML.IO_GetY(yi.ETC_LightOn))
            {
                btlightOn.Text = " LIGHT ON ";
            }                                                                    //btlightOn.BackColor = Color.Lime;}
            else
            {
                btlightOn.Text = " LIGHT OFF";
            }                                                                    //btlightOn.BackColor = Color.Red ;}

            if (ML.IO_GetY(yi.MARK_Light))
            {
                btMarklightOn.Text = " MARK LIGHT ON ";
            }                                                                         //btlightOn.BackColor = Color.Lime;}
            else
            {
                btMarklightOn.Text = " MARK LIGHT OFF";
            }                                                                         //btlightOn.BackColor = Color.Red ;}


            if (!this.Visible)
            {
                tmUpdate.Enabled = false;
                return;
            }
            tmUpdate.Enabled = true;
        }
Esempio n. 5
0
        private static void UpdateButton()
        {
            //Check Inspect.
            //if (!OM.CmnOptn.bIgnrDoor)
            InspectDoor();

            if (m_iStep != EN_SEQ_STEP.Idle)
            {
                InspectHomeDone();
            }

            if (m_iStep == EN_SEQ_STEP.Idle)
            {
                InspectLightGrid();
            }
            //Local Var.
            bool isErr     = ML.ER_IsErr();
            bool isHomeEnd = ML.MT_GetHomeDoneAll();

            //vision manual button.
            //CDelayTimer tmVisnCycle ;
            //if(IO_GetX(xETC_LStopSw)&& m_iSeqStat == ssStop ){
            //if(tmVisnCycle.OnDelay(true , 1000)) {
            //    tmVisnCycle.Clear();
            //    if(MM.GetManNo() == mcNoneCycle) {
            //        MM.SetManCycle(mcVSN_CycleWork);
            //    }
            //}
            //}
            //else {
            //tmVisnCycle.Clear();
            //}

            bool bStartSw = ML.IO_GetXUp(xi.ETC_LStartSw) || ML.IO_GetXUp(xi.ETC_RStartSw) || m_bBtnStart;   // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ;
            bool bStopSw  = ML.IO_GetXUp(xi.ETC_LStopSw) || ML.IO_GetXUp(xi.ETC_RStopSw) || m_bBtnStop;      // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop  ;
            bool bResetSw = ML.IO_GetXUp(xi.ETC_LResetSw) || ML.IO_GetXUp(xi.ETC_RResetSw) || m_bBtnReset;   // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ;
            bool bAirSw   = ML.IO_GetXUp(xi.ETC_LAirSw) || ML.IO_GetXUp(xi.ETC_RAirSw) || m_bBtnAir;
            bool bInitSw  = ML.IO_GetXUp(xi.ETC_LInitSw) || ML.IO_GetXUp(xi.ETC_RInitSw);



            if (m_bBtnStart)
            {
                Log.Trace("m_bBtnStart", "true");
            }
            if (bStartSw)
            {
                Log.Trace("bStartSw", "Started");

                if (MM.GetManNo() != (int)mc.NoneCycle)
                {
                    Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString()));
                    bStartSw = false;
                }
            }


            //Update Switch's Lamp
            bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick;


            //버튼 클릭시나
            ML.IO_SetY(yi.ETC_LStartLp, ML.IO_GetX(xi.ETC_LStartSw) || m_bRun);
            ML.IO_SetY(yi.ETC_LStopLp, ML.IO_GetX(xi.ETC_LStopSw) || !m_bRun || bStopBtnFlick);
            ML.IO_SetY(yi.ETC_LResetLp, ML.IO_GetX(xi.ETC_LResetSw) || (m_bFlick && isErr));
            ML.IO_SetY(yi.ETC_LAirLp, ML.IO_GetX(xi.ETC_LAirSw) || ML.IO_GetY(yi.ETC_MainAir));
            ML.IO_SetY(yi.ETC_LInitLp, ML.IO_GetX(xi.ETC_LInitSw));

            ML.IO_SetY(yi.ETC_RStartLp, ML.IO_GetX(xi.ETC_RStartSw) || m_bRun);
            ML.IO_SetY(yi.ETC_RStopLp, ML.IO_GetX(xi.ETC_RStopSw) || !m_bRun || bStopBtnFlick);
            ML.IO_SetY(yi.ETC_RResetLp, ML.IO_GetX(xi.ETC_RResetSw) || (m_bFlick && isErr));
            ML.IO_SetY(yi.ETC_RAirLp, ML.IO_GetX(xi.ETC_RAirSw) || ML.IO_GetY(yi.ETC_MainAir));
            ML.IO_SetY(yi.ETC_RInitLp, ML.IO_GetX(xi.ETC_RInitSw));

            ML.IO_SetY(yi.ETC_Manual1, ML.IO_GetX(xi.ETC_Manual1));
            ML.IO_SetY(yi.ETC_Manual2, ML.IO_GetX(xi.ETC_Manual2));
            ML.IO_SetY(yi.ETC_Manual3, ML.IO_GetX(xi.ETC_Manual3));
            ML.IO_SetY(yi.ETC_Manual4, ML.IO_GetX(xi.ETC_Manual4));
            ML.IO_SetY(yi.ETC_Manual5, ML.IO_GetX(xi.ETC_Manual5));

            //  ML.IO_SetY(yi.ETC_StartLpR  , ML.IO_GetX(xi.ETC_StartSwR ) ||  m_bRun                             );
            //  ML.IO_SetY(yi.ETC_StopLpR   , ML.IO_GetX(xi.ETC_StopSwR  ) || !m_bRun || bStopBtnFlick            );
            //  ML.IO_SetY(yi.ETC_ResetLpR  , ML.IO_GetX(xi.ETC_ResetSwR ) || (m_bFlick && isErr)                 );
            ////ML.IO_SetY(yi.ETC_AirLp     , ML.IO_GetX(xi.ETC_AirSw    ) || ML.IO_GetY(yi.ETC_MainAirSol     ));
            //  ML.IO_SetY(yi.ETC_InitLpR   , ML.IO_GetX(xi.ETC_InitSwR  )                                        );

            //Center Man Button
            m_bBtnStart = false;
            m_bBtnStop  = false;
            m_bBtnReset = false;
            m_bBtnAir   = false;


            //Init. Button Flags.
            if (bStartSw)
            {
                //bool bAllArayNone = DM.ARAY[riLSP].CheckAllStat(csNone) && DM.ARAY[riLDR].CheckAllStat(csNone) && DM.ARAY[riLST].CheckAllStat(csNone) &&
                //                    DM.ARAY[riPSB].CheckAllStat(csNone) && DM.ARAY[riULD].CheckAllStat(csNone) && DM.ARAY[riVSN].CheckAllStat(csNone)  ;
                if (!isHomeEnd)
                {
                    Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false;
                }
                //if(!LOT.GetLotOpen     ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; }
                if (!InspectStripDispr())
                {
                    m_bInspDispr = true; bStartSw = false;
                }
                if (!InspectStripUnknown())
                {
                    m_bInspUnkwn = true; bStartSw = false;
                }

                if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn)
                {
                    Reset();
                }
            }

            if (bInitSw)
            {
                MM.SetManCycle(mc.AllHome);
            }

            //Air Switch.
            if (bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init)
            {
                ML.IO_SetY(yi.ETC_MainAir, !ML.IO_GetY(yi.ETC_MainAir));
            }

            //Buzzer Off.
            if (isErr && bStopSw)
            {
                ML.TL_SetBuzzOff(true);
            }

            //Set Condition Flags.
            if (bStartSw)    //스타트버튼 안눌리는것 때문에 테스트.
            {
                Log.Trace("isErr", isErr ? "true":"false");
                Log.Trace("ManualMan.GetManNo()", string.Format(MM.GetManNo().ToString()));
            }
            if (bStopSw)
            {
                Log.Trace("Stop", "Stop");
            }

            bool isStopCon  = bStopSw || (isErr && !m_bReqStop && m_bRun);
            bool isRunCon   = bStartSw && !isErr /*&& ManualMan.GetManNo() == mcNone*/;
            bool isResetCon = bResetSw && !m_bRun;

            //Run.
            if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle))
            {
                m_iStep = EN_SEQ_STEP.ToStartCon;
                ML.TL_SetBuzzOff(false);
                ML.ER_SetDisp(true);
            }
            if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle))  //스타트버튼 안눌리는것 때문에 테스트.
            {
                Log.Trace("isRunCon && m_iStep", string.Format(m_iStep.ToString()));
            }
            if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle))    //스타트버튼 안눌리는것 때문에 테스트.
            {
                Log.Trace("isStopCon  &&  m_iStep", string.Format(m_iStep.ToString()));
                Log.Trace("bStopSw", bStopSw    ? "True" : "False");
                Log.Trace("isErr", isErr      ? "True" : "False");
                Log.Trace("m_bReqStop", m_bReqStop ? "True" : "False");
                Log.Trace("m_bRun", m_bRun     ? "True" : "False");

                m_bReqStop = true;
            }

            if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle))
            {
                Reset();
            }

            if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 30000))
            {
                //Trace Log.
                string Msg;
                Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep);
                Log.Trace("SEQ", Msg);
                ML.ER_SetErr(ei.ETC_ToStartTO);
                m_iStep = EN_SEQ_STEP.Idle;
                m_bRun  = false;
            }

            //CDelayTimer StopBtn = null;
            //StopBtn = new CDelayTimer();
            //if(m_iStep == EN_SEQ_STEP.scToStopCon)
            //{
            //    if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000))
            //    {
            //        Log.Trace("SEQ","Forced Stop");
            //        m_bRun = false ;
            //        m_iStep    = EN_SEQ_STEP.scIdle;
            //        m_bReqStop = false;
            //    }
            //}
            //else
            //{
            //    StopBtn.Clear();
            //}


            if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 30000))        //  20000)) {
            {
                //Trace Log.
                string Msg;
                Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep);
                Log.Trace("SEQ", Msg);
                m_bRun = false;

                ML.ER_SetErr(ei.ETC_ToStopTO);
                m_iStep    = EN_SEQ_STEP.Idle;
                m_bReqStop = false;
            }

            EN_SEQ_STEP iPreStep = m_iStep;

            if (iPreStep != m_iStep)
            {
                string sMsg = "";
                sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString());
                Log.Trace("SEQ", sMsg);
            }
            iPreStep = m_iStep;


            //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠.
            bool bPreLotEnd = LOT.GetLotEnd();

            if (LOT.GetLotEnd() != bPreLotEnd)
            {
                Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False");
            }
            bPreLotEnd = LOT.GetLotEnd();



            //Running Step.
            switch (m_iStep)
            {
            case EN_SEQ_STEP.Idle: return;

            case EN_SEQ_STEP.ToStartCon: if (!ToStartCon())
                {
                    return;
                }
                m_iStep = EN_SEQ_STEP.ToStart;
                Log.Trace("SEQ", "scToStartCon END");
                return;

            case EN_SEQ_STEP.ToStart: if (!ToStart())
                {
                    return;
                }
                m_bRun     = true;
                m_bRunEdge = true;
                m_iStep    = EN_SEQ_STEP.Run;
                Log.Trace("SEQ", "scToStart END");
                return;

            case EN_SEQ_STEP.Run: if (!m_bReqStop)
                {
                    if (Autorun())
                    {
                        //랏엔드 상황.
                        LOT.LotEnd();
                        Log.ShowMessage("Checked", "Lot Ended.");
                        Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd");
                        m_bRunEnd = true;
                        m_iStep   = EN_SEQ_STEP.ToStopCon;
                    }
                    return;
                }
                m_bReqStop = false;
                m_iStep    = EN_SEQ_STEP.ToStopCon;
                Log.Trace("SEQ", "scRun END");
                return;

            case EN_SEQ_STEP.ToStopCon:  if (!ToStopCon())
                {
                    if (Autorun())
                    {
                        //랏엔드 상황.
                        LOT.LotEnd();
                        Log.Trace("SEQ", "scToStopCon LotEnd");
                    }
                    return;
                }
                m_bRun  = false;
                m_iStep = EN_SEQ_STEP.ToStop;
                Log.Trace("SEQ", "scToStopCon END");
                return;

            case EN_SEQ_STEP.ToStop:  if (!ToStop())
                {
                    return;
                }
                m_iStep    = EN_SEQ_STEP.Idle;
                m_bReqStop = false;

                DM.SaveMap();
                Log.Trace("SEQ", "scToStop END");

                return;
            }
        }