Exemplo n.º 1
0
        public FormOperation(Panel _pnBase)
        {
            InitializeComponent();

            FrmPassword = new FormPassword();
            FrmLotOpen  = new FormLotOpen();

            this.TopLevel = false;
            this.Parent   = _pnBase;

            //FrmMain = _FrmMain;
            DayInfoList();
            LotInfoList();

            pnPassWord.Visible = false;
            tmUpdate.Enabled   = true;

            btLotEnd.Enabled  = LOT.GetLotOpen();
            btStart.Enabled   = LOT.GetLotOpen();
            btLotOpen.Enabled = !LOT.GetLotOpen();
            //
            DM.ARAY[(int)ri.IDX].SetParent(pnIdx);
            DM.ARAY[(int)ri.IDX].Name = "riIDX";
            DM.ARAY[(int)ri.IDX].SetDispColor(cs.None, Color.White); DM.ARAY[(int)ri.IDX].SetDispName(cs.None, "NotExsist"); DM.ARAY[(int)ri.IDX].SetVisible(cs.None, true);
            DM.ARAY[(int)ri.IDX].SetDispColor(cs.Empty, Color.Gray); DM.ARAY[(int)ri.IDX].SetDispName(cs.Empty, "Empty"); DM.ARAY[(int)ri.IDX].SetVisible(cs.Empty, true);
            DM.ARAY[(int)ri.IDX].SetDispColor(cs.Unkwn, Color.Aqua); DM.ARAY[(int)ri.IDX].SetDispName(cs.Unkwn, "Unknown"); DM.ARAY[(int)ri.IDX].SetVisible(cs.Unkwn, true);
            DM.ARAY[(int)ri.IDX].SetDispColor(cs.Move, Color.Yellow); DM.ARAY[(int)ri.IDX].SetDispName(cs.Move, "Move"); DM.ARAY[(int)ri.IDX].SetVisible(cs.Move, true);
            DM.ARAY[(int)ri.IDX].SetDispColor(cs.Work, Color.Blue); DM.ARAY[(int)ri.IDX].SetDispName(cs.Work, "Work"); DM.ARAY[(int)ri.IDX].SetVisible(cs.Work, true);
            DM.ARAY[(int)ri.IDX].SetMaxColRow(1, 1);

            //
            //DM.ARAY[(int)ri.PST_IDX].SetParent(pnPst);
            //DM.ARAY[(int)ri.PST_IDX].Name = "riPst";
            //DM.ARAY[(int)ri.PST_IDX].SetDispColor(cs.None , Color.White ); DM.ARAY[(int)ri.PST_IDX].SetDispName(cs.None , "NotExsist" ); DM.ARAY[(int)ri.PST_IDX].SetVisible(cs.None , true);
            //DM.ARAY[(int)ri.PST_IDX].SetDispColor(cs.Empty, Color.Gray  ); DM.ARAY[(int)ri.PST_IDX].SetDispName(cs.Empty, "Empty"     ); DM.ARAY[(int)ri.PST_IDX].SetVisible(cs.Empty, true);
            //DM.ARAY[(int)ri.PST_IDX].SetDispColor(cs.Work , Color.Blue  ); DM.ARAY[(int)ri.PST_IDX].SetDispName(cs.Work , "Work"      ); DM.ARAY[(int)ri.PST_IDX].SetVisible(cs.Work , true);
            //DM.ARAY[(int)ri.PST_IDX].SetMaxColRow(1,  5);

            DM.LoadMap();
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 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;
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            tmUpdate.Enabled = false;

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

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

            bool bRet = false;

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

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

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

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

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

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

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

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

            TimeSpan Span;

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

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

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

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


            WorkInfo();
            string sCycleTimeSec;
            int    iCycleTimeMs;


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

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

            SPC.LOT.DispLotInfo(lvLotInfo);

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


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

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


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

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

                pnManual.Enabled = true;
            }

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

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

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

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

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

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

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

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


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

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

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

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

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

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

            PanelRefresh();

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

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

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



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

            tmUpdate.Enabled = true;
        }
