animeic il y a 2 ans
Parent
commit
9a38111e88

+ 365 - 0
boxcost/api/bill-process-excel.go

@@ -0,0 +1,365 @@
+package api
+
+import (
+	"box-cost/db/model"
+	"fmt"
+
+	_ "image/gif"
+	_ "image/jpeg"
+	_ "image/png"
+
+	"github.com/xuri/excelize/v2"
+)
+
+type ProcessBillExcel struct {
+	Offset int
+	Row    int
+
+	Title string //标题
+
+	Excel *excelize.File
+
+	SheetName string
+
+	AlignCenterStyle int
+
+	Content *model.PurchaseBill
+
+	Signatures []*model.Signature
+}
+
+func (b *ProcessBillExcel) drawTitle() error {
+	tileIndex := b.Offset + 1
+	startCell := fmt.Sprintf("A%d", tileIndex)
+	err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("I%d", tileIndex))
+	if err != nil {
+		return err
+	}
+
+	style, err := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
+		Font:      &excelize.Font{Bold: true, Size: 18}})
+	if err != nil {
+		return err
+	}
+	err = b.Excel.SetCellStyle(b.SheetName, startCell, startCell, style)
+	if err != nil {
+		return err
+	}
+	b.Excel.SetRowHeight(b.SheetName, tileIndex, 23)
+	b.Excel.SetCellValue(b.SheetName, startCell, b.Title)
+	return nil
+}
+
+func (b *ProcessBillExcel) drawSubTitles() error {
+	row := b.Offset + 2
+	styleLeft, err := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Font:      &excelize.Font{Size: 11}})
+	if err != nil {
+		return err
+	}
+	styleRight, err := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "right", Vertical: "center"},
+		Font:      &excelize.Font{Size: 11}})
+	if err != nil {
+		return err
+	}
+
+	var drawLeft = func(rowIndex int, value string) error {
+		//左边1
+		left1Cell := fmt.Sprintf("A%d", rowIndex)
+		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("E%d", rowIndex))
+		if err != nil {
+			return err
+		}
+		err = b.Excel.SetCellStyle(b.SheetName, left1Cell, left1Cell, styleLeft)
+		if err != nil {
+			return err
+		}
+		b.Excel.SetCellValue(b.SheetName, left1Cell, value)
+		return nil
+	}
+
+	var drawRight = func(rowIndex int, value string) error {
+		right1Cell := fmt.Sprintf("F%d", rowIndex)
+		err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("I%d", rowIndex))
+		if err != nil {
+			return err
+		}
+		err = b.Excel.SetCellStyle(b.SheetName, right1Cell, right1Cell, styleRight)
+		if err != nil {
+			return err
+		}
+		b.Excel.SetCellValue(b.SheetName, right1Cell, value)
+		return nil
+	}
+	//第一行
+	drawLeft(row, "类别:"+b.Content.Type)
+	drawRight(row, "单号:"+b.Content.SerialNumber)
+	b.Excel.SetRowHeight(b.SheetName, row, 21)
+
+	//第二行
+	drawLeft(row+1, "供应商名称:"+b.Content.Supplier)
+	timeformat := b.Content.CreateTime.Local().Format("2006年01月02号 15:04:05")
+	drawRight(row+1, "下单时间:"+timeformat)
+	b.Excel.SetRowHeight(b.SheetName, row+1, 21)
+
+	//第三行
+	drawLeft(row+2, "产品名称:"+b.Content.ProductName)
+	status := ""
+	if b.Content.Status == "complete" {
+		status = fmt.Sprintf("已完成(%d)", b.Content.ConfirmCount)
+	}
+	if b.Content.Status == "created" {
+		status = "进行中"
+	}
+	drawRight(row+2, "状态:"+status)
+	b.Excel.SetRowHeight(b.SheetName, row+2, 21)
+
+	return nil
+}
+
+func (b *ProcessBillExcel) drawTableTitle() error {
+	row := b.Offset + 5
+	// 品名 规格  数量 单位 单价 金额
+	var drawCol = func(prefix string, value string) error {
+		left1Cell := fmt.Sprintf("%s%d", prefix, row)
+		left2Cell := fmt.Sprintf("%s%d", prefix, row+1)
+
+		err := b.Excel.MergeCell(b.SheetName, left1Cell, left2Cell)
+		if err != nil {
+			return err
+		}
+		err = b.Excel.SetCellStyle(b.SheetName, left1Cell, left2Cell, b.AlignCenterStyle)
+		if err != nil {
+			return err
+		}
+
+		return b.Excel.SetCellValue(b.SheetName, left1Cell, value)
+	}
+	drawCol("A", "采购项目")
+	drawCol("B", "规格")
+	drawCol("C", "数量")
+	drawCol("D", "单位")
+	drawCol("E", "单价")
+	drawCol("F", "预算金额")
+	drawCol("G", "实际金额")
+	drawCol("H", "交货时间")
+	drawCol("I", "备注")
+
+	return nil
+}
+
+func (b *ProcessBillExcel) drawTableContent() error {
+	row := b.Offset + 7
+	b.Row = row
+
+	var DrawRow = func(rowIndex int, values ...string) {
+		charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I"}
+		for i, c := range charas {
+			v := ""
+			if i < len(values) {
+				v = values[i]
+			}
+			b.Excel.SetCellValue(b.SheetName, fmt.Sprintf("%s%d", c, rowIndex), v)
+			val2Cel := fmt.Sprintf("%s%d", c, rowIndex)
+			b.Excel.SetCellStyle(b.SheetName, val2Cel, val2Cel, b.AlignCenterStyle)
+
+			b.Excel.SetRowHeight(b.SheetName, rowIndex, 21)
+		}
+	}
+	process := b.Content.Process
+	if len(process) > 0 {
+		for _, ps := range process {
+			// 不是订单工序
+			if !ps.IsBill {
+				continue
+			}
+			deliveryTime := ps.DeliveryTime.Local().Format("2006-01-02")
+			confirmCount := "-"
+			realAmount := "-"
+			// 预算金额
+			budgetAmount := fmt.Sprintf("%.2f", float64(ps.Count)*ps.Price)
+			b.FormatToEmpty(&budgetAmount)
+
+			if b.Content.Status == "complete" {
+				// 实际完成数
+				confirmCount = fmt.Sprintf("%d", b.Content.ConfirmCount)
+				b.FormatToEmpty(&confirmCount)
+
+				// 实际金额
+				realAmount = fmt.Sprintf("%.2f", float64(b.Content.ConfirmCount)*ps.Price)
+				b.FormatToEmpty(&realAmount)
+			}
+
+			// 采购项目 规格 数量 单位 单价 预算金额 实际金额 交货时间 备注
+			count := fmt.Sprintf("%d", ps.Count)
+			price := fmt.Sprintf("%.2f", ps.Price)
+			b.FormatToEmpty(&price)
+			DrawRow(row, ps.Name, ps.Norm, count, ps.Unit, price, budgetAmount, realAmount, deliveryTime, ps.Remark)
+			row++
+			b.Row++
+		}
+	}
+
+	return nil
+}
+
+func (b *ProcessBillExcel) drawTableFooter() error {
+	left1Cell := fmt.Sprintf("A%d", b.Row)
+	border := []excelize.Border{
+		{Type: "top", Style: 1, Color: "000000"},
+		{Type: "left", Style: 1, Color: "000000"},
+		{Type: "right", Style: 1, Color: "000000"},
+		{Type: "bottom", Style: 1, Color: "000000"},
+	}
+	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Border:    border,
+	})
+
+	b.Excel.SetCellStyle(b.SheetName, left1Cell, left1Cell, styleLeft)
+	b.Excel.SetCellValue(b.SheetName, left1Cell, "送货地址:")
+
+	addCel := fmt.Sprintf("B%d", b.Row)
+
+	b.Excel.MergeCell(b.SheetName, addCel, fmt.Sprintf("E%d", b.Row))
+	b.Excel.SetCellStyle(b.SheetName, addCel, fmt.Sprintf("E%d", b.Row), styleLeft)
+	b.Excel.SetCellValue(b.SheetName, addCel, b.Content.SendTo)
+
+	sureCel := fmt.Sprintf("F%d", b.Row)
+	b.Excel.MergeCell(b.SheetName, sureCel, fmt.Sprintf("I%d", b.Row))
+	b.Excel.SetCellStyle(b.SheetName, sureCel, fmt.Sprintf("I%d", b.Row), styleLeft)
+	b.Excel.SetCellValue(b.SheetName, sureCel, "供应商签字:")
+
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 30)
+
+	return nil
+}
+
+func (b *ProcessBillExcel) drawRemark() error {
+	// 填备注
+	remarkTitleCell := fmt.Sprintf("A%d", b.Row)
+	b.Excel.SetCellValue(b.SheetName, remarkTitleCell, "备注:")
+	b.Row++
+
+	remarkContentScell := fmt.Sprintf("A%d", b.Row)
+	// 预留五行备注内容 // TODO 获取内容换行符个数然后动态确定内容占用多少行单元格
+	b.Row += 5
+	remarkContentEcell := fmt.Sprintf("L%d", b.Row)
+	b.Excel.MergeCell(b.SheetName, remarkContentScell, remarkContentEcell)
+	b.Excel.SetCellValue(b.SheetName, remarkContentScell, b.Content.Remark)
+
+	return nil
+
+}
+
+func (b *ProcessBillExcel) drawTableSignature() error {
+	b.Row += 2
+	style1, _ := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
+		// Border:    border,
+	})
+
+	fontCell := fmt.Sprintf("E%d", b.Row)
+	imageCell1 := fmt.Sprintf("F%d", b.Row)
+	imageCell2 := fmt.Sprintf("H%d", b.Row)
+	eRow := b.Row + 2
+	b.Excel.MergeCell(b.SheetName, fontCell, fmt.Sprintf("E%d", eRow))
+	b.Excel.SetCellStyle(b.SheetName, fontCell, fontCell, style1)
+	b.Excel.SetCellValue(b.SheetName, fontCell, "审核签字:")
+
+	b.Excel.MergeCell(b.SheetName, imageCell1, fmt.Sprintf("F%d", eRow))
+	b.Excel.SetCellStyle(b.SheetName, imageCell1, imageCell1, style1)
+	b.Excel.SetCellValue(b.SheetName, imageCell1, "")
+
+	b.Excel.MergeCell(b.SheetName, imageCell2, fmt.Sprintf("H%d", eRow))
+	b.Excel.SetCellStyle(b.SheetName, imageCell2, imageCell1, style1)
+	b.Excel.SetCellValue(b.SheetName, imageCell2, "")
+
+	// 状态为已审核时,签字
+	// `{
+	// 	"x_scale": 0.12,
+	// 	"y_scale": 0.12,
+	// 	"x_offset": 30,
+	// 	"print_obj": true,
+	// 	"lock_aspect_ratio": false,
+	// 	"locked": false,
+	// 	"positioning": "oncell"
+	// }`
+	if b.Content.Reviewed == 1 {
+		imageCells := []string{imageCell1, imageCell2}
+		if len(b.Signatures) > 0 {
+			for k, sign := range b.Signatures {
+				b.Excel.AddPicture(b.SheetName, imageCells[k], sign.Url, sign.Format)
+
+			}
+		}
+	}
+
+	return nil
+}
+
+func (b *ProcessBillExcel) Draws() {
+	b.drawTitle()
+	b.drawSubTitles()
+	b.drawTableTitle()
+	b.drawTableContent()
+	b.drawTableFooter()
+	b.drawRemark()
+	b.drawTableSignature()
+}
+
+func NewProcessBill(f *excelize.File) *ProcessBillExcel {
+
+	border := []excelize.Border{
+		{Type: "top", Style: 1, Color: "000000"},
+		{Type: "left", Style: 1, Color: "000000"},
+		{Type: "right", Style: 1, Color: "000000"},
+		{Type: "bottom", Style: 1, Color: "000000"},
+	}
+
+	styleLeft, _ := f.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
+		Border:    border,
+		Font:      &excelize.Font{Size: 10},
+	})
+
+	b := &ProcessBillExcel{
+		Title:            "原材料采购单",
+		SheetName:        "Sheet1",
+		Excel:            f,
+		Offset:           0,
+		AlignCenterStyle: styleLeft,
+		Signatures:       make([]*model.Signature, 0),
+	}
+
+	f.SetColWidth(b.SheetName, "A", "I", 14)
+	f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
+	return b
+}
+
+func (b *ProcessBillExcel) FormatToEmpty(str *string) {
+	if *str == "0" || *str == "0.00" {
+		*str = ""
+	}
+
+}
+
+func (b *ProcessBillExcel) PrintPurchType() string {
+	return "process"
+}
+
+func (b *ProcessBillExcel) SetContent(content *model.PurchaseBill) {
+	b.Content = content
+
+}
+func (b *ProcessBillExcel) SetTitle(title string) {
+	b.Title = title
+
+}
+func (b *ProcessBillExcel) SetSignatures(sign []*model.Signature) {
+	b.Signatures = sign
+
+}

