waybill.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. package model
  2. import (
  3. model2 "cold-delivery/common/model"
  4. "database/sql/driver"
  5. "encoding/json"
  6. )
  7. var (
  8. WaybillStatusWaitDelivery = 1 // 已下单
  9. WaybillStatusInDelivery = 2 // 配送中
  10. WaybillStatusReceipt = 3 // 已签收
  11. WaybillStatusRejection = 4 // 已拒收
  12. WaybillStatusMap = map[int]string{
  13. WaybillStatusWaitDelivery: "已下单",
  14. WaybillStatusInDelivery: "配送中",
  15. WaybillStatusReceipt: "已签收",
  16. WaybillStatusRejection: "已拒收",
  17. }
  18. )
  19. // 运单短信发送日志
  20. type WaybillSendLog struct {
  21. Phone string `json:"phone"`
  22. Content string `json:"content"`
  23. }
  24. func (e WaybillSendLog) Value() (driver.Value, error) {
  25. d, err := json.Marshal(e)
  26. return string(d), err
  27. }
  28. func (e *WaybillSendLog) Scan(src interface{}) error {
  29. return json.Unmarshal(src.([]byte), e)
  30. }
  31. type IceRaftCode []string
  32. func (e IceRaftCode) Value() (driver.Value, error) {
  33. d, err := json.Marshal(e)
  34. return string(d), err
  35. }
  36. func (e *IceRaftCode) Scan(src interface{}) error {
  37. return json.Unmarshal(src.([]byte), e)
  38. }
  39. // 运单
  40. type Waybill struct {
  41. model2.Model
  42. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 单号
  43. OrderNo string `json:"orderNo" gorm:"size:128"` // 订单号
  44. Status int `json:"status" gorm:"size:128"` // 订单状态:1已下单 2配送中 3已送达 4已拒收
  45. SenderAddressDetails string `json:"senderAddressDetails" gorm:"size:128"` // 发货地址详情
  46. SenderAddressName string `json:"senderAddressName" gorm:"size:128"` // 发货地址名称
  47. SenderAddressPhone string `json:"senderAddressPhone" gorm:"size:128"` // 发货地址电话
  48. ConsigneeAddressDetails string `json:"consigneeAddressDetails" gorm:"size:128"` // 收发货地址详情
  49. ConsigneeAddressName string `json:"consigneeAddressName" gorm:"size:128"` // 收发货地址名称
  50. ConsigneeAddressPhone string `json:"consigneeAddressPhone" gorm:"size:128"` // 收发货地址电话
  51. DeliveryName string `json:"deliveryName" gorm:"size:128"` // 配送人名称
  52. DeliveryPhone string `json:"deliveryPhone" gorm:"size:128"` // 配送人电话
  53. DeliveryId int `json:"deliveryId" gorm:"size:128"` // 配送人id
  54. ReCheckId int `json:"reCheckId" gorm:"size:128"` // 复核id
  55. Remark string `json:"remark" gorm:"size:text"` // 运输备注
  56. OrderTime model2.Time `json:"orderTime" gorm:"size:128"` // 下单时间
  57. DeliveryTime model2.Time `json:"deliveryTime" gorm:"size:128"` // 配送时间
  58. DeliveryDuration int `json:"deliveryDuration" gorm:"size:128;comment:冷冻时长"` // 配送耗时 单位分钟
  59. ReceiptTime model2.Time `json:"receiptTime" gorm:"size:128"` // 签收时间
  60. Quantity int `json:"quantity" gorm:"size:128"` // 药品数量
  61. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128"` // 保温箱id
  62. ReceiptImg string `json:"receiptImg" gorm:"size:text"` // 签收图片
  63. TamperProofLabel string `json:"tamperProofLabel" gorm:"size:128"` // 防拆标签
  64. TamperProofLabelImg string `json:"tamperProofLabelImg" gorm:"size:text"` // 防拆标签
  65. RejectionReason string `json:"rejectionReason" gorm:"size:128"` // 拒收原因
  66. SendLog WaybillSendLog `json:"sendLog" gorm:"size:text"` // 运单短信发送日志
  67. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"` // 保温箱
  68. Dept SysDeptOmit `json:"dept" gorm:"->"` // 部门
  69. Delivery SysUserOmit `json:"delivery" gorm:"->"` // 部门
  70. ReCheck SysUserOmit `json:"reCheck" gorm:"->"` // 部门
  71. IceRaftCode IceRaftCode `json:"iceRaftCode" gorm:"size:text"`
  72. AssessStar int `json:"assessStar" gorm:"size:128"` // 评价星星
  73. AssessContent string `json:"assessContent" gorm:"size:128"` // 评价内容
  74. model2.ControlBy
  75. model2.ModelTime
  76. model2.DeptBy
  77. }
  78. func (Waybill) TableName() string {
  79. return "waybill"
  80. }