Exemplo n.º 8
0
        private void btDownload_Click(object sender, EventArgs e)             //HRM-930B 참고
        {
            string sText = ((Button)sender).Text;

            Log.Trace(sFormText + sText + " Button Clicked", ti.Frm);

            if (tbFromName.Text == "")
            {
                return;
            }

            //Check Running Status
            //            bool bAllArayNone = DM.ARAY[(int)ri.SLD].CheckAllStat(cs.None);

            if (LOT.GetLotOpen())
            {
                Log.ShowMessage("Error", "자재나 메거진이 남아 있으면 잡파일을 바꿀수 없습니다.");
                //Log.ShowMessage("Error", "Cannot change the working files.");
                return;
            }

            //if(OM.DevInfo.sMrkData != "")SEQ.Com[0].SendMsg(OM.DevInfo.sMrkData);
            if (lvDevice.SelectedIndices.Count <= 0)
            {
                return;
            }
            int iDeviceSel = lvDevice.SelectedIndices[0];

            string sName = lvDevice.Items[iDeviceSel].SubItems[1].Text;
            string sTemp = "DOWNLOAD JOB FILE. (" + lbSelDevice.Text + ")";

            if (OM.GetCrntDev() == sName)
            {
                Log.ShowMessage("ERROR", "현재 잡파일과 같은 잡파일 입니다.");
                //Log.ShowMessage("ERROR", "This is the current file with the same file.");
                return;
            }
            if (Log.ShowMessageModal("Confirm", "Are you Sure?") != DialogResult.Yes)
            {
                return;
            }

            SaveDeviceLog(0, OM.GetCrntDev(), sName);
            //FrmMain.FrmDeviceSet.
            OM.LoadJobFile(sName); pbStatus.Minimum = 0;
            //SEQ.Visn.SendJobChange(sName); pbStatus.Minimum = 30;
            PM.Load(sName); pbStatus.Value = 70;
            CConfig Config = new CConfig();

            //string sExeFolder = System.AppDomain.CurrentDomain.BaseDirectory;
            //string sDevOptnPath = sExeFolder + "JobFile\\" + sName + "\\TrayMask.ini";
            //Config.Load(sDevOptnPath, CConfig.EN_CONFIG_FILE_TYPE.ftIni);
            //DM.ARAY[ri.MASK].Load(Config, true);

            pbStatus.Value = 100;

            CDelayTimer TimeOut = new CDelayTimer();

            TimeOut.Clear();
            //while (!SEQ.Visn.GetSendCycleEnd(VisnCom.vs.JobChange))
            //{
            //    Thread.Sleep(1);
            //    if (TimeOut.OnDelay(5000))
            //    {
            //        ML.ER_SetErr(ei.VSN_ComErr, "JobFile Change TimeOut");
            //        break;
            //    }
            //}

            lbSelDevice.Text  = "";
            tbFromName.Text   = "";
            lbCrntDevice.Text = sName;

            PM.UpdatePstn(true);


            //OM.TrayMask.SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY);
            //OM.TrayMask.SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY);
            //OM.SaveTrayMask();

            //SEQ.VisnRB.SendJobChange(sName);
            //CDelayTimer TimeOut = new CDelayTimer();
            //TimeOut.Clear();
            //while(!SEQ.VisnRB.GetSendCycleEnd(VisnCom.vs.JobChange  )){
            //    Thread.Sleep(1);
            //    if(TimeOut.OnDelay(5000)) {
            //        SM.ER_SetErr(ei.VSN_ComErr,"잡체인지 비전 통신 타임아웃");
            //        break;
            //    }
            //}
        }
Exemplo n.º 9
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;
            }
        }
