waybill.go 15 KB

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