Add notification of complete export.

This commit is contained in:
Patrick Fic
2022-11-03 08:25:44 -07:00
parent 6354ccee87
commit b3ed9106f0
8 changed files with 147 additions and 60 deletions

View File

@@ -66,7 +66,13 @@ async function PbsCalculateAllocationsAp(socket, billids) {
//Each bill will enter it's own top level transaction.
const transactionlist = [];
if (bills.length === 0) {
CdkBase.createLogEvent(
socket,
"ERROR",
`No bills found for export. Ensure they have not already been exported and try again.`
);
}
bills.forEach((bill) => {
//Keep the allocations at the bill level.
@@ -240,10 +246,15 @@ exports.PbsExportAp = async function (socket, { billids, txEnvelope }) {
CdkBase.createLogEvent(socket, "DEBUG", `Marking bill as exported.`);
await MarkApExported(socket, [billid]);
// socket.emit("export-success", billids);
socket.emit("ap-export-success", billid);
} else {
CdkBase.createLogEvent(socket, "ERROR", `Export was not succesful.`);
socket.emit("ap-export-failure", {
billid,
error: AccountPostingChange.Message,
});
}
socket.emit("ap-export-complete");
}
};

View File

@@ -1659,7 +1659,7 @@ query GET_PBS_AP_ALLOCATIONS($billids: [uuid!]) {
pbs_serialnumber
id
}
bills(where: {id: {_in: $billids}}) {
bills(where: {id: {_in: $billids}, exported:{_eq: false}}) {
id
date
isinhouse
@@ -1692,6 +1692,4 @@ query GET_PBS_AP_ALLOCATIONS($billids: [uuid!]) {
}
}
}
`;