From a8674e6b91fb4d356c311fad0251878de154da53 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 24 Nov 2025 11:16:32 +0000 Subject: (최겸) 구매 입찰 수정(폐찰, 낙찰 결재 기능 추가 등) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectors/cost-center/cost-center-selector.tsx | 26 ------------ .../selectors/cost-center/cost-center-service.ts | 40 ++++++------------ .../cost-center/cost-center-single-selector.tsx | 24 +---------- .../selectors/gl-account/gl-account-selector.tsx | 20 +++------ .../selectors/gl-account/gl-account-service.ts | 32 ++++++--------- .../gl-account/gl-account-single-selector.tsx | 14 ++----- .../procurement-item-selector-dialog-single.tsx | 2 +- .../selectors/wbs-code/wbs-code-selector.tsx | 37 ++++------------- .../common/selectors/wbs-code/wbs-code-service.ts | 48 ++++++---------------- .../wbs-code/wbs-code-single-selector.tsx | 40 +++++------------- 10 files changed, 67 insertions(+), 216 deletions(-) (limited to 'components/common/selectors') diff --git a/components/common/selectors/cost-center/cost-center-selector.tsx b/components/common/selectors/cost-center/cost-center-selector.tsx index 3aad5787..f87b6928 100644 --- a/components/common/selectors/cost-center/cost-center-selector.tsx +++ b/components/common/selectors/cost-center/cost-center-selector.tsx @@ -77,11 +77,6 @@ export function CostCenterSelector({ const [globalFilter, setGlobalFilter] = useState('') const [isPending, startTransition] = useTransition() - // 날짜 포맷 함수 (YYYYMMDD -> YYYY-MM-DD) - const formatDate = (dateStr: string) => { - if (!dateStr || dateStr.length !== 8) return dateStr - return `${dateStr.substring(0, 4)}-${dateStr.substring(4, 6)}-${dateStr.substring(6, 8)}` - } // Cost Center 선택 핸들러 const handleCodeSelect = useCallback(async (code: CostCenter) => { @@ -117,27 +112,6 @@ export function CostCenterSelector({
{row.getValue('KTEXT')}
), }, - { - accessorKey: 'LTEXT', - header: '설명', - cell: ({ row }) => ( -
{row.getValue('LTEXT')}
- ), - }, - { - accessorKey: 'DATAB', - header: '시작일', - cell: ({ row }) => ( -
{formatDate(row.getValue('DATAB'))}
- ), - }, - { - accessorKey: 'DATBI', - header: '종료일', - cell: ({ row }) => ( -
{formatDate(row.getValue('DATBI'))}
- ), - }, { id: 'actions', header: '선택', diff --git a/components/common/selectors/cost-center/cost-center-service.ts b/components/common/selectors/cost-center/cost-center-service.ts index 844215f0..1e7e43f5 100644 --- a/components/common/selectors/cost-center/cost-center-service.ts +++ b/components/common/selectors/cost-center/cost-center-service.ts @@ -5,19 +5,16 @@ import { oracleKnex } from '@/lib/oracle-db/db' // Cost Center 타입 정의 export interface CostCenter { KOSTL: string // Cost Center 코드 - DATAB: string // 시작일 - DATBI: string // 종료일 KTEXT: string // 단축 텍스트 - LTEXT: string // 긴 텍스트 } // 테스트 환경용 폴백 데이터 const FALLBACK_TEST_DATA: CostCenter[] = [ - { KOSTL: 'D6023930', DATAB: '20230101', DATBI: '99991231', KTEXT: '구매팀', LTEXT: '구매팀 Cost Center(테스트데이터 - 오라클 페칭 실패시)' }, - { KOSTL: 'D6023931', DATAB: '20230101', DATBI: '99991231', KTEXT: '자재팀', LTEXT: '자재팀 Cost Center(테스트데이터 - 오라클 페칭 실패시)' }, - { KOSTL: 'D6023932', DATAB: '20230101', DATBI: '99991231', KTEXT: '조달팀', LTEXT: '조달팀 Cost Center(테스트데이터 - 오라클 페칭 실패시)' }, - { KOSTL: 'D6023933', DATAB: '20230101', DATBI: '99991231', KTEXT: '구매1팀', LTEXT: '구매1팀 Cost Center(테스트데이터 - 오라클 페칭 실패시)' }, - { KOSTL: 'D6023934', DATAB: '20230101', DATBI: '99991231', KTEXT: '구매2팀', LTEXT: '구매2팀 Cost Center(테스트데이터 - 오라클 페칭 실패시)' }, + { KOSTL: 'D6023930', KTEXT: '구매팀(테스트데이터 - 오라클 페칭 실패시)' }, + { KOSTL: 'D6023931', KTEXT: '자재팀(테스트데이터 - 오라클 페칭 실패시)' }, + { KOSTL: 'D6023932', KTEXT: '조달팀(테스트데이터 - 오라클 페칭 실패시)' }, + { KOSTL: 'D6023933', KTEXT: '구매1팀(테스트데이터 - 오라클 페칭 실패시)' }, + { KOSTL: 'D6023934', KTEXT: '구매2팀(테스트데이터 - 오라클 페칭 실패시)' }, ] /** @@ -35,19 +32,11 @@ export async function getCostCenters(): Promise<{ console.log('📋 [getCostCenters] Oracle 쿼리 시작...') const result = await oracleKnex.raw(` - SELECT - KOSTL, - DATAB, - DATBI, - KTEXT, - LTEXT - FROM CMCTB_COSTCENTER - WHERE ROWNUM < 100 - AND NVL(BKZKP,' ') = ' ' - AND TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DATAB AND DATBI - AND KOKRS = 'H100' - ORDER BY KOSTL + SELECT KOSTL , KTEXT FROM CMCTB_COSTCENTER + WHERE TO_CHAR(SYSDATE,'YYYYMMDD') BETWEEN DATAB AND DATBI AND ROWNUM < 10 `) + // KOSTL -> CONTCENTER + // KTEXT -> CONTCENTER명 // Oracle raw query의 결과는 rows 배열에 들어있음 const rows = (result.rows || result) as Array> @@ -56,17 +45,12 @@ export async function getCostCenters(): Promise<{ // null 값 필터링 const cleanedResult = rows - .filter((item) => - item.KOSTL && - item.DATAB && - item.DATBI + .filter((item) => + item.KOSTL ) .map((item) => ({ KOSTL: String(item.KOSTL), - DATAB: String(item.DATAB), - DATBI: String(item.DATBI), - KTEXT: String(item.KTEXT || ''), - LTEXT: String(item.LTEXT || '') + KTEXT: String(item.KTEXT || '') })) console.log(`✅ [getCostCenters] 필터링 후 ${cleanedResult.length}건`) diff --git a/components/common/selectors/cost-center/cost-center-single-selector.tsx b/components/common/selectors/cost-center/cost-center-single-selector.tsx index e09f782b..952fab3f 100644 --- a/components/common/selectors/cost-center/cost-center-single-selector.tsx +++ b/components/common/selectors/cost-center/cost-center-single-selector.tsx @@ -133,27 +133,6 @@ export function CostCenterSingleSelector({
{row.getValue('KTEXT')}
), }, - { - accessorKey: 'LTEXT', - header: '설명', - cell: ({ row }) => ( -
{row.getValue('LTEXT')}
- ), - }, - { - accessorKey: 'DATAB', - header: '시작일', - cell: ({ row }) => ( -
{formatDate(row.getValue('DATAB'))}
- ), - }, - { - accessorKey: 'DATBI', - header: '종료일', - cell: ({ row }) => ( -
{formatDate(row.getValue('DATBI'))}
- ), - }, { id: 'actions', header: '선택', @@ -283,7 +262,6 @@ export function CostCenterSingleSelector({
[{currentSelectedCode.KOSTL}] {currentSelectedCode.KTEXT} - - {currentSelectedCode.LTEXT}
)} @@ -291,7 +269,7 @@ export function CostCenterSingleSelector({
handleSearchChange(e.target.value)} className="flex-1" diff --git a/components/common/selectors/gl-account/gl-account-selector.tsx b/components/common/selectors/gl-account/gl-account-selector.tsx index 7e47a072..63eeede8 100644 --- a/components/common/selectors/gl-account/gl-account-selector.tsx +++ b/components/common/selectors/gl-account/gl-account-selector.tsx @@ -5,9 +5,8 @@ * * @description * - 오라클에서 GL 계정들을 조회 - * - SAKNR: 계정(G/L) - * - FIPEX: 세부계정 - * - TEXT1: 계정명 + * - GL: 계정 + * - GL명: 계정명 */ import { useState, useCallback, useMemo, useTransition } from 'react' @@ -52,7 +51,6 @@ export interface GlAccountSelectorProps { export interface GlAccountItem { saknr: string // 계정(G/L) - fipex: string // 세부계정 text1: string // 계정명 displayText: string // 표시용 텍스트 } @@ -76,7 +74,7 @@ export function GlAccountSelector({ // GL 계정 선택 핸들러 const handleCodeSelect = useCallback(async (code: GlAccount) => { // 이미 선택된 계정을 다시 선택하면 선택 해제 - if (selectedCode && selectedCode.SAKNR === code.SAKNR && selectedCode.FIPEX === code.FIPEX) { + if (selectedCode && selectedCode.SAKNR === code.SAKNR) { onCodeSelect(undefined as any) // 선택 해제를 위해 undefined 전달 setOpen(false) return @@ -100,13 +98,6 @@ export function GlAccountSelector({
{row.getValue('SAKNR')}
), }, - { - accessorKey: 'FIPEX', - header: '세부계정', - cell: ({ row }) => ( -
{row.getValue('FIPEX')}
- ), - }, { accessorKey: 'TEXT1', header: '계정명', @@ -206,7 +197,6 @@ export function GlAccountSelector({ {selectedCode ? (
[{selectedCode.SAKNR}] - {selectedCode.FIPEX} {selectedCode.TEXT1}
[{currentSelectedCode.SAKNR}] - {currentSelectedCode.FIPEX} - - {currentSelectedCode.TEXT1} + {currentSelectedCode.TEXT1}
)} @@ -271,7 +263,7 @@ export function GlAccountSingleSelector({
handleSearchChange(e.target.value)} className="flex-1" diff --git a/components/common/selectors/procurement-item/procurement-item-selector-dialog-single.tsx b/components/common/selectors/procurement-item/procurement-item-selector-dialog-single.tsx index 90d4975b..84fd85ff 100644 --- a/components/common/selectors/procurement-item/procurement-item-selector-dialog-single.tsx +++ b/components/common/selectors/procurement-item/procurement-item-selector-dialog-single.tsx @@ -131,7 +131,7 @@ export function ProcurementItemSelectorDialogSingle({
- [{currentSelectedCode.PROJ_NO}] - {currentSelectedCode.WBS_ELMT} + [{currentSelectedCode.WBS_ELMT}] {currentSelectedCode.WBS_ELMT_NM}
@@ -278,7 +261,7 @@ export function WbsCodeSingleSelector({
handleSearchChange(e.target.value)} className="flex-1" @@ -311,8 +294,7 @@ export function WbsCodeSingleSelector({ {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => { - const isRowSelected = currentSelectedCode?.WBS_ELMT === row.original.WBS_ELMT && - currentSelectedCode?.PROJ_NO === row.original.PROJ_NO + const isRowSelected = currentSelectedCode?.WBS_ELMT === row.original.WBS_ELMT return (