Forráskód Böngészése

fix: plan track设置单元格高度

sun-pc-linux 7 hónapja
szülő
commit
a6fdf3f0bb

+ 15 - 1
boxcost/api/plan-process-track-excel.go

@@ -247,6 +247,8 @@ func (b *PlanProcessTrackExcel) Draws() {
 	b.drawTitle()
 	b.drawTableTitle()
 	b.drawAllContent()
+	// 根据类容设置最大行高
+	b.setRowsHeight()
 }
 
 func NewPlanProcessTrackExcel(f *excelize.File) *PlanProcessTrackExcel {
@@ -272,10 +274,22 @@ func NewPlanProcessTrackExcel(f *excelize.File) *PlanProcessTrackExcel {
 		AlignCenterStyle: styleLeft,
 		Content:          make([]*PlanStatusInfo, 0),
 		RowMap:           map[string]int{"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7, "I": 8, "J": 9, "K": 10, "L": 11, "M": 12, "N": 13, "O": 14, "P": 15, "Q": 16, "R": 17, "S": 18},
-		RowWidthArray:    []float64{8, 12, 12, 12, 12, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12},
+		RowWidthArray:    []float64{6, 12, 12, 12, 16, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12},
 		RowsHeightArray:  make([]map[int]float64, 0),
 	}
 
+	// 初始化批量设置列宽
+	for index, cw := range b.RowWidthArray {
+		for k, v := range b.RowMap {
+			if v == index {
+				fmt.Println(index)
+				fmt.Println(k, cw)
+				b.Excel.SetColWidth(b.SheetName, k, k, cw)
+			}
+		}
+
+	}
+
 	f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
 	return b
 }

+ 16 - 16
boxcost/api/plan-process-track.go

@@ -212,22 +212,22 @@ const (
 	CELL_BACKGROUND    = "808080"
 )
 
-var needChangeCol = map[string]string{
-	"部件": "E",
-	"下单": "F",
-	"纸张": "G",
-	"印刷": "H",
-	"覆膜": "I",
-	"烫金": "J",
-	"丝印": "K",
-	"对裱": "L",
-	"压纹": "M",
-	"裱瓦": "N",
-	"模切": "O",
-	"粘盒": "P",
-	"组装": "Q",
-	"交货": "R",
-}
+// var needChangeCol = map[string]string{
+// 	"部件": "E",
+// 	"下单": "F",
+// 	"纸张": "G",
+// 	"印刷": "H",
+// 	"覆膜": "I",
+// 	"烫金": "J",
+// 	"丝印": "K",
+// 	"对裱": "L",
+// 	"压纹": "M",
+// 	"裱瓦": "N",
+// 	"模切": "O",
+// 	"粘盒": "P",
+// 	"组装": "Q",
+// 	"交货": "R",
+// }
 
 func MatchString(targetStr string, regexPattern string) bool {
 	// 编译正则表达式

+ 43 - 43
boxcost/db/model/pack.go

@@ -8,82 +8,82 @@ import (
 
 // 包装
 type Pack struct {
-	Id        primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
-	Name      string             `bson:"name,omitempty" json:"name"`
-	Thumbnail string             `bson:"thumbnail,omitempty" json:"thumbnail"`
+	Id        primitive.ObjectID `bson:"_id" json:"_id"`
+	Name      string             `bson:"name" json:"name"`
+	Thumbnail string             `bson:"thumbnail" json:"thumbnail"`
 	// 部件数量
-	CompCounts int `bson:"compCounts,omitempty" json:"compCounts"`
+	CompCounts int `bson:"compCounts" json:"compCounts"`
 	// 设计师
-	Designer string `bson:"designer,omitempty" json:"designer"`
+	Designer string `bson:"designer" json:"designer"`
 	// 组成包装的部件
-	Components []*PackComponent `bson:"components,omitempty" json:"components"`
-	CreateTime time.Time        `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time        `bson:"updateTime,omitempty" json:"updateTime"`
+	Components []*PackComponent `bson:"components" json:"components"`
+	CreateTime time.Time        `bson:"createTime" json:"createTime"`
+	UpdateTime time.Time        `bson:"updateTime" json:"updateTime"`
 }
 
 type PackComponent struct {
-	Id        string `bson:"id,omitempty" json:"id"`
-	Name      string `bson:"name,omitempty" json:"name"`
-	Thumbnail string `bson:"thumbnail,omitempty" json:"thumbnail"`
+	Id        string `bson:"id" json:"id"`
+	Name      string `bson:"name" json:"name"`
+	Thumbnail string `bson:"thumbnail" json:"thumbnail"`
 	//数量
-	Count int `bson:"count,omitempty" json:"count"`
+	Count int `bson:"count" json:"count"`
 
 	//刀版图
-	Uv string `bson:"uv,omitempty" json:"uv"`
+	Uv string `bson:"uv" json:"uv"`
 
 	//部件尺寸
-	UvSize string `bson:"uvSize,omitempty" json:"uvSize"`
+	UvSize string `bson:"uvSize" json:"uvSize"`
 
 	//所有材料
-	Stages []*ComponentStage `bson:"stages,omitempty" json:"stages"`
+	Stages []*ComponentStage `bson:"stages" json:"stages"`
 
-	Remark string `bson:"remark,omitempty" json:"remark"`
+	Remark string `bson:"remark" json:"remark"`
 
 	//部件总价
-	TotalPrice float64 `bson:"totalPrice,omitempty" json:"totalPrice"`
+	TotalPrice float64 `bson:"totalPrice" json:"totalPrice"`
 }
 
 type ComponentStage struct {
-	Id     string             `bson:"id,omitempty" json:"id"`
-	TypeId primitive.ObjectID `bson:"typeId,omitempty" json:"typeId"`
+	Id     string             `bson:"id" json:"id"`
+	TypeId primitive.ObjectID `bson:"typeId" json:"typeId"`
 
 	// 下单单价
-	OrderPrice float64 `bson:"orderPrice,omitempty" json:"orderPrice"`
+	OrderPrice float64 `bson:"orderPrice" json:"orderPrice"`
 
 	// 下单数量
-	OrderCount int `bson:"orderCount,omitempty" json:"orderCount"`
+	OrderCount int `bson:"orderCount" json:"orderCount"`
 
 	// 是否固定价格 如果是:为预算总价,不是:为实际总价
-	IsFix *bool `bson:"isFix,omitempty" json:"isFix"`
+	IsFix *bool `bson:"isFix" json:"isFix"`
 
 	//实际价格 OrderPrice*ConfirmCount
 	//预算价格 OrderPrice*OrderCount
 
 	//确认收货数量
-	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
+	ConfirmCount int `bson:"confirmCount" json:"confirmCount"`
 
 	// 供应相关信息
 	// 交货时间
-	DeliveryTime time.Time `bson:"deliveryTime,omitempty" json:"deliveryTime"`
+	DeliveryTime time.Time `bson:"deliveryTime" json:"deliveryTime"`
 
 	// 供应商信息
-	SupplierInfo *Supplier `bson:"supplierInfo,omitempty" json:"supplierInfo"`
-
-	BatchCount      *float64 `bson:"batchCount,omitempty" json:"batchCount"`           //拼版数量
-	BatchSizeWidth  int      `bson:"batchSizeWidth,omitempty" json:"batchSizeWidth"`   //平板尺寸
-	BatchSizeHeight int      `bson:"batchSizeHeight,omitempty" json:"batchSizeHeight"` //平板尺寸
-
-	Remark     string    `bson:"remark,omitempty" json:"remark"`     //备注
-	Size       string    `bson:"size,omitempty" json:"size"`         //工艺尺寸
-	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"`         // 规格
-	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
-	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
-	Type       int       `bson:"type,omitempty" json:"type"`         //1-材料 2-工艺 3-成品
-	Group      string    `bson:"group,omitempty" json:"group"`       //工序合标记,相同Group的数据合并成一个单据
-	BillId     string    `bson:"billId,omitempty" json:"billId"`     //订单Id
-	BillType   int       `bson:"billType,omitempty" json:"billType"` //订单type // 1,2,3
+	SupplierInfo *Supplier `bson:"supplierInfo" json:"supplierInfo"`
+
+	BatchCount      *float64 `bson:"batchCount" json:"batchCount"`           //拼版数量
+	BatchSizeWidth  int      `bson:"batchSizeWidth" json:"batchSizeWidth"`   //平板尺寸
+	BatchSizeHeight int      `bson:"batchSizeHeight" json:"batchSizeHeight"` //平板尺寸
+
+	Remark     string    `bson:"remark" json:"remark"`     //备注
+	Size       string    `bson:"size" json:"size"`         //工艺尺寸
+	Name       string    `bson:"name" json:"name"`         //名称
+	Category   string    `bson:"category" json:"category"` //分类
+	Price      float64   `bson:"price" json:"price"`       //单价
+	Unit       string    `bson:"unit" json:"unit"`         //单位
+	Norm       string    `bson:"norm" json:"norm"`         // 规格
+	CreateTime time.Time `bson:"createTime" json:"createTime"`
+	UpdateTime time.Time `bson:"updateTime" json:"updateTime"`
+	Type       int       `bson:"type" json:"type"`         //1-材料 2-工艺 3-成品
+	Group      string    `bson:"group" json:"group"`       //工序合标记,相同Group的数据合并成一个单据
+	BillId     string    `bson:"billId" json:"billId"`     //订单Id
+	BillType   int       `bson:"billType" json:"billType"` //订单type // 1,2,3
 }

+ 89 - 0
boxcost/db/model/packcopy

@@ -0,0 +1,89 @@
+package model
+
+import (
+	"time"
+
+	"go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+// 包装
+type Pack struct {
+	Id        primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+	Name      string             `bson:"name,omitempty" json:"name"`
+	Thumbnail string             `bson:"thumbnail,omitempty" json:"thumbnail"`
+	// 部件数量
+	CompCounts int `bson:"compCounts,omitempty" json:"compCounts"`
+	// 设计师
+	Designer string `bson:"designer,omitempty" json:"designer"`
+	// 组成包装的部件
+	Components []*PackComponent `bson:"components,omitempty" json:"components"`
+	CreateTime time.Time        `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime time.Time        `bson:"updateTime,omitempty" json:"updateTime"`
+}
+
+type PackComponent struct {
+	Id        string `bson:"id,omitempty" json:"id"`
+	Name      string `bson:"name,omitempty" json:"name"`
+	Thumbnail string `bson:"thumbnail,omitempty" json:"thumbnail"`
+	//数量
+	Count int `bson:"count,omitempty" json:"count"`
+
+	//刀版图
+	Uv string `bson:"uv,omitempty" json:"uv"`
+
+	//部件尺寸
+	UvSize string `bson:"uvSize,omitempty" json:"uvSize"`
+
+	//所有材料
+	Stages []*ComponentStage `bson:"stages,omitempty" json:"stages"`
+
+	Remark string `bson:"remark,omitempty" json:"remark"`
+
+	//部件总价
+	TotalPrice float64 `bson:"totalPrice,omitempty" json:"totalPrice"`
+}
+
+type ComponentStage struct {
+	Id     string             `bson:"id,omitempty" json:"id"`
+	TypeId primitive.ObjectID `bson:"typeId,omitempty" json:"typeId"`
+
+	// 下单单价
+	OrderPrice float64 `bson:"orderPrice,omitempty" json:"orderPrice"`
+
+	// 下单数量
+	OrderCount int `bson:"orderCount,omitempty" json:"orderCount"`
+
+	// 是否固定价格 如果是:为预算总价,不是:为实际总价
+	IsFix *bool `bson:"isFix,omitempty" json:"isFix"`
+
+	//实际价格 OrderPrice*ConfirmCount
+	//预算价格 OrderPrice*OrderCount
+
+	//确认收货数量
+	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
+
+	// 供应相关信息
+	// 交货时间
+	DeliveryTime time.Time `bson:"deliveryTime,omitempty" json:"deliveryTime"`
+
+	// 供应商信息
+	SupplierInfo *Supplier `bson:"supplierInfo,omitempty" json:"supplierInfo"`
+
+	BatchCount      *float64 `bson:"batchCount,omitempty" json:"batchCount"`           //拼版数量
+	BatchSizeWidth  int      `bson:"batchSizeWidth,omitempty" json:"batchSizeWidth"`   //平板尺寸
+	BatchSizeHeight int      `bson:"batchSizeHeight,omitempty" json:"batchSizeHeight"` //平板尺寸
+
+	Remark     string    `bson:"remark,omitempty" json:"remark"`     //备注
+	Size       string    `bson:"size,omitempty" json:"size"`         //工艺尺寸
+	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"`         // 规格
+	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
+	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
+	Type       int       `bson:"type,omitempty" json:"type"`         //1-材料 2-工艺 3-成品
+	Group      string    `bson:"group,omitempty" json:"group"`       //工序合标记,相同Group的数据合并成一个单据
+	BillId     string    `bson:"billId,omitempty" json:"billId"`     //订单Id
+	BillType   int       `bson:"billType,omitempty" json:"billType"` //订单type // 1,2,3
+}