Răsfoiți Sursa

添加来纸数量

animeic 1 an în urmă
părinte
comite
1d84180f9d
2 a modificat fișierele cu 41 adăugiri și 46 ștergeri
  1. 38 46
      boxcost/api/bill-produce-excel.go
  2. 3 0
      boxcost/db/model/bill.go

+ 38 - 46
boxcost/api/bill-produce-excel.go

@@ -29,17 +29,18 @@ func (b *ProduceBillExcel) drawTitle() error {
 	b.Row++
 	//是打印
 	startCell := fmt.Sprintf("A%d", b.Row)
-	marginLeft := excelize.PageMarginLeft(0.15)
-	endCell := fmt.Sprintf("K%d", b.Row)
+	marginLeft := excelize.PageMarginLeft(0.1)
+	endCell := fmt.Sprintf("L%d", b.Row)
 	if b.Content.IsPrint {
-		b.Excel.SetColWidth(b.SheetName, "A", "A", 14)
-		b.Excel.SetColWidth(b.SheetName, "B", "C", 13)
-		b.Excel.SetColWidth(b.SheetName, "D", "E", 9)
-		b.Excel.SetColWidth(b.SheetName, "F", "F", 8)
-		b.Excel.SetColWidth(b.SheetName, "G", "G", 6.5)
-		b.Excel.SetColWidth(b.SheetName, "H", "I", 9)
-		b.Excel.SetColWidth(b.SheetName, "J", "J", 12)
-		b.Excel.SetColWidth(b.SheetName, "K", "K", 14)
+		b.Excel.SetColWidth(b.SheetName, "A", "C", 11)
+		b.Excel.SetColWidth(b.SheetName, "D", "D", 10)
+		b.Excel.SetColWidth(b.SheetName, "E", "E", 7)
+		b.Excel.SetColWidth(b.SheetName, "F", "F", 10)
+		b.Excel.SetColWidth(b.SheetName, "G", "G", 7)
+		b.Excel.SetColWidth(b.SheetName, "H", "H", 6.5)
+		b.Excel.SetColWidth(b.SheetName, "I", "J", 9)
+		b.Excel.SetColWidth(b.SheetName, "K", "K", 12)
+		b.Excel.SetColWidth(b.SheetName, "L", "L", 14)
 
 	} else {
 		// 不是打印
@@ -105,7 +106,7 @@ func (b *ProduceBillExcel) drawSubTitles() error {
 	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))
+		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("I%d", rowIndex))
 		if err != nil {
 			return err
 		}
@@ -118,8 +119,8 @@ func (b *ProduceBillExcel) drawSubTitles() error {
 	}
 
 	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))
+		right1Cell := fmt.Sprintf("J%d", rowIndex)
+		err = b.Excel.MergeCell(b.SheetName, right1Cell, fmt.Sprintf("L%d", rowIndex))
 		if err != nil {
 			return err
 		}
@@ -134,7 +135,7 @@ func (b *ProduceBillExcel) drawSubTitles() error {
 	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))
+		err = b.Excel.MergeCell(b.SheetName, left1Cell, fmt.Sprintf("L%d", rowIndex))
 		if err != nil {
 			return err
 		}
@@ -285,19 +286,6 @@ func (b *ProduceBillExcel) drawTableTitle() error {
 		return b.Excel.SetCellValue(b.SheetName, left1Cell, value)
 	}
 
