生產工單BOM以及批號完善
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Successful in 57s
Koori-ERP-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
2026-01-22 15:39:35 +08:00
parent 1ae21febb5
commit 1d134c9ad8
31 changed files with 2684 additions and 694 deletions

View File

@@ -8,13 +8,15 @@ export interface Transaction {
reason: string | null;
userName: string;
actualTime: string;
batchNumber?: string; // 商品層級查詢時顯示批號
}
interface TransactionTableProps {
transactions: Transaction[];
showBatchNumber?: boolean; // 是否顯示批號欄位
}
export default function TransactionTable({ transactions }: TransactionTableProps) {
export default function TransactionTable({ transactions, showBatchNumber = false }: TransactionTableProps) {
if (transactions.length === 0) {
return (
<div className="text-center py-8 text-gray-500">
@@ -23,6 +25,9 @@ export default function TransactionTable({ transactions }: TransactionTableProps
);
}
// 自動偵測是否需要顯示批號(如果任一筆記錄有 batchNumber
const shouldShowBatchNumber = showBatchNumber || transactions.some(tx => tx.batchNumber);
return (
<div className="overflow-x-auto">
<table className="w-full text-sm text-left">
@@ -30,6 +35,7 @@ export default function TransactionTable({ transactions }: TransactionTableProps
<tr>
<th className="px-4 py-3 w-[50px]">#</th>
<th className="px-4 py-3"></th>
{shouldShowBatchNumber && <th className="px-4 py-3"></th>}
<th className="px-4 py-3"></th>
<th className="px-4 py-3 text-right"></th>
<th className="px-4 py-3 text-right"></th>
@@ -42,6 +48,9 @@ export default function TransactionTable({ transactions }: TransactionTableProps
<tr key={tx.id} className="border-b hover:bg-gray-50">
<td className="px-4 py-3 text-center text-gray-500 font-medium">{index + 1}</td>
<td className="px-4 py-3 whitespace-nowrap">{tx.actualTime}</td>
{shouldShowBatchNumber && (
<td className="px-4 py-3 font-mono text-sm text-gray-600">{tx.batchNumber || '-'}</td>
)}
<td className="px-4 py-3">
<span className={`px-2 py-1 rounded-full text-xs ${tx.quantity > 0
? 'bg-green-100 text-green-800'