animeic 1 éve
szülő
commit
c792a749b8
2 módosított fájl, 72 hozzáadás és 50 törlés
  1. 71 50
      boxcost/api/bill-produce-excel.go
  2. 1 0
      boxcost/db/model/bill.go

+ 71 - 50
boxcost/api/bill-produce-excel.go

@@ -78,31 +78,43 @@ func (b *ProduceBillExcel) drawTitle() error {
 		b.Excel.SetColWidth(b.SheetName, "K", "K", 12)
 		b.Excel.SetColWidth(b.SheetName, "L", "L", 14)
 
+	} else if b.Content.IsLam {
+		// 是覆膜
+		b.RowMap = map[string]int{"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7, "I": 8}
+		b.RowWidthArray = []float64{14, 14, 14, 10, 11, 11, 12, 12, 16}
+		endCell = fmt.Sprintf("I%d", b.Row)
+		marginLeft = excelize.PageMarginLeft(0.2)
+		b.Excel.SetColWidth(b.SheetName, "A", "C", 14)
+		// 覆膜规格
+		b.Excel.SetColWidth(b.SheetName, "D", "D", 10)
+		b.Excel.SetColWidth(b.SheetName, "E", "F", 12)
+		b.Excel.SetColWidth(b.SheetName, "G", "H", 12)
+		b.Excel.SetColWidth(b.SheetName, "I", "I", 16)
+
+	} else if b.Content.IsDuib {
+		// 是对裱
+		b.RowMap = map[string]int{"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7, "I": 8}
+		b.RowWidthArray = []float64{14, 14, 14, 12, 7, 12, 12, 12, 16}
+		endCell = fmt.Sprintf("I%d", b.Row)
+		marginLeft = excelize.PageMarginLeft(0.2)
+		b.Excel.SetColWidth(b.SheetName, "A", "C", 14)
+		b.Excel.SetColWidth(b.SheetName, "D", "D", 12)
+		b.Excel.SetColWidth(b.SheetName, "E", "E", 10)
+		b.Excel.SetColWidth(b.SheetName, "F", "H", 12)
+		b.Excel.SetColWidth(b.SheetName, "I", "I", 16)
+
 	} else {
 		// 不是打印
 		endCell = fmt.Sprintf("H%d", b.Row)
-		marginLeft = excelize.PageMarginLeft(0.6)
+		marginLeft = excelize.PageMarginLeft(0.4)
 		b.Excel.SetColWidth(b.SheetName, "A", "B", 17)
 		b.Excel.SetColWidth(b.SheetName, "C", "C", 12)
-		b.Excel.SetColWidth(b.SheetName, "D", "D", 6)
+		b.Excel.SetColWidth(b.SheetName, "D", "D", 10)
 		b.Excel.SetColWidth(b.SheetName, "E", "G", 12)
 		b.Excel.SetColWidth(b.SheetName, "H", "H", 20)
-		// 是覆膜
-		if b.Content.IsLam {
-			b.RowMap = map[string]int{"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7, "I": 8}
-			b.RowWidthArray = []float64{14, 14, 14, 10, 11, 11, 12, 12, 16}
-			endCell = fmt.Sprintf("I%d", b.Row)
-			marginLeft = excelize.PageMarginLeft(0.2)
-			b.Excel.SetColWidth(b.SheetName, "A", "C", 14)
-			// 覆膜规格
-			b.Excel.SetColWidth(b.SheetName, "D", "D", 10)
-			b.Excel.SetColWidth(b.SheetName, "E", "F", 11)
-			b.Excel.SetColWidth(b.SheetName, "G", "H", 12)
-			b.Excel.SetColWidth(b.SheetName, "I", "I", 16)
-
-		}
 
 	}
+
 	b.Excel.SetPageMargins(b.SheetName, marginLeft)
 	err := b.Excel.MergeCell(b.SheetName, startCell, endCell)
 	if err != nil {
@@ -235,7 +247,7 @@ func (b *ProduceBillExcel) drawSubTitles() error {
 			b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{rowIndex: getRowHeight(value, b.getRangeWidth("A:H"))})
 			return nil
 		}
-		if b.Content.IsLam {
+		if b.Content.IsLam || b.Content.IsDuib {
 			drawLeft = func(rowIndex int, value string) error {
 				//左边1
 				left1Cell := fmt.Sprintf("A%d", rowIndex)
@@ -373,29 +385,36 @@ func (b *ProduceBillExcel) drawTableTitle() error {
 		drawCol("K", "交货时间")
 		drawCol("L", "备注")
 
-	} else {
-		if b.Content.IsLam {
-			drawCol("A", "加工项目")
-			drawCol("B", "规格")
-			drawCol("C", "覆膜尺寸")
-			drawCol("D", "下单数量")
-			unit2 := b.Content.Produces[0].Unit2
-			drawCol3("E", "F", "单价", unit, unit2)
-			drawCol("G", "预算金额")
-			drawCol("H", "交货时间")
-			drawCol("I", "备注")
-
-		} else {
-			drawCol("A", "加工项目")
-			drawCol("B", "规格")
-			drawCol("C", "下单数量")
-			drawCol("D", "单位")
-			drawCol("E", "单价")
-			drawCol("F", "预算金额")
-			drawCol("G", "交货时间")
-			drawCol("H", "备注")
+	} else if b.Content.IsLam {
 
-		}
+		drawCol("A", "加工项目")
+		drawCol("B", "规格")
+		drawCol("C", "覆膜尺寸")
+		drawCol("D", "下单数量")
+		unit2 := b.Content.Produces[0].Unit2
+		drawCol3("E", "F", "单价", unit, unit2)
+		drawCol("G", "预算金额")
+		drawCol("H", "交货时间")
+		drawCol("I", "备注")
+	} else if b.Content.IsDuib {
+		drawCol("A", "加工项目")
+		drawCol("B", "规格")
+		drawCol("C", "对裱尺寸")
+		drawCol("D", "下单数量")
+		drawCol("E", "单位")
+		drawCol("F", "单价")
+		drawCol("G", "预算金额")
+		drawCol("H", "交货时间")
+		drawCol("I", "备注")
+	} else {
+		drawCol("A", "加工项目")
+		drawCol("B", "规格")
+		drawCol("C", "下单数量")
+		drawCol("D", "单位")
+		drawCol("E", "单价")
+		drawCol("F", "预算金额")
+		drawCol("G", "交货时间")
+		drawCol("H", "备注")
 
 	}
 
@@ -408,7 +427,7 @@ func (b *ProduceBillExcel) drawTableContent() error {
 		charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}
 		if !b.Content.IsPrint {
 			charas = []string{"A", "B", "C", "D", "E", "F", "G", "H"}
-			if b.Content.IsLam {
+			if b.Content.IsLam || b.Content.IsDuib {
 				charas = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I"}
 			}
 		}
@@ -456,15 +475,17 @@ func (b *ProduceBillExcel) drawTableContent() error {
 			rowMaxHeight := 0.0
 			if b.Content.IsPrint {
 				rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, produce.Paper, produce.PaperSize, paperCount, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
-			} else {
+			} else if b.Content.IsLam {
 				// 覆膜
-				if b.Content.IsLam {
-					rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), priceStr, fmt.Sprintf("%.3f", produce.Price2), budgetAmount, deliveryTime, produce.Remark)
-				} else {
-					rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
-				}
+				rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), priceStr, fmt.Sprintf("%.3f", produce.Price2), budgetAmount, deliveryTime, produce.Remark)
 
+			} else if b.Content.IsDuib {
+				// 对裱
+				rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, produce.PaperSize, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
+			} else {
+				rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
 			}
+
 			b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: rowMaxHeight})
 			b.Row++
 		}
@@ -498,7 +519,7 @@ func (b *ProduceBillExcel) drawTableFooter() error {
 		supplierEndCell = fmt.Sprintf("H%d", b.Row)
 		b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("送货地址:"+b.Content.SendTo, b.getRangeWidth("A:E"))})
 
