ice_raft.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 model2.FloatList `json:"freezeClaim" gorm:"type:json;comment:冷冻要求"` // 冷冻要求 单位小时
  14. IceRaftRecord IceRaftRecordOmit `json:"iceRaftRecord" gorm:"->;foreignkey:IceRaftRecordId;references:Id"`
  15. Label string `json:"label" gorm:"size:128;comment:标签"` // 标签
  16. IceColdAddress string `json:"iceColdAddress" gorm:"size:128;comment:冰排预冷地点"` //冰排预冷地点
  17. SuitableForCold string `json:"suitableForCold" gorm:"size:128;comment:冰排适冷温度"` // 冰排遇冷温度
  18. Sort int `json:"sort" gorm:"size:4;comment:排序"` // 排序
  19. ForColdTime float64 `json:"forColdTime" gorm:"type:decimal(10,2);comment:适冷时长"` // 适冷时长 单位小时
  20. BindCoolerBox model2.IntList `json:"bindCoolerBox" gorm:"type:json;comment:绑定保温箱"` //绑定保温箱 当该字段为零时,代表未绑定保温箱可正常出库
  21. CoolerBoxName model2.StringList `json:"coolerBoxName" gorm:"type:json;comment:保温箱名称"` // 保温箱名称
  22. model2.ControlBy
  23. model2.ModelTime
  24. model2.DeptBy
  25. }
  26. type IceRaftOmit struct {
  27. Id int `json:"id,omitempty"` // 主键编码
  28. Code string `json:"code,omitempty"` // 商品名称
  29. Label string `json:"label" gorm:"size:128;comment:标签"` // 标签
  30. }
  31. func (IceRaft) TableName() string {
  32. return "ice_raft"
  33. }
  34. func (IceRaftOmit) TableName() string {
  35. return "ice_raft"
  36. }
  37. const (
  38. IceRaftRecordStatusFreezing = "1" // 冷冻中
  39. IceRaftRecordStatusWaitUse = "2" // 待使用
  40. IceRaftRecordStatusUsing = "3" // 使用中
  41. IceRaftRecordStatusFinish = "4" // 已结束
  42. IceRaftRecordReleasedInTheCold = "5" // 释冷中
  43. IceRaftRecordReleasedInTheColdEnd = "6" // 释冷完成
  44. )
  45. func GetIceRaftRecordStatus(s string) string {
  46. switch s {
  47. case "":
  48. return "未入库"
  49. case IceRaftRecordStatusFreezing:
  50. return "冷冻中"
  51. case IceRaftRecordStatusWaitUse:
  52. return "待使用"
  53. case IceRaftRecordStatusUsing:
  54. return "使用中"
  55. case IceRaftRecordStatusFinish:
  56. return "已结束"
  57. case IceRaftRecordReleasedInTheCold:
  58. return "释冷中"
  59. case IceRaftRecordReleasedInTheColdEnd:
  60. return "释冷完成"
  61. }
  62. return ""
  63. }
  64. // IceRaftRecord 冰排记录
  65. type IceRaftRecord struct {
  66. model2.Model
  67. IceRaftId int `json:"iceRaftId" gorm:"size:128;comment:冰排id"`
  68. Label string `json:"label" gorm:"size:128;comment:标签"` // 标签
  69. Code string `json:"code" gorm:"size:128;comment:编号"` // 编号
  70. Status string `json:"status" gorm:"size:4;not null;default:'2';comment:状态"` // 0未入库 1-冷冻中 2-待使用 3-使用中 4已结束 5-释冷中 6-释冷完成
  71. Sort int `json:"sort" gorm:"size:4;comment:排序"` // 排序
  72. ForColdTime float64 `json:"forColdTime" gorm:"type:decimal(10,2);comment:要求适冷时间"` // 适冷时长 单位小时
  73. ForColdTimeActual float64 `json:"forColdTimeActual" gorm:"type:decimal(10,0);comment:实际适冷时间"` // 适冷时长 单位分钟
  74. InStorageTime model2.Time `json:"inStorageTime" gorm:"size:128;comment:入库时间"` // 入库时间
  75. OutStorageTime model2.Time `json:"outStorageTime" gorm:"size:128;comment:出库时间"` // 出库时间
  76. IceLockerId int `json:"iceLockerId" gorm:"size:128;comment:冷冻柜id"` // 冷冻柜id
  77. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128;comment:保温箱id"` // 保温箱id
  78. FreezeClaim model2.FloatList `json:"freezeClaim" gorm:"type:json;comment:冷冻要求"` // 冷冻要求 单位小时
  79. FreezeDuration float64 `json:"freezeDuration" gorm:"type:decimal(10,2);comment:冷冻时长"` // 冷冻时长 单位分钟
  80. SuitableForCold string `json:"suitableForCold" gorm:"size:128;comment:冰排适冷温度"` // 冰排适冷温度
  81. EndForColdTime model2.Time `json:"endForColdTime" gorm:"size:128;comment:适冷结束时间"` // 适冷结束时间
  82. IsSuitableForCold int `json:"isSuitableForCold" gorm:"size:4;not null;comment:是否结束适冷"` //0 未适冷 1已适冷
  83. CoolerBoxStarTime model2.Time `json:"coolerBoxStarTime" gorm:"size:128;comment:保温箱开始预冷时间"` //保温箱开始预冷时间
  84. CoolerBoxEndTime model2.Time `json:"coolerBoxEndTime" gorm:"size:128;comment:保温箱结束记录时间"` //保温箱结束记录时间
  85. StartIceColdTime model2.Time `json:"start_ice_cold_time" gorm:"size:128;comment:释冷开始时间"` //冰排释冷开始时间
  86. IceColdAddress string `json:"ice_cold_address" gorm:"size:128;comment:冰排预冷地点"` //冰排预冷地点
  87. IceColdUsers string `json:"ice_cold_users" gorm:"size:128;comment:冰排预冷操作人员"` //冰排预冷操作人员
  88. IceUseUsers string `json:"ice_use_users" gorm:"size:128;comment:冰排使用操作人员"` //冰排使用操作人员
  89. IceUseTime model2.Time `json:"ice_use_time" gorm:"size:128;comment:冰排使用时间"` //冰排使用时间
  90. CoolerColdAddress string `json:"cooler-cold-address" gorm:"size:128;comment:保温箱预冷地点"` //保温箱预冷地点
  91. CoolerColdUsers string `json:"cooler-cold-users" gorm:"size:128;comment:保温箱预冷操作人员"` //保温箱预冷操作人员
  92. CoolerUseUsers string `json:"cooler-use-users" gorm:"size:128;comment:保温箱使用操作人员"` //保温箱使用操作人员
  93. ReturnDate model2.Time `json:"returnDate" gorm:"size:128;comment:归还日期"` // 归还日期
  94. CoolingTime string `json:"coolingTime" gorm:"-"` //释冷时间
  95. IceLocker IceLockerOmit `json:"iceLocker" gorm:"->"`
  96. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"`
  97. CoolerBoxRecord CoolerBoxRecord `json:"coolerBoxRecord" gorm:"-"`
  98. IceRafts IceRaftOmit `json:"iceRafts" gorm:"-"`
  99. model2.ControlBy
  100. model2.ModelTime
  101. model2.DeptBy
  102. }
  103. type IceRaftRecordOmit struct {
  104. Id int `json:"id,omitempty"` // 主键编码
  105. IceRaftId int `json:"iceRaftId,omitempty"` // 冰排id
  106. Status string `json:"status"` // 1-停用 2-正常
  107. InStorageTime model2.Time `json:"inStorageTime,omitempty"` // 入库时间
  108. OutStorageTime model2.Time `json:"outStorageTime,omitempty"` // 出库时间
  109. IceLockerId int `json:"iceLockerId,omitempty"` // 冷冻柜id
  110. CoolerBoxId int `json:"coolerBoxId,omitempty"` // 保温箱id
  111. FreezeClaim model2.FloatList `json:"freezeClaim" gorm:"type:json;comment:冷冻要求"` // 冷冻要求 单位小时
  112. FreezeDuration float64 `json:"freezeDuration"` // 冷冻时长 单位分钟
  113. SuitableForCold string `json:"suitableForCold" ` // 冰排适冷温度
  114. EndForColdTime model2.Time `json:"endForColdTime" ` // 适冷结束时间
  115. IsSuitableForCold int `json:"isSuitableForCold" ` //0 未适冷 1已适冷
  116. StartIceColdTime model2.Time `json:"start_ice_cold_time" gorm:"size:128;comment:释冷开始时间"` //冰排释冷开始时间
  117. ForColdTimeActual float64 `json:"forColdTimeActual"`
  118. IceColdAddress string `json:"ice_cold_address" gorm:"size:128;comment:冰排预冷地点"` //冰排预冷地点
  119. IceColdUsers string `json:"ice_cold_users" gorm:"size:128;comment:冰排预冷操作人员"` //冰排预冷操作人员
  120. IceUseUsers string `json:"ice_use_users" gorm:"size:128;comment:冰排使用操作人员"` //冰排使用操作人员
  121. IceUseTime model2.Time `json:"ice_use_time" gorm:"size:128;comment:冰排使用时间"` //冰排使用时间
  122. CoolerColdAddress string `json:"cooler-cold-address" gorm:"size:128;comment:保温箱预冷地点"` //保温箱预冷地点
  123. CoolerColdUsers string `json:"cooler-cold-users" gorm:"size:128;comment:保温箱预冷操作人员"` //保温箱预冷操作人员
  124. CoolerUseUsers string `json:"cooler-use-users" gorm:"size:128;comment:保温箱使用操作人员"` //保温箱使用操作人员
  125. ReturnDate model2.Time `json:"returnDate" gorm:"size:128;comment:归还日期"` // 归还日期
  126. CoolingTime string `json:"coolingTime" gorm:"-"` //释冷时间
  127. IceLocker IceLockerOmit `json:"iceLocker" gorm:"->"`
  128. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"`
  129. model2.ControlBy
  130. model2.ModelTime
  131. }
  132. func (IceRaftRecord) TableName() string {
  133. return "ice_raft_record"
  134. }
  135. func (IceRaftRecordOmit) TableName() string {
  136. return "ice_raft_record"
  137. }