public string GetCrntLotNo() { //if(DM.ARAY[riSRT].GetCntStat(csRslt1) // return ""; return(LOT.GetLotNo()); /* * if(!DM.ARAY[riSRT].CheckAllStat(csNone)) return DM.ARAY[riSRT].GetLotNo() ; * else if(!DM.ARAY[riZIG].CheckAllStat(csNone)) return DM.ARAY[riZIG].GetLotNo() ; * else if(!DM.ARAY[riSG1].CheckAllStat(csNone)) return DM.ARAY[riSG1].GetLotNo() ; * else if(!DM.ARAY[riSG2].CheckAllStat(csNone)) return DM.ARAY[riSG2].GetLotNo() ; * else if(!DM.ARAY[riSG3].CheckAllStat(csNone)) return DM.ARAY[riSG3].GetLotNo() ; * else if(!DM.ARAY[riSG4].CheckAllStat(csNone)) return DM.ARAY[riSG4].GetLotNo() ; * else if(!DM.ARAY[riPRL].CheckAllStat(csNone)) return DM.ARAY[riPRL].GetLotNo() ; * else if(!DM.ARAY[riLDR].CheckAllStat(csNone)) return DM.ARAY[riLDR].GetLotNo() ; * else if(!DM.ARAY[riPSL].CheckAllStat(csNone)) return DM.ARAY[riPSL].GetLotNo() ; * else if(!DM.ARAY[riPRU].CheckAllStat(csNone)) return DM.ARAY[riPRU].GetLotNo() ; * else if(!DM.ARAY[riULD].CheckAllStat(csNone)) return DM.ARAY[riULD].GetLotNo() ; * else if(!DM.ARAY[riPSU].CheckAllStat(csNone)) return DM.ARAY[riPSU].GetLotNo() ; * else if(!DM.ARAY[riRJ1].CheckAllStat(csNone)) return DM.ARAY[riRJ1].GetLotNo() ; * else if(!DM.ARAY[riRJ2].CheckAllStat(csNone)) return DM.ARAY[riRJ2].GetLotNo() ; * else if(!DM.ARAY[riRJ3].CheckAllStat(csNone)) return DM.ARAY[riRJ3].GetLotNo() ; * else if(!DM.ARAY[riRJ4].CheckAllStat(csNone)) return DM.ARAY[riRJ4].GetLotNo() ; * * else return ""; */ }
private void btLotEnd_Click(object sender, EventArgs e) { if (Log.ShowMessageModal("Confirm", "Do you want to Clear Lot?") != DialogResult.Yes) { return; } LOT.LotEnd(); DM.ARAY[ri.SPLR].SetStat(cs.None); DM.ARAY[ri.IDXR].SetStat(cs.None); DM.ARAY[ri.IDXF].SetStat(cs.None); DM.ARAY[ri.PCKR].SetStat(cs.None); //DM.ARAY[ri.TRYF].SetStat(cs.None ); //DM.ARAY[ri.TRYG].SetStat(cs.None ); DM.ARAY[ri.OUTZ].SetStat(cs.None); DM.ARAY[ri.STCK].SetStat(cs.Empty); DM.ARAY[ri.BARZ].SetStat(cs.None); DM.ARAY[ri.INSP].SetStat(cs.Good); DM.ARAY[ri.PSTC].SetStat(cs.None); btStart.Enabled = false; if (Log.ShowMessageModal("Confirm", "Do you want to make VIT file and Local Report?") != DialogResult.Yes) { return; } LOT.LotEnd(); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); //HZ7290XH98_006_170928_143116P int iRealTrayCnt = OM.DevInfo.iTRAY_StackingCnt; iRealTrayCnt--; //Top CoverTray if (OM.DevOptn.bUseBtmCover) { iRealTrayCnt--; } int iQty = OM.DevInfo.iTRAY_PcktCntX * OM.DevInfo.iTRAY_PcktCntY * iRealTrayCnt; iQty *= OM.EqpStat.iWorkBundle; if (!OM.CmnOptn.bOracleNotWriteVITFile && OM.CmnOptn.sVITFolder != "") { SEQ.Oracle.WriteVIT(OM.CmnOptn.sVITFolder, DateTime.Now.ToString("MM\\/dd\\/yyyy"), OM.CmnOptn.sMachinID, LOT.CrntLotData.sEmployeeID, //20180125 SML.FrmLogOn.GetId() , OM.EqpStat.sLotSttTime, DateTime.Now.ToString("HH:mm:ss"), iQty.ToString()); } }
public static void Update() { double dPreTime = CTimer.GetTime_us(); double dCrntTime; while (true) { dCrntTime = CTimer.GetTime_us(); m_dMainThreadCycleTime = (dCrntTime - dPreTime) / 1000.0; if (m_dMainThreadCycleTime > 2) { Log.Trace(m_dMainThreadCycleTime.ToString()); } dPreTime = dCrntTime; Thread.Sleep(1); //Motion Dll Update SM.Update(m_iSeqStat); //Part for (int i = 0; i < (int)pi.MAX_PART; i++) { m_Part[i].Update(); } //Inspection InspectMainAir(); InspectEmergency(); InspectActuator(); InspectMotor(); InspectCrash(); InspectTemp(); InspectLightGrid(); //Update ErrorProc. UpdateButton(); //Check Button. UpdateSeqState(); //Update Motor State (Input) MM.Update(); //SPC SPC.Update(LOT.GetLotNo(), OM.GetCrntDev(), m_iSeqStat, OM.EqpStat.bMaint); } }
public FormMain() { //this.TopMost = true; SEQ.Init(); OM.LoadLastInfo(); //VC.Init(); InitializeComponent(); m_iActivePage = 0; FrmOperation = new FormOperation(pnBase); FrmVision = new FormVision(pnBase); FrmDevice = new FormDevice(this); FrmDeviceSet = new FormDeviceSet(pnBase); FrmSPC = new FormSPC(pnBase); FrmOption = new FormOption(pnBase); FrmMaster = new FormMaster(); FrmDevice.TopLevel = false; FrmDevice.Parent = pnBase; lbDevice.Text = OM.GetCrntDev().ToString(); lbLotNo.Text = LOT.GetLotNo(); lbName.Text = Eqp.sEqpName; //OM.EqpOptn.sModelName; ShowPage(0); //Operation. tmUpdate.Enabled = true; //SM.IO.SetY((int)yi.ETC_MainAirSol, true); //if (SM.CL.GetCmd((int)ai.IDX_Hold1UpDn) == EN_CYLINDER_POS.cpFwd) //{ // SM.CL.Move((int)ai.IDX_Hold1UpDn, EN_CYLINDER_POS.cpFwd); //} //if (SM.CL.GetCmd((int)ai.IDX_Hold2UpDn) != 0) //{ // SM.CL.Move((int)ai.IDX_Hold2UpDn, EN_CYLINDER_POS.cpFwd); //} }
public FormMain() { //this.TopMost = true; SEQ.Init(); OM.LoadLastInfo(); InitializeComponent(); m_iActivePage = 0; FrmOperation = new FormOperation(pnBase); FrmDevice = new FormDevice(this); FrmDeviceSet = new FormDeviceSet(pnBase); FrmSPC = new FormSPC(pnBase); FrmOption = new FormOption(pnBase); FrmMaster = new FormMaster(); FrmVccOption = new FormVccOption(); FrmVer = new FormVer(); FrmVer.TopLevel = true; FrmDevice.TopLevel = false; FrmDevice.Parent = pnBase; lbDevice.Text = OM.GetCrntDev().ToString(); lbLotNo.Text = LOT.GetLotNo(); lbName.Text = Eqp.sEqpName; //파일 버전 보여주는 부분 string sFileVersion = System.Windows.Forms.Application.ProductVersion; lbVer.Text = "Ver " + sFileVersion; ShowPage(0);//Operation. //MainSol //SM.IO.SetY((int)yi.ETC_MainAirSol, true); tmUpdate.Enabled = true; }
public void LoadSaveLotIni(bool _bLoad) { string sPath; sPath = LOT_FOLDER + LOT.GetLotNo() + "\\LotInfo.ini"; if (_bLoad) { CIniFile IniLoadLotInfo = new CIniFile(sPath); IniLoadLotInfo.Load("Data", "sLotId ", out m_tData.sLotId); IniLoadLotInfo.Load("Data", "iWorkCnt ", out m_tData.iWorkCnt); IniLoadLotInfo.Load("Data", "dSttTime ", out m_tData.dSttTime); IniLoadLotInfo.Load("Data", "dEndTime ", out m_tData.dEndTime); IniLoadLotInfo.Load("Data", "dWorkTime ", out m_tData.dWorkTime); IniLoadLotInfo.Load("Data", "dErrTime ", out m_tData.dErrTime); IniLoadLotInfo.Load("Data", "dStopTime ", out m_tData.dStopTime); IniLoadLotInfo.Load("Data", "dTotalTime", out m_tData.dTotalTime); IniLoadLotInfo.Load("Data", "dUPEH ", out m_tData.dUPEH); IniLoadLotInfo.Load("Data", "dUPH ", out m_tData.dUPH); IniLoadLotInfo.Load("Data", "sJobFile ", out m_tData.sJobFile); } else { CIniFile IniSaveLotInfo = new CIniFile(sPath); IniSaveLotInfo.Save("Data", "sLotId ", m_tData.sLotId); IniSaveLotInfo.Save("Data", "iWorkCnt ", m_tData.iWorkCnt); IniSaveLotInfo.Save("Data", "dSttTime ", m_tData.dSttTime); IniSaveLotInfo.Save("Data", "dEndTime ", m_tData.dEndTime); IniSaveLotInfo.Save("Data", "dWorkTime ", m_tData.dWorkTime); IniSaveLotInfo.Save("Data", "dErrTime ", m_tData.dErrTime); IniSaveLotInfo.Save("Data", "dStopTime ", m_tData.dStopTime); IniSaveLotInfo.Save("Data", "dTotalTime", m_tData.dTotalTime); IniSaveLotInfo.Save("Data", "dUPEH ", m_tData.dUPEH); IniSaveLotInfo.Save("Data", "dUPH ", m_tData.dUPH); IniSaveLotInfo.Save("Data", "sJobFile ", m_tData.sJobFile); } }
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; } }
private void tmUpdate_Tick(object sender, EventArgs e) { tmUpdate.Enabled = false; lbMainThreadTime.Text = string.Format("{0:0.000ms}", SEQ._dMainThreadCycleTime); lbDevice.Text = OM.GetCrntDev().ToString(); lbLotNo.Text = LOT.GetLotNo(); btExit.Enabled = !SEQ._bRun; //Set Sequence State. if (!OM.MstOptn.bDebugMode) { switch (SEQ._iSeqStat) { default: break; case EN_SEQ_STAT.Init: lbStat.Text = "INIT"; lbStat.ForeColor = Color.Blue; break; case EN_SEQ_STAT.Error: lbStat.Text = "ERROR"; lbStat.ForeColor = SEQ._bFlick ? Color.Yellow : Color.Red; break; case EN_SEQ_STAT.Running: lbStat.Text = "RUNNING"; lbStat.ForeColor = Color.Lime; break; case EN_SEQ_STAT.Stop: lbStat.Text = "STOP"; lbStat.ForeColor = Color.Black; break; case EN_SEQ_STAT.WorkEnd: lbStat.Text = "LOTEND"; lbStat.ForeColor = Color.Gray; break; case EN_SEQ_STAT.RunWarn: lbStat.Text = "Run End"; lbStat.ForeColor = Color.Gray; break; } } else { switch (SEQ._iSeqStat) { default: break; case EN_SEQ_STAT.Init: lbStat.Text = "DEBUG INIT"; lbStat.ForeColor = Color.Blue; break; case EN_SEQ_STAT.Error: lbStat.Text = "DEBUG ERROR"; lbStat.ForeColor = SEQ._bFlick ? Color.Yellow : Color.Red; break; case EN_SEQ_STAT.Running: lbStat.Text = "DEBUG RUNNING"; lbStat.ForeColor = Color.Lime; break; case EN_SEQ_STAT.Stop: lbStat.Text = "DEBUG STOP"; lbStat.ForeColor = Color.Black; break; case EN_SEQ_STAT.WorkEnd: lbStat.Text = "DEBUG LOTEND"; lbStat.ForeColor = Color.Gray; break; } } //접근 레벨 Operator에서 Option/Util 버튼 비활성화 if (FormPassword.GetLevel() == EN_LEVEL.Operator) { //btSpc.Enabled = false; btUtil.Enabled = false; btOption.Enabled = false; } else { //btSpc.Enabled = true; btUtil.Enabled = true; btOption.Enabled = true; } 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; } }
public bool CycleWork() { String sTemp; if (m_tmCycle.OnDelay(Step.iCycle != 0 && Step.iCycle == PreStep.iCycle && CheckStop() && !OM.MstOptn.bDebugMode, 5000)) { sTemp = string.Format("Time Out Step.iCycle={0:00}", Step.iCycle); sTemp = m_sPartName + " " + Step.eSeq.ToString() + sTemp; IO_SetY(yi.LODR_MgzInAC, false); IO_SetY(yi.LODR_MgzOutAC, false); IO_SetY(yi.PREB_AirBlower, false); IO_SetY(yi.RAIL_FeedingAC1, false); ER_SetErr(ei.ETC_CycleTO, sTemp); Trace(sTemp); return(true); } if (Step.iCycle != PreStep.iCycle) { sTemp = string.Format("Cycle Step.iCycle={0:00}", Step.iCycle); Trace(sTemp); } PreStep.iCycle = Step.iCycle; if (Stat.bReqStop) { //return true ; } int r, c = 0; //double dPos = 0; switch (Step.iCycle) { default: sTemp = string.Format("Cycle Default Clear Step.iCycle={0:00}", Step.iCycle); return(true); case 10: dPos = (DM.ARAY[ri.LODR].GetMaxRow() - DM.ARAY[ri.LODR].FindLastRow(cs.Unknown) - 1) * OM.DevInfo.dMgzPitch; double dWorkStt = PM.GetValue(mi.LODR_ZClmp, pv.ULDR_ZClmpWorkStart) + dPos; if (!MT_CmprPos(mi.LODR_ZClmp, dWorkStt) && IO_GetX(xi.PREB_PkgInDetect)) { ER_SetErr(ei.LODR_SupplyFail, "Pre Buffer In Sensor Checked"); return(true); } MoveCyl(ci.LODR_ClampUpDn, fb.Fwd); MoveCyl(ci.LODR_PusherFwBw, fb.Bwd); IO_SetY(yi.LODR_MgzInAC, false); IO_SetY(yi.LODR_MgzOutAC, false); Step.iCycle++; return(false); case 11: if (!CL_Complete(ci.LODR_ClampUpDn, fb.Fwd)) { return(false); } if (!CL_Complete(ci.LODR_PusherFwBw, fb.Bwd)) { return(false); } MoveMotr(mi.LODR_YClmp, pv.LODR_YClmpWork); Step.iCycle++; return(false); case 12: if (!MT_GetStopPos(mi.LODR_YClmp, pv.LODR_YClmpWork)) { return(false); } dPos = (DM.ARAY[ri.LODR].GetMaxRow() - DM.ARAY[ri.LODR].FindLastRow(cs.Unknown) - 1) * OM.DevInfo.dMgzPitch; MoveMotr(mi.LODR_ZClmp, pv.LODR_ZClmpWorkStart, dPos); Step.iCycle++; return(false); case 13: if (!MT_GetStopPos(mi.LODR_ZClmp, pv.LODR_ZClmpWorkStart, dPos)) { return(false); } MoveCyl(ci.LODR_PusherFwBw, fb.Fwd); IO_SetY(yi.RAIL_FeedingAC1, true); Step.iCycle++; return(false); case 14: if (IO_GetX(xi.LODR_PushOverload)) { MoveCyl(ci.LODR_PusherFwBw, fb.Bwd); ER_SetErr(ei.LODR_PushOverload); return(true); } if (!CL_Complete(ci.LODR_PusherFwBw, fb.Fwd)) { return(false); } if (!IO_GetX(xi.PREB_PkgInDetect)) //Have no strip { MoveCyl(ci.LODR_PusherFwBw, fb.Bwd); r = DM.ARAY[ri.LODR].FindLastRow(cs.Unknown); DM.ARAY[ri.LODR].SetStat(0, r, cs.Empty); Step.iCycle = 20; return(false); } //요기서 살짝 씀 SEQ.PREB.MoveCyl(ci.PREB_StprUpDn, fb.Fwd); IO_SetY(yi.PREB_AirBlower, true); MoveCyl(ci.LODR_PusherFwBw, fb.Bwd); Step.iCycle++; return(false); case 20: //Have no strip case if (!CL_Complete(ci.LODR_PusherFwBw, fb.Bwd)) { return(false); } IO_SetY(yi.RAIL_FeedingAC1, false); Step.iCycle = 0; return(true); case 15: if (!CL_Complete(ci.PREB_StprUpDn, fb.Fwd)) { return(false); } //IO_SetY(yi.RAIL_FeedingAC1,true); m_tmDelay.Clear(); Step.iCycle++; return(false); case 16: if (m_tmDelay.OnDelay(4000)) { IO_SetY(yi.RAIL_FeedingAC1, false); IO_SetY(yi.PREB_AirBlower, false); ER_SetErr(ei.RAIL_FeedingFail, "Loader Pusher Feeding Fail"); return(true); } if (!IO_GetX(xi.PREB_StrpDetect)) { return(false); } m_tmDelay.Clear(); Step.iCycle++; return(false); case 17: if (!m_tmDelay.OnDelay(100)) { return(false); //자꾸 튕겨서 센서밖으로 나가서. } IO_SetY(yi.RAIL_FeedingAC1, false); IO_SetY(yi.PREB_AirBlower, false); //?? 쉬프트로 하면 안됌.//DM.ShiftData(ri.LODR,ri.PREB); r = DM.ARAY[ri.LODR].FindLastRow(cs.Unknown); DM.ARAY[ri.LODR].SetStat(0, r, cs.Empty); DM.ARAY[ri.PREB].SetStat(cs.Unknown); DM.ARAY[ri.PREB].LotNo = DM.ARAY[ri.LODR].LotNo; DM.ARAY[ri.PREB].ID = (LOT.GetWorkMgzCnt() * 100 + r).ToString(); //100자리는 메거진카운트 10자리까진 슬롯. OM.CmnOptn.sLdrPreLotNo = DM.ARAY[ri.PREB].LotNo; OM.CmnOptn.sLdrPreLotId = DM.ARAY[ri.PREB].ID; if (LOT.GetLotNo() != DM.ARAY[ri.PREB].LotNo) { LOT.LotOpen(DM.ARAY[ri.PREB].LotNo); OM.EqpStat.iPreRsltCnts = (int [])OM.EqpStat.iRsltCnts.Clone(); System.Array.Clear(OM.EqpStat.iRsltCnts, 0, OM.EqpStat.iRsltCnts.Length); //OM.EqpStat.iRsltCnts.Initialize(); } m_tmDelay.Clear(); Step.iCycle++; return(false); case 18: if (!m_tmDelay.OnDelay(1000)) { return(false); //자꾸 튕겨서 센서밖으로 나가서. } if (IO_GetX(xi.PREB_StrpDetect)) { Step.iCycle = 0; return(true); } IO_SetY(yi.RAIL_FeedingAC1, true); m_tmDelay.Clear(); Step.iCycle++; return(false); case 19: if (!m_tmDelay.OnDelay(300)) { return(false); //자꾸 튕겨서 센서밖으로 나가서. } IO_SetY(yi.RAIL_FeedingAC1, false); Step.iCycle = 0; return(true); } }
override public bool Autorun() //오토런닝시에 계속 타는 함수. { PreStep.eSeq = Step.eSeq; string sCycle = GetCrntCycleName(); //Check Error & Decide Step. if (Step.eSeq == sc.Idle) { if (Stat.bReqStop) { return(false); } if (OM.DevInfo.iMgzCntPerLot < 1) { OM.DevInfo.iMgzCntPerLot = 1; //1이상이여야 함 다른데서 까먹을거 같아서 여기 넣어놈. } //자재 상태 bool None = DM.ARAY[ri.LODR].CheckAllStat(cs.None); bool Unkwn = DM.ARAY[ri.LODR].GetCntStat(cs.Unknown) > 0; bool Empty = DM.ARAY[ri.LODR].CheckAllStat(cs.Empty); bool bMgzSsr1 = IO_GetX(xi.LODR_MgzDetect1); bool bMgzSsr2 = IO_GetX(xi.LODR_MgzDetect2); //조건 bool Supply = (!IO_GetX(xi.LODR_MgzIn) && !Stat.bSupply); //매거진에 구멍땜에 안들어와있을경우 반영 , 매거진 있을때라고 생각 bool Pick = !Supply; bool PreRdy = DM.ARAY[ri.PREB].CheckAllStat(cs.None) && SEQ.VSNZ.GetSeqStep() != (int)VisnZone.sc.Move; bool bLot = LOT.GetNextMgz() != ""; bool bLotWait = LOT.GetLotNo() != DM.ARAY[ri.LODR].LotNo; //랏변경시에 레일을 비우고 시작한다. bool bLotMove = DM.ARAY[ri.PREB].CheckAllStat(cs.None) && DM.ARAY[ri.VSN1].CheckAllStat(cs.None) && DM.ARAY[ri.VSN2].CheckAllStat(cs.None) && DM.ARAY[ri.VSN3].CheckAllStat(cs.None) && DM.ARAY[ri.PSTB].CheckAllStat(cs.None); //사이클 bool isSupply = None && Supply && bLot && !OM.CmnOptn.bLoadStop; bool isPick = None && Pick && bLot && !OM.CmnOptn.bLoadStop; bool isWork = Unkwn && PreRdy && !OM.CmnOptn.bLoadStop && (!bLotWait || bLotMove); bool isDrop = Empty; bool isEnd = None && LOT.GetNextMgz() == ""; //모르는 카세트 에러 if (None && (bMgzSsr1 || bMgzSsr2)) { ER_SetErr(ei.PKG_Unknwn, "Loader have no data found, but mgz sensor detected"); } //카세트 사라짐 if (!None && (!bMgzSsr1 && !bMgzSsr2)) { ER_SetErr(ei.PKG_Dispr, "Loader have data, but mgz sensor not detected"); } if (ER_IsErr()) { return(false); } //Normal Decide Step. if (isSupply) { DM.ARAY[ri.LODR].Trace(m_iPartId); Step.eSeq = sc.Supply; } else if (isPick) { DM.ARAY[ri.LODR].Trace(m_iPartId); Step.eSeq = sc.Pick; } else if (isWork) { DM.ARAY[ri.LODR].Trace(m_iPartId); Step.eSeq = sc.Work; } else if (isDrop) { DM.ARAY[ri.LODR].Trace(m_iPartId); Step.eSeq = sc.Drop; } else if (isEnd) { Stat.bWorkEnd = true; return(true); } Stat.bWorkEnd = false; if (Step.eSeq != sc.Idle) { Trace(Step.eSeq.ToString() + " Start"); InitCycleStep(); m_CycleTime[(int)Step.eSeq].Start(); } } //Cycle. Step.eLastSeq = Step.eSeq; switch (Step.eSeq) { default: Trace("default End"); Step.eSeq = sc.Idle; return(false); case sc.Idle: return(false); case sc.Supply: if (!CycleSupply()) { return(false); } break; case sc.Pick: if (!CyclePick()) { return(false); } break; case sc.Work: if (!CycleWork()) { return(false); } break; case sc.Drop: if (!CycleDrop()) { return(false); } break; } Trace(sCycle + " End"); m_CycleTime[(int)Step.eSeq].End(); Step.eSeq = sc.Idle; return(false); }
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; }
private static void UpdateButton() { //Check Inspect. //if (!OM.CmnOptn.bIgnrDoor) InspectDoor(); if (m_iStep != EN_SEQ_STEP.Idle) { InspectHomeDone(); } if (m_iStep == EN_SEQ_STEP.Idle) { InspectLightGrid(); } //Local Var. bool isErr = ML.ER_IsErr(); bool isHomeEnd = ML.MT_GetHomeDoneAll(); //vision manual button. //CDelayTimer tmVisnCycle ; //if(IO_GetX(xETC_LStopSw)&& m_iSeqStat == ssStop ){ //if(tmVisnCycle.OnDelay(true , 1000)) { // tmVisnCycle.Clear(); // if(MM.GetManNo() == mcNoneCycle) { // MM.SetManCycle(mcVSN_CycleWork); // } //} //} //else { //tmVisnCycle.Clear(); //} bool bStartSw = ML.IO_GetXUp(xi.ETC_LStartSw) || ML.IO_GetXUp(xi.ETC_RStartSw) || m_bBtnStart; // || ML.IO_GetXUp(xi.ETC_StartSwR) || m_bBtnStart ; bool bStopSw = ML.IO_GetXUp(xi.ETC_LStopSw) || ML.IO_GetXUp(xi.ETC_RStopSw) || m_bBtnStop; // || ML.IO_GetXUp(xi.ETC_StopSwR ) || m_bBtnStop ; bool bResetSw = ML.IO_GetXUp(xi.ETC_LResetSw) || ML.IO_GetXUp(xi.ETC_RResetSw) || m_bBtnReset; // || ML.IO_GetXUp(xi.ETC_ResetSwR) || m_bBtnReset ; bool bAirSw = ML.IO_GetXUp(xi.ETC_LAirSw) || ML.IO_GetXUp(xi.ETC_RAirSw) || m_bBtnAir; bool bInitSw = ML.IO_GetXUp(xi.ETC_LInitSw) || ML.IO_GetXUp(xi.ETC_RInitSw); if (m_bBtnStart) { Log.Trace("m_bBtnStart", "true"); } if (bStartSw) { Log.Trace("bStartSw", "Started"); if (MM.GetManNo() != (int)mc.NoneCycle) { Log.Trace("ManCycle", string.Format(MM.GetManNo().ToString())); bStartSw = false; } } //Update Switch's Lamp bool bStopBtnFlick = (m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop) && m_bFlick; //버튼 클릭시나 ML.IO_SetY(yi.ETC_LStartLp, ML.IO_GetX(xi.ETC_LStartSw) || m_bRun); ML.IO_SetY(yi.ETC_LStopLp, ML.IO_GetX(xi.ETC_LStopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_LResetLp, ML.IO_GetX(xi.ETC_LResetSw) || (m_bFlick && isErr)); ML.IO_SetY(yi.ETC_LAirLp, ML.IO_GetX(xi.ETC_LAirSw) || ML.IO_GetY(yi.ETC_MainAir)); ML.IO_SetY(yi.ETC_LInitLp, ML.IO_GetX(xi.ETC_LInitSw)); ML.IO_SetY(yi.ETC_RStartLp, ML.IO_GetX(xi.ETC_RStartSw) || m_bRun); ML.IO_SetY(yi.ETC_RStopLp, ML.IO_GetX(xi.ETC_RStopSw) || !m_bRun || bStopBtnFlick); ML.IO_SetY(yi.ETC_RResetLp, ML.IO_GetX(xi.ETC_RResetSw) || (m_bFlick && isErr)); ML.IO_SetY(yi.ETC_RAirLp, ML.IO_GetX(xi.ETC_RAirSw) || ML.IO_GetY(yi.ETC_MainAir)); ML.IO_SetY(yi.ETC_RInitLp, ML.IO_GetX(xi.ETC_RInitSw)); ML.IO_SetY(yi.ETC_Manual1, ML.IO_GetX(xi.ETC_Manual1)); ML.IO_SetY(yi.ETC_Manual2, ML.IO_GetX(xi.ETC_Manual2)); ML.IO_SetY(yi.ETC_Manual3, ML.IO_GetX(xi.ETC_Manual3)); ML.IO_SetY(yi.ETC_Manual4, ML.IO_GetX(xi.ETC_Manual4)); ML.IO_SetY(yi.ETC_Manual5, ML.IO_GetX(xi.ETC_Manual5)); // ML.IO_SetY(yi.ETC_StartLpR , ML.IO_GetX(xi.ETC_StartSwR ) || m_bRun ); // ML.IO_SetY(yi.ETC_StopLpR , ML.IO_GetX(xi.ETC_StopSwR ) || !m_bRun || bStopBtnFlick ); // ML.IO_SetY(yi.ETC_ResetLpR , ML.IO_GetX(xi.ETC_ResetSwR ) || (m_bFlick && isErr) ); ////ML.IO_SetY(yi.ETC_AirLp , ML.IO_GetX(xi.ETC_AirSw ) || ML.IO_GetY(yi.ETC_MainAirSol )); // ML.IO_SetY(yi.ETC_InitLpR , ML.IO_GetX(xi.ETC_InitSwR ) ); //Center Man Button m_bBtnStart = false; m_bBtnStop = false; m_bBtnReset = false; m_bBtnAir = false; //Init. Button Flags. if (bStartSw) { //bool bAllArayNone = DM.ARAY[riLSP].CheckAllStat(csNone) && DM.ARAY[riLDR].CheckAllStat(csNone) && DM.ARAY[riLST].CheckAllStat(csNone) && // DM.ARAY[riPSB].CheckAllStat(csNone) && DM.ARAY[riULD].CheckAllStat(csNone) && DM.ARAY[riVSN].CheckAllStat(csNone) ; if (!isHomeEnd) { Log.ShowMessage("Error", "장비 홈을 잡아주세요."); bStartSw = false; } //if(!LOT.GetLotOpen ()) { Log.ShowMessage("Error" , "장비 랏오픈을 해주세요."); bStartSw = false ; } if (!InspectStripDispr()) { m_bInspDispr = true; bStartSw = false; } if (!InspectStripUnknown()) { m_bInspUnkwn = true; bStartSw = false; } if (m_iSeqStat == EN_SEQ_STAT.WorkEnd || m_iSeqStat == EN_SEQ_STAT.RunWarn) { Reset(); } } if (bInitSw) { MM.SetManCycle(mc.AllHome); } //Air Switch. if (bAirSw && !m_bRun && m_iSeqStat != EN_SEQ_STAT.Init) { ML.IO_SetY(yi.ETC_MainAir, !ML.IO_GetY(yi.ETC_MainAir)); } //Buzzer Off. if (isErr && bStopSw) { ML.TL_SetBuzzOff(true); } //Set Condition Flags. if (bStartSw) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isErr", isErr ? "true":"false"); Log.Trace("ManualMan.GetManNo()", string.Format(MM.GetManNo().ToString())); } if (bStopSw) { Log.Trace("Stop", "Stop"); } bool isStopCon = bStopSw || (isErr && !m_bReqStop && m_bRun); bool isRunCon = bStartSw && !isErr /*&& ManualMan.GetManNo() == mcNone*/; bool isResetCon = bResetSw && !m_bRun; //Run. if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) { m_iStep = EN_SEQ_STEP.ToStartCon; ML.TL_SetBuzzOff(false); ML.ER_SetDisp(true); } if (isRunCon && (m_iStep == EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isRunCon && m_iStep", string.Format(m_iStep.ToString())); } if (isStopCon && (m_iStep != EN_SEQ_STEP.Idle)) //스타트버튼 안눌리는것 때문에 테스트. { Log.Trace("isStopCon && m_iStep", string.Format(m_iStep.ToString())); Log.Trace("bStopSw", bStopSw ? "True" : "False"); Log.Trace("isErr", isErr ? "True" : "False"); Log.Trace("m_bReqStop", m_bReqStop ? "True" : "False"); Log.Trace("m_bRun", m_bRun ? "True" : "False"); m_bReqStop = true; } if (isResetCon && (m_iStep == EN_SEQ_STEP.Idle)) { Reset(); } if (m_tmToStrt.OnDelay(m_iStep == EN_SEQ_STEP.ToStartCon || m_iStep == EN_SEQ_STEP.ToStart, 30000)) { //Trace Log. string Msg; Msg = string.Format("ToStrtTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); ML.ER_SetErr(ei.ETC_ToStartTO); m_iStep = EN_SEQ_STEP.Idle; m_bRun = false; } //CDelayTimer StopBtn = null; //StopBtn = new CDelayTimer(); //if(m_iStep == EN_SEQ_STEP.scToStopCon) //{ // if(StopBtn.OnDelay(ML.IO_GetX((int)IP.xETC_StopSw)||ML.IO_GetX((int)IP.xETC_StopSw) , 5000)) // { // Log.Trace("SEQ","Forced Stop"); // m_bRun = false ; // m_iStep = EN_SEQ_STEP.scIdle; // m_bReqStop = false; // } //} //else //{ // StopBtn.Clear(); //} if (m_tmToStop.OnDelay(m_iStep == EN_SEQ_STEP.ToStopCon || m_iStep == EN_SEQ_STEP.ToStop, 30000)) // 20000)) { { //Trace Log. string Msg; Msg = string.Format("ToStopTimeOut : m_iStep=%d", m_iStep); Log.Trace("SEQ", Msg); m_bRun = false; ML.ER_SetErr(ei.ETC_ToStopTO); m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; } EN_SEQ_STEP iPreStep = m_iStep; if (iPreStep != m_iStep) { string sMsg = ""; sMsg = "Step Changed" + string.Format(iPreStep.ToString()) + " -> " + string.Format(m_iStep.ToString()); Log.Trace("SEQ", sMsg); } iPreStep = m_iStep; //이상하게 중간에 랏엔드가 되는 현상 발견해서 넣어둠. bool bPreLotEnd = LOT.GetLotEnd(); if (LOT.GetLotEnd() != bPreLotEnd) { Log.Trace("SEQ", LOT.GetLotEnd() ? "LotEnd True" : "LotEnd False"); } bPreLotEnd = LOT.GetLotEnd(); //Running Step. switch (m_iStep) { case EN_SEQ_STEP.Idle: return; case EN_SEQ_STEP.ToStartCon: if (!ToStartCon()) { return; } m_iStep = EN_SEQ_STEP.ToStart; Log.Trace("SEQ", "scToStartCon END"); return; case EN_SEQ_STEP.ToStart: if (!ToStart()) { return; } m_bRun = true; m_bRunEdge = true; m_iStep = EN_SEQ_STEP.Run; Log.Trace("SEQ", "scToStart END"); return; case EN_SEQ_STEP.Run: if (!m_bReqStop) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.ShowMessage("Checked", "Lot Ended."); Log.Trace("SEQ", LOT.GetLotNo() + "LotEnd"); m_bRunEnd = true; m_iStep = EN_SEQ_STEP.ToStopCon; } return; } m_bReqStop = false; m_iStep = EN_SEQ_STEP.ToStopCon; Log.Trace("SEQ", "scRun END"); return; case EN_SEQ_STEP.ToStopCon: if (!ToStopCon()) { if (Autorun()) { //랏엔드 상황. LOT.LotEnd(); Log.Trace("SEQ", "scToStopCon LotEnd"); } return; } m_bRun = false; m_iStep = EN_SEQ_STEP.ToStop; Log.Trace("SEQ", "scToStopCon END"); return; case EN_SEQ_STEP.ToStop: if (!ToStop()) { return; } m_iStep = EN_SEQ_STEP.Idle; m_bReqStop = false; DM.SaveMap(); Log.Trace("SEQ", "scToStop END"); return; } }
public void Update(EN_SEQ_STAT Stat) { //타임 인포 갱신. //DateTime tDateTime = DateTime.Now; // ////string sDateTime = DateTime.Now.ToString(); // //DateTime tPreTime = tDateTime; //DateTime tCrntTime = DateTime.Now; //DateTime tCycleTime = tCrntTime - tPreTime ; //시간 단위가 너무 커서 컴파일 에러 남 진섭 double dStartTime = DateTime.Now.ToOADate(); //double dPreTime = dStartTime; double dCrntTime = DateTime.Now.ToOADate(); double dTickTime = DateTime.Now.ToOADate(); double dCycleTime = dCrntTime - dPreTime; switch (Stat) { case EN_SEQ_STAT.Init: m_tData.dStopTime += dCycleTime; break; case EN_SEQ_STAT.Warning: m_tData.dStopTime += dCycleTime; break; case EN_SEQ_STAT.Error: m_tData.dErrTime += dCycleTime; break; case EN_SEQ_STAT.Running: m_tData.dWorkTime += dCycleTime; break; case EN_SEQ_STAT.Stop: m_tData.dStopTime += dCycleTime; break; case EN_SEQ_STAT.Maint: m_tData.dStopTime += dCycleTime; break; case EN_SEQ_STAT.RunWarn: m_tData.dWorkTime += dCycleTime; break; case EN_SEQ_STAT.WorkEnd: m_tData.dStopTime += dCycleTime; break; } m_tData.dTotalTime += dCycleTime; //m_tData.dTotalTime += dCycleTime; //m_tData.dTickTime = STG.GetTickTime() / 1000; dPreTime = dCrntTime; //잡파일 체인지 할때 어레이 동적 할당 다시 하기때문에 돌려줘야 한다. //이장비는 툴만 보기 때문에 상관 없지만 그냥 이렇게 내둔다. if (Stat == EN_SEQ_STAT.Stop) { return; } //if(Stat != ssRunning && Stat != ssRunWarn) return ; ///////////////////////매우 중요............. string sLotId; sLotId = LOT.GetLotNo(); //LDR까지 스캔해보고 있으면 미리 랏오픈을 한다. if (sLotId != m_tData.sLotId && sLotId != "") //어맛! 새로운 랏. { m_tData.Clear(); //memset(&m_tData , 0 , sizeof(TData)); 메모리 누수. m_tData.sLotId = LOT.GetLotNo(); m_tData.dSttTime = dCrntTime; } int iLotWorkCnt; if (SEQ._bRun) { iLotWorkCnt = DM.ARAY[(int)ri.IDX].GetCntStat(cs.Work); if (iPreLotWorkCnt != iLotWorkCnt && iLotWorkCnt != 0) { if (!SML.IO.GetX((int)xi.IDX_Detect1)) { m_tData.iWorkCnt += 1; } if (!SML.IO.GetX((int)xi.IDX_Detect2)) { m_tData.iWorkCnt += 1; } if (!SML.IO.GetX((int)xi.IDX_Detect3)) { m_tData.iWorkCnt += 1; } if (!SML.IO.GetX((int)xi.IDX_Detect4)) { m_tData.iWorkCnt += 1; } if (!SML.IO.GetX((int)xi.IDX_Detect5)) { m_tData.iWorkCnt += 1; } m_tData.dTickTime = dTickTime - dPreTickTime; dPreTickTime = dTickTime; //m_tData.iWorkCnt += 1; } iPreLotWorkCnt = iLotWorkCnt; } const int iSlotNo = 0; const int iMgzNo = 0; m_tData.dUPEH = m_tData.dTotalTime == 0 ? 0.0 : m_tData.iWorkCnt / (m_tData.dTotalTime * 24); m_tData.dUPH = m_tData.dWorkTime == 0 ? 0.0 : m_tData.iWorkCnt / (m_tData.dWorkTime * 24); m_tData.sJobFile = OM.GetCrntDev(); //Array 완성되면 마저 해야함 진섭 //bool bPreSTGExist = !DM.ARAY[riSTG].CheckAllStat(csNone); //bool bSTGExist = !DM.ARAY[riSTG].CheckAllStat(csNone); //if(!bPreSTGExist && bSTGExist) //{ // m_tmTick.Clear(); //} //if(bSTGExist){ // m_tData.dTickTime = m_tmTick.OnCheckCycle() / 1000; //} //bPreSTGExist = bSTGExist ; }
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; } }
private void tmUpdate_Tick(object sender, EventArgs e) { tmUpdate.Enabled = false; CrntTime = DateTime.Now; if (CrntTime.Date != PreTime.Date)//하루지났다 백업해라. { //옵션끄려면 공백. if (OM.CmnOptn.sBackupFolder != "") { string sExeFolder = System.AppDomain.CurrentDomain.BaseDirectory; string sUtilPath = sExeFolder + "Util"; string sJobFilePath = sExeFolder + "JobFile"; string sToday = DateTime.Now.ToString("yyyyMMdd_HHmmss"); CopyFolder(sUtilPath, OM.CmnOptn.sBackupFolder + "\\" + sToday + "\\Util"); CopyFolder(sJobFilePath, OM.CmnOptn.sBackupFolder + "\\" + sToday + "\\JobFile"); //기존에 있던것들 지우기. DirectoryInfo di = new DirectoryInfo(OM.CmnOptn.sBackupFolder); if (!di.Exists) { di.Create(); } foreach (FileInfo fi in di.GetFiles()) { //if (fi.Extension != ".log") continue; // 1개월 이전 네디터를 삭제합니다. if (fi.CreationTime <= DateTime.Now.AddDays(-1)) { fi.Delete(); } } } } PreTime = CrntTime; lbMainThreadTime.Text = string.Format("{0:0.000ms}", SEQ._dMainThreadCycleTime); lbDevice.Text = OM.GetCrntDev().ToString(); //lbDevice.ForeColor = Color.Yellow; label3.Text = "LotNo"; lbLotNo.Text = LOT.GetLotNo(); //lbLotNo.ForeColor = Color.White; btExit.Enabled = !SEQ._bRun; //Set Sequence State. string sStatText = ""; Color StatColor = Color.Black; //if(!OM.MstOptn.bDebugMode){ // switch(SEQ._iSeqStat) { // default : // break ; // case EN_SEQ_STAT.Init : sStatText = "INIT" ; StatColor = Color.Blue ; // break ; // case EN_SEQ_STAT.Error : sStatText = "ERROR" ; StatColor = SEQ._bFlick ? Color.Yellow : Color.Red ; // break ; // case EN_SEQ_STAT.Running : sStatText = "RUNNING" ; StatColor = Color.Lime ; // break ; // case EN_SEQ_STAT.Stop : sStatText = "STOP" ; StatColor = Color.Black ; // break ; // case EN_SEQ_STAT.WorkEnd : sStatText = "LOTEND" ; StatColor = Color.Gray ; // break ; // case EN_SEQ_STAT.RunWarn : sStatText = "Run End" ; StatColor = Color.Gray ; // break; // } //} //else { // switch(SEQ._iSeqStat) { // default : break; // case EN_SEQ_STAT.Init : sStatText = "DEBUG INIT" ; StatColor = Color.Blue ; break; // case EN_SEQ_STAT.Error : sStatText = "DEBUG ERROR" ; StatColor = SEQ._bFlick ? Color.Yellow : Color.Red ; break; // case EN_SEQ_STAT.Running : sStatText = "DEBUG RUNNING" ; StatColor = Color.Lime ; break; // case EN_SEQ_STAT.Stop : sStatText = "DEBUG STOP" ; StatColor = Color.Black ; break; // case EN_SEQ_STAT.WorkEnd : sStatText = "DEBUG LOTEND" ; StatColor = Color.Gray ; break; // } //} switch (SEQ._iSeqStat) { default: break; case EN_SEQ_STAT.Init: sStatText = "INIT"; StatColor = Color.Blue; break; case EN_SEQ_STAT.Warning: sStatText = "WARNING"; StatColor = Color.Yellow; break; case EN_SEQ_STAT.Error: sStatText = "ERROR"; StatColor = SEQ._bFlick ? Color.Yellow : Color.Red; break; case EN_SEQ_STAT.Running: sStatText = "RUNNING"; StatColor = Color.Lime; break; case EN_SEQ_STAT.Stop: sStatText = "STOP"; StatColor = Color.Black; break; case EN_SEQ_STAT.RunWarn: sStatText = "RUNWARN"; StatColor = SEQ._bFlick ? Color.Yellow : Color.Lime; break; case EN_SEQ_STAT.WorkEnd: sStatText = "LOTEND"; StatColor = Color.Gray; break; case EN_SEQ_STAT.Manual: sStatText = "MANUAL"; StatColor = Color.Blue; break; } //if (MM.GetManSetting()) sStatText = "MANUAL"; StatColor = Color.Lime; if (OM.MstOptn.bDebugMode) { sStatText = "DEBUG " + sStatText; } lbStat.Text = sStatText; lbStat.ForeColor = StatColor; pnUnderRepair.Visible = SEQ._bFlick && OM.EqpStat.bMaint; pnIdleRunning.Visible = SEQ._bFlick && OM.CmnOptn.bIdleRun; pnGoldenDevice.Visible = SEQ._bFlick && OM.CmnOptn.bGoldenTray; pnDBNotConnect.Visible = SEQ._bFlick && !SEQ.Oracle.GetDBOpen(); //접근 레벨 Operator에서 Option/Util 버튼 비활성화(패스워드 방식) //if (FormPassword.GetLevel() == EN_LEVEL.Operator) //{ // btSpc.Enabled = false; // btUtil.Enabled = false; // btOption.Enabled = false; //} // //else //{ // btSpc.Enabled = true; // btUtil.Enabled = true; // btOption.Enabled = true; //} //btSpc .Enabled = SML.FrmLogOn.GetLevel()>= EN_LEVEL.Engineer ; btUtil.Enabled = SML.FrmLogOn.GetLevel() >= EN_LEVEL.Master; btOption.Enabled = SML.FrmLogOn.GetLevel() >= EN_LEVEL.Engineer; btDevice.Enabled = SML.FrmLogOn.GetLevel() != EN_LEVEL.LogOff; tmUpdate.Enabled = true; }