animeic 1 year ago
parent
commit
01fb6809f1

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

@@ -453,7 +453,7 @@ func (b *ProduceBillExcel) drawTableFooter() error {
 	}
 
 	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
-		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center", WrapText: true},
 		Border:    border,
 	})
 
@@ -481,7 +481,7 @@ func (b *ProduceBillExcel) drawTableFooter() error {
 	b.Excel.MergeCell(b.SheetName, supplierStartCell, supplierEndCell)
 	b.Excel.SetCellStyle(b.SheetName, supplierStartCell, supplierEndCell, styleLeft)
 	b.Excel.SetCellValue(b.SheetName, supplierStartCell, "供应商签字:")
-	b.Excel.SetRowHeight(b.SheetName, b.Row, 21)
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 32)
 
 	return nil
 }

+ 2 - 2
boxcost/api/bill-product-excel.go

@@ -247,7 +247,7 @@ func (b *ProductBillExcel) drawTableFooter() error {
 		{Type: "bottom", Style: 1, Color: "000000"},
 	}
 	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
-		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center", WrapText: true},
 		Border:    border,
 	})
 
@@ -262,7 +262,7 @@ func (b *ProductBillExcel) drawTableFooter() error {
 	b.Excel.MergeCell(b.SheetName, supplierStartCell, supplierEndCell)
 	b.Excel.SetCellStyle(b.SheetName, supplierStartCell, supplierEndCell, styleLeft)
 	b.Excel.SetCellValue(b.SheetName, supplierStartCell, " 供应商签字:")
-	b.Excel.SetRowHeight(b.SheetName, b.Row, 21)
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 32)
 
 	return nil
 }

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

@@ -288,7 +288,7 @@ func (b *PurchaseBillExcel) drawTableFooter() error {
 	}
 
 	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
-		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center", WrapText: true},
 		Border:    border,
 	})
 
@@ -303,7 +303,7 @@ func (b *PurchaseBillExcel) drawTableFooter() error {
 	b.Excel.MergeCell(b.SheetName, supplierStartCell, supplierEndCell)
 	b.Excel.SetCellStyle(b.SheetName, supplierStartCell, supplierEndCell, styleLeft)
 	b.Excel.SetCellValue(b.SheetName, supplierStartCell, "供应商签字:")
-	b.Excel.SetRowHeight(b.SheetName, b.Row, 21)
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 32)
 
 	return nil
 }

+ 21 - 52
boxcost/api/print.go

@@ -4,7 +4,7 @@ import (
 	"box-cost/db/repo"
 
 	"github.com/gin-gonic/gin"
-	"go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 
 // func UpdateIsAckStatus(c *gin.Context, apictx *ApiSession) (interface{}, error) {
@@ -68,57 +68,26 @@ import (
 // }
 
 func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	// 2023粽子礼盒稻香拾味定制款彩盒手提绳
-	// bill := model.ProductBill{}
-	// bill.Remark = ""
-	// fmt.Println(bill)
-	// !数据库报错,不能识别remark == ""
-	// !无效
-	// return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, "6440dc82afe88127dda4a5ef", &model.ProductBill{Remark: ""})
-	// !有效
-	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, "6440dc82afe88127dda4a5ef", bson.M{"remark": ""})
+	// !如果数据模型tag omitempty存在 对某个字段设置零值的方法
+	// !如果有omitempty存在,对应字段零值将被忽略
+	// !该字段设置为引用类型
+	// !创建该字段时设置默认值
+	type RegCode struct {
+		Id    primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
+		Roles *[]string          `bson:"roles,omitempty" json:"roles"`
+		Key   string             `bson:"key,omitempty" json:"key"`
+	}
+	roles := []string{}
 
-}
+	// ?接收客户端传参数,更新
+	// {"_id":"642e2e97243b5c5107d70204","roles":false}
+	// form := RegCode{}
+	// err := c.ShouldBindJSON(&form)
+	// if err != nil {
+	// 	return nil, err
+	// }
 
-// ? 测试供应商备注
-// {{boxcost}}/bill/produce/download?id=6444d14db2a7c8eae4240579
+	// return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), "reg-code", form.Id.Hex(), &RegCode{Roles: form.Roles})
+	return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), "reg-code", "642e2e97243b5c5107d70204", &RegCode{Roles: &roles})
 
-// {
-//     "_id": ObjectId("6440dc82afe88127dda4a5ef"),
-//     "packId": ObjectId("643f9bdd75db8728bf88c0da"),
-//     "planId": ObjectId("643fae2175db8728bf88c0e7"),
-//     "supplierId": ObjectId("63f3167b1031634bc6eeb8be"),
-//     "userId": ObjectId("63e208dc7452ab74932b9e37"),
-//     "userName": "郑茜",
-//     "type": "成品采购",
-//     "status": "complete",
-//     "reviewed": NumberInt("1"),
-//     "createTime": ISODate("2023-04-20T06:32:34.18Z"),
-//     "updateTime": ISODate("2023-04-24T06:05:42.177Z"),
-//     "supplier": "029-温州意彩织带有限公司",
-//     "sendTo": "新都军屯镇食品大道158号稻香村--联系电话巫元萍13808077671",
-//     "productName": "稻香拾味定制款手提盒(5000套)--墨绿色罗纹丝带",
-//     "products": [
-//         {
-//             "id": "16819724424006440d278afe88127dda4a5e6",
-//             "name": "墨绿色罗纹丝带",
-//             "norm": "2cm*45cm",
-//             "orderCount": NumberInt("5100"),
-//             "orderPrice": 0.09,
-//             "remark": "2023粽子礼盒稻香拾味定制款彩盒手提绳",
-//             "deliveryTime": ISODate("2023-04-24T06:35:08.000Z"),
-//             "confirmCount": NumberInt("5100"),
-//             "unit": "元/对"
-//         }
-//     ],
-//     "serialNumber": "CPCG-000022",
-//     "remark": "2023粽子礼盒稻香拾味定制款彩盒手提绳",
-//     "isAck": false,
-//     "signUsers": [
-//         ObjectId("63e209a87452ab74932b9e38")
-//     ],
-//     "isSend": true,
-//     "sendTime": ISODate("2023-04-20T06:47:00.685Z"),
-//     "supplierRemark": " ",
-//     "completeTime": ISODate("2023-04-24T06:05:42.176Z")
-// }
+}

+ 0 - 1
boxcost/db/repo/repo.go

@@ -121,7 +121,6 @@ func RepoDeleteDocs(ctx *RepoSession, collectName string, query interface{}) (in
 func RepoUpdateSetDoc(ctx *RepoSession, collectName string, idstr string, model interface{}) (*mongo.UpdateResult, error) {
 
 	colls := ctx.Client.GetCollection(collectName)
-	// !如果将某个字符串置为空字符串,不会生效。比如删除remark中的内容。
 	update := bson.M{"$set": model}
 
 	uid, _ := primitive.ObjectIDFromHex(idstr)