fix(Inventory): 修復庫存列表批號欄位與新增庫存頁面儲位欄位遺失問題,並還原批號輸入佈局
This commit is contained in:
@@ -162,7 +162,7 @@ export default function InventoryImportDialog({ open, onOpenChange, warehouseId
|
||||
<div className="text-sm text-gray-600 space-y-2 pb-2 pl-6">
|
||||
<ul className="list-disc space-y-1">
|
||||
<li><span className="font-medium text-gray-700">商品匹配</span>:優先使用「商品條碼」匹配,其次為「商品代號」。</li>
|
||||
<li><span className="font-medium text-gray-700">無批號模式</span>:若 Excel 中的「批號」欄位<span className="underline">保持空白</span>,系統將自動累加至該商品的「通用紀錄」。</li>
|
||||
<li><span className="font-medium text-gray-700">無批號模式</span>:若 Excel 中的「批號」欄位保持空白,系統將自動累加至該商品的「通用紀錄」。(對販賣機而言,此紀錄通常對應至預設的一般庫存)。</li>
|
||||
<li><span className="font-medium text-gray-700">效期設定</span>:若商品無效期概念可留空,或輸入格式如:2026/12/31。</li>
|
||||
<li><span className="font-medium text-gray-700">入庫單價</span>:未填寫時將預設使用商品的「採購成本價」。</li>
|
||||
</ul>
|
||||
|
||||
@@ -42,7 +42,11 @@ export default function InventoryTable({
|
||||
onView,
|
||||
onDelete,
|
||||
onViewProduct,
|
||||
}: InventoryTableProps) {
|
||||
warehouse,
|
||||
}: InventoryTableProps & { warehouse: any }) {
|
||||
// 判斷是否為販賣機倉庫
|
||||
const isVending = warehouse?.type === "vending";
|
||||
|
||||
// 每個商品的展開/折疊狀態
|
||||
const [expandedProducts, setExpandedProducts] = useState<Set<string>>(new Set());
|
||||
|
||||
@@ -197,7 +201,8 @@ export default function InventoryTable({
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[5%]">#</TableHead>
|
||||
<TableHead className="w-[12%]">批號</TableHead>
|
||||
<TableHead className="w-[15%]">批號</TableHead>
|
||||
<TableHead className="w-[10%]">{isVending ? "貨道" : "儲位"}</TableHead>
|
||||
<TableHead className="w-[10%]">庫存數量</TableHead>
|
||||
<Can permission="inventory.view_cost">
|
||||
<TableHead className="w-[10%]">單位成本</TableHead>
|
||||
@@ -215,6 +220,7 @@ export default function InventoryTable({
|
||||
<TableRow key={batch.id}>
|
||||
<TableCell className="text-grey-2">{index + 1}</TableCell>
|
||||
<TableCell>{batch.batchNumber || "-"}</TableCell>
|
||||
<TableCell>{batch.location || "-"}</TableCell>
|
||||
<TableCell>
|
||||
<span>{batch.quantity} {batch.unit}</span>
|
||||
</TableCell>
|
||||
|
||||
@@ -510,6 +510,9 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
|
||||
數量 <span className="text-red-500">*</span>
|
||||
</TableHead>
|
||||
<TableHead className="w-[90px]">單位</TableHead>
|
||||
<TableHead className="w-[120px]">
|
||||
{warehouse.type === 'vending' ? '貨道' : '儲位'}
|
||||
</TableHead>
|
||||
<TableHead className="w-[50px]"></TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
@@ -714,6 +717,16 @@ export default function AddInventoryPage({ warehouse, products }: Props) {
|
||||
)}
|
||||
</TableCell>
|
||||
|
||||
{/* 儲位/貨道 */}
|
||||
<TableCell>
|
||||
<Input
|
||||
value={item.location || ""}
|
||||
onChange={(e) => handleUpdateItem(item.tempId, { location: e.target.value })}
|
||||
className="border-gray-300"
|
||||
placeholder={warehouse.type === 'vending' ? "貨道 (如: A1)" : "儲位 (選填)"}
|
||||
/>
|
||||
</TableCell>
|
||||
|
||||
{/* 刪除按鈕 */}
|
||||
<TableCell>
|
||||
<Button
|
||||
|
||||
@@ -201,6 +201,7 @@ export default function WarehouseInventoryPage({
|
||||
onView={handleView}
|
||||
onDelete={confirmDelete}
|
||||
onViewProduct={handleViewProduct}
|
||||
warehouse={warehouse}
|
||||
/>
|
||||
</div>
|
||||
<AlertDialog open={!!deleteId} onOpenChange={(open) => !open && setDeleteId(null)}>
|
||||
|
||||
@@ -47,6 +47,7 @@ export interface WarehouseInventory {
|
||||
safetyStock: number | null;
|
||||
status?: '正常' | '低於'; // 後端可能回傳的狀態
|
||||
batchNumber: string; // 批號 (Mock for now)
|
||||
location?: string; // 儲位/貨道
|
||||
expiryDate: string;
|
||||
lastInboundDate: string | null;
|
||||
lastOutboundDate: string | null;
|
||||
@@ -177,6 +178,7 @@ export interface InboundItem {
|
||||
batchMode?: 'existing' | 'new' | 'none'; // 批號模式
|
||||
inventoryId?: string; // 選擇現有批號時的 ID
|
||||
batchNumber?: string;
|
||||
location?: string; // 儲位/貨道
|
||||
originCountry?: string; // 新增產地
|
||||
expiryDate?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user