Table of Contents

UPDATE LOADING METER: Loading Meters Calculation for Document Headers

Overview

The UPDATE LOADING METER function calculates and updates the total loading meters for a document header by aggregating loading meters from all document lines. This function provides advanced options for rounding, conditional calculations, and special handling for different handling unit type groups.

Purpose

To provide a comprehensive loading meter calculation for complete documents, enabling:

  • Total loading meter calculation for entire shipments
  • Advanced rounding per handling unit type group
  • Conditional rounding based on minimum values
  • Special handling for rol containers
  • Building-specific filtering
  • Integration with document header fields

Parameters

Parameter Name Type Description Default Value
BUILDING FILTER Code[20] Optional filter to only include document lines within this building. If empty, all buildings are included. '' (empty)
STACKING FACTOR COND Code[10] Condition code containing a stacking factor. Applied to each line's calculation. '' (empty)
SPLIT ORDERPICK COND Code[10] Optional condition. When active, orderpick handling units with this condition are rounded upwards in totaling per Handling Unit Type Group. '' (empty)
INTERLEAVE COND Text Override condition filter for interleave handling units. Can be a filter expression. '' (empty)
PRIORITY PICKCTGROUP Code[10] When multiple order pick handling unit types are allowed, prioritize this handling unit type group. '' (empty)
WEIGHT CARR.TYPE Code[20] Handling Unit type filter. When matched, uses weight/volume-based calculation for that line. '' (empty)
ROLLYCARRIERTYPE Text Optional: Rol container Handling Unit Type Group code. When specified, uses special rol container calculation method. '' (empty)
ROLLYROUNDBY Decimal Optional: Round total quantity in case of rol container by this amount. 0
TOTAL METHOD Integer (Option) Totaling method: 0 = Sum of document lines; 1 = Rounded by Handling Unit Type Group 0
ROUND Integer (Option) Rounding method: 0 = No rounding; 1 = Round up to whole number 0
ROUND CONDITION Text If this condition is active, use rounding method below. If empty, always use rounding method. '' (empty)
RCON MIN. Decimal Optional: Check if total quantity is below this value (when condition is active). 0
RCON MIN. RESULT Decimal Optional: If total quantity is below minimum, return this value (when condition is active). 0
RCON ROUND BY Decimal Optional: If total quantity is above minimum, round by this amount (when condition is active). 0
RCON METHOD Text Rounding method when condition is active: = = nearest; < = down; > = up '>'
RNOCON MIN. Decimal If condition NOT active, check if total quantity is below this value. 0
RNOCON MIN. RESULT Decimal Optional: If total quantity is below minimum, return this value (when condition is NOT active). 0

Algorithm Overview

The UpdateLoadingMeters procedure performs the following steps:

  1. Determine Calculation Method: Check if rol container calculation should be used
  2. Process Document Lines: Calculate loading meters for each line
  3. Aggregate Results: Sum or round per handling unit type group
  4. Apply Conditional Rounding: Apply minimum values and rounding based on conditions
  5. Update Document Header: Store the final result

Calculation Methods

Method 1: Rol Container Calculation

Used when ROLLYCARRIERTYPE is specified and the order pick handling unit type matches this group.

Step 1: Initialize Totals

CTWeight = 0
CTVolume = 0

Step 2: Process All Document Lines

For each document line matching the building filter:

IF UsePosted THEN
    CTWeight += DocumentLine."Gross Weight Posted"
    CTVolume += UnitOfMeasure.Cubage × DocumentLine."Qty. Posted"
ELSE
    CTWeight += DocumentLine."Gross Weight"
    CTVolume += UnitOfMeasure.Cubage × DocumentLine.Quantity
END IF

Where UsePosted = true if any line has posted quantities.

Step 3: Calculate Volume and Weight Factors

CTVolume = CTVolume / CarrierType."Pick Max. Load Cubage"
CTWeight = CTWeight / CarrierType."Pick Max. Load Weight"

Step 4: Determine Maximum Factor

IF CTVolume > CTWeight THEN
    CalcQty = CTVolume
ELSE
    CalcQty = CTWeight
END IF

Step 5: Calculate Result

Result = CalcQty × CarrierTypeGroup."Loading Meter Factor"

Step 6: Apply Conditional Rounding

IF ROUND CONDITION is empty OR condition is active THEN
    IF ROLLYROUNDBY <> 0 THEN
        Result = Round(Result, ROLLYROUNDBY, RCON METHOD)
    END IF
END IF

IF Result < RNOCON MIN. RESULT THEN
    Result = RNOCON MIN. RESULT
END IF

