Browse Source

isSend 可更改

sun-pc-linux 7 months ago
parent
commit
7bed6047ee

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

@@ -126,6 +126,8 @@ func CreateProduceBill(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	bill.CreateTime = time.Now()
 	bill.UpdateTime = time.Now()
 	notAck := false
+	_isSend := false
+	bill.IsSend = &_isSend
 	bill.IsAck = &notAck
 	// 制单人数据
 	userId, _ := primitive.ObjectIDFromHex(apictx.User.Parent)

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

@@ -124,6 +124,8 @@ func CreateProductBill(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	}
 	bill.CreateTime = time.Now()
 	bill.UpdateTime = time.Now()
+	_isSend := false
+	bill.IsSend = &_isSend
 	notAck := false
 	bill.IsAck = &notAck
 	// 制单人数据

+ 2 - 0
boxcost/api/bill.go

@@ -175,6 +175,8 @@ func CreateBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	}
 	bill.CreateTime = time.Now()
 	bill.UpdateTime = time.Now()
+	_isSend := false
+	bill.IsSend = &_isSend
 	notAck := false
 	bill.IsAck = &notAck
 	// 制单人数据

+ 4 - 3
boxcost/api/plan.go

@@ -105,6 +105,7 @@ func PlanAllocBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if len(typeBillIds) < 1 {
 		return nil, errors.New("未找到单据信息")
 	}
+	_isSend := true
 
 	var wg sync.WaitGroup
 	for _, tId := range typeBillIds {
@@ -116,7 +117,7 @@ func PlanAllocBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		if tidArr[0] == "1" {
 			billType = PURCHASE_BILL_TYPE
 			// _, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillPurchase, billId.Hex(), &model.PurchaseBill{IsSend: true, SendTime: time.Now()})
-			_, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillPurchase, billId.Hex(), &model.PurchaseBill{IsSend: true, SendTime: time.Now()}, &repo.RecordLogReq{
+			_, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillPurchase, billId.Hex(), &model.PurchaseBill{IsSend: &_isSend, SendTime: time.Now()}, &repo.RecordLogReq{
 				Path:     c.Request.URL.Path,
 				UserInfo: user,
 				TargetId: billId.Hex(),
@@ -127,7 +128,7 @@ func PlanAllocBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		if tidArr[0] == "2" {
 			billType = PRODUCE_BILL_TYPE
 			// _, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduce, billId.Hex(), &model.ProduceBill{IsSend: true, SendTime: time.Now()})
-			_, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduce, billId.Hex(), &model.ProduceBill{IsSend: true, SendTime: time.Now()}, &repo.RecordLogReq{
+			_, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduce, billId.Hex(), &model.ProduceBill{IsSend: &_isSend, SendTime: time.Now()}, &repo.RecordLogReq{
 				Path:     c.Request.URL.Path,
 				UserInfo: user,
 				TargetId: billId.Hex(),
@@ -138,7 +139,7 @@ func PlanAllocBatch(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 		if tidArr[0] == "3" {
 			billType = PRODUCT_BILL_TYPE
 			// _, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: true, SendTime: time.Now()})
-			_, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: true, SendTime: time.Now()}, &repo.RecordLogReq{
+			_, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: &_isSend, SendTime: time.Now()}, &repo.RecordLogReq{
 				Path:     c.Request.URL.Path,
 				UserInfo: user,
 				TargetId: billId.Hex(),

+ 4 - 3
boxcost/api/supplier.go

@@ -166,13 +166,14 @@ func SupplierBillAlloc(c *gin.Context, apictx *ApiSession) (interface{}, error)
 	if !flagType {
 		return nil, errors.New("订单类型错误")
 	}
+	_isSend := true
 
 	result := &mongo.UpdateResult{}
 	var err error
 	switch billType {
 	case PURCHASE_BILL_TYPE:
 		// result, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillPurchase, billId.Hex(), &model.PurchaseBill{IsSend: true, SendTime: time.Now()})
-		result, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillPurchase, billId.Hex(), &model.PurchaseBill{IsSend: true, SendTime: time.Now()}, &repo.RecordLogReq{
+		result, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillPurchase, billId.Hex(), &model.PurchaseBill{IsSend: &_isSend, SendTime: time.Now()}, &repo.RecordLogReq{
 			Path:     c.Request.URL.Path,
 			UserInfo: user,
 			TargetId: billId.Hex(),
@@ -180,7 +181,7 @@ func SupplierBillAlloc(c *gin.Context, apictx *ApiSession) (interface{}, error)
 		})
 	case PRODUCE_BILL_TYPE:
 		// result, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduce, billId.Hex(), &model.ProduceBill{IsSend: true, SendTime: time.Now()})
-		result, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduce, billId.Hex(), &model.ProduceBill{IsSend: true, SendTime: time.Now()}, &repo.RecordLogReq{
+		result, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduce, billId.Hex(), &model.ProduceBill{IsSend: &_isSend, SendTime: time.Now()}, &repo.RecordLogReq{
 			Path:     c.Request.URL.Path,
 			UserInfo: user,
 			TargetId: billId.Hex(),
@@ -188,7 +189,7 @@ func SupplierBillAlloc(c *gin.Context, apictx *ApiSession) (interface{}, error)
 		})
 	case PRODUCT_BILL_TYPE:
 		// result, err = repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: true, SendTime: time.Now()})
-		result, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: true, SendTime: time.Now()}, &repo.RecordLogReq{
+		result, err = repo.RepoUpdateSetDoc1(apictx.CreateRepoCtx(), repo.CollectionBillProduct, billId.Hex(), &model.ProductBill{IsSend: &_isSend, SendTime: time.Now()}, &repo.RecordLogReq{
 			Path:     c.Request.URL.Path,
 			UserInfo: user,
 			TargetId: billId.Hex(),

+ 3 - 3
boxcost/db/model/bill.go

@@ -83,7 +83,7 @@ type PurchaseBill struct {
 	BillType string `bson:"billType,omitempty" json:"billType"`
 
 	// 发送给供应商
-	IsSend   bool      `bson:"isSend,omitempty" json:"isSend"`
+	IsSend   *bool     `bson:"isSend,omitempty" json:"isSend"`
 	SendTime time.Time `bson:"sendTime,omitempty" json:"sendTime"`
 
 	// 供应商确认
@@ -190,7 +190,7 @@ type ProduceBill struct {
 	BillType string `bson:"billType,omitempty" json:"billType"`
 
 	// 发送给供应商
-	IsSend   bool      `bson:"isSend,omitempty" json:"isSend"`
+	IsSend   *bool     `bson:"isSend,omitempty" json:"isSend"`
 	SendTime time.Time `bson:"sendTime,omitempty" json:"sendTime"`
 	// 供应商确认
 	IsAck   *bool     `bson:"isAck,omitempty" json:"isAck"`
@@ -245,7 +245,7 @@ type ProductBill struct {
 	BillType string `bson:"billType,omitempty" json:"billType"`
 
 	// 发送给供应商
-	IsSend   bool      `bson:"isSend,omitempty" json:"isSend"`
+	IsSend   *bool     `bson:"isSend,omitempty" json:"isSend"`
 	SendTime time.Time `bson:"sendTime,omitempty" json:"sendTime"`
 	// 供应商确认
 	IsAck   *bool     `bson:"isAck,omitempty" json:"isAck"`