+ 30 - 1
boxcost/api/bill-purchase-excel.go

@@ -317,7 +317,7 @@ func (b *PurchaseBillExcel) drawTableSignature() error {
 	imageCell2 := fmt.Sprintf("K%d", row)
 	b.Excel.MergeCell(b.SheetName, fontCell, fmt.Sprintf("H%d", row+2))
 	b.Excel.SetCellStyle(b.SheetName, fontCell, fontCell, style1)
-	b.Excel.SetCellValue(b.SheetName, fontCell, "领导签字:")
+	b.Excel.SetCellValue(b.SheetName, fontCell, "审核签字:")
 
 	// 签字图片1 I10-J12
 	b.Excel.MergeCell(b.SheetName, imageCell1, fmt.Sprintf("J%d", row+2))
@@ -401,3 +401,32 @@ func (b *PurchaseBillExcel) FormatToEmpty(str *string) {
 	}
 
 }
+
+func (b *PurchaseBillExcel) PrintPurchType() string {
+	return "process"
+}
+
+func (b *PurchaseBillExcel) SetContent(content *model.PurchaseBill) {
+	b.Content = content
+
+}
+func (b *PurchaseBillExcel) SetTitle(title string) {
+	b.Title = title
+
+}
+func (b *PurchaseBillExcel) SetSignatures(sign []*model.Signature) {
+	b.Signatures = sign
+
+}
+
+type IPurchBill interface {
+	PrintPurchType() string
+	Draws()
+	SetContent(*model.PurchaseBill)
+	SetTitle(string)
+	SetSignatures([]*model.Signature)
+}
+
+// func ExeclDraw(ipurch IPurchBill) {
+// 	ipurch.Draws()
+// }

