瀏覽代碼

switch dev

animeic 2 年之前
父節點
當前提交
8b458629fd

+ 31 - 0
boxcost/api/outbox.go

@@ -0,0 +1,31 @@
+package api
+
+func Outbox(r *GinRouter) {
+	// CreateCRUD(router, "/calc", &CRUDOption{
+	// 	Collection: "calcs",
+	// 	NewModel: func(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+	// 		entity := &model.PriceCalc{}
+	// 		c.ShouldBindJSON(entity)
+	// 		entity.CreateTime = time.Now()
+	// 		entity.UpdateTime = time.Now()
+	// 		return entity, nil
+	// 	},
+	// 	EmtyModel: func(c *gin.Context, apictx *ApiSession) interface{} {
+	// 		return &model.PriceCalc{}
+	// 	},
+
+	// 	JWT: true,
+	// 	OnUpdate: func(c *gin.Context, apictx *ApiSession, entity interface{}) {
+	// 		calc := entity.(*model.PriceCalc)
+	// 		calc.UpdateTime = time.Now()
+	// 		if calc.IsDefault != nil && *calc.IsDefault { //设为默认把其他的所有默认清除
+	// 			repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(),
+	// 				&repo.DocFilterOptions{
+	// 					CollectName: "calcs",
+	// 					Query:       repo.Map{"category": calc.Category},
+	// 				}, bson.M{"isDefault": false})
+	// 		}
+	// 	},
+	// 	SearchProject: []string{"name", "updateTime", "isDefault", "category", "remark", "param1", "param2", "param3", "param4", "param5"},
+	// })
+}

+ 2 - 2
boxcost/api/plan-cost-excel.go

