Example #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            tmUpdate.Enabled = false;
            pnIdx.Refresh();
            //pnPst.Refresh();

            tbTargetCnt.Text = OM.DevOptn.iTargetCnt.ToString();
            tbCrntCnt.Text   = OM.EqpStat.iWorkCnt.ToString();

            tbNodeCnt.Text = OM.EqpStat.iNodeCnt.ToString();
            tbCttrCnt.Text = OM.EqpStat.iCttrCnt.ToString();
            tbDegree.Text  = OM.NodePos[SEQ.IDX.iNodeCnt].dDegree.ToString();

            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 (bPreLotOpen != LOT.GetLotOpen())
            {
                btLotEnd.Enabled  = LOT.GetLotOpen();
                btStart.Enabled   = LOT.GetLotOpen();
                btLotOpen.Enabled = !LOT.GetLotOpen();
                bPreLotOpen       = LOT.GetLotOpen();
            }


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

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

            for (int i = 0; i < SML.ER._iMaxErrCnt; i++)
            {
                if (SML.ER.GetErr(i))
                {
                    iCrntErrCnt++;
                }
            }
            if (iPreErrCnt != iCrntErrCnt)
            {
                lbErr.Items.Clear();
                int iErrNo = SML.ER.GetLastErr();
                for (int i = 0; i < SML.ER._iMaxErrCnt; i++)
                {
                    if (SML.ER.GetErr(i))
                    {
                        Str  = string.Format("[ERR{0:000}]", i);
                        Str += SML.ER.GetErrName(i) + " " + SML.ER.GetErrMsg(i);
                        lbErr.Items.Add(Str);
                    }
                }
            }
            if (SEQ._iSeqStat != EN_SEQ_STAT.Error)
            {
                lbErr.Items.Clear();
            }
            iPreErrCnt = iCrntErrCnt;


            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 (!SM.MT_GetHomeDoneAll())
            {
                btAllHome.ForeColor = SEQ._bFlick ? Color.Black : Color.Red;
            }
            else
            {
                btAllHome.ForeColor = Color.Black;
            }

            //DM.ARAY[(int)ri.LENS ].SetMaxColRow(OM.DevInfo.iLensColCnt , OM.DevInfo.iLensRowCnt);
            //DM.ARAY[(int)ri.REAR ].SetMaxColRow(OM.DevInfo.iRearColCnt , OM.DevInfo.iRearRowCnt);
            //DM.ARAY[(int)ri.FRNT ].SetMaxColRow(OM.DevInfo.iFrntColCnt , OM.DevInfo.iFrntRowCnt);
            //DM.ARAY[(int)ri.PICK ].SetMaxColRow(2, 1);

            pnIDXDetect1.BackColor = !SM.IO_GetX(xi.IDX_Detect1) ? Color.Lime : Color.Red;
            pnIDXDetect2.BackColor = !SM.IO_GetX(xi.IDX_Detect2) ? Color.Lime : Color.Red;
            pnIDXDetect3.BackColor = !SM.IO_GetX(xi.IDX_Detect3) ? Color.Lime : Color.Red;
            pnIDXDetect4.BackColor = !SM.IO_GetX(xi.IDX_Detect4) ? Color.Lime : Color.Red;
            pnIDXDetect5.BackColor = !SM.IO_GetX(xi.IDX_Detect5) ? Color.Lime : Color.Red;

            pnULDDetect1.BackColor = SM.IO_GetX(xi.ULD_Detect1) ? Color.Lime : Color.Red;
            pnULDDetect2.BackColor = SM.IO_GetX(xi.ULD_Detect2) ? Color.Lime : Color.Red;
            pnULDDetect3.BackColor = SM.IO_GetX(xi.ULD_Detect3) ? Color.Lime : Color.Red;
            pnULDDetect4.BackColor = SM.IO_GetX(xi.ULD_Detect4) ? Color.Lime : Color.Red;
            pnULDDetect5.BackColor = SM.IO_GetX(xi.ULD_Detect5) ? Color.Lime : Color.Red;

            //Option View
            if (OM.CmnOptn.bUsedLine1)
            {
                pnOption1.BackColor = Color.Lime; lbOption1.Text = "ON";
            }
            else
            {
                pnOption1.BackColor = Color.Red; lbOption1.Text = "OFF";
            }
            if (OM.CmnOptn.bUsedLine2)
            {
                pnOption2.BackColor = Color.Lime; lbOption2.Text = "ON";
            }
            else
            {
                pnOption2.BackColor = Color.Red; lbOption2.Text = "OFF";
            }
            if (OM.CmnOptn.bUsedLine3)
            {
                pnOption3.BackColor = Color.Lime; lbOption3.Text = "ON";
            }
            else
            {
                pnOption3.BackColor = Color.Red; lbOption3.Text = "OFF";
            }
            if (OM.CmnOptn.bUsedLine4)
            {
                pnOption4.BackColor = Color.Lime; lbOption4.Text = "ON";
            }
            else
            {
                pnOption4.BackColor = Color.Red; lbOption4.Text = "OFF";
            }
            if (OM.CmnOptn.bUsedLine5)
            {
                pnOption5.BackColor = Color.Lime; lbOption5.Text = "ON";
            }
            else
            {
                pnOption5.BackColor = Color.Red; lbOption5.Text = "OFF";
            }
            if (OM.CmnOptn.bIgnrWork)
            {
                pnOption6.BackColor = Color.Lime; lbOption6.Text = "ON";
            }
            else
            {
                pnOption6.BackColor = Color.Red; lbOption6.Text = "OFF";
            }

            btCyl1.Text      = SML.CL.GetCmd((int)ci.IDX_Hold1UpDn) != 0 ?  "FWD"      : "BWD";
            btCyl1.ForeColor = SML.CL.GetCmd((int)ci.IDX_Hold1UpDn) != 0 ?  Color.Lime : Color.Black;

            btCyl2.Text      = SML.CL.GetCmd((int)ci.IDX_CutLtFwBw) != 0 ?  "FWD"      : "BWD";
            btCyl2.ForeColor = SML.CL.GetCmd((int)ci.IDX_CutLtFwBw) != 0 ?  Color.Lime : Color.Black;

            btCyl3.Text      = SML.CL.GetCmd((int)ci.IDX_CutRtFwBw) != 0 ?  "FWD"      : "BWD";
            btCyl3.ForeColor = SML.CL.GetCmd((int)ci.IDX_CutRtFwBw) != 0 ?  Color.Lime : Color.Black;

            btCyl4.Text      = SML.CL.GetCmd((int)ci.IDX_TwstLtDnUp) != 0 ?  "FWD"      : "BWD";
            btCyl4.ForeColor = SML.CL.GetCmd((int)ci.IDX_TwstLtDnUp) != 0 ?  Color.Lime : Color.Black;

            //btCyl5 .Text      = SM.CL.GetCmd((int)ai.IDX_TwstRtDnUp) != 0 ?  "FWD"      : "BWD"      ;
            //btCyl5 .ForeColor = SM.CL.GetCmd((int)ai.IDX_TwstRtDnUp) != 0 ?  Color.Lime : Color.Black;

            btCyl6.Text      = SML.CL.GetCmd((int)ci.IDX_Hold2UpDn) != 0 ?  "FWD"      : "BWD";
            btCyl6.ForeColor = SML.CL.GetCmd((int)ci.IDX_Hold2UpDn) != 0 ?  Color.Lime : Color.Black;

            btCyl7.Text      = SML.CL.GetCmd((int)ci.IDX_CutBaseUpDn) != 0 ? "FWD"       : "BWD";
            btCyl7.ForeColor = SML.CL.GetCmd((int)ci.IDX_CutBaseUpDn) != 0 ?  Color.Lime : Color.Black;

            //btCyl7 .Text      = SM.CL.GetCmd((int)ai.IDX_ShiftFwBw ) != 0 ?  "FWD"      : "BWD"      ;
            //btCyl7 .ForeColor = SM.CL.GetCmd((int)ai.IDX_ShiftFwBw ) != 0 ?  Color.Lime : Color.Black;

            //btCyl8 .Text      = SM.CL.GetCmd((int)ai.IDX_ShiftUpDn ) != 0 ?  "FWD"      : "BWD"      ;
            //btCyl8 .ForeColor = SM.CL.GetCmd((int)ai.IDX_ShiftUpDn ) != 0 ?  Color.Lime : Color.Black;

            btCyl8.Text      = SML.CL.GetCmd((int)ci.IDX_OutDnUp) != 0 ?  "FWD"      : "BWD";
            btCyl8.ForeColor = SML.CL.GetCmd((int)ci.IDX_OutDnUp) != 0 ?  Color.Lime : Color.Black;

            btCyl9.Text      = SML.CL.GetCmd((int)ci.IDX_CutterDnUp) != 0 ?  "FWD"      : "BWD";
            btCyl9.ForeColor = SML.CL.GetCmd((int)ci.IDX_CutterDnUp) != 0 ?  Color.Lime : Color.Black;

            //if (CMachine._iSeqStat == EN_SEQ_STAT.ssWorkEnd || CMachine._iSeqStat == EN_SEQ_STAT.ssStop)
            //{
            //    CMachine.Reset();
            //    if (bRepeat) CMachine._bBtnStart = true;
            //}
            tmUpdate.Enabled = true;
        }