+ 15 - 4
boxcost/api/bill.go

@@ -214,7 +214,18 @@ func DownLoadBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	f.SetActiveSheet(index)
 	f.SetDefaultFont("宋体")
 
-	billExcel := NewPurchaseBill(f)
+	var billExcel IPurchBill
+
+	if len(bill.Process) > 0 {
+		billExcel = NewProcessBill(f)
+	}
+
+	if len(bill.Paper) > 0 {
+		billExcel = NewPurchaseBill(f)
+	}
+	if billExcel == nil {
+		return nil, errors.New("数据未找到")
+	}
 
 	// 获取已审核的签名数据
 	if bill.Reviewed == 1 {
@@ -225,13 +236,13 @@ func DownLoadBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 				Query:       repo.Map{"_id": bson.M{"$in": bill.SignUsers}},
 				Sort:        bson.M{"sort": 1}, // 升序
 			}, &signs)
-			billExcel.Signatures = signs
+			billExcel.SetSignatures(signs)
 		}
 
 	}
-	billExcel.Content = &bill
+	billExcel.SetContent(&bill)
 	companyName := getCompanyName(apictx)
-	billExcel.Title = fmt.Sprintf("%s原材料采购单", companyName)
+	billExcel.SetTitle(fmt.Sprintf("%s原材料采购单", companyName))
 
 	//设置对应的数据
 	billExcel.Draws()

