refs #6321 perf: updatemethod
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Javier Segarra 2024-03-13 09:20:32 +01:00
parent d1e7e13333
commit c8446eb9a1
1 changed files with 89 additions and 842 deletions

View File

@ -1,4 +1,7 @@
/* eslint-disable no-console */
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const {buildFilter} = require('vn-loopback/util/filter');
module.exports = Self => {
Self.remoteMethod('itemLack', {
description: 'Download a ticket delivery note document',
@ -23,25 +26,27 @@ module.exports = Self => {
{
arg: 'longname',
type: 'string',
description: 'The item id',
description: 'Article name',
},
{
arg: 'supplier',
type: 'string',
description: 'The client fiscal id',
description: 'Supplier id',
},
{
arg: 'color',
type: 'string',
description: 'The item id',
description: 'Color\'s item',
},
{
arg: 'size',
type: 'string', description: 'The item id',
type: 'string',
description: 'Size\'s item',
},
{
arg: 'origen',
type: 'string', description: 'The item id',
type: 'string',
description: 'origen id',
},
{
arg: 'lack',
@ -63,849 +68,91 @@ module.exports = Self => {
Self.itemLack = async(ctx, filter, options) => {
const myOptions = {};
// const versionSQL = false;
if (typeof options == 'object')
Object.assign(myOptions, options);
// if (versionSQL) {
// const filterKeyOrder = ['id', 'longname', 'supplier', 'colour', 'size', 'origen', 'lack'];
const conn = Self.dataSource.connector;
let where = {};
where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'id':
return {'i.id': value};
case 'longname':
return {'i.longName': value};
case 'name':
return {'p.name': {like: `%${value}%`}};
case 'color':
return {'i.inkFk': value};
case 'size':
return {'i.size': value};
case 'origen':
return {'w.name': value};
case 'lack':
return {'lack': value};
}
}) ?? {};
// const {body} = ctx;
const stmts = [];
stmts.push(`SET @_optimizer_search_depth = @@optimizer_search_depth`);
stmts.push(`SET SESSION optimizer_search_depth = 0`);
// let procedureParams = [true, 2];
// procedureParams.push(...filterKeyOrder.map(clave => body || null));
// const procedureArgs = Array(procedureParams.length).fill('?').join(', ');
// let query = `CALL vn.item_getLack(${procedureArgs})`;
stmts.push(`CALL cache.stock_refresh(true)`);
stmts.push(`CALL item_getMinacum(NULL, util.VN_CURDATE(), 2, NULL)`);
stmts.push(`CALL item_getMinETD()`);
stmts.push(`CALL item_zoneClosure()`);
// const result = await Self.rawSql(query, procedureParams, myOptions);
// console.log('qUERY:', query);
// console.log('Argumentos procedimiento:', procedureArgs);
// console.log('PArametros del procedimiento:', procedureParams);
// // const result = await Self.rawSql(query, [true, 2, ...procedureParams]);
// // console.log('Resultado', result);
// return result;
// } else {
// const where = buildFilter(ctx.args, (param, value) => {
// switch (param) {
// case 'id':
// return {'i.id': value};
// case 'longname':
// return {'i.longName': value};
// case 'name':
// return {'p.name': {like: `%${value}%`}};
// case 'color':
// return {'i.inkFk': value};
// case 'size':
// return {'i.size': value};
// case 'origen':
// return {'w.name': value};
// case 'lack':
// return {'lack': value};
// }
// }) ?? {};
const stmt = new ParameterizedSQL(`
SELECT i.id itemFk,
i.longName,
w.id warehouseFk,
p.name producer,
i.size,
i.category,
w.name warehouse,
SUM(IFNULL(sub.amount,0)) lack,
i.inkFk,
IFNULL(im.timed, util.midnight()) timed,
IFNULL(izc.timed, util.midnight()) minTimed
FROM (SELECT item_id,
warehouse_id,
amount
FROM cache.stock
WHERE amount > 0
UNION ALL
SELECT itemFk,
warehouseFk,
amount
FROM tmp.itemMinacum
) sub
JOIN warehouse w ON w.id = sub.warehouse_id
JOIN item i ON i.id = sub.item_id
LEFT JOIN producer p ON p.id = i.producerFk
JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
`);
// const stmts = [
// 'CALL cache.stock_refresh(vForce);',
// 'CALL item_getMinacum(NULL, util.VN_CURDATE(), vDays, NULL);',
// 'CALL item_getMinETD();',
// 'CALL item_zoneClosure();'
// ];
const sqlWhere = conn.makeWhere(where);
stmt.merge(sqlWhere);
const prefix = Object.keys(where).length > 0 ? 'AND' : 'WHERE';
stmt.merge(`${prefix} w.isForTicket
AND ic.display
AND it.code != 'GEN'`);
// const stmt = new ParameterizedSQL(`
// SELECT i.id itemFk,
// i.longName,
// w.id warehouseFk,
// p.name producer,
// i.size,
// i.category,
// w.name warehouse,
// SUM(IFNULL(sub.amount,0)) lack,
// i.inkFk,
// IFNULL(im.timed, util.midnight()) timed,
// IFNULL(izc.timed, util.midnight()) minTimed
// FROM (SELECT item_id,
// warehouse_id,
// amount
// FROM cache.stock
// WHERE amount > 0
// UNION ALL
// SELECT itemFk,
// warehouseFk,
// amount
// FROM tmp.itemMinacum
// ) sub
// JOIN warehouse w ON w.id = sub.warehouse_id
// JOIN item i ON i.id = sub.item_id
// LEFT JOIN producer p ON p.id = i.producerFk
// JOIN itemType it ON it.id = i.typeFk
// JOIN itemCategory ic ON ic.id = it.categoryFk
// LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
// LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
// WHERE w.isForTicket
// AND ic.display
// AND it.code != 'GEN'
// `);
stmt.merge(`
GROUP BY i.id, w.id
HAVING lack < 0`
);
stmt.merge(conn.makeSuffix(filter));
const itemsIndex = stmts.push(stmt) - 1;
stmts.push(
`DROP TEMPORARY TABLE
tmp.itemMinacum,
tmp.itemMinETD,
tmp.itemZoneClosure`);
// const sqlWhere = conn.makeWhere(where);
// stmt.merge(sqlWhere);
// stmt.merge(`
// GROUP BY i.id, w.id
// HAVING lack < 0;`
// );
// stmts.push(`
// DROP TEMPORARY TABLE tmp.itemMinacum;
// DROP TEMPORARY TABLE tmp.itemMinETD;
// DROP TEMPORARY TABLE tmp.itemZoneClosure;
// `);
// stmt.merge(conn.makeSuffix(filter));
// const itemsIndex = stmts.push(stmt) - 1;
// const sql = ParameterizedSQL.join(stmts, ';');
// const result = await conn.executeStmt(sql, myOptions);
// return itemsIndex === 0 ? result : result[itemsIndex];
// }
return [
{
'itemFk': 72176,
'longName': 'Anthurium Olivius x20',
'warehouseFk': 60,
'producer': null,
'size': null,
'category': null,
'warehouse': 'Algemesi',
'lack': -40,
'inkFk': 'VRD',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 14613,
'longName': 'Crisantemo Uniflora Anastasia Topsin',
'warehouseFk': 60,
'producer': null,
'size': 70,
'category': null,
'warehouse': 'Algemesi',
'lack': -10,
'inkFk': 'BLN',
'timed': '2024-01-19T15:20:00.000Z',
'minTimed': '16:20'
},
{
'itemFk': 28619,
'longName': 'Clavel Mix Fancy',
'warehouseFk': 60,
'producer': 'Benchmark',
'size': 60,
'category': 'Fan',
'warehouse': 'Algemesi',
'lack': -700,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 29422,
'longName': 'Lisianthus Doble Green',
'warehouseFk': 60,
'producer': 'L.I.S.',
'size': 65,
'category': null,
'warehouse': 'Algemesi',
'lack': -10,
'inkFk': 'VRC',
'timed': '2024-01-19T16:00:00.000Z',
'minTimed': '17:00'
},
{
'itemFk': 29590,
'longName': 'Schlumbergera (3 Colors)',
'warehouseFk': 60,
'producer': 'Gartneriet Thoruplund',
'size': 18,
'category': null,
'warehouse': 'Algemesi',
'lack': -18,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 33636,
'longName': 'Antirrinum Lavander',
'warehouseFk': 60,
'producer': null,
'size': 80,
'category': null,
'warehouse': 'Algemesi',
'lack': -10,
'inkFk': 'LAV',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 36864,
'longName': 'Kattegrass (Comida para gatos)',
'warehouseFk': 60,
'producer': 'Willem Jongenotter Kw.',
'size': 10,
'category': null,
'warehouse': 'Algemesi',
'lack': -10,
'inkFk': 'VRD',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 38631,
'longName': 'Triple Accion Listo Uso',
'warehouseFk': 60,
'producer': 'Flower',
'size': null,
'category': 'ml',
'warehouse': 'Algemesi',
'lack': -24,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 53233,
'longName': 'Clavel Cheerio Fancy',
'warehouseFk': 60,
'producer': 'Benchmark',
'size': 60,
'category': 'Fan',
'warehouse': 'Algemesi',
'lack': -50,
'inkFk': 'R\/B',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 60525,
'longName': 'Rosa Explorer Extra',
'warehouseFk': 60,
'producer': 'Floraroma',
'size': 60,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -500,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 68998,
'longName': 'Clavel Hot Pink Select',
'warehouseFk': 60,
'producer': 'Funza',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -25,
'inkFk': 'FUC',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 77807,
'longName': 'Hydrangea Mix 4Flo',
'warehouseFk': 60,
'producer': 'Schroll-Flowers',
'size': 35,
'category': null,
'warehouse': 'Algemesi',
'lack': -6,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 84883,
'longName': 'Rosa Freedom Standard',
'warehouseFk': 60,
'producer': 'El Milagro',
'size': 40,
'category': 'Sta',
'warehouse': 'Algemesi',
'lack': -600,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 92466,
'longName': 'Clavel Kino Select',
'warehouseFk': 60,
'producer': 'Funza',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -25,
'inkFk': 'P\/B',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 93355,
'longName': 'Clavel Caramel Fancy',
'warehouseFk': 60,
'producer': 'Funza',
'size': 60,
'category': 'Fan',
'warehouse': 'Algemesi',
'lack': -50,
'inkFk': 'TRR',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 95068,
'longName': 'Alstroemeria Fifi Plus',
'warehouseFk': 60,
'producer': 'Funza',
'size': 80,
'category': 'Plu',
'warehouse': 'Algemesi',
'lack': -30,
'inkFk': 'SWE',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 107891,
'longName': 'Rosa Freedom Select',
'warehouseFk': 60,
'producer': 'Excellence',
'size': 40,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -1000,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 113163,
'longName': 'Lilium Oriental Roselily Aisha 2',
'warehouseFk': 60,
'producer': 'Moerman Lilium BV',
'size': 65,
'category': null,
'warehouse': 'Algemesi',
'lack': -10,
'inkFk': 'BLN',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 117832,
'longName': 'Rosa Freedom Standard',
'warehouseFk': 60,
'producer': 'Multiflora',
'size': 50,
'category': 'Sta',
'warehouse': 'Algemesi',
'lack': -200,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 123005,
'longName': 'Rosa Orange Crush Extra',
'warehouseFk': 60,
'producer': 'Trebol',
'size': 50,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -125,
'inkFk': 'NAR',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 123380,
'longName': 'Clavel Hypnosis Standard',
'warehouseFk': 60,
'producer': 'GEOFLORA',
'size': 50,
'category': 'Sta',
'warehouse': 'Algemesi',
'lack': -25,
'inkFk': 'LAV',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 124948,
'longName': 'Cymbidium Mon Amour',
'warehouseFk': 60,
'producer': 'New Orchids',
'size': 60,
'category': null,
'warehouse': 'Algemesi',
'lack': -1,
'inkFk': 'BLN',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 125062,
'longName': 'Hoya Kerri Cerámica',
'warehouseFk': 60,
'producer': 'Gartneriet Lundager',
'size': 15,
'category': null,
'warehouse': 'Algemesi',
'lack': -18,
'inkFk': 'VRD',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 125593,
'longName': 'Hoya Kerri Cerámica Roja',
'warehouseFk': 60,
'producer': 'v.d. Arend Tropical',
'size': 12,
'category': null,
'warehouse': 'Algemesi',
'lack': -1,
'inkFk': 'VRD',
'timed': '2024-01-19T15:20:00.000Z',
'minTimed': '16:20'
},
{
'itemFk': 126428,
'longName': 'Rosa Freedom Extra',
'warehouseFk': 60,
'producer': 'Matina',
'size': 50,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -25,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 128417,
'longName': 'Rosa Brighton Select',
'warehouseFk': 60,
'producer': 'Excellence',
'size': 50,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -75,
'inkFk': 'AMA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 132651,
'longName': 'Rosa Freedom Select',
'warehouseFk': 60,
'producer': 'Excellence',
'size': 60,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -1250,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 135194,
'longName': 'Eucalipto Torreliana Small',
'warehouseFk': 60,
'producer': null,
'size': 40,
'category': null,
'warehouse': 'Algemesi',
'lack': -20,
'inkFk': 'M\/V',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 135516,
'longName': 'Hydrangea Curaçao Petite',
'warehouseFk': 60,
'producer': 'Flores del Este',
'size': 60,
'category': 'Pet',
'warehouse': 'Algemesi',
'lack': -15,
'inkFk': 'AZL',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 136169,
'longName': 'Hydrangea Turquesa Jumbo',
'warehouseFk': 60,
'producer': null,
'size': 0,
'category': null,
'warehouse': 'Algemesi',
'lack': -1,
'inkFk': 'TUR',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 136518,
'longName': 'Rosa Freedom Select',
'warehouseFk': 60,
'producer': 'Excellence',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -200,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 136733,
'longName': 'Rosa LightHouse Premium',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 50,
'category': 'Pre',
'warehouse': 'Algemesi',
'lack': -100,
'inkFk': 'AMA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137200,
'longName': 'Rosa Luciano Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 50,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -250,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137203,
'longName': 'Rosa Satina Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 40,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -600,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137204,
'longName': 'Rosa Satina Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 50,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -125,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137207,
'longName': 'Rosa Mix Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 40,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -875,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137213,
'longName': 'Rosa Vendela Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 40,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -1800,
'inkFk': 'BLN',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137233,
'longName': 'Rosa Freedom Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 40,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -1200,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137234,
'longName': 'Rosa Freedom Extra',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 50,
'category': 'Ext',
'warehouse': 'Algemesi',
'lack': -600,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 137748,
'longName': 'Clavel Mini Hot Pink Select',
'warehouseFk': 60,
'producer': null,
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -20,
'inkFk': 'FUC',
'timed': '2024-01-19T12:45:00.000Z',
'minTimed': '13:45'
},
{
'itemFk': 137814,
'longName': 'Rosa Freedom Premium',
'warehouseFk': 60,
'producer': 'Santa Dorotea',
'size': 80,
'category': 'Pre',
'warehouse': 'Algemesi',
'lack': -1200,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 139016,
'longName': 'Cesta Cassius',
'warehouseFk': 60,
'producer': 'Mega Ceramics',
'size': 29,
'category': null,
'warehouse': 'Algemesi',
'lack': -2,
'inkFk': 'NAT',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 142330,
'longName': 'Rosa Glam Dome Rosa',
'warehouseFk': 60,
'producer': null,
'size': 0,
'category': null,
'warehouse': 'Algemesi',
'lack': -3,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 142331,
'longName': 'Rosa Glam Dome Rojo',
'warehouseFk': 60,
'producer': null,
'size': 0,
'category': null,
'warehouse': 'Algemesi',
'lack': -6,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143511,
'longName': 'Clavel White Florafil Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -200,
'inkFk': 'BLN',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143512,
'longName': 'Clavel Red Florafil Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -200,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143513,
'longName': 'Clavel Lege Pink Florafil Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -200,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143556,
'longName': 'Clavel Mini White Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -400,
'inkFk': 'BLN',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143557,
'longName': 'Clavel Mini Red Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -400,
'inkFk': 'ROJ',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143575,
'longName': 'Clavel Mini Bicolor Mix Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -2000,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143697,
'longName': 'Syngonium Rosa Colgante',
'warehouseFk': 60,
'producer': 'Quakelplant BV',
'size': 35,
'category': null,
'warehouse': 'Algemesi',
'lack': -3,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143833,
'longName': 'Cymbidium Magic',
'warehouseFk': 60,
'producer': 'HVS Orchids',
'size': 50,
'category': null,
'warehouse': 'Algemesi',
'lack': -3,
'inkFk': 'BLN',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143918,
'longName': 'Ranunculus Sprinkles Mix',
'warehouseFk': 60,
'producer': 'Firma P.A.M. van Os',
'size': 27,
'category': null,
'warehouse': 'Algemesi',
'lack': -12,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 143923,
'longName': 'Dieff se Tropic Snow 2 Plantas',
'warehouseFk': 60,
'producer': 'Floramiata',
'size': 80,
'category': null,
'warehouse': 'Algemesi',
'lack': -1,
'inkFk': 'VRD',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 144034,
'longName': 'Clavel Pink Florafil Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -200,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 144035,
'longName': 'Clavel Bicolor Mix Florafil Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -2000,
'inkFk': 'MIX',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
},
{
'itemFk': 144115,
'longName': 'Clavel Mini Hot Pink Select',
'warehouseFk': 60,
'producer': 'Colibri',
'size': 70,
'category': 'Sel',
'warehouse': 'Algemesi',
'lack': -400,
'inkFk': 'RSA',
'timed': '2024-01-19T22:59:59.000Z',
'minTimed': '2024-01-19 23:59:59'
}];
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
return itemsIndex === 0 ? result : result[itemsIndex];
};
};