fix: [생산지시] 날짜포맷·수량→개소수·중복key 수정

- actions.ts: formatDateOnly 정규식 보강 (공백/T 구분자 모두 처리)
- actions.ts: nodeCount 매핑 추가 (node_count/nodes_count)
- types.ts: nodeCount, node_count, nodes_count 필드 추가
- page.tsx: 수량→개소 컬럼 변경, nodeCount 표시
- [id]/page.tsx: 수량→개소 표시, BOM 테이블 중복 key 수정
This commit is contained in:
2026-03-05 17:27:49 +09:00
parent fa7efb7b24
commit 9fc979e135
4 changed files with 23 additions and 10 deletions

View File

@@ -316,7 +316,7 @@ export default function ProductionOrderDetailPage() {
<InfoItem label="수주번호" value={detail.orderNumber} />
<InfoItem label="생산지시일" value={detail.productionOrderedAt} />
<InfoItem label="납기일" value={detail.deliveryDate} />
<InfoItem label="수량" value={`${detail.quantity}`} />
<InfoItem label="개소" value={`${formatNumber(detail.nodeCount)}`} />
</div>
</CardContent>
</Card>
@@ -378,7 +378,7 @@ export default function ProductionOrderDetailPage() {
</TableHeader>
<TableBody>
{group.items.map((item, idx) => (
<TableRow key={item.id ?? idx}>
<TableRow key={`${item.id}-${idx}`}>
<TableCell className="text-center font-medium">
{item.itemCode}
</TableCell>
@@ -442,7 +442,7 @@ export default function ProductionOrderDetailPage() {
<TableRow>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead className="text-center"></TableHead>
<TableHead className="text-center"></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
</TableRow>
@@ -456,7 +456,7 @@ export default function ProductionOrderDetailPage() {
</code>
</TableCell>
<TableCell>{wo.processName}</TableCell>
<TableCell className="text-center">{wo.quantity}</TableCell>
<TableCell className="text-center">{wo.quantity}</TableCell>
<TableCell>{getWorkOrderStatusBadge(wo.status)}</TableCell>
<TableCell>{wo.assignees.length > 0 ? wo.assignees.join(", ") : "-"}</TableCell>
</TableRow>

View File

@@ -43,6 +43,7 @@ import type {
ProductionStatus,
ProductionOrderStats,
} from "@/components/production/ProductionOrders/types";
import { formatNumber } from '@/lib/utils/amount';
// 진행 단계 컴포넌트
function ProgressSteps({ statusCode }: { statusCode?: string }) {
@@ -163,7 +164,7 @@ const TABLE_COLUMNS: TableColumn[] = [
{ key: "orderNumber", label: "수주번호", className: "min-w-[150px]" },
{ key: "siteName", label: "현장명", className: "min-w-[180px]" },
{ key: "clientName", label: "거래처", className: "min-w-[120px]" },
{ key: "quantity", label: "수량", className: "w-[80px] text-center" },
{ key: "nodeCount", label: "개소", className: "w-[80px] text-center" },
{ key: "deliveryDate", label: "납기", className: "w-[110px]" },
{ key: "productionOrderedAt", label: "생산지시일", className: "w-[110px]" },
{ key: "status", label: "상태", className: "w-[100px]" },
@@ -241,7 +242,7 @@ export default function ProductionOrdersListPage() {
{item.siteName}
</TableCell>
<TableCell>{item.clientName}</TableCell>
<TableCell className="text-center">{item.quantity}</TableCell>
<TableCell className="text-center">{formatNumber(item.nodeCount)}</TableCell>
<TableCell>{item.deliveryDate}</TableCell>
<TableCell>{item.productionOrderedAt}</TableCell>
<TableCell>{getStatusBadge(item.productionStatus)}</TableCell>
@@ -297,7 +298,7 @@ export default function ProductionOrdersListPage() {
<InfoField label="수주번호" value={item.orderNumber} />
<InfoField label="현장명" value={item.siteName} />
<InfoField label="거래처" value={item.clientName} />
<InfoField label="수량" value={`${item.quantity}`} />
<InfoField label="개소" value={`${formatNumber(item.nodeCount)}`} />
<InfoField label="납기" value={item.deliveryDate} />
<InfoField label="생산지시일" value={item.productionOrderedAt} />
<InfoField

View File

@@ -15,15 +15,22 @@ import type {
// ===== 변환 함수 =====
function formatDateOnly(dateStr: string | null | undefined): string {
if (!dateStr) return '-';
// ISO "2026-02-21T18:12:31.000000Z" 또는 "2026-02-22 03:12:31" 형식 모두 지원
return dateStr.split(/[T ]/)[0];
}
function transformApiToFrontend(data: ApiProductionOrder): ProductionOrder {
return {
id: String(data.id),
orderNumber: data.order_no,
siteName: data.site_name || '',
clientName: data.client_name || data.client?.name || '',
quantity: data.quantity,
quantity: parseFloat(String(data.quantity)) || 0,
nodeCount: data.node_count || data.nodes_count || 0,
deliveryDate: data.delivery_date || '',
productionOrderedAt: data.production_ordered_at || '',
productionOrderedAt: formatDateOnly(data.production_ordered_at),
productionStatus: data.production_status,
workOrderCount: data.work_orders_count,
workOrderProgress: {
@@ -38,8 +45,9 @@ function transformDetailApiToFrontend(data: ApiProductionOrderDetail): Productio
const order = transformApiToFrontend(data.order);
return {
...order,
productionOrderedAt: data.production_ordered_at || order.productionOrderedAt,
productionOrderedAt: formatDateOnly(data.production_ordered_at) || order.productionOrderedAt,
productionStatus: data.production_status || order.productionStatus,
nodeCount: data.node_count || order.nodeCount,
workOrderProgress: {
total: data.work_order_progress?.total || 0,
completed: data.work_order_progress?.completed || 0,

View File

@@ -8,11 +8,13 @@ export interface ApiProductionOrder {
site_name: string;
client_name: string;
quantity: number;
node_count: number;
delivery_date: string | null;
status_code: string;
production_ordered_at: string | null;
production_status: ProductionStatus;
work_orders_count: number;
nodes_count: number;
work_order_progress: {
total: number;
completed: number;
@@ -31,6 +33,7 @@ export interface ProductionOrder {
siteName: string;
clientName: string;
quantity: number;
nodeCount: number;
deliveryDate: string;
productionOrderedAt: string;
productionStatus: ProductionStatus;
@@ -55,6 +58,7 @@ export interface ApiProductionOrderDetail {
order: ApiProductionOrder;
production_ordered_at: string | null;
production_status: ProductionStatus;
node_count: number;
work_order_progress: {
total: number;
completed: number;