feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint

This commit is contained in:
Dave
2025-11-07 11:01:56 -05:00
parent d6b295855d
commit a788beaa19
8 changed files with 362 additions and 322 deletions

View File

@@ -14,16 +14,13 @@ async function exportJobToRR(args) {
const log = RRLogger(socket, { ns: "rr-export" });
if (!bodyshop) throw new Error("exportJobToRR: bodyshop is required");
if (!job) throw new Error("exportJobToRR: job is required");
if (advisorNo == null || String(advisorNo).trim() === "") {
throw new Error("exportJobToRR: advisorNo is required for RR");
}
// Resolve customer number (accept multiple shapes)
const selected = selectedCustomer?.customerNo;
const selected = selectedCustomer?.customerNo || selectedCustomer?.custNo;
if (!selected) throw new Error("exportJobToRR: selectedCustomer.custNo/customerNo is required");
const { client, opts } = buildClientAndOpts(bodyshop);
@@ -43,7 +40,6 @@ async function exportJobToRR(args) {
let svId = null;
if (!existing?.dmsRepairOrderId) {
try {
// Provide both customerNo and custNo for safety
const svRes = await ensureRRServiceVehicle({
bodyshop,
job,
@@ -58,10 +54,10 @@ async function exportJobToRR(args) {
}
}
// Build RO payload (now includes both customerNo & custNo; advisorNo & advNo)
// Build RO payload (now includes DeptType/departmentType + variants)
const payload = buildRRRepairOrderPayload({
job,
selectedCustomer: { customerNo: String(selected) },
selectedCustomer: { customerNo: String(selected), custNo: String(selected) },
advisorNo: String(advisorNo)
});