From 935fd22e17afc034a472bc2d159de7b9f5e5dcae Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Thu, 20 Nov 2025 19:36:01 +0900
Subject: (김준회) PO, POS, swp - PO: 발주서출력기능 초안 - 벤더측 POS 다운로드
기능 추가 - Contract 생성시 Status 설정 (mapper) - swp document registration
table 로직 리팩터링 - swp: 입력가능 문서번호 validation 추가 (리스트 메뉴에서
Completed 된 건)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../po/[id]/contract-detail-client.tsx | 2 +-
.../(partners)/po/[id]/contract-detail-client.tsx | 2 +-
.../swp-document-upload/vendor-document-page.tsx | 1 +
components/contract/contract-items-card.tsx | 134 +++++-
lib/po/vendor-table/service.ts | 38 +-
lib/po/vendor-table/shi-vendor-po-table.tsx | 1 +
lib/po/vendor-table/types.ts | 14 +-
lib/po/vendor-table/vendor-po-actions.tsx | 2 +-
lib/po/vendor-table/vendor-po-items-dialog.tsx | 131 +++++-
lib/po/vendor-table/vendor-po-print-dialog.tsx | 514 +++++++++++++++++++++
lib/po/vendor-table/vendor-po-table.tsx | 53 ++-
lib/soap/ecc/mapper/po-mapper.ts | 9 +-
lib/swp/table/swp-help-dialog.tsx | 4 +-
lib/swp/table/swp-inbox-table.tsx | 459 +++++++++++-------
lib/swp/table/swp-table-columns.tsx | 36 +-
lib/swp/table/swp-table-toolbar.tsx | 18 +-
lib/swp/table/swp-table.tsx | 24 +-
17 files changed, 1217 insertions(+), 225 deletions(-)
create mode 100644 lib/po/vendor-table/vendor-po-print-dialog.tsx
diff --git a/app/[lng]/evcp/(evcp)/(procurement)/po/[id]/contract-detail-client.tsx b/app/[lng]/evcp/(evcp)/(procurement)/po/[id]/contract-detail-client.tsx
index 28a85e50..334f8678 100644
--- a/app/[lng]/evcp/(evcp)/(procurement)/po/[id]/contract-detail-client.tsx
+++ b/app/[lng]/evcp/(evcp)/(procurement)/po/[id]/contract-detail-client.tsx
@@ -136,7 +136,7 @@ export function ContractDetailClient({ contract, lng }: ContractDetailClientProp
{/* 계약 품목 */}
-
+
>
)
}
diff --git a/app/[lng]/partners/(partners)/po/[id]/contract-detail-client.tsx b/app/[lng]/partners/(partners)/po/[id]/contract-detail-client.tsx
index a6f7a729..6640bcc0 100644
--- a/app/[lng]/partners/(partners)/po/[id]/contract-detail-client.tsx
+++ b/app/[lng]/partners/(partners)/po/[id]/contract-detail-client.tsx
@@ -199,7 +199,7 @@ export function ContractDetailClient({ contract, lng }: ContractDetailClientProp
{/* 계약 품목 */}
-
+
{/* 계약 반려 다이얼로그 */}
)
diff --git a/lib/po/vendor-table/vendor-po-print-dialog.tsx b/lib/po/vendor-table/vendor-po-print-dialog.tsx
new file mode 100644
index 00000000..f4e30798
--- /dev/null
+++ b/lib/po/vendor-table/vendor-po-print-dialog.tsx
@@ -0,0 +1,514 @@
+"use client"
+
+import * as React from "react"
+import {
+ Dialog,
+ DialogContent,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog"
+import { Button } from "@/components/ui/button"
+import { PrinterIcon } from "lucide-react"
+import { VendorPO, VendorPOItem } from "./types"
+import { formatNumber } from "@/lib/utils"
+import { getVendorPOById, getVendorPOItems } from "./service"
+
+interface VendorPOPrintDialogProps {
+ open: boolean
+ onOpenChange: (open: boolean) => void
+ po: VendorPO | null
+}
+
+// 발주서 헤더 컴포넌트 (페이지마다 반복)
+function POHeader({ po }: { po: VendorPO }) {
+ return (
+
+ {/* 로고 및 타이틀 */}
+
+
+
+ |
+
+ {/* 구매처 로고 위치 */}
+ PURCHASER LOGO
+
+ |
+
+
+ 발주서 / PURCHASE ORDER
+
+ |
+
+
+ {/* 공급자 로고 위치 */}
+ SUPPLIER LOGO
+
+ |
+
+
+
+
+ {/* 회사 정보 및 PO 정보 */}
+
+
+
+
+
+
+ | 거제조선소 : 경상남도 거제시 장평3로 80 (장평동) |
+ | SHIP YARD : 80, Jangpyeong 3-ro, Geoje-si, Gyeongsangnam-do, 53261, Rep. of KOREA |
+ | FAX NO : +82-55-630-5768 |
+ | TEL NO : +82-55-631-4434 |
+
+
+ |
+
+
+
+
+ |
+ PO번호
+ |
+
+ {po.contractNo}
+ |
+
+
+ |
+ REV
+ |
+
+ {po.poVersion ? String(po.poVersion).padStart(2, '0') : '00'}
+ |
+
+
+ |
+ PO발행일
+ |
+
+ {po.contractDate || '-'}
+ |
+
+
+ |
+ 구매담당
+ |
+
+ {po.purchaseManagerName || po.purchaseGroup || '-'}
+ |
+
+
+
+ |
+
+
+
+
+ {/* 출력 정보 */}
+
+ OUTPUT : {new Date().toLocaleString('ko-KR')}
+
+
+ )
+}
+
+export function VendorPOPrintDialog({
+ open,
+ onOpenChange,
+ po,
+}: VendorPOPrintDialogProps) {
+ const [loading, setLoading] = React.useState(false)
+ const [poDetails, setPoDetails] = React.useState(null)
+ const [poItems, setPoItems] = React.useState([])
+
+ // PO 상세 정보 로드
+ React.useEffect(() => {
+ if (open && po) {
+ setLoading(true)
+ Promise.all([
+ getVendorPOById(po.id),
+ getVendorPOItems(po.id)
+ ])
+ .then(([details, items]) => {
+ setPoDetails(details)
+ setPoItems(items)
+ })
+ .catch((error) => {
+ console.error("Failed to load PO details:", error)
+ })
+ .finally(() => {
+ setLoading(false)
+ })
+ }
+ }, [open, po])
+
+ const handlePrint = () => {
+ window.print()
+ }
+
+ if (!po) return null
+
+ const displayPO = poDetails || po
+
+ // 총 수량 계산
+ const totalQuantity = poItems.reduce((sum, item) => sum + (item.quantity || 0), 0)
+
+ return (
+ <>
+ {/* 인쇄 전용 스타일 - Tailwind와 독립적으로 작동 */}
+