IO-2118 Add expected production hours to scheduling.
This commit is contained in:
@@ -35,6 +35,7 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
|
||||
const load = {
|
||||
productionTotal: {},
|
||||
productionHours: 0,
|
||||
};
|
||||
|
||||
//Set the current load.
|
||||
@@ -45,6 +46,10 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
prodJobs.forEach((item) => {
|
||||
//Add all of the jobs currently in production to the buckets so that we have a starting point.
|
||||
const bucketId = CheckJobBucket(buckets, item);
|
||||
load.productionHours =
|
||||
load.productionHours +
|
||||
item.labhrs.aggregate.sum.mod_lb_hrs +
|
||||
item.larhrs.aggregate.sum.mod_lb_hrs;
|
||||
if (bucketId) {
|
||||
load.productionTotal[bucketId].count =
|
||||
load.productionTotal[bucketId].count + 1;
|
||||
@@ -131,6 +136,10 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
}
|
||||
});
|
||||
|
||||
console.log(
|
||||
"🚀 ~ file: application.sagas.js:160 ~ function*calculateScheduleLoad ~ load.productionTotal",
|
||||
load.productionTotal
|
||||
);
|
||||
//Propagate the expected load to each day.
|
||||
const range = Math.round(moment.duration(end.diff(today)).asDays());
|
||||
for (var day = 0; day < range; day++) {
|
||||
@@ -149,6 +158,10 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
load[current].jobsIn || [],
|
||||
load[current].jobsOut || []
|
||||
);
|
||||
load[current].expectedHours =
|
||||
load.productionHours +
|
||||
(load[current].hoursIn || 0) -
|
||||
(load[current].hoursOut || 0);
|
||||
} else {
|
||||
load[current].expectedLoad = CalculateLoad(
|
||||
load[prev].expectedLoad,
|
||||
@@ -156,6 +169,10 @@ export function* calculateScheduleLoad({ payload: end }) {
|
||||
load[current].jobsIn || [],
|
||||
load[current].jobsOut || []
|
||||
);
|
||||
load[current].expectedHours =
|
||||
load[prev].expectedHours +
|
||||
(load[current].hoursIn || 0) -
|
||||
(load[current].hoursOut || 0);
|
||||
}
|
||||
}
|
||||
yield put(setProblemJobs(problemJobs));
|
||||
|
||||
Reference in New Issue
Block a user