private void tmUpdate_Tick(object sender, EventArgs e) { tmUpdate.Enabled = false; LbStat1.BackColor = SM.MT_GetNLimSnsr(m_eId) ? Color.Lime : Color.Silver; LbStat2.BackColor = SM.MT_GetHomeSnsr(m_eId) ? Color.Lime : Color.Silver; LbStat3.BackColor = SM.MT_GetPLimSnsr(m_eId) ? Color.Lime : Color.Silver; LbStat4.BackColor = SM.MT_GetAlarmSgnl(m_eId) ? Color.Lime : Color.Silver; LbStat5.BackColor = SM.MT_GetServo(m_eId) ? Color.Lime : Color.Silver; LbStat6.BackColor = SM.MT_GetStop(m_eId) ? Color.Lime : Color.Silver; LbStat7.BackColor = SM.MT_GetHomeDone(m_eId) ? Color.Lime : Color.Silver; LbCmdPos.Text = string.Format("{0:0.0000}", SM.MT_GetCmdPos(m_eId)); LbEncPos.Text = string.Format("{0:0.0000}", SM.MT_GetEncPos(m_eId)); if (SEQ._bRun || MM.GetManNo() != mc.NoneCycle) { btNeg.Enabled = false; btPos.Enabled = false; } else { btNeg.Enabled = true; btPos.Enabled = true; } tmUpdate.Enabled = true; }
public static void UpdateSeqState() { bool isInit = MM.GetManNo() == mc.AllHome; bool isError = SML.ER.IsErr(); bool isRunning = m_bRun; bool isRunWarn = m_bRunEnd; bool isStop = !m_bRun && !m_bRunEnd; bool isLotEnd = LOT.GetLotEnd(); //Flicking Timer. if (m_bFlick) { m_tmFlickOn.Clear(); if (m_tmFlickOff.OnDelay(m_bFlick, 500)) { m_bFlick = false; } } else { m_tmFlickOff.Clear(); if (m_tmFlickOn.OnDelay(!m_bFlick, 500)) { m_bFlick = true; } } //Set Sequence State. Tower Lamp if (isInit) { m_iSeqStat = EN_SEQ_STAT.Init; } else if (isLotEnd) { m_iSeqStat = EN_SEQ_STAT.WorkEnd; } else if (isError) { m_iSeqStat = EN_SEQ_STAT.Error; } else if (isRunning) { m_iSeqStat = EN_SEQ_STAT.Running; } else if (isStop) { m_iSeqStat = EN_SEQ_STAT.Stop; } else if (isRunWarn) { m_iSeqStat = EN_SEQ_STAT.RunWarn; Log.ShowMessage("Warning", "Work End"); } else { } }
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; } }
// CPartInterface * m_pPart[MAX_PART] ; //-------------------------------------------------------------------------------------------------------- public static void Reset() { //Check running flag. if (m_bRun) { return; } if (m_iSeqStat == EN_SEQ_STAT.Init) { return; } if (m_iStep == EN_SEQ_STEP.ToStopCon) { return; } if (m_iStep == EN_SEQ_STEP.ToStop) { return; } if (MM.GetManNo() != mc.NoneCycle) { return; } LOT.Reset(); Log.Trace("Seq", "Reset"); m_tmToStop.Clear(); m_tmToStrt.Clear(); m_tmFlickOn.Clear(); m_tmFlickOff.Clear(); m_tmTemp.Clear(); m_tmCloseDoor.Clear(); //Init. Var. m_bBtnReset = false; m_bBtnStart = false; m_bBtnStop = false; m_bRunEnd = false; m_bRun = false; m_iStep = EN_SEQ_STEP.Idle; //Error. ML.ER_Clear(); //Manual. MM.Reset(); //ML. for (int i = 0; i < (int)pi.MAX_PART; i++) { m_Part[i].Reset(); } //Cylinder Reset , Need to First Time ML.CL_Reset(); //Lot End Flag Reset. LOT.Reset(); Log.CloseForm(); m_iSeqStat = EN_SEQ_STAT.Stop; //System. ML.MT_ResetAll(); ML.MT_SetServoAll(true); //VSNZ존에서 처리함. //for(int i = 0 ; i < (int)vi.MAX_VI; i++) //{ // if(!OM.VsSkip((vi)i)) VSNZ.VisnComs[i].SendCmd(VisnCom.vc.Reset); //} }
public static void UpdateSeqState() { bool isInit = MM.GetManNo() == mc.AllHome; bool isError = ML.ER_IsErr(); bool isRunning = m_bRun; bool isRunWarn = m_bRunEnd; bool isManual = MM.GetManNo() > mc.AllHome; bool isStop = !m_bRun && !m_bRunEnd; bool isToStart = m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart; bool isToStop = m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop; bool isLotEnd = LOT.GetLotEnd(); //Flicking Timer. if (m_bFlick) { m_tmFlickOn.Clear(); if (m_tmFlickOff.OnDelay(m_bFlick, 500)) { m_bFlick = false; } } else { m_tmFlickOff.Clear(); if (m_tmFlickOn.OnDelay(!m_bFlick, 500)) { m_bFlick = true; } } //Set Sequence State. Tower Lamp // if (isMaint ) { m_iSeqStat = EN_SEQ_STAT.Maint ;} if (isInit) { m_iSeqStat = EN_SEQ_STAT.Init; } else if (isLotEnd) { m_iSeqStat = EN_SEQ_STAT.WorkEnd; } else if (isError) { m_iSeqStat = EN_SEQ_STAT.Error; } else if (isToStart) { m_iSeqStat = EN_SEQ_STAT.ToStart; } else if (isToStop) { m_iSeqStat = EN_SEQ_STAT.ToStop; } else if (isRunning) { m_iSeqStat = EN_SEQ_STAT.Running; } else if (isManual) { m_iSeqStat = EN_SEQ_STAT.Manual; } else if (isStop) { m_iSeqStat = EN_SEQ_STAT.Stop; } else if (isRunWarn) { m_iSeqStat = EN_SEQ_STAT.RunWarn; Log.ShowMessage("Warning", "Work End"); } else { } //Save Status Log. string sStatText, sSub; if (m_iSeqStat != iPreStat) { for (int i = 0; i < 2; i++) { if (i == 0) { sSub = " STATUS END"; iStat = iPreStat; } else { sSub = " STATUS START"; iStat = m_iSeqStat; } switch (iStat) { default: sStatText = "Program Start"; break; case EN_SEQ_STAT.Init: sStatText = "INIT" + sSub; break; case EN_SEQ_STAT.Warning: sStatText = "WARNING" + sSub; break; case EN_SEQ_STAT.Error: sStatText = "ERROR" + sSub; break; case EN_SEQ_STAT.Running: sStatText = "RUNNING" + sSub; break; case EN_SEQ_STAT.Stop: sStatText = "STOP" + sSub; break; case EN_SEQ_STAT.RunWarn: sStatText = "RUNWARN" + sSub; break; case EN_SEQ_STAT.WorkEnd: sStatText = "LOTEND" + sSub; break; case EN_SEQ_STAT.Manual: sStatText = "MANUAL" + sSub; break; case EN_SEQ_STAT.ToStart: sStatText = "TO START" + sSub; break; case EN_SEQ_STAT.ToStop: sStatText = "TO STOP" + sSub; break; } Log.Trace(sStatText, ForContext.Sts); } iPreStat = m_iSeqStat; } }
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; } }
// CPartInterface * m_pPart[MAX_PART] ; //-------------------------------------------------------------------------------------------------------- public static void Reset() { //Check running flag. if (m_bRun) { return; } if (m_iSeqStat == EN_SEQ_STAT.Init) { return; } if (m_iStep == EN_SEQ_STEP.ToStopCon) { return; } if (m_iStep == EN_SEQ_STEP.ToStop) { return; } if (MM.GetManNo() != mc.NoneCycle) { return; } LOT.Reset(); Log.Trace("Seq", "Reset"); m_tmToStop.Clear(); m_tmToStrt.Clear(); m_tmFlickOn.Clear(); m_tmFlickOff.Clear(); m_tmTemp.Clear(); m_tmCloseDoor.Clear(); //Init. Var. m_bBtnReset = false; m_bBtnStart = false; m_bBtnStop = false; m_bRunEnd = false; m_bRun = false; m_iStep = EN_SEQ_STEP.Idle; //Error. SM.ER_Clear(); //Manual. MM.Reset(); //Part. for (int i = 0; i < (int)pi.MAX_PART; i++) { m_Part[i].Reset(); } //Lot End Flag Reset. LOT.Reset(); //FM_CloseMsgOk(); m_iSeqStat = EN_SEQ_STAT.Stop; //System. //if(!EM_IsErr()) return; //20150801 선계원 홈잡을때 리셑 누르면 홈스텝이 날라가서 처박았음. //SM.MT.ResetAll(); SM.MT_ResetAll(); SM.MT_SetServoAll(true); }
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; }
private static void UpdateButton() { //Check Inspect. //if (!OM.CmnOptn.bIgnrDoor) InspectDoor(); if (m_iStep != EN_SEQ_STEP.Idle) { InspectHomeDone(); } if (m_iStep == EN_SEQ_STEP.Idle) { InspectLightGrid(); } //Local Var. bool isErr = ML.ER_IsErr(); bool bStartSw = ML.IO_GetXUp(xi.ETC_StartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ; bool bStopSw = ML.IO_GetXUp(xi.ETC_StopSw) || m_bBtnStop; // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop ; bool bResetSw = ML.IO_GetXUp(xi.ETC_ResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ; bool bAirSw = false; //ML.IO_GetXUp(xi.ETC_AirSw ) || m_bBtnAir ; bool bInitSw = false; //ML.IO_GetXUp(xi.ETC_InitSw ) ; bool bMotorSw = ML.IO_GetXUp(xi.ETC_MotorSw); if (m_bBtnStart) { Log.Trace("m_bBtnStart", "true"); } if (bStartSw) { Log.Trace("bStartSw", "Started"); if (m_iSeqStat == EN_SEQ_STAT.Init) { Log.Trace("SeqStat", "ssInit "); } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd) { Log.Trace("SeqStat", "ssWorkEnd"); } if (m_iSeqStat == EN_SEQ_STAT.Error) { Log.Trace("SeqStat", "ssError "); } if (m_iSeqStat == EN_SEQ_STAT.Running) { Log.Trace("SeqStat", "ssRunning"); } if (m_iSeqStat == EN_SEQ_STAT.Stop) { Log.Trace("SeqStat", "ssStop "); } if (m_iSeqStat == EN_SEQ_STAT.RunWarn) { Log.Trace("SeqStat", "ssRunWarn"); } if (MM.GetManNo() != (int)mc.NoneCycle) { Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString())); bStartSw = false; } } //Update Switch's Lamp bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick; //버튼 클릭시나 ML.IO_SetY(yi.ETC_StartLp, ML.IO_GetX(xi.ETC_StartSw) || m_bRun); ML.IO_SetY(yi.ETC_StopLp, ML.IO_GetX(xi.ETC_StopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_ResetLp, ML.IO_GetX(xi.ETC_ResetSw) || (m_bFlick && isErr)); //ML.IO_SetY(yi.ETC_AirLp , ML.IO_GetX(xi.ETC_AirSw ) || ML.IO_GetY(yi.ETC_MainAirSol )); //ML.IO_SetY(yi.ETC_InitLp , ML.IO_GetX(xi.ETC_InitSw ) ); ML.IO_SetY(yi.ETC_MotorLp, ML.MT_GetServo(mi.OUT_TRelT)); //Center Man Button m_bBtnStart = false; m_bBtnStop = false; m_bBtnReset = false; m_bBtnAir = false; //Init. Button Flags. bool isHomeEnd = ML.MT_GetHomeDoneAll(); if (bStartSw) { if (!isHomeEnd) { Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false; } //if(!LOT.GetLotOpen ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; } //if(!InspectStripDispr ()) { m_bInspDispr = true ; bStartSw = false ; } //if(!InspectStripUnknown()) { m_bInspUnkwn = true ; bStartSw = false ; } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn) { Reset(); } } if (bInitSw) { MM.SetManCycle(mc.AllHome); } if (bMotorSw) { if (ML.MT_GetServo(mi.OUT_TRelT)) { ML.MT_SetServo(mi.OUT_TRelT, false); ML.MT_SetServo(mi.OUT_TRelB, false); } else { ML.MT_SetServo(mi.OUT_TRelT, true); ML.MT_SetServo(mi.OUT_TRelB, true); ML.MT_SetHomeDone(mi.OUT_TRelT, true); ML.MT_SetHomeDone(mi.OUT_TRelB, true); } } //Air Switch. //if(bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init) //{ // ML.IO_SetY(yi.ETC_MainAirSol , !ML.IO_GetY(yi.ETC_MainAirSol )) ; //} //Buzzer Off. if (isErr && bStopSw) { ML.TL_SetBuzzOff(true); } bool isStopCon = bStopSw || (isErr && !m_bReqStop && m_bRun); bool isRunCon = bStartSw && !isErr; bool isResetCon = bResetSw && !m_bRun; //Run. if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) { m_iStep = EN_SEQ_STEP.ToStartCon; ML.TL_SetBuzzOff(false); ML.ER_SetDisp(true); } if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { m_bReqStop = true; } if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle)) { Reset(); } if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 10000)) { //Trace Log. string Msg; Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); ML.ER_SetErr(ei.ETC_ToStartTO); m_iStep = EN_SEQ_STEP.Idle; m_bRun = false; } //CDelayTimer StopBtn = null; //StopBtn = new CDelayTimer(); //if(m_iStep == EN_SEQ_STEP.scToStopCon) //{ // if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000)) // { // Log.Trace("SEQ","Forced Stop"); // m_bRun = false ; // m_iStep = EN_SEQ_STEP.scIdle; // m_bReqStop = false; // } //} //else //{ // StopBtn.Clear(); //} if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 10000)) // 20000)) { { //Trace Log. string Msg; Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); m_bRun = false; ML.ER_SetErr(ei.ETC_ToStopTO); m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; } EN_SEQ_STEP iPreStep = m_iStep; if (iPreStep != m_iStep) { string sMsg = ""; sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString()); Log.Trace("SEQ", sMsg); } iPreStep = m_iStep; //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠. bool bPreLotEnd = LOT.GetLotEnd(); if (LOT.GetLotEnd() != bPreLotEnd) { Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False"); } bPreLotEnd = LOT.GetLotEnd(); //Running Step. switch (m_iStep) { case EN_SEQ_STEP.Idle: return; case EN_SEQ_STEP.ToStartCon: if (!ToStartCon()) { return; } m_iStep = EN_SEQ_STEP.ToStart; Log.Trace("SEQ", "scToStartCon END"); return; case EN_SEQ_STEP.ToStart: if (!ToStart()) { return; } m_bRun = true; m_bRunEdge = true; m_iStep = EN_SEQ_STEP.Run; Log.Trace("SEQ", "scToStart END"); return; case EN_SEQ_STEP.Run: if (!m_bReqStop) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.ShowMessage("Checked", "Lot Ended."); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); m_bRunEnd = true; m_iStep = EN_SEQ_STEP.ToStopCon; } return; } m_bReqStop = false; m_iStep = EN_SEQ_STEP.ToStopCon; Log.Trace("SEQ", "scRun END"); return; case EN_SEQ_STEP.ToStopCon: if (!ToStopCon()) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.Trace("SEQ", "scToStopCon LotEnd"); } return; } m_bRun = false; m_iStep = EN_SEQ_STEP.ToStop; Log.Trace("SEQ", "scToStopCon END"); return; case EN_SEQ_STEP.ToStop: if (!ToStop()) { return; } m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; DM.SaveMap(); Log.Trace("SEQ", "scToStop END"); return; } }
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; } }