實作 InventoryService 的批量入庫 (processIncomingInventory) 與庫存調整 (adjustInventory) 邏輯
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
This commit is contained in:
@@ -29,6 +29,50 @@ interface LogTableProps {
|
||||
from?: number; // 起始索引編號 (paginator.from)
|
||||
}
|
||||
|
||||
// 主體類型解析 (Model 類名轉中文)
|
||||
const subjectTypeMap: Record<string, string> = {
|
||||
// 完整路徑映射
|
||||
'App\\Modules\\Inventory\\Models\\Product': '商品資料',
|
||||
'App\\Modules\\Inventory\\Models\\Warehouse': '倉庫資料',
|
||||
'App\\Modules\\Inventory\\Models\\Inventory': '庫存異動',
|
||||
'App\\Modules\\Inventory\\Models\\Category': '商品分類',
|
||||
'App\\Modules\\Inventory\\Models\\Unit': '單位',
|
||||
'App\\Modules\\Inventory\\Models\\InventoryTransaction': '庫存異動紀錄',
|
||||
'App\\Modules\\Inventory\\Models\\GoodsReceipt': '進貨單',
|
||||
'App\\Modules\\Inventory\\Models\\InventoryCountDoc': '庫存盤點單',
|
||||
'App\\Modules\\Inventory\\Models\\InventoryAdjustDoc': '庫存盤調單',
|
||||
'App\\Modules\\Inventory\\Models\\InventoryTransferOrder': '庫存調撥單',
|
||||
'App\\Modules\\Inventory\\Models\\StockMovementDoc': '庫存單據',
|
||||
'App\\Modules\\Procurement\\Models\\Vendor': '廠商資料',
|
||||
'App\\Modules\\Procurement\\Models\\PurchaseOrder': '採購單',
|
||||
'App\\Modules\\Production\\Models\\ProductionOrder': '生產工單',
|
||||
'App\\Modules\\Production\\Models\\Recipe': '生產配方',
|
||||
'App\\Modules\\Production\\Models\\RecipeItem': '配方品項',
|
||||
'App\\Modules\\Production\\Models\\ProductionOrderItem': '工單品項',
|
||||
'App\\Modules\\Finance\\Models\\UtilityFee': '公共事業費',
|
||||
'App\\Modules\\Core\\Models\\User': '使用者帳號',
|
||||
'App\\Modules\\Core\\Models\\Role': '角色權限',
|
||||
// 簡寫映射
|
||||
'Product': '商品資料',
|
||||
'Warehouse': '倉庫資料',
|
||||
'Inventory': '庫存異動',
|
||||
'InventoryTransaction': '庫存異動紀錄',
|
||||
'Category': '商品分類',
|
||||
'Unit': '單位',
|
||||
'Vendor': '廠商資料',
|
||||
'PurchaseOrder': '採購單',
|
||||
'GoodsReceipt': '進貨單',
|
||||
'ProductionOrder': '生產工單',
|
||||
'Recipe': '生產配方',
|
||||
'InventoryCountDoc': '庫存盤點單',
|
||||
'InventoryAdjustDoc': '庫存盤調單',
|
||||
'InventoryTransferOrder': '庫存調撥單',
|
||||
'StockMovementDoc': '庫存單據',
|
||||
'User': '使用者帳號',
|
||||
'Role': '角色權限',
|
||||
'UtilityFee': '公共事業費',
|
||||
};
|
||||
|
||||
export default function LogTable({
|
||||
activities,
|
||||
sortField,
|
||||
@@ -37,6 +81,8 @@ export default function LogTable({
|
||||
onViewDetail,
|
||||
from = 1
|
||||
}: LogTableProps) {
|
||||
const getSubjectTypeLabel = (type: string) => subjectTypeMap[type] || type;
|
||||
|
||||
const getEventBadgeClass = (event: string) => {
|
||||
switch (event) {
|
||||
case 'created': return 'bg-green-50 text-green-700 border-green-200 hover:bg-green-100';
|
||||
@@ -111,7 +157,7 @@ export default function LogTable({
|
||||
{props.sub_subject ? (
|
||||
<span className="text-gray-700">{props.sub_subject}</span>
|
||||
) : (
|
||||
<span className="text-gray-700">{activity.subject_type}</span>
|
||||
<span className="text-gray-700">{getSubjectTypeLabel(activity.subject_type)}</span>
|
||||
)}
|
||||
|
||||
{/* 如果有原因/來源則顯示(例如:來自補貨) */}
|
||||
@@ -185,7 +231,7 @@ export default function LogTable({
|
||||
</TableCell>
|
||||
<TableCell className="max-w-[200px]">
|
||||
<Badge variant="outline" className="bg-slate-50 text-slate-600 border-slate-200 break-all whitespace-normal text-left h-auto py-1">
|
||||
{activity.subject_type}
|
||||
{getSubjectTypeLabel(activity.subject_type)}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="text-center">
|
||||
|
||||
Reference in New Issue
Block a user