1.修改出入库模块的新增、修改、列表,operation_details不再保存产品名称和单位,改为读取material
2.修改报废模块的新增,修改、列表,不再使用productName和unit字段
| | |
| | | if v.ProductId == "" { |
| | | return errors.New("productID为空") |
| | | } |
| | | if v.ProductName == "" { |
| | | return errors.New("产品名称异常") |
| | | } |
| | | //if v.ProductName == "" { |
| | | // return errors.New("产品名称异常") |
| | | //} |
| | | if v.Amount.IsNegative() { |
| | | return errors.New("产品数量出错") |
| | | } |
| | |
| | | return |
| | | } |
| | | detail := &models.OperationDetails{ |
| | | ProductId: params.ProductId, |
| | | ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | Unit: params.Unit, |
| | | ProductId: params.ProductId, |
| | | //ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | //Unit: params.Unit, |
| | | } |
| | | operation := models.Operation{ |
| | | Number: strconv.FormatInt(time.Now().Unix(), 10), |
| | |
| | | return |
| | | } |
| | | |
| | | db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,wms_operation_details.product_name,wms_operation_details.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id") |
| | | //db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,wms_operation_details.product_name,wms_operation_details.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id") |
| | | |
| | | db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,material.name as product_name,material.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").InnerJoins("inner join material on material.id=wms_operation_details.product_id") |
| | | |
| | | if params.SourceNumber != "" { |
| | | db = db.Where("wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.SourceNumber)) |
| | |
| | | return |
| | | } |
| | | detail := &models.OperationDetails{ |
| | | ProductId: params.ProductId, |
| | | ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | Unit: params.Unit, |
| | | ProductId: params.ProductId, |
| | | //ProductName: params.ProductName, |
| | | Amount: params.Amount, |
| | | //Unit: params.Unit, |
| | | } |
| | | operation := models.Operation{ |
| | | Id: params.Id, |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string ` + "`" + `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` + "`" + ` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "createTime": { |
| | |
| | | "description": "操作id", |
| | | "type": "integer" |
| | | }, |
| | | "product": { |
| | | "description": "Unit string ` + "`" + `json:\"unit\" gorm:\"type:varchar(31);comment:单位\"` + "`" + ` //单位", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Material" |
| | | } |
| | | ] |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string ` + "`" + `json:\"productName\"` + "`" + `", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | | "type": "string" |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "integer" |
| | | }, |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string ` + "`" + `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` + "`" + ` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string ` + "`" + `json:\"productName\"` + "`" + `", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "description": "Unit string ` + "`" + `json:\"unit\"` + "`" + `", |
| | | "type": "string" |
| | | }, |
| | | "operationDate": { |
| | | "type": "string" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "createTime": { |
| | |
| | | "description": "操作id", |
| | | "type": "integer" |
| | | }, |
| | | "product": { |
| | | "description": "Unit string `json:\"unit\" gorm:\"type:varchar(31);comment:单位\"` //单位", |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/models.Material" |
| | | } |
| | | ] |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string `json:\"productName\"`", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | | "type": "string" |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | "type": "integer" |
| | | }, |
| | | "amount": { |
| | | "description": "数量", |
| | | "description": "ProductName string `json:\"productName\" gorm:\"type:varchar(255);not null;comment:产品名称\"` //产品名称", |
| | | "type": "number" |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "description": "ProductName string `json:\"productName\"`", |
| | | "type": "number" |
| | | }, |
| | | "fromLocationId": { |
| | |
| | | "type": "integer" |
| | | }, |
| | | "number": { |
| | | "description": "Unit string `json:\"unit\"`", |
| | | "type": "string" |
| | | }, |
| | | "operationDate": { |
| | | "type": "string" |
| | | }, |
| | | "productId": { |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "type": "string" |
| | | }, |
| | | "sourceNumber": { |
| | |
| | | }, |
| | | "toLocationId": { |
| | | "type": "integer" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | |
| | | models.OperationDetails: |
| | | properties: |
| | | amount: |
| | | description: 数量 |
| | | description: ProductName string `json:"productName" gorm:"type:varchar(255);not |
| | | null;comment:产品名称"` //产品名称 |
| | | type: number |
| | | createTime: |
| | | type: string |
| | |
| | | operationId: |
| | | description: 操作id |
| | | type: integer |
| | | product: |
| | | allOf: |
| | | - $ref: '#/definitions/models.Material' |
| | | description: Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` //单位 |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | unit: |
| | | type: string |
| | | updateTime: |
| | | type: string |
| | |
| | | request.AddDisuse: |
| | | properties: |
| | | amount: |
| | | description: ProductName string `json:"productName"` |
| | | type: number |
| | | fromLocationId: |
| | | type: integer |
| | | productId: |
| | | type: string |
| | | productName: |
| | | type: string |
| | | sourceNumber: |
| | | type: string |
| | | toLocationId: |
| | | type: integer |
| | | unit: |
| | | type: string |
| | | type: object |
| | | request.AddOperation: |
| | | properties: |
| | |
| | | description: 操作id |
| | | type: integer |
| | | amount: |
| | | description: 数量 |
| | | description: ProductName string `json:"productName" gorm:"type:varchar(255);not |
| | | null;comment:产品名称"` //产品名称 |
| | | type: number |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | unit: |
| | | type: string |
| | | type: object |
| | | request.OperationList: |
| | |
| | | request.UpdateDisuse: |
| | | properties: |
| | | amount: |
| | | description: ProductName string `json:"productName"` |
| | | type: number |
| | | fromLocationId: |
| | | type: integer |
| | | id: |
| | | type: integer |
| | | number: |
| | | description: Unit string `json:"unit"` |
| | | type: string |
| | | operationDate: |
| | | type: string |
| | | productId: |
| | | type: string |
| | | productName: |
| | | type: string |
| | | sourceNumber: |
| | | type: string |
| | |
| | | $ref: '#/definitions/constvar.OperationStatus' |
| | | toLocationId: |
| | | type: integer |
| | | unit: |
| | | type: string |
| | | type: object |
| | | request.UpdateOperation: |
| | | properties: |
| | |
| | | } |
| | | |
| | | if slf.Preload { |
| | | db = db.Model(&Operation{}).Preload("Details").Preload("FromLocation").Preload("ToLocation") |
| | | db = db.Model(&Operation{}).Preload("Details").Preload("Details.Product").Preload("FromLocation").Preload("ToLocation") |
| | | } |
| | | |
| | | if slf.Disuse { |
| | |
| | | // OperationDetails 操作明细表 |
| | | OperationDetails struct { |
| | | WmsModel |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | OperationID int `json:"operationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` |
| | | Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"` |
| | | OperationID int `json:"operationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | //ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | //Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` //单位 |
| | | Product Material `json:"product" gorm:"foreignKey:ProductId;references:ID"` |
| | | } |
| | | |
| | | OperationDetailsSearch struct { |
| | |
| | | } |
| | | |
| | | type OperationDetails struct { |
| | | OperationId int `json:"OperationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` |
| | | OperationId int `json:"OperationId" gorm:"type:int;not null;comment:操作记录id"` //操作id |
| | | ProductId string `json:"productId" gorm:"type:varchar(191);not null;comment:产品id"` //产品id |
| | | //ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:产品名称"` //产品名称 |
| | | Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:数量"` //数量 |
| | | //Unit string `json:"unit" gorm:"type:varchar(31);comment:单位"` //单位 |
| | | //Product models.Material `json:"product" gorm:"foreignKey:ProductId;references:ID"` |
| | | } |
| | | |
| | | type OperationList struct { |
| | |
| | | } |
| | | |
| | | type AddDisuse struct { |
| | | ProductId string `json:"productId"` |
| | | ProductName string `json:"productName"` |
| | | ProductId string `json:"productId"` |
| | | //ProductName string `json:"productName"` |
| | | Amount decimal.Decimal `json:"amount"` |
| | | FromLocationId int `json:"fromLocationId"` |
| | | ToLocationId int `json:"toLocationId"` |
| | | SourceNumber string `json:"sourceNumber"` |
| | | Unit string `json:"unit"` |
| | | //Unit string `json:"unit"` |
| | | } |
| | | |
| | | type QueryDisuseList struct { |
| | |
| | | } |
| | | |
| | | type UpdateDisuse struct { |
| | | Id int `json:"id"` |
| | | ProductId string `json:"productId"` |
| | | ProductName string `json:"productName"` |
| | | Amount decimal.Decimal `json:"amount"` |
| | | FromLocationId int `json:"fromLocationId"` |
| | | ToLocationId int `json:"toLocationId"` |
| | | SourceNumber string `json:"sourceNumber"` |
| | | Unit string `json:"unit"` |
| | | Number string `json:"number"` |
| | | Status constvar.OperationStatus `json:"status"` |
| | | OperationDate string `json:"operationDate"` |
| | | Id int `json:"id"` |
| | | ProductId string `json:"productId"` |
| | | //ProductName string `json:"productName"` |
| | | Amount decimal.Decimal `json:"amount"` |
| | | FromLocationId int `json:"fromLocationId"` |
| | | ToLocationId int `json:"toLocationId"` |
| | | SourceNumber string `json:"sourceNumber"` |
| | | //Unit string `json:"unit"` |
| | | Number string `json:"number"` |
| | | Status constvar.OperationStatus `json:"status"` |
| | | OperationDate string `json:"operationDate"` |
| | | } |