ice_raft.go 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. IceRaftRecord IceRaftRecordOmit `json:"iceRaftRecord" gorm:"->;foreignkey:IceRaftRecordId;references:Id"`
  14. model2.ControlBy
  15. model2.ModelTime
  16. model2.DeptBy
  17. }
  18. type IceRaftOmit struct {
  19. Id int `json:"id,omitempty"` // 主键编码
  20. Code string `json:"code,omitempty"` // 商品名称
  21. }
  22. func (IceRaft) TableName() string {
  23. return "ice_raft"
  24. }
  25. func (IceRaftOmit) TableName() string {
  26. return "ice_raft"
  27. }
  28. const (
  29. IceRaftRecordStatusFreezing = "1" // 冷冻中
  30. IceRaftRecordStatusWaitUse = "2" // 待使用
  31. IceRaftRecordStatusUsing = "3" // 使用中
  32. IceRaftRecordStatusFinish = "4" // 已结束
  33. )
  34. func GetIceRaftRecordStatus(s string) string {
  35. switch s {
  36. case IceRaftRecordStatusFreezing:
  37. return "冷冻中"
  38. case IceRaftRecordStatusWaitUse:
  39. return "待使用"
  40. case IceRaftRecordStatusUsing:
  41. return "使用中"
  42. case IceRaftRecordStatusFinish:
  43. return "已结束"
  44. }
  45. return ""
  46. }
  47. // 冰排记录
  48. type IceRaftRecord struct {
  49. model2.Model
  50. IceRaftId int `json:"iceRaftId" gorm:"size:128;comment:冰排id"`
  51. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 1-冷冻中 2-待使用 3-使用中
  52. InStorageTime model2.Time `json:"inStorageTime" gorm:"size:128;comment:入库时间"` // 入库时间
  53. OutStorageTime model2.Time `json:"outStorageTime" gorm:"size:128;comment:出库时间"` // 出库时间
  54. IceLockerId int `json:"iceLockerId" gorm:"size:128;comment:冰柜id"` // 冰柜id
  55. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128;comment:保温箱id"` // 保温箱id
  56. FreezeClaim float32 `json:"freezeClaim" gorm:"type:decimal(10,2);comment:冷冻要求"` // 冷冻要求 单位小时
  57. FreezeDuration int `json:"freezeDuration" gorm:"size:128;comment:冷冻时长"` // 冷冻时长 单位分钟
  58. IceLocker IceLockerOmit `json:"iceLocker" gorm:"->"`
  59. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"`
  60. model2.ControlBy
  61. model2.ModelTime
  62. model2.DeptBy
  63. }
  64. type IceRaftRecordOmit struct {
  65. Id int `json:"id,omitempty"` // 主键编码
  66. IceRaftId int `json:"iceRaftId,omitempty"` // 冰排id
  67. Status string `json:"status,omitempty"` // 1-停用 2-正常
  68. InStorageTime model2.Time `json:"inStorageTime,omitempty"` // 入库时间
  69. OutStorageTime model2.Time `json:"outStorageTime,omitempty"` // 出库时间
  70. IceLockerId int `json:"iceLockerId,omitempty"` // 冰柜id
  71. CoolerBoxId int `json:"coolerBoxId,omitempty"` // 保温箱id
  72. FreezeClaim float32 `json:"freezeClaim"` // 冷冻要求 单位小时
  73. FreezeDuration int `json:"freezeDuration"` // 冷冻时长 单位分钟
  74. IceLocker IceLockerOmit `json:"iceLocker" gorm:"->"`
  75. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"`
  76. }
  77. func (IceRaftRecord) TableName() string {
  78. return "ice_raft_record"
  79. }
  80. func (IceRaftRecordOmit) TableName() string {
  81. return "ice_raft_record"
  82. }