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"` PurchaseId string `gorm:"column:purchaseId"` } 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 int `json:"id"` } type PartRefundStr struct { // 退货明细 ID interface{} `gorm:"column:id"` BigID interface{} `gorm:"column:bigId"` ContractID interface{} `gorm:"column:contractId"` PartID interface{} `gorm:"column:partId"` Brand interface{} `gorm:"column:brand"` Location interface{} `gorm:"column:location"` Note interface{} `gorm:"column:note"` PartCode interface{} `gorm:"column:partCode"` PartName interface{} `gorm:"column:partName"` Price interface{} `gorm:"column:price"` RefundNumber interface{} `gorm:"column:refundNumber"` Reportery interface{} `gorm:"column:reportery"` Specification interface{} `gorm:"column:specification"` SumPrice interface{} `gorm:"column:sumPrice"` Unit interface{} `gorm:"column:unit"` Dflag interface{} `gorm:"column:dflag"` RowNumber interface{} `gorm:"column:rowNumber"` }