animeic 1 år sedan
förälder
incheckning
130f2fcdb6

+ 37 - 0
boxcost/api/bill-produce-excel.go

@@ -440,6 +440,39 @@ func (b *ProduceBillExcel) drawTableFooter() error {
 
 
 	return nil
 	return nil
 }
 }
+func (b *ProduceBillExcel) drawSupplierRemark() error {
+	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"},
+	}
+
+	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Border:    border,
+	})
+
+	sendToStartCell := fmt.Sprintf("A%d", b.Row)
+
+	sendToEndCell := fmt.Sprintf("K%d", b.Row)
+	if !b.Content.IsPrint {
+		sendToEndCell = fmt.Sprintf("H%d", b.Row)
+
+		if b.Content.IsLam {
+			sendToEndCell = fmt.Sprintf("I%d", b.Row)
+
+		}
+	}
+
+	b.Excel.MergeCell(b.SheetName, sendToStartCell, sendToEndCell)
+	b.Excel.SetCellStyle(b.SheetName, sendToStartCell, sendToEndCell, styleLeft)
+	b.Excel.SetCellValue(b.SheetName, sendToStartCell, "供应商备注:"+b.Content.SupplierRemark)
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 32)
+	return nil
+
+}
 
 
 func (b *ProduceBillExcel) drawTableSignature() error {
 func (b *ProduceBillExcel) drawTableSignature() error {
 	b.Row += 2
 	b.Row += 2
@@ -524,6 +557,10 @@ func (b *ProduceBillExcel) Draws() {
 	b.drawTableTitle()
 	b.drawTableTitle()
 	b.drawTableContent()
 	b.drawTableContent()
 	b.drawTableFooter()
 	b.drawTableFooter()
+	if len(b.Content.SupplierRemark) > 1 {
+		b.drawSupplierRemark()
+
+	}
 	b.drawTableSignature()
 	b.drawTableSignature()
 }
 }
 
 

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

@@ -220,6 +220,12 @@ func UpdateProduceBill(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	if bill.Status == "complete" {
 	if bill.Status == "complete" {
 		bill.CompleteTime = time.Now()
 		bill.CompleteTime = time.Now()
 	}
 	}
+	if bill.Remark == "" {
+		bill.Remark = " "
+	}
+	if bill.SupplierRemark == "" {
+		bill.SupplierRemark = " "
+	}
 
 
 	// 更新供应商确定数量与plan中stage项的同步
 	// 更新供应商确定数量与plan中stage项的同步
 	if len(bill.Produces) > 0 {
 	if len(bill.Produces) > 0 {

+ 30 - 0
boxcost/api/bill-product-excel.go

@@ -260,6 +260,32 @@ func (b *ProductBillExcel) drawTableFooter() error {
 	return nil
 	return nil
 }
 }
 
 
+func (b *ProductBillExcel) drawSupplierRemark() error {
+	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"},
+	}
+
+	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Border:    border,
+	})
+
+	sendToStartCell := fmt.Sprintf("A%d", b.Row)
+
+	sendToEndCell := fmt.Sprintf("H%d", b.Row)
+
+	b.Excel.MergeCell(b.SheetName, sendToStartCell, sendToEndCell)
+	b.Excel.SetCellStyle(b.SheetName, sendToStartCell, sendToEndCell, styleLeft)
+	b.Excel.SetCellValue(b.SheetName, sendToStartCell, "供应商备注:"+b.Content.SupplierRemark)
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 32)
+	return nil
+
+}
+
 func (b *ProductBillExcel) drawTableSignature() error {
 func (b *ProductBillExcel) drawTableSignature() error {
 	b.Row += 2
 	b.Row += 2
 	// row := b.Row
 	// row := b.Row
@@ -324,6 +350,10 @@ func (b *ProductBillExcel) Draws() {
 	b.drawTableTitle()
 	b.drawTableTitle()
 	b.drawTableContent()
 	b.drawTableContent()
 	b.drawTableFooter()
 	b.drawTableFooter()
+	if len(b.Content.SupplierRemark) > 1 {
+		b.drawSupplierRemark()
+
+	}
 	b.drawTableSignature()
 	b.drawTableSignature()
 }
 }
 
 

+ 3 - 0
boxcost/api/bill-product.go

@@ -224,6 +224,9 @@ func UpdateProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	if bill.Remark == "" {
 	if bill.Remark == "" {
 		bill.Remark = " "
 		bill.Remark = " "
 	}
 	}
+	if bill.SupplierRemark == "" {
+		bill.SupplierRemark = " "
+	}
 
 
 	// 更新供应商确定数量与plan中stage项的同步
 	// 更新供应商确定数量与plan中stage项的同步
 	if len(bill.Products) > 0 {
 	if len(bill.Products) > 0 {

+ 30 - 0
boxcost/api/bill-purchase-excel.go

@@ -297,6 +297,32 @@ func (b *PurchaseBillExcel) drawTableFooter() error {
 	return nil
 	return nil
 }
 }
 
 
+func (b *PurchaseBillExcel) drawSupplierRemark() error {
+	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"},
+	}
+
+	styleLeft, _ := b.Excel.NewStyle(&excelize.Style{
+		Alignment: &excelize.Alignment{Horizontal: "left", Vertical: "center"},
+		Border:    border,
+	})
+
+	sendToStartCell := fmt.Sprintf("A%d", b.Row)
+
+	sendToEndCell := fmt.Sprintf("J%d", b.Row)
+
+	b.Excel.MergeCell(b.SheetName, sendToStartCell, sendToEndCell)
+	b.Excel.SetCellStyle(b.SheetName, sendToStartCell, sendToEndCell, styleLeft)
+	b.Excel.SetCellValue(b.SheetName, sendToStartCell, "供应商备注:"+b.Content.SupplierRemark)
+	b.Excel.SetRowHeight(b.SheetName, b.Row, 32)
+	return nil
+
+}
+
 func (b *PurchaseBillExcel) drawTableSignature() error {
 func (b *PurchaseBillExcel) drawTableSignature() error {
 	b.Row += 2
 	b.Row += 2
 
 
@@ -360,6 +386,10 @@ func (b *PurchaseBillExcel) Draws() {
 	b.drawTableTitle()
 	b.drawTableTitle()
 	b.drawTableContent()
 	b.drawTableContent()
 	b.drawTableFooter()
 	b.drawTableFooter()
+	if len(b.Content.SupplierRemark) > 1 {
+		b.drawSupplierRemark()
+
+	}
 	b.drawTableSignature()
 	b.drawTableSignature()
 }
 }
 
 

+ 3 - 0
boxcost/api/bill.go

@@ -318,6 +318,9 @@ func UpdateBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if bill.Remark == "" {
 	if bill.Remark == "" {
 		bill.Remark = " "
 		bill.Remark = " "
 	}
 	}
+	if bill.SupplierRemark == "" {
+		bill.SupplierRemark = " "
+	}
 	// 更新供应商确定数量与plan中stage项的同步
 	// 更新供应商确定数量与plan中stage项的同步
 	if len(bill.Paper) > 0 {
 	if len(bill.Paper) > 0 {
 		idCounts := map[string]int{}
 		idCounts := map[string]int{}

+ 64 - 51
boxcost/api/print.go

@@ -1,65 +1,78 @@
 package api
 package api
 
 
 import (
 import (
+	"box-cost/db/model"
+	"box-cost/db/repo"
+
 	"github.com/gin-gonic/gin"
 	"github.com/gin-gonic/gin"
 )
 )
 
 
-func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
+// func UpdateIsAckStatus(c *gin.Context, apictx *ApiSession) (interface{}, error) {
-	// products := []*model.ProductBill{}
+// products := []*model.ProductBill{}
-	// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
+// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-	// 	CollectName: repo.CollectionBillProduct,
+// 	CollectName: repo.CollectionBillProduct,
-	// 	Query:       repo.Map{"isAck": nil},
+// 	Query:       repo.Map{"isAck": nil},
-	// Project:     []string{"isAck"},
+// Project:     []string{"isAck"},
-	// }, &products)
+// }, &products)
-	// fmt.Println(len(products))
+// fmt.Println(len(products))
+
+// for _, product := range products {
+// 	fmt.Println(product.Id.Hex())
+// 	fmt.Println(product.IsAck)
+// 	notAck := false
+// 	repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(), &repo.DocFilterOptions{
+// 		CollectName: repo.CollectionBillProduct,
+// 		Query:       repo.Map{"isAck": nil},
+// 	}, &model.ProductBill{IsAck: &notAck})
+// }
+// return products, nil
 
 
-	// for _, product := range products {
+// produces := []*model.ProduceBill{}
-	// 	fmt.Println(product.Id.Hex())
+// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-	// 	fmt.Println(product.IsAck)
+// 	CollectName: repo.CollectionBillProduce,
-	// 	notAck := false
+// 	Query:       repo.Map{"isAck": nil},
-	// 	repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(), &repo.DocFilterOptions{
+// 	Project:     []string{"isAck"},
-	// 		CollectName: repo.CollectionBillProduct,
+// }, &produces)
-	// 		Query:       repo.Map{"isAck": nil},
-	// 	}, &model.ProductBill{IsAck: &notAck})
-	// }
-	// return products, nil
 
 
-	// produces := []*model.ProduceBill{}
+// for _, produce := range produces {
-	// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
+// 	fmt.Println(produce.Id.Hex())
-	// 	CollectName: repo.CollectionBillProduce,
+// 	fmt.Println(produce.IsAck)
-	// 	Query:       repo.Map{"isAck": nil},
+// 	notAck := false
-	// 	Project:     []string{"isAck"},
+// 	repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(), &repo.DocFilterOptions{
-	// }, &produces)
+// 		CollectName: repo.CollectionBillProduce,
+// 		Query:       repo.Map{"isAck": nil},
+// 	}, &model.ProduceBill{IsAck: &notAck})
+// }
+// return produces, nil
 
 
-	// for _, produce := range produces {
+// purchases := []*model.PurchaseBill{}
-	// 	fmt.Println(produce.Id.Hex())
+// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-	// 	fmt.Println(produce.IsAck)
+// 	CollectName: repo.CollectionBillPurchase,
-	// 	notAck := false
+// 	Query:       repo.Map{"isAck": nil},
-	// 	repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(), &repo.DocFilterOptions{
+// Project:     []string{"isAck"},
-	// 		CollectName: repo.CollectionBillProduce,
+// }, &purchases)
-	// 		Query:       repo.Map{"isAck": nil},
-	// 	}, &model.ProduceBill{IsAck: &notAck})
-	// }
-	// return produces, nil
 
 
-	// purchases := []*model.PurchaseBill{}
+// for _, purchase := range purchases {
-	// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
+// 	fmt.Println(purchase.Id.Hex())
-	// 	CollectName: repo.CollectionBillPurchase,
+// 	fmt.Println(purchase.IsAck)
-	// 	Query:       repo.Map{"isAck": nil},
+// 	notAck := false
-	// Project:     []string{"isAck"},
+// 	repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(), &repo.DocFilterOptions{
-	// }, &purchases)
+// 		CollectName: repo.CollectionBillPurchase,
+// 		Query:       repo.Map{"isAck": nil},
+// 	}, &model.PurchaseBill{IsAck: &notAck})
+// }
+// return purchases, nil
 
 
-	// for _, purchase := range purchases {
+// return nil, nil
-	// 	fmt.Println(purchase.Id.Hex())
-	// 	fmt.Println(purchase.IsAck)
-	// 	notAck := false
-	// 	repo.RepoUpdateSetDocsProps(apictx.CreateRepoCtx(), &repo.DocFilterOptions{
-	// 		CollectName: repo.CollectionBillPurchase,
-	// 		Query:       repo.Map{"isAck": nil},
-	// 	}, &model.PurchaseBill{IsAck: &notAck})
-	// }
-	// return purchases, nil
 
 
-	return nil, nil
+// }
+
+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: ""})
 
 
 }
 }

