private void timer_Tick(object sender, EventArgs e) { try { FNSYSTEMEntity systemInfo = new RetrieveCriteria(typeof(FNSYSTEMEntity)).AsEntity() as FNSYSTEMEntity; int status = 1; if (systemInfo.WORK_FILE_FLG.TrimEnd() != "0" || systemInfo.TRX00_FLG.TrimEnd() != "0" || systemInfo.TRY00_FLG.TrimEnd() != "0" || systemInfo.TRZ00_FLG.TrimEnd() != "0" || systemInfo.RETRIEVAL_CANCEL_FLG.TrimEnd() != "0") { status = 4; } else if (systemInfo.BATCH_FLAG == "2") { status = 3; } else if (systemInfo.BATCH_FLAG == "1") { status = 2; } if (status == lastStatus) { return; } else { lastStatus = status; } switch (status) { case 1: lblStatus.Text = " 正常 "; this.lblFixedHead.ForeColor = Color.White; this.lblStatus.ForeColor = Color.White; this.BackColor = Color.Blue; break; case 2: lblStatus.Text = "日次处理中"; this.lblFixedHead.ForeColor = Color.Black; this.lblStatus.ForeColor = Color.Black; this.BackColor = Color.Yellow; break; case 3: lblStatus.Text = " 盘点中 "; this.lblFixedHead.ForeColor = Color.Black; this.lblStatus.ForeColor = Color.Black; this.BackColor = Color.Yellow; break; case 4: lblStatus.Text = " 异常 "; this.lblFixedHead.ForeColor = Color.White; this.lblStatus.ForeColor = Color.White; this.BackColor = Color.Red; break; } tsmiShow.PerformClick(); } catch (Exception ex) { AppLogger.logErrorMessage(ex.Message); } }