waybill.go 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. Status int `json:"status" gorm:"size:128"` // 订单状态:1已下单 2配送中 3已送达 4已拒收
  44. SenderAddressDetails string `json:"senderAddressDetails" gorm:"size:128"` // 发货地址详情
  45. SenderAddressName string `json:"senderAddressName" gorm:"size:128"` // 发货地址名称
  46. SenderAddressPhone string `json:"senderAddressPhone" gorm:"size:128"` // 发货地址电话
  47. ConsigneeAddressDetails string `json:"consigneeAddressDetails" gorm:"size:128"` // 收发货地址详情
  48. ConsigneeAddressName string `json:"consigneeAddressName" gorm:"size:128"` // 收发货地址名称
  49. ConsigneeAddressPhone string `json:"consigneeAddressPhone" gorm:"size:128"` // 收发货地址电话
  50. DeliveryName string `json:"deliveryName" gorm:"size:128"` // 配送人名称
  51. DeliveryPhone string `json:"deliveryPhone" gorm:"size:128"` // 配送人电话
  52. DeliveryId int `json:"deliveryId" gorm:"size:128"` // 配送人id
  53. ReCheckId int `json:"reCheckId" gorm:"size:128"` // 复核id
  54. Remark string `json:"remark" gorm:"size:text"` // 运输备注
  55. OrderTime model2.Time `json:"orderTime" gorm:"size:128"` // 下单时间
  56. DeliveryTime model2.Time `json:"deliveryTime" gorm:"size:128"` // 配送时间
  57. DeliveryDuration int `json:"deliveryDuration" gorm:"size:128;comment:冷冻时长"` // 配送耗时 单位分钟
  58. ReceiptTime model2.Time `json:"receiptTime" gorm:"size:128"` // 签收时间
  59. Quantity int `json:"quantity" gorm:"size:128"` // 药品数量
  60. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128"` // 保温箱id
  61. ReceiptImg string `json:"receiptImg" gorm:"size:text"` // 签收图片
  62. TamperProofLabel string `json:"tamperProofLabel" gorm:"size:128"` // 防拆标签
  63. TamperProofLabelImg string `json:"tamperProofLabelImg" gorm:"size:text"` // 防拆标签
  64. RejectionReason string `json:"rejectionReason" gorm:"size:128"` // 拒收原因
  65. SendLog WaybillSendLog `json:"sendLog" gorm:"size:text"` // 运单短信发送日志
  66. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"` // 保温箱
  67. Dept SysDeptOmit `json:"dept" gorm:"->"` // 部门
  68. Delivery SysUserOmit `json:"delivery" gorm:"->"` // 部门
  69. ReCheck SysUserOmit `json:"reCheck" gorm:"->"` // 部门
  70. IceRaftCode IceRaftCode `json:"iceRaftCode" gorm:"size:text"`
  71. AssessStar int `json:"assessStar" gorm:"size:128"` // 评价星星
  72. AssessContent string `json:"assessContent" gorm:"size:128"` // 评价内容
  73. model2.ControlBy
  74. model2.ModelTime
  75. model2.DeptBy
  76. }
  77. func (Waybill) TableName() string {
  78. return "waybill"
  79. }