|
@@ -37,6 +37,40 @@ func Bill(r *GinRouter) {
|
|
|
|
|
|
// 审核单据
|
|
|
r.POSTJWT("/bill/purchase/review/:id", PurchaseReview)
|
|
|
+
|
|
|
+ // 对账单据
|
|
|
+ r.POSTJWT("/bill/record", BillRecord)
|
|
|
+}
|
|
|
+
|
|
|
+type BillRecordReq struct {
|
|
|
+ BillType string `json:"billType"`
|
|
|
+ Id primitive.ObjectID `json:"id"`
|
|
|
+}
|
|
|
+
|
|
|
+// 对账单据
|
|
|
+func BillRecord(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
+ var req BillRecordReq
|
|
|
+ err := c.ShouldBindJSON(&req)
|
|
|
+ if err != nil {
|
|
|
+ return nil, errors.New("参数错误!")
|
|
|
+ }
|
|
|
+ if req.Id.IsZero() {
|
|
|
+ return nil, errors.New("id错误!")
|
|
|
+ }
|
|
|
+ collection := ""
|
|
|
+ if req.BillType == "purchase" {
|
|
|
+ collection = repo.CollectionBillPurchase
|
|
|
+ } else if req.BillType == "produce" {
|
|
|
+ collection = repo.CollectionBillProduce
|
|
|
+ } else if req.BillType == "product" {
|
|
|
+ collection = repo.CollectionBillProduct
|
|
|
+ } else {
|
|
|
+ return nil, errors.New("订单类型错误!")
|
|
|
+ }
|
|
|
+ record := true
|
|
|
+ update := bson.M{"isRecord": &record}
|
|
|
+ return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), collection, req.Id.Hex(), &update)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// 审核单据
|