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); } }
/// <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); } }
/// <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); } }
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); } }