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
53
54
import { default as BaseController } from "../baseController";
import { Post, Prefix } from "egg-shell-decorators";
import { vBaseProductPosition } from "../../entity/storage/product/vBaseProductPosition";
import { BasePosition } from "../../entity/basicInfo/base/basePosition";
import { MoreThan } from "typeorm";
/**
 * WCS客户端
 */
@Prefix("/wcs")
export default class WcsController extends BaseController {
  //#region 更新入库标签打印中的“动态称重”
  @Post()
  public async updatedYnamicWeight() {
    let { ctx } = this;
    let body = ctx.request.body;
 
    this.info = await this.ctx.service.wcs.updatedYnamicWeight(body.plateCode, body.dynamicWeight, body.transId);
    ctx.body = this.info;
  }
  //#endregion
 
  @Post()
  public async getPostionName() {
    let { ctx } = this;
    let body = ctx.request.body;
    try {
      let postionInfo = await this.dbRead.findOne(BasePosition, {
        positionName: body.positionName,
        storage_Id: body.storage_Id
      });
      if (postionInfo) {
        // 获取所有该货位的库存明细数据
        let productPositionList = await this.dbRead.find(vBaseProductPosition, {
          positionName: body.positionName,
          storage_Id: body.storage_Id,
          productStorage: MoreThan(0)
        });
 
        this.info.result = true;
        this.info.data = {
          postionInfo: postionInfo,
          productPositionList: productPositionList
        };
      } else {
        this.info.result = false;
        this.info.msg = body.positionName + "没有找到对应的货位";
      }
    } catch (error) {
      this.info.result = false;
      this.info.msg = error.message;
    }
    ctx.body = this.info;
  }
}