ソースを参照

Merge branch 'dev' of http://124.70.149.18:10880/sunsheng/box-cost into dev

liwei 2 年 前
コミット
b8bfbd6316

+ 0 - 21
boxcost/api/bill-purchase-excel.go

@@ -396,24 +396,3 @@ 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) SetOffset(offset int) {
-	b.Offset = offset
-
-}
-func (b *PurchaseBillExcel) SetSignatures(sign []*model.Signature) {
-	b.Signatures = sign
-
-}

+ 4 - 8
boxcost/api/bill.go

@@ -225,11 +225,7 @@ func DownLoadBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	f.SetActiveSheet(index)
 	f.SetDefaultFont("宋体")
 
-	var billExcel IPurchBill
-
-	// if bill.Process != nil {
-	// 	billExcel = NewProcessBill(f)
-	// }
+	var billExcel *PurchaseBillExcel
 
 	if len(bill.Paper) > 0 {
 		billExcel = NewPurchaseBill(f)
@@ -247,13 +243,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.SetSignatures(signs)
+			billExcel.Signatures = signs
 		}
 
 	}
-	billExcel.SetContent(&bill)
+	billExcel.Content = &bill
 	companyName := getCompanyName(apictx)
-	billExcel.SetTitle(fmt.Sprintf("%s原材料采购单", companyName))
+	billExcel.Title = fmt.Sprintf("%s原材料采购单", companyName)
 
 	//设置对应的数据
 	billExcel.Draws()

+ 17 - 0
boxcost/db/model/category.go

@@ -0,0 +1,17 @@
+package model
+
+import (
+	"time"
+
+	"go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+// 分类
+type Category struct {
+	Id   primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name string             `bson:"name,omitempty" json:"name"`
+
+	//字母缩写
+	LetterName string    `bson:"letterName,omitempty" json:"letterName"`
+	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
+}

+ 9 - 14
boxcost/db/model/craft.go

@@ -8,18 +8,13 @@ import (
 
 // 工艺
 type Craft struct {
-	Id   primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	Name string             `bson:"name,omitempty" json:"name"`
-	// 单位
-	Unit  string  `bson:"unit,omitempty" json:"unit"`
-	Price float64 `bson:"price,omitempty" json:"price"`
-	//质量规格要求
-	Norm string `bson:"norm,omitempty" json:"norm"`
-	// 备注
-	Remark     string    `bson:"remark,omitempty" json:"remark"`
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
-
-	//分类
-	Category string `bson:"category,omitempty" json:"category"`
+	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name       string             `bson:"name,omitempty" json:"name"`
+	Unit       string             `bson:"unit,omitempty" json:"unit"`         // 单位
+	Price      float64            `bson:"price,omitempty" json:"price"`       // 单价
+	Norm       string             `bson:"norm,omitempty" json:"norm"`         //规格
+	Category   string             `bson:"category,omitempty" json:"category"` //分类
+	Remark     string             `bson:"remark,omitempty" json:"remark"`     // 备注
+	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
 }

+ 8 - 30
boxcost/db/model/material.go

@@ -6,37 +6,15 @@ import (
 	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 
-// 单位
-type Unit struct {
+// 材料只能添加,不能修改
+type Material struct {
 	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
 	Name       string             `bson:"name,omitempty" json:"name"`
+	Unit       string             `bson:"unit,omitempty" json:"unit"`         // 单位
+	Price      float64            `bson:"price,omitempty" json:"price"`       // 单价
+	Norm       string             `bson:"norm,omitempty" json:"norm"`         //规格
+	Category   string             `bson:"category,omitempty" json:"category"` //分类
+	Remark     string             `bson:"remark,omitempty" json:"remark"`     // 备注
 	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
-}
-
-// 分类
-type Category struct {
-	Id   primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	Name string             `bson:"name,omitempty" json:"name"`
-
-	//字母缩写
-	LetterName string    `bson:"letterName,omitempty" json:"letterName"`
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-}
-
-// 材料只能添加,不能修改
-type Material struct {
-	Id       primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	Name     string             `bson:"name,omitempty" json:"name"`
-	Category string             `bson:"category,omitempty" json:"category"`
-	Price    float64            `bson:"price,omitempty" json:"price"`
-	Unit     string             `bson:"unit,omitempty" json:"unit"`
-
-	// 规格
-	Norm   string  `bson:"norm,omitempty" json:"norm"`
-	Heigth float64 `bson:"height,omitempty" json:"height"`
-	Width  float64 `bson:"width,omitempty" json:"width"`
-	Remark string  `bson:"remark,omitempty" json:"remark"`
-
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
+	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
 }

+ 9 - 12
boxcost/db/model/product.go

@@ -8,16 +8,13 @@ import (
 
 // 成品采购管理 用于选择模板
 type Product 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"`
-	// 分类
-	Category string `bson:"category,omitempty" json:"category"`
-
-	// 单个工艺备注
-	Remark     string    `bson:"remark,omitempty" json:"remark"`
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
+	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name       string             `bson:"name,omitempty" json:"name"`
+	Unit       string             `bson:"unit,omitempty" json:"unit"`         // 单位
+	Price      float64            `bson:"price,omitempty" json:"price"`       // 单价
+	Norm       string             `bson:"norm,omitempty" json:"norm"`         //规格
+	Category   string             `bson:"category,omitempty" json:"category"` //分类
+	Remark     string             `bson:"remark,omitempty" json:"remark"`     // 备注
+	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime time.Time          `bson:"updateTime,omitempty" json:"updateTime"`
 }

+ 14 - 0
boxcost/db/model/unit.go

@@ -0,0 +1,14 @@
+package model
+
+import (
+	"time"
+
+	"go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+// 单位
+type Unit struct {
+	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name       string             `bson:"name,omitempty" json:"name"`
+	CreateTime time.Time          `bson:"createTime,omitempty" json:"createTime"`
+}