From 96236f07009f7138af765633fe3ac30c8ba88b94 Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期三, 19 六月 2024 14:26:11 +0800
Subject: [PATCH] 产品-产品-Excel导入产品

---
 controllers/product_controller.go |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index 3e9ea0c..cb0e7fc 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -18,6 +18,8 @@
 	"wms/pkg/mysqlx"
 	"wms/pkg/structx"
 	"wms/request"
+	"wms/response"
+	"wms/service"
 )
 
 type ProductController struct {
@@ -874,3 +876,28 @@
 
 	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)
+}

--
Gitblit v1.8.0