animeic 1 năm trước cách đây
mục cha
commit
35f2660662
3 tập tin đã thay đổi với 17 bổ sung11 xóa
  1. 10 10
      boxcost/api/bill-produce-excel.go
  2. 5 0
      boxcost/api/bill-produce.go
  3. 2 1
      boxcost/db/model/bill.go

+ 10 - 10
boxcost/api/bill-produce-excel.go

@@ -91,8 +91,8 @@ func (b *ProduceBillExcel) drawTitle() error {
 		b.Excel.SetColWidth(b.SheetName, "G", "H", 12)
 		b.Excel.SetColWidth(b.SheetName, "I", "I", 16)
 
-	} else if b.Content.IsDuib {
-		// 是对裱
+	} 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)
@@ -247,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 || b.Content.IsDuib {
+		if b.Content.IsLam || b.Content.IsPaper {
 			drawLeft = func(rowIndex int, value string) error {
 				//左边1
 				left1Cell := fmt.Sprintf("A%d", rowIndex)
@@ -396,10 +396,10 @@ func (b *ProduceBillExcel) drawTableTitle() error {
 		drawCol("G", "预算金额")
 		drawCol("H", "交货时间")
 		drawCol("I", "备注")
-	} else if b.Content.IsDuib {
+	} else if b.Content.IsPaper {
 		drawCol("A", "加工项目")
 		drawCol("B", "规格")
-		drawCol("C", "对裱尺寸")
+		drawCol("C", "来纸尺寸")
 		drawCol("D", "下单数量")
 		drawCol("E", "单位")
 		drawCol("F", "单价")
@@ -427,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 || b.Content.IsDuib {
+			if b.Content.IsLam || b.Content.IsPaper {
 				charas = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I"}
 			}
 		}
@@ -479,7 +479,7 @@ func (b *ProduceBillExcel) drawTableContent() error {
 				// 覆膜
 				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 {
+			} 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)
 			} else {
@@ -519,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 || b.Content.IsDuib {
+		if b.Content.IsLam || b.Content.IsPaper {
 			sendToEndCell = fmt.Sprintf("F%d", b.Row)
 			supplierStartCell = fmt.Sprintf("G%d", b.Row)
 			supplierEndCell = fmt.Sprintf("I%d", b.Row)
@@ -561,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 || b.Content.IsDuib {
+		if b.Content.IsLam || b.Content.IsPaper {
 			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"))})
@@ -603,7 +603,7 @@ func (b *ProduceBillExcel) drawTableSignature() error {
 		image2s = "H"
 		image1e = "G"
 		image2e = "H"
-		if b.Content.IsLam || b.Content.IsDuib {
+		if b.Content.IsLam || b.Content.IsPaper {
 			fontNum = "E"
 			fontENum = "E"
 			image1s = "F"

+ 5 - 0
boxcost/api/bill-produce.go

@@ -301,6 +301,11 @@ func DownProduceBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		}
 
 	}
+	// 覆膜、打印与其他有来纸尺寸类型互斥
+	// 如果是这两种类型,不管isPaper的值,都需要有自己的表格
+	if bill.IsLam || bill.IsPrint {
+		bill.IsPaper = false
+	}
 	billExcel.Content = &bill
 	billExcel.IsPdf = isPdf
 	companyName := getCompanyName(apictx)

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

@@ -176,7 +176,8 @@ type ProduceBill struct {
 
 	IsPrint bool `bson:"isPrint,omitempty" json:"isPrint"`
 	IsLam   bool `bson:"isLam,omitempty" json:"isLam"`
-	IsDuib  bool `bson:"isDuib,omitempty" json:"isDuib"`
+	//是否需要纸张尺寸
+	IsPaper bool `bson:"isPaper,omitempty" json:"isPaper"`
 
 	// 单据类型
 	BillType string `bson:"billType,omitempty" json:"billType"`