ice_raft.go 3.6 KB

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