Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1x 1x 1x 1x | import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
import ABaseServantSoapBatch from './ABaseServantSoapBatch';
export const NAME = 'servant-get-inventory';
export default class ServantGetInventory extends ABaseServantSoapBatch {
public getName(): string {
return NAME;
}
public async processAction(dto: BatchProcessDto): Promise<BatchProcessDto> {
return this.callSOAP<IOutput[]>(
dto,
'GetInventory',
'inventoryItems',
{},
);
}
protected processDataAfterRequest(data: IOutput[]|undefined): IOutput[] {
const processData: IOutput[] = [];
data?.forEach((item) => {
const index = processData.findIndex((line) => line.item.code === item.item.code);
if (index >= 0) {
processData[index].count += item.count;
} else {
processData.push(item);
}
});
return processData;
}
}
export interface IOutput {
item: IItem;
count: number;
group: string;
eans: {
items: IEan[];
};
movement: Date;
}
export interface IItem {
code: string;
name: string;
attributes: string[];
expiration: Date;
batch: string;
unit: string;
}
interface IEan {
ean: string;
count: number;
weight: number;
dimension: {
x: number;
y: number;
z: number;
};
velocity: number;
primary: boolean;
}
|