Method 2: Stacked Load Meter Calculation

Standard method used when rol container calculation is not applicable.

Step 1: Process Each Document Line

For each document line matching the building filter:

  1. Check if line has loading meter calculation method:

    IF CustItem."Loading Meters Calc. Method" <> '' THEN
    
  2. Calculate line loading meters:

    NewLoadMeterQty = GetDocLineLoadMeterQty(
        DocumentLine,
        CarrierType,
        StackingFactorConditionCode,
        InterleaveConditionFilter,
        WeightCarrierTypeCode,
        FullCarriers,
        OrderpickCarriers)
    
  3. Update document line:

    IF DocumentLine."Load Meter" <> NewLoadMeterQty THEN
        DocumentLine."Load Meter" = NewLoadMeterQty
        DocumentLine.Modify()
    END IF
    
  4. Handle orderpick handling units:

    IF OrderpickCarriers <> 0 THEN
        GetOrderpickCarrierType(OrderPickCarrierType, DocumentLine, PriorityPickCTGroupCode, SplitOrderpick)
    
        IF SplitOrderpick THEN
            Add to SplitOrderpickPerGroupDict
        ELSE
            Add to RemainingCarrierPerGroupDict
        END IF
    END IF
    

Step 2: Aggregate Results

Based on TOTAL METHOD:

Option 0: Sum Method

DocumentLine.CalcSums("Load Meter")
Result = DocumentLine."Load Meter"

IF ROUND = 1 THEN
    Result = Round(Result, 1, '>')
END IF

Option 1: Round by Handling Unit Type Group

Result = GetLoadMetersRoundedPerCarrierTypeGroup(
    FullCarrierPerGroupDict,
    SplitOrderpickPerGroupDict,
    RemainingCarrierPerGroupDict)

Where GetLoadMetersRoundedPerCarrierTypeGroup:

  • Rounds full handling units per group (up to whole number)
  • Rounds split orderpick handling units per group (up to whole number)
  • Rounds remaining handling units per group (up to whole number)
  • Multiplies each by the group's loading meter factor
  • Sums all results

Step 3: Apply Conditional Rounding

IF ROUND CONDITION is empty OR condition is active THEN
    ConditionActive = TRUE
ELSE
    ConditionActive = HasBooleanCondition(ConditionSetID, RoundCondition)
END IF

IF ConditionActive THEN
    IF Result <= RCON MIN. THEN
        Result = RCON MIN. RESULT
    ELSE
        IF RCON ROUND BY <> 0 AND Result < RCON ROUND BY THEN
            Result = Round(Result, RCON ROUND BY, RCON METHOD)
        END IF
    END IF
ELSE
    IF Result <= RNOCON MIN. THEN
        Result = RNOCON MIN. RESULT
    END IF
END IF

Mermaid Flowchart

