waybill.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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. 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.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 WaybillUpdateReq struct {
  96. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  97. OrderNo string `json:"orderNo"`
  98. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  99. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  100. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  101. DeliveryName string `json:"deliveryName"` // 配送姓名
  102. DeliveryPhone string `json:"deliveryPhone"` // 配送电话
  103. DeliveryId int `json:"deliveryId"` // 配送id
  104. ReCheckId int `json:"reCheckId"` // 复核人id
  105. TamperProofLabel string `json:"tamperProofLabel"` //防拆标签
  106. TamperProofLabelImg string `json:"tamperProofLabelImg"` //防拆码标签图片
  107. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  108. Quantity int `json:"quantity"` //药品数量
  109. Remark string `json:"remark"` //运输备注
  110. CoolerBoxId int `json:"coolerBoxId"` //保温箱id
  111. model2.ControlBy `swaggerignore:"true"`
  112. model2.DeptBy `swaggerignore:"true"`
  113. }
  114. type WaybillUpdateReqaudit struct {
  115. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  116. OrderNo string `json:"orderNo"`
  117. Status int `json:"status"` // 状态
  118. PrescriptionIsAudit int `json:"prescriptionIssue" gorm:"size:128;default:1"` // 处方是否审核 1 未审核 2已审核
  119. InvoiceIsAudit int `json:"invoiceIssue" gorm:"size:128;default:1"` // 发票是否审核 1 未审核 2已审核
  120. InspectionReportIsAudit int `json:"inspectionReportIssue" gorm:"size:128;default:1"` // 检验报告是否审核 1 未审核 2已审核
  121. DispensingMedicinesIsAudit int `json:"dispensingMedicinesIssue" gorm:"size:128;default:1"` // 调配药品信息是否审核 1 未审核 2已审核
  122. IsCold int `json:"isCold" gorm:"size:128;default:1"` // 是否冷链 1 否 2 是
  123. AuditRemark string `json:"audit_remark" gorm:"size:255;default:''"` //驳回原因
  124. model2.ControlBy `swaggerignore:"true"`
  125. model2.DeptBy `swaggerignore:"true"`
  126. }
  127. type WaybillAdmin struct {
  128. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  129. AdminAuditRemark string `json:"admin_audit_remark"` //管理员审核备注
  130. model2.ControlBy `swaggerignore:"true"`
  131. model2.DeptBy `swaggerignore:"true"`
  132. }
  133. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  134. if s.Id != 0 {
  135. m.Id = s.Id
  136. }
  137. m.OrderNo = s.OrderNo
  138. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  139. m.ConsigneeAddressName = s.ConsigneeAddressName
  140. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  141. m.DeliveryName = s.DeliveryName
  142. m.DeliveryPhone = s.DeliveryPhone
  143. m.DeliveryId = s.DeliveryId
  144. m.ReCheckId = s.ReCheckId
  145. m.Quantity = s.Quantity
  146. m.Remark = s.Remark
  147. m.TamperProofLabel = s.TamperProofLabel
  148. m.TamperProofLabelImg = s.TamperProofLabelImg
  149. if s.CoolerBoxId > 0 {
  150. m.CoolerBoxId = s.CoolerBoxId
  151. }
  152. if s.ControlBy.UpdateBy != 0 {
  153. m.UpdateBy = s.UpdateBy
  154. }
  155. if s.ControlBy.CreateBy != 0 {
  156. m.CreateBy = s.CreateBy
  157. }
  158. }
  159. func (s *WaybillAdmin) Generate(m *model.Waybill) {
  160. if s.Id != 0 {
  161. m.Id = s.Id
  162. }
  163. m.AdminAuditRemark = s.AdminAuditRemark
  164. if s.ControlBy.UpdateBy != 0 {
  165. m.UpdateBy = s.UpdateBy
  166. }
  167. if s.ControlBy.CreateBy != 0 {
  168. m.CreateBy = s.CreateBy
  169. }
  170. }
  171. func (s *WaybillUpdateReqaudit) Generate(m *model.Waybill) {
  172. if s.Id != 0 {
  173. m.Id = s.Id
  174. }
  175. m.OrderNo = s.OrderNo
  176. m.PrescriptionIsAudit = s.PrescriptionIsAudit
  177. m.InvoiceIsAudit = s.InvoiceIsAudit
  178. m.InspectionReportIsAudit = s.InspectionReportIsAudit
  179. m.DispensingMedicinesIsAudit = s.DispensingMedicinesIsAudit
  180. m.IsCold = s.IsCold
  181. m.Status = s.Status
  182. }
  183. func (s *WaybillUpdateReq) GetId() interface{} {
  184. return s.Id
  185. }
  186. func (s *WaybillUpdateReqaudit) GetId() interface{} {
  187. return s.Id
  188. }
  189. func (s *WaybillAdmin) GetId() interface{} {
  190. return s.Id
  191. }
  192. type WaybillUpdateStatusReq struct {
  193. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  194. Status int `json:"status"` //订单状态
  195. model2.ControlBy `swaggerignore:"true"`
  196. model2.DeptBy `swaggerignore:"true"`
  197. }
  198. type UpdateStatusReq struct {
  199. Id []int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  200. Status int `json:"status"`
  201. model2.ControlBy `swaggerignore:"true"`
  202. model2.DeptBy `swaggerignore:"true"`
  203. }
  204. type WaybillUpdateStatusReqList struct {
  205. Id []int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  206. Status int `json:"status"` //订单状态
  207. model2.ControlBy `swaggerignore:"true"`
  208. model2.DeptBy `swaggerignore:"true"`
  209. }
  210. //func (s *WaybillUpdateStatusReq) Generate(m *model.Waybill) {
  211. // if s.Id != 0 {
  212. // m.Id = s.Id
  213. // }
  214. // m.Status = s.Status
  215. //
  216. // if s.ControlBy.UpdateBy != 0 {
  217. // m.UpdateBy = s.UpdateBy
  218. // }
  219. // if s.ControlBy.CreateBy != 0 {
  220. // m.CreateBy = s.CreateBy
  221. // }
  222. //}
  223. func (s *WaybillUpdateStatusReq) GetId() interface{} {
  224. return s.Id
  225. }
  226. func (s *UpdateStatusReq) GetId() interface{} {
  227. return s.Id
  228. }
  229. type WaybillDeliveryReq struct {
  230. WaybillIds []int `json:"waybillIds"` // 运单id
  231. DeliveryId int `json:"deliveryId"` // 配送人id
  232. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  233. IceRaftCode []string `json:"iceRaftCode"` // 冰排code
  234. Status int `json:"status"` // 配送状态
  235. OldIceRaftCode []string `json:"oldIceRaftCode" swaggerignore:"true"` // 旧的冰排code
  236. TamperProofLabel string `json:"tamperProofLabel" gorm:"size:128"` // 防拆标签
  237. TamperProofLabelImg string `json:"tamperProofLabelImg" gorm:"size:text"` // 防拆标签图片
  238. model2.ControlBy `swaggerignore:"true"`
  239. model2.DeptBy `swaggerignore:"true"`
  240. }
  241. func (s *WaybillDeliveryReq) GetId() interface{} {
  242. return s.WaybillIds
  243. }
  244. type WaybillGetReq struct {
  245. Id int `uri:"id"`
  246. }
  247. func (s *WaybillGetReq) GetId() interface{} {
  248. return s.Id
  249. }
  250. type WaybillDeleteReq struct {
  251. Id int `json:"id"`
  252. common.ControlBy `swaggerignore:"true"`
  253. }
  254. func (s *WaybillDeleteReq) GetId() interface{} {
  255. return s.Id
  256. }
  257. // 运单出入库/上下车
  258. type WaybillInOutReq struct {
  259. StartTime model2.Time `json:"startTime"`
  260. WaybillNoList []string `json:"waybillNoList"` // 订单编号
  261. }
  262. // 运单签收
  263. type WaybillReceiptReq struct {
  264. Status int `json:"status"` // 5 已签收 6 已拒收
  265. RejectionReason string `json:"rejectionReason"` // 拒收原因
  266. WaybillNo string `json:"waybillNo"` // 订单编号
  267. ReceiptImg string `json:"receiptImg"` // 签收图片凭证
  268. Receiptsign string `json:"receiptsign"` // 签收图片签字
  269. PaymentStatus int `json:"paymentStatus"` //支付状态 1 结清 2 未结清 3 支付完成
  270. PaymentType int `json:"paymentType"` //支付方式 1现金 2线上支付 3银行卡 4医保 5其他
  271. PaymentRemark string `json:"paymentremark"` //支付备注
  272. AssessStar int `json:"assessStar"` // 评价星星
  273. AssessContent string `json:"assessContent"` // 评价内容
  274. }
  275. type WaybillGetAppletPageReq struct {
  276. dto2.Pagination `search:"-"`
  277. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  278. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  279. WaybillOrder
  280. }
  281. type WaybillGetAppletPageOrder struct {
  282. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  283. }
  284. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  285. return *m
  286. }
  287. type WaybillImportReq struct {
  288. CustomerName string `form:"customerName"` //下单客户名称
  289. }
  290. type WaybillStatsReq struct {
  291. Date string `form:"date"` // 日期
  292. Type string `form:"type"` // 类型 month-月 year-年
  293. }
  294. type WaybillUserStatsReq struct {
  295. Date string `form:"date"` // 日期
  296. Type string `form:"type"` // 类型 month-月 year-年
  297. UserType string `form:"userType"` // 配送员 delivery-配送员 reCheck-复核员
  298. UserIds []int `form:"userId"` // 用户id
  299. }
  300. type WaybillStats struct {
  301. Date string `json:"date"` // 日期 2024-01-01
  302. Num int64 `json:"num"` // 数量
  303. }
  304. type WaybillUserStats struct {
  305. Name string
  306. Stats []WaybillStats `json:"stats"`
  307. }
  308. type WaybillStatsRes struct {
  309. TodayNum int64 `json:"todayNum"` // 今日总运单数
  310. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 已下单
  311. ReceiptNum int64 `json:"receiptNum"` // 已签收
  312. RejectionNum int64 `json:"rejectionNum"` // 已拒收
  313. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  314. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  315. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  316. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  317. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  318. Stats []WaybillStats `json:"stats"`
  319. }
  320. type WaybillGetByWaybillNoReq struct {
  321. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  322. }
  323. type WaybillGetByWaybillPdfReq struct {
  324. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  325. HumidityShow bool `form:"humidityShow" vd:""` // 湿度显示
  326. //TemplateShow bool `form:"templateShow" vd:""` // 湿度显示
  327. }
  328. type WaybillTurnarounds struct {
  329. WaybillNo string `json:"waybillNo" vd:"len($)>0;msg:'订单编号不能为空'"` // 运单编号-必填
  330. DeptId int `json:"deptId"` // 门店id
  331. }