Exemplo n.º 1
0
        //---------------------------------------------------------------------------
        public void fn_Update(EN_SEQ_STATE iSeqStat)
        {
            //if(SEQ._bRun) return;

            bool bLotOpen  = LOT._bLotOpen;
            bool bDoorOpen = SEQ.fn_IsAnyDoorOpen(true);

            //Set Start.
            m_dSeqSrtTime = TICK._GetTickTime();

            //Get During Seq Time.
            m_dDrngSeqTime = m_dSeqSrtTime - m_dSeqEndTime;


            EN_ERR_KIND iLastErrKind = (EN_ERR_KIND)EPU.fn_GetKind(EPU._nLastErr);


            //Clear. //86400000 == 24:00:00

            //Day Sequence 별 시간 증가.
            //dPMTime : PM Time / dDownTime : 비가동 / dRunTime : 가동


            switch (iSeqStat)
            {
            case EN_SEQ_STATE.RUNNING:
            case EN_SEQ_STATE.RUNWARN:

                DAILY_DATA.dRunTime   += m_dDrngSeqTime;
                DAILY_DATA.dTotalTime += m_dDrngSeqTime;
                break;

            case EN_SEQ_STATE.INIT:
            case EN_SEQ_STATE.WARNING:
            case EN_SEQ_STATE.STOP:
            case EN_SEQ_STATE.IDLE:
                if (bLotOpen)
                {
                    DAILY_DATA.dPMTime += m_dDrngSeqTime;
                }
                else
                {
                    if (bDoorOpen)
                    {
                        DAILY_DATA.dPMTime += m_dDrngSeqTime;
                    }
                    else
                    {
                        DAILY_DATA.dDownTime += m_dDrngSeqTime;
                    }
                }

                DAILY_DATA.dTotalTime += m_dDrngSeqTime;
                break;

            case EN_SEQ_STATE.ERROR:
                if (bLotOpen)
                {
                    DAILY_DATA.dPMTime += m_dDrngSeqTime;
                }
                else
                {
                    if (bDoorOpen)
                    {
                        DAILY_DATA.dPMTime += m_dDrngSeqTime;
                    }
                    else
                    {
                        DAILY_DATA.dDownTime += m_dDrngSeqTime;
                    }
                }

                DAILY_DATA.dErrorTime += m_dDrngSeqTime;
                DAILY_DATA.dTotalTime += m_dDrngSeqTime;
                break;

            default:
                if (bLotOpen)
                {
                    DAILY_DATA.dPMTime += m_dDrngSeqTime;
                }
                else
                {
                    if (bDoorOpen)
                    {
                        DAILY_DATA.dPMTime += m_dDrngSeqTime;
                    }
                    else
                    {
                        DAILY_DATA.dDownTime += m_dDrngSeqTime;
                    }
                }

                DAILY_DATA.dTotalTime += m_dDrngSeqTime;
                break;
            }

            //
            //DAILY_DATA.dTotalTime += m_dDrngSeqTime;


            //Set End Time.
            m_dSeqEndTime = TICK._GetTickTime();

            //Check Changing Time.
            if (!IsChangedDay())
            {
                return;
            }

            string sLog = string.Empty;

            //string sLog = string.Format($"Day Change : MTBI= {CalMTBI(DAILY_DATA.dRunTime, DAILY_DATA.iJamQty)})");
            //fn_WriteLog(sLog);

            sLog = string.Format($"TOTAL TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dTotalTime)} / RUN TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dRunTime)} / DOWN TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dDownTime)} / PM TIME : {TICK.ConvTimeTickToStr(SPC.DAILY_DATA.dPMTime)}");
            fn_WriteLog(sLog);

            //Kill Past Log
            LOG.fn_DeleteOldFile();

            SPC_EFF.ResetData();
            DAILY_DATA.ResetData();
        }