-	// var drawCol2 = func(prefix string, value1 string, value2 string) error {
-
-	// 	left1Cell := fmt.Sprintf("%s%d", prefix, b.Row)
-	// 	left2Cell := fmt.Sprintf("%s%d", prefix, b.Row+1)
-	// 	err := b.Excel.SetCellStyle(b.SheetName, left1Cell, left2Cell, b.AlignCenterStyle)
-	// 	if err != nil {
-	// 		return err
-	// 	}
-	// 	b.Excel.SetCellValue(b.SheetName, left1Cell, value1)
-	// 	b.Excel.SetCellValue(b.SheetName, left2Cell, value2)
-	// 	return nil
-	// }
-
 	var drawCol3 = func(prefix1 string, prefix2 string, value1 string, value2 string, value3 string) error {
 		left1Cell := fmt.Sprintf("%s%d", prefix1, b.Row)
 		left2Cell := fmt.Sprintf("%s%d", prefix2, b.Row)
@@ -331,13 +319,14 @@ func (b *ProduceBillExcel) drawTableTitle() error {
 		drawCol("B", "规格")
 		drawCol("C", "纸张")
 		drawCol("D", "来纸尺寸")
-		drawCol("E", "印刷尺寸")
-		drawCol("F", "下单数量")
-		drawCol("G", "单位")
-		drawCol("H", "单价")
-		drawCol("I", "预算金额")
-		drawCol("J", "交货时间")
-		drawCol("K", "备注")
+		drawCol("E", "来纸数量")
+		drawCol("F", "印刷尺寸")
+		drawCol("G", "下单数量")
+		drawCol("H", "单位")
+		drawCol("I", "单价")
+		drawCol("J", "预算金额")
+		drawCol("K", "交货时间")
+		drawCol("L", "备注")
 
 	} else {
 		if b.Content.IsLam {
@@ -371,7 +360,7 @@ func (b *ProduceBillExcel) drawTableTitle() error {
 func (b *ProduceBillExcel) drawTableContent() error {
 	b.Row += 2
 	var DrawRow = func(rowIndex int, values ...string) {
-		charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K"}
+		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 {
@@ -426,8 +415,11 @@ func (b *ProduceBillExcel) drawTableContent() error {
 
 			deliveryTime := produce.DeliveryTime.Local().Format("2006-01-02")
 
+			paperCount := fmt.Sprintf("%d", produce.PaperCount)
+			b.FormatToEmpty(&paperCount)
+
 			if b.Content.IsPrint {
-				DrawRow(b.Row, produce.Name, produce.Norm, produce.Paper, produce.PaperSize, produce.PrintSize, fmt.Sprintf("%d", produce.OrderCount), produce.Unit, priceStr, budgetAmount, deliveryTime, produce.Remark)
+				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 {
 				// 覆膜
 				if b.Content.IsLam {
@@ -459,9 +451,9 @@ func (b *ProduceBillExcel) drawTableFooter() error {
 
 	sendToStartCell := fmt.Sprintf("A%d", b.Row)
 
-	sendToEndCell := fmt.Sprintf("H%d", b.Row)
-	supplierStartCell := fmt.Sprintf("I%d", b.Row)
-	supplierEndCell := fmt.Sprintf("K%d", b.Row)
+	sendToEndCell := fmt.Sprintf("I%d", b.Row)
+	supplierStartCell := fmt.Sprintf("J%d", b.Row)
+	supplierEndCell := fmt.Sprintf("L%d", b.Row)
 	if !b.Content.IsPrint {
 		sendToEndCell = fmt.Sprintf("E%d", b.Row)
 		supplierStartCell = fmt.Sprintf("F%d", b.Row)
@@ -501,7 +493,7 @@ func (b *ProduceBillExcel) drawSupplierRemark() error {
 
 	sendToStartCell := fmt.Sprintf("A%d", b.Row)
 
-	sendToEndCell := fmt.Sprintf("K%d", b.Row)
+	sendToEndCell := fmt.Sprintf("L%d", b.Row)
 	if !b.Content.IsPrint {
 		sendToEndCell = fmt.Sprintf("H%d", b.Row)
 
@@ -533,12 +525,12 @@ func (b *ProduceBillExcel) drawTableSignature() error {
 	b.Excel.MergeCell(b.SheetName, billUserCellS, billUserCellE)
 	b.Excel.SetCellValue(b.SheetName, billUserCellS, "制单人:"+b.Content.UserName)
 
-	fontNum := "F"
-	fontENum := "G"
-	image1s := "H"
-	image2s := "J"
-	image1e := "I"
-	image2e := "K"
+	fontNum := "G"
+	fontENum := "H"
+	image1s := "I"
+	image2s := "K"
+	image1e := "J"
+	image2e := "L"
 	if !b.Content.IsPrint {
 		fontNum = "E"
 		fontENum = "E"

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

@@ -115,6 +115,9 @@ type ProduceBillData struct {
 	// 确认收货数量
 	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
 
+	// 来纸数量
+	PaperCount int `bson:"paperCount,omitempty" json:"paperCount"`
+
 	//备注
 	Remark string `bson:"remark,omitempty" json:"remark"`