|
@@ -266,7 +266,21 @@ func ParseMatObject(ctx *repo.RepoSession, row []string, headers []string, cates
|
|
|
}
|
|
|
}
|
|
|
if len(row11Cate.IdStr) <= 0 {
|
|
|
- return imageMat, fmt.Errorf("%s的首选供应商未找到定义", row[MainSupplierIndex])
|
|
|
+ oid := primitive.NewObjectID()
|
|
|
+ super := &model.Category{
|
|
|
+ Id: oid,
|
|
|
+ Name: row[MainSupplierIndex],
|
|
|
+ IdStr: oid.Hex(),
|
|
|
+ CusNum: "0000",
|
|
|
+ Children: []*model.Category{},
|
|
|
+ }
|
|
|
+ for _, cate := range cates {
|
|
|
+ if cate.Name == "首选供应商" {
|
|
|
+ cate.Children = append(cate.Children, super)
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ row11Cate = super
|
|
|
}
|
|
|
//添加首先供应商
|
|
|
imageMat.Categories = append(imageMat.Categories, row11Cate.IdStr)
|