+ 9 - 0
boxcost/db/model/bill.go

@@ -88,6 +88,8 @@ type PurchaseBill struct {
 	AckTime time.Time `bson:"ackTime,omitempty" json:"ackTime"`
 	AckTime time.Time `bson:"ackTime,omitempty" json:"ackTime"`
 	// 部件工序名
 	// 部件工序名
 	CompProduceName string `bson:"compProduceName,omitempty" json:"compProduceName"`
 	CompProduceName string `bson:"compProduceName,omitempty" json:"compProduceName"`
+	// 供应商备注
+	SupplierRemark string `bson:"supplierRemark,omitempty" json:"supplierRemark"`
 }
 }
 
 
 // 工艺生产数据
 // 工艺生产数据
@@ -166,6 +168,9 @@ type ProduceBill struct {
 	// 序号
 	// 序号
 	SerialNumber string `bson:"serialNumber,omitempty" json:"serialNumber"`
 	SerialNumber string `bson:"serialNumber,omitempty" json:"serialNumber"`
 
 
+	//备注
+	Remark string `bson:"remark,omitempty" json:"remark"`
+
 	IsPrint bool `bson:"isPrint,omitempty" json:"isPrint"`
 	IsPrint bool `bson:"isPrint,omitempty" json:"isPrint"`
 	IsLam   bool `bson:"isLam,omitempty" json:"isLam"`
 	IsLam   bool `bson:"isLam,omitempty" json:"isLam"`
 
 
@@ -180,6 +185,8 @@ type ProduceBill struct {
 	AckTime time.Time `bson:"ackTime,omitempty" json:"ackTime"`
 	AckTime time.Time `bson:"ackTime,omitempty" json:"ackTime"`
 	// 部件包含工序
 	// 部件包含工序
 	CompProduceName string `bson:"compProduceName,omitempty" json:"compProduceName"`
 	CompProduceName string `bson:"compProduceName,omitempty" json:"compProduceName"`
+	// 供应商备注
+	SupplierRemark string `bson:"supplierRemark,omitempty" json:"supplierRemark"`
 }
 }
 
 
 // 成品采购单据
 // 成品采购单据
@@ -231,6 +238,8 @@ type ProductBill struct {
 	AckTime time.Time `bson:"ackTime,omitempty" json:"ackTime"`
 	AckTime time.Time `bson:"ackTime,omitempty" json:"ackTime"`
 	// 部件工序名
 	// 部件工序名
 	CompProduceName string `bson:"compProduceName,omitempty" json:"compProduceName"`
 	CompProduceName string `bson:"compProduceName,omitempty" json:"compProduceName"`
+	// 供应商备注
+	SupplierRemark string `bson:"supplierRemark,omitempty" json:"supplierRemark"`
 }
 }
 
 
 // 工艺生产数据
 // 工艺生产数据

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

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

BIN
boxcost/微信图片_20230423160806.jpg


BIN
boxcost/微信图片_20230423161013.jpg