123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- /**
- * Created by han on 2017/1/20.
- */
- //报警点
- function AlarmPoints(tagName,alarmAreaId,delayTime,deadBand,alarmFilterSetting){
- this.TagName=tagName;
- this.AlarmAreaId=alarmAreaId;
- this.DelayTime=delayTime;
- this.DeadBand=deadBand;
- this.AlarmFilterSetting=alarmFilterSetting;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //报警等级,类别等信息
- function AlarmFilterSetting(alarmCategoryId,alarmLevelId,alarmGroupId,alarmException,limitValue){
- this.AlarmCategoryId=alarmCategoryId;
- this.AlarmLevelId=alarmLevelId;
- this.AlarmGroupId=alarmGroupId;
- this.AlarmException=alarmException;
- this.LimitValue=limitValue;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //对象转换为Json格式数据
- var objJson=function(obj){
- return JSON.stringify(obj);
- }
- function ResultData(TagName,ErrorCode,Message){
- this.TagName=TagName;
- this.ErrorCode=ErrorCode;
- this.Message=Message;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //报警等级
- function AlarmLevels(Id,Name,WavFile,WavNoticeCount,AlarmColor,ResetColor,EnsureColor,IsSpangled,LevelValue,FinallyColor){
- this.Id=Id;
- this.Name=Name;
- this.WavFile=WavFile;
- this.WavNoticeCount=WavNoticeCount;
- this.AlarmColor=AlarmColor;
- this.ResetColor=ResetColor;
- this.EnsureColor=EnsureColor;
- this.IsSpangled=IsSpangled;
- this.LevelValue=LevelValue;
- this.FinallyColor=FinallyColor;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //报警类别
- function AlarmCategories(Id,Name,Desc,LevelValue){
- this.Id=Id;
- this.Name=Name;
- this.Desc=Desc;
- this.LevelValue=LevelValue;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //报警组
- function AlarmGroup(Id,Name,Desc){
- this.Id=Id;
- this.Name=Name;
- this.Desc=Desc;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //报警区域
- function AlarmArea(Name,ParentAreaId){
- this.Name=Name;
- this.ParentAreaId=ParentAreaId;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //报警规则
- function AlarmRules(TagName,DeadBand,DelayTime,AlarmFilterSettings){
- this.TagName=TagName;
- this.DeadBand=DeadBand;
- this.DelayTime=DelayTime;
- this.AlarmFilterSettings=AlarmFilterSettings;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //查询条件
- function SearchCondition(pageIndex,pageSize,condition,orderby,ascending){
- this.pageIndex=pageIndex; //当前页
- this.pageSize=pageSize; //页大小
- this.condition=condition; //过滤条件
- this.orderby=orderby; //排序方式
- this.ascending=ascending; //升序降序
- this.getJson=function(){
- return objJson(this);
- }
- }
- //过滤条件
- function FieldCondition(field,value,method){
- this.field=field;
- this.value=value;
- this.method=method;
- this.getJson=function(){
- return objJson(this);
- }
- }
- //错误码定义
- var ErrorCode = {
- Ok: 1, //成功
- ArgumentIllegal: 2, //参数不合格
- OpreateFailed: 3, //操作失败
- UnkownException: 4 //未知异常
- }
- var TagOptCode={
- Sucess : 0, //成功
- TagUnExsit:1, //不存在该点
- TagTypeIllage:2, //标签点类型非法
- AlarmTagUnExsit:3, //不存在该报警点
- AlarmTagHasExsit:4, //该报警点已经存在
- AlarmTagLoadFailed:5, //该报警点在数据库中存在,启动服务时加载失败
- AlarmSnapshotUnExsit:6, //实时报警不存在(未产生,已确认复归,或者未删除)
- Other:7 //其它异常
- }
- var DataType={
- BOOL : 0,
- //
- // 摘要:
- // 无符号8位整数,占用1字节
- UINT8 :1,
- //
- // 摘要:
- // 有符号8位整数,占用1字节
- INT8 : 2,
- //
- // 摘要:
- // 无符号16位整数,占用2字节
- UINT16 : 4,
- //
- // 摘要:
- // 有符号16位整数,占用2字节
- INT16 : 5,
- //
- // 摘要:
- // 无符号32位整数,占用4字节
- UINT32 : 6,
- //
- // 摘要:
- // 有符号32位整数,占用4字节
- INT32 : 7,
- //
- // 摘要:
- // 有符号64位整数,占用8字节
- INT64 : 8,
- //
- // 摘要:
- // 16位浮点数,占用2字节
- REAL16 : 9,
- //
- // 摘要:
- // 32位单精度浮点数,占用4字节
- REAL32 : 10,
- //
- // 摘要:
- // 64位双精度浮点数,占用8字节
- REAL64 : 11
- }
|