waybill.go 12 KB

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