waybill.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package model
  2. import model2 "cold-logistics/common/model"
  3. var (
  4. WaybillStatusWaitDelivery = 1 // 待派单
  5. WaybillStatusWaitTruck = 2 // 待装车
  6. WaybillStatusWaitStorage = 3 // 待入库
  7. WaybillStatusTruck = 4 // 已装车
  8. WaybillStatusStorage = 5 // 已入库
  9. WaybillStatusTruckOut = 6 // 已下车
  10. WaybillStatusStorageOut = 7 // 已出库
  11. WaybillStatusReceipt = 8 // 已签收
  12. WaybillStatusMap = map[int]string{
  13. WaybillStatusWaitDelivery: "待派单",
  14. WaybillStatusWaitTruck: "待装车",
  15. WaybillStatusWaitStorage: "待入库",
  16. WaybillStatusTruck: "已装车",
  17. WaybillStatusStorage: "已入库",
  18. WaybillStatusReceipt: "已签收",
  19. WaybillStatusTruckOut: "已下车",
  20. WaybillStatusStorageOut: "已出库",
  21. }
  22. )
  23. // 获取客户运单状态
  24. func GetCustomerWaybillStatus(status int) string {
  25. switch status {
  26. case WaybillStatusWaitDelivery, WaybillStatusWaitTruck, WaybillStatusWaitStorage:
  27. return "未发货"
  28. case WaybillStatusTruck, WaybillStatusStorage, WaybillStatusTruckOut, WaybillStatusStorageOut:
  29. return "已发货"
  30. case WaybillStatusReceipt:
  31. return "已签收"
  32. }
  33. return ""
  34. }
  35. // 运单
  36. type Waybill struct {
  37. model2.Model
  38. WaybillNo string `json:"waybillNo" gorm:"size:128"` //单号
  39. Status int `json:"status" gorm:"size:128"` //订单状态:1待派单 2待装车 3待入库 4已装车 5已入库 6已下车 7已出库 8已签收
  40. //SenderAddressId int `json:"senderAddressId" gorm:"size:128"` //发货地址Id
  41. SenderAddressDetails string `json:"senderAddressDetails" gorm:"size:128"` //发货地址详情
  42. SenderAddressName string `json:"senderAddressName" gorm:"size:128"` //发货地址名称
  43. SenderAddressPhone string `json:"senderAddressPhone" gorm:"size:128"` //发货地址电话
  44. //ConsigneeAddressId int `json:"consigneeAddressId" gorm:"size:128"` // 收货地址id
  45. ConsigneeAddressDetails string `json:"consigneeAddressDetails" gorm:"size:128"` // 收发货地址详情
  46. ConsigneeAddressName string `json:"consigneeAddressName" gorm:"size:128"` // 收发货地址名称
  47. ConsigneeAddressPhone string `json:"consigneeAddressPhone" gorm:"size:128"` // 收发货地址电话
  48. CargoType string `json:"cargoType" gorm:"size:128"` // 货物类型
  49. TemperatureInterval string `json:"temperatureInterval" gorm:"size:128"` // 温度要求
  50. DeliveryCondition string `json:"deliveryCondition" gorm:"size:128"` // 配送要求
  51. Remark string `json:"remark" gorm:"size:128"` // 运输备注
  52. CustomerId int `json:"customerId" gorm:"size:4"` // 下单客户id
  53. CustomerName string `json:"customerName" gorm:"size:128"` // 下单客户名称
  54. OrderTime model2.Time `json:"orderTime" gorm:"size:128"` // 下单时间
  55. DeliveryTime model2.Time `json:"deliveryTime" gorm:"size:128"` // 发货时间 入库/装车时间
  56. PrintUserId int `json:"printUserId" gorm:"size:128"` // 打印人id
  57. ReceiptTime model2.Time `json:"receiptTime" gorm:"size:128"` // 签收时间
  58. WarehouseId int `json:"warehouseId" gorm:"size:128"` // 仓库id
  59. CarId int `json:"carId" gorm:"size:128"` // 仓库id
  60. ReceiptImg string `json:"ReceiptImg" gorm:"size:text"` // 签收图片
  61. Freight float64 `json:"freight" gorm:"size:9"` //运费
  62. PrintUser SysUserOmit `json:"printUser" gorm:"->;foreignkey:PrintUserId;references:Id"`
  63. model2.ControlBy
  64. model2.ModelTime
  65. model2.DeptBy
  66. }
  67. func (Waybill) TableName() string {
  68. return "waybill"
  69. }