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;
|
}
|
}
|