IO-233 CDK Updates.
This commit is contained in:
@@ -86,11 +86,13 @@ export function DmsCustomerSelector({ bodyshop }) {
|
||||
//dataIndex: ["name2", "fullName"],
|
||||
key: "address",
|
||||
render: (record, value) =>
|
||||
`${record.address && record.address.addressLine[0]}, ${
|
||||
record.address && record.address.city
|
||||
} ${record.address && record.address.stateOrProvince} ${
|
||||
record.address && record.address.postalCode
|
||||
}`,
|
||||
`${
|
||||
record.address &&
|
||||
record.address.addressLine &&
|
||||
record.address.addressLine[0]
|
||||
}, ${record.address && record.address.city} ${
|
||||
record.address && record.address.stateOrProvince
|
||||
} ${record.address && record.address.postalCode}`,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -54,18 +54,21 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
|
||||
|
||||
const DMSVehCustomer =
|
||||
socket.DMSVeh &&
|
||||
socket.DMSVeh.owners &&
|
||||
socket.DMSVeh.owners.find((o) => o.id.assigningPartyId === "CURRENT");
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{2.2} Querying the Customer using the ID from DMSVeh: ${DMSVehCustomer.id.value}`
|
||||
);
|
||||
socket.DMSVehCustomer = await QueryDmsCustomerById(
|
||||
socket,
|
||||
JobData,
|
||||
DMSVehCustomer.id.value
|
||||
);
|
||||
if (DMSVehCustomer && DMSVehCustomer.id && DMSVehCustomer.id.value) {
|
||||
CdkBase.createLogEvent(
|
||||
socket,
|
||||
"DEBUG",
|
||||
`{2.2} Querying the Customer using the ID from DMSVeh: ${DMSVehCustomer.id.value}`
|
||||
);
|
||||
socket.DMSVehCustomer = await QueryDmsCustomerById(
|
||||
socket,
|
||||
JobData,
|
||||
DMSVehCustomer.id.value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
CdkBase.createLogEvent(
|
||||
@@ -771,26 +774,44 @@ async function UpdateDmsVehicle(socket) {
|
||||
|
||||
let ids = [];
|
||||
|
||||
const existingOwnerinVeh = socket.DMSVeh.owners.filter(
|
||||
(o) => o.id.value === socket.DMSCust.id.value
|
||||
);
|
||||
const existingOwnerinVeh =
|
||||
socket.DMSVeh &&
|
||||
socket.DMSVeh.owners &&
|
||||
socket.DMSVeh.owners.find((o) => o.id.value === socket.DMSCust.id.value);
|
||||
|
||||
if (existingOwnerinVeh) {
|
||||
ids = socket.DMSVeh.owners.filter(
|
||||
(o) => o.id.value === socket.DMSCust.id.value
|
||||
);
|
||||
ids = socket.DMSVeh.owners.map((o) => {
|
||||
return {
|
||||
id: {
|
||||
assigningPartyId:
|
||||
o.id.value === socket.dmsCust.id.value ? "CURRENT" : "PREVIOUS",
|
||||
value: o.id.value,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else {
|
||||
const oldOwner =
|
||||
socket.DMSVeh &&
|
||||
socket.DMSVeh.owners &&
|
||||
socket.DMSVeh.owners.find((o) => o.id.assigningPartyId === "CURRENT");
|
||||
|
||||
ids = [
|
||||
{
|
||||
assigningPartyId: "CURRENT",
|
||||
value: socket.DMSCust.id.value,
|
||||
id: {
|
||||
assigningPartyId: "CURRENT",
|
||||
value: socket.DMSCust.id.value,
|
||||
},
|
||||
},
|
||||
...socket.DMSVeh.owners.map((o) => {
|
||||
return {
|
||||
assigningPartyId: "PREVIOUS",
|
||||
value: o.id.value,
|
||||
};
|
||||
}),
|
||||
...(oldOwner
|
||||
? [
|
||||
{
|
||||
id: {
|
||||
assigningPartyId: "PREVIOUS",
|
||||
value: oldOwner.id.value,
|
||||
},
|
||||
},
|
||||
]
|
||||
: []),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -812,7 +833,7 @@ async function UpdateDmsVehicle(socket) {
|
||||
socket.DMSVeh.vehicle.deliveryDate
|
||||
).toISOString(),
|
||||
},
|
||||
owners: { ids: ids },
|
||||
owners: ids,
|
||||
},
|
||||
arg3: "VEHICLES",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user