PartRefund.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. PurchaseId string `gorm:"column:purchaseId"`
  36. }
  37. type PartRefund struct {
  38. // 退货明细
  39. ID int `gorm:"column:id"`
  40. BigID int `gorm:"column:bigId"`
  41. ContractID int `gorm:"column:contractId"`
  42. PartID int `gorm:"column:partId"`
  43. Brand string `gorm:"column:brand"`
  44. Location string `gorm:"column:location"`
  45. Note string `gorm:"column:note"`
  46. PartCode string `gorm:"column:partCode"`
  47. PartName string `gorm:"column:partName"`
  48. Price float32 `gorm:"column:price"`
  49. RefundNumber float32 `gorm:"column:refundNumber"`
  50. Reportery string `gorm:"column:reportery"`
  51. Specification string `gorm:"column:specification"`
  52. SumPrice float32 `gorm:"column:sumPrice"`
  53. Unit string `gorm:"column:unit"`
  54. Dflag int `gorm:"column:dflag"`
  55. RowNumber int `gorm:"column:rowNumber"`
  56. }
  57. func (p *PartRefund) ToProofPart() (r *ProofPart) {
  58. r = &ProofPart{
  59. RowNumber: p.RowNumber,
  60. PartCode: p.PartCode,
  61. PartName: p.PartName,
  62. Specification: p.Specification,
  63. PartBrand: p.Brand,
  64. Warehouse: p.Location,
  65. ChangeCount: p.RefundNumber,
  66. UnitPrice: p.Price,
  67. TotalPrice: p.SumPrice,
  68. }
  69. return
  70. }
  71. func (p *BigPartRefund) NewProof(pa *ProofReq) {
  72. pa.ChargeDate = p.CreateTime.Format("2006-01-02")
  73. pa.ProofCode = p.UseForm
  74. pa.ProofYear = p.CreateTime.Format("2006")
  75. pa.OrderNumberId = p.ID
  76. }
  77. func (p *BigPartRefund) NewProofPart() (mps []ProofPart, e error) {
  78. path := " BigPartRefund NewProofPart()"
  79. c := util.NewMap("bigid", p.ID)
  80. m := make([]PartRefund, 0)
  81. if e = Find(c, &m); e != nil {
  82. e = errors.Wrapf(e, path)
  83. return
  84. }
  85. mps = make([]ProofPart, 0)
  86. mp := new(ProofPart)
  87. for i, v := range m {
  88. mp = v.ToProofPart()
  89. mp.RowNumber = i
  90. mps = append(mps, *mp)
  91. }
  92. return
  93. }
  94. type RefundParam struct {
  95. ID int `json:"id"`
  96. }
  97. type PartRefundStr struct {
  98. // 退货明细
  99. ID interface{} `gorm:"column:id"`
  100. BigID interface{} `gorm:"column:bigId"`
  101. ContractID interface{} `gorm:"column:contractId"`
  102. PartID interface{} `gorm:"column:partId"`
  103. Brand interface{} `gorm:"column:brand"`
  104. Location interface{} `gorm:"column:location"`
  105. Note interface{} `gorm:"column:note"`
  106. PartCode interface{} `gorm:"column:partCode"`
  107. PartName interface{} `gorm:"column:partName"`
  108. Price interface{} `gorm:"column:price"`
  109. RefundNumber interface{} `gorm:"column:refundNumber"`
  110. Reportery interface{} `gorm:"column:reportery"`
  111. Specification interface{} `gorm:"column:specification"`
  112. SumPrice interface{} `gorm:"column:sumPrice"`
  113. Unit interface{} `gorm:"column:unit"`
  114. Dflag interface{} `gorm:"column:dflag"`
  115. RowNumber interface{} `gorm:"column:rowNumber"`
  116. }