123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- package model
- import (
- "time"
- "github.com/pkg/errors"
- "kpt.xdmy/pkg/util"
- )
- type BigPartUse struct {
- ApplicatID int `gorm:"column:applicatId"`
- DepartmentID int `gorm:"column:departmentId"`
- EmpID int `gorm:"column:empId"`
- FClassID int `gorm:"column:fClassId"`
- ID int `gorm:"column:id"`
- MaintainID int `gorm:"column:maintainId"`
- PastureID int `gorm:"column:pastureId"`
- WorkflowID int `gorm:"column:workflowId"`
- PlanUpkeepID int `gorm:"column:planUpkeepId"`
- SClassID int `gorm:"column:sClassId"`
- ReceiveTime time.Time `gorm:"column:receiveTime"` //'领用时间'
- CreatDate time.Time `gorm:"column:creatDate"`
- FlowworkNote string `gorm:"column:flowworkNote"`
- ListType string `gorm:"column:listType"`
- OddCode string `gorm:"column:oddCode"`
- RefuseStatue int `gorm:"column:refuseStatue"`
- Msg string `gorm:"column:msg"`
- FlowCompeleted int `gorm:"column:flowCompeleted"`
- Issync int `gorm:"column:issync"`
- Note string `gorm:"column:note"`
- SumPrice string `gorm:"column:sumPrice"`
- UseType int `gorm:"column:useType"`
- UseForm string `gorm:"column:useForm"`
- UseStatus int `gorm:"column:useStatus"`
- ProofCode string `gorm:"column:proofCode"`
- }
- type PartUse struct {
- ID int `gorm:"column:id"`
- BigID int `gorm:"column:bigId"`
- BrandID int `gorm:"column:brandId"`
- ContractID int `gorm:"column:contractId"`
- LocationID int `gorm:"column:locationId"`
- MaintainID int `gorm:"column:maintainId"`
- PlanUpkeepID int `gorm:"column:planUpkeepId"`
- PartID int `gorm:"column:partId"`
- ProID int `gorm:"column:proId"`
- EqCode string `gorm:"column:eqCode"`
- EqID int `gorm:"column:eqId"`
- Cpm int `gorm:"column:CPM"`
- CheckoutNumber float32 `gorm:"column:checkoutNumber"` // 出库数量
- EqName string `gorm:"column:eqName"`
- IsRefuse int `gorm:"column:isRefuse"`
- Note string `gorm:"column:note"`
- PartCode string `gorm:"column:partCode"`
- PartName string `gorm:"column:partName"`
- Price float32 `gorm:"column:price"` // 单价
- ProName string `gorm:"column:proName"`
- QuitNumber string `gorm:"column:quitNumber"`
- RefuseNumber int `gorm:"column:refuseNumber"`
- RefuseStatue int `gorm:"column:refuseStatue"`
- 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"`
- UseTypeV string `gorm:"column:useTypeV"`
- Dflag int `gorm:"column:dflag"`
- RowNumber int `gorm:"column:rowNumber"`
- }
- func (p *PartUse) ToProofPart() (r *ProofPart, e error) {
- mb := &Brand{ID: p.BrandID}
- mw := &Warehouse{ID: p.LocationID}
- e = First(mb)
- e = First(mw)
- if e != nil {
- e = errors.Wrapf(e, "model PartLaid ToProofPart()")
- return
- }
- r = &ProofPart{
- RowNumber: p.RowNumber,
- PartCode: p.PartCode,
- PartName: p.PartName,
- Specification: p.Specification,
- PartBrand: mb.BrandName,
- Supplier: p.ProName,
- Warehouse: mw.WarehoseCode,
- ChangeCount: p.CheckoutNumber,
- UnitPrice: p.Price,
- TotalPrice: p.SumPrice,
- }
- return
- }
- func (p *BigPartUse) NewProof(pa *ProofReq) {
- pa.ChargeDate = p.ReceiveTime.Format("2006-01-02")
- pa.ProofCode = p.UseForm
- pa.ProofYear = p.ReceiveTime.Format("2006")
- pa.OrderNumberId = p.ID
- }
- func (p *BigPartUse) NewProofPart() (mps []ProofPart, e error) {
- path := " BigPartUse NewProofPart()"
- c := util.NewMap("bigid", p.ID)
- m := make([]PartUse, 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, e = v.ToProofPart()
- mp.RowNumber = i
- mps = append(mps, *mp)
- }
- if e != e {
- e = errors.Wrapf(e, path)
- }
- return
- }
- type BigPartUseStr struct {
- ApplicatID interface{} `gorm:"column:applicatId"`
- DepartmentID interface{} `gorm:"column:departmentId"`
- EmpID interface{} `gorm:"column:empId"`
- FClassID interface{} `gorm:"column:fClassId"`
- ID interface{} `gorm:"column:id"`
- MaintainID interface{} `gorm:"column:maintainId"`
- PastureID interface{} `gorm:"column:pastureId"`
- WorkflowID interface{} `gorm:"column:workflowId"`
- PlanUpkeepID interface{} `gorm:"column:planUpkeepId"`
- SClassID interface{} `gorm:"column:sClassId"`
- ReceiveTime interface{} `gorm:"column:receiveTime"` //'领用时间'
- CreatDate interface{} `gorm:"column:creatDate"`
- FlowworkNote interface{} `gorm:"column:flowworkNote"`
- ListType interface{} `gorm:"column:listType"`
- OddCode interface{} `gorm:"column:oddCode"`
- RefuseStatue interface{} `gorm:"column:refuseStatue"`
- Msg interface{} `gorm:"column:msg"`
- FlowCompeleted interface{} `gorm:"column:flowCompeleted"`
- Issync interface{} `gorm:"column:issync"`
- Note interface{} `gorm:"column:note"`
- SumPrice interface{} `gorm:"column:sumPrice"`
- UseType interface{} `gorm:"column:useType"`
- UseForm interface{} `gorm:"column:useForm"`
- UseStatus interface{} `gorm:"column:useStatus"`
- ProofCode interface{} `gorm:"column:proofCode"`
- }
- type PartUseStr struct {
- ID interface{} `gorm:"column:id"`
- BigID interface{} `gorm:"column:bigId"`
- BrandID interface{} `gorm:"column:brandId"`
- ContractID interface{} `gorm:"column:contractId"`
- LocationID interface{} `gorm:"column:locationId"`
- MaintainID interface{} `gorm:"column:maintainId"`
- PlanUpkeepID interface{} `gorm:"column:planUpkeepId"`
- PartID interface{} `gorm:"column:partId"`
- ProID interface{} `gorm:"column:proId"`
- EqCode interface{} `gorm:"column:eqCode"`
- EqID interface{} `gorm:"column:eqId"`
- Cpm interface{} `gorm:"column:CPM"`
- CheckoutNumber interface{} `gorm:"column:checkoutNumber"` // 出库数量
- EqName interface{} `gorm:"column:eqName"`
- IsRefuse interface{} `gorm:"column:isRefuse"`
- Note interface{} `gorm:"column:note"`
- PartCode interface{} `gorm:"column:partCode"`
- PartName interface{} `gorm:"column:partName"`
- Price interface{} `gorm:"column:price"` // 单价
- ProName interface{} `gorm:"column:proName"`
- QuitNumber interface{} `gorm:"column:quitNumber"`
- RefuseNumber interface{} `gorm:"column:refuseNumber"`
- RefuseStatue interface{} `gorm:"column:refuseStatue"`
- Reportery interface{} `gorm:"column:reportery"`
- Specification interface{} `gorm:"column:specification"`
- SumPrice interface{} `gorm:"column:sumPrice"` // 总价
- Unit interface{} `gorm:"column:unit"`
- UseNumber interface{} `gorm:"column:useNumber"`
- UseTypeV interface{} `gorm:"column:useTypeV"`
- Dflag interface{} `gorm:"column:dflag"`
- RowNumber interface{} `gorm:"column:rowNumber"`
- }
|