-		if b.Content.IsLam {
+		if b.Content.IsLam || b.Content.IsDuib {
 			sendToEndCell = fmt.Sprintf("F%d", b.Row)
 			supplierStartCell = fmt.Sprintf("G%d", b.Row)
 			supplierEndCell = fmt.Sprintf("I%d", b.Row)
@@ -540,7 +561,7 @@ func (b *ProduceBillExcel) drawSupplierRemark() error {
 		// 设置行高
 		b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("供应商备注:"+b.Content.SupplierRemark, b.getRangeWidth("A:H"))})
 
-		if b.Content.IsLam {
+		if b.Content.IsLam || b.Content.IsDuib {
 			sendToEndCell = fmt.Sprintf("I%d", b.Row)
 			// 设置行高
 			b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("供应商备注:"+b.Content.SupplierRemark, b.getRangeWidth("A:I"))})
@@ -582,7 +603,7 @@ func (b *ProduceBillExcel) drawTableSignature() error {
 		image2s = "H"
 		image1e = "G"
 		image2e = "H"
-		if b.Content.IsLam {
+		if b.Content.IsLam || b.Content.IsDuib {
 			fontNum = "E"
 			fontENum = "E"
 			image1s = "F"
@@ -667,7 +688,7 @@ func NewProduceBill(f *excelize.File) *ProduceBillExcel {
 		AlignCenterStyle: styleLeft,
 		Signatures:       make([]*model.Signature, 0),
 		RowMap:           map[string]int{"A": 0, "B": 1, "C": 2, "D": 3, "E": 4, "F": 5, "G": 6, "H": 7},
-		RowWidthArray:    []float64{17, 17, 12, 6, 12, 12, 12, 20},
+		RowWidthArray:    []float64{17, 17, 12, 10, 12, 12, 12, 20},
 		RowsHeightArray:  make([]map[int]float64, 0),
 	}
 

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

@@ -176,6 +176,7 @@ type ProduceBill struct {
 
 	IsPrint bool `bson:"isPrint,omitempty" json:"isPrint"`
 	IsLam   bool `bson:"isLam,omitempty" json:"isLam"`
+	IsDuib  bool `bson:"isDuib,omitempty" json:"isDuib"`
 
 	// 单据类型
 	BillType string `bson:"billType,omitempty" json:"billType"`