animeic 2 years ago
parent
commit
949f006721

+ 1 - 0
boxcost/Dockerfile

@@ -14,6 +14,7 @@ RUN echo -e https://mirrors.ustc.edu.cn/alpine/v3.15/main > /etc/apk/repositorie
 
 WORKDIR /root/box-cost
 
+ADD ./signature ./signature
 ADD ./app.yaml ./app.yaml
 ADD ./box-cost-service ./box-cost-service
 

+ 9 - 4
boxcost/api/bill-produce-excel.go

@@ -10,6 +10,7 @@ import (
 
 type ProduceBillExcel struct {
 	Offset int
+	Row    int
 
 	Title string //标题
 
@@ -50,7 +51,6 @@ func (b *ProduceBillExcel) drawTitle() error {
 }
 
 func (b *ProduceBillExcel) drawSubTitles() error {
-
 	row := b.Offset + 2
 
 	styleLeft, err := b.Excel.NewStyle(&excelize.Style{
@@ -172,7 +172,7 @@ func (b *ProduceBillExcel) drawTableTitle() error {
 
 func (b *ProduceBillExcel) drawTableContent() error {
 	row := b.Offset + 7
-
+	b.Row = row
 	var DrawRow = func(rowIndex int, values ...string) {
 		charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}
 		for i, c := range charas {
@@ -216,6 +216,7 @@ func (b *ProduceBillExcel) drawTableContent() error {
 			deliveryTime := produce.DeliveryTime.Local().Format("2006-01-02")
 			DrawRow(row, produce.Name, produce.Norm, produce.Paper, produce.PaperSize, produce.PrintSize, fmt.Sprintf("%d", produce.Count), confirmCount, produce.Price, budgetAmount, realAmount, deliveryTime, produce.Remark)
 			row++
+			b.Row++
 		}
 	}
 
@@ -223,7 +224,9 @@ func (b *ProduceBillExcel) drawTableContent() error {
 }
 
 func (b *ProduceBillExcel) drawTableFooter() error {
-	row := b.Offset + 8
+	// row := b.Offset + 8
+	// b.Row++
+	row := b.Row
 
 	left1Cell := fmt.Sprintf("A%d", row)
 
@@ -259,7 +262,9 @@ func (b *ProduceBillExcel) drawTableFooter() error {
 }
 
 func (b *ProduceBillExcel) drawTableSignature() error {
-	row := b.Offset + 11
+	// row := b.Offset + 11
+	b.Row += 2
+	row := b.Row
 
 	style1, _ := b.Excel.NewStyle(&excelize.Style{
 		Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},

+ 9 - 2
boxcost/api/bill-purchase-excel.go

@@ -14,6 +14,7 @@ import (
 
 type PurchaseBillExcel struct {
 	Offset int
+	Row    int
 
 	Title string //标题
 
@@ -180,6 +181,7 @@ func (b *PurchaseBillExcel) drawTableTitle() error {
 	drawCol2("C", "D", "尺寸(mm)", "长", "宽")
 	unit1 := "-"
 	unit2 := "-"
+	// ??? for ragne
 	if len(b.Content.Paper) > 0 {
 		if b.Content.Paper[0].PriceUnit != "" {
 			unit1 = b.Content.Paper[0].PriceUnit
@@ -206,6 +208,7 @@ func (b *PurchaseBillExcel) drawTableTitle() error {
 
 func (b *PurchaseBillExcel) drawTableContent() error {
 	row := b.Offset + 7
+	b.Row = row
 
 	var DrawRow = func(rowIndex int, values ...string) {
 		charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}
@@ -249,6 +252,7 @@ func (b *PurchaseBillExcel) drawTableContent() error {
 
 			DrawRow(row, paper.Name, paper.Norm, paper.Height, paper.Width, fmt.Sprintf("%d", paper.Count), confirmCount, paper.Price, paper.Price2, budgetAmount, realAmount, deliveryTime, paper.Remark)
 			row++
+			b.Row++
 		}
 	}
 
@@ -256,7 +260,8 @@ func (b *PurchaseBillExcel) drawTableContent() error {
 }
 
 func (b *PurchaseBillExcel) drawTableFooter() error {
-	row := b.Offset + 8
+	// row := b.Offset + 8
+	row := b.Row
 
 	left1Cell := fmt.Sprintf("A%d", row)
 
@@ -292,7 +297,9 @@ func (b *PurchaseBillExcel) drawTableFooter() error {
 }
 
 func (b *PurchaseBillExcel) drawTableSignature() error {
-	row := b.Offset + 11
+	// row := b.Offset + 11
+	b.Row += 2
+	row := b.Row
 	// border := []excelize.Border{
 	// 	{Type: "top", Style: 1, Color: "000000"},
 	// 	{Type: "left", Style: 1, Color: "000000"},

+ 60 - 62
boxcost/api/plan-cost-excel.go

@@ -26,7 +26,7 @@ type PlanCostExcel struct {
 func (b *PlanCostExcel) drawTitle() error {
 	tileIndex := b.Offset + 1
 	startCell := fmt.Sprintf("A%d", tileIndex)
-	err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("L%d", tileIndex))
+	err := b.Excel.MergeCell(b.SheetName, startCell, fmt.Sprintf("M%d", tileIndex))
 	if err != nil {
 		return err
 	}
@@ -144,9 +144,6 @@ func (b *PlanCostExcel) drawTableTitle() error {
 	drawCol("K", "单价")
 	drawCol("L", "预算金额")
 	drawCol("M", "实际金额")
-	drawCol("N", "预算汇总")
-	drawCol("O", "实际汇总")
-
 	return nil
 }
 
@@ -196,7 +193,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 							totalConfirmRealPrice += confirmPrice
 							confirmRealPrice := fmt.Sprintf("%.2f", confirmPrice)
 							b.FormatToEmpty(&confirmRealPrice)
-							b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice, "", "")
+							b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice)
 							row++
 						}
 
@@ -235,7 +232,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 									confirmCraftRealPrice := fmt.Sprintf("%.2f", confirmCraftPrice)
 									b.FormatToEmpty(&confirmCraftRealPrice)
 
-									b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice, "", "")
+									b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice)
 									row++
 
 								}
@@ -260,28 +257,28 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 					fmt.Println("startACell:", startACell)
 					fmt.Println("endACell:", endACell)
 					fmt.Println("compName:", comp.Name)
-					// 供应商组件预算汇总
-					startLCell := fmt.Sprintf("%s%d", "N", startRow)
-					endLCell := fmt.Sprintf("%s%d", "N", endRow)
-					b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
-					err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
-					if err != nil {
-						return err
-					}
-					compTotalPrice := fmt.Sprintf("%.2f", totalOrderRealPrice)
-					b.FormatToEmpty(&compTotalPrice)
-					b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
-					// 供应商组件实际汇总
-					startOCell := fmt.Sprintf("%s%d", "O", startRow)
-					endOCell := fmt.Sprintf("%s%d", "O", endRow)
-					b.Excel.MergeCell(b.SheetName, startOCell, endOCell)
-					err = b.Excel.SetCellStyle(b.SheetName, startOCell, endOCell, b.AlignCenterStyle)
-					if err != nil {
-						return err
-					}
-					compConfirmTotalPrice := fmt.Sprintf("%.2f", totalConfirmRealPrice)
-					b.FormatToEmpty(&compConfirmTotalPrice)
-					b.Excel.SetCellValue(b.SheetName, startLCell, compConfirmTotalPrice)
+					// // 供应商组件预算汇总
+					// startLCell := fmt.Sprintf("%s%d", "N", startRow)
+					// endLCell := fmt.Sprintf("%s%d", "N", endRow)
+					// b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
+					// err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
+					// if err != nil {
+					// 	return err
+					// }
+					// compTotalPrice := fmt.Sprintf("%.2f", totalOrderRealPrice)
+					// b.FormatToEmpty(&compTotalPrice)
+					// b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
+					// // 供应商组件实际汇总
+					// startOCell := fmt.Sprintf("%s%d", "O", startRow)
+					// endOCell := fmt.Sprintf("%s%d", "O", endRow)
+					// b.Excel.MergeCell(b.SheetName, startOCell, endOCell)
+					// err = b.Excel.SetCellStyle(b.SheetName, startOCell, endOCell, b.AlignCenterStyle)
+					// if err != nil {
+					// 	return err
+					// }
+					// compConfirmTotalPrice := fmt.Sprintf("%.2f", totalConfirmRealPrice)
+					// b.FormatToEmpty(&compConfirmTotalPrice)
+					// b.Excel.SetCellValue(b.SheetName, startLCell, compConfirmTotalPrice)
 
 				}
 
@@ -289,26 +286,27 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 			totalPlanPrice += totalOrderRealPrice
 			confirmTotalPlanPrice += totalConfirmRealPrice
 		}
+
 		// 生产汇总金额
 		startACell := fmt.Sprintf("%s%d", "A", row)
-		endMCell := fmt.Sprintf("%s%d", "M", row)
-		NCell := fmt.Sprintf("%s%d", "N", row)
-		OCell := fmt.Sprintf("%s%d", "O", row)
-		b.Excel.MergeCell(b.SheetName, startACell, endMCell)
-		b.Excel.SetCellStyle(b.SheetName, startACell, endMCell, b.AlignCenterStyle)
+		endKCell := fmt.Sprintf("%s%d", "K", row)
+		LCell := fmt.Sprintf("%s%d", "L", row)
+		MCell := fmt.Sprintf("%s%d", "M", row)
+		b.Excel.MergeCell(b.SheetName, startACell, endKCell)
+		b.Excel.SetCellStyle(b.SheetName, startACell, endKCell, b.AlignCenterStyle)
 		b.Excel.SetCellValue(b.SheetName, startACell, "生产计划汇总金额")
 
 		// 生产预算汇总
-		b.Excel.SetCellStyle(b.SheetName, NCell, NCell, b.AlignCenterStyle)
+		b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
 		planTotalPrice := fmt.Sprintf("%.2f", totalPlanPrice)
 		b.FormatToEmpty(&planTotalPrice)
-		b.Excel.SetCellValue(b.SheetName, NCell, planTotalPrice)
+		b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
 
 		// 生产实际汇总
-		b.Excel.SetCellStyle(b.SheetName, OCell, OCell, b.AlignCenterStyle)
+		b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
 		planConfirmTotalPrice := fmt.Sprintf("%.2f", confirmTotalPlanPrice)
 		b.FormatToEmpty(&planConfirmTotalPrice)
-		b.Excel.SetCellValue(b.SheetName, OCell, planConfirmTotalPrice)
+		b.Excel.SetCellValue(b.SheetName, MCell, planConfirmTotalPrice)
 
 	}
 
@@ -316,7 +314,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 }
 
 func (b *PlanCostExcel) drawRow(rowIndex int, values ...string) {
-	charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O"}
+	charas := []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M"}
 	for i, c := range charas {
 		v := ""
 		if i < len(values) {
@@ -374,7 +372,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 					totalConfirmRealPrice += confirmPrice
 					confirmRealPrice := fmt.Sprintf("%.2f", confirmPrice)
 					b.FormatToEmpty(&confirmRealPrice)
-					b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice, "", "")
+					b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, confirmCount, orderPrice, orderRealPrice, confirmRealPrice)
 
 					row++
 					if len(mat.Crafts) > 0 {
@@ -413,7 +411,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 							confirmCraftRealPrice := fmt.Sprintf("%.2f", confirmCraftPrice)
 							b.FormatToEmpty(&confirmCraftRealPrice)
 
-							b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice, "", "")
+							b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, confirmCraftCount, carftOrderPrice, carftOrderRealPrice, confirmCraftRealPrice)
 
 							row++
 
@@ -430,41 +428,41 @@ func (b *PlanCostExcel) drawAllContent() error {
 					return err
 				}
 				b.Excel.SetCellValue(b.SheetName, startACell, comp.Name)
-				// 组件汇总金额
-				startLCell := fmt.Sprintf("%s%d", "L", startRow)
-				endLCell := fmt.Sprintf("%s%d", "L", endRow)
-				b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
-				err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
-				if err != nil {
-					return err
-				}
-				compTotalPrice := fmt.Sprintf("%.2f", comp.TotalPrice)
-				b.FormatToEmpty(&compTotalPrice)
-				b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
-				confirmTotalPlanPrice += totalConfirmRealPrice
+				// // 组件汇总金额
+				// startLCell := fmt.Sprintf("%s%d", "L", startRow)
+				// endLCell := fmt.Sprintf("%s%d", "L", endRow)
+				// b.Excel.MergeCell(b.SheetName, startLCell, endLCell)
+				// err = b.Excel.SetCellStyle(b.SheetName, startLCell, endLCell, b.AlignCenterStyle)
+				// if err != nil {
+				// 	return err
+				// }
+				// compTotalPrice := fmt.Sprintf("%.2f", comp.TotalPrice)
+				// b.FormatToEmpty(&compTotalPrice)
+				// b.Excel.SetCellValue(b.SheetName, startLCell, compTotalPrice)
+				// confirmTotalPlanPrice += totalConfirmRealPrice
 
 			}
 		}
 		// 生产汇总金额
 		startACell := fmt.Sprintf("%s%d", "A", row)
-		endMCell := fmt.Sprintf("%s%d", "M", row)
-		NCell := fmt.Sprintf("%s%d", "L", row)
-		OCell := fmt.Sprintf("%s%d", "O", row)
-		b.Excel.MergeCell(b.SheetName, startACell, endMCell)
-		b.Excel.SetCellStyle(b.SheetName, startACell, endMCell, b.AlignCenterStyle)
+		endKCell := fmt.Sprintf("%s%d", "K", row)
+		LCell := fmt.Sprintf("%s%d", "L", row)
+		MCell := fmt.Sprintf("%s%d", "M", row)
+		b.Excel.MergeCell(b.SheetName, startACell, endKCell)
+		b.Excel.SetCellStyle(b.SheetName, startACell, endKCell, b.AlignCenterStyle)
 		b.Excel.SetCellValue(b.SheetName, startACell, "生产计划汇总金额")
 
 		// 生产预算汇总
-		b.Excel.SetCellStyle(b.SheetName, NCell, NCell, b.AlignCenterStyle)
+		b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
 		planTotalPrice := fmt.Sprintf("%.2f", b.Content.TotalPrice)
 		b.FormatToEmpty(&planTotalPrice)
-		b.Excel.SetCellValue(b.SheetName, NCell, planTotalPrice)
+		b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
 
 		// 生产实际汇总
-		b.Excel.SetCellStyle(b.SheetName, OCell, OCell, b.AlignCenterStyle)
+		b.Excel.SetCellStyle(b.SheetName, MCell, MCell, b.AlignCenterStyle)
 		planConfirmTotalPrice := fmt.Sprintf("%.2f", confirmTotalPlanPrice)
 		b.FormatToEmpty(&planConfirmTotalPrice)
-		b.Excel.SetCellValue(b.SheetName, OCell, planConfirmTotalPrice)
+		b.Excel.SetCellValue(b.SheetName, MCell, planConfirmTotalPrice)
 	}
 
 	return nil
@@ -505,7 +503,7 @@ func NewPlanCostExcel(f *excelize.File) *PlanCostExcel {
 	}
 
 	f.SetColWidth(b.SheetName, "A", "D", 12)
-	f.SetColWidth(b.SheetName, "E", "O", 10)
+	f.SetColWidth(b.SheetName, "E", "M", 10)
 	f.SetPageMargins(b.SheetName, excelize.PageMarginTop(0), excelize.PageMarginLeft(0), excelize.PageMarginRight(0))
 	return b
 }

+ 696 - 7
boxcost/api/tmp.json

@@ -1,9 +1,698 @@
 {
-  "x_scale": 0.12,
-  "y_scale": 0.12,
-  "x_offset": 30,
-  "print_obj": true,
-  "lock_aspect_ratio": false,
-  "locked": false,
-  "positioning": "oncell"
+    "_id": "63c27fe7e3c018ab8c1c155e",
+    "name": "桃酥-复制",
+    "pack": {
+        "_id": "63c27389e3c018ab8c1c1559",
+        "name": "800g桃酥--复制",
+        "thumbnail": "",
+        "compCounts": 4,
+        "designer": "测试人",
+        "components": [
+            {
+                "id": "63c27389e3c018ab8c1c1538",
+                "name": "上盖",
+                "thumbnail": "",
+                "count": 1,
+                "uv": "",
+                "uvSize": "1000x2000",
+                "mats": [
+                    {
+                        "id": "63c27389e3c018ab8c1c1539",
+                        "crafts": [
+                            {
+                                "id": "63c27389e3c018ab8c1c153a",
+                                "size": "100x100",
+                                "count": 4,
+                                "craftInfo": {
+                                    "_id": "638ef06b0027470dd3a42f51",
+                                    "name": "单色印刷",
+                                    "unit": "张",
+                                    "price": 400,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-12-06T07:34:03.326Z",
+                                    "updateTime": "2022-12-06T08:02:30.869Z",
+                                    "category": "普通印刷",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": {
+                                        "_id": "000000000000000000000000",
+                                        "category": "普通印刷",
+                                        "name": "普通印刷计价方案1",
+                                        "remark": "版费(50)\n起价(普通550,普通+专色800)\n超过10000份减版费",
+                                        "param1": "50",
+                                        "param2": "550",
+                                        "param3": "800",
+                                        "param4": "10000",
+                                        "param5": "",
+                                        "createTime": "0001-01-01T00:00:00Z",
+                                        "updateTime": "0001-01-01T00:00:00Z",
+                                        "isDefault": null
+                                    },
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 1600,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 320200,
+                                    "supplierInfo": {
+                                        "_id": "63846b744d585ba68be6cba1",
+                                        "name": "宏川",
+                                        "address": "崇州泗潍路333号",
+                                        "phone": "13882239198",
+                                        "category": "普通印刷",
+                                        "createTime": "2022-11-28T08:04:04.791Z",
+                                        "updateTime": "2022-12-06T06:55:33.649Z"
+                                    }
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 100,
+                                "batchSizeHeight": 100,
+                                "billId": "63c5177858afc5b702afd31e",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c153b",
+                                "size": "10x10",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638eecaef9039e0980fe564f",
+                                    "name": "烫浅金",
+                                    "unit": "张",
+                                    "price": 0.15,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-12-06T07:18:06.188Z",
+                                    "updateTime": "2022-12-06T07:18:06.188Z",
+                                    "category": "烫金",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.15,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 30,
+                                    "supplierInfo": {
+                                        "_id": "638eecd4f9039e0980fe5650",
+                                        "name": "温学刚",
+                                        "address": "崇州金鸡路556",
+                                        "phone": "13028138020",
+                                        "category": "烫金",
+                                        "createTime": "2022-12-06T07:18:44.322Z",
+                                        "updateTime": "2022-12-06T07:18:44.322Z"
+                                    }
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 10,
+                                "batchSizeHeight": 10,
+                                "billId": "63c517a758afc5b702afd31f",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c153c",
+                                "size": "100x100",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "6388430851ba5b3307f8ab60",
+                                    "name": "光膜",
+                                    "unit": "平方米",
+                                    "price": 0.4,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-12-01T06:00:40.068Z",
+                                    "updateTime": "2022-12-01T06:00:40.068Z",
+                                    "category": "覆膜",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.004,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 0.8,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 100,
+                                "batchSizeHeight": 100,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c153d",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638471684d585ba68be6cbb0",
+                                    "name": "打包",
+                                    "unit": "张",
+                                    "price": 0.01,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:29:28.343Z",
+                                    "updateTime": "2022-11-28T08:29:28.343Z",
+                                    "category": "打包",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.01,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 2,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c153e",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638470d24d585ba68be6cbaf",
+                                    "name": "粘盒",
+                                    "unit": "张",
+                                    "price": 0.08,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:26:58.869Z",
+                                    "updateTime": "2022-11-28T08:27:24.914Z",
+                                    "category": "粘盒",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.08,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 16,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c153f",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638470a94d585ba68be6cbae",
+                                    "name": "模切",
+                                    "unit": "张",
+                                    "price": 0.04,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:26:17.151Z",
+                                    "updateTime": "2022-11-28T08:29:11.086Z",
+                                    "category": "模切",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.04,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 8,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1540",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "6384708e4d585ba68be6cbad",
+                                    "name": "对裱",
+                                    "unit": "平方米",
+                                    "price": 0.2,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:25:50.565Z",
+                                    "updateTime": "2022-11-28T08:27:45.765Z",
+                                    "category": "对裱",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 0,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            }
+                        ],
+                        "matInfo": {
+                            "_id": "638eedb2f9039e0980fe5653",
+                            "name": "太阳白卡",
+                            "category": "纸张类",
+                            "price": 4400,
+                            "unit": "吨",
+                            "norm": "250g",
+                            "height": 0,
+                            "width": 0,
+                            "remark": "",
+                            "createTime": "2022-12-06T07:22:26.375Z",
+                            "updateTime": "2022-12-06T07:24:48.591Z",
+                            "confirmCount": 0
+                        },
+                        "supplier": {
+                            "calc": null,
+                            "deliveryTime": "2023-01-14T10:11:31Z",
+                            "orderPrice": 2.2,
+                            "orderCount": 200,
+                            "orderRealPrice": 440,
+                            "supplierInfo": {
+                                "_id": "6384668e4d585ba68be6cb9f",
+                                "name": "正大文博",
+                                "address": "四川省成都市温江区分水村清波工业园A3号",
+                                "phone": "13853360367",
+                                "category": "纸张类",
+                                "createTime": "2022-11-28T07:43:10.638Z",
+                                "updateTime": "2022-12-06T07:19:45.089Z"
+                            }
+                        },
+                        "batchCount": 1,
+                        "batchSizeWidth": 1000,
+                        "batchSizeHeight": 2000,
+                        "billId": "63c518b5828aebf130c60b2c",
+                        "remark": ""
+                    }
+                ],
+                "remark": "",
+                "totalPrice": 320696.8
+            },
+            {
+                "id": "63c27389e3c018ab8c1c1541",
+                "name": "下盖",
+                "thumbnail": "",
+                "count": 1,
+                "uv": "",
+                "uvSize": "0",
+                "mats": [
+                    {
+                        "id": "63c27389e3c018ab8c1c1542",
+                        "crafts": [
+                            {
+                                "id": "63c27389e3c018ab8c1c1543",
+                                "size": "200x200",
+                                "count": 4,
+                                "craftInfo": {
+                                    "_id": "638455584d585ba68be6cb90",
+                                    "name": "4c印刷",
+                                    "unit": "版/色",
+                                    "price": 0.22,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T06:29:44.629Z",
+                                    "updateTime": "2022-11-28T06:29:44.629Z",
+                                    "category": "UV印刷",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": {
+                                        "_id": "638457b64d585ba68be6cb97",
+                                        "category": "UV印刷",
+                                        "name": "uv印刷计价方案1",
+                                        "remark": "版费(60)\n起价(普通1200,逆向油1600)\n超过10000份减版费",
+                                        "param1": "60",
+                                        "param2": "1200",
+                                        "param3": "1600",
+                                        "param4": "10000",
+                                        "param5": "",
+                                        "createTime": "0001-01-01T00:00:00Z",
+                                        "updateTime": "2022-12-01T05:52:58.196Z",
+                                        "isDefault": true
+                                    },
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.88,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 1600,
+                                    "supplierInfo": {
+                                        "_id": "6375e17b3913c1b5774bad73",
+                                        "name": "泓瑞包装",
+                                        "address": "崇州金鸡路556",
+                                        "phone": "15212341234",
+                                        "category": "UV印刷",
+                                        "createTime": "2022-11-17T07:23:39.49Z",
+                                        "updateTime": "2023-01-03T09:55:46.168Z"
+                                    }
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 200,
+                                "batchSizeHeight": 200,
+                                "billId": "63c500b93e778319cbfa0b59",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1544",
+                                "size": "200x200",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "6384558b4d585ba68be6cb91",
+                                    "name": "专色",
+                                    "unit": "版/色",
+                                    "price": 0.12,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T06:30:35.62Z",
+                                    "updateTime": "2022-11-28T06:30:51.226Z",
+                                    "category": "UV印刷",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": {
+                                        "_id": "638457b64d585ba68be6cb97",
+                                        "category": "UV印刷",
+                                        "name": "uv印刷计价方案1",
+                                        "remark": "版费(60)\n起价(普通1200,逆向油1600)\n超过10000份减版费",
+                                        "param1": "60",
+                                        "param2": "1200",
+                                        "param3": "1600",
+                                        "param4": "10000",
+                                        "param5": "",
+                                        "createTime": "0001-01-01T00:00:00Z",
+                                        "updateTime": "2022-12-01T05:52:58.196Z",
+                                        "isDefault": true
+                                    },
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.12,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 1600,
+                                    "supplierInfo": {
+                                        "_id": "6375e17b3913c1b5774bad73",
+                                        "name": "泓瑞包装",
+                                        "address": "崇州金鸡路556",
+                                        "phone": "15212341234",
+                                        "category": "UV印刷",
+                                        "createTime": "2022-11-17T07:23:39.49Z",
+                                        "updateTime": "2023-01-03T09:55:46.168Z"
+                                    }
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 200,
+                                "batchSizeHeight": 200,
+                                "billId": "63c500b93e778319cbfa0b59",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1545",
+                                "size": "200x200",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638455274d585ba68be6cb8f",
+                                    "name": "逆向油",
+                                    "unit": "平方米",
+                                    "price": 0.65,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T06:28:55.891Z",
+                                    "updateTime": "2022-11-28T06:30:08.619Z",
+                                    "category": "UV印刷",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": {
+                                        "_id": "638457b64d585ba68be6cb97",
+                                        "category": "UV印刷",
+                                        "name": "uv印刷计价方案1",
+                                        "remark": "版费(60)\n起价(普通1200,逆向油1600)\n超过10000份减版费",
+                                        "param1": "60",
+                                        "param2": "1200",
+                                        "param3": "1600",
+                                        "param4": "10000",
+                                        "param5": "",
+                                        "createTime": "0001-01-01T00:00:00Z",
+                                        "updateTime": "2022-12-01T05:52:58.196Z",
+                                        "isDefault": true
+                                    },
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.026,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 1600,
+                                    "supplierInfo": {
+                                        "_id": "6375e17b3913c1b5774bad73",
+                                        "name": "泓瑞包装",
+                                        "address": "崇州金鸡路556",
+                                        "phone": "15212341234",
+                                        "category": "UV印刷",
+                                        "createTime": "2022-11-17T07:23:39.49Z",
+                                        "updateTime": "2023-01-03T09:55:46.168Z"
+                                    }
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 200,
+                                "batchSizeHeight": 200,
+                                "billId": "63c500b93e778319cbfa0b59",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1546",
+                                "size": "100x100",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638eecaef9039e0980fe564f",
+                                    "name": "烫浅金",
+                                    "unit": "张",
+                                    "price": 0.15,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-12-06T07:18:06.188Z",
+                                    "updateTime": "2022-12-06T07:18:06.188Z",
+                                    "category": "烫金",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.15,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 30,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 100,
+                                "batchSizeHeight": 100,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1547",
+                                "size": "200x200",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "6388430851ba5b3307f8ab60",
+                                    "name": "光膜",
+                                    "unit": "平方米",
+                                    "price": 0.4,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-12-01T06:00:40.068Z",
+                                    "updateTime": "2022-12-01T06:00:40.068Z",
+                                    "category": "覆膜",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.016,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 3.2,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 200,
+                                "batchSizeHeight": 200,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1548",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638471684d585ba68be6cbb0",
+                                    "name": "打包",
+                                    "unit": "张",
+                                    "price": 0.01,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:29:28.343Z",
+                                    "updateTime": "2022-11-28T08:29:28.343Z",
+                                    "category": "打包",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.01,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 2,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c1549",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638470d24d585ba68be6cbaf",
+                                    "name": "粘盒",
+                                    "unit": "张",
+                                    "price": 0.08,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:26:58.869Z",
+                                    "updateTime": "2022-11-28T08:27:24.914Z",
+                                    "category": "粘盒",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.08,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 16,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c154a",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "638470a94d585ba68be6cbae",
+                                    "name": "模切",
+                                    "unit": "张",
+                                    "price": 0.04,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:26:17.151Z",
+                                    "updateTime": "2022-11-28T08:29:11.086Z",
+                                    "category": "模切",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 0.04,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 8,
+                                    "supplierInfo": null
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 0,
+                                "batchSizeHeight": 0,
+                                "billId": "",
+                                "remark": ""
+                            },
+                            {
+                                "id": "63c27389e3c018ab8c1c154b",
+                                "size": "0",
+                                "count": 1,
+                                "craftInfo": {
+                                    "_id": "6384708e4d585ba68be6cbad",
+                                    "name": "对裱",
+                                    "unit": "平方米",
+                                    "price": 0.2,
+                                    "norm": "按文件要求",
+                                    "remark": "",
+                                    "createTime": "2022-11-28T08:25:50.565Z",
+                                    "updateTime": "2022-11-28T08:27:45.765Z",
+                                    "category": "对裱",
+                                    "confirmCount": 0
+                                },
+                                "supplier": {
+                                    "calc": null,
+                                    "deliveryTime": "2023-01-14T10:11:31Z",
+                                    "orderPrice": 6,
+                                    "orderCount": 200,
+                                    "orderRealPrice": 1200,
+                                    "supplierInfo": {
+                                        "_id": "638844d151ba5b3307f8ab68",
+                                        "name": "中印正隆",
+                                        "address": "崇州2",
+                                        "phone": "13699069388",
+                                        "category": "打包",
+                                        "createTime": "2022-12-01T06:08:17.095Z",
+                                        "updateTime": "2022-12-01T06:08:17.095Z"
+                                    }
+                                },
+                                "batchCount": 1,
+                                "batchSizeWidth": 6000,
+                                "batchSizeHeight": 5000,
+                                "billId": "63c51010b07fb70dd5f3fe6f",
+                                "remark": ""
+                            }
+                        ],
+                        "matInfo": {
+                            "_id": "638eee5bf9039e0980fe5654",
+                            "name": "太阳白卡",
+                            "category": "纸张类",
+                            "price": 5400,
+                            "unit": "吨",
+                            "norm": "350g",
+                            "height": 0,
+                            "width": 0,
+                            "remark": "",
+                            "createTime": "2022-12-06T07:25:15.32Z",
+                            "updateTime": "2022-12-06T07:25:15.32Z",
+                            "confirmCount": 0
+                        },
+                        "supplier": {
+                            "calc": null,
+                            "deliveryTime": "2023-01-14T10:11:31Z",
+                            "orderPrice": 47.25,
+                            "orderCount": 200,
+                            "orderRealPrice": 9450,
+                            "supplierInfo": null
+                        },
+                        "batchCount": 1,
+                        "batchSizeWidth": 5000,
+                        "batchSizeHeight": 5000,
+                        "billId": "",
+                        "remark": ""
+                    }
+                ],
+                "remark": "",
+                "totalPrice": 12309.2
+            }
+        ],
+        "createTime": "2023-01-14T09:19:05.775Z",
+        "updateTime": "2023-01-14T09:19:17.299Z"
+    },
+    "thumbnail": "",
+    "createUser": "123",
+    "total": 200,
+    "status": "process",
+    "totalPrice": 333006,
+    "updateTime": "2023-01-16T09:28:28.667Z",
+    "createTime": "2023-01-14T10:11:51.525Z"
 }

+ 2 - 2
boxcost/app.yaml

@@ -29,7 +29,7 @@ debug:
   UserRole: string
 
 nats:
-  # url: nats://124.71.139.24:14300
-  url: nats://127.0.0.1:14300
+  url: nats://124.71.139.24:14300
+  # url: nats://127.0.0.1:14300
   maxReconnect: 1000
   reconnDelaySecond: 5

+ 4 - 1
boxcost/conf/app.go

@@ -1,6 +1,7 @@
 package conf
 
 import (
+	"fmt"
 	"os"
 
 	"box-cost/log"
@@ -93,10 +94,12 @@ func NewAppConf(filePath string) (*AppConf, error) {
 	if len(natsHost) > 0 {
 		c.Nats.Url = natsHost
 	}
-	pdfApiAddr := os.Getenv("PDF_API_ADDR")
+	pdfApiAddr := os.Getenv("TOPDF_ADDR")
 	if len(pdfApiAddr) > 0 {
 		c.PdfApiAddr = pdfApiAddr
 	}
+	fmt.Println("pdf_config=>", c.PdfApiAddr)
+	fmt.Println("pdf_env=>", pdfApiAddr)
 	AppConfig = c
 	return c, nil
 }

+ 0 - 0
boxcost/signature1.png → boxcost/signature/zhang.png


+ 0 - 0
boxcost/signature2.png → boxcost/signature/zhu.png