schangxiang@126.com
2025-09-09 3d8966ba2c81e7e0365c8b123e861d18ee4f94f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import BaseService from "../baseService";
import { ResultInfo } from "../../public/commonInterface";
import { RequireGoods } from "../../entity/outbound/require/requireGoods";
 
export default class GoodsService extends BaseService {
  //#region 批量审核
  public async batchAuditing(): Promise<ResultInfo> {
    let { ctx } = this;
    let body = ctx.request.body;
    let userInfo = await ctx.helper.userInfo();
 
    try {
      let idValues = body.idValues;
      if (!Array.isArray(idValues)) {
        this.info.result = false;
        this.info.msg = "没有可执行的数据";
        return this.info;
      }
 
      for (var idValue of idValues) {
        let dataInfo = await this.dbRead.findOne(RequireGoods, idValue);
        if (!dataInfo) {
          this.info.result = false;
          this.info.msg = "单据不存在";
          return this.info;
        }
 
        await this.dbWrite.update(
          RequireGoods,
          {
            goods_Id: dataInfo.goods_Id,
            userProduct_Id: userInfo.userProduct_Id
          },
          {
            goodsText: "已审核",
            auditing: 2,
            auditor: userInfo.userTrueName,
            auditDate: new Date()
          }
        );
      }
      this.info.result = true;
      this.info.msg = "审核成功";
    } catch (error) {
      this.info.result = false;
      this.info.msg = "审核失败" + error.message;
    }
 
    return this.info;
  }
  //#endregion
}