feat: 倉庫業務屬性、庫存成本追蹤與採購單功能更新
1. 倉庫管理:新增業務類型 (Owned/External/Customer) 與車牌資訊與司機欄位。 2. 庫存管理:實作成本追蹤 (unit_cost, total_value),更新列表與撥補單顯示。 3. 採購單:新增採購日期 (order_date),調整欄位名稱與順序。 4. 前端優化:更新相關 TS Type 定義與 UI 顯示。
This commit is contained in:
@@ -67,6 +67,7 @@ export interface PurchaseOrder {
|
||||
poNumber: string;
|
||||
supplierId: string;
|
||||
supplierName: string;
|
||||
orderDate?: string; // 採購日期
|
||||
expectedDate: string;
|
||||
status: PurchaseOrderStatus;
|
||||
items: PurchaseOrderItem[];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* 倉庫相關型別定義
|
||||
*/
|
||||
|
||||
export type WarehouseType = "中央倉庫" | "門市";
|
||||
export type WarehouseType = "standard" | "production" | "retail" | "vending" | "transit" | "quarantine";
|
||||
|
||||
/**
|
||||
* 門市資訊
|
||||
@@ -19,17 +19,17 @@ export interface Warehouse {
|
||||
name: string;
|
||||
address?: string;
|
||||
description?: string;
|
||||
createdAt?: string; // 對應 created_at 但前端可能習慣 camelCase,後端傳回 snake_case,Inertia 會保持原樣。
|
||||
// 若後端 Resource 沒轉 camelCase,這裡應該用 snake_case 或在前端轉
|
||||
// 為求簡單,我修改 interface 為 snake_case 以匹配 Laravel 預設 Response
|
||||
createdAt?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
total_quantity?: number;
|
||||
low_stock_count?: number;
|
||||
type?: WarehouseType;
|
||||
is_sellable?: boolean; // 新增欄位
|
||||
book_stock?: number; // 帳面庫存
|
||||
available_stock?: number; // 可用庫存
|
||||
is_sellable?: boolean;
|
||||
license_plate?: string; // 車牌號碼 (移動倉)
|
||||
driver_name?: string; // 司機姓名 (移動倉)
|
||||
book_stock?: number;
|
||||
available_stock?: number;
|
||||
}
|
||||
// 倉庫中的庫存項目
|
||||
export interface WarehouseInventory {
|
||||
@@ -41,6 +41,8 @@ export interface WarehouseInventory {
|
||||
productCode: string;
|
||||
unit: string;
|
||||
quantity: number;
|
||||
unit_cost?: number; // 單位成本
|
||||
total_value?: number; // 總價值
|
||||
safetyStock: number | null;
|
||||
status?: '正常' | '低於'; // 後端可能回傳的狀態
|
||||
batchNumber: string; // 批號 (Mock for now)
|
||||
@@ -56,6 +58,7 @@ export interface GroupedInventory {
|
||||
productCode: string;
|
||||
baseUnit: string;
|
||||
totalQuantity: number;
|
||||
totalValue?: number; // 總價值總計
|
||||
safetyStock: number | null; // 以商品層級顯示的安全庫存
|
||||
status: '正常' | '低於';
|
||||
batches: WarehouseInventory[]; // 該商品下的所有批號庫存
|
||||
@@ -89,6 +92,7 @@ export interface Product {
|
||||
|
||||
export interface WarehouseStats {
|
||||
totalQuantity: number;
|
||||
totalValue?: number; // 倉庫總值
|
||||
lowStockCount: number;
|
||||
replenishmentNeeded: number;
|
||||
}
|
||||
@@ -145,6 +149,7 @@ export interface InventoryTransaction {
|
||||
productName: string;
|
||||
batchNumber: string;
|
||||
quantity: number; // 正數為入庫,負數為出庫
|
||||
unit_cost?: number; // 異動時的成本
|
||||
transactionType: TransactionType;
|
||||
reason?: string;
|
||||
notes?: string;
|
||||
@@ -161,6 +166,7 @@ export interface InboundItem {
|
||||
productId: string;
|
||||
productName: string;
|
||||
quantity: number;
|
||||
unit_cost?: number; // 入庫單價
|
||||
unit: string;
|
||||
baseUnit?: string;
|
||||
largeUnit?: string;
|
||||
|
||||
Reference in New Issue
Block a user