feat(labeling): added printers and machine and other data for preprinting
This commit is contained in:
29
app/src/pkg/utils/getMachineInfo.ts
Normal file
29
app/src/pkg/utils/getMachineInfo.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { createLogger } from "../logger/logger.js";
|
||||
import { prodQuery } from "../prodSql/prodQuery.js";
|
||||
import { machineCheck } from "../prodSql/querys/general/machineInfo.js";
|
||||
|
||||
export const getMachineData = async (machine: string) => {
|
||||
const log = createLogger({
|
||||
module: "logistics",
|
||||
subModule: "preprint",
|
||||
});
|
||||
let updateQuery = machineCheck.replaceAll("[loc]", machine!);
|
||||
|
||||
if (machine === "all") {
|
||||
updateQuery = machineCheck.replaceAll("and [Location] = [loc]", "");
|
||||
}
|
||||
|
||||
// create blank lots in case there is an error and dose not work
|
||||
let mac = [];
|
||||
|
||||
try {
|
||||
const getMac: any = await prodQuery(updateQuery, "Machine id check");
|
||||
|
||||
mac = getMac.data;
|
||||
// console.log("Machine data", mac); // removed due to swr being activated
|
||||
} catch (err) {
|
||||
log.error({ error: err }, `Error with Machine id Check query: ${err}`);
|
||||
}
|
||||
|
||||
return mac;
|
||||
};
|
||||
Reference in New Issue
Block a user