Example #2
0
        private static void UpdateButton()
        {
            //if (!OM.CmnOptn.bIgnrDoor) InspectDoor();

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

            //Local Var.
            bool isErr     = SML.ER.IsErr();
            bool isHomeEnd = SM.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 = SM.IO_GetXUp(xi.ETC_StartSw) || m_bBtnStart;
            bool bStopSw  = SM.IO_GetXUp(xi.ETC_StopSw) || m_bBtnStop;
            bool bResetSw = SM.IO_GetXUp(xi.ETC_ResetSw) || m_bBtnReset;
            bool bAirSw   = SM.IO_GetXUp(xi.ETC_AirSw) || m_bBtnAir;

            //bool bInitSw    = SM.IO_GetXUp(xi.ETC_LInitSw ) || SM.IO_GetXUp(xi.ETC_RInitSw )                ;

            if (SM.IO_GetXUp(xi.ETC_StartSw))
            {
                Log.Trace("IO_GetXUp(xETC_StartSw)", "true");
            }

            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 (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;


            //버튼 클릭시나
            SM.IO_SetY(yi.ETC_StartLp, SM.IO_GetX(xi.ETC_StartSw) || m_bRun);
            SM.IO_SetY(yi.ETC_StopLp, SM.IO_GetX(xi.ETC_StopSw) || !m_bRun || bStopBtnFlick);
            SM.IO_SetY(yi.ETC_ResetLp, SM.IO_GetX(xi.ETC_ResetSw) || (m_bFlick && isErr));
            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_LAirLp    , SM.IO.GetX((int)EN_INPUT_ID.xETC_LAirSw   ) || SM.IO.GetY((int)EN_OUTPUT_ID.yETC_MainAirSol));
            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_LInitLp   , SM.IO.GetX((int)EN_INPUT_ID.xETC_LInitSw  )                                                 );

            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_RStartLp  , SM.IO.GetX((int)EN_INPUT_ID.xETC_RStartSw ) ||  m_bRun                                      );
            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_RStopLp   , SM.IO.GetX((int)EN_INPUT_ID.xETC_RStopSw  ) || !m_bRun || bStopBtnFlick                     );
            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_RResetLp  , SM.IO.GetX((int)EN_INPUT_ID.xETC_RResetSw ) || (m_bFlick && isErr)                          );
            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_RAirLp    , SM.IO.GetX((int)EN_INPUT_ID.xETC_RAirSw   ) || SM.IO.GetY((int)EN_OUTPUT_ID.yETC_MainAirSol));
            //SM.IO.SetY((int)EN_OUTPUT_ID.yETC_RInitLp   , SM.IO.GetX((int)EN_INPUT_ID.xETC_RInitSw  )                                                 );

            //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)
            {
                SM.IO_SetY(yi.ETC_MainAirSol, !SM.IO_GetY(yi.ETC_MainAirSol));
            }

            //Buzzer Off.
            if (isErr && bStopSw)
            {
                SML.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;
                SML.TL.SetBuzzOff(false);
                SML.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);
                SML.ER.SetErr((int)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(SM.IO.GetX((int)IP.xETC_StopSw)||SM.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;

                //ToStop();
                SML.ER.SetErr((int)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.Trace("SEQ", "scRun LotEnd");
                        m_bRunEnd = true;
                        m_iStep   = EN_SEQ_STEP.ToStopCon;
                        ////랏엔드 상황.
                        //LOT.LotEnd();
                        //Log.Trace("SEQ","scRun LotEnd");
                        //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;
            }
        }
Example #3
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     = SM.ER_IsErr();
            bool isHomeEnd = SM.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 = SM.IO_GetXUp(xi.ETC_StartSw) || m_bBtnStart;   // || SM.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ;
            bool bStopSw  = SM.IO_GetXUp(xi.ETC_StopSw) || m_bBtnStop;     // || SM.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop  ;
            bool bResetSw = SM.IO_GetXUp(xi.ETC_ResetSw) || m_bBtnReset;   // || SM.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ;
            bool bAirSw   = m_bBtnAir;
            bool bInitSw  = SM.IO_GetXUp(xi.ETC_InitSw);

            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;


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

            //  SM.IO_SetY(yi.ETC_StartLpR  , SM.IO_GetX(xi.ETC_StartSwR ) ||  m_bRun                             );
            //  SM.IO_SetY(yi.ETC_StopLpR   , SM.IO_GetX(xi.ETC_StopSwR  ) || !m_bRun || bStopBtnFlick            );
            //  SM.IO_SetY(yi.ETC_ResetLpR  , SM.IO_GetX(xi.ETC_ResetSwR ) || (m_bFlick && isErr)                 );
            ////SM.IO_SetY(yi.ETC_AirLp     , SM.IO_GetX(xi.ETC_AirSw    ) || SM.IO_GetY(yi.ETC_MainAirSol     ));
            //  SM.IO_SetY(yi.ETC_InitLpR   , SM.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)
            {
                if (!SM.IO_GetX(xi.VISN_Ready))
                {
                    Log.ShowMessage("Vision", SM.IO_GetXName(xi.VISN_Ready) + "Vision Ready IO is not On");
                    bStartSw = false;
                }
                if (COracle.bMakingDMC1List)
                {
                    Log.ShowMessage("OracleDB", "Please Wait for Finish Making DMC1 List!");
                    bStartSw = false;
                }
                if (COracle.bMakingPanelList)
                {
                    Log.ShowMessage("OracleDB", "Please Wait for Finish Making Panel List!");
                    bStartSw = false;
                }
                //if(!RockKey.Check()) { Log.ShowMessage("Error" , "Rock Key Error"        ); bStartSw = false ; }
                if (!isHomeEnd)
                {
                    Log.ShowMessage("Error", "Please Initial First"); bStartSw = false;
                }
                //

                if (!LOT.GetLotOpen())
                {
                    Log.ShowMessage("Error", "Open Lot!"); 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)
            {
                //SM.IO_SetY((int)yi.ETC_MainAirSol , !SM.IO_GetY((int)yi.ETC_MainAirSol )) ;
            }

            //Buzzer Off.
            if (isErr && bStopSw)
            {
                SML.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;
                SML.TL.SetBuzzOff(false);
                SM.ER_SetNeedShowErr(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);
                SM.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(SM.IO_GetX((int)IP.xETC_StopSw)||SM.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;

                SM.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())
                    {
                        //랏엔드 상황.

                        if (OM.CmnOptn.bGoldenTray)
                        {
                            LOT.LotEnd();
                            int iIdx = 0;
                            if (DM.ARAY[ri.IDXR].CheckAllStat(cs.None))
                            {
                                iIdx = ri.IDXF;
                            }
                            else
                            {
                                iIdx = ri.IDXR;
                            }
                            int iCntGood = DM.ARAY[iIdx].GetCntStat(cs.Good);
                            int iCntNG   = DM.ARAY[iIdx].GetCntStat(cs.NG1) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG2) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG3) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG4) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG5) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG6) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG7) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG8) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG9) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG10);
                            int iCntEmpty = DM.ARAY[iIdx].GetCntStat(cs.NG0);
                            Log.ShowMessage("Golden Tray Ended", "Good=" + iCntGood + " NG=" + iCntNG + " Empty=" + iCntEmpty);
                            SEQ.IDXF.MoveCyl(ci.IDXF_ClampClOp, fb.Bwd);
                            SEQ.IDXR.MoveCyl(ci.IDXR_ClampClOp, fb.Bwd);
                        }
                        else
                        {
                            if (OM.EqpStat.iWorkBundle >= OM.DevInfo.iTRAY_BundleCnt)
                            {
                                LOT.LotEnd();
                                Log.ShowMessage("Checked", "Lot Ended.");
                                Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd");
                            }
                            else
                            {
                                m_bRunEnd = true;
                                Log.ShowMessage("Checked", OM.EqpStat.iWorkBundle.ToString() + " Bundle Ended.");
                                Log.Trace("SEQ", LOT.GetLotNo() + OM.EqpStat.iWorkBundle.ToString() + "BundleEnd");
                                OM.EqpStat.bWrapingEnd = false;                                   //요걸 초기화 해야 로딩을 한다.
                            }
                        }

                        //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())
                    {
                        if (OM.CmnOptn.bGoldenTray)
                        {
                            LOT.LotEnd();
                            int iIdx = 0;
                            if (DM.ARAY[ri.IDXR].CheckAllStat(cs.None))
                            {
                                iIdx = ri.IDXF;
                            }
                            else
                            {
                                iIdx = ri.IDXR;
                            }
                            int iCntGood = DM.ARAY[iIdx].GetCntStat(cs.Good);
                            int iCntNG   = DM.ARAY[iIdx].GetCntStat(cs.NG1) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG2) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG3) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG4) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG5) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG6) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG7) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG8) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG9) +
                                           DM.ARAY[iIdx].GetCntStat(cs.NG10);
                            int iCntEmpty = DM.ARAY[iIdx].GetCntStat(cs.NG0);
                            Log.ShowMessage("Golden Tray Ended", "Good=" + iCntGood + " NG=" + iCntNG + " Empty=" + iCntEmpty);
                            SEQ.IDXF.MoveCyl(ci.IDXF_ClampClOp, fb.Bwd);
                            SEQ.IDXR.MoveCyl(ci.IDXR_ClampClOp, fb.Bwd);
                        }
                        else
                        {
                            if (OM.EqpStat.iWorkBundle >= OM.DevInfo.iTRAY_BundleCnt)
                            {
                                LOT.LotEnd();
                                Log.ShowMessage("Checked", "Lot Ended.");
                                Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd");
                            }
                            else
                            {
                                m_bRunEnd = true;
                                Log.ShowMessage("Checked", OM.EqpStat.iWorkBundle.ToString() + " Bundle Ended.");
                                Log.Trace("SEQ", LOT.GetLotNo() + OM.EqpStat.iWorkBundle.ToString() + "BundleEnd");
                                OM.EqpStat.bWrapingEnd = false;                                   //요걸 초기화 해야 로딩을 한다.
                            }
                        }
                    }
                    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;
            }
        }
