feat(migrate): quality alert migrated
This commit is contained in:
73
backend/utils/mailViews/qualityBlocking.hbs
Normal file
73
backend/utils/mailViews/qualityBlocking.hbs
Normal file
@@ -0,0 +1,73 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
{{!-- <link rel="stylesheet" href="styles/styles.css" /> --}}
|
||||
<style>
|
||||
.email-wrapper {
|
||||
max-width: 80%; /* Limit width to 80% of the window */
|
||||
margin: 0 auto; /* Center the content horizontally */
|
||||
}
|
||||
.email-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.email-table td {
|
||||
vertical-align: top;
|
||||
padding: 10px;
|
||||
border: 1px solid #000;
|
||||
border-radius: 25px; /* Rounded corners */
|
||||
background-color: #f0f0f0; /* Optional: Add a background color */
|
||||
}
|
||||
.email-table h2 {
|
||||
margin: 0;
|
||||
}
|
||||
.remarks {
|
||||
border: 1px solid black;
|
||||
padding: 10px;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 25px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="email-wrapper">
|
||||
<p>All,</p>
|
||||
<p>Please see the new blocking order that was created.</p>
|
||||
<div>
|
||||
<div class="email-table">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<p><strong>Blocking number: </strong>{{items.blockingNumber}}</p>
|
||||
<p><strong>Blocking Date: </strong>{{items.blockingDate}}</p>
|
||||
<p><strong>Article: </strong>{{items.av}}</p>
|
||||
<p><strong>Production Lot: </strong>{{items.lotNumber}}</p>
|
||||
<p><strong>Line: </strong>{{items.line}}</p>
|
||||
</td>
|
||||
<td>
|
||||
<p><strong>Customer: </strong>{{items.customer}}</p>
|
||||
<p><strong>Blocked pieces /LUs: </strong>{{items.peicesAndLoadingUnits}}</p>
|
||||
<p><strong>Main defect group: </strong>{{items.mainDefectGroup}}</p>
|
||||
<p><strong>Main defect: </strong>{{items.mainDefect}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="remarks">
|
||||
<h4>Remarks:</h4>
|
||||
<p>{{items.remark}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<p>For further questions please reach out to quality.</p>
|
||||
<p>Thank you,</p>
|
||||
<p>Quality Department</p>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
46
backend/utils/pgConnectToLst.utils.ts
Normal file
46
backend/utils/pgConnectToLst.utils.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import pkg from "pg";
|
||||
const { Client } = pkg;
|
||||
|
||||
const v1client = new Client({
|
||||
host: "localhost",
|
||||
port: 5432,
|
||||
user: "postgres",
|
||||
password: "obelix",
|
||||
database: "lst",
|
||||
});
|
||||
|
||||
const v2client = new Client({
|
||||
host: "localhost",
|
||||
port: 5432,
|
||||
user: "postgres",
|
||||
password: "obelix",
|
||||
database: "lst_db",
|
||||
});
|
||||
|
||||
export const v1QueryRun= async (query:string)=> {
|
||||
try {
|
||||
await v1client.connect();
|
||||
|
||||
const res = await v1client.query(query);
|
||||
|
||||
console.log("Rows affected:", res.rowCount);
|
||||
} catch (err) {
|
||||
console.error("Error running query:", err);
|
||||
} finally {
|
||||
await v1client.end();
|
||||
}
|
||||
}
|
||||
|
||||
export const v2QueryRun = async (query:string)=> {
|
||||
try {
|
||||
await v2client.connect();
|
||||
|
||||
const res = await v2client.query(query);
|
||||
|
||||
console.log("Rows affected:", res.rowCount);
|
||||
} catch (err) {
|
||||
console.error("Error running query:", err);
|
||||
} finally {
|
||||
await v2client.end();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user