123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package model
- import (
- "time"
- "github.com/pkg/errors"
- "kpt.xdmy/pkg/util"
- )
- type BigPartRefundReq struct {
- PastureID int `json:"pastureId"`
- ProviderID int `json:"providerId"`
- UseForm string `json:"useForm"`
- EmployeID int `json:"employeId"`
- CreateTime string `json:"createTime"`
- Note string `json:"note"`
- }
- type BigPartRefund struct {
- // 退货
- ID int `gorm:"column:id"`
- CGChargeID int `gorm:"column:CGChargeId"`
- ChargeID int `gorm:"column:chargeId"`
- EmployeID int `gorm:"column:employeId"`
- BigPartlaidID int `gorm:"column:bigPartlaidId"`
- PastureID int `gorm:"column:pastureId"`
- ProviderID int `gorm:"column:providerId"`
- UseForm string `gorm:"column:useForm"`
- RefundClass int `gorm:"column:refundClass"`
- Issync int `gorm:"column:issync"`
- CGChargedate string `gorm:"column:CGChargedate"`
- ChargeDate string `gorm:"column:chargeDate"`
- CreateTime time.Time `gorm:"column:createTime"`
- Msg string `gorm:"column:msg"`
- Note string `gorm:"column:note"`
- Statue int `gorm:"column:statue"`
- WorkflowNote string `gorm:"column:workflowNote"`
- ProofCode string `gorm:"column:proofCode"`
- }
- type PartRefund struct {
- // 退货明细
- ID int `gorm:"column:id"`
- BigID int `gorm:"column:bigId"`
- ContractID int `gorm:"column:contractId"`
- PartID int `gorm:"column:partId"`
- Brand string `gorm:"column:brand"`
- Location string `gorm:"column:location"`
- Note string `gorm:"column:note"`
- PartCode string `gorm:"column:partCode"`
- PartName string `gorm:"column:partName"`
- Price float32 `gorm:"column:price"`
- RefundNumber float32 `gorm:"column:refundNumber"`
- Reportery string `gorm:"column:reportery"`
- Specification string `gorm:"column:specification"`
- SumPrice float32 `gorm:"column:sumPrice"`
- Unit string `gorm:"column:unit"`
- Dflag int `gorm:"column:dflag"`
- RowNumber int `gorm:"column:rowNumber"`
- }
- func (p *PartRefund) ToProofPart() (r *ProofPart) {
- r = &ProofPart{
- RowNumber: p.RowNumber,
- PartCode: p.PartCode,
- PartName: p.PartName,
- Specification: p.Specification,
- PartBrand: p.Brand,
- Warehouse: p.Location,
- ChangeCount: p.RefundNumber,
- UnitPrice: p.Price,
- TotalPrice: p.SumPrice,
- }
- return
- }
- func (p *BigPartRefund) NewProof(pa *ProofReq) {
- pa.ChargeDate = p.CreateTime.Format("2006-01-02")
- pa.ProofCode = p.UseForm
- pa.ProofYear = p.CreateTime.Format("2006")
- pa.OrderNumberId = p.ID
- }
- func (p *BigPartRefund) NewProofPart() (mps []ProofPart, e error) {
- path := " BigPartRefund NewProofPart()"
- c := util.NewMap("bigid", p.ID)
- m := make([]PartRefund, 0)
- if e = Find(c, &m); e != nil {
- e = errors.Wrapf(e, path)
- return
- }
- mps = make([]ProofPart, 0)
- mp := new(ProofPart)
- for i, v := range m {
- mp = v.ToProofPart()
- mp.RowNumber = i
- mps = append(mps, *mp)
- }
- return
- }
- type RefundParam struct {
- ID string `json:"id"`
- }
|