public static bool InspectMotor() { //Local Var. bool isOk = true; for (mi i = 0; i < mi.MAX_MOTR; i++) { if (SM.MT_GetAlarmSgnl(i)) { SM.ER_SetErr(ei.MTR_Alarm, SM.MT_GetName(i)); isOk = false; } if (SM.MT_GetHomeDone(i)) { if (SM.MT_GetNLimSnsr(i)) { SML.ER.SetErrMsg((int)ei.MTR_NegLim, SM.MT_GetName(i)); isOk = false; } if (SM.MT_GetPLimSnsr(i)) { SML.ER.SetErrMsg((int)ei.MTR_PosLim, SM.MT_GetName(i)); isOk = false; } } } //Ok. return(isOk); }
public static bool InspectEmergency() { bool isOk = true; //Check Emergency if (SM.IO_GetX(xi.ETC_FtEmgSw) || SM.IO_GetX(xi.ETC_LtEmgSw) || SM.IO_GetX(xi.ETC_RrEmgSw) || SM.IO_GetX(xi.ETC_RtEmgSw)) { SM.MT_EmgStopAll(); SM.MT_SetServoAll(false); if (SM.IO_GetX(xi.ETC_FtEmgSw)) { SM.ER_SetErr(ei.ETC_Emergency, "전면 Emergency Switch 가 눌렸습니다."); } if (SM.IO_GetX(xi.ETC_LtEmgSw)) { SM.ER_SetErr(ei.ETC_Emergency, "좌측 Emergency Switch 가 눌렸습니다."); } if (SM.IO_GetX(xi.ETC_RrEmgSw)) { SM.ER_SetErr(ei.ETC_Emergency, "뒷면 Emergency Switch 가 눌렸습니다."); } if (SM.IO_GetX(xi.ETC_RtEmgSw)) { SM.ER_SetErr(ei.ETC_Emergency, "우측 Emergency Switch 가 눌렸습니다."); } isOk = false; } return(isOk); }
public bool SendIndex(int _iIndx) { SaveCommand(_iIndx); if (!SM.IO_GetX(xi.VISN_Ready)) { SM.ER_SetErr(ei.VSN_ComErr, "Vision not ready"); return(false); } VisnCycle[(int)vs.Command].iStep = 10; return(true); }
private void button2_Click(object sender, EventArgs e) { //SPC.LOT.Data.Device = RandomStr().toString(); //SPC.ERR.Data.LotNo = GetRandomStr(8); Random ran = new Random(); SM.ER_SetErr((ei)(ran.Next(0, (int)ei.MAX_ERR - 1)), "sunsunsunsun"); //SPC.LOT.SaveDataIni(); }
public static bool InspectEmergency() { bool isOk = true; //Check Emergency if (SM.IO_GetX(xi.ETC_EmgSw)) { SM.MT_EmgStopAll(); SM.ER_SetErr(ei.ETC_Emergency, "Emergency Switch가 눌렸습니다."); //SM.MT.SetServoAll(false); isOk = false; } return(isOk); }
public static bool InspectFlowMeter() { bool isOk = true; if (SM.IO_GetY(yi.BARZ_Blower)) { m_tmTemp.Clear(); } if (!SM.IO_GetY(yi.BARZ_Blower) && !SM.IO_GetX(xi.ETC_FlowMeter) && m_tmTemp.OnDelay(500)) { SM.ER_SetErr(ei.ETC_FlowMeter, "Flow Meter Sensor Checked"); isOk = false; } return(isOk); }
public static bool InspectHomeDone() { //Local Var. bool isOk = true; //Inspect. for (mi i = 0; i < mi.MAX_MOTR; i++) { if (!SM.MT_GetHomeDone(i)) { SM.ER_SetErr(ei.MTR_HomeEnd, SM.MT_GetName(i)); isOk = false; } } //Ok. return(isOk); }
public static bool InspectActuator() { //Local Var. bool isOk = true; bool isErr = false; //Inspect. for (ci i = 0; i < ci.MAX_ACTR; i++) { isErr = SM.CL_Err(i); if (isErr) { SM.ER_SetErr(ei.ATR_TimeOut, SM.CL_GetName(i)); isOk = false; } } //Ok. return(isOk); }
bool CycleLotStart(ref TCycle _tCycle) { //Check Cycle Time Out. string sTemp; if (_tCycle.tmCycle.OnDelay(_tCycle.iStep == _tCycle.iPreStep && !OM.MstOptn.bDebugMode, 8000)) { SM.ER_SetNeedShowErr(false); sTemp = string.Format("VisionTimeOut Step={0:00}", _tCycle.iStep); SM.ER_SetErr(ei.VSN_ComErr, sTemp); SM.IO_SetY(yi.VISN_Change, false); _tCycle.iStep = 0; return(true); } if (_tCycle.iStep != _tCycle.iPreStep) { sTemp = string.Format("Step={0:00}", _tCycle.iStep); Log.Trace("Vision Communction", sTemp); } _tCycle.iPreStep = _tCycle.iStep; //Cycle. switch (_tCycle.iStep) { default: sTemp = string.Format("DEFAILT END STATUS Step={0:00} , PreStep={0:00}", _tCycle.iStep, _tCycle.iPreStep); SM.ER_SetErr(ei.VSN_ComErr, sTemp); Log.Trace("Vision Communction", sTemp); SM.IO_SetY(yi.VISN_Change, false); _tCycle.iStep = 0; return(true); case 10: SM.IO_SetY(yi.VISN_LotStart, false); _tCycle.iStep++; return(false); case 11: if (SM.IO_GetX(xi.VISN_Busy)) { return(false); } SM.IO_SetY(yi.VISN_LotStart, true); _tCycle.iStep++; return(false); case 12: if (!SM.IO_GetX(xi.VISN_Busy)) { return(false); } SM.IO_SetY(yi.VISN_LotStart, false); _tCycle.iStep++; return(false); case 13: if (SM.IO_GetX(xi.VISN_Busy)) { return(false); } _tCycle.iStep = 0; return(true); } }
//One Cycle. //여기부터. bool CycleInsp(ref TCycle _tCycle) { //Check Cycle Time Out. string sTemp; if (_tCycle.tmCycle.OnDelay(_tCycle.iStep == _tCycle.iPreStep && !OM.MstOptn.bDebugMode, 8000)) { SM.ER_SetNeedShowErr(false); sTemp = string.Format("VisionTimeOut Step={0:00}", _tCycle.iStep); SM.ER_SetErr(ei.VSN_ComErr, sTemp); _tCycle.iStep = 0; return(true); } if (_tCycle.iStep != _tCycle.iPreStep) { sTemp = string.Format("Step={0:00}", _tCycle.iStep); Log.Trace("Vision Communction", sTemp); } _tCycle.iPreStep = _tCycle.iStep; //Cycle. switch (_tCycle.iStep) { default: sTemp = string.Format("DEFAILT END STATUS Step={0:00} , PreStep={0:00}", _tCycle.iStep, _tCycle.iPreStep); SM.ER_SetErr(ei.VSN_ComErr, sTemp); Log.Trace("Vision Communction", sTemp); _tCycle.iStep = 0; return(true); case 10: if (SM.IO_GetX(xi.VISN_Busy)) { return(false); } //SML.MT.OneShotTrg((int)mi.TOOL_YTool,true,1000); //SM.IO_SetY(Para.yVisn_ManInsp, true); SM.IO_SetY(yi.VISN_ManInsp, true); Log.Trace("Vision Shot", "ON"); _tCycle.tmDelay.Clear(); _tCycle.iStep++; return(false); case 11: //if(_tCycle.tmDelay.OnDelay(true, 10))return false; if (!SM.IO_GetX(xi.VISN_Busy)) { return(false); } //SM.IO_SetY(Para.yVisn_ManInsp, false); SM.IO_SetY(yi.VISN_ManInsp, false); Log.Trace("Vision Shot", "OFF"); _tCycle.tmDelay.Clear(); _tCycle.iStep++; return(false); case 12: //if(_tCycle.tmDelay.OnDelay(1000))return false; //SM.IO_SetY(Para.yVisn_ManInsp, false); _tCycle.tmDelay.Clear(); _tCycle.iStep++; return(false); case 13: //if(_tCycle.tmDelay.OnDelay(1000))return false; //if(SM.IO_GetY(Para.yVisn_ManInsp)) //{ //SM.IO_SetY(yi.VISN_ManInsp, false); Log.Trace("Vision Shot", "OFF2"); //return false; //} if (SM.IO_GetX(xi.VISN_Busy)) { return(false); } Log.Trace("Vision Shot", "END"); _tCycle.iStep = 0; return(true); } }
//bool bNeedToBarcode = false ; public bool CycleBarcode() { String sTemp; if (m_tmCycle.OnDelay(Step.iCycle != 0 && Step.iCycle == PreStep.iCycle && CheckStop() && !OM.MstOptn.bDebugMode, 30000)) { sTemp = string.Format("Cycle Step.iCycle={0:00}", Step.iCycle); sTemp = m_sPartName + "-" + GetCrntCycleName() + sTemp; ER_SetErr(ei.PRT_CycleTO, sTemp); Log.Trace(m_sPartName, sTemp); return(true); } if (Step.iCycle != PreStep.iCycle) { sTemp = string.Format("Cycle Step.iCycle={0:00}", Step.iCycle); sTemp = m_sPartName + "-" + GetCrntCycleName() + sTemp; Log.Trace(m_sPartName, sTemp); } if (IO_GetX(xi.IDXR_Overload)) { MT_Stop(mi.IDXR_XRear); ER_SetErr(ei.PRT_OverLoad, "Rear Index is Overload Error"); return(true); } PreStep.iCycle = Step.iCycle; if (Stat.bReqStop) { //return true ; } LOT.TLot Lot; switch (Step.iCycle) { default: sTemp = string.Format("Cycle Default Clear Step.iCycle={0:00}", Step.iCycle); //if(Step.iCycle != PreStep.iCycle)Trace(m_sPartName.c_str(), sTemp.c_str()); return(true); case 10: //sometime when barcode works failed.! if (!OM.CmnOptn.bIdleRun && IO_GetX(xi.RAIL_TrayDtct2) && !MT_CmprPos(mi.IDXR_XRear, PM_GetValue(mi.IDXR_XRear, pv.IDXR_XRearBarcode))) { //ER_SetErr(ei.PRT_Detect , IO_GetXName(xi.RAIL_TrayDtct2) +" is Something Detected!"); //return true ; } OM.EqpStat.sTraySttTime = DateTime.Now.ToString("HH:mm:ss"); OM.EqpStat.dTrayWorkTime = SEQ.bTrayWorkTimer ? SEQ.m_cyTrayWorktime.CheckTime_s() : 0; OM.EqpStat.dTrayUPH = SEQ.bTrayWorkTimer ? 3600 / (OM.EqpStat.dTrayWorkTime / (DM.ARAY[ri.IDXF].GetMaxCol() * DM.ARAY[ri.IDXF].GetMaxRow() - DM.ARAY[ri.IDXF].GetCntStat(cs.None))) : 0; SEQ.m_cyTrayWorktime.Clear(); SEQ.bTrayWorkTimer = true; if (OM.CmnOptn.bIdleRun) { Step.iCycle = 100; return(false); } //이조건이면 바코드 안찍는다. if (!OM.CmnOptn.bIdleRun) //아이들 런이면 첫장부터 작업 한다. { if (OM.GetSupplyCnt() == 1 || (OM.DevOptn.bUseBtmCover && OM.GetSupplyCnt() == OM.DevInfo.iTRAY_StackingCnt) || OM.CmnOptn.bGoldenTray) { Step.iCycle = 50; return(false); } } Step.iCycle++; return(false); case 11: if (!IO_GetX(xi.IDXR_TrayDtct) && !OM.CmnOptn.bIdleRun) { ER_SetErr(ei.PKG_Dispr, "Rear Index tray detect sensor Not detected."); return(true); } //Don need to barcode scan SEQ.BarcordLODR.SendScanOn(); MoveMotr(mi.IDXR_XRear, pv.IDXR_XRearBarcode); Step.iCycle++; return(false); case 12: if (!MT_GetStopPos(mi.IDXR_XRear, pv.IDXR_XRearBarcode)) { return(false); } if (!OM.CmnOptn.bIdleRun && !IO_GetX(xi.RAIL_TrayDtct2)) //sensor zone is over when col 0 { ER_SetErr(ei.PRT_Missed, IO_GetXName(xi.RAIL_TrayDtct2) + " is Not Detected!"); return(true); } MoveCyl(ci.IDXR_ClampClOp, fb.Bwd); //레일 초기 진입시에 크리퍼랑 레일이랑 찐따지는것 방지용. 한번 풀었다 잡는다. Step.iCycle++; return(false); case 13: if (!CL_Complete(ci.IDXR_ClampClOp, fb.Bwd)) { return(false); } m_tmDelay.Clear(); Step.iCycle++; return(false); case 14: if (m_tmDelay.OnDelay(3000)) //바코드 못읽었을때 상황. { if (SEQ.BarcordLODR.GetText() == "") { ER_SetErr(ei.PRT_Barcode, "Barcode Reading Failed"); return(true); } } if (SEQ.BarcordLODR.GetText() == "") { return(false); } //temp //SEQ.LODR.iLDRSplyCnt++; if (SPC.LOT.Data.TrayNo == "") { SPC.LOT.Data.TrayNo = SEQ.BarcordLODR.GetText(); } OM.EqpStat.sTrayLabel = SEQ.BarcordLODR.GetText(); if (!OM.CmnOptn.bOracleNotUse) { if (!SEQ.Oracle.ProcessTrayLabel(OM.EqpStat.sTrayLabel)) { SM.ER_SetErr(ei.ETC_Oracle, SEQ.Oracle.GetLastMsg()); Log.Trace("Oracle Fail Message", SEQ.Oracle.GetLastMsg()); return(true); } //쓰레드로 돌린다 PanelID가 많을때 10만개 정도... SEQ.Oracle.ThreadMakePanelIDList(); } Step.iCycle++; return(false); case 15: if (!OM.CmnOptn.bOracleNotUse) { //쓰레드로 돌린다 PanelID가 많을때 10만개 정도... if (COracle.bMakingPanelList) { return(false); } if (!COracle.bMakePanelListRet) { ER_SetErr(ei.ETC_Oracle, SEQ.Oracle.GetLastMsg()); return(true); } } MoveCyl(ci.IDXR_ClampClOp, fb.Fwd); Step.iCycle++; return(false); case 16: if (!CL_Complete(ci.IDXR_ClampClOp, fb.Fwd)) { return(false); } MoveMotr(mi.IDXR_XRear, pv.IDXR_XRearVsnStt1); Step.iCycle++; return(false); case 17: if (!MT_GetStopPos(mi.IDXR_XRear, pv.IDXR_XRearVsnStt1)) { return(false); } DM.ARAY[ri.IDXR].ChangeStat(cs.Unknown, cs.Vision); Step.iCycle = 0; return(true); //골든디바이스 및 빈트레이일때 위에서 씀. case 50: MoveMotr(mi.IDXR_XRear, pv.IDXR_XRearVsnStt1); Step.iCycle++; return(false); case 51: if (!MT_GetStopPos(mi.IDXR_XRear, pv.IDXR_XRearVsnStt1)) { return(false); } MoveCyl(ci.IDXR_ClampClOp, fb.Bwd); //레일 초기 진입시에 크리퍼랑 레일이랑 찐따지는것 방지용. 한번 풀었다 잡는다. Step.iCycle++; return(false); case 52: if (!CL_Complete(ci.IDXR_ClampClOp, fb.Bwd)) { return(false); } MoveCyl(ci.IDXR_ClampClOp, fb.Fwd); Step.iCycle++; return(false); case 53: if (!CL_Complete(ci.IDXR_ClampClOp, fb.Fwd)) { return(false); } //골드트레이가 아니고서. if (!OM.CmnOptn.bGoldenTray) { DM.ARAY[ri.IDXR].ChangeStat(cs.Unknown, cs.Empty); if (OM.CmnOptn.iInspCrvrTray == (int)vi.One) { DM.ARAY[ri.IDXR].SetStat(OM.DevInfo.iTRAY_PcktCntX - 1, 0, cs.Vision); } else if (OM.CmnOptn.iInspCrvrTray == (int)vi.Col) { for (int i = 0; i < OM.DevInfo.iTRAY_PcktCntY; i++) { DM.ARAY[ri.IDXR].SetStat(OM.DevInfo.iTRAY_PcktCntX - 1, i, cs.Vision); } } else if (OM.CmnOptn.iInspCrvrTray == (int)vi.All) { DM.ARAY[ri.IDXR].SetStat(cs.Vision); } else { DM.ARAY[ri.IDXR].SetStat(cs.Vision); } } else { DM.ARAY[ri.IDXR].ChangeStat(cs.Unknown, cs.Vision); } Step.iCycle = 0; return(true); //아이들 러닝용 위애서 씀. case 100: MoveMotr(mi.IDXR_XRear, pv.IDXR_XRearBarcode); Step.iCycle++; return(false); case 101: if (!MT_GetStopPos(mi.IDXR_XRear, pv.IDXR_XRearBarcode)) { return(false); } MoveMotr(mi.IDXR_XRear, pv.IDXR_XRearVsnStt1); Step.iCycle++; return(false); case 102: if (!MT_GetStopPos(mi.IDXR_XRear, pv.IDXR_XRearVsnStt1)) { return(false); } DM.ARAY[ri.IDXR].ChangeStat(cs.Unknown, cs.Vision); Step.iCycle = 0; return(true); } }
public static bool InspectDoor() { //JS //Local Var. isOk = true; bNeedToLock = m_bRun || m_iSeqStat == EN_SEQ_STAT.Init || m_iSeqStat == EN_SEQ_STAT.Manual; if (SM.IO_GetX(xi.ETC_MstrSw) && bNeedToLock) { if (!SM.IO_GetX(xi.ETC_FtDoor)) { SM.ER_SetErr(ei.ETC_Door, "Front Door Open"); isOk = false; } if (!SM.IO_GetX(xi.ETC_FtDoorSd)) { SM.ER_SetErr(ei.ETC_Door, "Front Side Door Open"); isOk = false; } if (!SM.IO_GetX(xi.ETC_LtDoorsd)) { SM.ER_SetErr(ei.ETC_Door, "Left Side Door Open"); isOk = false; } if (!SM.IO_GetX(xi.ETC_RrDoorLt)) { SM.ER_SetErr(ei.ETC_Door, "Rear Left Door Open"); isOk = false; } if (!SM.IO_GetX(xi.ETC_RrDoorRt)) { SM.ER_SetErr(ei.ETC_Door, "Rear Right Door Open"); isOk = false; } if (!SM.IO_GetX(xi.ETC_RtDoorSd)) { SM.ER_SetErr(ei.ETC_Door, "Right Side Door Open"); isOk = false; } if (isOk) { SM.IO_SetY(yi.ETC_DoorLockLtFt, true); SM.IO_SetY(yi.ETC_DoorLockLtLt, true); SM.IO_SetY(yi.ETC_DoorLockLtRr, true); SM.IO_SetY(yi.ETC_DoorLockLtRt, true); SM.IO_SetY(yi.ETC_DoorLockRtFt, true); SM.IO_SetY(yi.ETC_DoorLockRtLt, true); SM.IO_SetY(yi.ETC_DoorLockRtRr, true); SM.IO_SetY(yi.ETC_DoorLockRtRt, true); } } else { SM.IO_SetY(yi.ETC_DoorLockLtFt, false); SM.IO_SetY(yi.ETC_DoorLockLtLt, false); SM.IO_SetY(yi.ETC_DoorLockLtRr, false); SM.IO_SetY(yi.ETC_DoorLockLtRt, false); SM.IO_SetY(yi.ETC_DoorLockRtFt, false); SM.IO_SetY(yi.ETC_DoorLockRtLt, false); SM.IO_SetY(yi.ETC_DoorLockRtRr, false); SM.IO_SetY(yi.ETC_DoorLockRtRt, false); } ////if(!OM.CmnOptn.bIgnrDoor && m_iStep == EN_SEQ_STEP.Run){ //if(m_bRun || m_iSeqStat == EN_SEQ_STAT.Init || m_iSeqStat == EN_SEQ_STAT.Manual){ //키가 ON // if (SM.IO_GetX(xi.ETC_MstrSw)){ // if (!SM.IO_GetX(xi.ETC_FtDoor )){SM.ER_SetErr(ei.ETC_Door, "Front Door Open" );isOk= false;} // if (!SM.IO_GetX(xi.ETC_FtDoorSd)){SM.ER_SetErr(ei.ETC_Door, "Front Side Door Open");isOk= false;} // if (!SM.IO_GetX(xi.ETC_LtDoorsd)){SM.ER_SetErr(ei.ETC_Door, "Left Side Door Open" );isOk= false;} // if (!SM.IO_GetX(xi.ETC_RrDoorLt)){SM.ER_SetErr(ei.ETC_Door, "Rear Left Door Open" );isOk= false;} // if (!SM.IO_GetX(xi.ETC_RrDoorRt)){SM.ER_SetErr(ei.ETC_Door, "Rear Right Door Open");isOk= false;} // if (!SM.IO_GetX(xi.ETC_RtDoorSd)){SM.ER_SetErr(ei.ETC_Door, "Right Side Door Open");isOk= false;} // if (isOk) { // SM.IO_SetY(yi.ETC_DoorLockLtFt, true); // SM.IO_SetY(yi.ETC_DoorLockLtLt, true); // SM.IO_SetY(yi.ETC_DoorLockLtRr, true); // SM.IO_SetY(yi.ETC_DoorLockLtRt, true); // SM.IO_SetY(yi.ETC_DoorLockRtFt, true); // SM.IO_SetY(yi.ETC_DoorLockRtLt, true); // SM.IO_SetY(yi.ETC_DoorLockRtRr, true); // SM.IO_SetY(yi.ETC_DoorLockRtRt, true); // } // } //} //else //{ // SM.IO_SetY(yi.ETC_DoorLockLtFt, false); // SM.IO_SetY(yi.ETC_DoorLockLtLt, false); // SM.IO_SetY(yi.ETC_DoorLockLtRr, false); // SM.IO_SetY(yi.ETC_DoorLockLtRt, false); // SM.IO_SetY(yi.ETC_DoorLockRtFt, false); // SM.IO_SetY(yi.ETC_DoorLockRtLt, false); // SM.IO_SetY(yi.ETC_DoorLockRtRr, false); // SM.IO_SetY(yi.ETC_DoorLockRtRt, false); //} //Ok. return(isOk); }
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 btDownload_Click(object sender, EventArgs e) //HRM-930B 참고 { if (tbFromName.Text == "") { return; } //Check Running Status // bool bAllArayNone = DM.ARAY[(int)ri.SLD].CheckAllStat(cs.None); if (LOT.GetLotOpen()) { //Log.ShowMessage("Error", "자재나 메거진이 남아 있으면 잡파일을 바꿀수 없습니다."); Log.ShowMessage("Error", "Cannot change the working files."); return; } //if(OM.DevInfo.sMrkData != "")SEQ.Com[0].SendMsg(OM.DevInfo.sMrkData); if (lvDevice.SelectedIndices.Count <= 0) { return; } int iDeviceSel = lvDevice.SelectedIndices[0]; string sName = lvDevice.Items[iDeviceSel].SubItems[1].Text; string sTemp = "DOWNLOAD JOB FILE. (" + lbSelDevice.Text + ")"; if (OM.GetCrntDev() == sName) { //Log.ShowMessage( "ERROR", "현재 잡파일과 같은 잡파일 입니다."); Log.ShowMessage("ERROR", "This is the current file with the same file."); return; } if (Log.ShowMessageModal("Confirm", "Are you Sure?") != DialogResult.Yes) { return; } //FrmMain.FrmDeviceSet. OM.LoadJobFile(sName); pbStatus.Minimum = 0; SEQ.Visn.SendJobChange(sName); pbStatus.Minimum = 30; PM.Load(sName); pbStatus.Value = 70; CConfig Config = new CConfig(); string sExeFolder = System.AppDomain.CurrentDomain.BaseDirectory; string sDevOptnPath = sExeFolder + "JobFile\\" + sName + "\\TrayMask.ini"; Config.Load(sDevOptnPath, CConfig.EN_CONFIG_FILE_TYPE.ftIni); DM.ARAY[ri.MASK].Load(Config, true); pbStatus.Value = 100; CDelayTimer TimeOut = new CDelayTimer(); TimeOut.Clear(); while (!SEQ.Visn.GetSendCycleEnd(VisnCom.vs.JobChange)) { Thread.Sleep(1); if (TimeOut.OnDelay(5000)) { SM.ER_SetErr(ei.VSN_ComErr, "JobFile Change TimeOut"); break; } } lbSelDevice.Text = ""; tbFromName.Text = ""; lbCrntDevice.Text = sName; PM.UpdatePstn(true); //OM.TrayMask.SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); //OM.TrayMask.SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); //OM.SaveTrayMask(); DM.ARAY[ri.SPLR].SetMaxColRow(1, 1); DM.ARAY[ri.IDXR].SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); DM.ARAY[ri.IDXF].SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); DM.ARAY[ri.PCKR].SetMaxColRow(1, 1); DM.ARAY[ri.TRYF].SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); DM.ARAY[ri.TRYG].SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); DM.ARAY[ri.OUTZ].SetMaxColRow(1, 1); DM.ARAY[ri.STCK].SetMaxColRow(1, OM.DevInfo.iTRAY_StackingCnt); DM.ARAY[ri.BARZ].SetMaxColRow(1, 1); DM.ARAY[ri.INSP].SetMaxColRow(1, OM.DevInfo.iTRAY_PcktCntY); DM.ARAY[ri.PSTC].SetMaxColRow(1, 1); DM.ARAY[ri.MASK].SetMaxColRow(OM.DevInfo.iTRAY_PcktCntX, OM.DevInfo.iTRAY_PcktCntY); // DM.ARAY[ri.BPCK].SetMaxColRow(1 , 1 ); DM.ARAY[ri.TRYF].SetStat(cs.Empty); DM.ARAY[ri.TRYG].SetStat(cs.Good); DM.ARAY[ri.STCK].SetStat(cs.Empty); DM.ARAY[ri.INSP].SetStat(cs.Good); DM.ARAY[ri.IDXR].SetMask(DM.ARAY[ri.MASK]); DM.ARAY[ri.IDXF].SetMask(DM.ARAY[ri.MASK]); DM.ARAY[ri.TRYF].SetMask(DM.ARAY[ri.MASK]); DM.ARAY[ri.TRYG].SetMask(DM.ARAY[ri.MASK]); //SEQ.VisnRB.SendJobChange(sName); //CDelayTimer TimeOut = new CDelayTimer(); //TimeOut.Clear(); //while(!SEQ.VisnRB.GetSendCycleEnd(VisnCom.vs.JobChange )){ // Thread.Sleep(1); // if(TimeOut.OnDelay(5000)) { // SM.ER_SetErr(ei.VSN_ComErr,"잡체인지 비전 통신 타임아웃"); // break; // } //} }