|
@@ -5,6 +5,7 @@ import (
|
|
|
"box-cost/db/repo"
|
|
|
"box-cost/log"
|
|
|
"bytes"
|
|
|
+ "errors"
|
|
|
"fmt"
|
|
|
"math"
|
|
|
"math/rand"
|
|
@@ -22,6 +23,26 @@ import (
|
|
|
|
|
|
var SignatureDir string = "https://www.3dqueen.cloud/box/v1/boxcost/public/"
|
|
|
|
|
|
+func isCompareStatus(apictx *ApiSession, collection string, id primitive.ObjectID, sv string) (bool, error) {
|
|
|
+ ok, ret := repo.RepoSeachDocMap(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
|
|
|
+ CollectName: collection,
|
|
|
+ Query: repo.Map{"_id": id},
|
|
|
+ Project: []string{"status"},
|
|
|
+ })
|
|
|
+ if !ok {
|
|
|
+ return false, errors.New("未找到该单据")
|
|
|
+ }
|
|
|
+ if _, ok := ret["status"]; !ok {
|
|
|
+ return false, errors.New("状态为空")
|
|
|
+ }
|
|
|
+ // 更新状态和完成状态相同
|
|
|
+ if ret["status"].(string) == sv {
|
|
|
+ return true, nil
|
|
|
+ }
|
|
|
+
|
|
|
+ return false, nil
|
|
|
+}
|
|
|
+
|
|
|
func makeBillQuery(query map[string]interface{}) map[string]interface{} {
|
|
|
if query["packId"] != nil {
|
|
|
query["packId"], _ = primitive.ObjectIDFromHex(query["packId"].(string))
|