waybill.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. package dto
  2. import (
  3. "cold-delivery/app/admin/model"
  4. dto2 "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. dto2.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. AssignmentStatus int `form:"assignment_status" search:"type:exact;column:assignment_status;table:waybill"` //分配状态 1 未分配 2已分配
  16. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  17. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  18. WaybillOrder
  19. }
  20. type WaybillOrder struct {
  21. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill" form:"createdAtOrder" default:"desc"`
  22. }
  23. func (m *WaybillGetPageReq) GetNeedSearch() interface{} {
  24. return *m
  25. }
  26. type WaybillGetCustomerPageReq struct {
  27. dto2.Pagination `search:"-"`
  28. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill"` // 运单编号
  29. OrderNo string `form:"orderNo" search:"type:contains;column:order_no;table:waybill"` // 运单编号
  30. Status int `form:"status" search:"-"` // 状态
  31. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  32. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  33. CustomerId int `form:"customerId" search:"type:exact;column:customer_id;table:waybill" swaggerignore:"true"` // 客户id
  34. WaybillOrder
  35. }
  36. func (m *WaybillGetCustomerPageReq) GetNeedSearch() interface{} {
  37. return *m
  38. }
  39. type WaybillInsertReq struct {
  40. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  41. No string `json:"no" swaggerignore:"true"` //单号
  42. OrderNo string `json:"orderNo"` // 订单号
  43. Status int `json:"status" swaggerignore:"true"` //订单状态:1-待处理;102-待装车 103-运输中 104-已签收
  44. SaveConsigneeAddress bool `json:"SaveConsigneeAddress"` //保存收货地址
  45. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  46. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  47. ConsigneeAddressPhone string `json:"consigneeAddressPhone" vd:"regexp('^1[3-9]\\d{9}$');msg:'收件人电话格式不正确'"` //收发货地址电话
  48. DeliveryName string `json:"deliveryName"` // 配送姓名
  49. DeliveryPhone string `json:"deliveryPhone"` // 配送电话
  50. DeliveryId int `json:"deliveryId"` // 配送人id
  51. ReCheckId int `json:"reCheckId"` // 复核人id
  52. Quantity int `json:"quantity"` // 药品数量
  53. Remark string `json:"remark"` // 运输备注
  54. TamperProofLabel string `json:"tamperProofLabel"` // 防拆码标签
  55. TamperProofLabelImg string `json:"tamperProofLabelImg"` // 防拆码标签图片
  56. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  57. IsSecondaryDistribution bool `json:"is_secondary_distribution"` //是否二次分配
  58. Drugs []model.Drug `json:"drugs"` //药品信息
  59. IsPhone bool `json:"is_phone"` //是否手机添加订单
  60. model2.ControlBy `swaggerignore:"true"`
  61. model2.DeptBy
  62. }
  63. func (s *WaybillInsertReq) Generate(m *model.Waybill) {
  64. if s.Id != 0 {
  65. m.Id = s.Id
  66. }
  67. m.Status = 1
  68. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  69. m.ConsigneeAddressName = s.ConsigneeAddressName
  70. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  71. m.DeliveryName = s.DeliveryName
  72. m.DeliveryPhone = s.DeliveryPhone
  73. m.DeliveryId = s.DeliveryId
  74. m.ReCheckId = s.ReCheckId
  75. m.Quantity = s.Quantity
  76. m.Remark = s.Remark
  77. m.TamperProofLabel = s.TamperProofLabel
  78. m.TamperProofLabelImg = s.TamperProofLabelImg
  79. m.CoolerBoxId = s.CoolerBoxId
  80. m.IsSecondaryDistribution = s.IsSecondaryDistribution
  81. m.OrderTime = model2.Time(time.Now())
  82. if s.ControlBy.UpdateBy != 0 {
  83. m.UpdateBy = s.UpdateBy
  84. }
  85. if s.ControlBy.CreateBy != 0 {
  86. m.CreateBy = s.CreateBy
  87. }
  88. if s.DeptBy.DeptId != 0 {
  89. m.DeptId = s.DeptId
  90. }
  91. }
  92. func (s *WaybillInsertReq) GetId() interface{} {
  93. return s.Id
  94. }
  95. type WaybillAssignment struct {
  96. WaybillNo string `json:"waybillNo" comment:"运单号" swaggerignore:"true"` // 编码
  97. OrderNo string `json:"orderNo"` // 订单号
  98. Status int `json:"status" swaggerignore:"true"` //订单状态:1-待处理;102-待装车 103-运输中 104-已签收
  99. SaveConsigneeAddress bool `json:"SaveConsigneeAddress"` //保存收货地址
  100. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  101. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  102. ConsigneeAddressPhone string `json:"consigneeAddressPhone" vd:"regexp('^1[3-9]\\d{9}$');msg:'收件人电话格式不正确'"` //收发货地址电话
  103. DeliveryName string `json:"deliveryName"` // 配送姓名
  104. DeliveryPhone string `json:"deliveryPhone"` // 配送电话
  105. DeliveryId int `json:"deliveryId"` // 配送人id
  106. ReCheckId int `json:"reCheckId"` // 复核人id
  107. Quantity int `json:"quantity"` // 药品数量
  108. Remark string `json:"remark"` // 运输备注
  109. TamperProofLabel string `json:"tamperProofLabel"` // 防拆码标签
  110. TamperProofLabelImg string `json:"tamperProofLabelImg"` // 防拆码标签图片
  111. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  112. IsSecondaryDistribution bool `json:"is_secondary_distribution"` //是否二次分配
  113. Drugs []model.Drug `json:"drugs"` //药品信息
  114. model2.ControlBy `swaggerignore:"true"`
  115. model2.DeptBy
  116. }
  117. func (s *WaybillAssignment) Generate(m *model.Waybill) {
  118. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  119. m.ConsigneeAddressName = s.ConsigneeAddressName
  120. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  121. m.DeliveryName = s.DeliveryName
  122. m.DeliveryPhone = s.DeliveryPhone
  123. m.DeliveryId = s.DeliveryId
  124. m.ReCheckId = s.ReCheckId
  125. m.Quantity = s.Quantity
  126. m.Remark = s.Remark
  127. m.TamperProofLabel = s.TamperProofLabel
  128. m.TamperProofLabelImg = s.TamperProofLabelImg
  129. m.CoolerBoxId = s.CoolerBoxId
  130. m.IsSecondaryDistribution = s.IsSecondaryDistribution
  131. m.OrderTime = model2.Time(time.Now())
  132. if s.ControlBy.UpdateBy != 0 {
  133. m.UpdateBy = s.UpdateBy
  134. }
  135. if s.ControlBy.CreateBy != 0 {
  136. m.CreateBy = s.CreateBy
  137. }
  138. if s.DeptBy.DeptId != 0 {
  139. m.DeptId = s.DeptId
  140. }
  141. }
  142. type WaybillUpdateReq struct {
  143. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  144. OrderNo string `json:"orderNo"`
  145. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  146. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  147. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  148. DeliveryName string `json:"deliveryName"` // 配送姓名
  149. DeliveryPhone string `json:"deliveryPhone"` // 配送电话
  150. DeliveryId int `json:"deliveryId"` // 配送id
  151. ReCheckId int `json:"reCheckId"` // 复核人id
  152. TamperProofLabel string `json:"tamperProofLabel"` //防拆标签
  153. TamperProofLabelImg string `json:"tamperProofLabelImg"` //防拆码标签图片
  154. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  155. Quantity int `json:"quantity"` //药品数量
  156. Remark string `json:"remark"` //运输备注
  157. CoolerBoxId int `json:"coolerBoxId"` //保温箱id
  158. model2.ControlBy `swaggerignore:"true"`
  159. model2.DeptBy `swaggerignore:"true"`
  160. }
  161. type WaybillUpdateReqaudit struct {
  162. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  163. OrderNo string `json:"orderNo"`
  164. Status int `json:"status"` // 状态
  165. PrescriptionIsAudit int `json:"prescriptionIssue" gorm:"size:128;default:1"` // 处方是否审核 1 未审核 2已审核
  166. InvoiceIsAudit int `json:"invoiceIssue" gorm:"size:128;default:1"` // 发票是否审核 1 未审核 2已审核
  167. InspectionReportIsAudit int `json:"inspectionReportIssue" gorm:"size:128;default:1"` // 检验报告是否审核 1 未审核 2已审核
  168. DispensingMedicinesIsAudit int `json:"dispensingMedicinesIssue" gorm:"size:128;default:1"` // 调配药品信息是否审核 1 未审核 2已审核
  169. IsCold int `json:"isCold" gorm:"size:128;default:1"` // 是否冷链 1 否 2 是
  170. AuditRemark string `json:"audit_remark" gorm:"size:255;default:''"` //驳回原因
  171. model2.ControlBy `swaggerignore:"true"`
  172. model2.DeptBy `swaggerignore:"true"`
  173. }
  174. type WaybillAdmin struct {
  175. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  176. AdminAuditRemark string `json:"admin_audit_remark"` //管理员审核备注
  177. model2.ControlBy `swaggerignore:"true"`
  178. model2.DeptBy `swaggerignore:"true"`
  179. }
  180. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  181. if s.Id != 0 {
  182. m.Id = s.Id
  183. }
  184. m.OrderNo = s.OrderNo
  185. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  186. m.ConsigneeAddressName = s.ConsigneeAddressName
  187. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  188. m.DeliveryName = s.DeliveryName
  189. m.DeliveryPhone = s.DeliveryPhone
  190. m.DeliveryId = s.DeliveryId
  191. m.ReCheckId = s.ReCheckId
  192. m.Quantity = s.Quantity
  193. m.Remark = s.Remark
  194. m.TamperProofLabel = s.TamperProofLabel
  195. m.TamperProofLabelImg = s.TamperProofLabelImg
  196. if s.CoolerBoxId > 0 {
  197. m.CoolerBoxId = s.CoolerBoxId
  198. }
  199. if s.ControlBy.UpdateBy != 0 {
  200. m.UpdateBy = s.UpdateBy
  201. }
  202. if s.ControlBy.CreateBy != 0 {
  203. m.CreateBy = s.CreateBy
  204. }
  205. }
  206. func (s *WaybillAdmin) Generate(m *model.Waybill) {
  207. if s.Id != 0 {
  208. m.Id = s.Id
  209. }
  210. m.AdminAuditRemark = s.AdminAuditRemark
  211. if s.ControlBy.UpdateBy != 0 {
  212. m.UpdateBy = s.UpdateBy
  213. }
  214. if s.ControlBy.CreateBy != 0 {
  215. m.CreateBy = s.CreateBy
  216. }
  217. }
  218. func (s *WaybillUpdateReqaudit) Generate(m *model.Waybill) {
  219. if s.Id != 0 {
  220. m.Id = s.Id
  221. }
  222. m.OrderNo = s.OrderNo
  223. m.PrescriptionIsAudit = s.PrescriptionIsAudit
  224. m.InvoiceIsAudit = s.InvoiceIsAudit
  225. m.InspectionReportIsAudit = s.InspectionReportIsAudit
  226. m.DispensingMedicinesIsAudit = s.DispensingMedicinesIsAudit
  227. m.IsCold = s.IsCold
  228. m.Status = s.Status
  229. }
  230. func (s *WaybillUpdateReq) GetId() interface{} {
  231. return s.Id
  232. }
  233. func (s *WaybillUpdateReqaudit) GetId() interface{} {
  234. return s.Id
  235. }
  236. func (s *WaybillAdmin) GetId() interface{} {
  237. return s.Id
  238. }
  239. type WaybillUpdateStatusReq struct {
  240. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  241. Status int `json:"status"` //订单状态
  242. model2.ControlBy `swaggerignore:"true"`
  243. model2.DeptBy `swaggerignore:"true"`
  244. }
  245. type UpdateStatusReq struct {
  246. Id []int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  247. Status int `json:"status"`
  248. model2.ControlBy `swaggerignore:"true"`
  249. model2.DeptBy `swaggerignore:"true"`
  250. }
  251. type WaybillUpdateStatusReqList struct {
  252. Id []int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  253. Status int `json:"status"` //订单状态
  254. model2.ControlBy `swaggerignore:"true"`
  255. model2.DeptBy `swaggerignore:"true"`
  256. }
  257. //func (s *WaybillUpdateStatusReq) Generate(m *model.Waybill) {
  258. // if s.Id != 0 {
  259. // m.Id = s.Id
  260. // }
  261. // m.Status = s.Status
  262. //
  263. // if s.ControlBy.UpdateBy != 0 {
  264. // m.UpdateBy = s.UpdateBy
  265. // }
  266. // if s.ControlBy.CreateBy != 0 {
  267. // m.CreateBy = s.CreateBy
  268. // }
  269. //}
  270. func (s *WaybillUpdateStatusReq) GetId() interface{} {
  271. return s.Id
  272. }
  273. func (s *UpdateStatusReq) GetId() interface{} {
  274. return s.Id
  275. }
  276. type WaybillDeliveryReq struct {
  277. WaybillIds []int `json:"waybillIds"` // 运单id
  278. DeliveryId int `json:"deliveryId"` // 配送人id
  279. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  280. IceRaftCode []string `json:"iceRaftCode"` // 冰排code
  281. Status int `json:"status"` // 配送状态
  282. OldIceRaftCode []string `json:"oldIceRaftCode" swaggerignore:"true"` // 旧的冰排code
  283. TamperProofLabel string `json:"tamperProofLabel" gorm:"size:128"` // 防拆标签
  284. TamperProofLabelImg string `json:"tamperProofLabelImg" gorm:"size:text"` // 防拆标签图片
  285. model2.ControlBy `swaggerignore:"true"`
  286. model2.DeptBy `swaggerignore:"true"`
  287. }
  288. func (s *WaybillDeliveryReq) GetId() interface{} {
  289. return s.WaybillIds
  290. }
  291. type WaybillGetReq struct {
  292. Id int `uri:"id"`
  293. }
  294. func (s *WaybillGetReq) GetId() interface{} {
  295. return s.Id
  296. }
  297. type WaybillDeleteReq struct {
  298. Id int `json:"id"`
  299. common.ControlBy `swaggerignore:"true"`
  300. }
  301. func (s *WaybillDeleteReq) GetId() interface{} {
  302. return s.Id
  303. }
  304. // 运单出入库/上下车
  305. type WaybillInOutReq struct {
  306. StartTime model2.Time `json:"startTime"`
  307. WaybillNoList []string `json:"waybillNoList"` // 订单编号
  308. }
  309. // 运单签收
  310. type WaybillReceiptReq struct {
  311. Status int `json:"status"` // 5 已签收 6 已拒收
  312. RejectionReason string `json:"rejectionReason"` // 拒收原因
  313. WaybillNo string `json:"waybillNo"` // 订单编号
  314. ReceiptImg string `json:"receiptImg"` // 签收图片凭证
  315. Receiptsign string `json:"receiptsign"` // 签收图片签字
  316. PaymentStatus int `json:"paymentStatus"` //支付状态 1 结清 2 未结清 3 支付完成
  317. PaymentType int `json:"paymentType"` //支付方式 1现金 2线上支付 3银行卡 4医保 5其他
  318. PaymentRemark string `json:"paymentremark"` //支付备注
  319. AssessStar int `json:"assessStar"` // 评价星星
  320. AssessContent string `json:"assessContent"` // 评价内容
  321. }
  322. type WaybillGetAppletPageReq struct {
  323. dto2.Pagination `search:"-"`
  324. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  325. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  326. WaybillOrder
  327. }
  328. type WaybillGetAppletPageOrder struct {
  329. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  330. }
  331. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  332. return *m
  333. }
  334. type WaybillImportReq struct {
  335. CustomerName string `form:"customerName"` //下单客户名称
  336. }
  337. type WaybillStatsReq struct {
  338. Date string `form:"date"` // 日期
  339. Type string `form:"type"` // 类型 month-月 year-年
  340. }
  341. type WaybillUserStatsReq struct {
  342. Date string `form:"date"` // 日期
  343. Type string `form:"type"` // 类型 month-月 year-年
  344. UserType string `form:"userType"` // 配送员 delivery-配送员 reCheck-复核员
  345. UserIds []int `form:"userId"` // 用户id
  346. }
  347. type WaybillStats struct {
  348. Date string `json:"date"` // 日期 2024-01-01
  349. Num int64 `json:"num"` // 数量
  350. }
  351. type WaybillUserStats struct {
  352. Name string
  353. Stats []WaybillStats `json:"stats"`
  354. }
  355. type WaybillStatsRes struct {
  356. TodayNum int64 `json:"todayNum"` // 今日总运单数
  357. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 已下单
  358. ReceiptNum int64 `json:"receiptNum"` // 已签收
  359. RejectionNum int64 `json:"rejectionNum"` // 已拒收
  360. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  361. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  362. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  363. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  364. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  365. Stats []WaybillStats `json:"stats"`
  366. }
  367. type WaybillGetByWaybillNoReq struct {
  368. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  369. }
  370. type WaybillGetByWaybillPdfReq struct {
  371. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  372. HumidityShow bool `form:"humidityShow" vd:""` // 湿度显示
  373. //TemplateShow bool `form:"templateShow" vd:""` // 湿度显示
  374. }
  375. type WaybillTurnarounds struct {
  376. WaybillNo string `json:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  377. DeptId int `json:"deptId"` // 门店id
  378. }