private void receiveMessage(object obj) { while (true) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); GateRecordResponse gateRecordResponse = server.getAbnormalRecord(AppConfig.gateSensor); if (gateRecordResponse.error_code == 0 && !this.IsDisposed) { gateRecordResponse.gate_record.nvr_begintime = gateRecordResponse.gate_record.nvr_begintime; gateRecordResponse.gate_record.nvr_endtime = gateRecordResponse.gate_record.nvr_endtime; this.Invoke(new Action <GateRecordResponse>(this.addAbnormalList), gateRecordResponse); } } catch (Exception ex) { MessageBox.Show("获取异常人员出错:" + ex.Message, "错误"); } finally { System.Threading.Thread.Sleep(AppConfig.getMessageSecond); } } }
private List <GateRecord> abnormalList = new List <GateRecord>();//检测异常人员集 public void addAbnormalList(GateRecordResponse gateRecordResponse) { int gate_id = gateRecordResponse.gate_record.gate_id; gateRecordResponse.gate_record.unnormal_type_name = zhuhai.util.AbnormalType.getAllAbnormalTypeNames()[gateRecordResponse.gate_record.unnormal_type + 1]; gateRecordResponse.gate_record.gate_mode_name = zhuhai.util.GateWorkState.getAllGateWorkStateNames()[gateRecordResponse.gate_record.gate_mode]; abnormalList.Insert(0, gateRecordResponse.gate_record); //超过显示的数量则删除最后一条记录 if (abnormalList.Count > AppConfig.personNo) { abnormalList.RemoveAt(abnormalList.Count - 1); } gridControl_abnormal.DataSource = abnormalList; gridControl_abnormal.RefreshDataSource(); if (!this.IsDisposed) { System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.channelBlinkThread), gate_id); ICustomsCMS server = XmlRpcInstance.getInstance(); if (gateRecordResponse.gate_record.unnormal_type == (int)zhuhai.xmlrpc.AbnormalType.Temperatare && MessageBox.Show("检查到温度异常记录,是否切换到温度异常预案中?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { RichTextEditorForm richTextEditorForm = new RichTextEditorForm(0, "温度异常", DisposePlanService.getInstance(), true); richTextEditorForm.ShowDialog(); } else if (gateRecordResponse.gate_record.unnormal_type == (int)zhuhai.xmlrpc.AbnormalType.Nuclear && MessageBox.Show("检查到核素异常记录,是否切换到核素异常预案中?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { RichTextEditorForm richTextEditorForm = new RichTextEditorForm(0, "核素异常", DisposePlanService.getInstance(), true); richTextEditorForm.ShowDialog(); } else if (gateRecordResponse.gate_record.unnormal_type == (int)zhuhai.xmlrpc.AbnormalType.TemperatareNuclear && MessageBox.Show("检查到温度核素异常记录,是否切换到温度核素异常预案中?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { RichTextEditorForm richTextEditorForm = new RichTextEditorForm(0, "温度核素异常", DisposePlanService.getInstance(), true); richTextEditorForm.ShowDialog(); } else if (gateRecordResponse.gate_record.unnormal_type == (int)zhuhai.xmlrpc.AbnormalType.Shenbao && MessageBox.Show("检查到申报异常记录,是否切换到申报异常预案中?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { RichTextEditorForm richTextEditorForm = new RichTextEditorForm(0, "申报异常", DisposePlanService.getInstance(), true); richTextEditorForm.ShowDialog(); } } }