types.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. }
  52. SetCurrentsReq []SetCurrentReq
  53. SetCurrentResp struct {
  54. Code int `json:"code"`
  55. Msg string `json:"msg"`
  56. Data interface{} `json:"data"`
  57. }
  58. VirtualPlcItem struct {
  59. ProjectId int `json:"ProjectId"`
  60. PageSize int `json:"pageSize"`
  61. }
  62. VirtualPlc struct {
  63. ItemName string `json:"ItemName"`
  64. Expression string `json:"Expression"`
  65. Frequency int `json:"frequency"`
  66. IsVirtual int `json:"IsVirtual"`
  67. ItemPrecise int `json:"ItemPrecise"`
  68. }
  69. VirtualPlcPage struct {
  70. List []*VirtualPlc `json:"list"`
  71. }
  72. VirtualPlcItemResp struct {
  73. Code int `json:"code"`
  74. Data *VirtualPlcPage `json:"data"`
  75. }
  76. )