zhangqian
2024-04-16 4a8a520396df8a780e71b2c2a1c757dfab7ad831
月度统计报表查询接口
7个文件已修改
563 ■■■■■ 已修改文件
controllers/report_forms_controller.go 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 133 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
models/month_stats.go 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
request/report_forms_request.go 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
router/router.go 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
controllers/report_forms_controller.go
@@ -370,3 +370,27 @@
    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(&params); 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))
}
docs/docs.go
@@ -551,6 +551,58 @@
                }
            }
        },
        "/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": [
@@ -3440,6 +3492,12 @@
                    "description": "客户前置时间(天)",
                    "type": "number"
                },
                "grossUnit": {
                    "type": "string"
                },
                "grossWeight": {
                    "type": "number"
                },
                "id": {
                    "type": "string"
                },
@@ -3514,9 +3572,24 @@
                        }
                    ]
                },
                "moreUnit": {
                    "type": "boolean"
                },
                "moreUnitList": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/models.UnitItems"
                    }
                },
                "name": {
                    "description": "物料名称",
                    "type": "string"
                },
                "netUnit": {
                    "type": "string"
                },
                "netWeight": {
                    "type": "number"
                },
                "note": {
                    "type": "string"
@@ -3612,6 +3685,84 @@
                "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": "重量",
@@ -3829,6 +3980,12 @@
                    "description": "目标位置id",
                    "type": "integer"
                },
                "totalGrossWeight": {
                    "type": "number"
                },
                "totalNetWeight": {
                    "type": "number"
                },
                "updateTime": {
                    "type": "string"
                }
@@ -3958,6 +4115,20 @@
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "models.UnitItems": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "floating": {
                    "type": "boolean"
                },
                "unit": {
                    "type": "string"
                }
            }
@@ -4514,6 +4685,25 @@
                }
            }
        },
        "request.GetMonthStats": {
            "type": "object",
            "properties": {
                "date": {
                    "type": "string"
                },
                "keyword": {
                    "type": "string"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                }
            }
        },
        "request.GetProductList": {
            "type": "object",
            "properties": {
@@ -4629,6 +4819,14 @@
                "toLocationId": {
                    "description": "目标位置id",
                    "type": "integer"
                },
                "totalGrossWeight": {
                    "description": "总毛重",
                    "type": "number"
                },
                "totalNetWeight": {
                    "description": "总净重",
                    "type": "number"
                }
            }
        },
docs/swagger.json
@@ -539,6 +539,58 @@
                }
            }
        },
        "/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": [
@@ -3428,6 +3480,12 @@
                    "description": "客户前置时间(天)",
                    "type": "number"
                },
                "grossUnit": {
                    "type": "string"
                },
                "grossWeight": {
                    "type": "number"
                },
                "id": {
                    "type": "string"
                },
@@ -3502,9 +3560,24 @@
                        }
                    ]
                },
                "moreUnit": {
                    "type": "boolean"
                },
                "moreUnitList": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/models.UnitItems"
                    }
                },
                "name": {
                    "description": "物料名称",
                    "type": "string"
                },
                "netUnit": {
                    "type": "string"
                },
                "netWeight": {
                    "type": "number"
                },
                "note": {
                    "type": "string"
@@ -3600,6 +3673,84 @@
                "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": "重量",
@@ -3817,6 +3968,12 @@
                    "description": "目标位置id",
                    "type": "integer"
                },
                "totalGrossWeight": {
                    "type": "number"
                },
                "totalNetWeight": {
                    "type": "number"
                },
                "updateTime": {
                    "type": "string"
                }
@@ -3946,6 +4103,20 @@
                    "type": "boolean"
                },
                "name": {
                    "type": "string"
                }
            }
        },
        "models.UnitItems": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "floating": {
                    "type": "boolean"
                },
                "unit": {
                    "type": "string"
                }
            }
@@ -4502,6 +4673,25 @@
                }
            }
        },
        "request.GetMonthStats": {
            "type": "object",
            "properties": {
                "date": {
                    "type": "string"
                },
                "keyword": {
                    "type": "string"
                },
                "page": {
                    "description": "页码",
                    "type": "integer"
                },
                "pageSize": {
                    "description": "每页大小",
                    "type": "integer"
                }
            }
        },
        "request.GetProductList": {
            "type": "object",
            "properties": {
@@ -4617,6 +4807,14 @@
                "toLocationId": {
                    "description": "目标位置id",
                    "type": "integer"
                },
                "totalGrossWeight": {
                    "description": "总毛重",
                    "type": "number"
                },
                "totalNetWeight": {
                    "description": "总净重",
                    "type": "number"
                }
            }
        },
docs/swagger.yaml
@@ -540,6 +540,10 @@
      deliveryAdvanceTime:
        description: 客户前置时间(天)
        type: number
      grossUnit:
        type: string
      grossWeight:
        type: number
      id:
        type: string
      inStorageExplain:
@@ -597,9 +601,19 @@
        - $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:
@@ -668,6 +682,62 @@
      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
@@ -811,6 +881,10 @@
      toLocationId:
        description: 目标位置id
        type: integer
      totalGrossWeight:
        type: number
      totalNetWeight:
        type: number
      updateTime:
        type: string
    type: object
@@ -897,6 +971,15 @@
      isDefault:
        type: boolean
      name:
        type: string
    type: object
  models.UnitItems:
    properties:
      amount:
        type: number
      floating:
        type: boolean
      unit:
        type: string
    type: object
  models.Warehouse:
@@ -1284,6 +1367,19 @@
      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:
@@ -1368,6 +1464,12 @@
      toLocationId:
        description: 目标位置id
        type: integer
      totalGrossWeight:
        description: 总毛重
        type: number
      totalNetWeight:
        description: 总净重
        type: number
    type: object
  request.OperationList:
    properties:
@@ -2139,6 +2241,37 @@
      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:
models/month_stats.go
@@ -177,7 +177,8 @@
    }
    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 != "" {
request/report_forms_request.go
@@ -25,3 +25,9 @@
    ProductId     string `json:"productId"`
    LocationId    int    `json:"locationId"`
}
type GetMonthStats struct {
    PageInfo
    Keyword string `json:"keyword"`
    Date    string `json:"date"`
}
router/router.go
@@ -156,6 +156,7 @@
        reportFormsAPI.POST("getInventoryForms", reportFormsController.GetInventoryForms) //获取库存报表
        reportFormsAPI.POST("getHistory", reportFormsController.GetHistory)               //获取库存历史
        reportFormsAPI.POST("getLocationForms", reportFormsController.GetLocationForms)   //获取位置报表
        reportFormsAPI.POST("monthStats", reportFormsController.MonthStats)               //获取月度统计报表
    }
    //重订货规则