Exemplo n.º 10
0
        private void btDownload_Click(object sender, EventArgs e)             //HRM-930B 참고
        {
            string sText = ((Button)sender).Text;

            Log.Trace(sFormText + sText + " Button Clicked", ti.Frm);

            if (tbFromName.Text == "")
            {
                return;
            }

            //Check Running Status
            //            bool bAllArayNone = DM.ARAY[(int)ri.SLD].CheckAllStat(cs.None);

            if (LOT.GetLotOpen())
            {
                //Log.ShowMessage("Error", "자재나 메거진이 남아 있으면 잡파일을 바꿀수 없습니다.");
                Log.ShowMessage("Error", "Please check the status of the Lot(Need to Lot End).");
                return;
            }

            //if(OM.DevInfo.sMrkData != "")SEQ.Com[0].SendMsg(OM.DevInfo.sMrkData);
            if (lvDevice.SelectedIndices.Count <= 0)
            {
                return;
            }
            int iDeviceSel = lvDevice.SelectedIndices[0];

            string sName = lvDevice.Items[iDeviceSel].SubItems[1].Text;
            string sTemp = "DOWNLOAD JOB FILE. (" + lbSelDevice.Text + ")";

            if (OM.GetCrntDev() == sName)
            {
                //Log.ShowMessage( "ERROR", "현재 잡파일과 같은 잡파일 입니다.");
                Log.ShowMessage("ERROR", "This is the current file with the same file.");
                return;
            }
            if (Log.ShowMessageModal("Confirm", "Are you Sure?") != DialogResult.Yes)
            {
                return;
            }

            SaveDeviceLog(0, OM.GetCrntDev(), sName);
            //FrmMain.FrmDeviceSet.
            OM.LoadJobFile(sName); pbStatus.Minimum = 0;
            //SEQ.Visn.SendJobChange(sName); pbStatus.Minimum = 30;
            PM.Load(sName); pbStatus.Value = 70;
            CConfig Config = new CConfig();

            //string sExeFolder = System.AppDomain.CurrentDomain.BaseDirectory;
            //string sDevOptnPath = sExeFolder + "JobFile\\" + sName + "\\TrayMask.ini";
            //Config.Load(sDevOptnPath, CConfig.EN_CONFIG_FILE_TYPE.ftIni);

            ArrayPos.TPara PosPara; //= new ArrayPos.TPara();
            PosPara.dColGrGap   = OM.DevInfo.dColGrGap;
            PosPara.iColCnt     = OM.DevInfo.iColCnt;
            PosPara.iRowCnt     = OM.DevInfo.iRowCnt;
            PosPara.dColPitch   = OM.DevInfo.dColPitch;
            PosPara.dRowPitch   = OM.DevInfo.dRowPitch;
            PosPara.iColGrCnt   = OM.DevInfo.iColGrCnt;
            PosPara.iRowGrCnt   = OM.DevInfo.iRowGrCnt;
            PosPara.dColGrGap   = OM.DevInfo.dColGrGap;
            PosPara.dRowGrGap   = OM.DevInfo.dRowGrGap;
            PosPara.iColSbGrCnt = OM.DevInfo.iColSbGrCnt;
            PosPara.iRowSbGrCnt = OM.DevInfo.iRowSbGrCnt;
            PosPara.dRowSbGrGap = OM.DevInfo.dRowSbGrGap;
            PosPara.dColSbGrGap = OM.DevInfo.dColSbGrGap;
            if (!OM.StripPos.SetPara(PosPara))
            {
                Log.ShowMessage("Strip Position Err", OM.StripPos.Error);
            }

            pbStatus.Value = 100;

            CDelayTimer TimeOut = new CDelayTimer();

            TimeOut.Clear();
            //while (!SEQ.Visn.GetSendCycleEnd(VisnCom.vs.JobChange))
            //{
            //    Thread.Sleep(1);
            //    if (TimeOut.OnDelay(5000))
            //    {
            //        ML.ER_SetErr(ei.VSN_ComErr, "JobFile Change TimeOut");
            //        break;
            //    }
            //}

            lbSelDevice.Text  = "";
            tbFromName.Text   = "";
            lbCrntDevice.Text = sName;

            PM.UpdatePstn(true);

            //Loader.
            DM.ARAY[ri.LODR].SetMaxColRow(1, OM.DevInfo.iMgzSlotCnt);

            //Prebuffer
            DM.ARAY[ri.PREB].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);

            //Vision1
            DM.ARAY[ri.VSN1].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);
            DM.ARAY[ri.RLT1].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);
            DM.ARAY[ri.WRK1].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);

            //Vision2
            DM.ARAY[ri.VSN2].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);
            DM.ARAY[ri.RLT2].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);
            DM.ARAY[ri.WRK2].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);

            //Vision3
            DM.ARAY[ri.VSN3].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);
            DM.ARAY[ri.RLT3].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);
            DM.ARAY[ri.WRK3].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);

            //PostBuffer
            DM.ARAY[ri.PSTB].SetMaxColRow(OM.DevInfo.iColCnt, OM.DevInfo.iRowCnt);

            //Unloader
            DM.ARAY[ri.ULDR].SetMaxColRow(1, OM.DevInfo.iMgzSlotCnt);

            SEQ.VSNZ.JobChange();
            //SEQ.VisnRB.SendJobChange(sName);

            //CDelayTimer TimeOut = new CDelayTimer();
            //TimeOut.Clear();
            //while(!SEQ.VisnRB.GetSendCycleEnd(VisnCom.vs.JobChange  )){
            //    Thread.Sleep(1);
            //    if(TimeOut.OnDelay(5000)) {
            //        SM.ER_SetErr(ei.VSN_ComErr,"잡체인지 비전 통신 타임아웃");
            //        break;
            //    }
            //}

            //프로그램 강제 종료할때 셋팅 안되서 강제 종료 후 다시 켰을때 종료 이전에 다운로드한 디바이스로
            //다시 로딩되서 집어 넣음. 진섭
            OM.SaveLastInfo();
        }