| | |
| | | |
| | | util.ResponseFormatList(c, code.Success, result, int(total)) |
| | | } |
| | | |
| | | // MonthStats |
| | | // @Tags 报表 |
| | | // @Summary 月度统计库存报表 |
| | | // @Produce application/json |
| | | // @Param object body request.GetMonthStats true "查询参数" |
| | | // @Param Authorization header string true "token" |
| | | // @Success 200 {object} util.ResponseList{data=[]models.MonthStats} "成功" |
| | | // @Router /api-wms/v1/forms/monthStats [post] |
| | | func (slf ReportFormsController) MonthStats(c *gin.Context) { |
| | | var params request.GetMonthStats |
| | | if err := c.BindJSON(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误") |
| | | return |
| | | } |
| | | |
| | | list, total, err := models.NewMonthStatsSearch().SetPage(params.Page, params.PageSize).SetKeyword(params.Keyword).SetDate(params.Date).Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.InternalError, "查询失败") |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatList(c, code.Success, list, int(total)) |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/forms/monthStats": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "报表" |
| | | ], |
| | | "summary": "月度统计库存报表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetMonthStats" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.MonthStats" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/location/addLocation": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "description": "客户前置时间(天)", |
| | | "type": "number" |
| | | }, |
| | | "grossUnit": { |
| | | "type": "string" |
| | | }, |
| | | "grossWeight": { |
| | | "type": "number" |
| | | }, |
| | | "id": { |
| | | "type": "string" |
| | | }, |
| | |
| | | } |
| | | ] |
| | | }, |
| | | "moreUnit": { |
| | | "type": "boolean" |
| | | }, |
| | | "moreUnitList": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "name": { |
| | | "description": "物料名称", |
| | | "type": "string" |
| | | }, |
| | | "netUnit": { |
| | | "type": "string" |
| | | }, |
| | | "netWeight": { |
| | | "type": "number" |
| | | }, |
| | | "note": { |
| | | "type": "string" |
| | |
| | | "volume": { |
| | | "description": "体积", |
| | | "type": "number" |
| | | }, |
| | | "weight": { |
| | | "description": "重量", |
| | | "type": "number" |
| | | } |
| | | } |
| | | }, |
| | | "models.MonthStats": { |
| | | "type": "object", |
| | | "properties": { |
| | | "MoreUnitsArr": { |
| | | "description": "期末其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "amount": { |
| | | "description": "期末结余数量", |
| | | "type": "number" |
| | | }, |
| | | "beginAmount": { |
| | | "description": "期初数量", |
| | | "type": "number" |
| | | }, |
| | | "beginMoreUnitsArr": { |
| | | "description": "期初其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "date": { |
| | | "description": "日期 2024-04", |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "inputAmount": { |
| | | "description": "入库数量", |
| | | "type": "number" |
| | | }, |
| | | "inputMoreUnitsArr": { |
| | | "description": "入库其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "outputAmount": { |
| | | "description": "出库数量", |
| | | "type": "number" |
| | | }, |
| | | "outputMoreUnitsArr": { |
| | | "description": "出库其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | }, |
| | | "weight": { |
| | | "description": "重量", |
| | |
| | | "description": "目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "totalGrossWeight": { |
| | | "type": "number" |
| | | }, |
| | | "totalNetWeight": { |
| | | "type": "number" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | |
| | | "type": "boolean" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.UnitItems": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "type": "number" |
| | | }, |
| | | "floating": { |
| | | "type": "boolean" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetMonthStats": { |
| | | "type": "object", |
| | | "properties": { |
| | | "date": { |
| | | "type": "string" |
| | | }, |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetProductList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "toLocationId": { |
| | | "description": "目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "totalGrossWeight": { |
| | | "description": "总毛重", |
| | | "type": "number" |
| | | }, |
| | | "totalNetWeight": { |
| | | "description": "总净重", |
| | | "type": "number" |
| | | } |
| | | } |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/forms/monthStats": { |
| | | "post": { |
| | | "produces": [ |
| | | "application/json" |
| | | ], |
| | | "tags": [ |
| | | "报表" |
| | | ], |
| | | "summary": "月度统计库存报表", |
| | | "parameters": [ |
| | | { |
| | | "description": "查询参数", |
| | | "name": "object", |
| | | "in": "body", |
| | | "required": true, |
| | | "schema": { |
| | | "$ref": "#/definitions/request.GetMonthStats" |
| | | } |
| | | }, |
| | | { |
| | | "type": "string", |
| | | "description": "token", |
| | | "name": "Authorization", |
| | | "in": "header", |
| | | "required": true |
| | | } |
| | | ], |
| | | "responses": { |
| | | "200": { |
| | | "description": "成功", |
| | | "schema": { |
| | | "allOf": [ |
| | | { |
| | | "$ref": "#/definitions/util.ResponseList" |
| | | }, |
| | | { |
| | | "type": "object", |
| | | "properties": { |
| | | "data": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.MonthStats" |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | "/api-wms/v1/location/addLocation": { |
| | | "post": { |
| | | "produces": [ |
| | |
| | | "description": "客户前置时间(天)", |
| | | "type": "number" |
| | | }, |
| | | "grossUnit": { |
| | | "type": "string" |
| | | }, |
| | | "grossWeight": { |
| | | "type": "number" |
| | | }, |
| | | "id": { |
| | | "type": "string" |
| | | }, |
| | |
| | | } |
| | | ] |
| | | }, |
| | | "moreUnit": { |
| | | "type": "boolean" |
| | | }, |
| | | "moreUnitList": { |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "name": { |
| | | "description": "物料名称", |
| | | "type": "string" |
| | | }, |
| | | "netUnit": { |
| | | "type": "string" |
| | | }, |
| | | "netWeight": { |
| | | "type": "number" |
| | | }, |
| | | "note": { |
| | | "type": "string" |
| | |
| | | "volume": { |
| | | "description": "体积", |
| | | "type": "number" |
| | | }, |
| | | "weight": { |
| | | "description": "重量", |
| | | "type": "number" |
| | | } |
| | | } |
| | | }, |
| | | "models.MonthStats": { |
| | | "type": "object", |
| | | "properties": { |
| | | "MoreUnitsArr": { |
| | | "description": "期末其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "amount": { |
| | | "description": "期末结余数量", |
| | | "type": "number" |
| | | }, |
| | | "beginAmount": { |
| | | "description": "期初数量", |
| | | "type": "number" |
| | | }, |
| | | "beginMoreUnitsArr": { |
| | | "description": "期初其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "createTime": { |
| | | "type": "string" |
| | | }, |
| | | "date": { |
| | | "description": "日期 2024-04", |
| | | "type": "string" |
| | | }, |
| | | "id": { |
| | | "type": "integer" |
| | | }, |
| | | "inputAmount": { |
| | | "description": "入库数量", |
| | | "type": "number" |
| | | }, |
| | | "inputMoreUnitsArr": { |
| | | "description": "入库其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "outputAmount": { |
| | | "description": "出库数量", |
| | | "type": "number" |
| | | }, |
| | | "outputMoreUnitsArr": { |
| | | "description": "出库其他单位数组", |
| | | "type": "array", |
| | | "items": { |
| | | "$ref": "#/definitions/models.UnitItems" |
| | | } |
| | | }, |
| | | "productId": { |
| | | "description": "产品id", |
| | | "type": "string" |
| | | }, |
| | | "productName": { |
| | | "description": "产品名称", |
| | | "type": "string" |
| | | }, |
| | | "unit": { |
| | | "description": "单位", |
| | | "type": "string" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | }, |
| | | "weight": { |
| | | "description": "重量", |
| | |
| | | "description": "目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "totalGrossWeight": { |
| | | "type": "number" |
| | | }, |
| | | "totalNetWeight": { |
| | | "type": "number" |
| | | }, |
| | | "updateTime": { |
| | | "type": "string" |
| | | } |
| | |
| | | "type": "boolean" |
| | | }, |
| | | "name": { |
| | | "type": "string" |
| | | } |
| | | } |
| | | }, |
| | | "models.UnitItems": { |
| | | "type": "object", |
| | | "properties": { |
| | | "amount": { |
| | | "type": "number" |
| | | }, |
| | | "floating": { |
| | | "type": "boolean" |
| | | }, |
| | | "unit": { |
| | | "type": "string" |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | }, |
| | | "request.GetMonthStats": { |
| | | "type": "object", |
| | | "properties": { |
| | | "date": { |
| | | "type": "string" |
| | | }, |
| | | "keyword": { |
| | | "type": "string" |
| | | }, |
| | | "page": { |
| | | "description": "页码", |
| | | "type": "integer" |
| | | }, |
| | | "pageSize": { |
| | | "description": "每页大小", |
| | | "type": "integer" |
| | | } |
| | | } |
| | | }, |
| | | "request.GetProductList": { |
| | | "type": "object", |
| | | "properties": { |
| | |
| | | "toLocationId": { |
| | | "description": "目标位置id", |
| | | "type": "integer" |
| | | }, |
| | | "totalGrossWeight": { |
| | | "description": "总毛重", |
| | | "type": "number" |
| | | }, |
| | | "totalNetWeight": { |
| | | "description": "总净重", |
| | | "type": "number" |
| | | } |
| | | } |
| | | }, |
| | |
| | | deliveryAdvanceTime: |
| | | description: 客户前置时间(天) |
| | | type: number |
| | | grossUnit: |
| | | type: string |
| | | grossWeight: |
| | | type: number |
| | | id: |
| | | type: string |
| | | inStorageExplain: |
| | |
| | | - $ref: '#/definitions/constvar.MaterialMode' |
| | | description: MaterialType constvar.ProductType `gorm:"index;type:int(11);comment:物料类型(数字)" |
| | | json:"materialType"` |
| | | moreUnit: |
| | | type: boolean |
| | | moreUnitList: |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | name: |
| | | description: 物料名称 |
| | | type: string |
| | | netUnit: |
| | | type: string |
| | | netWeight: |
| | | type: number |
| | | note: |
| | | type: string |
| | | orderAdvanceTime: |
| | |
| | | volume: |
| | | description: 体积 |
| | | type: number |
| | | weight: |
| | | description: 重量 |
| | | type: number |
| | | type: object |
| | | models.MonthStats: |
| | | properties: |
| | | MoreUnitsArr: |
| | | description: 期末其他单位数组 |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | amount: |
| | | description: 期末结余数量 |
| | | type: number |
| | | beginAmount: |
| | | description: 期初数量 |
| | | type: number |
| | | beginMoreUnitsArr: |
| | | description: 期初其他单位数组 |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | createTime: |
| | | type: string |
| | | date: |
| | | description: 日期 2024-04 |
| | | type: string |
| | | id: |
| | | type: integer |
| | | inputAmount: |
| | | description: 入库数量 |
| | | type: number |
| | | inputMoreUnitsArr: |
| | | description: 入库其他单位数组 |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | outputAmount: |
| | | description: 出库数量 |
| | | type: number |
| | | outputMoreUnitsArr: |
| | | description: 出库其他单位数组 |
| | | items: |
| | | $ref: '#/definitions/models.UnitItems' |
| | | type: array |
| | | productId: |
| | | description: 产品id |
| | | type: string |
| | | productName: |
| | | description: 产品名称 |
| | | type: string |
| | | unit: |
| | | description: 单位 |
| | | type: string |
| | | updateTime: |
| | | type: string |
| | | weight: |
| | | description: 重量 |
| | | type: number |
| | |
| | | toLocationId: |
| | | description: 目标位置id |
| | | type: integer |
| | | totalGrossWeight: |
| | | type: number |
| | | totalNetWeight: |
| | | type: number |
| | | updateTime: |
| | | type: string |
| | | type: object |
| | |
| | | isDefault: |
| | | type: boolean |
| | | name: |
| | | type: string |
| | | type: object |
| | | models.UnitItems: |
| | | properties: |
| | | amount: |
| | | type: number |
| | | floating: |
| | | type: boolean |
| | | unit: |
| | | type: string |
| | | type: object |
| | | models.Warehouse: |
| | |
| | | type: |
| | | type: integer |
| | | type: object |
| | | request.GetMonthStats: |
| | | properties: |
| | | date: |
| | | type: string |
| | | keyword: |
| | | type: string |
| | | page: |
| | | description: 页码 |
| | | type: integer |
| | | pageSize: |
| | | description: 每页大小 |
| | | type: integer |
| | | type: object |
| | | request.GetProductList: |
| | | properties: |
| | | categoryId: |
| | |
| | | toLocationId: |
| | | description: 目标位置id |
| | | type: integer |
| | | totalGrossWeight: |
| | | description: 总毛重 |
| | | type: number |
| | | totalNetWeight: |
| | | description: 总净重 |
| | | type: number |
| | | type: object |
| | | request.OperationList: |
| | | properties: |
| | |
| | | summary: 获取位置报表 |
| | | tags: |
| | | - 报表 |
| | | /api-wms/v1/forms/monthStats: |
| | | post: |
| | | parameters: |
| | | - description: 查询参数 |
| | | in: body |
| | | name: object |
| | | required: true |
| | | schema: |
| | | $ref: '#/definitions/request.GetMonthStats' |
| | | - description: token |
| | | in: header |
| | | name: Authorization |
| | | required: true |
| | | type: string |
| | | produces: |
| | | - application/json |
| | | responses: |
| | | "200": |
| | | description: 成功 |
| | | schema: |
| | | allOf: |
| | | - $ref: '#/definitions/util.ResponseList' |
| | | - properties: |
| | | data: |
| | | items: |
| | | $ref: '#/definitions/models.MonthStats' |
| | | type: array |
| | | type: object |
| | | summary: 月度统计库存报表 |
| | | tags: |
| | | - 报表 |
| | | /api-wms/v1/location/addLocation: |
| | | post: |
| | | parameters: |
| | |
| | | } |
| | | |
| | | if slf.Keyword != "" { |
| | | db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)) |
| | | kw := fmt.Sprintf("%%%v%%", slf.Keyword) |
| | | db = db.Where("product_id like ? or product_name like ?", kw, kw) |
| | | } |
| | | |
| | | if slf.Date != "" { |
| | |
| | | ProductId string `json:"productId"` |
| | | LocationId int `json:"locationId"` |
| | | } |
| | | |
| | | type GetMonthStats struct { |
| | | PageInfo |
| | | Keyword string `json:"keyword"` |
| | | Date string `json:"date"` |
| | | } |
| | |
| | | reportFormsAPI.POST("getInventoryForms", reportFormsController.GetInventoryForms) //获取库存报表 |
| | | reportFormsAPI.POST("getHistory", reportFormsController.GetHistory) //获取库存历史 |
| | | reportFormsAPI.POST("getLocationForms", reportFormsController.GetLocationForms) //获取位置报表 |
| | | reportFormsAPI.POST("monthStats", reportFormsController.MonthStats) //获取月度统计报表 |
| | | } |
| | | |
| | | //重订货规则 |