Selaa lähdekoodia

去掉4bool类型的值,默认为true

liwei 1 kuukausi sitten
vanhempi
commit
09259f6e32
3 muutettua tiedostoa jossa 29 lisäystä ja 29 poistoa
  1. BIN
      sku3d/.DS_Store
  2. 29 29
      sku3d/sku3d/api/a-excel.go
  3. BIN
      sku3d/sku3d/template.xlsx

BIN
sku3d/.DS_Store


+ 29 - 29
sku3d/sku3d/api/a-excel.go

@@ -30,7 +30,7 @@ var fixedHeaders = []string{
 	"公司商品编号", "商品中文名", "商品英文名", "分类", "图片",
 	"单位包材毛重(KG)", "单位包材体积(CBM)", "长度(MM)", "门幅/宽(MM)", "厚度/高(MM)",
 	"备注", "首选供应商", "默认采购单价", "样品搜集人", "开发日期",
-	"出口属性", "内销属性", "内购属性", "委外属性",
+	// "出口属性", "内销属性", "内购属性", "委外属性", 2025-4-29沟通去掉这几个属性
 	"报关助记符", "报关商品编码", "报关商品中文名", "录入人名称", "适合的市场",
 	"供应商编号", "种类分类", "种类分类名称", "基布", "基布名称",
 	"表面工艺", "表面工艺名称", "产品克重(KG)", "运营周期", "商品单位体积",
@@ -228,21 +228,21 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 			devTime, _ := time.Parse(layout, row[15])
 			imageMat.DevTime = &devTime
 		}
-		var str2bool = func(s string) *bool {
-			result := false
-			if s == "True" {
-				result = true
-			}
-			return &result
-		}
+		// var str2bool = func(s string) *bool {
+		// 	result := false
+		// 	if s == "True" {
+		// 		result = true
+		// 	}
+		// 	return &result
+		// }
 		// 出口属性
-		imageMat.ExportProperty = str2bool(row[16])
+		imageMat.ExportProperty = BoolValue(true) //str2bool(row[16])
 		// 内销属性
-		imageMat.DomesticProperty = str2bool(row[17])
+		imageMat.DomesticProperty = BoolValue(true) //str2bool(row[17])
 		// 内购属性
-		imageMat.InpurchaseProperty = str2bool(row[18])
+		imageMat.InpurchaseProperty = BoolValue(true) //str2bool(row[18])
 		// 委外属性
-		imageMat.OutsourcedProperty = str2bool(row[19])
+		imageMat.OutsourcedProperty = BoolValue(true) //str2bool(row[19])
 
 		// 报关助记
 		// 根据分类层级一的名字获取对应id,遍历一层获取对应数据
@@ -250,7 +250,7 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 		for _, cate := range cates {
 			if cate.Name == "报关助记符" {
 				for _, c := range cate.Children {
-					if c.Name == row[20] {
+					if c.Name == row[20-4] {
 						// 记录该分类为其他自动做准备
 						row20Cate = c
 					}
@@ -265,15 +265,15 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 			continue
 		}
 		imageMat.Categories = append(imageMat.Categories, row20Cate.IdStr)
-		imageMat.TaxNameCN = row[22]
+		imageMat.TaxNameCN = row[22-4]
 		// 录入人
 		imageMat.UserId, _ = primitive.ObjectIDFromHex(apictx.User.ID)
-		imageMat.FitMarket = row[24]
+		imageMat.FitMarket = row[24-4]
 		// 供应商编号
-		imageMat.SupplierID = row[25]
+		imageMat.SupplierID = row[25-4]
 
 		// 种类分类
-		row26Cate := getRowCate2(row3Cate, "种类分类", row[27], row[26])
+		row26Cate := getRowCate2(row3Cate, "种类分类", row[27-4], row[26-4])
 		if row26Cate == nil {
 			// 没有找到对应分类
 			result.Status = "失败"
@@ -284,7 +284,7 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 		imageMat.Categories = append(imageMat.Categories, row26Cate.IdStr)
 
 		// 基布
-		row28Cate := getRowCate2(row3Cate, "基布", row[29], row[28])
+		row28Cate := getRowCate2(row3Cate, "基布", row[29-4], row[28-4])
 		if row28Cate == nil {
 			// 没有找到对应分类
 			result.Status = "失败"
@@ -295,7 +295,7 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 		imageMat.Categories = append(imageMat.Categories, row28Cate.IdStr)
 
 		// 表面工艺
-		row30Cate := getRowCate2(row3Cate, "表面工艺", row[31], row[30])
+		row30Cate := getRowCate2(row3Cate, "表面工艺", row[31-4], row[30-4])
 		if row30Cate == nil {
 			// 没有找到对应分类
 			result.Status = "失败"
@@ -306,18 +306,18 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 		imageMat.Categories = append(imageMat.Categories, row30Cate.IdStr)
 
 		// 产品克重
-		pw := str2float64(row[32])
+		pw := str2float64(row[32-4])
 		imageMat.ProductWeight = &pw
 		// 运营周期
-		imageMat.OperationCycle = row[33]
+		imageMat.OperationCycle = row[33-4]
 		// 商品单位体积
-		pv := str2float64(row[34])
+		pv := str2float64(row[34-4])
 		imageMat.ProductVolume = &pv
 
 		// ??? 产品分类代码
 
 		// 产品系列
-		row36Cate := getRowCate2(row3Cate, "产品系列", row[37], row[36])
+		row36Cate := getRowCate2(row3Cate, "产品系列", row[37-4], row[36-4])
 		if row36Cate == nil {
 			// 没有找到对应分类
 			result.Status = "失败"
@@ -328,7 +328,7 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 		imageMat.Categories = append(imageMat.Categories, row36Cate.IdStr)
 
 		// 产品用途
-		row38Cate := getRowCate2(row3Cate, "产品用途", row[39], row[38])
+		row38Cate := getRowCate2(row3Cate, "产品用途", row[39-4], row[38-4])
 		if row38Cate == nil {
 			// 没有找到对应分类
 			result.Status = "失败"
@@ -339,16 +339,16 @@ func ExcelImportWithImages(c *gin.Context, apictx *ApiSession, file io.Reader, g
 		imageMat.Categories = append(imageMat.Categories, row38Cate.IdStr)
 
 		// 样品编号
-		imageMat.SampleNumber = row[40]
+		imageMat.SampleNumber = row[40-4]
 		// 留样册号
-		imageMat.CatalogNumber = row[41]
+		imageMat.CatalogNumber = row[41-4]
 		// 原命名编号
-		imageMat.OriginalNumber = row[42]
+		imageMat.OriginalNumber = row[42-4]
 		// 底布克重
-		bw := str2float64(row[43])
+		bw := str2float64(row[43-4])
 		imageMat.BackingWeight = &bw
 		// 面布克重
-		sw := str2float64(row[44])
+		sw := str2float64(row[44-4])
 		imageMat.SurfaceWeight = &sw
 
 		imageName := row[0] // 不包含后缀 .jpg .png .jpeg

BIN
sku3d/sku3d/template.xlsx