From 99aff0c53c3330907f8f72dc7f21e0b0ef597023 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 11 Aug 2025 21:04:31 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncReg/chkgdnReg/rainChkgdn/excel.tsx | 11 ++++-- .../prfmncReg/chkgdnReg/rswrtChkgdn/excel.tsx | 35 ++++++++++++------- apps/wr/components/lib/func/excelFunc.tsx | 21 +++++++++-- .../ruseCaseMng/ruseCaseMngExcelModal.tsx | 1 - 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx index 8e18317a8..38e2cab7f 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx @@ -172,9 +172,16 @@ console.log("rainChkgdData", rainChkgdData); ` 연간운영비(원/년): 숫자 형식 아님 /입력값:${rain.anlOperCst}` ); } - if (rain.oilqMeasMthd.length > 1 && !chkMngType.includes(rain.oilqMeasMthd)) { + + if (rain.operMngCd.length > 1 && !chkMngType.includes(rain.operMngCd)) { issues.push( - defaultMessage + `유량측정방법: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}` + defaultMessage + `운영관리 형태: 위탁 혹은 자체 만 허용) /입력값:${rain.oilqMeasMthd}` + ); + } + + if (rain.oilqMeasMthd.length > 1 && !chkSpwtPositnType.includes(rain.oilqMeasMthd)) { + issues.push( + defaultMessage + `유량측정방법: 유량계, 수위계, 펌프적산전력계, 기타) /입력값:${rain.oilqMeasMthd}` ); } diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel.tsx index d9016410d..3ae35e82c 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/excel.tsx @@ -2,12 +2,12 @@ import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; import { isInvalidDate, isInvalidNumber, + parseCommaRawValue, parseRawValue, } from "@/components/lib/func/excelFunc"; import type { SelectDataType } from "@common/business_components/ui"; import type { rswtChkZodType } from "."; import { - chkSpwtPositnType, useTypes, type Buildingtype } from "../rainChkgdn/excel"; @@ -160,7 +160,7 @@ export const excelToRswtGuideData = ( return { bdstRuseFcltSn: Number(item["NO"]), operMngCd: item["운영관리형태"], - anlOperCst: parseRawValue(item[`연간운영비(원/년)`]), + anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]), prcsCpct: parseRawValue(item[`처리용량(m³)`]), spwtPositn: item["채수지점"], chckYmd: checkYmd, @@ -175,6 +175,8 @@ export const excelToRswtGuideData = ( .filter((el: any) => el !== undefined); if (rswtChkgdData.length > 0) { + + console.log('rswtChkgdData ', rswtChkgdData) rswtExcelDataCheck(rswtChkgdData, issues); } @@ -185,7 +187,11 @@ export const excelToRswtGuideData = ( return { data: rswtChkgdData, issues: [] }; }; + + + export const excelToRswtPolution = (excelData: any, issues: string[]) => { + const rswtChkgdData: rswtChkZodType[] = excelData .map((item: any) => { if (item["점검일"] !== undefined) { @@ -226,12 +232,14 @@ export const excelToRswtPolution = (excelData: any, issues: string[]) => { mdfr: TEST_UUID, }; }); + + console.log( 'item["연간운영비(원/년)"] ', item["연간운영비(원/년)"]) return { bdstRuseFcltSn: Number(item["NO"]), chckYmd: checkYmd, utztnUsgCd: item["이용용도"], operMngCd: item["운영관리형태"], - anlOperCst: parseRawValue(item["연간운영비(원/년)"]), + anlOperCst: parseCommaRawValue(item["연간운영비(원/년)"]), prcsCpct: parseRawValue(item["처리용량(m³)"]), spwtPositn: item["채수지점"], rswtrPollutions: makePoluttion, @@ -266,6 +274,7 @@ const rswtExcelDataCheck = ( rswtChkgdData: rswtChkZodType[], issues: string[] ) => { + rswtChkgdData.forEach((rswt: any) => { const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `; @@ -273,6 +282,8 @@ const rswtExcelDataCheck = ( issues.push(defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`); } if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) { + + console.log('rswt.anlOperCst ', rswt.anlOperCst ) issues.push( defaultMessage + ` 연간운영비(원/년): 숫자 형식 아님 (${rswt.anlOperCst})` @@ -283,15 +294,15 @@ const rswtExcelDataCheck = ( defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})` ); } - if ( - rswt.spwtPositn.length > 1 && - !chkSpwtPositnType.includes(rswt.spwtPositn) - ) { - issues.push( - defaultMessage + - `측정위치: 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}` - ); - } + // if ( + // rswt.spwtPositn.length > 1 && + // !chkSpwtPositnType.includes(rswt.spwtPositn) + // ) { + // issues.push( + // defaultMessage + + // `채수지점 : 유량계, 수위계, 펌프적산전력계, 기타 중 하나만 허용) /입력값:${rswt.spwtPositn}` + // ); + // } if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) { rswt.rswtrPollutions.forEach((pol) => { diff --git a/apps/wr/components/lib/func/excelFunc.tsx b/apps/wr/components/lib/func/excelFunc.tsx index 2383bdbb3..7a1cc1d2e 100644 --- a/apps/wr/components/lib/func/excelFunc.tsx +++ b/apps/wr/components/lib/func/excelFunc.tsx @@ -12,6 +12,23 @@ export const isInvalidNumber = (val: any) => { if (val === "" || val === undefined || val === null) return 0; if (typeof val === "string" && ["보류", "N/A"].includes(val.trim())) return val; - return !isNaN(val) && val !== " " ? Number(val) : val; + return !isNaN(val) && val !== " " ? Number(val.replaceAll(',','')) : val; }; - \ No newline at end of file + + + export const parseCommaRawValue = (val: any): number | string => { + if (val === "" || val === undefined || val === null) return 0; + + // 문자열이고 "보류"나 "N/A"면 그대로 반환 + if (typeof val === "string" && ["보류", "N/A"].includes(val.trim())) { + return val; + } + + // 문자열에 쉼표가 있으면 제거 + if (typeof val === "string" && val.includes(",")) { + val = val.replace(/,/g, ""); + } + + // 숫자로 변환 가능하면 숫자로, 아니면 그대로 + return !isNaN(val) && val !== " " ? Number(val) : val; + }; \ No newline at end of file diff --git a/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx b/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx index a809c88f6..911dd2ed2 100644 --- a/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx +++ b/apps/wr/components/ui/modal/coMat/ruseCaseMng/ruseCaseMngExcelModal.tsx @@ -79,7 +79,6 @@ export default function RuseCaseMngExcel() { }; Object.keys(reUseCaseNames).forEach((key: string) => { - console.log("reUseCaseNames", reUseCaseNames) if (item && reUseCaseNames[key] !== undefined) { const mappedKey = reUseCaseNames[key]; if (mappedKey && object.hasOwnProperty(mappedKey)) {