animeic 2 years ago
parent
commit
c68220545b

+ 6 - 0
boxcost/api/bill-process-excel.go

@@ -259,6 +259,12 @@ func (b *ProcessBillExcel) drawTableSignature() error {
 		// Border:    border,
 	})
 
+	// 制单人
+	billUserCell := fmt.Sprintf("A%d", b.Row+3)
+	b.Excel.SetCellValue(b.SheetName, billUserCell, "制单人:")
+	billUservCell := fmt.Sprintf("B%d", b.Row+3)
+	b.Excel.SetCellValue(b.SheetName, billUservCell, b.Content.UserName)
+
 	fontCell := fmt.Sprintf("E%d", b.Row)
 	imageCell1 := fmt.Sprintf("F%d", b.Row)
 	imageCell2 := fmt.Sprintf("H%d", b.Row)

+ 7 - 1
boxcost/api/bill-produce-excel.go

@@ -271,12 +271,18 @@ func (b *ProduceBillExcel) drawTableSignature() error {
 		// Border:    border,
 	})
 
+	// 制单人
+	billUserCell := fmt.Sprintf("A%d", row+3)
+	b.Excel.SetCellValue(b.SheetName, billUserCell, "制单人:")
+	billUservCell := fmt.Sprintf("B%d", row+3)
+	b.Excel.SetCellValue(b.SheetName, billUservCell, b.Content.UserName)
+
 	fontCell := fmt.Sprintf("H%d", row)
 	imageCell1 := fmt.Sprintf("I%d", row)
 	imageCell2 := fmt.Sprintf("K%d", row)
 	b.Excel.MergeCell(b.SheetName, fontCell, fmt.Sprintf("H%d", row+2))
 	b.Excel.SetCellStyle(b.SheetName, fontCell, fontCell, style1)
-	b.Excel.SetCellValue(b.SheetName, fontCell, "领导签字:")
+	b.Excel.SetCellValue(b.SheetName, fontCell, "审核签字:")
 
 	// 签字图片1 I10-J12
 	b.Excel.MergeCell(b.SheetName, imageCell1, fmt.Sprintf("J%d", row+2))

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

@@ -117,6 +117,15 @@ func CreateProduceBill(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	}
 	bill.CreateTime = time.Now()
 	bill.UpdateTime = time.Now()
+	// 制单人数据
+	userId, _ := primitive.ObjectIDFromHex(apictx.User.Parent)
+	if !userId.IsZero() {
+		user, err := getUserById(apictx, userId)
+		if err != nil {
+			bill.UserName = user.Name
+			bill.UserId = userId
+		}
+	}
 
 	result, err := repo.RepoAddDoc(ctx, repo.CollectionBillProduce, &bill)
 	return result, err

+ 6 - 8
boxcost/api/bill-purchase-excel.go

@@ -297,21 +297,19 @@ func (b *PurchaseBillExcel) drawTableFooter() error {
 }
 
 func (b *PurchaseBillExcel) drawTableSignature() error {
-	// 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"},
-	// 	{Type: "right", Style: 1, Color: "000000"},
-	// 	{Type: "bottom", Style: 1, Color: "000000"},
-	// }
 
 	style1, _ := b.Excel.NewStyle(&excelize.Style{
 		Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
-		// Border:    border,
 	})
 
+	// 制单人
+	billUserCell := fmt.Sprintf("A%d", row+3)
+	b.Excel.SetCellValue(b.SheetName, billUserCell, "制单人:")
+	billUservCell := fmt.Sprintf("B%d", row+3)
+	b.Excel.SetCellValue(b.SheetName, billUservCell, b.Content.UserName)
+
 	fontCell := fmt.Sprintf("H%d", row)
 	imageCell1 := fmt.Sprintf("I%d", row)
 	imageCell2 := fmt.Sprintf("K%d", row)

+ 10 - 0
boxcost/api/bill.go

@@ -127,6 +127,16 @@ func CreateBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	bill.CreateTime = time.Now()
 	bill.UpdateTime = time.Now()
 
+	// 制单人数据
+	userId, _ := primitive.ObjectIDFromHex(apictx.User.Parent)
+	if !userId.IsZero() {
+		user, err := getUserById(apictx, userId)
+		if err != nil {
+			bill.UserName = user.Name
+			bill.UserId = userId
+		}
+	}
+
 	return repo.RepoAddDoc(ctx, repo.CollectionBillPurchase, &bill)
 }
 

