waybill.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. package dto
  2. import (
  3. "cold-logistics/app/admin/model"
  4. "cold-logistics/common/dto"
  5. common "cold-logistics/common/model"
  6. model2 "cold-logistics/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. Status int `form:"status" search:"type:exact;column:status;table:waybill"` // 状态
  14. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  15. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  16. WaybillOrder
  17. }
  18. type WaybillOrder struct {
  19. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill" form:"createdAtOrder" default:"desc"`
  20. }
  21. func (m *WaybillGetPageReq) GetNeedSearch() interface{} {
  22. return *m
  23. }
  24. type WaybillGetCustomerPageReq struct {
  25. dto.Pagination `search:"-"`
  26. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill"` // 运单编号
  27. Status int `form:"status" search:"-"` // 状态
  28. OrderStartTime string `form:"orderStartTime" search:"type:gte;column:order_time;table:waybill"` // 下单开始时间
  29. OrderEndTime string `form:"orderEndTime" search:"type:lte;column:order_time;table:waybill"` // 下单结束时间
  30. CustomerId int `form:"customerId" search:"type:exact;column:customer_id;table:waybill" swaggerignore:"true"` // 客户id
  31. WaybillOrder
  32. }
  33. func (m *WaybillGetCustomerPageReq) GetNeedSearch() interface{} {
  34. return *m
  35. }
  36. type WaybillInsertReq struct {
  37. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  38. No string `json:"no" swaggerignore:"true"` //单号
  39. Status int `json:"status" swaggerignore:"true"` //运单状态:1-待处理;102-待装车 103-运输中 104-已签收
  40. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  41. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  42. SenderAddressPhone string `json:"senderAddressPhone" vd:"regexp('^1[3-9]\\d{9}$');msg:'寄件人电话格式不正确'"` //发货地址电话
  43. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  44. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  45. ConsigneeAddressPhone string `json:"consigneeAddressPhone" vd:"regexp('^1[3-9]\\d{9}$');msg:'收件人电话格式不正确'"` //收发货地址电话
  46. CargoType string `json:"cargoType"` //货物类型
  47. TemperatureInterval string `json:"temperatureInterval"` //温度要求
  48. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  49. Quantity int `json:"quantity"` //药品数量
  50. Remark string `json:"remark"` //运输备注
  51. CustomerId int `json:"customerId"` //下单客户id
  52. CustomerName string `json:"customerName"` //下单客户名称
  53. CoolerBoxId int `json:"coolerBoxId"` //保温箱id
  54. model2.ControlBy `swaggerignore:"true"`
  55. model2.DeptBy
  56. }
  57. func (s *WaybillInsertReq) Generate(m *model.Waybill) {
  58. if s.Id != 0 {
  59. m.Id = s.Id
  60. }
  61. m.Status = 1
  62. m.SenderAddressDetails = s.SenderAddressDetails
  63. m.SenderAddressName = s.SenderAddressName
  64. m.SenderAddressPhone = s.SenderAddressPhone
  65. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  66. m.ConsigneeAddressName = s.ConsigneeAddressName
  67. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  68. m.CargoType = s.CargoType
  69. m.TemperatureInterval = s.TemperatureInterval
  70. m.DeliveryCondition = s.DeliveryCondition
  71. m.Quantity = s.Quantity
  72. m.Remark = s.Remark
  73. m.CustomerId = s.CustomerId
  74. m.CustomerName = s.CustomerName
  75. m.CoolerBoxId = s.CoolerBoxId
  76. m.OrderTime = model2.Time(time.Now())
  77. if s.ControlBy.UpdateBy != 0 {
  78. m.UpdateBy = s.UpdateBy
  79. }
  80. if s.ControlBy.CreateBy != 0 {
  81. m.CreateBy = s.CreateBy
  82. }
  83. if s.DeptBy.DeptId != 0 {
  84. m.DeptId = s.DeptId
  85. }
  86. }
  87. func (s *WaybillInsertReq) GetId() interface{} {
  88. return s.Id
  89. }
  90. type WaybillUpdateReq struct {
  91. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  92. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  93. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  94. SenderAddressPhone string `json:"senderAddressPhone"` //发货地址电话
  95. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  96. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  97. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  98. CargoType string `json:"cargoType"` //货物类型
  99. TemperatureInterval string `json:"temperatureInterval"` //温度要求
  100. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  101. Quantity int `json:"quantity"` //药品数量
  102. Remark string `json:"remark"` //运输备注
  103. CustomerName string `json:"customerName"` //下单客户名称
  104. model2.ControlBy `swaggerignore:"true"`
  105. model2.DeptBy `swaggerignore:"true"`
  106. }
  107. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  108. if s.Id != 0 {
  109. m.Id = s.Id
  110. }
  111. m.SenderAddressDetails = s.SenderAddressDetails
  112. m.SenderAddressName = s.SenderAddressName
  113. m.SenderAddressPhone = s.SenderAddressPhone
  114. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  115. m.ConsigneeAddressName = s.ConsigneeAddressName
  116. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  117. m.CargoType = s.CargoType
  118. m.TemperatureInterval = s.TemperatureInterval
  119. m.DeliveryCondition = s.DeliveryCondition
  120. m.Quantity = s.Quantity
  121. m.Remark = s.Remark
  122. m.CustomerName = s.CustomerName
  123. if s.ControlBy.UpdateBy != 0 {
  124. m.UpdateBy = s.UpdateBy
  125. }
  126. if s.ControlBy.CreateBy != 0 {
  127. m.CreateBy = s.CreateBy
  128. }
  129. }
  130. func (s *WaybillUpdateReq) GetId() interface{} {
  131. return s.Id
  132. }
  133. type WaybillDeliveryReq struct {
  134. WaybillIds []int `json:"waybillIds"` // 运单id
  135. Type int `json:"type"` // 派单类型 3司机 2仓管 4保温箱
  136. PrintUserId int `json:"printUserId"` // 制单人
  137. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  138. model2.ControlBy `swaggerignore:"true"`
  139. model2.DeptBy `swaggerignore:"true"`
  140. }
  141. func (s *WaybillDeliveryReq) GetId() interface{} {
  142. return s.WaybillIds
  143. }
  144. type WaybillGetReq struct {
  145. WaybillNo string `uri:"waybillNo"`
  146. }
  147. type WaybillDeleteReq struct {
  148. Id int `json:"id"`
  149. common.ControlBy `swaggerignore:"true"`
  150. }
  151. func (s *WaybillDeleteReq) GetId() interface{} {
  152. return s.Id
  153. }
  154. // 运单出入库/上下车
  155. type WaybillInOutReq struct {
  156. StartTime model2.Time `json:"startTime"`
  157. WaybillNoList []string `json:"waybillNoList"` // 运单编号
  158. }
  159. type WaybillCoolerBoxInReq struct {
  160. StartTime model2.Time `json:"startTime"`
  161. WaybillNoList []string `json:"waybillNoList" ` // 运单编号
  162. CoolerBoxId int `json:"coolerBoxId"` // 保温箱id
  163. }
  164. // 运单签收
  165. type WaybillReceiptReq struct {
  166. StartTime model2.Time `json:"startTime"`
  167. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 运单编号
  168. ReceiptImg string `json:"receiptImg" gorm:"size:128"` // 签收图片
  169. }
  170. type WaybillStopRecordReq struct {
  171. StartTime model2.Time `json:"startTime"`
  172. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 运单编号
  173. }
  174. type WaybillGetAppletPageReq struct {
  175. dto.Pagination `search:"-"`
  176. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  177. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  178. WaybillOrder
  179. }
  180. type WaybillGetAppletPageOrder struct {
  181. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  182. }
  183. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  184. return *m
  185. }
  186. type WaybillImportReq struct {
  187. CustomerName string `form:"customerName"` //下单客户名称
  188. }
  189. type WaybillStatsReq struct {
  190. Date string `form:"date"` // 日期
  191. Type string `form:"type"` // 类型 month-月 year-年
  192. }
  193. type WaybillStatsRes struct {
  194. TodayNum int64 `json:"todayNum"` // 今日总运单数
  195. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 待派单
  196. WaitTruckNum int64 `json:"waitTruckNum"` // 未装车
  197. WaitStorageNum int64 `json:"waitStorageNum"` // 未入库
  198. WaitVanningNum int64 `json:"waitVanningNum"` // 未装箱
  199. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  200. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  201. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  202. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  203. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  204. Stats []struct {
  205. Date string `json:"date"` // 日期 2024-01-01
  206. Num int64 `json:"num"` // 数量
  207. } `json:"stats"`
  208. }
  209. type WaybillGetByWaybillNoReq struct {
  210. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'运单编号不能为空'"` // 运单编号-必填
  211. }
  212. type WaybillPdfReq struct {
  213. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'运单编号不能为空'"` // 运单编号-必填
  214. WaybillTaskIds []int `form:"waybillTaskIds" vd:""` // 运单任务id
  215. }
  216. type WaybillGetByWaybillPdfReq struct {
  217. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'运单编号不能为空'"` // 运单编号-必填
  218. HumidityShow bool `form:"humidityShow" vd:""` // 湿度显示
  219. WaybillTaskIds []int `form:"waybillTaskIds" vd:""` // 运单任务id
  220. //TemplateShow bool `form:"templateShow" vd:""` // 湿度显示
  221. }
  222. type WaybillSendMailPdfReq struct {
  223. WaybillNo string `form:"waybillNo" vd:"len($)>0;msg:'运单编号不能为空'"` // 运单编号-必填
  224. HumidityShow bool `form:"humidityShow" vd:""` // 湿度显示
  225. WaybillTaskIds []int `form:"waybillTaskIds" vd:""` // 运单任务id
  226. To []string `form:"to" vd:""` // 收件人
  227. }
  228. type WaybillLogisticsUpdateReq struct {
  229. WaybillLogisticsList []struct {
  230. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  231. Time model2.Time `json:"time" gorm:"size:128"` // 开始时间
  232. } `json:"waybillLogistics"`
  233. model2.ControlBy `swaggerignore:"true"`
  234. model2.DeptBy `swaggerignore:"true"`
  235. }