animeic 2 years ago
parent
commit
7893a9e464

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

@@ -162,8 +162,8 @@ func GetProduceBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	et, ok2 := query["endTime"]
 	delete(query, "endTime")
 	if ok1 && ok2 {
-		startTime := st.(time.Time)
-		endTime := et.(time.Time)
+		startTime := st.(string)
+		endTime := et.(string)
 		start, end := getTimeRange(startTime, endTime)
 		query["createTime"] = bson.M{"$gte": start, "$lte": end}
 	}

+ 3 - 3
boxcost/api/bill.go

@@ -68,7 +68,7 @@ func PurchaseReview(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		// 如果自己已存在该集合中了
 		for _, signUser := range bill.SignUsers {
 			if signUser == userId {
-				return nil, errors.New("该单据您已审核过了")
+				return nil, errors.New("该单据您已签字审核过了")
 			}
 		}
 		signs = bill.SignUsers
@@ -170,8 +170,8 @@ func GetBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	et, ok2 := query["endTime"]
 	delete(query, "endTime")
 	if ok1 && ok2 {
-		startTime := st.(time.Time)
-		endTime := et.(time.Time)
+		startTime := st.(string)
+		endTime := et.(string)
 		start, end := getTimeRange(startTime, endTime)
 		query["createTime"] = bson.M{"$gte": start, "$lte": end}
 	}

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

@@ -180,7 +180,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 							b.FormatToEmpty(&orderCount)
 
 							// 实际数量
-							confirmCount := fmt.Sprintf("%d", mat.MatInfo.ConfirmCount)
+							confirmCount := fmt.Sprintf("%d", mat.ConfirmCount)
 							b.FormatToEmpty(&confirmCount)
 							// 单价
 							orderPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderPrice)
@@ -189,7 +189,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 							orderRealPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderRealPrice)
 							b.FormatToEmpty(&orderRealPrice)
 							// 实际金额
-							confirmPrice := mat.Supplier.OrderPrice * float64(mat.MatInfo.ConfirmCount)
+							confirmPrice := mat.Supplier.OrderPrice * float64(mat.ConfirmCount)
 							totalConfirmRealPrice += confirmPrice
 							confirmRealPrice := fmt.Sprintf("%.2f", confirmPrice)
 							b.FormatToEmpty(&confirmRealPrice)
@@ -217,7 +217,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 									b.FormatToEmpty(&carftWidth)
 
 									// 实际数量
-									confirmCraftCount := fmt.Sprintf("%d", craft.CraftInfo.ConfirmCount)
+									confirmCraftCount := fmt.Sprintf("%d", craft.ConfirmCount)
 									b.FormatToEmpty(&confirmCraftCount)
 
 									carftOrderPrice := fmt.Sprintf("%.2f", craft.Supplier.OrderPrice)
@@ -227,7 +227,7 @@ func (b *PlanCostExcel) drawSupplierContent() error {
 									b.FormatToEmpty(&carftOrderRealPrice)
 
 									// 实际金额
-									confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.CraftInfo.ConfirmCount)
+									confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.ConfirmCount)
 									totalConfirmRealPrice += confirmCraftPrice
 									confirmCraftRealPrice := fmt.Sprintf("%.2f", confirmCraftPrice)
 									b.FormatToEmpty(&confirmCraftRealPrice)
@@ -359,7 +359,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 					// b.drawRow(row, "", mat.MatInfo.Name, "", supplierName, mat.MatInfo.Norm, matHeigth, matWidth, mat.MatInfo.Unit, orderCount, orderPrice, orderRealPrice, "")
 
 					// 实际数量
-					confirmCount := fmt.Sprintf("%d", mat.MatInfo.ConfirmCount)
+					confirmCount := fmt.Sprintf("%d", mat.ConfirmCount)
 					b.FormatToEmpty(&confirmCount)
 					// 单价
 					orderPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderPrice)
@@ -368,7 +368,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 					orderRealPrice := fmt.Sprintf("%.2f", mat.Supplier.OrderRealPrice)
 					b.FormatToEmpty(&orderRealPrice)
 					// 实际金额
