animeic 2 жил өмнө
parent
commit
318b9b81d3

BIN
boxcost/.~生产成本表.xlsx


+ 12 - 2
boxcost/api/plan-cost-excel.go

@@ -164,7 +164,11 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 					if mat.Supplier.SupplierInfo != nil {
 						if supplierId == mat.Supplier.SupplierInfo.Id {
 							// 材料
-							startRow = row
+							if startRow == 0 {
+								startRow = row
+
+							}
+
 							supplierName := mat.Supplier.SupplierInfo.Name
 							matHeigth := fmt.Sprintf("%d", mat.BatchSizeHeight)
 							b.FormatToEmpty(&matHeigth)
@@ -189,7 +193,10 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 							if craft.Supplier.SupplierInfo != nil {
 								// 工序
 								if supplierId == craft.Supplier.SupplierInfo.Id {
-									startRow = row
+									if startRow == 0 {
+										startRow = row
+
+									}
 									craftSupplierName := craft.Supplier.SupplierInfo.Name
 									carftOrderCount := fmt.Sprintf("%d", int(craft.Supplier.OrderCount))
 									b.FormatToEmpty(&carftOrderCount)
@@ -224,6 +231,9 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 						return err
 					}
 					b.Excel.SetCellValue(b.SheetName, startACell, comp.Name)
+					fmt.Println("startACell:", startACell)
+					fmt.Println("endACell:", endACell)
+					fmt.Println("compName:", comp.Name)
 					// 供应商组件汇总金额
 					startLCell := fmt.Sprintf("%s%d", "L", startRow)
 					endLCell := fmt.Sprintf("%s%d", "L", endRow)

+ 8 - 8
boxcost/api/plan.go

@@ -74,14 +74,14 @@ func DownLoadPlanCost(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	planCostExcel.Content = supplierPlanCost
 	planCostExcel.Draws()
 
-	// // 另存为
-	// // _ = os.MkdirAll("excel", os.ModePerm)
-	// // filename1 := time.Now().Format("20060102150405") + ".xlsx"
-	// filename1 := "生产成本表.xlsx"
-	// err = f.SaveAs(filename1)
-	// if err != nil {
-	// 	return nil, err
-	// }
+	// 另存为
+	// _ = os.MkdirAll("excel", os.ModePerm)
+	// filename1 := time.Now().Format("20060102150405") + ".xlsx"
+	filename1 := "生产成本表.xlsx"
+	err = f.SaveAs(filename1)
+	if err != nil {
+		return nil, err
+	}
 
 	c.Header("Content-Type", "application/octet-stream")
 	c.Header("Content-Disposition", "attachment; filename="+"planCost.xlsx")

+ 121 - 13
boxcost/api/tmp.json

@@ -55,6 +55,106 @@
                 "batchSizeHeight": 0,
                 "billId": "63b3961900be5a99e8f7531b",
                 "remark": ""
+              },
+              {
+                "id": "1672729425983",
+                "size": "0",
+                "count": 1,
+                "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印刷"
+                },
+                "supplier": {
+                  "calc": {
+                    "_id": "000000000000000000000000",
+                    "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": "0001-01-01T00:00:00Z",
+                    "isDefault": null
+                  },
+                  "deliveryTime": "2023-01-03T07:03:57Z",
+                  "orderPrice": 0.22,
+                  "orderCount": 3000,
+                  "orderRealPrice": 1440,
+                  "supplierInfo": {
+                    "_id": "6375e17b3913c1b5774bad73",
+                    "name": "泓瑞包装",
+                    "address": "金鸡路556",
+                    "phone": "15212341234",
+                    "category": "UV印刷",
+                    "createTime": "2022-11-17T07:23:39.49Z",
+                    "updateTime": "2022-12-01T05:55:07.972Z"
+                  }
+                },
+                "batchCount": 1,
+                "batchSizeWidth": 0,
+                "batchSizeHeight": 0,
+                "billId": "63b3d37e00be5a99e8f7531d",
+                "remark": "3123"
+              },
+              {
+                "id": "1672729425983",
+                "size": "0",
+                "count": 1,
+                "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印刷"
+                },
+                "supplier": {
+                  "calc": {
+                    "_id": "000000000000000000000000",
+                    "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": "0001-01-01T00:00:00Z",
+                    "isDefault": null
+                  },
+                  "deliveryTime": "2023-01-03T07:03:57Z",
+                  "orderPrice": 0.22,
+                  "orderCount": 3000,
+                  "orderRealPrice": 1440,
+                  "supplierInfo": {
+                    "_id": "6375e17b3913c1b5774bad73",
+                    "name": "泓瑞包装",
+                    "address": "金鸡路556",
+                    "phone": "15212341234",
+                    "category": "UV印刷",
+                    "createTime": "2022-11-17T07:23:39.49Z",
+                    "updateTime": "2022-12-01T05:55:07.972Z"
+                  }
+                },
+                "batchCount": 1,
+                "batchSizeWidth": 0,
+                "batchSizeHeight": 0,
+                "billId": "63b3d37e00be5a99e8f7531d",
+                "remark": "3123"
               }
             ],
             "matInfo": {
@@ -93,7 +193,7 @@
             "remark": "3123144"
           },
           {
-            "id": "1672128855538638eedb2f9039e0980fe5653",
+            "id": "1672210568313638465894d585ba68be6cb9e",
             "crafts": [
               {
                 "id": "167212855882663846db34d585ba68be6cba30",
@@ -112,7 +212,7 @@
                 },
                 "supplier": {
                   "calc": null,
-                  "deliveryTime": "2022-12-27T08:14:23Z",
+                  "deliveryTime": "2023-01-03T07:03:57Z",
                   "orderPrice": 0,
                   "orderCount": 3000,
                   "orderRealPrice": 0,
@@ -126,25 +226,33 @@
               }
             ],
             "matInfo": {
-              "_id": "638eedb2f9039e0980fe5653",
-              "name": "太阳白卡",
+              "_id": "638465894d585ba68be6cb9e",
+              "name": "地龙灰底白",
               "category": "纸张类",
-              "price": 5400,
+              "price": 4450,
               "unit": "吨",
               "norm": "250g",
               "height": 0,
               "width": 0,
               "remark": "",
-              "createTime": "2022-12-06T07:22:26.375Z",
-              "updateTime": "2022-12-06T07:24:48.591Z"
+              "createTime": "2022-11-28T07:38:49.329Z",
+              "updateTime": "2022-11-28T07:38:49.329Z"
             },
             "supplier": {
               "calc": null,
-              "deliveryTime": "2022-12-27T08:14:23Z",
+              "deliveryTime": "2023-01-03T07:03:57Z",
               "orderPrice": 0,
               "orderCount": 3000,
               "orderRealPrice": 0,
-              "supplierInfo": null
+              "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": 0,
@@ -222,7 +330,7 @@
           }
         ],
         "remark": "",
-        "totalPrice": 3870
+        "totalPrice": 5310
       },
       {
         "id": "1670397519144",
@@ -335,13 +443,13 @@
       }
     ],
     "createTime": "2022-12-06T09:51:10.885Z",
-    "updateTime": "2022-12-27T08:14:19.213Z"
+    "updateTime": "2023-01-03T07:03:50.03Z"
   },
   "thumbnail": "",
   "createUser": "31231",
   "total": 3000,
   "status": "process",
-  "totalPrice": 4383,
-  "updateTime": "2023-01-03T04:08:40.653Z",
+  "totalPrice": 5823,
+  "updateTime": "2023-01-03T10:02:39.441Z",
   "createTime": "2022-12-07T08:32:55.92Z"
 }

BIN
boxcost/生产成本表.xlsx