waybill.go 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. WaybillOrder
  15. }
  16. type WaybillOrder struct {
  17. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill" form:"createdAtOrder" default:"desc"`
  18. }
  19. func (m *WaybillGetPageReq) GetNeedSearch() interface{} {
  20. return *m
  21. }
  22. type WaybillGetCustomerPageReq struct {
  23. dto.Pagination `search:"-"`
  24. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill"` // 运单编号
  25. Status int `form:"status" search:"-"` // 状态
  26. CustomerId int `form:"customerId" search:"type:exact;column:customer_id;table:waybill" swaggerignore:"true"` // 客户id
  27. WaybillOrder
  28. }
  29. func (m *WaybillGetCustomerPageReq) GetNeedSearch() interface{} {
  30. return *m
  31. }
  32. type WaybillInsertReq struct {
  33. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  34. No string `json:"no" swaggerignore:"true"` //单号
  35. Status int `json:"status" swaggerignore:"true"` //订单状态:1-待处理;102-待装车 103-运输中 104-已签收
  36. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  37. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  38. SenderAddressPhone string `json:"senderAddressPhone"` //发货地址电话
  39. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  40. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  41. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  42. CargoType string `json:"cargoType"` //货物类型
  43. TemperatureInterval string `json:"temperatureInterval"` //温度要求
  44. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  45. Remark string `json:"remark"` //运输备注
  46. CustomerId int `json:"customerId"` //下单客户id
  47. CustomerName string `json:"customerName"` //下单客户名称
  48. model2.ControlBy `swaggerignore:"true"`
  49. model2.DeptBy
  50. }
  51. func (s *WaybillInsertReq) Generate(m *model.Waybill) {
  52. if s.Id != 0 {
  53. m.Id = s.Id
  54. }
  55. m.Status = 1
  56. m.SenderAddressDetails = s.SenderAddressDetails
  57. m.SenderAddressName = s.SenderAddressName
  58. m.SenderAddressPhone = s.SenderAddressPhone
  59. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  60. m.ConsigneeAddressName = s.ConsigneeAddressName
  61. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  62. m.CargoType = s.CargoType
  63. m.TemperatureInterval = s.TemperatureInterval
  64. m.DeliveryCondition = s.DeliveryCondition
  65. m.Remark = s.Remark
  66. m.CustomerId = s.CustomerId
  67. m.CustomerName = s.CustomerName
  68. m.OrderTime = model2.Time(time.Now())
  69. if s.ControlBy.UpdateBy != 0 {
  70. m.UpdateBy = s.UpdateBy
  71. }
  72. if s.ControlBy.CreateBy != 0 {
  73. m.CreateBy = s.CreateBy
  74. }
  75. if s.DeptBy.DeptId != 0 {
  76. m.DeptId = s.DeptId
  77. }
  78. }
  79. func (s *WaybillInsertReq) GetId() interface{} {
  80. return s.Id
  81. }
  82. type WaybillUpdateReq struct {
  83. Id int `json:"id" comment:"编码" swaggerignore:"true"` // 编码
  84. SenderAddressDetails string `json:"senderAddressDetails"` //发货地址详情
  85. SenderAddressName string `json:"senderAddressName"` //发货地址名称
  86. SenderAddressPhone string `json:"senderAddressPhone"` //发货地址电话
  87. ConsigneeAddressDetails string `json:"consigneeAddressDetails"` //收发货地址详情
  88. ConsigneeAddressName string `json:"consigneeAddressName"` //收发货地址名称
  89. ConsigneeAddressPhone string `json:"consigneeAddressPhone"` //收发货地址电话
  90. CargoType string `json:"cargoType"` //货物类型
  91. TemperatureInterval string `json:"temperatureInterval"` //温度要求
  92. DeliveryCondition string `json:"deliveryCondition"` //配送要求
  93. Remark string `json:"remark"` //运输备注
  94. CustomerName string `json:"customerName"` //下单客户名称
  95. model2.ControlBy `swaggerignore:"true"`
  96. model2.DeptBy `swaggerignore:"true"`
  97. }
  98. func (s *WaybillUpdateReq) Generate(m *model.Waybill) {
  99. if s.Id != 0 {
  100. m.Id = s.Id
  101. }
  102. m.SenderAddressDetails = s.SenderAddressDetails
  103. m.SenderAddressName = s.SenderAddressName
  104. m.SenderAddressPhone = s.SenderAddressPhone
  105. m.ConsigneeAddressDetails = s.ConsigneeAddressDetails
  106. m.ConsigneeAddressName = s.ConsigneeAddressName
  107. m.ConsigneeAddressPhone = s.ConsigneeAddressPhone
  108. m.CargoType = s.CargoType
  109. m.TemperatureInterval = s.TemperatureInterval
  110. m.DeliveryCondition = s.DeliveryCondition
  111. m.Remark = s.Remark
  112. m.CustomerName = s.CustomerName
  113. if s.ControlBy.UpdateBy != 0 {
  114. m.UpdateBy = s.UpdateBy
  115. }
  116. if s.ControlBy.CreateBy != 0 {
  117. m.CreateBy = s.CreateBy
  118. }
  119. }
  120. func (s *WaybillUpdateReq) GetId() interface{} {
  121. return s.Id
  122. }
  123. type WaybillDeliveryReq struct {
  124. WaybillIds []int `json:"waybillIds"` // 运单id
  125. Type int `json:"type"` // 派单类型 3司机 2仓管
  126. PrintUserId int `json:"printUserId"` // 制单人
  127. model2.ControlBy `swaggerignore:"true"`
  128. model2.DeptBy `swaggerignore:"true"`
  129. }
  130. func (s *WaybillDeliveryReq) GetId() interface{} {
  131. return s.WaybillIds
  132. }
  133. type WaybillGetReq struct {
  134. Id int `uri:"id"`
  135. }
  136. func (s *WaybillGetReq) GetId() interface{} {
  137. return s.Id
  138. }
  139. type WaybillDeleteReq struct {
  140. Id int `json:"id"`
  141. common.ControlBy `swaggerignore:"true"`
  142. }
  143. func (s *WaybillDeleteReq) GetId() interface{} {
  144. return s.Id
  145. }
  146. // 运单出入库/上下车
  147. type WaybillInOutReq struct {
  148. StartTime model2.Time `json:"startTime"`
  149. WaybillNoList []string `json:"waybillNoList" gorm:"size:128"` // 订单编号
  150. }
  151. // 运单签收
  152. type WaybillReceiptReq struct {
  153. StartTime model2.Time `json:"startTime"`
  154. WaybillNo string `json:"waybillNo" gorm:"size:128"` // 订单编号
  155. ReceiptImg string `json:"receiptImg" gorm:"size:128"` // 签收图片
  156. }
  157. type WaybillGetAppletPageReq struct {
  158. dto.Pagination `search:"-"`
  159. WaybillNo string `form:"waybillNo" search:"type:contains;column:waybill_no;table:waybill_logistics"` // 运单编号
  160. Status int `form:"status" search:"type:exact;column:status;table:waybill_logistics"` // 状态
  161. WaybillOrder
  162. }
  163. type WaybillGetAppletPageOrder struct {
  164. CreatedAtOrder string `search:"type:order;column:created_at;table:waybill_logistics" form:"createdAtOrder" default:"desc"`
  165. }
  166. func (m *WaybillGetAppletPageReq) GetNeedSearch() interface{} {
  167. return *m
  168. }
  169. type WaybillImportReq struct {
  170. CustomerName string `form:"customerName"` //下单客户名称
  171. }
  172. type WaybillStatsReq struct {
  173. Date string `form:"date"` // 日期
  174. Type string `form:"type"` // 类型 month-月 year-年
  175. }
  176. type WaybillStatsRes struct {
  177. TodayNum int64 `json:"todayNum"` // 今日总运单数
  178. WaitDeliveryNum int64 `json:"waitDeliveryNum"` // 待派单
  179. WaitTruckNum int64 `json:"waitTruckNum"` // 未装车
  180. WaitStorageNum int64 `json:"waitStorageNum"` // 未入库
  181. InDeliveryNum int64 `json:"inDeliveryNum"` // 运送中
  182. ThisMonthNum int64 `json:"thisMonthNum"` // 本月运单数
  183. LastMonthNum int64 `json:"lastMonthNum"` // 上月运单数
  184. ThisYearNum int64 `json:"thisYearNum"` // 本年运单数
  185. LastYearNum int64 `json:"lastYearNum"` // 上年运单数
  186. Stats []struct {
  187. Date string `json:"date"` // 日期 2024-01-01
  188. Num int64 `json:"num"` // 数量
  189. } `json:"stats"`
  190. }