waybill.go 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. package dto
  2. import (
  3. "cold-delivery/app/admin/model"
  4. "cold-delivery/common/dto"
  5. common "cold-delivery/common/model"
  6. model2 "cold-delivery/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. Quantity int `json:"quantity"` //药品数量
  47. Remark string `json:"remark"` //运输备注
  48. TamperProofLabel string `json:"tamperProofLabel"` //防拆码标签
  49. CoolerBoxId int `json:"coolerBoxId"` //保温箱id
  50. model2.ControlBy `swaggerignore:"true"`
  51. model2.DeptBy
  52. }
  53. func (s *WaybillInsertReq) Generate(m *model.Waybill) {
  54. if s.Id != 0 {
  55. m.Id = s.Id
  56. }
  57. m.Status = 1
  58. m.SenderAddressDetails = s.SenderAddressDetails
  59. m.SenderAddressName = s.SenderAddressName
  60. m.SenderAddressPhone = s.SenderAddressPhone
  61. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  62. m.ConsigneeAddressName = s.ConsigneeAddressName
  63. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  64. m.Quantity = s.Quantity
  65. m.Remark = s.Remark
  66. m.TamperProofLabel = s.TamperProofLabel
  67. m.CoolerBoxId = s.CoolerBoxId
  68. m.OrderTime = model2.Time(time.Now())
  69. if s.ControlBy.UpdateBy != 0 {
  70. m.UpdateBy = s.UpdateBy
  71. }
  72. if s.ControlBy.CreateBy != 0 {
  73. m.CreateBy = s.CreateBy
  74. }
  75. if s.DeptBy.DeptId != 0 {
  76. m.DeptId = s.DeptId
  77. }
  78. }
  79. func (s *WaybillInsertReq) GetId() interface{} {
  80. return s.Id
  81. }
  82. type WaybillUpdateReq struct {
  83. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  84. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  85. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  86. SenderAddressPhone string `json:"senderAddressPhone"` //发货地址电话
  87. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  88. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  89. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  90. TamperProofLabel string `json:"tamperProofLabel"` //防拆标签
  91. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  92. Quantity int `json:"quantity"` //药品数量
  93. Remark string `json:"remark"` //运输备注
  94. CoolerBoxId int `json:"coolerBoxId"` //保温箱id
  95. model2.ControlBy `swaggerignore:"true"`
  96. model2.DeptBy `swaggerignore:"true"`
  97. }
  98. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  99. if s.Id != 0 {
  100. m.Id = s.Id
  101. }
  102. m.SenderAddressDetails = s.SenderAddressDetails
  103. m.SenderAddressName = s.SenderAddressName
  104. m.SenderAddressPhone = s.SenderAddressPhone
  105. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  106. m.ConsigneeAddressName = s.ConsigneeAddressName
  107. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  108. m.Quantity = s.Quantity
  109. m.Remark = s.Remark
  110. m.TamperProofLabel = s.TamperProofLabel
  111. if s.CoolerBoxId > 0 {
  112. m.CoolerBoxId = s.CoolerBoxId
  113. }
  114. if s.ControlBy.UpdateBy != 0 {
  115. m.UpdateBy = s.UpdateBy
  116. }
  117. if s.ControlBy.CreateBy != 0 {
  118. m.CreateBy = s.CreateBy
  119. }
  120. }
  121. func (s *WaybillUpdateReq) GetId() interface{} {
  122. return s.Id
  123. }
  124. type WaybillUpdateStatusReq struct {
  125. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  126. Status int `json:"status"` //药品数量
  127. model2.ControlBy `swaggerignore:"true"`
  128. model2.DeptBy `swaggerignore:"true"`
  129. }
  130. func (s *WaybillUpdateStatusReq) Generate(m *model.Waybill) {
  131. if s.Id != 0 {
  132. m.Id = s.Id
  133. }
  134. m.Status = s.Status
  135. if s.ControlBy.UpdateBy != 0 {
  136. m.UpdateBy = s.UpdateBy
  137. }
  138. if s.ControlBy.CreateBy != 0 {
  139. m.CreateBy = s.CreateBy
  140. }
  141. }
  142. func (s *WaybillUpdateStatusReq) GetId() interface{} {
  143. return s.Id
  144. }
  145. type WaybillDeliveryReq struct {
  146. WaybillIds []int `json:"waybillIds"` // 运单id
  147. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  148. model2.ControlBy `swaggerignore:"true"`
  149. model2.DeptBy `swaggerignore:"true"`
  150. }
  151. func (s *WaybillDeliveryReq) GetId() interface{} {
  152. return s.WaybillIds
  153. }
  154. type WaybillGetReq struct {
  155. Id int `uri:"id"`
  156. }
  157. func (s *WaybillGetReq) GetId() interface{} {
  158. return s.Id
  159. }
  160. type WaybillDeleteReq struct {
  161. Id int `json:"id"`
  162. common.ControlBy `swaggerignore:"true"`
  163. }
  164. func (s *WaybillDeleteReq) GetId() interface{} {
  165. return s.Id
  166. }
  167. // 运单出入库/上下车
  168. type WaybillInOutReq struct {
  169. StartTime model2.Time `json:"startTime"`
  170. WaybillNoList []string `json:"waybillNoList" gorm:"size:128"` // 订单编号
  171. }
  172. // 运单签收
  173. type WaybillReceiptReq struct {
  174. Status int `json:"status"` // 3 已签收 5 已拒收
  175. RejectionReason string `json:"rejectionReason"` // 拒收原因
  176. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 订单编号
  177. ReceiptImg string `json:"receiptImg" gorm:"size:128"` // 签收图片
  178. }
  179. type WaybillGetAppletPageReq struct {
  180. dto.Pagination `search:"-"`
  181. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  182. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  183. WaybillOrder
  184. }
  185. type WaybillGetAppletPageOrder struct {
  186. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  187. }
  188. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  189. return *m
  190. }
  191. type WaybillImportReq struct {
  192. CustomerName string `form:"customerName"` //下单客户名称
  193. }
  194. type WaybillStatsReq struct {
  195. Date string `form:"date"` // 日期
  196. Type string `form:"type"` // 类型 month-月 year-年
  197. }
  198. type WaybillStatsRes struct {
  199. TodayNum int64 `json:"todayNum"` // 今日总运单数
  200. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 已下单
  201. ReceiptNum int64 `json:"receiptNum"` // 已签收
  202. RejectionNum int64 `json:"rejectionNum"` // 已拒收
  203. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  204. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  205. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  206. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  207. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  208. Stats []struct {
  209. Date string `json:"date"` // 日期 2024-01-01
  210. Num int64 `json:"num"` // 数量
  211. } `json:"stats"`
  212. }
  213. type WaybillGetByWaybillNoReq struct {
  214. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  215. }
  216. type WaybillGetByWaybillPdfReq struct {
  217. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  218. HumidityShow bool `form:"humidityShow" vd:""` // 湿度显示
  219. //TemplateShow bool `form:"templateShow" vd:""` // 湿度显示
  220. }