From b2b754bee0a09fee57748af519686d566802d8c7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 5 Dec 2022 15:20:37 -0800 Subject: [PATCH] IO-2118 Add expected production hours to scheduling. --- bodyshop_translations.babel | 21 +++++++++++++++++++ ...chedule-calendar-header-graph.component.js | 11 +++++++--- .../redux/application/application.sagas.js | 17 +++++++++++++++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 6 files changed, 49 insertions(+), 3 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index b70cd7802..5be02b5ad 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -736,6 +736,27 @@ + + expectedprodhrs + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + history false diff --git a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js index 7dfb88012..5916ca583 100644 --- a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js +++ b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js @@ -1,4 +1,4 @@ -import { Popover } from "antd"; +import { Popover, Space } from "antd"; import React, { useMemo } from "react"; import { connect } from "react-redux"; import { @@ -13,7 +13,8 @@ import { import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { RadarChartOutlined } from "@ant-design/icons"; - +import { useTranslation } from "react-i18next"; +import { load } from "@fingerprintjs/fingerprintjs"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, }); @@ -23,7 +24,7 @@ const mapDispatchToProps = (dispatch) => ({ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) { const { ssbuckets } = bodyshop; - + const { t } = useTranslation(); const data = useMemo(() => { return ( (loadData && @@ -43,6 +44,10 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) { const popContent = (
+ + {t("appointments.labels.expectedprodhrs")} + {loadData.expectedHours.toFixed(1)} + { //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)); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index facde8e6a..d7559d54e 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -50,6 +50,7 @@ "cancelledappointment": "Canceled appointment for: ", "completingjobs": "Completing Jobs", "dataconsistency": "{{ro_number}} has a data consistency issue. It has been excluded for scheduling purposes. CODE: {{code}}.", + "expectedprodhrs": "Expected Production Hours:", "history": "History", "inproduction": "Jobs In Production", "manualevent": "Add Manual Appointment", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 7f38468c3..ce0b8a000 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -50,6 +50,7 @@ "cancelledappointment": "Cita cancelada para:", "completingjobs": "", "dataconsistency": "", + "expectedprodhrs": "", "history": "", "inproduction": "", "manualevent": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 8082b4bf0..712b3fcfb 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -50,6 +50,7 @@ "cancelledappointment": "Rendez-vous annulé pour:", "completingjobs": "", "dataconsistency": "", + "expectedprodhrs": "", "history": "", "inproduction": "", "manualevent": "",