@@ -201,7 +201,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 
 					if len(mat.Crafts) > 0 {
 						for _, craft := range mat.Crafts {
-							if craft.Supplier.SupplierInfo != nil {
+							if craft.Supplier.SupplierInfo != nil { // 外箱材料报错
 								// 工序
 								if supplierId == craft.Supplier.SupplierInfo.Id {
 									if startRow == 0 {
@@ -347,7 +347,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 						// 工序
 						for _, craft := range mat.Crafts {
 							craftSupplierName := ""
-							if craft.Supplier.SupplierInfo != nil {
+							if craft.Supplier.SupplierInfo != nil { // 外箱材料报错
 								craftSupplierName = craft.Supplier.SupplierInfo.Name
 
 							}

+ 229 - 226
boxcost/api/print.go

@@ -1,228 +1,231 @@
 package api
 
-import (
-	"box-cost/db/model"
-	"box-cost/db/repo"
-	randc "crypto/rand"
-	"encoding/json"
-	"fmt"
-	"log"
-	"math/big"
-	"math/rand"
-	"sort"
-	"sync"
-	"time"
-	"unsafe"
-
-	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
-	"go.mongodb.org/mongo-driver/mongo"
-)
-
-func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	loc, _ := time.LoadLocation("Local")
-	date := time.Now().Format("2006-01-02")
-	startDate := date + " 00:00:00"
-	startTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startDate, loc)
-	endDate := date + " 23:59:59"
-	endTime, _ := time.ParseInLocation("2006-01-02 15:04:05", endDate, loc)
-	fmt.Println(startTime.Unix())
-	fmt.Println(endTime.Unix())
-
-	return "success", nil
-
-}
-
-// 生成百万数据
-func GenData(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
-	var wg sync.WaitGroup
-	for i := 0; i < 100; i++ {
-		wg.Add(1)
-		go insertData(apictx, &wg)
-	}
-	wg.Wait()
-
-	return true, nil
-}
-
-// 聚合查询百万数据
-func SearchData(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
-	dataStatResult := make(chan bson.M)
-	var output ResultSlice
-	var wg sync.WaitGroup
-	// 82个gorutine 执行聚合
-	for i := 18; i < 100; i++ {
-		wg.Add(1)
-		go DataAggregate(apictx, i, dataStatResult, &wg)
-	}
-
-	// 从管道中获取聚合结果 保存在数组中
-	for value := range dataStatResult {
-		output = append(output, OutPut{
-			Age:       value["age"].(int32),
-			Sex:       value["sex"].(int32),
-			Total:     value["total"].(int32),
-			AvgSalary: value["avgSalary"].(float64),
-		})
-		if len(output) == 164 { // 如果大于164,不会跳出;如果小于164,wg.done != wg.add ,wg.wait阻塞
-			break
-		}
-	}
-
-	wg.Wait()
-	//倒序排列
-	sort.Sort(output)
-	for _, v := range output {
-		result, err := json.Marshal(&v)
-		if err != nil {
-			fmt.Println("json.marshal failed, err:", err)
-			return nil, err
-		}
-		fmt.Println(string(result))
-	}
-	return output, nil
-}
-
-func insertData(apictx *ApiSession, wg *sync.WaitGroup) {
-	collectName := "aggregate-test"
-	rowNum := 10000
-	for i := 0; i < rowNum; i++ {
-		repo.RepoAddDoc(apictx.CreateRepoCtx(), collectName, &model.AggregateTest{
-			Name:   randName(6),
-			Age:    randAge(),
-			Sex:    randSex(),
-			Salary: randSalary(),
-		})
-
-	}
-	wg.Done()
-}
-
-func randSex() *int {
-	result, _ := randc.Int(randc.Reader, big.NewInt(2))
-	sex := int(result.Int64())
-	return &sex
-}
-func randAge() int {
-	result, _ := randc.Int(randc.Reader, big.NewInt(82))
-	return int(result.Int64() + 18)
-}
-
-func randSalary() int {
-	result, _ := randc.Int(randc.Reader, big.NewInt(10000))
-
-	return int(result.Int64() + 2000)
-}
-
-const letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
-
-var src = rand.NewSource(time.Now().UnixNano())
-
-const (
-	// 6 bits to represent a letter index
-	letterIdBits = 6
-	// All 1-bits as many as letterIdBits
-	letterIdMask = 1<<letterIdBits - 1
-	letterIdMax  = 63 / letterIdBits
-)
-
-func randName(n int) string {
-	b := make([]byte, n)
-	// A rand.Int63() generates 63 random bits, enough for letterIdMax letters!
-	for i, cache, remain := n-1, src.Int63(), letterIdMax; i >= 0; {
-		if remain == 0 {
-			cache, remain = src.Int63(), letterIdMax
-		}
-		if idx := int(cache & letterIdMask); idx < len(letters) {
-			b[i] = letters[idx]
-			i--
-		}
-		cache >>= letterIdBits
-		remain--
-	}
-	return *(*string)(unsafe.Pointer(&b))
-}
-
-func genPipeline(age int) (bson.D, bson.D, bson.D) {
-
-	matchStage := bson.D{
-		{"$match", bson.D{
-			{"age",
-				bson.D{
-					{"$eq", age},
-				}},
-		}},
-	}
-	groupStage := bson.D{
-		{"$group", bson.D{
-			{"_id", bson.D{
-				{"age", "$age"},
-				{"sex", "$sex"},
-			}},
-			{"age", bson.D{
-				{"$first", "$age"},
-			}},
-			{"sex", bson.D{
-				{"$first", "$sex"},
-			}},
-			{"total", bson.D{
-				{"$sum", 1},
-			}},
-			{"avgSalary", bson.D{
-				{"$avg", "$salary"},
-			}},
-		}},
-	}
-	projectStage := bson.D{
-		{"$project", bson.D{
-			{"_id", 0},
-			{"age", 1},
-			{"sex", 1},
-			{"total", 1},
-			{"avgSalary", 1},
-		}},
-	}
-
-	return matchStage, groupStage, projectStage
-
-}
-
-func DataAggregate(apictx *ApiSession, age int, resultChan chan bson.M, wg *sync.WaitGroup) {
-	matchStage, groupStage, projectStage := genPipeline(age)
-
-	// opts := options.Aggregate().SetMaxTime(15 * time.Second)
-	cursor, err := apictx.Svc.Mongo.GetCollection("aggregate-test").Aggregate(apictx.CreateRepoCtx().Ctx, mongo.Pipeline{matchStage, groupStage, projectStage})
-	if err != nil {
-		log.Println(err)
-	}
-	//打印文档内容
-	var results []bson.M
-	if err = cursor.All(apictx.CreateRepoCtx().Ctx, &results); err != nil {
-		log.Println(err)
-	}
-	log.Printf("%#v\n", results)
-	for _, result := range results {
-		resultChan <- result
-	}
-
-	wg.Done()
-}
-
-type OutPut struct {
-	Age       int32   `json:"age"`
-	Sex       int32   `json:"sex"`
-	Total     int32   `json:"total"`
-	AvgSalary float64 `json:"avg_salary"`
-}
-
-type ResultSlice []OutPut
-
-func (a ResultSlice) Len() int { // 重写 Len() 方法
-	return len(a)
-}
-func (a ResultSlice) Swap(i, j int) { // 重写 Swap() 方法
-	a[i], a[j] = a[j], a[i]
-}
-func (a ResultSlice) Less(i, j int) bool { // 重写 Less() 方法, 从大到小排序
-	return a[j].Age < a[i].Age
-}
+// import (
+// 	"box-cost/db/model"
+// 	"box-cost/db/repo"
+// 	randc "crypto/rand"
+// 	"encoding/json"
+// 	"fmt"
+// 	"log"
+// 	"math/big"
+// 	"math/rand"
+// 	"sort"
+// 	"sync"
+// 	"time"
+// 	"unsafe"
+
+// 	"github.com/gin-gonic/gin"
+// 	"go.mongodb.org/mongo-driver/bson"
+// 	"go.mongodb.org/mongo-driver/mongo"
+// )
+
+// func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+
+// 	// https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/image/jpg/1675757991547cnt7X9_2.jpg zhang
+// 	// https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/image/jpg/1675758027305uLKtda_1.jpg zhu
+// 	loc, _ := time.LoadLocation("Local")
+// 	date := time.Now().Format("2006-01-02")
+// 	startDate := date + " 00:00:00"
+// 	startTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startDate, loc)
+// 	endDate := date + " 23:59:59"
+// 	endTime, _ := time.ParseInLocation("2006-01-02 15:04:05", endDate, loc)
+// 	fmt.Println(startTime.Unix())
+// 	fmt.Println(endTime.Unix())
+
+// 	return "success", nil
+
+// }
+
+// // 生成百万数据
+// func GenData(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
+// 	var wg sync.WaitGroup
+// 	for i := 0; i < 100; i++ {
+// 		wg.Add(1)
+// 		go insertData(apictx, &wg)
+// 	}
+// 	wg.Wait()
+
+// 	return true, nil
+// }
+
+// // 聚合查询百万数据
+// func SearchData(_ *gin.Context, apictx *ApiSession) (interface{}, error) {
+// 	dataStatResult := make(chan bson.M)
+// 	var output ResultSlice
+// 	var wg sync.WaitGroup
+// 	// 82个gorutine 执行聚合
+// 	for i := 18; i < 100; i++ {
+// 		wg.Add(1)
+// 		go DataAggregate(apictx, i, dataStatResult, &wg)
+// 	}
+
+// 	// 从管道中获取聚合结果 保存在数组中
+// 	for value := range dataStatResult {
+// 		output = append(output, OutPut{
+// 			Age:       value["age"].(int32),
+// 			Sex:       value["sex"].(int32),
+// 			Total:     value["total"].(int32),
+// 			AvgSalary: value["avgSalary"].(float64),
+// 		})
+// 		if len(output) == 164 { // 如果大于164,不会跳出;如果小于164,wg.done != wg.add ,wg.wait阻塞
+// 			break
+// 		}
+// 	}
+
+// 	wg.Wait()
+// 	//倒序排列
+// 	sort.Sort(output)
+// 	for _, v := range output {
+// 		result, err := json.Marshal(&v)
+// 		if err != nil {
+// 			fmt.Println("json.marshal failed, err:", err)
+// 			return nil, err
+// 		}
+// 		fmt.Println(string(result))
+// 	}
+// 	return output, nil
+// }
+
+// func insertData(apictx *ApiSession, wg *sync.WaitGroup) {
+// 	collectName := "aggregate-test"
+// 	rowNum := 10000
+// 	for i := 0; i < rowNum; i++ {
+// 		repo.RepoAddDoc(apictx.CreateRepoCtx(), collectName, &model.AggregateTest{
+// 			Name:   randName(6),
+// 			Age:    randAge(),
+// 			Sex:    randSex(),
+// 			Salary: randSalary(),
+// 		})
+
+// 	}
+// 	wg.Done()
+// }
+
+// func randSex() *int {
+// 	result, _ := randc.Int(randc.Reader, big.NewInt(2))
+// 	sex := int(result.Int64())
+// 	return &sex
+// }
+// func randAge() int {
+// 	result, _ := randc.Int(randc.Reader, big.NewInt(82))
+// 	return int(result.Int64() + 18)
+// }
+
+// func randSalary() int {
+// 	result, _ := randc.Int(randc.Reader, big.NewInt(10000))
+
+// 	return int(result.Int64() + 2000)
+// }
+
+// const letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+// var src = rand.NewSource(time.Now().UnixNano())
+
+// const (
+// 	// 6 bits to represent a letter index
+// 	letterIdBits = 6
+// 	// All 1-bits as many as letterIdBits
+// 	letterIdMask = 1<<letterIdBits - 1
+// 	letterIdMax  = 63 / letterIdBits
+// )
+
+// func randName(n int) string {
+// 	b := make([]byte, n)
+// 	// A rand.Int63() generates 63 random bits, enough for letterIdMax letters!
+// 	for i, cache, remain := n-1, src.Int63(), letterIdMax; i >= 0; {
+// 		if remain == 0 {
+// 			cache, remain = src.Int63(), letterIdMax
+// 		}
+// 		if idx := int(cache & letterIdMask); idx < len(letters) {
+// 			b[i] = letters[idx]
+// 			i--
+// 		}
+// 		cache >>= letterIdBits
+// 		remain--
+// 	}
+// 	return *(*string)(unsafe.Pointer(&b))
+// }
+
+// func genPipeline(age int) (bson.D, bson.D, bson.D) {
+
+// 	matchStage := bson.D{
+// 		{"$match", bson.D{
+// 			{"age",
+// 				bson.D{
+// 					{"$eq", age},
+// 				}},
+// 		}},
+// 	}
+// 	groupStage := bson.D{
+// 		{"$group", bson.D{
+// 			{"_id", bson.D{
+// 				{"age", "$age"},
+// 				{"sex", "$sex"},
+// 			}},
+// 			{"age", bson.D{
+// 				{"$first", "$age"},
+// 			}},
+// 			{"sex", bson.D{
+// 				{"$first", "$sex"},
+// 			}},
+// 			{"total", bson.D{
+// 				{"$sum", 1},
+// 			}},
+// 			{"avgSalary", bson.D{
+// 				{"$avg", "$salary"},
+// 			}},
+// 		}},
+// 	}
+// 	projectStage := bson.D{
+// 		{"$project", bson.D{
+// 			{"_id", 0},
+// 			{"age", 1},
+// 			{"sex", 1},
+// 			{"total", 1},
+// 			{"avgSalary", 1},
+// 		}},
+// 	}
+
+// 	return matchStage, groupStage, projectStage
+
+// }
+
+// func DataAggregate(apictx *ApiSession, age int, resultChan chan bson.M, wg *sync.WaitGroup) {
+// 	matchStage, groupStage, projectStage := genPipeline(age)
+
+// 	// opts := options.Aggregate().SetMaxTime(15 * time.Second)
+// 	cursor, err := apictx.Svc.Mongo.GetCollection("aggregate-test").Aggregate(apictx.CreateRepoCtx().Ctx, mongo.Pipeline{matchStage, groupStage, projectStage})
+// 	if err != nil {
+// 		log.Println(err)
+// 	}
+// 	//打印文档内容
+// 	var results []bson.M
+// 	if err = cursor.All(apictx.CreateRepoCtx().Ctx, &results); err != nil {
+// 		log.Println(err)
+// 	}
+// 	log.Printf("%#v\n", results)
+// 	for _, result := range results {
+// 		resultChan <- result
+// 	}
+
+// 	wg.Done()
+// }
+
+// type OutPut struct {
+// 	Age       int32   `json:"age"`
+// 	Sex       int32   `json:"sex"`
+// 	Total     int32   `json:"total"`
+// 	AvgSalary float64 `json:"avg_salary"`
+// }
+
+// type ResultSlice []OutPut
+
+// func (a ResultSlice) Len() int { // 重写 Len() 方法
+// 	return len(a)
+// }
+// func (a ResultSlice) Swap(i, j int) { // 重写 Swap() 方法
+// 	a[i], a[j] = a[j], a[i]
+// }
+// func (a ResultSlice) Less(i, j int) bool { // 重写 Less() 方法, 从大到小排序
+// 	return a[j].Age < a[i].Age
+// }

+ 3 - 3
boxcost/api/router.go

@@ -14,9 +14,9 @@ func RegRouters(svc *Service) {
 
 	//数据存储
 	boxcost.POST("/save/policy", ServiceObsUploadPolicy)
-	boxcost.GET("/printr", Printr)
-	boxcost.GET("/genData", GenData)
-	boxcost.GET("/searchData", SearchData)
+	// boxcost.GET("/printr", Printr)
+	// boxcost.GET("/genData", GenData)
+	// boxcost.GET("/searchData", SearchData)
 
 	// 材料管理
 	Material(boxcost)

+ 4 - 3
boxcost/api/signature.go

@@ -139,8 +139,9 @@ func SignatureUpload(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		return nil, errors.New("只支持jpg/png图片上传")
 	}
 	// 保存图片
-	os.Mkdir("./signature/", 0777)
-	saveFile, err := os.OpenFile("./signature/"+handle.Filename, os.O_WRONLY|os.O_CREATE, 0666)
+	os.Mkdir("signature/", 0777)
+	pathFileName := fmt.Sprintf("signature/%s%s", randName(6), handle.Filename)
+	saveFile, err := os.OpenFile(pathFileName, os.O_WRONLY|os.O_CREATE, 0666)
 	if err != nil {
 		return nil, err
 	}
@@ -148,5 +149,5 @@ func SignatureUpload(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	defer uploadFile.Close()
 	defer saveFile.Close()
 
-	return "signature/" + handle.Filename, nil
+	return pathFileName, nil
 }

+ 75 - 0
boxcost/api/tmp.json

@@ -0,0 +1,75 @@
+{
+    "id": "1675839406146",
+    "name": "外箱",
+    "thumbnail": "",
+    "count": 1,
+    "uv": "",
+    "uvSize": "0",
+    "mats": [
+        {
+            "id": "167583941129963e34765201413726b012274",
+            "crafts": [
+                {
+                    "id": "",
+                    "size": "0",
+                    "count": 1,
+                    "craftInfo": {
+                        "_id": "000000000000000000000000",
+                        "name": "",
+                        "unit": "",
+                        "price": 0,
+                        "norm": "",
+                        "remark": "",
+                        "createTime": "0001-01-01T00:00:00Z",
+                        "updateTime": "0001-01-01T00:00:00Z",
+                        "category": ""
+                    },
+                    "supplier": null,
+                    "batchCount": 0,
+                    "batchSizeWidth": 0,
+                    "batchSizeHeight": 0,
+                    "billId": "",
+                    "remark": "",
+                    "confirmCount": 0
+                }
+            ],
+            "matInfo": {
+                "_id": "63e34765201413726b012274",
+                "name": "玖龙A级外箱",
+                "category": "纸张类",
+                "price": 20,
+                "unit": "个",
+                "norm": "160克",
+                "height": 0,
+                "width": 0,
+                "remark": "",
+                "createTime": "2023-02-08T06:55:33.691Z",
+                "updateTime": "2023-02-08T06:56:22.799Z"
+            },
+            "supplier": {
+                "calc": null,
+                "deliveryTime": "2023-02-08T06:58:30Z",
+                "orderPrice": 20,
+                "orderCount": 10000,
+                "orderRealPrice": 200000,
+                "supplierInfo": {
+                    "_id": "638eecd4f9039e0980fe5650",
+                    "name": "温学刚",
+                    "address": "崇州金鸡路556",
+                    "phone": "13028138020",
+                    "category": "烫金",
+                    "createTime": "2022-12-06T07:18:44.322Z",
+                    "updateTime": "2022-12-06T07:18:44.322Z"
+                }
+            },
+            "batchCount": 1,
+            "batchSizeWidth": 0,
+            "batchSizeHeight": 0,
+            "billId": "63e348d3201413726b012277",
+            "remark": "",
+            "confirmCount": 0
+        }
+    ],
+    "remark": "",
+    "totalPrice": 200000
+}

+ 30 - 0
boxcost/api/utils.go

@@ -5,8 +5,10 @@ import (
 	"box-cost/db/repo"
 	"bytes"
 	"fmt"
+	"math/rand"
 	"net/http"
 	"time"
+	"unsafe"
 
 	"github.com/thecodingmachine/gotenberg-go-client/v7"
 	"go.mongodb.org/mongo-driver/bson"
@@ -179,3 +181,31 @@ func getCompanyName(apictx *ApiSession) string {
 	}
 	return companyName
 }
+
+const (
+	// 6 bits to represent a letter index
+	letterIdBits = 6
+	// All 1-bits as many as letterIdBits
+	letterIdMask = 1<<letterIdBits - 1
+	letterIdMax  = 63 / letterIdBits
+	letters      = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+)
+
+var src = rand.NewSource(time.Now().UnixNano())
+
+func randName(n int) string {
+	b := make([]byte, n)
+	// A rand.Int63() generates 63 random bits, enough for letterIdMax letters!
+	for i, cache, remain := n-1, src.Int63(), letterIdMax; i >= 0; {
+		if remain == 0 {
+			cache, remain = src.Int63(), letterIdMax
+		}
+		if idx := int(cache & letterIdMask); idx < len(letters) {
+			b[i] = letters[idx]
+			i--
+		}
+		cache >>= letterIdBits
+		remain--
+	}
+	return *(*string)(unsafe.Pointer(&b))
+}

+ 1 - 1
boxcost/db/db.go

@@ -35,7 +35,7 @@ func (db *MongoDB) GetOrCreateDatabase(name string) *mongo.Database {
 }
 
 func NewMongoDB(bus *comm.NatsBus) *MongoDB {
-	inst, err := bus.NewMongoDBFromConfig("box-mongo")
+	inst, err := bus.NewMongoDBFromConfigDev("box-mongo")
 	if err != nil {
 		panic(err)
 	}

+ 46 - 0
boxcost/db/model/outbox.go

@@ -0,0 +1,46 @@
+package model
+
+import (
+	"time"
+
+	"go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+// 外箱
+type Outbox struct {
+	Id   primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name string             `bson:"name,omitempty" json:"name"`
+	Norm string             `bson:"norm,omitempty" json:"norm"`
+	/*
+		材质要求
+		验收标准
+		结算方式
+		其他
+	*/
+	Remarks      []*Remark `bson:"remarks,omitempty" json:"remarks"`
+	DeliveryTime time.Time `bson:"deliveryTime,omitempty" json:"deliveryTime"`
+	CreateTime   time.Time `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime   time.Time `bson:"updateTime,omitempty" json:"updateTime"`
+}
+
+type Remark struct {
+	Key   string `bson:"key,omitempty" json:"key"`
+	Value string `bson:"value,omitempty" json:"value"`
+}
+
+// 外箱
+type OutboxBill struct {
+	Id   primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name string             `bson:"name,omitempty" json:"name"`
+	Norm string             `bson:"norm,omitempty" json:"norm"`
+	/*
+		材质要求
+		验收标准
+		结算方式
+		其他
+	*/
+	Remarks      []*Remark `bson:"remarks,omitempty" json:"remarks"`
+	DeliveryTime time.Time `bson:"deliveryTime,omitempty" json:"deliveryTime"`
+	CreateTime   time.Time `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime   time.Time `bson:"updateTime,omitempty" json:"updateTime"`
+}

+ 2 - 1
boxcost/db/model/supplier.go

@@ -12,7 +12,8 @@ type Supplier struct {
 	Name       string             `bson:"name,omitempty" json:"name"`
 	Address    string             `bson:"address,omitempty" json:"address"`
 	Phone      string             `bson:"phone,omitempty" json:"phone"`
-	Category   string             `bson:"category,omitempty" json:"category"`
+	Category   string             `bson:"category,omitempty" json:"category"`   // old
+	Categorys  []string           `bson:"Categorys,omitempty" json:"Categorys"` // 多个分类
 	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
 	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
 }

+ 1 - 1
boxcost/db/redis.go

@@ -6,7 +6,7 @@ import (
 )
 
 func NewRedisClient(bus *comm.NatsBus) *redis.Client {
-	client, err := bus.NewRedisFromConfig("box-redis")
+	client, err := bus.NewRedisFromConfigDev("box-redis")
 	if err != nil {
 		return nil
 	}