cooler_box.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package model
  2. import (
  3. model2 "cold-delivery/common/model"
  4. natsModel "cold-delivery/common/nats/nats_server"
  5. )
  6. const (
  7. CoolerBoxStatusNormal = "2"
  8. CoolerBoxStatusDisable = "1"
  9. )
  10. // 保温箱
  11. type CoolerBox struct {
  12. model2.Model
  13. Name string `json:"name" gorm:"size:128"` // 商品名称
  14. Sn string `json:"sn" gorm:"size:128"` // sn
  15. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 1-停用 2-正常
  16. HistorySn model2.StringList `json:"historySn"` // 历史绑定的sn
  17. ColdSpots string `json:"cold_spots"` //遇冷地点
  18. ColdTemperatures string `json:"cold_temperatures"` //遇冷温度
  19. DeviceData natsModel.DeviceData_R2 `json:"deviceData" gorm:"-"`
  20. MonitorStatus int `json:"monitorStatus" gorm:"comment:监控状态"` // 监控状态 0-未监控 1-监控中
  21. UseStatus string `json:"useStatus" gorm:"-"`
  22. model2.ControlBy
  23. model2.ModelTime
  24. model2.DeptBy
  25. IceRaft []IceRaft `json:"ice_raft" gorm:"-"`
  26. }
  27. // CoolerBoxRecord 保温箱历史记录
  28. type CoolerBoxRecord struct {
  29. model2.Model
  30. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128"`
  31. Name string `json:"name" gorm:"size:128"` // 保温箱名称
  32. Sn string `json:"sn" gorm:"size:128"` // sn
  33. HistoryCode model2.StringList `json:"historyCode"` // 历史冰排
  34. Status string `json:"status" gorm:"size:4;not null;default:'0';comment:状态"` // 0待使用 1-使用中 2-使用结束
  35. CoolerBoxStarTime model2.Time `json:"coolerBoxStarTime" gorm:"size:128;comment:保温箱开始预冷时间"` //保温箱开始预冷时间
  36. CoolerUserTime model2.Time `json:"coolerBoxUserTime" gorm:"size:128;comment:保温箱开始使用时间"` //保温箱使用时间
  37. CoolerColdAddress string `json:"cooler-cold-address" gorm:"size:128;comment:保温箱预冷地点"` //保温箱预冷地点
  38. ColdTemperatures string `json:"cold_temperatures"` //遇冷温度
  39. CoolerColdUsers string `json:"cooler-cold-users" gorm:"size:128;comment:保温箱预冷操作人员"` //保温箱预冷操作人员
  40. CoolerUseUsers string `json:"cooler-use-users" gorm:"size:128;comment:保温箱使用操作人员"` //保温箱使用操作人员
  41. model2.ControlBy
  42. model2.ModelTime
  43. model2.DeptBy
  44. }
  45. type CoolerBoxAndIceRaft struct {
  46. model2.Model
  47. Name string `json:"name" gorm:"size:128"` // 商品名称
  48. Sn string `json:"sn" gorm:"size:128"` // sn
  49. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 1-停用 2-正常
  50. HistorySn model2.StringList `json:"historySn"` // 历史绑定的sn
  51. DeviceData natsModel.DeviceData_R2 `json:"deviceData" gorm:"-"`
  52. model2.ControlBy
  53. model2.ModelTime
  54. model2.DeptBy
  55. IceRaft []IceRaft `json:"ice_raft"`
  56. }
  57. type CoolerBoxOmit struct {
  58. Id int `json:"id,omitempty"` // 主键编码
  59. Name string `json:"name,omitempty"` // 商品名称
  60. Sn string `json:"sn" gorm:"size:128"` // sn
  61. }
  62. func (CoolerBox) TableName() string {
  63. return "cooler_box"
  64. }
  65. func (CoolerBoxRecord) TableName() string {
  66. return "cooler_box_record"
  67. }
  68. func (CoolerBoxOmit) TableName() string {
  69. return "cooler_box"
  70. }