Further scheduling updates.
This commit is contained in:
@@ -76,17 +76,35 @@ export function* calculateScheduleLoad({ payload: end }) {
|
|||||||
|
|
||||||
let problemJobs = [];
|
let problemJobs = [];
|
||||||
compJobs.forEach((item) => {
|
compJobs.forEach((item) => {
|
||||||
if (!item.scheduled_completion)
|
if (!(item.actual_completion || item.scheduled_completion))
|
||||||
console.log("JOB HAS NO SCHEDULED COMPLETION DATE.", item);
|
console.log("JOB HAS NO COMPLETION DATE.", item);
|
||||||
|
|
||||||
const inProdJobs = prodJobs.find((p) => p.id === item.id);
|
const inProdJobs = prodJobs.find((p) => p.id === item.id);
|
||||||
const inArrJobs = arrJobs.find((p) => p.id === item.id);
|
const inArrJobs = arrJobs.find((p) => p.id === item.id);
|
||||||
|
|
||||||
if (
|
if (!(inProdJobs || inArrJobs)) {
|
||||||
!(inProdJobs || inArrJobs) &&
|
//Job isn't found in production or coming in.
|
||||||
!moment(item.scheduled_completion).isSame(moment(), "day")
|
//is it going today or scheduled to go today?
|
||||||
) {
|
if (
|
||||||
// NOT FOUND!
|
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({
|
problemJobs.push({
|
||||||
...item,
|
...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",
|
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;
|
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]) {
|
if (!!load[itemDate]) {
|
||||||
load[itemDate].hoursOut =
|
load[itemDate].hoursOut =
|
||||||
(load[itemDate].hoursOut || 0) +
|
(load[itemDate].hoursOut || 0) +
|
||||||
|
|||||||
@@ -96,14 +96,28 @@ exports.job = async (req, res) => {
|
|||||||
const inProdJobs = filteredProdJobsList.find((p) => p.id === item.id);
|
const inProdJobs = filteredProdJobsList.find((p) => p.id === item.id);
|
||||||
const inArrJobs = filteredArrJobs.find((p) => p.id === item.id);
|
const inArrJobs = filteredArrJobs.find((p) => p.id === item.id);
|
||||||
|
|
||||||
if (
|
if (!(inProdJobs || inArrJobs)) {
|
||||||
!(inProdJobs || inArrJobs) &&
|
//Job isn't found in production or coming in.
|
||||||
!moment(item.actual_completion || item.scheduled_completion).isSame(
|
//is it going today or scheduled to go today?
|
||||||
moment(),
|
if (
|
||||||
"day"
|
moment(item.actual_completion || item.scheduled_completion).isSame(
|
||||||
)
|
moment(),
|
||||||
) {
|
"day"
|
||||||
// NOT FOUND!
|
)
|
||||||
|
) {
|
||||||
|
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);
|
console.log("PROBLEM JOB", item);
|
||||||
problemJobs.push({
|
problemJobs.push({
|
||||||
...item,
|
...item,
|
||||||
|
|||||||
Reference in New Issue
Block a user