| | |
| | | "description": "是否调拨产生的出库", |
| | | "type": "boolean" |
| | | }, |
| | | "moreUnitList": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "operationId": { |
| | | "description": "操作记录id", |
| | | "type": "integer" |
| | |
| | | "description": "Unit string ` + "`" + `json:\"unit\"` + "`" + ` //单位\nProduct models.Material ` + "`" + `json:\"product\" ` + "`" + ` // 产品", |
| | | "type": "integer" |
| | | }, |
| | | "moreUnitList": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | |
| | | "description": "是否调拨产生的出库", |
| | | "type": "boolean" |
| | | }, |
| | | "moreUnitList": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "operationId": { |
| | | "description": "操作记录id", |
| | | "type": "integer" |
| | |
| | | "description": "Unit string `json:\"unit\"` //单位\nProduct models.Material `json:\"product\" ` // 产品", |
| | | "type": "integer" |
| | | }, |
| | | "moreUnitList": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | |
| | | isInternalOutput: |
| | | description: 是否调拨产生的出库 |
| | | type: boolean |
| | | moreUnitList: |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | operationId: |
| | | description: 操作记录id |
| | | type: integer |
| | |
| | | Unit string `json:"unit"` //单位 |
| | | Product models.Material `json:"product" ` // 产品 |
| | | type: integer |
| | | moreUnitList: |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | |
| | | return &OperationSearch{Orm: mysqlx.GetDB()} |
| | | } |
| | | |
| | | func (slf *OperationSearch) BeforeCreate(tx *gorm.DB) { |
| | | func (slf *OperationSearch) BeforeCreate(tx *gorm.DB) error { |
| | | for k := range slf.Details { |
| | | slf.Details[k].BaseOperationType = slf.BaseOperationType |
| | | slf.Details[k].DealerType = slf.DealerType |
| | | } |
| | | return nil |
| | | } |
| | | |
| | | func (slf *OperationSearch) SetOrm(tx *gorm.DB) *OperationSearch { |
| | |
| | | package models |
| | | |
| | | import ( |
| | | "encoding/json" |
| | | "fmt" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | |
| | | // 嘉联仓储添加 SilkMarket、SilkMarketClose |
| | | SilkMarket string `json:"silkMarket" gorm:"type:varchar(255);comment:庄口"` // 庄口 |
| | | SilkMarketClose string `json:"silkMarketClose" gorm:"type:varchar(10);comment:庄口关闭"` // 庄口关闭 |
| | | |
| | | MoreUnitList []UnitItems `json:"moreUnitList" gorm:"-"` |
| | | MoreUnitValue string `json:"-" gorm:"type:varchar(255);comment:多单位值"` |
| | | } |
| | | |
| | | OperationDetailsSearch struct { |
| | |
| | | return &OperationDetailsSearch{Orm: mysqlx.GetDB()} |
| | | } |
| | | |
| | | func (slf *OperationDetails) AfterFind(tx *gorm.DB) (err error) { |
| | | if slf.MoreUnitValue != "" { |
| | | var arr []UnitItems |
| | | err := json.Unmarshal([]byte(slf.MoreUnitValue), &arr) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | slf.MoreUnitList = arr |
| | | } |
| | | |
| | | return |
| | | } |
| | | |
| | | func (slf *OperationDetails) BeforeCreate(tx *gorm.DB) (err error) { |
| | | if len(slf.MoreUnitList) != 0 { |
| | | items := make([]UnitItems, 0) |
| | | for k, item := range slf.MoreUnitList { |
| | | if item.Unit != "" && !item.Amount.IsZero() { |
| | | items = append(items, slf.MoreUnitList[k]) |
| | | } |
| | | } |
| | | |
| | | str, err := json.Marshal(items) |
| | | if err != nil { |
| | | return err |
| | | } |
| | | slf.MoreUnitValue = string(str) |
| | | } |
| | | return |
| | | } |
| | | |
| | | func (slf *OperationDetailsSearch) SetOrm(tx *gorm.DB) *OperationDetailsSearch { |
| | | slf.Orm = tx |
| | | return slf |
| | |
| | | import ( |
| | | "github.com/shopspring/decimal" |
| | | "wms/constvar" |
| | | "wms/models" |
| | | ) |
| | | |
| | | type AddOperation struct { |
| | |
| | | SalePrice decimal.Decimal `json:"salePrice"` //销售单价 |
| | | SilkMarket string `json:"silkMarket"` // 庄口 |
| | | SilkMarketClose string `json:"silkMarketClose"` // 庄口关闭 |
| | | |
| | | MoreUnitList []models.UnitItems `json:"moreUnitList" gorm:"-"` |
| | | MoreUnitValue string `json:"-" gorm:"type:varchar(255);comment:多单位值"` |
| | | } |
| | | |
| | | type OperationList struct { |