types.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package envitem
  2. import "github.com/go-redis/redis/v8"
  3. type (
  4. Options struct {
  5. GtServerIp string
  6. Cache *redis.Client
  7. AdjustValue bool
  8. // 批量获取点位值
  9. FetchMultiItem bool
  10. // 设备点位值的secret
  11. PlcItemSecret string
  12. }
  13. EnvItem struct {
  14. ProjectId int64 `json:"project_id"`
  15. DeviceCode string `json:"device_code"`
  16. PlcDeviceId string `json:"plc_device_id"`
  17. Item string `json:"item"`
  18. DefaultVal interface{} `json:"default_val"`
  19. Value interface{} `json:"value"`
  20. Htime string `json:"htime"`
  21. }
  22. MultiEnvItem map[string]*EnvItem
  23. ItemValueResp struct {
  24. Alias string `json:"alias"`
  25. DataAddress string `json:"dataAddress"`
  26. DataType string `json:"datatype"`
  27. DevName string `json:"devName"`
  28. DevID string `json:"devid"`
  29. HTime string `json:"htime"`
  30. ItemID string `json:"itemid"`
  31. ItemName string `json:"itemname"`
  32. Quality string `json:"quality"`
  33. ReadOnly bool `json:"readOnly"`
  34. SpecificType string `json:"specificType"`
  35. Val string `json:"val"`
  36. }
  37. ItemValueResps struct {
  38. Code int `json:"code"`
  39. Data []*ItemValueResp `json:"data"`
  40. }
  41. ItemValueReq struct {
  42. DeviceId string `json:"deviceId"`
  43. DeviceItems string `json:"deviceItems"`
  44. ProjectId int64 `json:"project_id"`
  45. }
  46. SetCurrentReq struct {
  47. ProjectId int64 `json:"project_id"`
  48. Item string `json:"item"`
  49. OldValue string `json:"old_value"`
  50. NewValue string `json:"new_value"`
  51. CommandType int64 `json:"command_type"`
  52. }
  53. SetCurrentsReq []SetCurrentReq
  54. SetCurrentResp struct {
  55. Code int `json:"code"`
  56. Msg string `json:"msg"`
  57. Data interface{} `json:"data"`
  58. }
  59. VirtualPlcItem struct {
  60. ProjectId int `json:"ProjectId"`
  61. PageSize int `json:"pageSize"`
  62. }
  63. VirtualPlc struct {
  64. ItemName string `json:"ItemName"`
  65. Expression string `json:"Expression"`
  66. Frequency int `json:"frequency"`
  67. IsVirtual int `json:"IsVirtual"`
  68. ItemPrecise int `json:"ItemPrecise"`
  69. }
  70. VirtualPlcPage struct {
  71. List []*VirtualPlc `json:"list"`
  72. }
  73. VirtualPlcItemResp struct {
  74. Code int `json:"code"`
  75. Data *VirtualPlcPage `json:"data"`
  76. }
  77. )