ice_raft.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package model
  2. import model2 "cold-delivery/common/model"
  3. const (
  4. IceRaftStatusNormal = "2"
  5. IceRaftStatusDisable = "1"
  6. )
  7. // 冰排
  8. type IceRaft struct {
  9. model2.Model
  10. Code string `json:"code" gorm:"size:128"` // 商品名称
  11. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 1-停用 2-正常
  12. IceRaftRecordId int `json:"iceRaftRecordId" gorm:"size:128"` // 最新入库记录
  13. FreezeClaim float32 `json:"freezeClaim" gorm:"type:decimal(10,2);comment:冷冻要求"` // 冷冻要求 单位小时
  14. IceRaftRecord IceRaftRecordOmit `json:"iceRaftRecord" gorm:"->;foreignkey:IceRaftRecordId;references:Id"`
  15. Label string `json:"label" gorm:"size:128;comment:标签"` // 标签
  16. SuitableForColdTime int `json:"suitableForColdTime" gorm:"size:128;comment:适冷时间"` // 适冷时间 单位分钟
  17. model2.ControlBy
  18. model2.ModelTime
  19. model2.DeptBy
  20. }
  21. type IceRaftOmit struct {
  22. Id int `json:"id,omitempty"` // 主键编码
  23. Code string `json:"code,omitempty"` // 商品名称
  24. }
  25. func (IceRaft) TableName() string {
  26. return "ice_raft"
  27. }
  28. func (IceRaftOmit) TableName() string {
  29. return "ice_raft"
  30. }
  31. const (
  32. IceRaftRecordStatusFreezing = "1" // 冷冻中
  33. IceRaftRecordStatusWaitUse = "2" // 待使用
  34. IceRaftRecordStatusUsing = "3" // 使用中
  35. IceRaftRecordStatusFinish = "4" // 已结束
  36. )
  37. func GetIceRaftRecordStatus(s string) string {
  38. switch s {
  39. case "":
  40. return "未入库"
  41. case IceRaftRecordStatusFreezing:
  42. return "冷冻中"
  43. case IceRaftRecordStatusWaitUse:
  44. return "待使用"
  45. case IceRaftRecordStatusUsing:
  46. return "使用中"
  47. case IceRaftRecordStatusFinish:
  48. return "已结束"
  49. }
  50. return ""
  51. }
  52. // 冰排记录
  53. type IceRaftRecord struct {
  54. model2.Model
  55. IceRaftId int `json:"iceRaftId" gorm:"size:128;comment:冰排id"`
  56. Label string `json:"label" gorm:"size:128;comment:标签"` // 标签
  57. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 0未入库 1-冷冻中 2-待使用 3-使用中 4已结束
  58. InStorageTime model2.Time `json:"inStorageTime" gorm:"size:128;comment:入库时间"` // 入库时间
  59. OutStorageTime model2.Time `json:"outStorageTime" gorm:"size:128;comment:出库时间"` // 出库时间
  60. IceLockerId int `json:"iceLockerId" gorm:"size:128;comment:冷冻柜id"` // 冷冻柜id
  61. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128;comment:保温箱id"` // 保温箱id
  62. FreezeClaim float32 `json:"freezeClaim" gorm:"type:decimal(10,2);comment:冷冻要求"` // 冷冻要求 单位小时
  63. FreezeDuration int `json:"freezeDuration" gorm:"size:128;comment:冷冻时长"` // 冷冻时长 单位分钟
  64. SuitableForCold float32 `json:"suitableForCold" gorm:"type:decimal(10,2);comment:冰排适冷温度"` // 冰排适冷温度
  65. EndForColdTime model2.Time `json:"endForColdTime" gorm:"size:128;comment:适冷结束时间"` // 适冷结束时间
  66. IsSuitableForCold int `json:"isSuitableForCold" gorm:"size:4;not null;comment:是否结束适冷"` //0 未适冷 1已适冷
  67. CoolerBoxStarTime model2.Time `json:"coolerBoxStarTime" gorm:"size:128;comment:保温箱开始记录时间"` //保温箱开始记录时间
  68. CoolerBoxEndTime model2.Time `json:"coolerBoxEndTime" gorm:"size:128;comment:保温箱结束记录时间"` //保温箱结束记录时间
  69. StartIceColdTime model2.Time `json:"start_ice_cold_time" gorm:"size:128;comment:释冷开始时间"` //释冷开始时间
  70. IceLocker IceLockerOmit `json:"iceLocker" gorm:"->"`
  71. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"`
  72. model2.ControlBy
  73. model2.ModelTime
  74. model2.DeptBy
  75. }
  76. type IceRaftRecordOmit struct {
  77. Id int `json:"id,omitempty"` // 主键编码
  78. IceRaftId int `json:"iceRaftId,omitempty"` // 冰排id
  79. Status string `json:"status"` // 1-停用 2-正常
  80. InStorageTime model2.Time `json:"inStorageTime,omitempty"` // 入库时间
  81. OutStorageTime model2.Time `json:"outStorageTime,omitempty"` // 出库时间
  82. IceLockerId int `json:"iceLockerId,omitempty"` // 冷冻柜id
  83. CoolerBoxId int `json:"coolerBoxId,omitempty"` // 保温箱id
  84. FreezeClaim float32 `json:"freezeClaim"` // 冷冻要求 单位小时
  85. FreezeDuration int `json:"freezeDuration"` // 冷冻时长 单位分钟
  86. SuitableForCold float32 `json:"suitableForCold" ` // 冰排适冷温度
  87. EndForColdTime model2.Time `json:"endForColdTime" ` // 适冷结束时间
  88. IsSuitableForCold int `json:"isSuitableForCold" ` //0 未适冷 1已适冷
  89. IceLocker IceLockerOmit `json:"iceLocker" gorm:"->"`
  90. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"`
  91. }
  92. func (IceRaftRecord) TableName() string {
  93. return "ice_raft_record"
  94. }
  95. func (IceRaftRecordOmit) TableName() string {
  96. return "ice_raft_record"
  97. }