Further scheduling updates.
This commit is contained in:
@@ -76,17 +76,35 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
|
||||
let problemJobs = [];
|
||||
compJobs.forEach((item) => {
|
||||
if (!item.scheduled_completion)
|
||||
console.log("JOB HAS NO SCHEDULED COMPLETION DATE.", item);
|
||||
if (!(item.actual_completion || item.scheduled_completion))
|
||||
console.log("JOB HAS NO COMPLETION DATE.", item);
|
||||
|
||||
const inProdJobs = prodJobs.find((p) => p.id === item.id);
|
||||
const inArrJobs = arrJobs.find((p) => p.id === item.id);
|
||||
|
||||
if (
|
||||
!(inProdJobs || inArrJobs) &&
|
||||
!moment(item.scheduled_completion).isSame(moment(), "day")
|
||||
) {
|
||||
// NOT FOUND!
|
||||
if (!(inProdJobs || inArrJobs)) {
|
||||
//Job isn't found in production or coming in.
|
||||
//is it going today or scheduled to go today?
|
||||
if (
|
||||
moment(item.actual_completion || item.scheduled_completion).isSame(
|
||||
moment(),
|
||||
"day"
|
||||
)
|
||||
) {
|
||||
console.log("Job is going today anyways, ignore it.", item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
moment(item.actual_completion || item.scheduled_completion).isBefore(
|
||||
moment(),
|
||||
"day"
|
||||
)
|
||||
) {
|
||||
console.log("Job should have already gone. Ignoring it.", item);
|
||||
return;
|
||||
}
|
||||
|
||||
problemJobs.push({
|
||||
...item,
|
||||
code: "Job is scheduled for completion, but it is not marked in production nor is it an arriving job in this period. Check the scheduled in and completion dates",
|
||||
@@ -94,7 +112,9 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
return;
|
||||
}
|
||||
|
||||
const itemDate = moment(item.scheduled_completion).format("yyyy-MM-DD");
|
||||
const itemDate = moment(
|
||||
item.actual_completion || item.scheduled_completion
|
||||
).format("yyyy-MM-DD");
|
||||
if (!!load[itemDate]) {
|
||||
load[itemDate].hoursOut =
|
||||
(load[itemDate].hoursOut || 0) +
|
||||
|
||||
@@ -96,14 +96,28 @@ exports.job = async (req, res) => {
|
||||
const inProdJobs = filteredProdJobsList.find((p) => p.id === item.id);
|
||||
const inArrJobs = filteredArrJobs.find((p) => p.id === item.id);
|
||||
|
||||
if (
|
||||
!(inProdJobs || inArrJobs) &&
|
||||
!moment(item.actual_completion || item.scheduled_completion).isSame(
|
||||
moment(),
|
||||
"day"
|
||||
)
|
||||
) {
|
||||
// NOT FOUND!
|
||||
if (!(inProdJobs || inArrJobs)) {
|
||||
//Job isn't found in production or coming in.
|
||||
//is it going today or scheduled to go today?
|
||||
if (
|
||||
moment(item.actual_completion || item.scheduled_completion).isSame(
|
||||
moment(),
|
||||
"day"
|
||||
)
|
||||
) {
|
||||
console.log("Job is going today anyways, ignore it.", item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
moment(item.actual_completion || item.scheduled_completion).isBefore(
|
||||
moment(),
|
||||
"day"
|
||||
)
|
||||
) {
|
||||
console.log("Job should have already gone. Ignoring it.", item);
|
||||
return;
|
||||
}
|
||||
console.log("PROBLEM JOB", item);
|
||||
problemJobs.push({
|
||||
...item,
|
||||
|
||||
Reference in New Issue
Block a user