waybill.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // 运单
  32. type Waybill struct {
  33. model2.Model
  34. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 单号
  35. Status int `json:"status" gorm:"size:128"` // 订单状态:1已下单 2配送中 3已送达 4已拒收
  36. SenderAddressDetails string `json:"senderAddressDetails" gorm:"size:128"` // 发货地址详情
  37. SenderAddressName string `json:"senderAddressName" gorm:"size:128"` // 发货地址名称
  38. SenderAddressPhone string `json:"senderAddressPhone" gorm:"size:128"` // 发货地址电话
  39. ConsigneeAddressDetails string `json:"consigneeAddressDetails" gorm:"size:128"` // 收发货地址详情
  40. ConsigneeAddressName string `json:"consigneeAddressName" gorm:"size:128"` // 收发货地址名称
  41. ConsigneeAddressPhone string `json:"consigneeAddressPhone" gorm:"size:128"` // 收发货地址电话
  42. Remark string `json:"remark" gorm:"size:4"` // 运输备注
  43. OrderTime model2.Time `json:"orderTime" gorm:"size:128"` // 下单时间
  44. DeliveryTime model2.Time `json:"deliveryTime" gorm:"size:128"` // 配送时间
  45. ReceiptTime model2.Time `json:"receiptTime" gorm:"size:128"` // 签收时间
  46. Quantity int `json:"quantity" gorm:"size:128"` // 药品数量
  47. CoolerBoxId int `json:"coolerBoxId" gorm:"size:128"` // 保温箱id
  48. ReceiptImg string `json:"receiptImg" gorm:"size:text"` // 签收图片
  49. TamperProofLabel string `json:"tamperProofLabel" gorm:"size:128"` // 防拆标签
  50. RejectionReason string `json:"rejectionReason" gorm:"size:128"` // 拒收原因
  51. SendLog WaybillSendLog `json:"sendLog"` // 运单短信发送日志
  52. CoolerBox CoolerBoxOmit `json:"coolerBox" gorm:"->"` // 保温箱
  53. Dept SysDeptOmit `json:"dept" gorm:"->"` // 部门
  54. model2.ControlBy
  55. model2.ModelTime
  56. model2.DeptBy
  57. }
  58. func (Waybill) TableName() string {
  59. return "waybill"
  60. }