cooler_box.go 4.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. // CoolerBox 保温箱
  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. ForColdCoolerTime float64 `json:"for_cold_cooler_time" gorm:"type:decimal(10,2);comment:预冷要求"` //保温箱预冷要求
  20. DeviceData natsModel.DeviceData_R2 `json:"deviceData" gorm:"-"`
  21. MonitorStatus int `json:"monitorStatus" gorm:"comment:监控状态"` // 监控状态 0-未监控 1-监控中
  22. ForColdStatus int `json:"forColdStatus" gorm:"default:0;comment:预冷状态"` // 0-未预冷 1-预冷中 2-使用中
  23. BindIceRaftId model2.StringList `json:"bindIceRaftId" gorm:"comment:绑定冰排"` // 绑定的冰排id
  24. UseStatus int `json:"useStatus" gorm:"default:0;comment:预冷状态"` // 0-未预冷 1-预冷中 2-使用中 3遇冷结束
  25. model2.ControlBy
  26. model2.ModelTime
  27. model2.DeptBy
  28. IceRaft []IceRaft `json:"ice_raft" gorm:"-"`
  29. CoolerBoxRecords CoolerBoxRecord `json:"cooler_box_record" gorm:"-"`
  30. }
  31. // CoolerBoxRecord 保温箱历史记录
  32. type CoolerBoxRecord struct {
  33. model2.Model
  34. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128"`
  35. Name string `json:"name" gorm:"size:128"` // 保温箱名称
  36. Sn string `json:"sn" gorm:"size:128"` // sn
  37. HistoryCode model2.StringList `json:"historyCode"` // 历史冰排
  38. Status string `json:"status" gorm:"size:4;not null;default:'0';comment:状态"` // 0待使用 1-使用中 2-使用结束
  39. CoolerBoxStarTime model2.Time `json:"coolerBoxStarTime" gorm:"size:128;comment:保温箱开始预冷时间"` //保温箱开始预冷时间
  40. CoolerUserTime model2.Time `json:"coolerBoxUserTime" gorm:"size:128;comment:保温箱开始使用时间"` //保温箱使用时间
  41. CoolerColdAddress string `json:"cooler-cold-address" gorm:"size:128;comment:保温箱预冷地点"` //保温箱预冷地点
  42. ColdTemperatures string `json:"cold_temperatures" gorm:"size:128;comment:保温箱预冷温度"` //遇冷温度
  43. CoolerColdUsers string `json:"cooler-cold-users" gorm:"size:128;comment:保温箱预冷操作人员"` //保温箱预冷操作人员
  44. CoolerUseUsers string `json:"cooler-use-users" gorm:"size:128;comment:保温箱使用操作人员"` //保温箱使用操作人员
  45. CoolerEndUseTime model2.Time `json:"coolerEndUseTime" gorm:"size:128;comment:保温箱结束使用时间"`
  46. ForColdCoolerTime float64 `json:"for_cold_cooler_time" gorm:"type:decimal(10,2);comment:预冷要求"`
  47. ForColdDuration string `json:"for_cold_duration" gorm:"comment:预冷累计时长"` // 预冷累计时长
  48. model2.ControlBy
  49. model2.ModelTime
  50. model2.DeptBy
  51. }
  52. type CoolerBoxAndIceRaft struct {
  53. model2.Model
  54. Name string `json:"name" gorm:"size:128"` // 商品名称
  55. Sn string `json:"sn" gorm:"size:128"` // sn
  56. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 1-停用 2-正常
  57. HistorySn model2.StringList `json:"historySn"` // 历史绑定的sn
  58. DeviceData natsModel.DeviceData_R2 `json:"deviceData" gorm:"-"`
  59. model2.ControlBy
  60. model2.ModelTime
  61. model2.DeptBy
  62. IceRaft []IceRaft `json:"ice_raft"`
  63. }
  64. type CoolerBoxOmit struct {
  65. Id int `json:"id,omitempty"` // 主键编码
  66. Name string `json:"name,omitempty"` // 商品名称
  67. Sn string `json:"sn" gorm:"size:128"` // sn
  68. }
  69. func (CoolerBox) TableName() string {
  70. return "cooler_box"
  71. }
  72. func (CoolerBoxRecord) TableName() string {
  73. return "cooler_box_record"
  74. }
  75. func (CoolerBoxOmit) TableName() string {
  76. return "cooler_box"
  77. }