From 3f108f87a2d5df7e5f2faef3bdad68529ecf129d Mon Sep 17 00:00:00 2001 From: kjs Date: Tue, 14 Apr 2026 09:54:26 +0900 Subject: [PATCH] feat: Calculate standard and tolerance values based on lower and upper limits in equipment inspection - Implemented logic to derive standard and tolerance values from lower and upper limits when double-clicking on inspection items. - Enhanced user interaction by automatically calculating these values, improving data accuracy and usability in the inspection form. - These changes aim to streamline the inspection process and provide clearer insights into equipment metrics across multiple company implementations. --- .../app/(main)/COMPANY_10/equipment/info/page.tsx | 13 +++++++++++-- .../app/(main)/COMPANY_16/equipment/info/page.tsx | 13 +++++++++++-- .../app/(main)/COMPANY_29/equipment/info/page.tsx | 13 +++++++++++-- .../app/(main)/COMPANY_30/equipment/info/page.tsx | 13 +++++++++++-- .../app/(main)/COMPANY_7/equipment/info/page.tsx | 13 +++++++++++-- .../app/(main)/COMPANY_8/equipment/info/page.tsx | 13 +++++++++++-- .../app/(main)/COMPANY_9/equipment/info/page.tsx | 13 +++++++++++-- 7 files changed, 77 insertions(+), 14 deletions(-) diff --git a/frontend/app/(main)/COMPANY_10/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_10/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_10/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_10/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true); diff --git a/frontend/app/(main)/COMPANY_16/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_16/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_16/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_16/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true); diff --git a/frontend/app/(main)/COMPANY_29/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_29/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_29/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_29/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true); diff --git a/frontend/app/(main)/COMPANY_30/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_30/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_30/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_30/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true); diff --git a/frontend/app/(main)/COMPANY_7/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_7/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_7/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_7/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true); diff --git a/frontend/app/(main)/COMPANY_8/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_8/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_8/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_8/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true); diff --git a/frontend/app/(main)/COMPANY_9/equipment/info/page.tsx b/frontend/app/(main)/COMPANY_9/equipment/info/page.tsx index cd53e9b1..f32273ae 100644 --- a/frontend/app/(main)/COMPANY_9/equipment/info/page.tsx +++ b/frontend/app/(main)/COMPANY_9/equipment/info/page.tsx @@ -624,8 +624,17 @@ export default function EquipmentInfoPage() { {inspections.map((item) => ( { - const std = item.standard_value || ""; - const tol = item.tolerance || ""; + // lower/upper → standard/tolerance 역산 + const lower = item.lower_limit !== "" && item.lower_limit != null ? Number(item.lower_limit) : null; + const upper = item.upper_limit !== "" && item.upper_limit != null ? Number(item.upper_limit) : null; + let std = item.standard_value || ""; + let tol = item.tolerance || ""; + if (lower !== null && upper !== null && !isNaN(lower) && !isNaN(upper)) { + const stdCalc = (lower + upper) / 2; + const tolCalc = (upper - lower) / 2; + std = String(stdCalc); + tol = String(tolCalc); + } setInspectionForm({ ...item, standard_value: std, tolerance: tol }); setInspectionEditMode(true); setInspectionModalOpen(true);