+ 3 - 1
boxcost/api/plan-cost-excel.go

@@ -405,6 +405,8 @@ func (b *PlanCostExcel) drawAllContent() error {
 			totalPlanPrice += totalOrderRealPrice
 		}
 	}
+
+	// 工序数据
 	if len(b.Content.Process) > 0 {
 		// 生产汇总金额
 		startACell := fmt.Sprintf("%s%d", "A", row)
@@ -486,7 +488,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 	// 生产预算汇总
 	b.Excel.SetCellStyle(b.SheetName, LCell, LCell, b.AlignCenterStyle)
 	// planTotalPrice := fmt.Sprintf("%.2f", b.Content.TotalPrice) //
-	planTotalPrice := fmt.Sprintf("%.2f", totalPlanPrice) //
+	planTotalPrice := fmt.Sprintf("%.2f", totalPlanPrice)
 	b.FormatToEmpty(&planTotalPrice)
 	b.Excel.SetCellValue(b.SheetName, LCell, planTotalPrice)
 

+ 0 - 75
boxcost/api/tmp.json

@@ -1,75 +0,0 @@
-{
-    "id": "1675839406146",
-    "name": "外箱",
-    "thumbnail": "",
-    "count": 1,
-    "uv": "",
-    "uvSize": "0",
-    "mats": [
-        {
-            "id": "167583941129963e34765201413726b012274",
-            "crafts": [
-                {
-                    "id": "",
-                    "size": "0",
-                    "count": 1,
-                    "craftInfo": {
-                        "_id": "000000000000000000000000",
-                        "name": "",
-                        "unit": "",
-                        "price": 0,
-                        "norm": "",
-                        "remark": "",
-                        "createTime": "0001-01-01T00:00:00Z",
-                        "updateTime": "0001-01-01T00:00:00Z",
-                        "category": ""
-                    },
-                    "supplier": null,
-                    "batchCount": 0,
-                    "batchSizeWidth": 0,
-                    "batchSizeHeight": 0,
-                    "billId": "",
-                    "remark": "",
-                    "confirmCount": 0
-                }
-            ],
-            "matInfo": {
-                "_id": "63e34765201413726b012274",
-                "name": "玖龙A级外箱",
-                "category": "纸张类",
-                "price": 20,
-                "unit": "个",
-                "norm": "160克",
-                "height": 0,
-                "width": 0,
-                "remark": "",
-                "createTime": "2023-02-08T06:55:33.691Z",
-                "updateTime": "2023-02-08T06:56:22.799Z"
-            },
-            "supplier": {
-                "calc": null,
-                "deliveryTime": "2023-02-08T06:58:30Z",
-                "orderPrice": 20,
-                "orderCount": 10000,
-                "orderRealPrice": 200000,
-                "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": 0,
-            "batchSizeHeight": 0,
-            "billId": "63e348d3201413726b012277",
-            "remark": "",
-            "confirmCount": 0
-        }
-    ],
-    "remark": "",
-    "totalPrice": 200000
-}

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

@@ -39,7 +39,8 @@ type PurchaseBill struct {
 	PackId     primitive.ObjectID `bson:"packId,omitempty" json:"packId"`
 	PlanId     primitive.ObjectID `bson:"planId,omitempty" json:"planId"`
 	SupplierId primitive.ObjectID `bson:"supplierId,omitempty" json:"supplierId"`
-
+	UserId     primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
+	UserName   string             `bson:"userName,omitempty" json:"userName"`
 	//类别
 	Type string `bson:"type,omitempty" json:"type"`
 
@@ -112,8 +113,10 @@ type ProduceBill struct {
 	PackId     primitive.ObjectID `bson:"packId,omitempty" json:"packId"`
 	PlanId     primitive.ObjectID `bson:"planId,omitempty" json:"planId"`
 	SupplierId primitive.ObjectID `bson:"supplierId,omitempty" json:"supplierId"`
+	UserId     primitive.ObjectID `bson:"userId,omitempty" json:"userId"`
+	UserName   string             `bson:"userName,omitempty" json:"userName"`
 
-	//类别
+	// 类别
 	Type string `bson:"type,omitempty" json:"type"`
 
 	// 进行中 created  已完成 complete 已弃用 deprecated