| | |
| | | search.Orm = search.Orm. |
| | | Table("wms_location_product_amount"). |
| | | Select(` |
| | | wms_location_product_amount.id as location_product_amount_id, |
| | | wms_location.id as location_id, |
| | | wms_location.name as location_name, |
| | | material.id as product_id, |
| | |
| | | wms_operation_details.amount as adjust_amount, |
| | | wms_operation.id as operation_id`). |
| | | InnerJoins("inner join wms_location_product on wms_location_product.id=wms_location_product_amount.location_product_id"). |
| | | InnerJoins("inner join material on material.id=wms_location_product.product_id"). |
| | | InnerJoins("inner join wms_location on wms_location.id=wms_location_product.location_id"). |
| | | InnerJoins("inner join wms_operation_details on wms_operation_details.product_id=wms_location_product.product_id"). |
| | | InnerJoins("inner join material on material.id=wms_operation_details.product_id"). |
| | | InnerJoins("inner join wms_operation on wms_operation.id=wms_operation_details.operation_id"). |
| | | Where("wms_operation.base_operation_type=?", constvar.BaseOperationTypeAdjust) |
| | | |
| | | Joins("left join wms_operation_details on wms_operation_details.product_id=wms_location_product.product_id"). |
| | | Joins("left join wms_operation on wms_operation.id=wms_operation_details.operation_id and wms_operation.base_operation_type=? and wms_operation.status=?", constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready) |
| | | var ( |
| | | records = make([]*models.LocationProductAmountWithOperation, 0) |
| | | total int64 |
| | |
| | | return |
| | | } |
| | | for k, v := range records { |
| | | records[k].DifferenceAmount = v.Amount.Sub(v.AdjustAmount) |
| | | if v.OperationId != 0 { |
| | | records[k].DifferenceAmount = v.Amount.Add(v.AdjustAmount) |
| | | } |
| | | } |
| | | util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/getRuleList": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | ], |
| | | "summary": "获取上架规则", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetRuleList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/response.RuleList" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/list": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetRuleList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "locationId": { |
| | | "description": "位置id", |
| | | "type": "integer" |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.OperationAllList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.RuleList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "locationList": { |
| | | "description": "位置列表", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | }, |
| | | "productList": { |
| | | "description": "产品列表", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Material" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "util.Response": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/getRuleList": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "库存盘点" |
| | | ], |
| | | "summary": "获取上架规则", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询信息", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetRuleList" |
| | | } |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/response.RuleList" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/locationProductAmount/list": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetRuleList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "locationId": { |
| | | "description": "位置id", |
| | | "type": "integer" |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "request.OperationAllList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | } |
| | | } |
| | | }, |
| | | "response.RuleList": { |
| | | "type": "object", |
| | | "properties": { |
| | | "locationList": { |
| | | "description": "位置列表", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Location" |
| | | } |
| | | }, |
| | | "productList": { |
| | | "description": "产品列表", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.Material" |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "util.Response": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | description: 每页大小 |
| | | type: integer |
| | | type: object |
| | | request.GetRuleList: |
| | | properties: |
| | | locationId: |
| | | description: 位置id |
| | | type: integer |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | | type: object |
| | | request.OperationAllList: |
| | | properties: |
| | | number: |
| | |
| | | value: |
| | | description: 总价值 |
| | | type: number |
| | | type: object |
| | | response.RuleList: |
| | | properties: |
| | | locationList: |
| | | description: 位置列表 |
| | | items: |
| | | $ref: '#/definitions/models.Location' |
| | | type: array |
| | | productList: |
| | | description: 产品列表 |
| | | items: |
| | | $ref: '#/definitions/models.Material' |
| | | type: array |
| | | type: object |
| | | util.Response: |
| | | properties: |
| | |
| | | summary: 应用、验证 |
| | | tags: |
| | | - 库存盘点 |
| | | /api-wms/v1/locationProductAmount/getRuleList: |
| | | post: |
| | | parameters: |
| | | - description: 查询信息 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetRuleList' |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/response.RuleList' |
| | | type: array |
| | | type: object |
| | | summary: 获取上架规则 |
| | | tags: |
| | | - 库存盘点 |
| | | /api-wms/v1/locationProductAmount/list: |
| | | post: |
| | | parameters: |
| | |
| | | |
| | | LocationProductAmountWithOperation struct { |
| | | //LocationProductAmount LocationProductAmount `json:"locationProductAmount"` |
| | | LocationId int `json:"locationId" gorm:"column:location_id"` |
| | | LocationName string `json:"locationName" gorm:"column:location_name"` |
| | | ProductId string `json:"productId" gorm:"column:product_id"` |
| | | ProductName string `json:"productName" gorm:"column:product_name"` |
| | | Amount decimal.Decimal `json:"amount" gorm:"column:amount"` |
| | | Unit string `json:"unit" gorm:"column:unit"` |
| | | CreateDate string `json:"createDate" gorm:"column:create_date"` |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` |
| | | DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"` |
| | | OperationId int `json:"operationId" gorm:"column:operation_id"` |
| | | LocationProductAmountId int `json:"locationProductAmount" gorm:"location_product_amount_id"` |
| | | LocationId int `json:"locationId" gorm:"column:location_id"` |
| | | LocationName string `json:"locationName" gorm:"column:location_name"` |
| | | ProductId string `json:"productId" gorm:"column:product_id"` |
| | | ProductName string `json:"productName" gorm:"column:product_name"` |
| | | Amount decimal.Decimal `json:"amount" gorm:"column:amount"` |
| | | Unit string `json:"unit" gorm:"column:unit"` |
| | | CreateDate string `json:"createDate" gorm:"column:create_date"` |
| | | AdjustAmount decimal.Decimal `json:"adjustAmount" gorm:"column:adjust_amount"` |
| | | DifferenceAmount decimal.Decimal `json:"differenceAmount" gorm:"-"` |
| | | OperationId int `json:"operationId" gorm:"column:operation_id"` |
| | | } |
| | | ) |
| | | |