animeic 1 rok temu
rodzic
commit
e505a92610

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

@@ -230,7 +230,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 						}
 
 						// 接单状态
-						if splan.IsAck[stage.BillId] != nil && *splan.IsAck[stage.BillId] {
+						if splan.IsAck[stage.BillId] {
 							stageStatus = "已接单"
 						} else {
 							stageStatus = "未接单"
@@ -398,7 +398,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 								}
 
 								// 接单状态
-								if splan.IsAck[stage.BillId] != nil && *splan.IsAck[stage.BillId] {
+								if splan.IsAck[stage.BillId] {
 									stageStatus = "已接单"
 								} else {
 									stageStatus = "未接单"

+ 2 - 2
boxcost/api/plan-summary-excel.go

@@ -231,7 +231,7 @@ func (b *PlanSummaryExcel) drawAllContent() error {
 						}
 
 						// 接单状态
-						if splan.IsAck[stage.BillId] != nil && *splan.IsAck[stage.BillId] {
+						if splan.IsAck[stage.BillId] {
 							stageStatus = "已接单"
 						} else {
 							stageStatus = "未接单"
@@ -411,7 +411,7 @@ func (b *PlanSummaryExcel) drawSupplierContent() error {
 								}
 
 								// 接单状态
-								if splan.IsAck[stage.BillId] != nil && *splan.IsAck[stage.BillId] {
+								if splan.IsAck[stage.BillId] {
 									stageStatus = "已接单"
 								} else {
 									stageStatus = "未接单"

+ 3 - 4
boxcost/api/plan.go

@@ -1033,7 +1033,7 @@ func GetProductPlan(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	billStates := map[string]string{}
 	billIsSend := map[string]bool{}
 	billReviewed := map[string]int32{}
-	billIsAck := map[string]*bool{}
+	billIsAck := map[string]bool{}
 	if plan.Pack != nil && plan.Pack.Components != nil {
 		for _, comp := range plan.Pack.Components {
 			if comp.Stages != nil {
@@ -1072,11 +1072,10 @@ func GetProductPlan(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 								billReviewed[stage.BillId] = -1
 							}
 							if v, ok := state["isAck"]; ok {
-								billIsAck[stage.BillId] = v.(*bool)
+								billIsAck[stage.BillId] = v.(bool)
 
 							} else {
-								notAck := false
-								billIsAck[stage.BillId] = &notAck
+								billIsAck[stage.BillId] = false
 							}
 
 						}

+ 20 - 21
boxcost/api/print.go

@@ -1,10 +1,6 @@
 package api
 
 import (
-	"box-cost/db/model"
-	"box-cost/db/repo"
-	"fmt"
-
 	"github.com/gin-gonic/gin"
 )
 
@@ -13,8 +9,9 @@ func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
 	// 	CollectName: repo.CollectionBillProduct,
 	// 	Query:       repo.Map{"isAck": nil},
-	// 	Project:     []string{"isAck"},
+	// Project:     []string{"isAck"},
 	// }, &products)
+	// fmt.Println(len(products))
 
 	// for _, product := range products {
 	// 	fmt.Println(product.Id.Hex())
@@ -45,22 +42,24 @@ func Printr(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	// }
 	// return produces, nil
 
-	purchases := []*model.PurchaseBill{}
-	repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
-		CollectName: repo.CollectionBillPurchase,
-		Query:       repo.Map{"isAck": nil},
-		Project:     []string{"isAck"},
-	}, &purchases)
+	// purchases := []*model.PurchaseBill{}
+	// repo.RepoDocsSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
+	// 	CollectName: repo.CollectionBillPurchase,
+	// 	Query:       repo.Map{"isAck": nil},
+	// Project:     []string{"isAck"},
+	// }, &purchases)
+
+	// for _, purchase := range purchases {
+	// 	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
 
-	for _, purchase := range purchases {
-		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
 
 }

+ 2 - 2
boxcost/api/summary-sample-excel.go

@@ -131,7 +131,7 @@ func (b *SummarySampleExcel) drawAllContent() error {
 						}
 
 						// 接单状态
-						if splan.IsAck[stage.BillId] != nil && *splan.IsAck[stage.BillId] {
+						if splan.IsAck[stage.BillId] {
 							stageStatus = "已接单"
 						} else {
 							stageStatus = "未接单"
@@ -262,7 +262,7 @@ func (b *SummarySampleExcel) drawSupplierContent() error {
 								}
 
 								// 接单状态
-								if splan.IsAck[stage.BillId] != nil && *splan.IsAck[stage.BillId] {
+								if splan.IsAck[stage.BillId] {
 									stageStatus = "已接单"
 								} else {
 									stageStatus = "未接单"

+ 4 - 5
boxcost/api/summary.go

@@ -28,7 +28,7 @@ type SupplierPlanSummary struct {
 type PlanSummary struct {
 	Plan        *model.ProductPlan
 	IsSend      map[string]bool
-	IsAck       map[string]*bool
+	IsAck       map[string]bool
 	Reviewed    map[string]int32
 	State       map[string]string
 	CreateTimes map[string]time.Time
@@ -179,7 +179,7 @@ func GetPlanStatus(plan *model.ProductPlan, apictx *ApiSession) *PlanSummary {
 	billStates := map[string]string{}
 	billIsSend := map[string]bool{}
 	billReviewed := map[string]int32{}
-	billIsAck := map[string]*bool{}
+	billIsAck := map[string]bool{}
 	billCreateTimes := map[string]time.Time{}
 	if plan.Pack != nil && plan.Pack.Components != nil {
 		for _, comp := range plan.Pack.Components {
@@ -219,11 +219,10 @@ func GetPlanStatus(plan *model.ProductPlan, apictx *ApiSession) *PlanSummary {
 								billReviewed[stage.BillId] = -1
 							}
 							if v, ok := state["isAck"]; ok {
-								billIsAck[stage.BillId] = v.(*bool)
+								billIsAck[stage.BillId] = v.(bool)
 
 							} else {
-								notAck := false
-								billIsAck[stage.BillId] = &notAck
+								billIsAck[stage.BillId] = false
 							}
 							if v, ok := state["createTime"]; ok {
 								billCreateTimes[stage.BillId] = v.(primitive.DateTime).Time()