| | |
| | | "wms/pkg/mysqlx" |
| | | "wms/pkg/structx" |
| | | "wms/request" |
| | | "wms/response" |
| | | "wms/service" |
| | | ) |
| | | |
| | | type ProductController struct { |
| | |
| | | |
| | | util.ResponseFormat(c, code.Success, "添加成功") |
| | | } |
| | | |
| | | // InputProduct |
| | | // |
| | | // @Tags 物料管理 |
| | | // @Summary 导入物料 |
| | | // @Produce application/xlsx |
| | | // @Success 200 {object} util.Response "成功" |
| | | // @Router /api-wms/v1/product/inputProduct [post] |
| | | func (slf ProductController) InputProduct(c *gin.Context) { |
| | | file, _, err := c.Request.FormFile("file") |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | defer file.Close() |
| | | resp := response.MaterialInputRes{InputCount: 0, ErrCount: 0, FileAddress: ""} |
| | | userInfo := middleware.GetUserInfo(c) |
| | | insertCount, err := service.InputMaterial(file, userInfo.Username) |
| | | if err != nil { |
| | | util.ResponseFormat(c, code.RequestParamError, err.Error()) |
| | | return |
| | | } |
| | | resp.InputCount = insertCount |
| | | util.ResponseFormat(c, code.Success, resp) |
| | | } |