BOD-84 Added base calculations for schedule load

This commit is contained in:
Patrick Fic
2020-05-08 15:33:08 -07:00
parent 3d74a4106e
commit 6096fce7a6
17 changed files with 456 additions and 122 deletions

View File

@@ -1,8 +1,17 @@
import gql from "graphql-tag";
export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
query QUERY_ALL_ACTIVE_APPOINTMENTS {
appointments(where: { canceled: { _eq: false } }) {
query QUERY_ALL_ACTIVE_APPOINTMENTS(
$start: timestamptz!
$end: timestamptz!
) {
appointments(
where: {
canceled: { _eq: false }
end: { _lte: $end }
start: { _gte: $start }
}
) {
start
id
end
@@ -11,18 +20,16 @@ export const QUERY_ALL_ACTIVE_APPOINTMENTS = gql`
job {
ro_number
ownr_ln
ownr_co_nm
ownr_fn
ownr_ph1
ownr_ea
clm_total
id
clm_no
vehicle {
id
v_model_yr
v_make_desc
v_model_desc
}
v_model_yr
v_make_desc
v_model_desc
}
}
}
@@ -94,3 +101,53 @@ export const QUERY_APPOINTMENTS_BY_JOBID = gql`
}
}
`;
export const QUERY_SCHEDULE_LOAD_DATA = gql`
query QUERY_SCHEDULE_LOAD_DATA($start: timestamptz!, $end: timestamptz!) {
productionview_aggregate {
aggregate {
sum {
larhrs
labhrs
}
}
}
compJobs: jobs(
where: { scheduled_completion: { _gte: $start, _lte: $end } }
) {
id
scheduled_completion
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
arrJobs: jobs(where: { scheduled_in: { _gte: $start, _lte: $end } }) {
id
scheduled_in
labhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAB" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
larhrs: joblines_aggregate(where: { mod_lbr_ty: { _eq: "LAR" } }) {
aggregate {
sum {
mod_lb_hrs
}
}
}
}
}
`;