示例#1
0
        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;
        }
示例#2
0
        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;
        }