ice_raft.go 3.7 KB

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