Example #4
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            tmUpdate.Enabled = false;

            //로그인/로그아웃 방식
            if (SML.FrmLogOn.GetLevel() == (int)EN_LEVEL.LogOff)
            {
                btOperator.Text   = "LOG IN";
                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;
                btLightOnOff.Enabled = false;
                btOperator.Enabled   = true;
            }
            else
            {
                btOperator.Text   = SML.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;
                btLightOnOff.Enabled = true;
            }



            btLotOpen.Enabled = !LOT.GetLotOpen();


            lbDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            TimeSpan Span;

            try{
                Span = TimeSpan.FromMilliseconds(SPC.LOT.Data.RunTime);
            }
            catch (Exception ex) {
                Span = TimeSpan.FromMilliseconds(0);
            }
            //label11.Text = OM.EqpStat.iLDRSplyCnt.ToString() ;

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

            for (int i = 0; i < SML.ER._iMaxErrCnt; i++)
            {
                if (SML.ER.GetErr(i))
                {
                    iCrntErrCnt++;
                }
            }
            if (iPreErrCnt != iCrntErrCnt)
            {
                lbErr.Items.Clear();
                int iErrNo = SM.ER_GetLastErr();
                for (int i = 0; i < SML.ER._iMaxErrCnt; i++)
                {
                    if (SML.ER.GetErr(i))
                    {
                        Str  = string.Format("[ERR{0:000}]", i);
                        Str += SML.ER.GetErrName(i) + " " + SML.ER.GetErrSubMsg(i);
                        lbErr.Items.Add(Str);
                    }
                }
            }
            if (SEQ._iSeqStat != EN_SEQ_STAT.Error)
            {
                lbErr.Items.Clear();
            }
            iPreErrCnt = iCrntErrCnt;


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

            SPC.LOT.DispLotInfo(lvLotInfo);

            btInputTrayF.Enabled   = !SEQ._bRun;
            btInputTrayG.Enabled   = !SEQ._bRun;
            btAllEmptyTray.Enabled = !SEQ._bRun;
            btBarCodeReTry.Enabled = !SEQ._bRun;

            if (SM.IO_GetX(xi.BARZ_PckrVac))
            {
                lbBarVac.BackColor = Color.Lime;
            }
            else
            {
                lbBarVac.BackColor = Color.Red;
            }

            //JS
            //Manual Button Text.
            if (SM.CL_GetCmd(ci.LODR_ClampClOp) == fb.Bwd)
            {
                btCylinder1.Text = "Loader Clamp OPEN";
            }
            else
            {
                btCylinder1.Text = "Loader Clamp CLOSE";
            }
            btCylinder1.ForeColor = SM.CL_Complete(ci.LODR_ClampClOp) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.LODR_SperatorUpDn) == fb.Bwd)
            {
                btCylinder2.Text = "Loader Sperator DOWN";
            }
            else
            {
                btCylinder2.Text = "Loader Sperator Up";
            }
            btCylinder2.ForeColor = SM.CL_Complete(ci.LODR_SperatorUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.IDXR_ClampClOp) == fb.Bwd)
            {
                btCylinder4.Text = "Index Rear Clamp OPEN";
            }
            else
            {
                btCylinder4.Text = "Index Rear Clamp CLOSE";
            }
            btCylinder4.ForeColor = SM.CL_Complete(ci.IDXR_ClampClOp) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.IDXR_ClampUpDn) == fb.Bwd)
            {
                btCylinder5.Text = "Index Rear Clamp DOWN";
            }
            else
            {
                btCylinder5.Text = "Index Rear Clamp UP";
            }
            btCylinder5.ForeColor = SM.CL_Complete(ci.IDXR_ClampUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.IDXF_ClampClOp) == fb.Bwd)
            {
                btCylinder6.Text = "Index Front Clamp OPEN";
            }
            else
            {
                btCylinder6.Text = "Index Front Clamp CLOSE";
            }
            btCylinder6.ForeColor = SM.CL_Complete(ci.IDXF_ClampClOp) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.IDXF_ClampUpDn) == fb.Bwd)
            {
                btCylinder3.Text = "Index Front Clamp DOWN";
            }
            else
            {
                btCylinder3.Text = "Index Front Clamp UP";
            }
            btCylinder3.ForeColor = SM.CL_Complete(ci.IDXF_ClampUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.STCK_RailClOp) == fb.Bwd)
            {
                btCylinder7.Text = "Tray Rail      OPEN";
            }
            else
            {
                btCylinder7.Text = "Tray Rail      CLOSE";
            }
            btCylinder7.ForeColor = SM.CL_Complete(ci.STCK_RailClOp) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.STCK_RailTrayUpDn) == fb.Bwd)
            {
                btCylinder8.Text = "Stacker Rail Tray DOWN";
            }
            else
            {
                btCylinder8.Text = "Stacker Rail Tray UP";
            }
            btCylinder8.ForeColor = SM.CL_Complete(ci.STCK_RailTrayUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.STCK_StackStprUpDn) == fb.Bwd)
            {
                btCylinder9.Text = "Stacker Stopper DOWN";
            }
            else
            {
                btCylinder9.Text = "Stacker Stopper UP";
            }
            btCylinder9.ForeColor = SM.CL_Complete(ci.STCK_StackStprUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.STCK_StackOpCl) == fb.Bwd)
            {
                btCylinder10.Text = "Stacker Rail     CLOSE";
            }
            else
            {
                btCylinder10.Text = "Stacker Rail     OPEN";
            }
            btCylinder10.ForeColor = SM.CL_Complete(ci.STCK_StackOpCl) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.BARZ_BrcdStprUpDn) == fb.Bwd)
            {
                btCylinder11.Text = "Barcode Stopper DOWN";
            }
            else
            {
                btCylinder11.Text = "Barcode Stopper UP";
            }
            btCylinder11.ForeColor = SM.CL_Complete(ci.BARZ_BrcdStprUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.BARZ_BrcdTrayUpDn) == fb.Bwd)
            {
                btCylinder12.Text = "Barcode Tray DOWN";
            }
            else
            {
                btCylinder12.Text = "Barcode Tray UP";
            }
            btCylinder12.ForeColor = SM.CL_Complete(ci.BARZ_BrcdTrayUpDn) ? Color.Black : Color.Lime;

            if (SM.CL_GetCmd(ci.BARZ_YPckrFwBw) == fb.Bwd)
            {
                btCylinder13.Text = "Barcode Picker BWD";
            }
            else
            {
                btCylinder13.Text = "Barcode Picker FWD";
            }
            btCylinder13.ForeColor = SM.CL_Complete(ci.BARZ_YPckrFwBw)    ? Color.Black : Color.Lime;

            btManual1.ForeColor = (MM.GetManNo() == mc.LODR_Home) ? Color.Lime : Color.Black;
            btManual2.ForeColor = (MM.GetManNo() == mc.TOOL_Home) ? Color.Lime : Color.Black;
            btManual3.ForeColor = (MM.GetManNo() == mc.BARZ_Home) ? Color.Lime : Color.Black;
            btManual4.ForeColor = (MM.GetManNo() == mc.IDXR_Home) ? Color.Lime : Color.Black;
            btManual5.ForeColor = (MM.GetManNo() == mc.IDXF_Home) ? Color.Lime : Color.Black;
            btManual6.ForeColor = (MM.GetManNo() == mc.STCK_Home) ? Color.Lime : Color.Black;

            Refresh();
            tmUpdate.Enabled = true;
        }
