Exemple #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;
            }
        }
Exemple #2
0
        public static void Update()
        {
            if (m_iManNo == mc.NoneCycle)
            {
                return;
            }
            if (m_bManSetting)
            {
                return;
            }

            //if (m_iManNo != mc.AllHome && m_iManNo != mc.SLD_Home ) SEQ.InspectHomeDone();

            SEQ.InspectLightGrid();

            bool r1, r2, r3, r4, r5, r6, r7;

            r1 = r2 = r3 = r4 = r5 = r6 = r7 = false;

            //Check Alarm.
            if (ML.ER_IsErr())
            {
                Init(); return;
            }
            //Cycle Step.
            if (m_iManNo == mc.AllHome)
            {
                r2 = SEQ.TTBL.CycleHome();
                if (!r2)
                {
                    return;
                }
                r1 = SEQ.LODR.CycleHome();
                r3 = SEQ.VISN.CycleHome();
                r4 = SEQ.MARK.CycleHome();
                r5 = SEQ.ULDR.CycleHome();
                r6 = SEQ.REJM.CycleHome();
                r7 = SEQ.REJV.CycleHome();

                if (!r1 || !r2 || !r3 || !r4 || !r5 || !r6 || !r7)
                {
                    return;
                }
                m_iManNo = (int)mc.NoneCycle;

                Log.ShowMessage("Confirm", "All Home Finished!");

                m_iCrntManNo = m_iManNo;
            }

            else if (m_iManNo == mc.LODR_Home)
            {
                if (SEQ.LODR.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.TTBL_Home)
            {
                if (SEQ.TTBL.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.VISN_Home)
            {
                if (SEQ.VISN.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.MARK_Home)
            {
                if (SEQ.MARK.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_Home)
            {
                if (SEQ.ULDR.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.REJM_Home)
            {
                if (SEQ.REJM.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.REJV_Home)
            {
                if (SEQ.REJV.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.LODR_CycleHold)
            {
                if (SEQ.LODR.CycleHold())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_CyclePush)
            {
                if (SEQ.LODR.CyclePush())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_CyclePick)
            {
                if (SEQ.PLDR.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_ManLotSupply)
            {
                if (SEQ.LODR.CycleManSupply())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.TTBL_CycleMove)
            {
                if (SEQ.TTBL.CycleMove())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.VISN_CycleWork)
            {
                if (SEQ.VISN.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.MARK_CycleWork)
            {
                if (SEQ.MARK.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.MARK_CycleManChage)
            {
                if (SEQ.MARK.CycleManChange())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.ULDR_CycleMove)
            {
                if (SEQ.ULDR.CycleMove())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_CycleDlvr)
            {
                if (SEQ.PULD.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_CyclePick)
            {
                if (SEQ.ULDR.CyclePick())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_CyclePlce)
            {
                if (SEQ.ULDR.CyclePlce())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_CyclePaint)
            {
                if (SEQ.ULDR.CyclePaint())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.RJEM_CycleWork)
            {
                if (SEQ.REJM.CycleReject())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.RJEV_CycleWork)
            {
                if (SEQ.REJV.CycleReject())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            //else { m_iManNo = mc.NoneCycle; } //여기서 갱신됌.

            //Ok.
            return;
        }
Exemple #3
0
        public static void UpdateSeqState()
        {
            bool isInit    = MM.GetManNo() == mc.AllHome;
            bool isError   = ML.ER_IsErr();
            bool isRunning = m_bRun;
            bool isRunWarn = m_bRunEnd;
            bool isManual  = MM.GetManNo() > mc.AllHome;
            bool isStop    = !m_bRun && !m_bRunEnd;
            bool isToStart = m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart;
            bool isToStop  = m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop;
            bool isLotEnd  = LOT.GetLotEnd();

            //Flicking Timer.
            if (m_bFlick)
            {
                m_tmFlickOn.Clear(); if (m_tmFlickOff.OnDelay(m_bFlick, 500))
                {
                    m_bFlick = false;
                }
            }
            else
            {
                m_tmFlickOff.Clear(); if (m_tmFlickOn.OnDelay(!m_bFlick, 500))
                {
                    m_bFlick = true;
                }
            }

            //Set Sequence State. Tower Lamp
            //  if (isMaint  ) { m_iSeqStat = EN_SEQ_STAT.Maint      ;}
            if (isInit)
            {
                m_iSeqStat = EN_SEQ_STAT.Init;
            }
            else if (isLotEnd)
            {
                m_iSeqStat = EN_SEQ_STAT.WorkEnd;
            }
            else if (isError)
            {
                m_iSeqStat = EN_SEQ_STAT.Error;
            }
            else if (isToStart)
            {
                m_iSeqStat = EN_SEQ_STAT.ToStart;
            }
            else if (isToStop)
            {
                m_iSeqStat = EN_SEQ_STAT.ToStop;
            }
            else if (isRunning)
            {
                m_iSeqStat = EN_SEQ_STAT.Running;
            }
            else if (isManual)
            {
                m_iSeqStat = EN_SEQ_STAT.Manual;
            }
            else if (isStop)
            {
                m_iSeqStat = EN_SEQ_STAT.Stop;
            }
            else if (isRunWarn)
            {
                m_iSeqStat = EN_SEQ_STAT.RunWarn; Log.ShowMessage("Warning", "Work End");
            }
            else
            {
            }

            //Save Status Log.
            string sStatText, sSub;

            if (m_iSeqStat != iPreStat)
            {
                for (int i = 0; i < 2; i++)
                {
                    if (i == 0)
                    {
                        sSub = " STATUS END"; iStat = iPreStat;
                    }
                    else
                    {
                        sSub = " STATUS START"; iStat = m_iSeqStat;
                    }

                    switch (iStat)
                    {
                    default: sStatText = "Program Start"; break;

                    case EN_SEQ_STAT.Init: sStatText = "INIT" + sSub; break;

                    case EN_SEQ_STAT.Warning: sStatText = "WARNING" + sSub; break;

                    case EN_SEQ_STAT.Error: sStatText = "ERROR" + sSub; break;

                    case EN_SEQ_STAT.Running: sStatText = "RUNNING" + sSub; break;

                    case EN_SEQ_STAT.Stop: sStatText = "STOP" + sSub; break;

                    case EN_SEQ_STAT.RunWarn: sStatText = "RUNWARN" + sSub; break;

                    case EN_SEQ_STAT.WorkEnd: sStatText = "LOTEND" + sSub; break;

                    case EN_SEQ_STAT.Manual: sStatText = "MANUAL" + sSub; break;

                    case EN_SEQ_STAT.ToStart: sStatText = "TO START" + sSub; break;

                    case EN_SEQ_STAT.ToStop: sStatText = "TO STOP" + sSub; break;
                    }
                    Log.Trace(sStatText, ForContext.Sts);
                }

                iPreStat = m_iSeqStat;
            }
        }
Exemple #4
0
        public static void Update()
        {
            if (m_iManNo == mc.NoneCycle)
            {
                return;
            }
            if (m_bManSetting)
            {
                return;
            }

            //if (m_iManNo != mc.AllHome && m_iManNo != mc.SLD_Home ) SEQ.InspectHomeDone();

            SEQ.InspectLightGrid();

            bool r1, r2, r3, r4, r5, r6;

            r1 = r2 = r3 = r4 = r5 = r6 = false;

            //Check Alarm.
            if (ML.ER_IsErr())
            {
                Init(); return;
            }

            //Cycle Step.
            if (m_iManNo == mc.AllHome)
            {
                r1 = SEQ.WRK.CycleHome();
                r2 = SEQ.OUT.CycleHome();
                if (!r1 || !r2)
                {
                    return;
                }
                m_iManNo = (int)mc.NoneCycle;

                Log.ShowMessage("Confirm", "All Home Finished!");

                m_iCrntManNo = m_iManNo;
            }



            else if (m_iManNo == mc.StepCut)
            {
                if (CycleManWork(   ))
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.Move5mm)
            {
                if (CycleManMove(5))
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.Move100mm)
            {
                if (CycleManMove(10))
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else
            {
                m_iManNo = mc.NoneCycle;
            }                                 //여기서 갱신됌.

            //Ok.
            return;
        }
Exemple #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 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;
            }
        }
Exemple #6
0
        public static void Update()
        {
            if (m_iManNo == mc.NoneCycle)
            {
                Stop = false;
                return;
            }
            if (m_bManSetting)
            {
                return;
            }

            //if (m_iManNo != mc.AllHome && m_iManNo != mc.SLD_Home ) SEQ.InspectHomeDone();

            if (!OM.MstOptn.bDebugMode)
            {
                SEQ.InspectLightGrid();
            }

            //Check Alarm.
            if (ML.ER_IsErr())
            {
                Init(); return;
            }
            //Cycle Step.
            if (m_iManNo == mc.AllHome)
            {
                bool r1 = SEQ.LODR.CycleHome();
                bool r2 = SEQ.PREB.CycleHome();
                bool r3 = SEQ.VSNZ.CycleHome();
                bool r4 = SEQ.PSTB.CycleHome();
                bool r5 = SEQ.ULDR.CycleHome();

                if (!r1 || !r2 || !r3 || !r4 || !r5)
                {
                    return;
                }
                if (ML.ER_IsErr())
                {
                    Init(); return;
                }
                m_iManNo = (int)mc.NoneCycle;
                Log.ShowMessage("Confirm", "All Homing Finished!");
                m_iCrntManNo = m_iManNo;
            }

            else if (m_iManNo == mc.LODR_Home)
            {
                if (SEQ.LODR.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PREB_Home)
            {
                if (SEQ.PREB.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.HEAD_Home)
            {
                if (SEQ.VSNZ.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_Home)
            {
                if (SEQ.PSTB.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_Home)
            {
                if (SEQ.ULDR.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.LODR_Wait)
            {
                if (SEQ.LODR.CycleWait())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_Supply)
            {
                if (SEQ.LODR.CycleSupply())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_Pick)
            {
                if (SEQ.LODR.CyclePick())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_Work)
            {
                if (SEQ.LODR.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.LODR_Drop)
            {
                if (SEQ.LODR.CycleDrop())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.VSNZ_Wait)
            {
                if (SEQ.VSNZ.CycleWait())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.VSNZ_Stt)
            {
                if (SEQ.VSNZ.CycleWorkStart())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.VSNZ_Move)
            {
                if (SEQ.VSNZ.CycleMove())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.VSNZ_Insp)
            {
                if (SEQ.VSNZ.CycleInsp())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.VSNZ_Next)
            {
                if (SEQ.VSNZ.CycleNext())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.PSTB_Wait)
            {
                if (SEQ.PSTB.CycleWait(true))
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_Stt)
            {
                if (SEQ.PSTB.CycleWait(false))
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_In)
            {
                if (SEQ.PSTB.CycleIn())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_Work)
            {
                if (SEQ.PSTB.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_Out)
            {
                if (SEQ.PSTB.CycleOut())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_Next)
            {
                if (SEQ.PSTB.CycleNext())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.PSTB_Replace)
            {
                if (SEQ.PSTB.CycleReplace())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.ULDR_Wait)
            {
                if (SEQ.ULDR.CycleWait())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_Supply)
            {
                if (SEQ.ULDR.CycleSupply())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_Pick)
            {
                if (SEQ.ULDR.CyclePick())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_Work)
            {
                if (SEQ.ULDR.CycleWork())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.ULDR_Drop)
            {
                if (SEQ.ULDR.CycleDrop())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else
            {
                m_iManNo = mc.NoneCycle;
            }                                 //여기서 갱신됌.

            //Ok.
            return;
        }
Exemple #7
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;
            }
        }