优化
This commit is contained in:
@@ -91,6 +91,19 @@ async function verifyTruckDeparturePayables(context, aggregate) {
|
||||
&& row.direction === 'PAYABLE' && row.reviewStatus === 'APPROVED'
|
||||
&& Math.round(Number(row.amount) * 100) === Math.round(Number(fees.get(id(row.sourceFeeId)).amount) * 100)),
|
||||
`expected=${fees.size}, imported=${imported.size}`, OPTIONS)
|
||||
const candidates = new Map()
|
||||
for (const customer of new Set([...fees.values()].map(fee => id(fee.tenantId)))) {
|
||||
const response = await request(context, 'GET', `/api/platform/finance/v1/fee-pool?customerId=${customer}&direction=PAYABLE&supplierId=${id(truck.carrierId)}`)
|
||||
const rows = context.apiSuccess(MODULE, '回查拖车费可用于应付结算', response, '', OPTIONS)
|
||||
for (const row of Array.isArray(rows) ? rows : []) {
|
||||
if (row.sourceType === 'CONTAINER_FEE' && fees.has(id(row.sourceId))) candidates.set(id(row.sourceId), row)
|
||||
}
|
||||
}
|
||||
context.assert(MODULE, '拖车费已进入应付结算候选且未付款', null,
|
||||
candidates.size === fees.size && [...candidates.values()].every(row => row.direction === 'PAYABLE'
|
||||
&& row.settlementMode === 'ON_ACCOUNT' && row.status === 'AVAILABLE' && !row.paidAt
|
||||
&& Math.round(Number(row.amount) * 100) === Math.round(Number(fees.get(id(row.sourceId)).amount) * 100)),
|
||||
`expected=${fees.size}, candidates=${candidates.size}`, OPTIONS)
|
||||
}
|
||||
|
||||
export async function run(context) {
|
||||
|
||||
Reference in New Issue
Block a user