Example #5
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 (SM.ER_IsErr()) { Init(); return; }
            //Cycle Step.
            if (m_iManNo == mc.AllHome)
            {
                r1 = SEQ.TOOL.CycleHome();
                if (!r1)
                {
                    return;
                }
                r2 = SEQ.BARZ.CycleHome();
                r3 = SEQ.LODR.CycleHome();
                r4 = SEQ.IDXR.CycleHome();
                r5 = SEQ.IDXF.CycleHome();
                r6 = SEQ.STCK.CycleHome();

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

                if (SM.MT_GetHomeDoneAll())
                {
                    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.TOOL_Home)
            {
                if (SEQ.TOOL.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.BARZ_Home)
            {
                if (SEQ.BARZ.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXR_Home)
            {
                if (SEQ.IDXR.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXF_Home)
            {
                if (SEQ.IDXF.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.STCK_Home)
            {
                if (SEQ.STCK.CycleHome())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.LODR_CycleSply)
            {
                if (SEQ.LODR.CycleSupply())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.IDXF_CycleGet)
            {
                if (SEQ.IDXF.CycleGet())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXF_CycleBarcode)
            {
                if (SEQ.IDXF.CycleBarcode())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXF_CycleOut)
            {
                if (SEQ.IDXF.CycleOut())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXR_CycleGet)
            {
                if (SEQ.IDXR.CycleGet())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXR_CycleBarcode)
            {
                if (SEQ.IDXR.CycleBarcode())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.IDXR_CycleOut)
            {
                if (SEQ.IDXR.CycleOut())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.TOOL_CycleVisn)
            {
                if (SEQ.TOOL.CycleVision())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.TOOL_CycleNGPick)
            {
                if (SEQ.TOOL.CycleNGPick())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.TOOL_CycleNGPlace)
            {
                if (SEQ.TOOL.CycleNGPlace())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.TOOL_CycleGoodPick)
            {
                if (SEQ.TOOL.CycleGoodPick())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.TOOL_CycleGoodPlace)
            {
                if (SEQ.TOOL.CycleGoodPlace())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.STCK_CycleToStack)
            {
                if (SEQ.STCK.CycleToStack())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.STCK_CycleStack)
            {
                if (SEQ.STCK.CycleStack())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.STCK_CycleOut)
            {
                if (SEQ.STCK.CycleOut())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }

            else if (m_iManNo == mc.BARZ_CycleBarPick)
            {
                if (SEQ.BARZ.CycleBarPick())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.BARZ_CycleBarPlace)
            {
                if (SEQ.BARZ.CycleBarPlace())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }
            else if (m_iManNo == mc.BARZ_CycleOut)
            {
                if (SEQ.BARZ.CycleOut())
                {
                    m_iManNo = mc.NoneCycle;
                }
            }


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

            //Ok.
            return;
        }