waybill.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. OrderNo string `form:"orderNo" search:"type:contains;column:order_no;table:waybill"` // 运单编号
  14. Status int `form:"status" search:"type:exact;column:status;table:waybill"` // 状态
  15. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  16. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  17. WaybillOrder
  18. }
  19. type WaybillOrder struct {
  20. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill" form:"createdAtOrder" default:"desc"`
  21. }
  22. func (m *WaybillGetPageReq) GetNeedSearch() interface{} {
  23. return *m
  24. }
  25. type WaybillGetCustomerPageReq struct {
  26. dto.Pagination `search:"-"`
  27. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill"` // 运单编号
  28. OrderNo string `form:"orderNo" search:"type:contains;column:order_no;table:waybill"` // 运单编号
  29. Status int `form:"status" search:"-"` // 状态
  30. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  31. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  32. CustomerId int `form:"customerId" search:"type:exact;column:customer_id;table:waybill" swaggerignore:"true"` // 客户id
  33. WaybillOrder
  34. }
  35. func (m *WaybillGetCustomerPageReq) GetNeedSearch() interface{} {
  36. return *m
  37. }
  38. type WaybillInsertReq struct {
  39. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  40. No string `json:"no" swaggerignore:"true"` //单号
  41. OrderNo string `json:"orderNo"` // 订单号
  42. Status int `json:"status" swaggerignore:"true"` //订单状态:1-待处理;102-待装车 103-运输中 104-已签收
  43. SaveConsigneeAddress bool `json:"SaveConsigneeAddress"` //保存收货地址
  44. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  45. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  46. ConsigneeAddressPhone string `json:"consigneeAddressPhone" vd:"regexp('^1[3-9]\\d{9}$');msg:'收件人电话格式不正确'"` //收发货地址电话
  47. DeliveryName string `json:"deliveryName"` // 配送姓名
  48. DeliveryPhone string `json:"deliveryPhone"` // 配送电话
  49. DeliveryId int `json:"deliveryId"` // 配送人id
  50. ReCheckId int `json:"reCheckId"` // 复核人id
  51. Quantity int `json:"quantity"` // 药品数量
  52. Remark string `json:"remark"` // 运输备注
  53. TamperProofLabel string `json:"tamperProofLabel"` // 防拆码标签
  54. TamperProofLabelImg string `json:"tamperProofLabelImg"` // 防拆码标签图片
  55. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  56. model2.ControlBy `swaggerignore:"true"`
  57. model2.DeptBy
  58. }
  59. func (s *WaybillInsertReq) Generate(m *model.Waybill) {
  60. if s.Id != 0 {
  61. m.Id = s.Id
  62. }
  63. m.Status = 1
  64. m.OrderNo = s.OrderNo
  65. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  66. m.ConsigneeAddressName = s.ConsigneeAddressName
  67. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  68. m.DeliveryName = s.DeliveryName
  69. m.DeliveryPhone = s.DeliveryPhone
  70. m.DeliveryId = s.DeliveryId
  71. m.ReCheckId = s.ReCheckId
  72. m.Quantity = s.Quantity
  73. m.Remark = s.Remark
  74. m.TamperProofLabel = s.TamperProofLabel
  75. m.TamperProofLabelImg = s.TamperProofLabelImg
  76. m.CoolerBoxId = s.CoolerBoxId
  77. m.OrderTime = model2.Time(time.Now())
  78. if s.ControlBy.UpdateBy != 0 {
  79. m.UpdateBy = s.UpdateBy
  80. }
  81. if s.ControlBy.CreateBy != 0 {
  82. m.CreateBy = s.CreateBy
  83. }
  84. if s.DeptBy.DeptId != 0 {
  85. m.DeptId = s.DeptId
  86. }
  87. }
  88. func (s *WaybillInsertReq) GetId() interface{} {
  89. return s.Id
  90. }
  91. type WaybillUpdateReq struct {
  92. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  93. OrderNo string `json:"orderNo"`
  94. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  95. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  96. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  97. DeliveryName string `json:"deliveryName"` // 配送姓名
  98. DeliveryPhone string `json:"deliveryPhone"` // 配送电话
  99. DeliveryId int `json:"deliveryId"` // 配送id
  100. ReCheckId int `json:"reCheckId"` // 复核人id
  101. TamperProofLabel string `json:"tamperProofLabel"` //防拆标签
  102. TamperProofLabelImg string `json:"tamperProofLabelImg"` //防拆码标签图片
  103. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  104. Quantity int `json:"quantity"` //药品数量
  105. Remark string `json:"remark"` //运输备注
  106. CoolerBoxId int `json:"coolerBoxId"` //保温箱id
  107. model2.ControlBy `swaggerignore:"true"`
  108. model2.DeptBy `swaggerignore:"true"`
  109. }
  110. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  111. if s.Id != 0 {
  112. m.Id = s.Id
  113. }
  114. m.OrderNo = s.OrderNo
  115. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  116. m.ConsigneeAddressName = s.ConsigneeAddressName
  117. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  118. m.DeliveryName = s.DeliveryName
  119. m.DeliveryPhone = s.DeliveryPhone
  120. m.DeliveryId = s.DeliveryId
  121. m.ReCheckId = s.ReCheckId
  122. m.Quantity = s.Quantity
  123. m.Remark = s.Remark
  124. m.TamperProofLabel = s.TamperProofLabel
  125. m.TamperProofLabelImg = s.TamperProofLabelImg
  126. if s.CoolerBoxId > 0 {
  127. m.CoolerBoxId = s.CoolerBoxId
  128. }
  129. if s.ControlBy.UpdateBy != 0 {
  130. m.UpdateBy = s.UpdateBy
  131. }
  132. if s.ControlBy.CreateBy != 0 {
  133. m.CreateBy = s.CreateBy
  134. }
  135. }
  136. func (s *WaybillUpdateReq) GetId() interface{} {
  137. return s.Id
  138. }
  139. type WaybillUpdateStatusReq struct {
  140. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  141. Status int `json:"status"` //药品数量
  142. model2.ControlBy `swaggerignore:"true"`
  143. model2.DeptBy `swaggerignore:"true"`
  144. }
  145. func (s *WaybillUpdateStatusReq) Generate(m *model.Waybill) {
  146. if s.Id != 0 {
  147. m.Id = s.Id
  148. }
  149. m.Status = s.Status
  150. if s.ControlBy.UpdateBy != 0 {
  151. m.UpdateBy = s.UpdateBy
  152. }
  153. if s.ControlBy.CreateBy != 0 {
  154. m.CreateBy = s.CreateBy
  155. }
  156. }
  157. func (s *WaybillUpdateStatusReq) GetId() interface{} {
  158. return s.Id
  159. }
  160. type WaybillDeliveryReq struct {
  161. WaybillIds []int `json:"waybillIds"` // 运单id
  162. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  163. IceRaftCode []string `json:"iceRaftCode"` // 冰排code
  164. OldIceRaftCode []string `json:"oldIceRaftCode" swaggerignore:"true"` // 旧的冰排code
  165. model2.ControlBy `swaggerignore:"true"`
  166. model2.DeptBy `swaggerignore:"true"`
  167. }
  168. func (s *WaybillDeliveryReq) GetId() interface{} {
  169. return s.WaybillIds
  170. }
  171. type WaybillGetReq struct {
  172. Id int `uri:"id"`
  173. }
  174. func (s *WaybillGetReq) GetId() interface{} {
  175. return s.Id
  176. }
  177. type WaybillDeleteReq struct {
  178. Id int `json:"id"`
  179. common.ControlBy `swaggerignore:"true"`
  180. }
  181. func (s *WaybillDeleteReq) GetId() interface{} {
  182. return s.Id
  183. }
  184. // 运单出入库/上下车
  185. type WaybillInOutReq struct {
  186. StartTime model2.Time `json:"startTime"`
  187. WaybillNoList []string `json:"waybillNoList"` // 订单编号
  188. }
  189. // 运单签收
  190. type WaybillReceiptReq struct {
  191. Status int `json:"status"` // 3 已签收 5 已拒收
  192. RejectionReason string `json:"rejectionReason"` // 拒收原因
  193. WaybillNo string `json:"waybillNo"` // 订单编号
  194. ReceiptImg string `json:"receiptImg"` // 签收图片
  195. AssessStar int `json:"assessStar"` // 评价星星
  196. AssessContent string `json:"assessContent"` // 评价内容
  197. }
  198. type WaybillGetAppletPageReq struct {
  199. dto.Pagination `search:"-"`
  200. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  201. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  202. WaybillOrder
  203. }
  204. type WaybillGetAppletPageOrder struct {
  205. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  206. }
  207. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  208. return *m
  209. }
  210. type WaybillImportReq struct {
  211. CustomerName string `form:"customerName"` //下单客户名称
  212. }
  213. type WaybillStatsReq struct {
  214. Date string `form:"date"` // 日期
  215. Type string `form:"type"` // 类型 month-月 year-年
  216. }
  217. type WaybillUserStatsReq struct {
  218. Date string `form:"date"` // 日期
  219. Type string `form:"type"` // 类型 month-月 year-年
  220. UserType string `form:"userType"` // 配送员 delivery-配送员 reCheck-复核员
  221. UserIds []int `form:"userId"` // 用户id
  222. }
  223. type WaybillStats struct {
  224. Date string `json:"date"` // 日期 2024-01-01
  225. Num int64 `json:"num"` // 数量
  226. }
  227. type WaybillUserStats struct {
  228. Name string
  229. Stats []WaybillStats `json:"stats"`
  230. }
  231. type WaybillStatsRes struct {
  232. TodayNum int64 `json:"todayNum"` // 今日总运单数
  233. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 已下单
  234. ReceiptNum int64 `json:"receiptNum"` // 已签收
  235. RejectionNum int64 `json:"rejectionNum"` // 已拒收
  236. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  237. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  238. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  239. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  240. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  241. Stats []WaybillStats `json:"stats"`
  242. }
  243. type WaybillGetByWaybillNoReq struct {
  244. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  245. }
  246. type WaybillGetByWaybillPdfReq struct {
  247. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  248. HumidityShow bool `form:"humidityShow" vd:""` // 湿度显示
  249. //TemplateShow bool `form:"templateShow" vd:""` // 湿度显示
  250. }