Compare commits
10 Commits
3b939ff2d3
...
4cae96b1ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cae96b1ee | |||
| 1cde8ab2e6 | |||
| 03e8378213 | |||
| 275c93dc79 | |||
| fbb8c21d5c | |||
| dce93d3de2 | |||
| faf4e9f9ab | |||
| a9783a7d35 | |||
| e9ca6dbbb2 | |||
| e996f99400 |
@@ -48,6 +48,7 @@ export function DetachSilo(props: any) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
|
console.log(res.data.data);
|
||||||
toast.success(res.data.message);
|
toast.success(res.data.message);
|
||||||
|
|
||||||
refetch();
|
refetch();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"admConfig": {
|
"admConfig": {
|
||||||
"build": 647,
|
"build": 652,
|
||||||
"oldBuild": "backend-0.1.3.zip"
|
"oldBuild": "backend-0.1.3.zip"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { postForecast } from "../postForecast.js";
|
|||||||
import { query } from "../../../../../sqlServer/prodSqlServer.js";
|
import { query } from "../../../../../sqlServer/prodSqlServer.js";
|
||||||
import { activeArticle } from "../../../../../sqlServer/querys/dataMart/article.js";
|
import { activeArticle } from "../../../../../sqlServer/querys/dataMart/article.js";
|
||||||
import { addDays } from "date-fns";
|
import { addDays } from "date-fns";
|
||||||
|
import { sendEmail } from "../../../../../notifications/controller/sendMail.js";
|
||||||
|
import { createLog } from "../../../../../logger/logger.js";
|
||||||
|
|
||||||
let customerID = 4;
|
let customerID = 4;
|
||||||
export const lorealForecast = async (data: any, user: any) => {
|
export const lorealForecast = async (data: any, user: any) => {
|
||||||
@@ -111,6 +113,9 @@ export const lorealForecast = async (data: any, user: any) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (activeAV.length === 0) {
|
if (activeAV.length === 0) {
|
||||||
|
if (typeof forcast.customerArticleNo === "number") {
|
||||||
|
missingSku.push(forcast);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +186,9 @@ export const lorealForecast = async (data: any, user: any) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (activeAV.length === 0) {
|
if (activeAV.length === 0) {
|
||||||
|
if (typeof forcast.customerArticleNo === "number") {
|
||||||
|
missingSku.push(forcast);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +198,56 @@ export const lorealForecast = async (data: any, user: any) => {
|
|||||||
|
|
||||||
//console.log(comForecast);
|
//console.log(comForecast);
|
||||||
|
|
||||||
|
// email the for the missing ones
|
||||||
|
const missedGrouped = Object.values(
|
||||||
|
missingSku.reduce((acc: any, item: any) => {
|
||||||
|
const key = item.customerArticleNo;
|
||||||
|
|
||||||
|
if (!acc[key]) {
|
||||||
|
// first time we see this customer
|
||||||
|
acc[key] = item;
|
||||||
|
} else {
|
||||||
|
// compare dates and keep the earliest
|
||||||
|
if (
|
||||||
|
new Date(item.requirementDate) <
|
||||||
|
new Date(acc[key].requirementDate)
|
||||||
|
) {
|
||||||
|
acc[key] = item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
);
|
||||||
|
|
||||||
|
const emailSetup = {
|
||||||
|
email: "Blake.matthes@alpla.com; Stuart.Gladney@alpla.com; Harold.Mccalister@alpla.com; Jenn.Osbourn@alpla.com",
|
||||||
|
subject:
|
||||||
|
missedGrouped.length > 0
|
||||||
|
? `Alert! There are ${missedGrouped.length}, missing skus.`
|
||||||
|
: `Alert! There is a missing SKU.`,
|
||||||
|
template: "missingLorealSkus",
|
||||||
|
context: {
|
||||||
|
items: missedGrouped,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const { data: sentEmail, error: sendEmailError } = await tryCatch(
|
||||||
|
sendEmail(emailSetup)
|
||||||
|
);
|
||||||
|
if (sendEmailError) {
|
||||||
|
createLog(
|
||||||
|
"error",
|
||||||
|
"blocking",
|
||||||
|
"notify",
|
||||||
|
"Failed to send email, will try again on next interval"
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
success: false,
|
||||||
|
message: "Failed to send email, will try again on next interval",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// if the customerarticle number is not matching just ignore it
|
// if the customerarticle number is not matching just ignore it
|
||||||
const predefinedObject = {
|
const predefinedObject = {
|
||||||
receivingPlantId: plantToken[0].value,
|
receivingPlantId: plantToken[0].value,
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ app.openapi(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(silo);
|
||||||
return c.json({
|
return c.json({
|
||||||
success: silo.success,
|
success: silo.success,
|
||||||
message: silo.message,
|
message: silo.message,
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<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" /> --}}
|
||||||
|
{{> styles}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>All,</p>
|
||||||
|
<p>The below SKU's do not currently have an av and will be ignored in the forcast import.</p>
|
||||||
|
<p>The date and qty are the first time needed showing from teh vmi report</p>
|
||||||
|
<table >
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Customer Article Number</th>
|
||||||
|
<th>First Date Needed</th>
|
||||||
|
<th>Quantity</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
{{#each items}}
|
||||||
|
<tr>
|
||||||
|
<td>{{customerArticleNo}}</td>
|
||||||
|
<td>{{requirementDate}}</td>
|
||||||
|
<td>{{quantity}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
|
||||||
|
<p>Thank you,</p>
|
||||||
|
<p>LST Team</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -33,13 +33,13 @@ export const delieryInhouse = async (data: any) => {
|
|||||||
"error",
|
"error",
|
||||||
"labeling",
|
"labeling",
|
||||||
"ocp",
|
"ocp",
|
||||||
`${data.printer.name}, Error:${res.data.Message}`
|
`${data.printer?.name}, Error:${res.data.Message}`
|
||||||
);
|
);
|
||||||
//printerUpdate(data.printer, 7, "Error while deliverying inhouse.");
|
//printerUpdate(data.printer, 7, "Error while deliverying inhouse.");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
message: `${data.printer.name} had an error while trying to deliver.`,
|
message: `${data.printer?.name} had an error while trying to deliver.`,
|
||||||
data: res.data,
|
data: res.data,
|
||||||
};
|
};
|
||||||
} // label was just delivered
|
} // label was just delivered
|
||||||
|
|||||||
@@ -134,5 +134,8 @@ group by IdArtikelVarianten,ArtikelVariantenBez
|
|||||||
) as l on
|
) as l on
|
||||||
l.IdArtikelVarianten = MaterialHumanReadableId
|
l.IdArtikelVarianten = MaterialHumanReadableId
|
||||||
|
|
||||||
where lot.ProductionLotHumanReadableId = @lot and MaterialDescription not like '%nopal%'
|
where lot.ProductionLotHumanReadableId = @lot and
|
||||||
|
MaterialDescription NOT LIKE '%nopal%'
|
||||||
|
and MaterialDescription NOT LIKE '%bb%'
|
||||||
|
and MaterialDescription NOT LIKE '%mcg%'
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user