|
@@ -93,15 +93,16 @@ func (b *ProduceBillExcel) drawTitle() error {
|
|
|
|
|
|
} else if b.Content.IsPaper {
|
|
|
// 是纸张类型
|
|
|
- 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)
|
|
|
+ b.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}
|
|
|
+ b.RowWidthArray = []float64{11, 11, 11, 10, 10, 10, 8, 10, 9, 12, 14}
|
|
|
+ endCell = fmt.Sprintf("K%d", b.Row)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "A", "C", 11)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "D", "F", 10)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "G", "G", 8)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "H", "H", 10)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "I", "I", 11)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "J", "J", 12)
|
|
|
+ b.Excel.SetColWidth(b.SheetName, "K", "K", 14)
|
|
|
|
|
|
} else {
|
|
|
// 不是打印
|
|
@@ -247,7 +248,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 || b.Content.IsPaper {
|
|
|
+ if b.Content.IsLam {
|
|
|
drawLeft = func(rowIndex int, value string) error {
|
|
|
//左边1
|
|
|
left1Cell := fmt.Sprintf("A%d", rowIndex)
|
|
@@ -297,6 +298,56 @@ func (b *ProduceBillExcel) drawSubTitles() error {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ if b.Content.IsPaper {
|
|
|
+ drawLeft = func(rowIndex int, value string) error {
|
|
|
+ //左边1
|
|
|
+ left1Cell := fmt.Sprintf("A%d", rowIndex)
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("H%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)
|
|
|
+ // 设置行高
|
|
|
+ b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{rowIndex: getRowHeight(value, b.getRangeWidth("A:H"))})
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ drawRight = func(rowIndex int, value string) error {
|
|
|
+ right1Cell := fmt.Sprintf("I%d", rowIndex)
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("K%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
|
|
|
+ }
|
|
|
+
|
|
|
+ drawLall = func(rowIndex int, value string) error {
|
|
|
+ //左边1
|
|
|
+ left1Cell := fmt.Sprintf("A%d", rowIndex)
|
|
|
+ err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("K%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)
|
|
|
+ // 设置行高
|
|
|
+ b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{rowIndex: getRowHeight(value, b.getRangeWidth("A:K"))})
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//第一行
|
|
@@ -399,13 +450,15 @@ func (b *ProduceBillExcel) drawTableTitle() error {
|
|
|
} else if b.Content.IsPaper {
|
|
|
drawCol("A", "加工项目")
|
|
|
drawCol("B", "规格")
|
|
|
- drawCol("C", "来纸尺寸")
|
|
|
- drawCol("D", "下单数量")
|
|
|
- drawCol("E", "单位")
|
|
|
- drawCol("F", "单价")
|
|
|
- drawCol("G", "预算金额")
|
|
|
- drawCol("H", "交货时间")
|
|
|
- drawCol("I", "备注")
|
|
|
+ drawCol("C", "纸张")
|
|
|
+ drawCol("D", "来纸数量")
|
|
|
+ drawCol("E", "来纸尺寸")
|
|
|
+ drawCol("F", "下单数量")
|
|
|
+ drawCol("G", "单位")
|
|
|
+ drawCol("H", "单价")
|
|
|
+ drawCol("I", "预算金额")
|
|
|
+ drawCol("J", "交货时间")
|
|
|
+ drawCol("K", "备注")
|
|
|
} else {
|
|
|
drawCol("A", "加工项目")
|
|
|
drawCol("B", "规格")
|
|
@@ -427,9 +480,12 @@ 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 || b.Content.IsPaper {
|
|
|
+ if b.Content.IsLam {
|
|
|
charas = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I"}
|
|
|
}
|
|
|
+ if b.Content.IsPaper {
|
|
|
+ charas = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"}
|
|
|
+ }
|
|
|
}
|
|
|
// 获取改行最大行高
|
|
|
max := getRowHeight(values[0], b.getRangeWidth(charas[0]))
|
|
@@ -481,7 +537,7 @@ func (b *ProduceBillExcel) drawTableContent() error {
|
|
|
|
|
|
} else if b.Content.IsPaper {
|
|
|
// 对裱
|
|
|
- rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, produce.PaperSize, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
|
|
|
+ rowMaxHeight = DrawRow(b.Row, produce.Name, produce.Norm, produce.Paper, paperCount, 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)
|
|
|
}
|
|
@@ -519,13 +575,20 @@ 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 || b.Content.IsPaper {
|
|
|
+ if b.Content.IsLam {
|
|
|
sendToEndCell = fmt.Sprintf("F%d", b.Row)
|
|
|
supplierStartCell = fmt.Sprintf("G%d", b.Row)
|
|
|
supplierEndCell = fmt.Sprintf("I%d", b.Row)
|
|
|
b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("送货地址:"+b.Content.SendTo, b.getRangeWidth("A:F"))})
|
|
|
|
|
|
}
|
|
|
+ if b.Content.IsPaper {
|
|
|
+ sendToEndCell = fmt.Sprintf("H%d", b.Row)
|
|
|
+ supplierStartCell = fmt.Sprintf("I%d", b.Row)
|
|
|
+ supplierEndCell = fmt.Sprintf("K%d", b.Row)
|
|
|
+ b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("送货地址:"+b.Content.SendTo, b.getRangeWidth("A:K"))})
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
b.Excel.MergeCell(b.SheetName, sendToStartCell, sendToEndCell)
|
|
@@ -567,6 +630,12 @@ func (b *ProduceBillExcel) drawSupplierRemark() error {
|
|
|
b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("供应商备注:"+b.Content.SupplierRemark, b.getRangeWidth("A:I"))})
|
|
|
|
|
|
}
|
|
|
+ if b.Content.IsPaper {
|
|
|
+ sendToEndCell = fmt.Sprintf("K%d", b.Row)
|
|
|
+ // 设置行高
|
|
|
+ b.RowsHeightArray = append(b.RowsHeightArray, map[int]float64{b.Row: getRowHeight("供应商备注:"+b.Content.SupplierRemark, b.getRangeWidth("A:K"))})
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
b.Excel.MergeCell(b.SheetName, sendToStartCell, sendToEndCell)
|
|
@@ -603,7 +672,7 @@ func (b *ProduceBillExcel) drawTableSignature() error {
|
|
|
image2s = "H"
|
|
|
image1e = "G"
|
|
|
image2e = "H"
|
|
|
- if b.Content.IsLam || b.Content.IsPaper {
|
|
|
+ if b.Content.IsLam {
|
|
|
fontNum = "E"
|
|
|
fontENum = "E"
|
|
|
image1s = "F"
|
|
@@ -612,6 +681,15 @@ func (b *ProduceBillExcel) drawTableSignature() error {
|
|
|
image2e = "I"
|
|
|
|
|
|
}
|
|
|
+ if b.Content.IsPaper {
|
|
|
+ fontNum = "G"
|
|
|
+ fontENum = "G"
|
|
|
+ image1s = "H"
|
|
|
+ image2s = "J"
|
|
|
+ image1e = "I"
|
|
|
+ image2e = "K"
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
fontCell := fmt.Sprintf("%s%d", fontNum, b.Row)
|