flowchart TD
    Start([Start: UpdateLoadingMeters]) --> GetParams[Get Parameters:<br/>BUILDING FILTER, ROUND CONDITION,<br/>ROLLYCARRIERTYPE, etc.]

    GetParams --> CheckRolly{ROLLYCARRIERTYPE<br/>specified AND<br/>matches order pick<br/>handling unit type?}

    CheckRolly -->|Yes| RolContainerMethod[Rol Container Method]
    CheckRolly -->|No| StackedMethod[Stacked Load Meter Method]

    RolContainerMethod --> InitRolly[Initialize CTWeight = 0, CTVolume = 0]
    InitRolly --> ProcessRollyLines[Process all document lines:<br/>Sum weights and volumes]
    ProcessRollyLines --> CalcRollyFactors[CTVolume = CTVolume / Max Cubage<br/>CTWeight = CTWeight / Max Weight]
    CalcRollyFactors --> MaxRollyFactor[CalcQty = MAX CTVolume, CTWeight]
    MaxRollyFactor --> RollyResult[Result = CalcQty × Loading Meter Factor]
    RollyResult --> RollyRound{ROUND CONDITION<br/>active AND<br/>ROLLYROUNDBY <> 0?}
    RollyRound -->|Yes| ApplyRollyRound[Round Result by ROLLYROUNDBY]
    RollyRound -->|No| CheckRollyMin
    ApplyRollyRound --> CheckRollyMin{Result < RNOCON MIN. RESULT?}
    CheckRollyMin -->|Yes| SetRollyMin[Result = RNOCON MIN. RESULT]
    CheckRollyMin -->|No| UpdateHeader
    SetRollyMin --> UpdateHeader

    StackedMethod --> ProcessLines[For each document line<br/>matching BUILDING FILTER]
    ProcessLines --> CheckLineMethod{CustItem has<br/>Loading Meters<br/>Calc. Method?}
    CheckLineMethod -->|Yes| CalcLineMeter[Calculate line loading meters<br/>using GetDocLineLoadMeterQty]
    CheckLineMethod -->|No| ClearLineMeter[Set line Load Meter = 0]
    CalcLineMeter --> UpdateLineMeter{Line Load Meter<br/>changed?}
    UpdateLineMeter -->|Yes| ModifyLine[Update DocumentLine.Load Meter]
    UpdateLineMeter -->|No| CheckOrderpick
    ModifyLine --> CheckOrderpick{OrderpickCarriers <> 0?}
    ClearLineMeter --> NextLine
    CheckOrderpick -->|Yes| GetOrderpickType[Get Orderpick Handling Unit Type<br/>with priority handling]
    GetOrderpickType --> CheckSplit{SPLIT ORDERPICK COND<br/>active?}
    CheckSplit -->|Yes| AddSplitDict[Add to SplitOrderpickPerGroupDict]
    CheckSplit -->|No| AddRemainDict[Add to RemainingCarrierPerGroupDict]
    AddSplitDict --> NextLine
    AddRemainDict --> NextLine
    CheckOrderpick -->|No| NextLine{More lines?}
    NextLine -->|Yes| ProcessLines
    NextLine -->|No| CheckTotalMethod{TOTAL METHOD?}

    CheckTotalMethod -->|0: Sum| SumMethod[Sum all line Load Meters<br/>IF ROUND=1: Round up]
    CheckTotalMethod -->|1: Round by Group| RoundByGroup[Round per Handling Unit Type Group:<br/>Round FullCarriers, SplitOrderpick,<br/>RemainingCarriers per group<br/>Multiply by Loading Meter Factor<br/>Sum all groups]

    SumMethod --> CheckRoundCond{ROUND CONDITION<br/>empty OR active?}
    RoundByGroup --> CheckRoundCond

    CheckRoundCond -->|Yes| ConditionActive[ConditionActive = TRUE]
    CheckRoundCond -->|No| CheckCondition[ConditionActive = HasBooleanCondition]

    ConditionActive --> ApplyCondRound{Result <= RCON MIN.?}
    CheckCondition --> ApplyCondRound

    ApplyCondRound -->|Yes| SetCondMin[Result = RCON MIN. RESULT]
    ApplyCondRound -->|No| CheckCondRound{RCON ROUND BY <> 0<br/>AND Result < RCON ROUND BY?}
    CheckCondRound -->|Yes| RoundCond[Round Result by RCON ROUND BY<br/>using RCON METHOD]
    CheckCondRound -->|No| CheckNoCondMin
    SetCondMin --> UpdateHeader
    RoundCond --> UpdateHeader

    CheckNoCondMin{Result <= RNOCON MIN.?}
    CheckNoCondMin -->|Yes| SetNoCondMin[Result = RNOCON MIN. RESULT]
    CheckNoCondMin -->|No| UpdateHeader

    SetNoCondMin --> UpdateHeader[Update DocumentHeader.Load Meter]
    UpdateHeader --> End([End])

Calculation Steps

Rol Container Method

  1. Initialize totals: Set CTWeight and CTVolume to 0
  2. Process lines: Sum weights and volumes from all matching document lines
  3. Calculate factors: Divide totals by maximum capacity
  4. Get maximum: Use the larger of volume or weight factor
  5. Calculate result: Multiply by loading meter factor
  6. Apply rounding: Round if ROLLYROUNDBY is specified and condition is active
  7. Apply minimum: Use RNOCON MIN. RESULT if result is below threshold

Stacked Load Meter Method

  1. Process each line:

    • Calculate loading meters using GetDocLineLoadMeterQty
    • Update line's Load Meter field
    • Track full handling units and orderpick handling units per handling unit type group
  2. Aggregate results:

    • Sum method: Sum all line loading meters, optionally round up
    • Round by group: Round handling units per group, multiply by factor, sum
  3. Apply conditional rounding:

    • Check if rounding condition is active
    • Apply minimum values and rounding based on condition status

Examples

Example 1: Sum Method with Simple Rounding

Scenario:

  • Document has 3 lines with loading meters: 1.2, 0.8, 0.5
  • TOTAL METHOD = 0 (Sum)
  • ROUND = 1 (Round up)
  • ROUND CONDITION = '' (empty, always active)
  • RCON MIN. = 0
  • RNOCON MIN. = 0

Calculation:

  1. Sum of lines: 1.2 + 0.8 + 0.5 = 2.5
  2. Round up: Round(2.5, 1, '>') = 3.0
  3. No minimum checks (both = 0)
  4. Result: 3.0 Loading Meters

