/// <summary>
        /// 定時處理停機記錄的邏輯
        /// </summary>
        void m_tmrProjMacHalt_Elapsed(object sender, ElapsedEventArgs e)
        {
            if (m_blnIsRunningHalt)
            {
                return;
            }
            m_blnIsRunningHalt = true;

            if (m_CurrentHaltLogicStatus != EnmHaltLogicStatus.Running)
            {
                m_CurrentHaltLogicStatus = EnmHaltLogicStatus.Running;
            }

            int iHaltTaskMaxCount = base.ProjectMachineHaltLogicTime * 60;//時間間隔值(秒)

            if (m_iTmrCounter_Task < iHaltTaskMaxCount)//需要達到停機記錄時間間隔時,方可進行下一步操作
            {
                m_iTmrCounter_Task++;
            }
            else//到達停機記錄創建時間間隔
            {
                if (base.CurrentMachineHaltRecord == null)
                {
                    if (base.MachineHaltRecords == null)
                    {
                        base.MachineHaltRecords = new List<ProjectMachineHaltRecord>();
                    }

                    ProjectMachineHaltRecord recHalt = CreateNewHaltRec(true);
                    if (recHalt != null)
                    {
                        base.CurrentMachineHaltRecord = recHalt;

                        base.MachineHaltRecords.Add(recHalt);//將新的停機記錄添加到當前品檢記錄列表

                        base.OnProductionChanged(recHalt);//通知中心更新

                        this.m_statusProj = CustEnum.ProjectStatus.PROD_STOP;//當前狀態轉為生產停機狀態
                        base.OnMachineHaltStatusChanged(this.m_statusProj);

                        base.OnRecordEdit(recHalt);//通知界面編輯

                        m_tmrProjMacHalt.Stop();
                        m_iTmrCounter_Task = 0;

                        StartTimer_CheckOT();
                    }
                    else
                    {
                        base.OnException(mc_ControllerName, "m_tmrProjMacHalt_Elapsed", "無法創建新的停機記錄。" + DateTime.Now.ToString());
                    }

                }
                else
                {
                    m_tmrProjMacHalt.Stop();
                    m_iTmrCounter_Task = 0;
                }

                m_iTmrCounter_Task = 0;//將時間置零,準備下次操作
            }

            m_blnIsRunningHalt = false;
        }
 /// <summary>
 /// 初始化參數
 /// </summary>
 void InitParams()
 {
     m_dtHaltBegin = null;
     m_statusProj = CustEnum.ProjectStatus.PROD_STOP;
     m_iTmrCounter_Task = 0;
     m_CurrentHaltLogicStatus = EnmHaltLogicStatus.None;
     m_dtPause = null;
     m_blnIsRunningHalt = false;
     m_blnIsCheckingHaltOverTime = false;
 }
        /// <summary>
        /// 工程停機邏輯開始
        /// </summary>
        public override void MachineHaltLogicStart()
        {
            EnmHaltLogicStatus status = m_CurrentHaltLogicStatus;

            if (status != EnmHaltLogicStatus.Running)
            {
                ProjectMachineHaltRecord machineHaltRecord = this.GetCurrentMachineHaltRecord();

                if (machineHaltRecord != null)
                {
                    this.RegainHistoryMachineHaltRecord(machineHaltRecord);

                    return;
                }

                m_dtHaltBegin = DateTime.Now;
                m_CurrentHaltLogicStatus = EnmHaltLogicStatus.Running;
                if (status == EnmHaltLogicStatus.Pausing)//若之前的狀態為用餐暫停,則記錄用餐時長
                {
                    if (m_dtPause != null)
                    {
                        int iPauseTimeSpan = (DateTime.Now - m_dtPause.Value).Seconds;
                        base.DinnerTime += iPauseTimeSpan;
                        if (base.CurrentMachineHaltRecord != null)
                        {
                            base.CurrentMachineHaltRecord.psrd_iDinnerTime = iPauseTimeSpan;
                        }
                        m_dtPause = null;
                    }
                }

                StartTimer_Halt();
            }
        }
        /// <summary>
        /// 工程停機邏輯結束
        /// </summary>
        public override void MachineHaltLogicStop()
        {
            if (m_CurrentHaltLogicStatus != EnmHaltLogicStatus.Stopped)
            {
                m_dtHaltBegin = null;
                m_CurrentHaltLogicStatus = EnmHaltLogicStatus.Stopped;
                m_iTmrCounter_Task = 0;//計數器清零

                StopTimer_CheckOT();
                StopTimer_Halt();

                if (base.CurrentMachineHaltRecord != null)
                {
                    base.CurrentMachineHaltRecord.psrd_dEndTime = DateTime.Now;

                    if (this.CurrentMachineShiftData != null && this.CurrentMachineShiftData.sifo_dEndTime != null)
                    {
                        if (DateTime.Now > this.CurrentMachineShiftData.sifo_dEndTime.Value)
                        {
                            base.CurrentMachineHaltRecord.psrd_dEndTime = this.CurrentMachineShiftData.sifo_dEndTime;
                        }
                    }

                    base.OnProductionChanged(base.CurrentMachineHaltRecord);
                    base.OnProductionDataUpdate();
                    base.CurrentMachineHaltRecord = null;
                }
            }
        }
 /// <summary>
 /// 用餐暫停
 /// </summary>
 public override void DinnerPause()
 {
     if (m_CurrentHaltLogicStatus != EnmHaltLogicStatus.Pausing)//當前狀態不是暫停中時,進行暫停處理邏輯
     {
         m_CurrentHaltLogicStatus = EnmHaltLogicStatus.Pausing;
         m_dtPause = DateTime.Now;//記錄暫停的當前時間
         StopTimer_Halt();//停止停機邏輯處理計時器,計數器不清零
         m_iTmrCounter_Task = 0;//計數器清零 //2015-04-15 避免因停機暫停前已在停機狀態,已在計數,使未夠停機時間間隔時就產生出一條停機記錄
         StopTimer_CheckOT();//停止停機是否超時檢查
     }
 }