| | |
| | | // @Tags 入库/出库 |
| | | // @Summary 入库/出库列表 |
| | | // @Produce application/json |
| | | // @Accept json |
| | | // @Param object query request.OperationList true "参数" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/operation [get] |
| | | // @Param object body request.OperationList true "查询参数" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/list [post] |
| | | func (slf OperationController) List(c *gin.Context) { |
| | | var params request.OperationList |
| | | if err := c.ShouldBindQuery(¶ms); err != nil { |
| | | if err := c.BindJSON(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error()) |
| | | return |
| | | } |
| | |
| | | } |
| | | search := models.NewOperationSearch() |
| | | search.SetPage(params.Page, params.PageSize) |
| | | if params.Number != "" { |
| | | search.SetNumber(params.Number) |
| | | } |
| | | if params.SourceNumber != "" { |
| | | search.SetSourceNumber(params.SourceNumber) |
| | | } |
| | | list, total, err := search.SetOperationTypeId(params.OperationTypeId).SetPreload(true).SetOrder("created_at desc").Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error()) |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatList(c, code.Success, list, int(total)) |
| | | util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | util.ResponseFormat(c, code.Success, "操作成功") |
| | | } |
| | | |
| | | // ListAll |
| | | // @Tags 入库/出库 |
| | | // @Summary 调拨 |
| | | // @Produce application/json |
| | | // @Param object body request.OperationAllList true "参数" |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/operation/listAll [post] |
| | | func (slf OperationController) ListAll(c *gin.Context) { |
| | | var params request.OperationAllList |
| | | if err := c.BindJSON(¶ms); err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, "参数解析失败,数据类型错误:"+err.Error()) |
| | | return |
| | | } |
| | | if !params.PageInfo.Check() { |
| | | util.ResponseFormat(c, code.RequestParamError, "数据分页信息错误") |
| | | return |
| | | } |
| | | search := models.NewOperationSearch() |
| | | search.SetPage(params.Page, params.PageSize) |
| | | search.SetPage(params.Page, params.PageSize) |
| | | if params.Number != "" { |
| | | search.SetNumber(params.Number) |
| | | } |
| | | if params.SourceNumber != "" { |
| | | search.SetSourceNumber(params.SourceNumber) |
| | | } |
| | | list, total, err := search.SetPreload(true).SetOrder("created_at desc").Find() |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestError, "查找失败:"+err.Error()) |
| | | return |
| | | } |
| | | |
| | | util.ResponseFormatListWithPage(c, code.Success, list, int(total), params.Page, params.PageSize) |
| | | |
| | | } |