Example 2: Round by Handling Unit Type Group

Scenario:

  • Line 1: FullCarriers = 3, OrderpickCarriers = 0.5, Group = 'EUR' (Factor = 0.4)
  • Line 2: FullCarriers = 2, OrderpickCarriers = 0.3, Group = 'EUR' (Factor = 0.4)
  • Line 3: FullCarriers = 1, OrderpickCarriers = 0.8, Group = 'BLOCK' (Factor = 0.5)
  • TOTAL METHOD = 1 (Round by Handling Unit Type Group)
  • SPLIT ORDERPICK COND: Not active

Calculation:

  1. EUR Group:

    • FullCarriers: 3 + 2 = 5 → Round(5, 1, '>') = 5
    • RemainingCarriers: 0.5 + 0.3 = 0.8 → Round(0.8, 1, '>') = 1
    • EUR Total: (5 + 1) × 0.4 = 2.4
  2. BLOCK Group:

    • FullCarriers: 1 → Round(1, 1, '>') = 1
    • RemainingCarriers: 0.8 → Round(0.8, 1, '>') = 1
    • BLOCK Total: (1 + 1) × 0.5 = 1.0
  3. Total: 2.4 + 1.0 = 3.4 Loading Meters

Result: 3.4 Loading Meters

Example 3: Conditional Rounding with Minimum

Scenario:

  • Sum of lines: 1.8 Loading Meters
  • TOTAL METHOD = 0 (Sum)
  • ROUND CONDITION = 'HIGH_PRIORITY'
  • Condition is active
  • RCON MIN. = 2.0
  • RCON MIN. RESULT = 2.0
  • RCON ROUND BY = 0.5
  • RCON METHOD = '>'

Calculation:

  1. Sum: 1.8 Loading Meters
  2. Condition active: Check minimum
  3. Result (1.8) <= RCON MIN. (2.0): TRUE
  4. Result: 2.0 Loading Meters (RCON MIN. RESULT)

Example 4: Conditional Rounding Above Minimum

Scenario:

  • Sum of lines: 2.3 Loading Meters
  • TOTAL METHOD = 0 (Sum)
  • ROUND CONDITION = 'HIGH_PRIORITY'
  • Condition is active
  • RCON MIN. = 2.0
  • RCON MIN. RESULT = 2.0
  • RCON ROUND BY = 0.5
  • RCON METHOD = '>'

Calculation:

  1. Sum: 2.3 Loading Meters
  2. Condition active: Check minimum
  3. Result (2.3) <= RCON MIN. (2.0): FALSE
  4. Check rounding: RCON ROUND BY (0.5) <> 0 AND Result (2.3) < RCON ROUND BY (0.5): FALSE
    • Note: 2.3 is not < 0.5, so no rounding applied
  5. Result: 2.3 Loading Meters

Example 5: Rol Container Calculation

Scenario:

  • ROLLYCARRIERTYPE = 'ROLLY'
  • Order pick handling unit type matches 'ROLLY'
  • Total weight: 800 kg
  • Total volume: 1.5 m³
  • CarrierType."Pick Max. Load Weight" = 1000 kg
  • CarrierType."Pick Max. Load Cubage" = 2 m³
  • CarrierTypeGroup."Loading Meter Factor" = 0.6
  • ROLLYROUNDBY = 0.5
  • RCON METHOD = '>'
  • RNOCON MIN. RESULT = 0.5

Calculation:

  1. CTVolume = 1.5 / 2 = 0.75
  2. CTWeight = 800 / 1000 = 0.8
  3. CalcQty = MAX(0.75, 0.8) = 0.8
  4. Result = 0.8 × 0.6 = 0.48
  5. Round: Round(0.48, 0.5, '>') = 0.5
  6. Check minimum: 0.5 < 0.5: FALSE (no change)
  7. Result: 0.5 Loading Meters

Important Notes

  • Building Filter: Only lines matching the building filter are included in calculations
  • Posted Quantities: If any line has posted quantities, the calculation uses posted values instead of ordered quantities
  • Split Orderpick: When SPLIT ORDERPICK COND is active, orderpick handling units are tracked separately and rounded per group
  • Priority Pick Handling Unit Type Group: When multiple order pick handling unit types are available, the specified priority group is used first
  • Conditional Rounding: Rounding conditions allow different rounding rules based on document conditions
  • Minimum Values: Both condition-active and condition-inactive minimums can be set
  • Rol Container: Special calculation method for rol containers uses weight/volume aggregation across all lines