waybill.go 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. package dto
  2. import (
  3. "cold-logistics/app/admin/model"
  4. "cold-logistics/common/dto"
  5. common "cold-logistics/common/model"
  6. model2 "cold-logistics/common/model"
  7. "time"
  8. )
  9. // 运单
  10. type WaybillGetPageReq struct {
  11. dto.Pagination `search:"-"`
  12. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill"` // 运单编号
  13. Status int `form:"status" search:"type:exact;column:status;table:waybill"` // 状态
  14. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  15. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  16. WaybillOrder
  17. }
  18. type WaybillOrder struct {
  19. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill" form:"createdAtOrder" default:"desc"`
  20. }
  21. func (m *WaybillGetPageReq) GetNeedSearch() interface{} {
  22. return *m
  23. }
  24. type WaybillGetCustomerPageReq struct {
  25. dto.Pagination `search:"-"`
  26. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill"` // 运单编号
  27. Status int `form:"status" search:"-"` // 状态
  28. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  29. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  30. CustomerId int `form:"customerId" search:"type:exact;column:customer_id;table:waybill" swaggerignore:"true"` // 客户id
  31. WaybillOrder
  32. }
  33. func (m *WaybillGetCustomerPageReq) GetNeedSearch() interface{} {
  34. return *m
  35. }
  36. type WaybillInsertReq struct {
  37. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  38. No string `json:"no" swaggerignore:"true"` //单号
  39. Status int `json:"status" swaggerignore:"true"` //订单状态:1-待处理;102-待装车 103-运输中 104-已签收
  40. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  41. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  42. SenderAddressPhone string `json:"senderAddressPhone"` //发货地址电话
  43. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  44. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  45. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  46. CargoType string `json:"cargoType"` //货物类型
  47. TemperatureInterval string `json:"temperatureInterval"` //温度要求
  48. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  49. Remark string `json:"remark"` //运输备注
  50. CustomerId int `json:"customerId"` //下单客户id
  51. CustomerName string `json:"customerName"` //下单客户名称
  52. model2.ControlBy `swaggerignore:"true"`
  53. model2.DeptBy
  54. }
  55. func (s *WaybillInsertReq) Generate(m *model.Waybill) {
  56. if s.Id != 0 {
  57. m.Id = s.Id
  58. }
  59. m.Status = 1
  60. m.SenderAddressDetails = s.SenderAddressDetails
  61. m.SenderAddressName = s.SenderAddressName
  62. m.SenderAddressPhone = s.SenderAddressPhone
  63. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  64. m.ConsigneeAddressName = s.ConsigneeAddressName
  65. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  66. m.CargoType = s.CargoType
  67. m.TemperatureInterval = s.TemperatureInterval
  68. m.DeliveryCondition = s.DeliveryCondition
  69. m.Remark = s.Remark
  70. m.CustomerId = s.CustomerId
  71. m.CustomerName = s.CustomerName
  72. m.OrderTime = model2.Time(time.Now())
  73. if s.ControlBy.UpdateBy != 0 {
  74. m.UpdateBy = s.UpdateBy
  75. }
  76. if s.ControlBy.CreateBy != 0 {
  77. m.CreateBy = s.CreateBy
  78. }
  79. if s.DeptBy.DeptId != 0 {
  80. m.DeptId = s.DeptId
  81. }
  82. }
  83. func (s *WaybillInsertReq) GetId() interface{} {
  84. return s.Id
  85. }
  86. type WaybillUpdateReq struct {
  87. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  88. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  89. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  90. SenderAddressPhone string `json:"senderAddressPhone"` //发货地址电话
  91. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  92. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  93. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  94. CargoType string `json:"cargoType"` //货物类型
  95. TemperatureInterval string `json:"temperatureInterval"` //温度要求
  96. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  97. Remark string `json:"remark"` //运输备注
  98. CustomerName string `json:"customerName"` //下单客户名称
  99. model2.ControlBy `swaggerignore:"true"`
  100. model2.DeptBy `swaggerignore:"true"`
  101. }
  102. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  103. if s.Id != 0 {
  104. m.Id = s.Id
  105. }
  106. m.SenderAddressDetails = s.SenderAddressDetails
  107. m.SenderAddressName = s.SenderAddressName
  108. m.SenderAddressPhone = s.SenderAddressPhone
  109. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  110. m.ConsigneeAddressName = s.ConsigneeAddressName
  111. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  112. m.CargoType = s.CargoType
  113. m.TemperatureInterval = s.TemperatureInterval
  114. m.DeliveryCondition = s.DeliveryCondition
  115. m.Remark = s.Remark
  116. m.CustomerName = s.CustomerName
  117. if s.ControlBy.UpdateBy != 0 {
  118. m.UpdateBy = s.UpdateBy
  119. }
  120. if s.ControlBy.CreateBy != 0 {
  121. m.CreateBy = s.CreateBy
  122. }
  123. }
  124. func (s *WaybillUpdateReq) GetId() interface{} {
  125. return s.Id
  126. }
  127. type WaybillDeliveryReq struct {
  128. WaybillIds []int `json:"waybillIds"` // 运单id
  129. Type int `json:"type"` // 派单类型 3司机 2仓管
  130. PrintUserId int `json:"printUserId"` // 制单人
  131. model2.ControlBy `swaggerignore:"true"`
  132. model2.DeptBy `swaggerignore:"true"`
  133. }
  134. func (s *WaybillDeliveryReq) GetId() interface{} {
  135. return s.WaybillIds
  136. }
  137. type WaybillGetReq struct {
  138. Id int `uri:"id"`
  139. }
  140. func (s *WaybillGetReq) GetId() interface{} {
  141. return s.Id
  142. }
  143. type WaybillDeleteReq struct {
  144. Id int `json:"id"`
  145. common.ControlBy `swaggerignore:"true"`
  146. }
  147. func (s *WaybillDeleteReq) GetId() interface{} {
  148. return s.Id
  149. }
  150. // 运单出入库/上下车
  151. type WaybillInOutReq struct {
  152. StartTime model2.Time `json:"startTime"`
  153. WaybillNoList []string `json:"waybillNoList" gorm:"size:128"` // 订单编号
  154. }
  155. // 运单签收
  156. type WaybillReceiptReq struct {
  157. StartTime model2.Time `json:"startTime"`
  158. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 订单编号
  159. ReceiptImg string `json:"receiptImg" gorm:"size:128"` // 签收图片
  160. }
  161. type WaybillGetAppletPageReq struct {
  162. dto.Pagination `search:"-"`
  163. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  164. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  165. WaybillOrder
  166. }
  167. type WaybillGetAppletPageOrder struct {
  168. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  169. }
  170. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  171. return *m
  172. }
  173. type WaybillImportReq struct {
  174. CustomerName string `form:"customerName"` //下单客户名称
  175. }
  176. type WaybillStatsReq struct {
  177. Date string `form:"date"` // 日期
  178. Type string `form:"type"` // 类型 month-月 year-年
  179. }
  180. type WaybillStatsRes struct {
  181. TodayNum int64 `json:"todayNum"` // 今日总运单数
  182. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 待派单
  183. WaitTruckNum int64 `json:"waitTruckNum"` // 未装车
  184. WaitStorageNum int64 `json:"waitStorageNum"` // 未入库
  185. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  186. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  187. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  188. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  189. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  190. Stats []struct {
  191. Date string `json:"date"` // 日期 2024-01-01
  192. Num int64 `json:"num"` // 数量
  193. } `json:"stats"`
  194. }
  195. type WaybillGetByWaybillNoReq struct {
  196. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  197. }