-					confirmPrice := mat.Supplier.OrderPrice * float64(mat.MatInfo.ConfirmCount)
+					confirmPrice := mat.Supplier.OrderPrice * float64(mat.ConfirmCount)
 					totalConfirmRealPrice += confirmPrice
 					confirmRealPrice := fmt.Sprintf("%.2f", confirmPrice)
 					b.FormatToEmpty(&confirmRealPrice)
@@ -396,7 +396,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 							// b.drawRow(row, "", "", craft.CraftInfo.Name, craftSupplierName, craft.CraftInfo.Norm, carftHeigth, carftWidth, craft.CraftInfo.Unit, carftOrderCount, carftOrderPrice, carftOrderRealPrice, "")
 
 							// 实际数量
-							confirmCraftCount := fmt.Sprintf("%d", craft.CraftInfo.ConfirmCount)
+							confirmCraftCount := fmt.Sprintf("%d", craft.ConfirmCount)
 							b.FormatToEmpty(&confirmCraftCount)
 
 							carftOrderPrice := fmt.Sprintf("%.2f", craft.Supplier.OrderPrice)
@@ -406,7 +406,7 @@ func (b *PlanCostExcel) drawAllContent() error {
 							b.FormatToEmpty(&carftOrderRealPrice)
 
 							// 实际金额
-							confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.CraftInfo.ConfirmCount)
+							confirmCraftPrice := craft.Supplier.OrderPrice * float64(craft.ConfirmCount)
 							totalConfirmRealPrice += confirmCraftPrice
 							confirmCraftRealPrice := fmt.Sprintf("%.2f", confirmCraftPrice)
 							b.FormatToEmpty(&confirmCraftRealPrice)

+ 1 - 2
boxcost/api/report.go

@@ -6,7 +6,6 @@ import (
 	"box-cost/log"
 	"errors"
 	"fmt"
-	"time"
 
 	"github.com/gin-gonic/gin"
 	"github.com/go-redis/redis/v8"
@@ -23,7 +22,7 @@ func Report(r *GinRouter) {
 
 type ReportListReq struct {
 	Supplier  string
-	TimeRange []time.Time
+	TimeRange []string
 	PackIds   []primitive.ObjectID
 	PlanIds   []primitive.ObjectID
 	Page      int64

+ 1 - 3
boxcost/api/utils.go

@@ -117,10 +117,8 @@ func getDayRange(t time.Time) (start, end time.Time) {
 }
 
 // 获取时间跨度的起始终止时间
-func getTimeRange(startTime, endTime time.Time) (start, end time.Time) {
+func getTimeRange(startDate, endDate string) (start, end time.Time) {
 	loc, _ := time.LoadLocation("Local")
-	startDate := startTime.Format("2006-01-02")
-	endDate := endTime.Format("2006-01-02")
 	startDateTime := startDate + " 00:00:00"
 	endDateTime := endDate + " 23:59:59"
 	start, _ = time.ParseInLocation("2006-01-02 15:04:05", startDateTime, loc)

+ 0 - 3
boxcost/db/model/craft.go

@@ -22,7 +22,4 @@ type Craft struct {
 
 	//分类
 	Category string `bson:"category,omitempty" json:"category"`
-
-	//确认收货数量
-	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
 }

+ 0 - 3
boxcost/db/model/material.go

@@ -39,7 +39,4 @@ type Material struct {
 
 	CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
 	UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
-
-	//确认收货数量
-	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
 }

+ 6 - 0
boxcost/db/model/pack.go

@@ -79,6 +79,9 @@ type PackComponentMat struct {
 	BillId string `bson:"billId,omitempty" json:"billId"`
 
 	Remark string `bson:"remark,omitempty" json:"remark"` //备注
+
+	//确认收货数量
+	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
 }
 
 type PackComponentMatCraft struct {
@@ -102,4 +105,7 @@ type PackComponentMatCraft struct {
 	BillId string `bson:"billId,omitempty" json:"billId"`
 
 	Remark string `bson:"remark,omitempty" json:"remark"` //备注
+
+	//确认收货数量
+	ConfirmCount int `bson:"confirmCount,omitempty" json:"confirmCount"`
 }