ConstructorClass.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /**
  2. * Created by han on 2017/1/20.
  3. */
  4. //报警点
  5. function AlarmPoints(tagName,alarmAreaId,delayTime,deadBand,alarmFilterSetting){
  6. this.TagName=tagName;
  7. this.AlarmAreaId=alarmAreaId;
  8. this.DelayTime=delayTime;
  9. this.DeadBand=deadBand;
  10. this.AlarmFilterSetting=alarmFilterSetting;
  11. this.getJson=function(){
  12. return objJson(this);
  13. }
  14. }
  15. //报警等级,类别等信息
  16. function AlarmFilterSetting(alarmCategoryId,alarmLevelId,alarmGroupId,alarmException,limitValue){
  17. this.AlarmCategoryId=alarmCategoryId;
  18. this.AlarmLevelId=alarmLevelId;
  19. this.AlarmGroupId=alarmGroupId;
  20. this.AlarmException=alarmException;
  21. this.LimitValue=limitValue;
  22. this.getJson=function(){
  23. return objJson(this);
  24. }
  25. }
  26. //对象转换为Json格式数据
  27. var objJson=function(obj){
  28. return JSON.stringify(obj);
  29. }
  30. function ResultData(TagName,ErrorCode,Message){
  31. this.TagName=TagName;
  32. this.ErrorCode=ErrorCode;
  33. this.Message=Message;
  34. this.getJson=function(){
  35. return objJson(this);
  36. }
  37. }
  38. //报警等级
  39. function AlarmLevels(Id,Name,WavFile,WavNoticeCount,AlarmColor,ResetColor,EnsureColor,IsSpangled,LevelValue,FinallyColor){
  40. this.Id=Id;
  41. this.Name=Name;
  42. this.WavFile=WavFile;
  43. this.WavNoticeCount=WavNoticeCount;
  44. this.AlarmColor=AlarmColor;
  45. this.ResetColor=ResetColor;
  46. this.EnsureColor=EnsureColor;
  47. this.IsSpangled=IsSpangled;
  48. this.LevelValue=LevelValue;
  49. this.FinallyColor=FinallyColor;
  50. this.getJson=function(){
  51. return objJson(this);
  52. }
  53. }
  54. //报警类别
  55. function AlarmCategories(Id,Name,Desc,LevelValue){
  56. this.Id=Id;
  57. this.Name=Name;
  58. this.Desc=Desc;
  59. this.LevelValue=LevelValue;
  60. this.getJson=function(){
  61. return objJson(this);
  62. }
  63. }
  64. //报警组
  65. function AlarmGroup(Id,Name,Desc){
  66. this.Id=Id;
  67. this.Name=Name;
  68. this.Desc=Desc;
  69. this.getJson=function(){
  70. return objJson(this);
  71. }
  72. }
  73. //报警区域
  74. function AlarmArea(Name,ParentAreaId){
  75. this.Name=Name;
  76. this.ParentAreaId=ParentAreaId;
  77. this.getJson=function(){
  78. return objJson(this);
  79. }
  80. }
  81. //报警规则
  82. function AlarmRules(TagName,DeadBand,DelayTime,AlarmFilterSettings){
  83. this.TagName=TagName;
  84. this.DeadBand=DeadBand;
  85. this.DelayTime=DelayTime;
  86. this.AlarmFilterSettings=AlarmFilterSettings;
  87. this.getJson=function(){
  88. return objJson(this);
  89. }
  90. }
  91. //查询条件
  92. function SearchCondition(pageIndex,pageSize,condition,orderby,ascending){
  93. this.pageIndex=pageIndex; //当前页
  94. this.pageSize=pageSize; //页大小
  95. this.condition=condition; //过滤条件
  96. this.orderby=orderby; //排序方式
  97. this.ascending=ascending; //升序降序
  98. this.getJson=function(){
  99. return objJson(this);
  100. }
  101. }
  102. //过滤条件
  103. function FieldCondition(field,value,method){
  104. this.field=field;
  105. this.value=value;
  106. this.method=method;
  107. this.getJson=function(){
  108. return objJson(this);
  109. }
  110. }
  111. //错误码定义
  112. var ErrorCode = {
  113. Ok: 1, //成功
  114. ArgumentIllegal: 2, //参数不合格
  115. OpreateFailed: 3, //操作失败
  116. UnkownException: 4 //未知异常
  117. }
  118. var TagOptCode={
  119. Sucess : 0, //成功
  120. TagUnExsit:1, //不存在该点
  121. TagTypeIllage:2, //标签点类型非法
  122. AlarmTagUnExsit:3, //不存在该报警点
  123. AlarmTagHasExsit:4, //该报警点已经存在
  124. AlarmTagLoadFailed:5, //该报警点在数据库中存在,启动服务时加载失败
  125. AlarmSnapshotUnExsit:6, //实时报警不存在(未产生,已确认复归,或者未删除)
  126. Other:7 //其它异常
  127. }
  128. var DataType={
  129. BOOL : 0,
  130. //
  131. // 摘要:
  132. // 无符号8位整数,占用1字节
  133. UINT8 :1,
  134. //
  135. // 摘要:
  136. // 有符号8位整数,占用1字节
  137. INT8 : 2,
  138. //
  139. // 摘要:
  140. // 无符号16位整数,占用2字节
  141. UINT16 : 4,
  142. //
  143. // 摘要:
  144. // 有符号16位整数,占用2字节
  145. INT16 : 5,
  146. //
  147. // 摘要:
  148. // 无符号32位整数,占用4字节
  149. UINT32 : 6,
  150. //
  151. // 摘要:
  152. // 有符号32位整数,占用4字节
  153. INT32 : 7,
  154. //
  155. // 摘要:
  156. // 有符号64位整数,占用8字节
  157. INT64 : 8,
  158. //
  159. // 摘要:
  160. // 16位浮点数,占用2字节
  161. REAL16 : 9,
  162. //
  163. // 摘要:
  164. // 32位单精度浮点数,占用4字节
  165. REAL32 : 10,
  166. //
  167. // 摘要:
  168. // 64位双精度浮点数,占用8字节
  169. REAL64 : 11
  170. }