This commit is contained in:
Nuranggi Hermawan
2022-12-08 15:18:53 +07:00
parent 1ae4fc3b27
commit 0463fd1874
2 changed files with 17 additions and 10 deletions
@@ -172,11 +172,11 @@ const _generateCashIn = async (uniqueCode) => {
const paymentyHistory = await model.writePaynentHistory(dataCahsIn, "SUCCESSFULLY", 0, trx)
// Insert cahs in detail
// let data = []
let data = []
const reserv = await model.getReserve(trx, item.c_partner_code, item.d_payment)
await wait(1000)
for (const detail of reserv) {
let data = {
data.push({
i_cash_in : cashIn.i_cash_in,
c_reservation_no : detail.c_reservation_no,
m_amount : detail.i_reservation_amount,
@@ -184,7 +184,7 @@ const _generateCashIn = async (uniqueCode) => {
d_payment : detail.d_payment,
d_payment_recon : detail.d_payment_recon,
c_load_balance_no : detail.c_load_balance_no
}
})
let reserveNo = detail.c_reservation_no
@@ -194,13 +194,12 @@ const _generateCashIn = async (uniqueCode) => {
c_in_period : cashIn.c_in_period,
}
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} UPDATE CASH-IN TO RESERVE ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
await model.updateIntoReserve(trx, dataReserve, reserveNo)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN TO RESERVE ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
await model.insertCashInDetail(trx, data)
}
await wait(1000)
winston.logger.info(`SCHEDULER-FB70-${uniqueCode} INSERT CASH-IN TO RESERVE ${code} DATA : ${JSON.stringify(dataCahsIn)}`)
await model.insertCashInDetail(trx, data)
// await model.insertPostingEt(code, item, trx)
})
@@ -270,6 +269,11 @@ console.log(xmlRequest)
}
function wait(milliseconds) {
return new Promise(resolve => setTimeout(resolve, milliseconds));
}
module.exports = {
validate,
apiGenerateCahsIn,
+4 -1
View File
@@ -319,7 +319,10 @@ const generateCode = async (trx, c_partner_code, d_payment_recon) => {
}
const insertCashInDetail = async (trx, data) => {
let result = await trx('payment.t_d_cash_in_detail').insert(data,["*"])
let result = []
if(data.length > 0){
result = await trx('payment.t_d_cash_in_detail').insert(data,["*"])
}
return result
}