feat(Inventory): 實作批號溯源完整功能與 UI 呈現,包含文字敘述卡片與更完整的關聯屬性

This commit is contained in:
2026-02-26 10:39:24 +08:00
parent 63e4f88a14
commit f960aaaeb2
16 changed files with 1085 additions and 694 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Modules\Production\Services;
use App\Modules\Production\Contracts\ProductionServiceInterface;
use App\Modules\Production\Models\ProductionOrder;
use App\Modules\Production\Models\ProductionOrderItem;
class ProductionService implements ProductionServiceInterface
{
@@ -11,4 +12,18 @@ class ProductionService implements ProductionServiceInterface
{
return ProductionOrder::where('status', 'pending')->count();
}
public function getProductionOrdersByOutputBatch(string $batchNumber): \Illuminate\Support\Collection
{
return ProductionOrder::with(['items.inventory.product', 'items.inventory'])
->where('output_batch_number', $batchNumber)
->get();
}
public function getProductionOrderItemsByInventoryId(int $inventoryId, array $with = []): \Illuminate\Support\Collection
{
return ProductionOrderItem::with($with)
->where('inventory_id', $inventoryId)
->get();
}
}