first commit
This commit is contained in:
10
resources/js/types/global.d.ts
vendored
Normal file
10
resources/js/types/global.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { route as routeFn } from 'ziggy-js';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
axios: AxiosInstance;
|
||||
}
|
||||
|
||||
var route: typeof routeFn;
|
||||
}
|
||||
17
resources/js/types/product.ts
Normal file
17
resources/js/types/product.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 商品相關型別定義
|
||||
*/
|
||||
|
||||
export interface Product {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
category_id: number;
|
||||
brand?: string;
|
||||
specification?: string;
|
||||
base_unit?: string;
|
||||
large_unit?: string;
|
||||
conversion_rate?: number;
|
||||
purchase_unit?: string;
|
||||
unit?: string; // 相容舊有程式碼
|
||||
}
|
||||
98
resources/js/types/purchase-order.ts
Normal file
98
resources/js/types/purchase-order.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 採購單相關型別定義
|
||||
*/
|
||||
|
||||
export type PurchaseOrderStatus =
|
||||
| "draft" // 草稿
|
||||
| "pending" // 待審核
|
||||
| "processing" // 處理中
|
||||
| "shipping" // 運送中
|
||||
| "confirming" // 待確認
|
||||
| "completed" // 已完成
|
||||
| "cancelled"; // 已取消
|
||||
|
||||
|
||||
|
||||
export type PaymentMethod = "cash" | "bank_transfer" | "credit_card" | "check"; // 付款方式
|
||||
|
||||
export type InvoiceType = "duplicate" | "triplicate" | "electronic"; // 發票類型
|
||||
|
||||
export interface PurchaseOrderItem {
|
||||
productId: string;
|
||||
productName: string;
|
||||
quantity: number;
|
||||
unit: string;
|
||||
unitPrice: number;
|
||||
previousPrice?: number;
|
||||
subtotal: number;
|
||||
}
|
||||
|
||||
// 審核資訊
|
||||
export interface ReviewInfo {
|
||||
reviewedBy: string; // 審核人
|
||||
reviewedAt: string; // 審核時間
|
||||
rejectionReason?: string; // 退回原因(僅退回時)
|
||||
}
|
||||
|
||||
// 發票資訊
|
||||
export interface InvoiceInfo {
|
||||
invoiceNumber: string; // 發票號碼
|
||||
invoiceAmount: number; // 發票金額
|
||||
invoiceDate: string; // 發票日期
|
||||
invoiceType: InvoiceType; // 發票類型
|
||||
companyName?: string; // 公司抬頭(三聯式)
|
||||
taxId?: string; // 統一編號(三聯式)
|
||||
}
|
||||
|
||||
// 付款資訊
|
||||
export interface PaymentInfo {
|
||||
paymentMethod: PaymentMethod; // 付款方式
|
||||
paymentDate: string; // 付款日期
|
||||
actualAmount: number; // 實際付款金額
|
||||
paidBy: string; // 付款人
|
||||
paidAt: string; // 付款記錄時間
|
||||
hasInvoice: boolean; // 是否有發票
|
||||
invoice?: InvoiceInfo; // 發票資訊(如果有)
|
||||
}
|
||||
|
||||
export interface PurchaseOrder {
|
||||
id: string;
|
||||
poNumber: string;
|
||||
supplierId: string;
|
||||
supplierName: string;
|
||||
expectedDate: string;
|
||||
status: PurchaseOrderStatus;
|
||||
items: PurchaseOrderItem[];
|
||||
totalAmount: number;
|
||||
createdAt: string;
|
||||
createdBy: string; // 申請人(採購人)
|
||||
warehouse_id: number; // 預計入庫倉庫 ID
|
||||
warehouse_name: string; // 預計入庫倉庫名稱
|
||||
remark?: string;
|
||||
reviewInfo?: ReviewInfo; // 審核資訊
|
||||
paymentInfo?: PaymentInfo; // 付款資訊
|
||||
}
|
||||
|
||||
export interface CommonProduct {
|
||||
productId: string;
|
||||
productName: string;
|
||||
unit: string;
|
||||
lastPrice: number;
|
||||
}
|
||||
|
||||
export interface Supplier {
|
||||
id: number | string;
|
||||
name: string;
|
||||
contact?: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
commonProducts: CommonProduct[];
|
||||
}
|
||||
|
||||
export interface InspectionItem extends PurchaseOrderItem {
|
||||
receivedQuantity: number;
|
||||
damagedQuantity: number; // 保留欄位以維持相容性,但不再使用
|
||||
shortageQuantity: number;
|
||||
issueType?: "shortage" | "none";
|
||||
issueNote?: string;
|
||||
}
|
||||
19
resources/js/types/requester.ts
Normal file
19
resources/js/types/requester.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 申請單位相關型別定義
|
||||
*/
|
||||
|
||||
export interface Store {
|
||||
id: string;
|
||||
name: string;
|
||||
address?: string;
|
||||
manager?: string;
|
||||
phone?: string;
|
||||
}
|
||||
|
||||
export interface Warehouse {
|
||||
id: string;
|
||||
name: string;
|
||||
address?: string;
|
||||
manager?: string;
|
||||
phone?: string;
|
||||
}
|
||||
43
resources/js/types/vendor.ts
Normal file
43
resources/js/types/vendor.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 廠商相關型別定義
|
||||
*/
|
||||
|
||||
// 供貨商品(廠商可供應的商品)
|
||||
export interface SupplyProduct {
|
||||
id: string;
|
||||
productId: string;
|
||||
productName: string;
|
||||
unit: string;
|
||||
lastPrice?: number;
|
||||
}
|
||||
|
||||
export interface CommonProduct {
|
||||
productId: string;
|
||||
productName: string;
|
||||
unit: string;
|
||||
lastPrice?: number;
|
||||
}
|
||||
|
||||
export interface Supplier {
|
||||
id: string;
|
||||
name: string;
|
||||
contact?: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
lastPurchaseDate?: string; // 上次採購日期
|
||||
commonProducts: CommonProduct[];
|
||||
supplyProducts: SupplyProduct[]; // 供貨商品列表
|
||||
}
|
||||
|
||||
export interface SupplierFormData {
|
||||
name: string;
|
||||
contact: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
// 新增/編輯供貨商品表單
|
||||
export interface SupplyProductFormData {
|
||||
productId: string;
|
||||
lastPrice?: number;
|
||||
}
|
||||
189
resources/js/types/warehouse.ts
Normal file
189
resources/js/types/warehouse.ts
Normal file
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
* 倉庫相關型別定義
|
||||
*/
|
||||
|
||||
export type WarehouseType = "中央倉庫" | "門市";
|
||||
|
||||
/**
|
||||
* 門市資訊
|
||||
*/
|
||||
export interface Store {
|
||||
id: string;
|
||||
name: string;
|
||||
address: string;
|
||||
}
|
||||
|
||||
export interface Warehouse {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
address?: string;
|
||||
description?: string;
|
||||
createdAt?: string; // 對應 created_at 但前端可能習慣 camelCase,後端傳回 snake_case,Inertia 會保持原樣。
|
||||
// 若後端 Resource 沒轉 camelCase,這裡應該用 snake_case 或在前端轉
|
||||
// 為求簡單,我修改 interface 為 snake_case 以匹配 Laravel 預設 Response
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
total_quantity?: number;
|
||||
low_stock_count?: number;
|
||||
type?: WarehouseType;
|
||||
}
|
||||
// 倉庫中的庫存項目
|
||||
export interface WarehouseInventory {
|
||||
id: string; // 庫存項目 ID (Real ID)
|
||||
inventoryId?: string; // 舊有別名,相容性保留
|
||||
warehouseId: string;
|
||||
productId: string;
|
||||
productName: string;
|
||||
productCode: string;
|
||||
unit: string;
|
||||
quantity: number;
|
||||
safetyStock: number | null;
|
||||
status?: '正常' | '接近' | '低於'; // 後端可能回傳的狀態
|
||||
batchNumber: string; // 批號 (Mock for now)
|
||||
expiryDate: string;
|
||||
lastInboundDate: string | null;
|
||||
lastOutboundDate: string | null;
|
||||
}
|
||||
|
||||
export type TransferOrderStatus = "待處理" | "處理中" | "已完成" | "已取消";
|
||||
|
||||
export interface TransferOrder {
|
||||
id: string;
|
||||
orderNumber: string;
|
||||
sourceWarehouseId: string;
|
||||
sourceWarehouseName: string;
|
||||
targetWarehouseId: string;
|
||||
targetWarehouseName: string;
|
||||
productId: string;
|
||||
productName: string;
|
||||
batchNumber: string;
|
||||
quantity: number;
|
||||
transferDate: string;
|
||||
status: TransferOrderStatus;
|
||||
notes?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface Product {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
unit?: string;
|
||||
}
|
||||
|
||||
export interface WarehouseStats {
|
||||
totalQuantity: number;
|
||||
lowStockCount: number;
|
||||
replenishmentNeeded: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全庫存設定
|
||||
*/
|
||||
export interface SafetyStockSetting {
|
||||
id: string;
|
||||
warehouseId: string;
|
||||
productId: string;
|
||||
productName: string;
|
||||
productType: string;
|
||||
safetyStock: number;
|
||||
unit?: string;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全庫存狀態
|
||||
*/
|
||||
export type SafetyStockStatus = "正常" | "接近" | "低於";
|
||||
|
||||
/**
|
||||
* 入庫原因類型
|
||||
*/
|
||||
export type InboundReason =
|
||||
| "期初建檔"
|
||||
| "盤點調整"
|
||||
| "實際入庫未走採購流程"
|
||||
| "生產加工成品入庫"
|
||||
| "其他";
|
||||
|
||||
/**
|
||||
* 庫存異動類型
|
||||
*/
|
||||
export type TransactionType =
|
||||
| "手動入庫"
|
||||
| "手動出庫"
|
||||
| "撥補入庫"
|
||||
| "撥補出庫"
|
||||
| "盤點調整"
|
||||
| "其他";
|
||||
|
||||
/**
|
||||
* 庫存異動記錄
|
||||
*/
|
||||
export interface InventoryTransaction {
|
||||
id: string;
|
||||
warehouseId: string;
|
||||
warehouseName: string;
|
||||
productId: string;
|
||||
productName: string;
|
||||
batchNumber: string;
|
||||
quantity: number; // 正數為入庫,負數為出庫
|
||||
transactionType: TransactionType;
|
||||
reason?: string;
|
||||
notes?: string;
|
||||
expiryDate?: string;
|
||||
operatorName?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 入庫明細項目
|
||||
*/
|
||||
export interface InboundItem {
|
||||
tempId: string; // 臨時ID,用於表單編輯
|
||||
productId: string;
|
||||
productName: string;
|
||||
quantity: number;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 入庫記錄
|
||||
*/
|
||||
export interface InboundRecord {
|
||||
id: string;
|
||||
warehouseId: string;
|
||||
warehouseName: string;
|
||||
inboundDate: string;
|
||||
reason: InboundReason;
|
||||
notes?: string;
|
||||
items: InboundItem[];
|
||||
operatorName?: string;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
// 前端庫存列表用的商品型別
|
||||
export interface InventoryProduct {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
specification: string;
|
||||
base_unit: string;
|
||||
current_stock: number;
|
||||
safety_stock: number;
|
||||
location: string;
|
||||
last_updated: string | null;
|
||||
}
|
||||
|
||||
export type InventoryTransactionType =
|
||||
| "adjustment"
|
||||
| "purchase_in"
|
||||
| "sales_out"
|
||||
| "return_in"
|
||||
| "return_out"
|
||||
| "transfer_in"
|
||||
| "transfer_out";
|
||||
|
||||
export type InventoryOperation = "add" | "subtract" | "set";
|
||||
Reference in New Issue
Block a user