zhangqian
2024-07-04 5200927fcd5a352c540d42f9ecba0845367d1938
response/location_product_response.go
@@ -1,8 +1,106 @@
package response
import "wms/models"
import (
   "github.com/shopspring/decimal"
   "wms/constvar"
   "wms/models"
)
type RuleList struct {
   ProductList  []models.Material `json:"productList"`  //产品列表
   LocationList []models.Location `json:"locationList"` //位置列表
}
type LocationProductAmount struct {
   ID   string `gorm:"comment:主键ID;primaryKey;type:varchar(191);" json:"id"`
   Name string `gorm:"type:varchar(191);not null;comment:物料名称" json:"name"` //物料名称
   //MaterialType constvar.ProductType  `gorm:"index;type:int(11);comment:物料类型(数字)" json:"materialType"`
   Model constvar.MaterialMode `gorm:"type:varchar(191);not null;comment:物料类型(字符串)" json:"model"` //物料类型(字符串)
   //Explain           string                  `gorm:"type:varchar(512);comment:编号说明" json:"explain"`
   CodeStandardID string          `gorm:"type:varchar(191);comment:编码规范ID" json:"codeStandardID"`
   Specs          string          `gorm:"type:varchar(191);comment:物料规格" json:"specs"`
   Type           string          `gorm:"type:varchar(191);comment:物料型号" json:"type"`
   MinInventory   decimal.Decimal `gorm:"type:decimal(35,18);comment:最小库存" json:"minInventory"` //最小库存
   MaxInventory   decimal.Decimal `gorm:"type:decimal(35,18);comment:最大库存" json:"maxInventory"` //最大库存
   Amount         decimal.Decimal `gorm:"type:decimal(35,18);comment:数量" json:"amount"`         //数量
   //LockAmount        decimal.Decimal         `gorm:"type:decimal(35,18);default:0;comment:锁定数量" json:"lockAmount"`
   Unit       string `gorm:"type:varchar(100);comment:单位" json:"unit"` //单位
   Note       string `gorm:"type:varchar(1024);comment:备注" json:"note"`
   TemplateID string `gorm:"type:varchar(191);comment:模板ID" json:"templateID"` //模板ID
   //FSource           string                  `gorm:"type:varchar(191);comment:生产车间" json:"-"`
   //Status            constvar.MaterialStatus `gorm:"type:int(11);comment:状态" json:"status"`
   Supplier      string          `gorm:"type:varchar(191);comment:供应商" json:"supplier"`         //供应商
   PurchasePrice decimal.Decimal `gorm:"type:decimal(35,18);comment:采购价格" json:"purchasePrice"` //采购价格
   //PurchaseAheadDay  int                     `gorm:"type:int(11);comment:采购提前期(天)" json:"purchaseAheadDay"`
   //ProduceAheadDay   int                     `gorm:"type:int(11);comment:制造提前期(天)" json:"produceAheadDay"`
   MinPurchaseAmount decimal.Decimal       `gorm:"type:decimal(35,18);comment:最小采购量" json:"minPurchaseAmount"` //最小采购量
   PurchaseType      constvar.PurchaseType `gorm:"type:int(11);comment:采购类型" json:"purchaseType"`
   PurchaseTypes     string                `gorm:"type:varchar(255);comment:采购类型范围" json:"-"`
   PurchaseTypeList  []int                 `gorm:"-" json:"purchaseTypeList"`
   IsSale            bool                  `gorm:"type:tinyint(1);comment:是否销售" json:"isSale"`        //是否销售
   SalePrice         decimal.Decimal       `gorm:"type:decimal(35,18);comment:销售单价" json:"salePrice"` //销售单价
   AutoIncr          uint                  `gorm:"type:int(11);comment:自增ID;default:0;" json:"autoIncr"`
   //wms添加字段
   ProductType         constvar.ProductType       `gorm:"type:int(11);comment:产品类型" json:"productType"`                 //产品类型
   InvoicingStrategy   constvar.InvoicingStrategy `gorm:"type:int(11);comment:开票策略" json:"invoicingStrategy"`           //开票策略
   OrderCreation       constvar.OrderCreation     `gorm:"type:int(11);comment:订单创建" json:"orderCreation"`               //订单创建
   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
   CategoryName        string                     `gorm:"type:varchar(255);comment:产品类别名称" json:"categoryName"`         //产品类别名称
   InternalReference   string                     `gorm:"type:varchar(255);comment:内部参考" json:"internalReference"`      //内部参考
   ProductTagId        int                        `gorm:"type:int(11);comment:产品标签id" json:"productTagId"`              //产品标签id
   ProductTagName      string                     `gorm:"type:varchar(255);comment:产品标签名称" json:"productTagName"`       //产品标签名称
   CompanyId           int                        `gorm:"type:int(11);comment:公司id" json:"companyId"`                   //公司id
   CompanyName         string                     `gorm:"type:varchar(255);comment:公司名称" json:"companyName"`            //公司名称
   InternalNotes       string                     `gorm:"type:varchar(512);comment:内部说明" json:"internalNotes"`          //内部说明
   SelectProduct       string                     `gorm:"type:varchar(255);comment:可选产品id" json:"selectProduct"`        //可选产品id
   SellExplain         string                     `gorm:"type:varchar(512);comment:销售说明" json:"sellExplain"`            //销售说明
   CanBePurchased      bool                       `gorm:"type:int(11);comment:是否可采购" json:"canBePurchased"`             //是否可采购
   CurrencyName        string                     `gorm:"type:varchar(255);comment:币种名称" json:"currencyName"`           //币种名称
   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,3);comment:重量" json:"weight"`                  //重量
   Volume              decimal.Decimal            `gorm:"type:decimal(20,2);comment:体积" json:"volume"`                  //体积
   MakeAdvanceTime     decimal.Decimal            `gorm:"type:decimal(20,2);comment:制造前置时间" json:"makeAdvanceTime"`     //制造前置时间(天)
   OrderAdvanceTime    decimal.Decimal            `gorm:"type:decimal(20,2);comment:订单准备天数" json:"orderAdvanceTime"`    //订单准备天数(天)
   DeliveryAdvanceTime decimal.Decimal            `gorm:"type:decimal(20,2);comment:客户前置时间" json:"deliveryAdvanceTime"` //客户前置时间(天)
   //HSCode                  string                     `gorm:"type:varchar(255);comment:HS编码" json:"HSCode"`                    //HS编码
   //OriginCountryId         int                        `gorm:"type:int(11);comment:原产地id" json:"originCountryId"`               //原产地id
   //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"` //内部调拨说明
   AttachmentList          []*models.Attachment `json:"attachmentList" gorm:"many2many:material_attachment"`
   IsStorage               int                  `gorm:"type:tinyint(1);default:1;comment:是否存库(1是2否)" json:"isStorage"`   //无库存的在wms以及srm中需要过滤掉
   IsVirtual               int                  `json:"isVirtual" gorm:"type:tinyint(1);default:2;comment:是否虚拟物料(1是2否)"` //虚拟物料在MRP计算时跳过该层级直接领用下级物料,虚拟物料不生成工单
   ReorderRuleNum          int64                `json:"reorderRuleNum"`
   MoreUnit                *bool                `json:"moreUnit" gorm:"type:tinyint(1);default:false;comment:启动多单位"`
   MoreUnitList            []models.UnitItems   `json:"moreUnitList" gorm:"-"`
   MoreUnitValue           string               `json:"-" gorm:"type:varchar(255);comment:多单位值"`
   GrossWeight             decimal.Decimal      `json:"grossWeight" gorm:"type:decimal(20,3);comment:毛重"`
   NetWeight               decimal.Decimal      `json:"netWeight" gorm:"type:decimal(20,3);comment:净重"`
   GrossUnit               string               `json:"grossUnit" gorm:"type:varchar(255);comment:毛重单位"`
   NetUnit                 string               `json:"netUnit" gorm:"type:varchar(255);comment:净重单位"`
   Attributes              []models.Attribute   `json:"attributes" gorm:"-"` //动态属性
   //以下为不存库的字段
   AttachmentIDs    []uint          `json:"attachmentIDs" gorm:"-"`
   PredictionAmount decimal.Decimal `json:"predictionAmount" gorm:"-"`
   InputAmount      decimal.Decimal `json:"inputAmount" gorm:"-"`
   OutputAmount     decimal.Decimal `json:"outputAmount" gorm:"-"`
   MinInventoryRule decimal.Decimal `json:"minInventoryRule" gorm:"-"` //最小库存
   MaxInventoryRule decimal.Decimal `json:"maxInventoryRule" gorm:"-"` //最大库存
   CreateBy string `gorm:"type:varchar(255);comment:导入人、创建人" json:"createBy"`       //创建人
   BarCode  string `gorm:"type:varchar(255);comment:(商品/产品/物料的)条形码" json:"barCode"` //条码
   LocationId        int                    `json:"locationId" gorm:"type:int;not null;comment:位置id"` //位置id
   WarehouseId       int                    `json:"warehouseId" gorm:"type:int;not null;default:0;comment:仓库id"`
   Location          models.Location        `json:"location" gorm:"foreignKey:LocationId;references:id"`
   ProductCategoryID int                    `json:"productCategoryId" gorm:"type:int;not null;comment:产品种类id"` //产品种类id
   ProductCategory   models.ProductCategory `json:"productCategory" gorm:"foreignKey:ProductCategoryID;references:Id"`
   ProductId         string                 `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id
   CreateDate        string                 `json:"createDate" gorm:"type:varchar(63);comment:日期"`            //日期
}