diff options
Diffstat (limited to 'components/common/selectors/gl-account')
3 files changed, 20 insertions, 46 deletions
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 @@ -101,13 +99,6 @@ export function GlAccountSelector({ ), }, { - accessorKey: 'FIPEX', - header: '세부계정', - cell: ({ row }) => ( - <div className="font-mono text-sm">{row.getValue('FIPEX')}</div> - ), - }, - { accessorKey: 'TEXT1', header: '계정명', cell: ({ row }) => ( @@ -206,7 +197,6 @@ export function GlAccountSelector({ {selectedCode ? ( <div className="flex items-center gap-2 w-full"> <span className="font-mono text-sm">[{selectedCode.SAKNR}]</span> - <span className="font-mono text-sm">{selectedCode.FIPEX}</span> <span className="truncate flex-1 text-left">{selectedCode.TEXT1}</span> <Button variant="ghost" @@ -237,7 +227,7 @@ export function GlAccountSelector({ <div className="flex items-center space-x-2"> <Search className="h-4 w-4" /> <Input - placeholder="계정, 세부계정, 계정명으로 검색..." + placeholder="계정, 계정명으로 검색..." value={globalFilter} onChange={(e) => handleSearchChange(e.target.value)} className="flex-1" @@ -284,7 +274,7 @@ export function GlAccountSelector({ )} </TableCell> ))} - {selectedCode && selectedCode.SAKNR === row.original.SAKNR && selectedCode.FIPEX === row.original.FIPEX && ( + {selectedCode && selectedCode.SAKNR === row.original.SAKNR && ( <TableCell className="text-right"> <span className="text-xs text-muted-foreground">(선택됨)</span> </TableCell> diff --git a/components/common/selectors/gl-account/gl-account-service.ts b/components/common/selectors/gl-account/gl-account-service.ts index 75c82c95..3feaf24a 100644 --- a/components/common/selectors/gl-account/gl-account-service.ts +++ b/components/common/selectors/gl-account/gl-account-service.ts @@ -5,17 +5,16 @@ import { oracleKnex } from '@/lib/oracle-db/db' // GL 계정 타입 정의
export interface GlAccount {
SAKNR: string // 계정 (G/L)
- FIPEX: string // 세부계정
TEXT1: string // 계정명
}
// 테스트 환경용 폴백 데이터
const FALLBACK_TEST_DATA: GlAccount[] = [
- { SAKNR: '53351977', FIPEX: 'FIP001', TEXT1: '원재료 구매(테스트데이터 - 오라클 페칭 실패시)' },
- { SAKNR: '53351978', FIPEX: 'FIP002', TEXT1: '소모품 구매(테스트데이터 - 오라클 페칭 실패시)' },
- { SAKNR: '53351979', FIPEX: 'FIP003', TEXT1: '부품 구매(테스트데이터 - 오라클 페칭 실패시)' },
- { SAKNR: '53351980', FIPEX: 'FIP004', TEXT1: '자재 구매(테스트데이터 - 오라클 페칭 실패시)' },
- { SAKNR: '53351981', FIPEX: 'FIP005', TEXT1: '외주 가공비(테스트데이터 - 오라클 페칭 실패시)' },
+ { SAKNR: '53351977', TEXT1: '원재료 구매(테스트데이터 - 오라클 페칭 실패시)' },
+ { SAKNR: '53351978', TEXT1: '소모품 구매(테스트데이터 - 오라클 페칭 실패시)' },
+ { SAKNR: '53351979', TEXT1: '부품 구매(테스트데이터 - 오라클 페칭 실패시)' },
+ { SAKNR: '53351980', TEXT1: '자재 구매(테스트데이터 - 오라클 페칭 실패시)' },
+ { SAKNR: '53351981', TEXT1: '외주 가공비(테스트데이터 - 오라클 페칭 실패시)' },
]
/**
@@ -32,15 +31,10 @@ export async function getGlAccounts(): Promise<{ console.log('📋 [getGlAccounts] Oracle 쿼리 시작...')
const result = await oracleKnex.raw(`
- SELECT
- SAKNR,
- FIPEX,
- TEXT1"
- FROM CMCTB_BGT_MNG_ITM
- WHERE ROWNUM < 100
- AND BUKRS = 'H100'
- ORDER BY SAKNR
+ SELECT SAKNR , TEXT1 FROM CMCTB_BGT_MNG_ITM WHERE ROWNUM < 10
`)
+ // SAKNR -> GL
+ // TEXT1 -> GL명
// Oracle raw query의 결과는 rows 배열에 들어있음
const rows = (result.rows || result) as Array<Record<string, unknown>>
@@ -49,14 +43,12 @@ export async function getGlAccounts(): Promise<{ // null 값 필터링
const cleanedResult = rows
- .filter((item) =>
- item['계정(G/L)'] &&
- item['세부계정']
+ .filter((item) =>
+ item.SAKNR
)
.map((item) => ({
- SAKNR: String(item['계정(G/L)']),
- FIPEX: String(item['세부계정']),
- TEXT1: String(item['계정명'] || '')
+ SAKNR: String(item.SAKNR),
+ TEXT1: String(item.TEXT1 || '')
}))
console.log(`✅ [getGlAccounts] 필터링 후 ${cleanedResult.length}건`)
diff --git a/components/common/selectors/gl-account/gl-account-single-selector.tsx b/components/common/selectors/gl-account/gl-account-single-selector.tsx index 55a58a1f..c3237043 100644 --- a/components/common/selectors/gl-account/gl-account-single-selector.tsx +++ b/components/common/selectors/gl-account/gl-account-single-selector.tsx @@ -77,7 +77,7 @@ export function GlAccountSingleSelector({ const handleCodeSelect = useCallback((code: GlAccount) => { // 이미 선택된 계정을 다시 선택하면 선택 해제 const currentSelected = showConfirmButtons ? tempSelectedCode : selectedCode - if (currentSelected && currentSelected.SAKNR === code.SAKNR && currentSelected.FIPEX === code.FIPEX) { + if (currentSelected && currentSelected.SAKNR === code.SAKNR) { if (showConfirmButtons) { setTempSelectedCode(undefined) } else { @@ -121,13 +121,6 @@ export function GlAccountSingleSelector({ ), }, { - accessorKey: 'FIPEX', - header: '세부계정', - cell: ({ row }) => ( - <div className="font-mono text-sm">{row.getValue('FIPEX')}</div> - ), - }, - { accessorKey: 'TEXT1', header: '계정명', cell: ({ row }) => ( @@ -262,8 +255,7 @@ export function GlAccountSingleSelector({ </div> <div className="flex items-center gap-2 mt-1"> <span className="font-mono text-sm">[{currentSelectedCode.SAKNR}]</span> - <span className="font-mono text-sm">{currentSelectedCode.FIPEX}</span> - <span>- {currentSelectedCode.TEXT1}</span> + <span>{currentSelectedCode.TEXT1}</span> </div> </div> )} @@ -271,7 +263,7 @@ export function GlAccountSingleSelector({ <div className="flex items-center space-x-2"> <Search className="h-4 w-4" /> <Input - placeholder="계정, 세부계정, 계정명으로 검색..." + placeholder="계정, 계정명으로 검색..." value={globalFilter} onChange={(e) => handleSearchChange(e.target.value)} className="flex-1" |
