PartRefund.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package model
  2. import (
  3. "time"
  4. "github.com/pkg/errors"
  5. "kpt.xdmy/pkg/util"
  6. )
  7. type BigPartRefundReq struct {
  8. PastureID int `json:"pastureId"`
  9. ProviderID int `json:"providerId"`
  10. UseForm string `json:"useForm"`
  11. EmployeID int `json:"employeId"`
  12. CreateTime string `json:"createTime"`
  13. Note string `json:"note"`
  14. }
  15. type BigPartRefund struct {
  16. // 退货
  17. ID int `gorm:"column:id"`
  18. CGChargeID int `gorm:"column:CGChargeId"`
  19. ChargeID int `gorm:"column:chargeId"`
  20. EmployeID int `gorm:"column:employeId"`
  21. BigPartlaidID int `gorm:"column:bigPartlaidId"`
  22. PastureID int `gorm:"column:pastureId"`
  23. ProviderID int `gorm:"column:providerId"`
  24. UseForm string `gorm:"column:useForm"`
  25. RefundClass int `gorm:"column:refundClass"`
  26. Issync int `gorm:"column:issync"`
  27. CGChargedate string `gorm:"column:CGChargedate"`
  28. ChargeDate string `gorm:"column:chargeDate"`
  29. CreateTime time.Time `gorm:"column:createTime"`
  30. Msg string `gorm:"column:msg"`
  31. Note string `gorm:"column:note"`
  32. Statue int `gorm:"column:statue"`
  33. WorkflowNote string `gorm:"column:workflowNote"`
  34. ProofCode string `gorm:"column:proofCode"`
  35. }
  36. type PartRefund struct {
  37. // 退货明细
  38. ID int `gorm:"column:id"`
  39. BigID int `gorm:"column:bigId"`
  40. ContractID int `gorm:"column:contractId"`
  41. PartID int `gorm:"column:partId"`
  42. Brand string `gorm:"column:brand"`
  43. Location string `gorm:"column:location"`
  44. Note string `gorm:"column:note"`
  45. PartCode string `gorm:"column:partCode"`
  46. PartName string `gorm:"column:partName"`
  47. Price float32 `gorm:"column:price"`
  48. RefundNumber float32 `gorm:"column:refundNumber"`
  49. Reportery string `gorm:"column:reportery"`
  50. Specification string `gorm:"column:specification"`
  51. SumPrice float32 `gorm:"column:sumPrice"`
  52. Unit string `gorm:"column:unit"`
  53. Dflag int `gorm:"column:dflag"`
  54. RowNumber int `gorm:"column:rowNumber"`
  55. }
  56. func (p *PartRefund) ToProofPart() (r *ProofPart) {
  57. r = &ProofPart{
  58. RowNumber: p.RowNumber,
  59. PartCode: p.PartCode,
  60. PartName: p.PartName,
  61. Specification: p.Specification,
  62. PartBrand: p.Brand,
  63. Warehouse: p.Location,
  64. ChangeCount: p.RefundNumber,
  65. UnitPrice: p.Price,
  66. TotalPrice: p.SumPrice,
  67. }
  68. return
  69. }
  70. func (p *BigPartRefund) NewProof(pa *ProofReq) {
  71. pa.ChargeDate = p.CreateTime.Format("2006-01-02")
  72. pa.ProofCode = p.UseForm
  73. pa.ProofYear = p.CreateTime.Format("2006")
  74. pa.OrderNumberId = p.ID
  75. }
  76. func (p *BigPartRefund) NewProofPart() (mps []ProofPart, e error) {
  77. path := " BigPartRefund NewProofPart()"
  78. c := util.NewMap("bigid", p.ID)
  79. m := make([]PartRefund, 0)
  80. if e = Find(c, &m); e != nil {
  81. e = errors.Wrapf(e, path)
  82. return
  83. }
  84. mps = make([]ProofPart, 0)
  85. mp := new(ProofPart)
  86. for i, v := range m {
  87. mp = v.ToProofPart()
  88. mp.RowNumber = i
  89. mps = append(mps, *mp)
  90. }
  91. return
  92. }
  93. type RefundParam struct {
  94. ID string `json:"id"`
  95. }