예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            timer1.Stop();
            timer1.Interval = 2000;

            try
            {
                switch (this.CurrentFlowFlag)
                {
                case eFlowFlag.等待执行:

                    if (!IsResultSample)
                    {
                        CurrentCmdResultCode = beltSamplerDAO.GetSampleCmdResult(CurrentSampleCMD.Id);
                        if (CurrentCmdResultCode == eEquInfCmdResultCode.成功)
                        {
                            this.rTxtOutputer.Output("采样命令执行成功", eOutputType.Success);
                            this.CurrentFlowFlag = eFlowFlag.执行完毕;
                        }
                        else if (CurrentCmdResultCode == eEquInfCmdResultCode.失败)
                        {
                            this.rTxtOutputer.Output("采样命令执行失败", eOutputType.Warn);
                            List <InfEquInfHitch> list_Hitch = commonDAO.GetEquInfHitch(DateTime.Now.AddMinutes(-1), DateTime.Now.AddMinutes(1), this.CurrentSampleMachine.EquipmentCode);
                            foreach (InfEquInfHitch item in list_Hitch)
                            {
                                this.rTxtOutputer.Output("采样机:" + item.HitchDescribe, eOutputType.Error);
                            }
                        }
                        IsResultSample = CurrentCmdResultCode != eEquInfCmdResultCode.默认;
                    }

                    break;

                case eFlowFlag.执行完毕:
                    ResetBuyFuel();
                    break;
                }
            }
            catch (Exception ex)
            {
                Log4Neter.Error("timer1_Tick", ex);
            }
            finally
            {
                timer1.Start();
            }

            timer1.Start();
        }