+ 0 - 31
boxcost/api/outbox.go

@@ -1,31 +0,0 @@
-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"},
-	// })
-}

+ 31 - 0
boxcost/api/process.go

@@ -0,0 +1,31 @@
+package api
+
+import (
+	"box-cost/db/model"
+	"time"
+
+	"github.com/gin-gonic/gin"
+)
+
+func Process(r *GinRouter) {
+	CreateCRUD(r, "/process", &CRUDOption{
+		Collection: "process",
+		NewModel: func(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+			entity := &model.Process{}
+			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{}) {
+			process := entity.(*model.Process)
+			process.UpdateTime = time.Now()
+		},
+		SearchProject: []string{"name", "unit", "norm", "price", "type", "remark"},
+	})
+}

+ 3 - 0
boxcost/api/router.go

@@ -49,6 +49,9 @@ func RegRouters(svc *Service) {
 
 	// 统计报表
 	Report(boxcost)
+
+	// 工序管理
+	Process(boxcost)
 }
 
 func Logger() gin.HandlerFunc {

+ 2 - 2
boxcost/build.sh

@@ -5,8 +5,8 @@ echo "building..."
 go build -o box-cost-service
 
 # 命名镜像
-local_imge="pack-box-cost:v1.0.0"
-repository_image="registry.cn-chengdu.aliyuncs.com/infish/pack-box-cost:v1.0.0"
+local_imge="pack-box-cost:v1.0.1"
+repository_image="registry.cn-chengdu.aliyuncs.com/infish/pack-box-cost:v1.0.1"
 
 # 删除本地已存在的镜像
 docker rmi $repository_image

+ 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.NewMongoDBFromConfigDev("box-mongo")
+	inst, err := bus.NewMongoDBFromConfig("box-mongo")
 	if err != nil {
 		panic(err)
 	}

+ 5 - 0
boxcost/db/model/bill.go

@@ -66,8 +66,13 @@ type PurchaseBill struct {
 	//纸张类采购
 	Paper []*PaperBill `bson:"papers,omitempty" json:"papers"`
 
+	// 工序管理
+	Process []*ProcessBill `bson:"process,omitempty" json:"process"`
+
 	// 序号
 	SerialNumber string `bson:"serialNumber,omitempty" json:"serialNumber"`
+
+	Remark string `bson:"remark,omitempty" json:"remark"`
 }
 
 // 工艺生产数据

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

@@ -1,46 +0,0 @@
-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"`
-}

