import { default as BaseController } from "../baseController";
|
import { Post } from "egg-shell-decorators";
|
|
export default class productPositionGroupController extends BaseController {
|
//#region app-提交盘点
|
@Post()
|
public async getOriginalPlateList() {
|
let { ctx } = this;
|
let body = ctx.request.body;
|
let storage_Id = body.storage_Id;
|
let paiCode = body.paiCode;
|
try {
|
let sql = `SELECT p.consignor_Id, p.consignorCode, p.consignorName,
|
p.product_Id,p.productCode,p.productModel,MAX(p.productName) AS productName,MAX(p.positionName) AS positionNo,
|
SUM(validQty) AS quantity,MAX(I.remark) AS remark, p.productSpec, p.produceDate, p.batchNumber,
|
0 AS scanCount,
|
p.storageStatus, p.productAttribute,
|
MAX(I.relationCode) as relationCode,
|
MAX(I.relationCode2) as relationCode2,
|
MAX(I.relationCode3) as relationCode3,
|
MAX(I.relationCode4) as relationCode4,
|
MAX(I.relationCode5) as relationCode5,
|
MAX(I.middleBarcode) as middleBarcode,
|
MAX(I.middleUnitConvert) as middleUnitConvert,
|
MAX(I.bigBarcode) as bigBarcode,
|
MAX(I.unitConvert) as unitConvert,
|
p.plateCode
|
FROM dbo.vBase_ProductPosition p INNER JOIN dbo.vBase_ProductInfo_SKU I ON p.product_Id=I.product_Id
|
WHERE p.Storage_Id=@0
|
AND p.plateCode=@1
|
AND p.validQty>0
|
GROUP BY p.consignor_Id, p.consignorCode, p.consignorName, p.product_Id,
|
p.productCode,p.productModel, p.produceDate, p.productSpec, p.batchNumber, p.storageStatus, p.productAttribute,p.plateCode`;
|
let tableList = await this.dbRead.query(sql, [storage_Id, paiCode]);
|
if (tableList.length == 0) {
|
this.info.result = false;
|
this.info.msg = "没有找到库存数据";
|
return this.info;
|
} else {
|
this.info.result = true;
|
this.info.data = tableList;
|
}
|
} catch (error) {
|
this, (this.info.result = false);
|
this.info.msg = "错误:" + error.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
|
//#region app-提交盘点
|
@Post()
|
public async savePlateTransfer() {
|
let { ctx } = this;
|
let body = ctx.request.body;
|
let storage_Id = body.storage_Id; // 仓库
|
let position = body.position; // 目标货位
|
let plateCode = body.plateCode; // 拍号
|
try {
|
this.info = await ctx.service.storage.positionGroupService.savePlateTransfer(storage_Id, position, plateCode);
|
} catch (error) {
|
this, (this.info.result = false);
|
this.info.msg = "错误:" + error.message;
|
}
|
ctx.body = this.info;
|
}
|
//#endregion
|
}
|