mirror of
https://github.com/mohamadihsan/topuponline.git
synced 2026-12-06 19:56:27 +00:00
update
This commit is contained in:
@@ -288,6 +288,10 @@ const insertLoadingBalance = async (
|
||||
.insert(data)
|
||||
.returning('i_load_balance')
|
||||
.then((resp) => {
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} inserting loading balance 1 ${JSON.stringify(resp)}`
|
||||
);
|
||||
|
||||
let id = resp[0];
|
||||
let loadDetail = [];
|
||||
detail.forEach((element) => {
|
||||
@@ -313,6 +317,8 @@ const insertLoadingBalance = async (
|
||||
.insert(loadDetail);
|
||||
})
|
||||
.then(() => {
|
||||
winston.logger.warn(`${uniqueCode} inserting loading balance 2...}`);
|
||||
|
||||
// insert load balance history
|
||||
return knex('trx.t_d_load_balance_history')
|
||||
.transacting(trx)
|
||||
@@ -320,6 +326,12 @@ const insertLoadingBalance = async (
|
||||
.insert(data);
|
||||
})
|
||||
.then((history) => {
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} inserting loading balance 3 ${JSON.stringify(
|
||||
history
|
||||
)}`
|
||||
);
|
||||
|
||||
let id = history[0];
|
||||
let loadDetail = [];
|
||||
detail.forEach((element) => {
|
||||
@@ -345,6 +357,8 @@ const insertLoadingBalance = async (
|
||||
.insert(loadDetail);
|
||||
})
|
||||
.then(() => {
|
||||
winston.logger.warn(`${uniqueCode} inserting loading balance 4...}`);
|
||||
|
||||
// update reservation
|
||||
return knex('trx.t_d_reservation_balance')
|
||||
.transacting(trx)
|
||||
@@ -363,6 +377,8 @@ const insertLoadingBalance = async (
|
||||
.whereIn('c_reservation_no', reservationNumber);
|
||||
})
|
||||
.then(() => {
|
||||
winston.logger.warn(`${uniqueCode} inserting loading balance 5...}`);
|
||||
|
||||
// delete flag counting
|
||||
return knex('trx.t_d_flag_counting')
|
||||
.transacting(trx)
|
||||
@@ -371,6 +387,8 @@ const insertLoadingBalance = async (
|
||||
.del();
|
||||
})
|
||||
.then(() => {
|
||||
winston.logger.warn(`${uniqueCode} inserting loading balance 6...}`);
|
||||
|
||||
// insert flag counting
|
||||
return knex('trx.t_d_flag_counting').transacting(trx).insert({
|
||||
d_request: now,
|
||||
@@ -380,7 +398,13 @@ const insertLoadingBalance = async (
|
||||
c_flag: flag,
|
||||
});
|
||||
})
|
||||
.then(trx.commit)
|
||||
.then(() => {
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} inserting loading balance 7 COMMIT... }`
|
||||
);
|
||||
|
||||
trx.commit;
|
||||
})
|
||||
.catch((err) => {
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} ERRORRRRRRR ROLLBACK ${JSON.stringify(err.message)}`
|
||||
@@ -389,13 +413,19 @@ const insertLoadingBalance = async (
|
||||
});
|
||||
})
|
||||
.then((result) => {
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} inserting loading balance 8 ${JSON.stringify(result)}`
|
||||
);
|
||||
|
||||
// console.log(result);
|
||||
return result;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error.message);
|
||||
winston.logger.warn(
|
||||
`${uniqueCode} ERRORRRRRRR CATCH ${JSON.stringify(err.message)}`
|
||||
`${uniqueCode} inserting loadbalance 9 ERRORRRRRRR CATCH ${JSON.stringify(
|
||||
err.message
|
||||
)}`
|
||||
);
|
||||
return error.message;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user