updated array to handle
This commit is contained in:
parent
76a07a0451
commit
6fc32672f5
@ -471,13 +471,11 @@ export class HomePageService {
|
|||||||
|
|
||||||
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`)
|
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`)
|
||||||
|
|
||||||
let GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY');
|
// let GLARRAY = await connection.getDbObjectClass('CARNETSYS.GLARRAY');
|
||||||
const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE');
|
const GLTABLE = await connection.getDbObjectClass('CARNETSYS.GLTABLE');
|
||||||
const CARNETCOUNTRYARRAY = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYARRAY');
|
// const CARNETCOUNTRYARRAY = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYARRAY');
|
||||||
const CARNETCOUNTRYTABLE = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYTABLE');
|
const CARNETCOUNTRYTABLE = await connection.getDbObjectClass('CARNETSYS.CARNETCOUNTRYTABLE');
|
||||||
|
|
||||||
console.log("here ------------ 2");
|
|
||||||
|
|
||||||
// Check if GLTABLE is a constructor
|
// Check if GLTABLE is a constructor
|
||||||
if (typeof GLTABLE !== 'function') {
|
if (typeof GLTABLE !== 'function') {
|
||||||
throw new Error('GLTABLE is not a constructor');
|
throw new Error('GLTABLE is not a constructor');
|
||||||
@ -487,45 +485,17 @@ export class HomePageService {
|
|||||||
throw new Error('CARNETCOUNTRYTABLE is not a constructor');
|
throw new Error('CARNETCOUNTRYTABLE is not a constructor');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("here ------------ 3");
|
|
||||||
// console.log(finalBody);
|
|
||||||
|
|
||||||
let k = new GLARRAY(1, 'Description for itemno 1', 2500, 20,12,'LBS','US')
|
|
||||||
|
|
||||||
// return {k}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const GLTABLE_ARRAY = finalBody.p_gltable ? await Promise.all(finalBody.p_gltable.map(async (x:p_gltableDTO) => {
|
const GLTABLE_ARRAY = finalBody.p_gltable ? await Promise.all(finalBody.p_gltable.map(async (x:p_gltableDTO) => {
|
||||||
return await createGLArrayInstance(connection, x.ItemNo, x.ItemDescription, x.ItemValue, x.Noofpieces, x.ItemWeight, x.ItemWeightUOM, x.GoodsOriginCountry);
|
return await createGLArrayInstance(connection, x.ItemNo, x.ItemDescription, x.ItemValue, x.Noofpieces, x.ItemWeight, x.ItemWeightUOM, x.GoodsOriginCountry);
|
||||||
})) : [];
|
})) : [];
|
||||||
|
|
||||||
console.log("here ------------ 4");
|
|
||||||
|
|
||||||
const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable ? await Promise.all(finalBody.p_countrytable.map(async (x) => {
|
const CARNETCOUNTRYTABLE_ARRAY = finalBody.p_countrytable ? await Promise.all(finalBody.p_countrytable.map(async (x) => {
|
||||||
return await createCarnetCountryArrayInstance(connection, x.VisitTransitInd, x.CountryCode, x.NoOfTimesEntLeave);
|
return await createCarnetCountryArrayInstance(connection, x.VisitTransitInd, x.CountryCode, x.NoOfTimesEntLeave);
|
||||||
})) : [];
|
})) : [];
|
||||||
|
|
||||||
console.log("CARNETCOUNTRYTABLE_ARRAY : ", CARNETCOUNTRYTABLE_ARRAY[0], CARNETCOUNTRYTABLE_ARRAY[1]);
|
|
||||||
|
|
||||||
|
|
||||||
console.log("here ------------ 5");
|
|
||||||
|
|
||||||
// Create an instance of GLTABLE
|
|
||||||
const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY);
|
const GLTABLE_INSTANCE = new GLTABLE(GLTABLE_ARRAY);
|
||||||
const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(CARNETCOUNTRYTABLE_ARRAY);
|
const CARNETCOUNTRYTABLE_INSTANCE = new CARNETCOUNTRYTABLE(CARNETCOUNTRYTABLE_ARRAY);
|
||||||
|
|
||||||
console.log(finalBody);
|
|
||||||
console.log(GLTABLE_INSTANCE);
|
|
||||||
console.log(CARNETCOUNTRYTABLE_INSTANCE);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log("here ------------ 6");
|
|
||||||
|
|
||||||
// return { GLTABLE_INSTANCE, CARNETCOUNTRYTABLE_INSTANCE };
|
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
CARNETAPPLICATION_PKG.SaveCarnetApplication(
|
CARNETAPPLICATION_PKG.SaveCarnetApplication(
|
||||||
@ -679,8 +649,6 @@ export class HomePageService {
|
|||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
// let fres = await result.outBinds.P_cursor.getRows();
|
|
||||||
|
|
||||||
if (result.outBinds && result.outBinds.P_cursor) {
|
if (result.outBinds && result.outBinds.P_cursor) {
|
||||||
const cursor = result.outBinds.P_cursor;
|
const cursor = result.outBinds.P_cursor;
|
||||||
let rowsBatch;
|
let rowsBatch;
|
||||||
@ -698,8 +666,6 @@ export class HomePageService {
|
|||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
|
||||||
// return fres
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
console.error('Error fetching users: ', err);
|
||||||
return { error: err.message }
|
return { error: err.message }
|
||||||
|
|||||||
@ -56,14 +56,11 @@ export class ManageHoldersService {
|
|||||||
throw new Error('No DB Connected')
|
throw new Error('No DB Connected')
|
||||||
}
|
}
|
||||||
|
|
||||||
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name IN ('GLARRAY', 'GLTABLE')`)
|
|
||||||
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name LIKE '%CONTACT%'`);
|
// let res = await connection.execute(`SELECT owner, type_name FROM all_types WHERE type_name LIKE '%CONTACT%'`);
|
||||||
|
|
||||||
// return { res:res.rows };
|
// return { res:res.rows };
|
||||||
|
|
||||||
// contactstable
|
// const CONTACTSARRAY = await connection.getDbObjectClass('CARNETSYS.CONTACTSARRAY');
|
||||||
|
|
||||||
const CONTACTSARRAY = await connection.getDbObjectClass('CARNETSYS.CONTACTSARRAY');
|
|
||||||
const CONTACTSTABLE = await connection.getDbObjectClass('CARNETSYS.CONTACTSTABLE');
|
const CONTACTSTABLE = await connection.getDbObjectClass('CARNETSYS.CONTACTSTABLE');
|
||||||
|
|
||||||
// Check if GLTABLE is a constructor
|
// Check if GLTABLE is a constructor
|
||||||
@ -71,12 +68,29 @@ export class ManageHoldersService {
|
|||||||
throw new Error('CONTACTSTABLE is not a constructor');
|
throw new Error('CONTACTSTABLE is not a constructor');
|
||||||
}
|
}
|
||||||
|
|
||||||
const CONTACTSTABLE_ARRAY = finalBody.p_contactstable ? finalBody.p_contactstable.map((x: p_contactstableDTO) => {
|
async function CREATECONTACTSTABLE_INSTANCE(connection, FirstName, LastName, MiddleInitial, Title, EmailAddress, PhoneNo, MobileNo, FaxNo) {
|
||||||
return new CONTACTSARRAY(x.FirstName, x.LastName, x.MiddleInitial, x.Title, x.EmailAddress, x.PhoneNo, x.MobileNo, x.FaxNo)
|
const result = await connection.execute(
|
||||||
}) : [];
|
`SELECT CARNETSYS.CONTACTSARRAY(:FirstName, :LastName, :MiddleInitial, :Title, :EmailAddress, :PhoneNo, :MobileNo, :FaxNo) FROM dual`,
|
||||||
|
{
|
||||||
|
FirstName,
|
||||||
|
LastName,
|
||||||
|
MiddleInitial,
|
||||||
|
Title,
|
||||||
|
EmailAddress,
|
||||||
|
PhoneNo,
|
||||||
|
MobileNo,
|
||||||
|
FaxNo
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return result.rows[0][0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const CONTACTSARRAY = finalBody.p_contactstable ? await Promise.all(finalBody.p_contactstable.map(async (x: p_contactstableDTO) => {
|
||||||
|
return await CREATECONTACTSTABLE_INSTANCE(connection, x.FirstName, x.LastName, x.MiddleInitial, x.Title, x.EmailAddress, x.PhoneNo, x.MobileNo, x.FaxNo);
|
||||||
|
})) : [];
|
||||||
|
|
||||||
// Create an instance of GLTABLE
|
// Create an instance of GLTABLE
|
||||||
const CONTACTSTABLE_INSTANCE = new CONTACTSTABLE(CONTACTSTABLE_ARRAY);
|
const CONTACTSTABLE_INSTANCE = new CONTACTSTABLE(CONTACTSARRAY);
|
||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
@ -184,6 +198,7 @@ export class ManageHoldersService {
|
|||||||
outFormat: oracledb.OUT_FORMAT_OBJECT
|
outFormat: oracledb.OUT_FORMAT_OBJECT
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
// let fres = await result.outBinds.P_cursor.getRows();
|
// let fres = await result.outBinds.P_cursor.getRows();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user