R30423-2 ShipmentLine - Fill System Units

Code 30423-2
Entity Logistics.Shipment.ShipmentLines Entity
Name FillSystemUnits
Attribute NetWeightkg,GrossWeightkg, Volumel, Heightm, Lengthm, Widthm
Layer Front-End
Events AttributeChanged(ParentSalesOrderLine, Quantity, QuantityUnit)
Priority Normal
Modify YES
Applicable Legislations ALL // no condition needed
Action if (ParentSalesOrderLine !=null and ParentSalesOrderLine .Product !=null and Quantity != null and QuantityUnit != null) { NetWeightkg = Quantity.ConvertToOrDefault(GetSystemMeasurementUnit(SystemUnit.NetKilograms), Product, true). GrossWeightkg = Quantity.ConvertToOrDefault(GetSystemMeasurementUnit(SystemUnit.GrossKilograms), Product, true); Volumel = Quantity.ConvertToOrDefault(GetSystemMeasurementUnit( SystemUnit.VolumeLiters), Product, true); Heightm = Quantity.ConvertToOrDefault(GetSystemMeasurementUnit( SystemUnit.HeightMeters), Product, true); Lengthm = Quantity.ConvertToOrDefault(GetSystemMeasurementUnitSystemUnit.LengthMeters), Product, true); Widthm = Quantity.ConvertToOrDefault(GetSystemMeasurementUnit(SystemUnit.WidthMeters), Product, true); }





GetSystemMeasurementUnit =>

measurementUnits = transaction.Query<MeasurementUnit>().Where(mu => mu.SystemUnit == systemUnit)

IF(measurementUnits.Count==0)

throw M1

IF(measurementUnits .Count>1)

throw M2
Description When ParentSalesOrderLine, Quantity or QuantityUnit are changed, the quantities in system units' fields should be recalculated.
Message M1: Cannot find a Measurement Unit that corresponds to system unit '{SystemUnit}'.

M2: The Measurement unit that corresponds to system unit '{0}' cannot be determined because there are more than one measurement units that has the field System Unit filled with '{SystemUnit}'.
Version Introduced: 2020.1
Revocable YES

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.