27 lines
869 B
JavaScript
27 lines
869 B
JavaScript
'use strict';
|
|
|
|
const MainService = require('../main');
|
|
|
|
class inventoryServer extends MainService {
|
|
async query(data) {
|
|
const criteria = data.request.criteriaList.criteria;
|
|
const list = criteria.warehouseCode ? [ criteria ] : criteria;
|
|
const list2 = [];
|
|
for (let i = 0; i < list.length; i++) {
|
|
const info = await this.ctx.service.systems.stockStore.getItemStorages(list[i].itemId);
|
|
if (info.success) {
|
|
list2.push({
|
|
warehouseCode: info.data.stock.warehouse_code,
|
|
itemCode: info.data.stock.item_code,
|
|
itemId: info.data.stock.id,
|
|
quantity: info.data.storage.quantity,
|
|
lockQuantity: info.data.storage.lockedQuantity,
|
|
inventoryType: 'ZP',
|
|
});
|
|
}
|
|
}
|
|
return this.success('库存信息抓取成功', { items: list2 });
|
|
}
|
|
}
|
|
module.exports = inventoryServer;
|