| | |
| | | |
| | | import ( |
| | | "fmt" |
| | | "google.golang.org/genproto/googleapis/type/decimal" |
| | | "github.com/shopspring/decimal" |
| | | "gorm.io/gorm" |
| | | "wms/constvar" |
| | | "wms/pkg/mysqlx" |
| | |
| | | // Product 产品 |
| | | Product struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | Name string `json:"name" gorm:"index;type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Type constvar.ProductType `gorm:"type:tinyint;comment:产品类型" json:"type"` //产品类型 |
| | | CategoryId int `gorm:"type:int(11);comment:产品分类" json:"categoryId"` //产品分类id |
| | | Category string `gorm:"type:int(11);comment:产品分类" json:"category"` //产品分类 |
| | | Specs string `gorm:"type:varchar(191);comment:产品规格" json:"specs"` //产品规格 |
| | | Model string `gorm:"type:varchar(191);comment:产品型号" json:"model"` //产品型号 |
| | | //MinInventory decimal.Decimal `gorm:"type:decimal(20,2);comment:最小库存" json:"minInventory"` //最大库存 |
| | | //MaxInventory decimal.Decimal `gorm:"type:decimal(20,2);comment:最大库存" json:"maxInventory"` //最小库存 |
| | | //Amount decimal.Decimal `gorm:"type:decimal(20,2);comment:数量" json:"amount"` |
| | | //LockAmount decimal.Decimal `gorm:"type:decimal(20,2);default:0;comment:锁定数量" json:"lockAmount"` |
| | | Unit string `gorm:"type:varchar(100);comment:单位" json:"unit"` //单位 |
| | | PurchaseUnit string `gorm:"type:varchar(100);comment:采购单位" json:"purchaseUnit"` //采购单位 |
| | | Note string `gorm:"type:varchar(1024);comment:备注" json:"note"` |
| | | Status constvar.ProductStatus `gorm:"type:int(11);comment:状态" json:"status"` |
| | | Purchases []*PurchaseInfo `gorm:"-" json:"purchases"` //采购信息 |
| | | PurchasesStr string `gorm:"column:purchase;type:varchar(4096);comment:购买信息" json:"-"` |
| | | |
| | | //PurchaseType constvar.PurchaseType `gorm:"type:int(11);comment:采购类型" json:"purchaseType"` ///采购类型 |
| | | CanBePurchased bool `gorm:"type:int(11);not null;comment:是否可采购" json:"purchaseType"` //是否可采购 |
| | | IsSale bool `gorm:"type:tinyint(1);comment:是否销售" json:"isSale"` //是否销售 |
| | | SalePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:销售单价" json:"salePrice"` //销售价格 |
| | | CustomerTaxes decimal.Decimal `gorm:"type:decimal(20,2);not null;comment:客户税" json:"customerTaxes"` //客户税百分比 |
| | | Cost decimal.Decimal `gorm:"type:decimal(20,2);not null;comment:成本" json:"cost"` //成本 |
| | | OptionalProducts []int `gorm:"type:varchar(255);not null;comment:相似产品id" json:"optionalProducts"` //相识产品 |
| | | Principal string `gorm:"type:varchar(255);not null;comment:负责人" json:"principal"` //负责人 |
| | | Weight string `gorm:"type:decimal(20,2);not null;comment:重量" json:"weight"` //重量 |
| | | Volume string `gorm:"type:decimal(20,2);not null;comment:体积" json:"volume"` //体积 |
| | | |
| | | InternalReference string `gorm:"type:varchar(255);not null;comment:内部参考" json:"internalReference"` //内部参考 |
| | | Barcode string `gorm:"type:varchar(255);not null;comment:条码" json:"barcode"` //条码 |
| | | Tags string `gorm:"type:varchar(255);not null;comment:产品标签" json:"tags"` //产品标签 |
| | | InternalNotes string `gorm:"type:varchar(512);not null;comment:内部说明" json:"internalNotes"` //内部说明 |
| | | Id int `gorm:"column:id;primary_key;AUTO_INCREMENT" json:"id"` |
| | | Name string `gorm:"index;type:varchar(255);not null;comment:产品名称" json:"name"` //产品名称 |
| | | Type constvar.ProductType `gorm:"type:int(11);comment:产品类型" json:"type"` //产品类型 |
| | | InvoicingStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:开票策略" json:"invoicingStrategy"` |
| | | OrderCreation constvar.OrderCreation `gorm:"type:int(11);comment:订单创建" json:"orderCreation"` |
| | | ObjectTemplateId string `gorm:"type:varchar(191);comment:项目模版id" json:"objectTemplateId"` |
| | | SalePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:销售单价" json:"salePrice"` //销售价格 |
| | | CustomerTaxes decimal.Decimal `gorm:"type:decimal(20,2);comment:客户税" json:"customerTaxes"` //客户税百分比 |
| | | Cost decimal.Decimal `gorm:"type:decimal(20,2);comment:成本" json:"cost"` //成本 |
| | | CategoryId int `gorm:"type:int(11);comment:产品类型id" json:"categoryId"` //产品分类id |
| | | InternalReference string `gorm:"type:varchar(255);comment:内部参考" json:"internalReference"` //内部参考 |
| | | Barcode string `gorm:"type:varchar(255);comment:条码" json:"barcode"` //条码 |
| | | ProductTagId int `gorm:"type:int(11);comment:产品标签id" json:"productTagId"` //产品标签 |
| | | ProductTagName string `gorm:"type:varchar(255);comment:产品标签名称" json:"productTagName"` |
| | | CompanyId int `gorm:"type:int(11);comment:公司id" json:"companyId"` |
| | | CompanyName string `gorm:"type:varchar(255);comment:公司名称" json:"companyName"` |
| | | InternalNotes string `gorm:"type:varchar(512);comment:内部说明" json:"internalNotes"` //内部说明 |
| | | CanBeSell bool `gorm:"type:tinyint(1);comment:是否可销售" json:"canBeSell"` //是否销售 |
| | | SelectProduct int `gorm:"type:int(11);comment:可选产品id" json:"selectProduct"` |
| | | SellExplain string `gorm:"type:varchar(512);comment:销售说明" json:"sellExplain"` |
| | | CanBePurchased bool `gorm:"type:int(11);comment:是否可采购" json:"canBePurchased"` //是否可采购 |
| | | SupplierId int `gorm:"type:int(11);comment:供应商id" json:"supplierId"` |
| | | SupplierName string `gorm:"type:varchar(255);comment:供应商名称" json:"supplierName"` |
| | | Price decimal.Decimal `gorm:"type:decimal(20,2);comment:价格" json:"price"` |
| | | CurrencyId int `gorm:"type:int(11);comment:币种id" json:"currencyId"` |
| | | CurrencyName string `gorm:"type:varchar(255);comment:币种名称" json:"currencyName"` |
| | | DeliveryAdvanceTime decimal.Decimal `gorm:"type:decimal(20,5);comment:提前交货时间" json:"deliveryAdvanceTime"` |
| | | ControlStrategy constvar.InvoicingStrategy `gorm:"type:int(11);comment:控制策略" json:"controlStrategy"` |
| | | BuyExplain string `gorm:"type:varchar(512);comment:采购说明" json:"buyExplain"` |
| | | Principal string `gorm:"type:varchar(255);comment:负责人" json:"principal"` //负责人 |
| | | Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:重量" json:"weight"` //重量 |
| | | Volume decimal.Decimal `gorm:"type:decimal(20,2);comment:体积" json:"volume"` //体积 |
| | | CustomerAdvanceTime decimal.Decimal `gorm:"type:decimal(20,5);comment:客户前置时间" json:"customerAdvanceTime"` |
| | | HSCode string `gorm:"type:varchar(255);comment:HS编码" json:"HSCode"` |
| | | OriginCountryId int `gorm:"type:int(11);comment:原产地id" json:"originCountryId"` |
| | | OriginCountryName string `gorm:"type:varchar(255);comment:原产地名称" json:"originCountryName"` |
| | | InStorageExplain string `gorm:"type:varchar(512);comment:入库说明" json:"inStorageExplain"` |
| | | OutStorageExplain string `gorm:"type:varchar(512);comment:出库说明" json:"outStorageExplain"` |
| | | InternalTransferExplain string `gorm:"type:varchar(512);comment:内部调拨说明" json:"internalTransferExplain"` |
| | | } |
| | | |
| | | ProductSearch struct { |