1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package model
- import (
- "time"
- "github.com/pkg/errors"
- "kpt.xdmy/pkg/util"
- )
- type BigPartquit struct {
- // 退库
- CreatDate string `gorm:"column:creatDate"`
- DeptID int `gorm:"column:deptId"`
- ID int `gorm:"column:id"`
- Issync int `gorm:"column:issync"`
- ListType int `gorm:"column:listType"`
- Msg string `gorm:"column:msg"`
- Note string `gorm:"column:note"`
- OddNumber string `gorm:"column:oddNumber"`
- PastureID int `gorm:"column:pastureId"`
- QuitDate time.Time `gorm:"column:quitDate"`
- QuitID int `gorm:"column:quitId"`
- SumPrice float32 `gorm:"column:sumPrice"`
- UseForm string `gorm:"column:useForm"` // 出库单号
- ProofCode string `gorm:"column:proofCode"`
- }
- type Partquit struct {
- // 退库详情
- ApplyNumber string `gorm:"column:applyNumber"`
- BigID int `gorm:"column:bigId"`
- Brand string `gorm:"column:brand"`
- ContractID int `gorm:"column:contractId"`
- ID int `gorm:"column:id"`
- Location string `gorm:"column:location"`
- Note string `gorm:"column:note"`
- PartCode string `gorm:"column:partCode"`
- PartID int `gorm:"column:partId"`
- PartName string `gorm:"column:partName"`
- PartUseID int `gorm:"column:partUseId"`
- Price float32 `gorm:"column:price"`
- ProviderID int `gorm:"column:providerId"`
- ProviderName string `gorm:"column:providerName"`
- QuitNumber float32 `gorm:"column:quitNumber"`
- Reportery string `gorm:"column:reportery"`
- Specification string `gorm:"column:specification"`
- SumPrice float32 `gorm:"column:sumPrice"`
- Unit string `gorm:"column:unit"`
- UseNumber string `gorm:"column:useNumber"`
- Dflag int `gorm:"column:dflag"`
- RowNumber int `gorm:"column:rowNumber"`
- }
- func (p *Partquit) ToProofPart() (r *ProofPart) {
- r = &ProofPart{
- RowNumber: p.RowNumber,
- PartCode: p.PartCode,
- PartName: p.PartName,
- Specification: p.Specification,
- PartBrand: p.Brand,
- Supplier: p.ProviderName,
- Warehouse: p.Location,
- ChangeCount: p.QuitNumber,
- UnitPrice: p.Price,
- TotalPrice: p.SumPrice,
- }
- return
- }
- func (p *BigPartquit) NewProof(pa *ProofReq) {
- pa.ChargeDate = p.QuitDate.Format("2006-01-02")
- pa.ProofCode = p.UseForm
- pa.ProofYear = p.QuitDate.Format("2006")
- pa.OrderNumberId = p.ID
- }
- func (p *BigPartquit) NewProofPart() (mps []ProofPart, e error) {
- path := " BigPartquit NewProofPart()"
- c := util.NewMap("bigid", p.ID)
- m := make([]Partquit, 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
- }
|