انتقل إلى المحتوى الرئيسي

AssemblyDetails

File: src/IM.Domain/Aggregates/TransactionAggregate/ValueObjects/AssemblyDetails.cs Type: Value Object Module: Inventory - Transactions

Purpose

AssemblyDetails is a value object that encapsulates type-specific information for Assembly transactions. It represents the transformation of component items into finished goods through manufacturing or assembly operations. This value object maintains complete traceability by linking to the Bill of Materials (BOM) used for the assembly.

Business Context

Assembly transactions record the production of finished goods from component items. They represent value-added manufacturing operations that transform raw materials or sub-assemblies into final products.

Business Value:

  • Complete manufacturing traceability
  • Accurate component consumption tracking
  • Work-in-progress (WIP) management
  • Production cost calculation (COGS)

Value Object Properties

AssemblyItemId

Type: Guid | Required: Yes Purpose: The finished good item being produced.

QuantityProduced

Type: decimal | Required: Yes Purpose: How many units of the finished good were produced. Rules: Must be positive, up to 4 decimal places

UnitOfMeasureId

Type: Guid | Required: Yes Purpose: Unit of measure for the produced quantity.

AssemblyLocationId

Type: Guid | Required: Yes Purpose: Where the assembly operation occurred.

BillOfMaterialId

Type: Guid | Required: Yes Purpose: The BOM (recipe) used for this assembly. Traceability: Links to specific BOM version used


Factory Method

public static AssemblyDetails Create(
Guid assemblyItemId,
decimal quantityProduced,
Guid unitOfMeasureId,
Guid assemblyLocationId,
Guid billOfMaterialId)

Usage:

var details = AssemblyDetails.Create(
assemblyItemId: finishedWidgetId,
quantityProduced: 100,
unitOfMeasureId: eachUnitId,
assemblyLocationId: productionLineAId,
billOfMaterialId: widgetBomId);

Critical Design: Line Items vs AssemblyDetails

Line Items: Consumed components (inventory decreased) AssemblyDetails: Produced item (inventory increased)

Why Separate: Clear distinction between inputs and outputs

Example:

Assemble 10 Bikes:

Line Items (consumed):
- Frame: -10 units
- Wheels: -20 units
- Handlebars: -10 units

AssemblyDetails (produced):
- Bike: +10 units

All at AssemblyLocationId

Usage Example

// Assemble 50 Office Chairs
var transaction = InventoryTransaction.CreateAssembly(
userId: productionSupervisor.Id,
assemblyItemId: officeChairId,
quantityProduced: 50,
unitOfMeasureId: eachUnitId,
assemblyLocationId: assemblyLine1Id,
billOfMaterialId: chairBomV2Id,
consumedComponents: new[]
{
new InventoryTransaction.LineItemData(seatId, 50, eachUnitId),
new InventoryTransaction.LineItemData(backrestId, 50, eachUnitId),
new InventoryTransaction.LineItemData(wheelsId, 250, eachUnitId), // 5 per chair
new InventoryTransaction.LineItemData(armrestsId, 100, eachUnitId) // 2 per chair
},
reason: "Production order #PO-2024-156",
externalReference: "WO-5678");


Last Updated: 2025-10-23 | Version: 1.0 | Status: Production Ready