333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
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
import BaseController from "../baseController";
import { Post } from "egg-shell-decorators";
import * as sql from "mssql";
/**
 * 要货管理
 */
export default class GoodsController extends BaseController {
  //#region 转到预到货单
  @Post()
  public async toAllocation() {
    let userInfo = await this.ctx.helper.userInfo();
    try {
      const connection: any = await this.dbWrite.connection;
      let request = new sql.Request(connection.driver.master);
      request.input("goods_Id", this.body.goods_Id);
      request.input("user_Id", userInfo.user_Id);
      request.input("userTrueName", userInfo.userTrueName);
      request.input("userProduct_Id", userInfo.userProduct_Id);
      request.output("outMsg", sql.NVarChar(2000));
      let result = await request.execute("sp_Require_Goods_ToAllocation");
      let outMsg = result.output.outMsg;
      if (outMsg) {
        this.info.msg = outMsg;
        this.info.result = false;
        this.ctx.body = this.info;
      } else {
        this.info.msg = "生成调拨单成功!";
        this.info.result = true;
        this.ctx.body = this.info;
      }
    } catch (error) {
      this.info.msg = error.message;
      this.info.result = false;
      this.ctx.body = this.info;
    }
  }
  //#endregion
}