public void Update(string _sCrntLotNo, EN_SEQ_STAT Stat, string _sCrntDev, bool _bMaint) { long lCrntTime = DateTime.Now.Ticks; long lGapTime = lCrntTime - lPreTime; double dTimeGap = lGapTime / 10000.0f; if (_bMaint) //업타임 계산에서 씀 { Data.FailureTime += dTimeGap; } else if (Stat == EN_SEQ_STAT.Error && SM.ER_GetErrLevel((ei)SM.ER_GetLastErr()) == EN_ERR_LEVEL.Error) { Data.DownTime += dTimeGap; } else if (Stat == EN_SEQ_STAT.Running || Stat == EN_SEQ_STAT.RunWarn) { Data.RunTime += dTimeGap; } else //Stop Init Warnning WorkEnd { Data.IdleTime += dTimeGap; } bool LotChanged = (sPreLot != _sCrntLotNo); //&& sPreLot != "" ; bool LotEnded = LotChanged && _sCrntLotNo == ""; bool LotOpened = LotChanged && sPreLot == ""; if (LotOpened) { //새로운랏 처리. DataClear(); Data.LotNo = _sCrntLotNo; Data.Device = _sCrntDev; Data.StartedAt = DateTime.Now.ToOADate(); } else if (LotEnded) { Data.EndedAt = DateTime.Now.ToOADate(); SaveDataIni(Data.StartedAt); //이위로는 기존랏 처리. } else if (LotChanged) { Data.EndedAt = DateTime.Now.ToOADate(); SaveDataIni(Data.StartedAt); //이위로는 기존랏 처리. //새로운랏 처리. DataClear(); Data.LotNo = _sCrntLotNo; Data.Device = _sCrntDev; Data.StartedAt = DateTime.Now.ToOADate(); } lPreTime = lCrntTime; //sPreLot = ""; sPreLot = _sCrntLotNo; }
public void Update(string _sCrntLotNo, EN_SEQ_STAT Stat) { //Err Log bool isErr = Stat == EN_SEQ_STAT.Error && SM.ER_GetErrLevel((ei)SM.ER_GetLastErr()) == EN_ERR_LEVEL.Error; // SML.ER.IsErr(); if (isErr && !bPreErr) { Data.ErrNo = SM.ER_GetLastErr(); Data.ErrName = SM.ER_GetErrName((ei)SM.ER_GetLastErr()); Data.StartedAt = DateTime.Now.ToOADate(); Data.ErrMsg = SML.ER.GetErrSubMsg(SM.ER_GetLastErr()); Data.LotId = _sCrntLotNo; } if (!isErr && bPreErr) { Data.EndedAt = DateTime.Now.ToOADate(); TimeSpan Span; Span = TimeSpan.FromDays(Data.EndedAt - Data.StartedAt); Data.ErrTime = Span.TotalMilliseconds; SaveDataIni(Data.StartedAt); } bPreErr = isErr; }
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; }