types.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. package datacenter_client
  2. type (
  3. // 公共部分
  4. ItemHistoryResp struct {
  5. ProjectId int `json:"project_id"`
  6. ItemName string `json:"item_name"`
  7. Val float64 `json:"val"`
  8. HTime string `json:"h_time"`
  9. }
  10. InstrumentCompareData struct {
  11. Max float64 `json:"max_val"`
  12. Min float64 `json:"min_val"`
  13. }
  14. WorkingPump struct {
  15. Id int64
  16. ProjectId int64
  17. DeviceCode string
  18. FeedPressure float64
  19. OutPressure float64
  20. Duration int64
  21. Current float64
  22. Frequency float64
  23. Lift float64
  24. Efficiency float64
  25. RunStatus int64
  26. FaultStatus int64
  27. CTime string
  28. }
  29. WorkingChest struct {
  30. Id int64
  31. ProjectId int64
  32. DeviceCode string
  33. Switch int64
  34. Level float64
  35. AgitatorStatus int64
  36. AgitatorDuration int64
  37. AgitatorFaultStatus int64
  38. CTime string
  39. }
  40. WorkingRo struct {
  41. Id int64
  42. ProjectId int64
  43. DeviceCode string
  44. WaterTemperature float64
  45. FeedFlow_1St float64
  46. ConFlow_1St float64
  47. ProductFlow_1St float64
  48. FeedPressure_1St float64
  49. ConPressure_1St float64
  50. ProductPressure_1St float64
  51. Tmp_1St float64
  52. Flux_1St float64
  53. Permeability_1St float64
  54. FeedFlow_2Nd float64
  55. ConFlow_2Nd float64
  56. ProductFlow_2Nd float64
  57. FeedPressure_2Nd float64
  58. ConPressure_2Nd float64
  59. ProductPressure_2Nd float64
  60. Tmp_2Nd float64
  61. Flux_2Nd float64
  62. Permeability_2Nd float64
  63. FeedFlow_3Th float64
  64. ConFlow_3Th float64
  65. ProductFlow_3Th float64
  66. FeedPressure_3Th float64
  67. ConPressure_3Th float64
  68. ProductPressure_3Th float64
  69. Tmp_3Th float64
  70. Flux_3Th float64
  71. Permeability_3Th float64
  72. FeedWqTurbidity float64
  73. FeedWqPh int64
  74. ProductWqPh int64
  75. FeedWqAl float64
  76. ProductWqAl float64
  77. FeedWqFe float64
  78. ProductWqFe float64
  79. FeedWqMn float64
  80. ProductWqMn float64
  81. FeedWqSio2 float64
  82. ProductWqSio2 float64
  83. FeedWqCod float64
  84. ProductWqCod float64
  85. FeedWqP float64
  86. ProductWqP float64
  87. Step int64
  88. CTime string
  89. }
  90. WorkingUf struct {
  91. Id int64
  92. ProjectId int64
  93. DeviceCode string
  94. WaterTemperature float64
  95. FeedFlow float64
  96. ConFlow float64
  97. ProductFlow float64
  98. FeedPressure float64
  99. ConPressure float64
  100. ProductPressure float64
  101. Tmp float64
  102. Flux float64
  103. Permeability float64
  104. FeedWqTurbidity float64
  105. FeedWqPh int64
  106. ProductWqPh int64
  107. FeedWqAl float64
  108. ProductWqAl float64
  109. FeedWqFe float64
  110. ProductWqFe float64
  111. FeedWqMn float64
  112. ProductWqMn float64
  113. FeedWqSio2 float64
  114. ProductWqSio2 float64
  115. FeedWqCod float64
  116. ProductWqCod float64
  117. FeedWqP float64
  118. ProductWqP float64
  119. Step int64
  120. FilterTime float64
  121. FilterCycle int64
  122. CTime string
  123. }
  124. )
  125. type (
  126. // 请求参数部分
  127. FindWorkingUfByCycleReq struct {
  128. ProjectId int64
  129. DeviceCode string
  130. FilterCycle int64
  131. Step int64
  132. FilterTimeStart float64
  133. FilterTimeEnd float64
  134. Limit int64
  135. }
  136. DcWorkingReq struct {
  137. ProjectId int64
  138. DeviceCode string
  139. Stime string
  140. Etime string
  141. Page int64
  142. PageSize int64
  143. Order string
  144. }
  145. // 点位最大 and 最小值请求
  146. RangeMaxMinReq struct {
  147. ProjectId string
  148. ItemName string
  149. Stime string
  150. Etime string
  151. }
  152. ItemHistoryReq struct {
  153. ProjectId string
  154. ItemName string
  155. Stime string
  156. Etime string
  157. }
  158. // 点位数据写入结构
  159. ItemHistoryData struct {
  160. ProjectId int `json:"project_id"`
  161. ItemName string `json:"item_name"`
  162. Val float64 `json:"val"`
  163. HTime string `json:"h_time"`
  164. }
  165. // 点位数据写入请求
  166. MultiAddReq struct {
  167. List []ItemHistoryData `json:"list"`
  168. }
  169. )
  170. type (
  171. // 响应结构部分
  172. GetWorkingPumpByCodeResp struct {
  173. Code int `json:"code"`
  174. Msg string `json:"msg"`
  175. Data struct {
  176. List []WorkingPump `json:"list"`
  177. } `json:"data"`
  178. }
  179. GetWorkingChestByCodeResp struct {
  180. Code int `json:"code"`
  181. Msg string `json:"msg"`
  182. Data struct {
  183. List []WorkingChest `json:"list"`
  184. } `json:"data"`
  185. }
  186. GetWorkingRoByCodeResp struct {
  187. Code int `json:"code"`
  188. Msg string `json:"msg"`
  189. Data struct {
  190. List []WorkingRo `json:"list"`
  191. } `json:"data"`
  192. }
  193. FindWorkingUfByCycleResp struct {
  194. Code int `json:"code"`
  195. Msg string `json:"msg"`
  196. Data struct {
  197. List []WorkingUf `json:"list"`
  198. } `json:"data"`
  199. }
  200. GetWorkingUfByCodeResp struct {
  201. Code int `json:"code"`
  202. Msg string `json:"msg"`
  203. Data struct {
  204. List []WorkingUf `json:"list"`
  205. } `json:"data"`
  206. }
  207. RangeMaxMinResp struct {
  208. Code int `json:"code"`
  209. Msg string `json:"msg"`
  210. Data *InstrumentCompareData `json:"data"`
  211. }
  212. ItemHistoryRespList struct {
  213. List []ItemHistoryResp
  214. }
  215. MultiAddBody struct {
  216. Code int `json:"code"`
  217. Msg string `json:"msg"`
  218. }
  219. ItemHistoryBody struct {
  220. Code int `json:"code"`
  221. Msg string `json:"msg"`
  222. Data ItemHistoryRespList `json:"data"`
  223. }
  224. )
  225. type (
  226. // DcAPI 在这里定义了数据中心接口, 具体实现在版本目录中(目前只有v1)
  227. DcAPI interface {
  228. // GetItemHistory 查询历史点位数据
  229. GetItemHistory(req ItemHistoryReq) (resp []ItemHistoryResp, err error)
  230. // MultiAddData 点位数据写入
  231. MultiAddData(req MultiAddReq) (err error)
  232. // ObtainRangeMaxMin 查询最大最小值
  233. ObtainRangeMaxMin(req *RangeMaxMinReq) (resp *InstrumentCompareData, err error)
  234. // GetWorkingUfByCode 获得uf工况数据
  235. GetWorkingUfByCode(DcWorkingReq) (*GetWorkingUfByCodeResp, error)
  236. // FindWorkingUfByCycle 查询uf工况数据, 按周期进行过滤
  237. FindWorkingUfByCycle(FindWorkingUfByCycleReq) (*FindWorkingUfByCycleResp, error)
  238. // GetWorkingRoByCode 查询ro工况数据
  239. GetWorkingRoByCode(DcWorkingReq) (*GetWorkingRoByCodeResp, error)
  240. // GetWorkingChestByCode 查询液体容器类工况数据
  241. GetWorkingChestByCode(DcWorkingReq) (*GetWorkingChestByCodeResp, error)
  242. // GetWorkingPumpByCode 查询泵类工况数据
  243. GetWorkingPumpByCode(DcWorkingReq) (*GetWorkingPumpByCodeResp, error)
  244. }
  245. )