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); } } }
public VideoReplayForm(int gateTotal) { InitializeComponent(); ICustomsCMS server = XmlRpcInstance.getInstance(); playbackControler = new H264Controler(this.searchVideoPlayWnd, server); playbackControler.setToolStripStatusLabel(this.toolStripStatusLabel); bool isSuccess = playbackControler.init(); if (!isSuccess) { System.Environment.Exit(0); } this.dateTimePicker_startTime.Format = DateTimePickerFormat.Custom; this.dateTimePicker_startTime.Text = DateTime.Now.ToString(); this.dateTimePicker_startTime_time.Text = DateTime.Now.ToString(); this.dateTimePicker_endTime.Format = DateTimePickerFormat.Custom; this.dateTimePicker_endTime.Text = DateTime.Now.ToString(); this.dateTimePicker_endTime_time.Text = DateTime.Now.ToString(); //以下初始化通道 object[] items = new object[gateTotal]; for (int i = 0; i < gateTotal; i++) { items[i] = (i + 1).ToString(); } this.comboBox__channel.Items.AddRange(items); this.comboBox__channel.SelectedIndex = 0; }
/// <summary> /// 更新闸机的通行模式 /// </summary> /// <param name="mode">通行模式</param> /// <param name="gateNos">闸机编号</param> /// <returns></returns> public Boolean updateGateMode(int mode, int[] gateNos) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysTask task = new SysTask(); task.type = (int)TaskType.ChangeMode; task.mode = mode; task.target_gates = gateNos; task.created_by = SystemManageService.currentUser.UserName; try { RPCResponse response = server.publishTask(AppConfig.gateSensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("更改闸机运行模式错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <ShenboContent> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TitleNumResponse titleNumResponse = server.findReportContenCount(strWhere[ShenboContent.CONTENT_COLOMUN].ToString()); if (titleNumResponse.error_code != 0) { throw new Exception("连接服务器错误:" + titleNumResponse.error_msg); } TotalNum = titleNumResponse.titlenum; ReportContent_Response response = server.findReportContentList(strWhere[ShenboContent.CONTENT_COLOMUN].ToString(), startIndex, endIndex); ReportContent[] titlelist = response.reportcontentlist; List <ShenboContent> wrs = new List <ShenboContent>(); for (int i = 0; i < titlelist.Length; i++) { wrs.Add(new ShenboContent(titlelist[i].id, titlelist[i].logicid, titlelist[i].content, titlelist[i].content_en)); } reportContentArray = response.reportcontentlist; return(wrs); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 温度和核素阈值误差更新 /// </summary> /// <param name="temperature_error"></param> /// <param name="nuclear"></param> /// <param name="gates"></param> /// <returns></returns> public Boolean updateGateThresholdError(double temperature_error, double nuclear_error, int[] gates) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysTask task = new SysTask(); task.type = (int)TaskType.gateThresholdErrorUpdate; task.target_gates = gates; task.tiny_temperature = temperature_error; task.tiny_nuclear = nuclear_error; try { RPCResponse response = server.publishTask(AppConfig.gateSensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("修改闸机阀值误差错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 验证用户名和密码 /// </summary> /// <param name="username">用户名</param> /// <param name="password">密码</param> /// <returns>验证是否正确</returns> public Boolean validateUserNameAndPassword(string username, string password) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); Usercheck usercheck = new Usercheck(); usercheck.username = username; usercheck.password = password; UsercheckRPCResponse usercheckRPCResponse = server.checkUser(usercheck); if (usercheckRPCResponse.username != "") { currentUser.UserName = usercheckRPCResponse.username; currentUser.Rolename = usercheckRPCResponse.rolename; return(true); } else { return(false); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <LogRecord> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); NumResponse num = server.getLogCount((DateTime)strWhere[LogColumn.para_begin_column], (DateTime)strWhere[LogColumn.para_end_column], strWhere[LogColumn.operatePeople_column].ToString(), "", "");; TotalNum = num.all_num; LogListRPCResponse logListRPCResponse = server.getLog((DateTime)strWhere[LogColumn.para_begin_column], (DateTime)strWhere[LogColumn.para_end_column], strWhere[LogColumn.operatePeople_column].ToString(), "", "", startIndex, endIndex); LogRecord[] list = logListRPCResponse.loglists; List <LogRecord> logs = new List <LogRecord>(); for (int i = 0; i < list.Length; i++) { logs.Add(list[i]); } return(logs); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean publishTask(string mesage, int[] gates) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysTask task = new SysTask(); task.type = (int)TaskType.PublishNotice; task.notice = mesage.Trim(); task.target_gates = gates; try { RPCResponse response = server.publishTask(AppConfig.gateSensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("发布消息错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
private void receiveGateState(object obj) { while (true && (!this.IsDisposed)) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); List <int> gateIds = new List <int>(); for (int i = 1; i <= 100; i++) { gateIds.Add(i); } Gate_state_record_Response reportContent_Response = server.getGateAllInfo(AppConfig.gateSensor, gateIds.ToArray()); if (reportContent_Response.error_code == 0 && !this.IsDisposed) { this.Invoke(new Action <Gate_state_record_Response>(this.refreshGateMonitors), reportContent_Response); } } catch (Exception ex) { MessageBox.Show("获取闸机状态出错:" + ex.Message, "错误"); } finally { System.Threading.Thread.Sleep(AppConfig.getGateSecond); } } }
public List <SystemManage> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); NumResponse numResponse = server.findAllUserCount(strWhere[SystemManage.USERNAME_COLUMN].ToString()); if (numResponse.error_code != 0) { throw new Exception("连接服务器错误:" + numResponse.error_msg); } TotalNum = numResponse.all_num; UsercheckListRPCResponse response = server.findAllUserByUserid(strWhere[SystemManage.USERNAME_COLUMN].ToString(), startIndex, endIndex); Usercheck[] titlelist = response.listmodule; List <SystemManage> wrs = new List <SystemManage>(); for (int i = 0; i < titlelist.Length; i++) { string rolename = getRoleName(Int32.Parse(titlelist[i].rolename)); wrs.Add(new SystemManage(titlelist[i].id, titlelist[i].username, titlelist[i].password, Int32.Parse(titlelist[i].rolename), rolename, titlelist[i].realname, titlelist[i].idcard)); } return(wrs); } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); return(null); } }
public Boolean updateHxswqhThreshold(double biology, double chem) { SysTask task = new SysTask(); task.type = (int)TaskType.bio_port; task.target_gates = new int[] { AppConfig.hxswqhnum }; task.bio_port = biology; try { ICustomsCMS server = XmlRpcInstance.getInstance(); RPCResponse response = server.publishTask(AppConfig.hxswqhsensor, task); task.type = (int)TaskType.chem_port; task.chem_port = chem; response = server.publishTask(AppConfig.hxswqhsensor, task); if (response.error_code == 0) { return(true); } else { throw new Exception("修改口岸阀值错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误" + ex.Message); } }
/// <summary> /// 更新闸机的状态 /// </summary> /// <param name="state">状态</param> /// <param name="gateNos">闸机编号</param> /// <returns></returns> public Boolean updateGateState(int state, int[] gateNos) { ICustomsCMS server = XmlRpcInstance.getInstance(); SysOrder sysOrder = new SysOrder(); sysOrder.type = state; sysOrder.target_gates = gateNos; sysOrder.created_by = SystemManageService.currentUser.UserName; try { OrderRPCResponse response = server.publishSensorOrder(AppConfig.gateSensor, sysOrder); if (response.error_code == 0) { return(true); } else { throw new Exception("更改闸机状态错误:" + response.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 根据id和用户名查询符合条件的记录 /// </summary> /// <param name="id">id</param> /// <param name="name">用户名</param> /// <returns></returns> public Boolean findRowByIdAndName(int id, string userName) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); UsercheckRPCResponse usercheckRPCResponse = server.findUser(userName); if (usercheckRPCResponse.id != 0 && usercheckRPCResponse.id != id) { return(true); } return(false); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } try { ICustomsCMS server = XmlRpcInstance.getInstance(); UsercheckListRPCResponse response = server.findAllUserByUserid(userName, 1, 1); Usercheck[] titlelist = response.listmodule; } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <GateRecord> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { //实现分页查询的方法, 使用strWhere,startIndex,endIndex, 同时需要返回Pager //记录总数量 ICustomsCMS server = XmlRpcInstance.getInstance(); try { NumResponse numResponse = server.searchPassengerCount(strWhere[ClearanceRecord.NAME_COLUMN].ToString(), DictionaryToXmlRpcStruct.dictionaryToXmlRpcStruct(strWhere));; strWhere.Add("start", startIndex); strWhere.Add("limit", endIndex); GateRecordsResponse res = server.searchPassenger(strWhere[ClearanceRecord.NAME_COLUMN].ToString(), DictionaryToXmlRpcStruct.dictionaryToXmlRpcStruct(strWhere)); TotalNum = numResponse.all_num; List <GateRecord> gateRecords = new List <GateRecord>(res.records); for (int i = 0; i < gateRecords.Count; i++) { gateRecords[i].unnormal_type_name = zhuhai.util.AbnormalType.getAllAbnormalTypeNames()[gateRecords[i].unnormal_type + 1]; gateRecords[i].gate_mode_name = zhuhai.util.GateWorkState.getAllGateWorkStateNames()[gateRecords[i].gate_mode]; } return(gateRecords); } catch (Exception ex) { Console.WriteLine("ClearanceRecordService - InitDt" + ex.Message); } return(null); }
public Boolean addRow(CommonText commonText) { ////以下删掉 ////实例化一个文件流--->与写入文件相关联 //FileStream fo = new FileStream("D:/tmp/tmp.rtf", FileMode.Create); ////实例化BinaryWriter //BinaryWriter bw = new BinaryWriter(fo); //bw.Write(commonText.Bytes); ////清空缓冲区 //bw.Flush(); ////关闭流 //bw.Close(); //fo.Close(); try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = new ImageTextInfo(); imageTextInfo.title = commonText.Title; imageTextInfo.content = commonText.Bytes; imageTextInfo.authod = SystemManageService.currentUser.UserName; DBRPCResponse dBRPCResponse = server.putWorkRule(imageTextInfo); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public List <EpidemicInfo> InitDt(IDictionary <string, object> strWhere, int startIndex, int endIndex) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TitleNumResponse titleNumResponse = server.findEpideInfoCount(strWhere[CommonText.TITLE_COLOMUN].ToString(), DateTime.Parse("0001-01-01"), DateTime.Parse("9999-12-30")); if (titleNumResponse.error_code != 0) { throw new Exception("连接服务器错误:" + titleNumResponse.error_msg); } TotalNum = titleNumResponse.titlenum; Title_Response title_Response = server.findEpideInfoTitleList(strWhere[CommonText.TITLE_COLOMUN].ToString(), DateTime.Parse("0001-01-01"), DateTime.Parse("9999-12-30"), startIndex, endIndex); TitleInfo[] titlelist = title_Response.titlelist; List <EpidemicInfo> es = new List <EpidemicInfo>(); for (int i = 0; i < titlelist.Length; i++) { es.Add(new EpidemicInfo(titlelist[i].id, titlelist[i].title, titlelist[i].authod)); } return(es); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public static ICustomsCMS getInstance() { if (server == null) { server = XmlRpcProxyGen.Create <ICustomsCMS>(); XmlRpcClientProtocol protocol; protocol = (XmlRpcClientProtocol)server; protocol.Url = "http://" + AppConfig.cmsServer + "/apixmlrpc"; } return(server); }
public CommonText getRow(int id, string title) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = server.findEpideInfobytitle(title); CommonText commonText = new CommonText(imageTextInfo.id, imageTextInfo.title); commonText.Bytes = imageTextInfo.content; return(commonText); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean setTitle(string titleName) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); RPCResponse rPCResponse = server.setTitle("100", titleName); if (rPCResponse.error_code != 0) { throw new Exception("连接服务器错误:" + rPCResponse.error_msg); } return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public string getTitle() { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TitleNameRPCResponse r = server.getTitle("100"); if (r.error_code != 0) { throw new Exception("连接服务器错误:" + r.error_msg); } return(r.value); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public int getGateTotal() { try { ICustomsCMS server = XmlRpcInstance.getInstance(); GatesNumResponse gatesNumResponse = server.getGatesNumber(AppConfig.gateSensor); if (gatesNumResponse.error_code != 0) { throw new Exception("连接服务器错误:" + gatesNumResponse.error_msg); } return(gatesNumResponse.all_num); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean deleteRow(int id) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); DBRPCResponse dBRPCResponse = server.deleteReportContent(id); if (dBRPCResponse.error_code != 0) { throw new Exception("连接服务器错误:" + dBRPCResponse.error_msg); } return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean addRow(CommonText commonText) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = new ImageTextInfo(); imageTextInfo.title = commonText.Title; imageTextInfo.content = commonText.Bytes; imageTextInfo.authod = SystemManageService.currentUser.UserName; DBRPCResponse dBRPCResponse = server.putEpideInfo(imageTextInfo); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
public Boolean addRow(string content, string content_en, int logicid) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ReportContent reportContent = new ReportContent(); reportContent.content = content; reportContent.logicid = logicid; reportContent.content_en = content_en; reportContent.operatePeople = SystemManageService.currentUser.UserName; DBRPCResponse dBRPCResponse = server.addReportContent(reportContent); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 根据id和标题查询符合条件的记录 /// </summary> /// <param name="id">id</param> /// <param name="title">标题</param> /// <returns></returns> public Boolean findRowByIdAndTitle(int id, string title) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); ImageTextInfo imageTextInfo = server.findEpideInfobytitle(title); //查询出结果,同时id不和本身相同 if (imageTextInfo.id != 0 && imageTextInfo.id != id) { return(true); } return(false); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
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(); } } }
public Boolean addRow(SystemManage systemManage) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); Usercheck usercheck = new Usercheck(); usercheck.idcard = systemManage.IdCard; usercheck.password = systemManage.Password; usercheck.realname = systemManage.Name; usercheck.username = systemManage.UserName; usercheck.rolename = systemManage.Type.ToString(); DBRPCResponse dBRPCResponse = server.AddUser(usercheck); return(true); } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 根据Id获取照片 /// </summary> /// <param name="photo_id">照片id</param> /// <returns></returns> public byte[] getPassengerPhoto(int photo_id) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); IDPhotoResponse photoResponse = server.getPassengerPhoto(AppConfig.gateSensor, photo_id); if (photoResponse.error_code == 0) { return(photoResponse.content); } else { throw new Exception("错误:" + photoResponse.error_msg); } } catch (Exception ex) { throw new Exception("错误:" + ex.Message); } }
/// <summary> /// 获取闸机的阈值 /// </summary> /// <param name="gateNo">闸机号</param> /// <returns></returns> public GateThresholdValue getGateThreshold(int gateNo) { try { ICustomsCMS server = XmlRpcInstance.getInstance(); TaskRPCResponse taskRPCResponse = server.getCurrentThreshold(gateNo); if (taskRPCResponse.error_code == 0) { return(new GateThresholdValue(taskRPCResponse.task.thr_temperature, taskRPCResponse.task.thr_nuclear)); } else { Console.WriteLine("连接服务器错误:" + taskRPCResponse.error_msg); return(null); } } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); return(null); } }
/// <summary> /// 记录日志 /// </summary> /// <param name="operateContent">操作内容</param> /// <param name="operateModule">操作模块</param> public void log(string operateContent, string operateModule) { string operatePeople = SystemManageService.currentUser.UserName; try { ICustomsCMS server = XmlRpcInstance.getInstance(); Log log = new Log(); log.operateContent = operateContent; log.operateModule = operateModule; log.operatePeople = operatePeople; RPCResponse rPCResponse = server.log(log); if (rPCResponse.error_code != 0) { Console.WriteLine("连接服务器错误:" + rPCResponse.error_msg); } } catch (Exception ex) { Console.WriteLine("错误:" + ex.Message); } }
public H264Controler(ICustomsCMS server) { this.server = server; }
public H264Controler(PictureBox pb, ICustomsCMS server) { this.pictureBox = pb; this.server = server; }