feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration / RRScratch2 / Checkpoint
This commit is contained in:
@@ -116,18 +116,25 @@ const exportJobToRR = async (args) => {
|
||||
|
||||
// 2) Allocations (sales + cost by center, with rr_* metadata already attached)
|
||||
try {
|
||||
allocations = await CdkCalculateAllocations(socket, job.id);
|
||||
const allocResult = await CdkCalculateAllocations(socket, job.id);
|
||||
|
||||
// We only need the per-center job allocations for RO.GOG / ROLABOR.
|
||||
allocations = Array.isArray(allocResult?.jobAllocations) ? allocResult.jobAllocations : [];
|
||||
|
||||
CreateRRLogEvent(socket, "SILLY", "RR allocations resolved", {
|
||||
hasAllocations: Array.isArray(allocations),
|
||||
count: Array.isArray(allocations) ? allocations.length : 0
|
||||
hasAllocations: allocations.length > 0,
|
||||
count: allocations.length,
|
||||
taxAllocCount: Array.isArray(allocResult?.taxAllocArray) ? allocResult.taxAllocArray.length : 0,
|
||||
ttlAdjCount: Array.isArray(allocResult?.ttlAdjArray) ? allocResult.ttlAdjArray.length : 0,
|
||||
ttlTaxAdjCount: Array.isArray(allocResult?.ttlTaxAdjArray) ? allocResult.ttlTaxAdjArray.length : 0
|
||||
});
|
||||
} catch (e) {
|
||||
CreateRRLogEvent(socket, "ERROR", "Failed to calculate RR allocations", {
|
||||
message: e?.message,
|
||||
stack: e?.stack
|
||||
});
|
||||
allocations = null; // We still proceed with a header-only RO if this fails.
|
||||
// Proceed with a header-only RO if allocations fail.
|
||||
allocations = [];
|
||||
}
|
||||
|
||||
// 3) OpCode (global, but overridable)
|
||||
|
||||
Reference in New Issue
Block a user