+ 3 - 0
boxcost/db/model/plan.go

@@ -15,6 +15,9 @@ type ProductPlan struct {
 	Thumbnail  string `bson:"thumbnail,omitempty" json:"thumbnail"`
 	CreateUser string `bson:"createUser,omitempty" json:"createUser"`
 
+	// 工序 外箱、手工非
+	Process []*ProcessBill `bson:"process,omitempty" json:"process"`
+
 	//生产数量
 	Total int `bson:"total,omitempty" json:"total"`
 

+ 54 - 0
boxcost/db/model/process.go

@@ -0,0 +1,54 @@
+package model
+
+import (
+	"time"
+
+	"go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+// 工序管理 用于选择模板
+type Process struct {
+	Id   primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name string             `bson:"name,omitempty" json:"name"`
+	Unit string             `bson:"unit,omitempty" json:"unit"`
+	Norm string             `bson:"norm,omitempty" json:"norm"`
+
+	Price float64 `bson:"price,omitempty" json:"price"`
+	// 分类 外箱 礼盒。。。
+	Type string `bson:"type,omitempty" json:"type"`
+
+	// 金额
+	Amount float64 `bson:"amount,omitempty" json:"amount"`
+
+	IsBill bool `bson:"isBill,omitempty" json:"isBill"`
+
+	// 单个工艺备注
+	Remark     string    `bson:"remark,omitempty" json:"remark"`
+	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
+}
+
+// 算到采购单里面
+type ProcessBill struct {
+	//名字
+	Name string `bson:"name,omitempty" json:"name"`
+
+	//名字
+	Type string `bson:"type,omitempty" json:"type"`
+	//规格(质量要求)
+	Norm string `bson:"norm,omitempty" json:"norm"`
+	//数量
+	Count int `bson:"count,omitempty" json:"count"`
+	// 单位
+	Unit string `bson:"unit,omitempty" json:"unit"`
+	//单价
+	Price float64 `bson:"price,omitempty" json:"price"`
+	// 金额
+	Amount float64 `bson:"amount,omitempty" json:"amount"`
+	//备注
+	Remark string `bson:"remark,omitempty" json:"remark"`
+
+	IsBill bool `bson:"isBill,omitempty" json:"isBill"`
+	//交货时间
+	DeliveryTime time.Time `bson:"deliveryTime,omitempty" json:"deliveryTime"`
+}

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

@@ -12,8 +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"`   // old
-	Categorys  []string           `bson:"Categorys,omitempty" json:"Categorys"` // 多个分类
+	Categorys  []string           `bson:"categorys,omitempty" json:"categorys"` // 多个分类
+	Category   string             `bson:"category,omitempty" json:"category"`   // 多个分类
 	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.NewRedisFromConfigDev("box-redis")
+	client, err := bus.NewRedisFromConfig("box-redis")
 	if err != nil {
 		return nil
 	}