Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CreateOrUpdate (
|
MacroPlan macroPlan,
|
String sourceUnitOfMeasureName,
|
String targetUnitOfMeasureName,
|
Boolean isEnable,
|
String productId,
|
Real factor
|
) as ConversionFactor
|
{
|
TextBody:
|
[*
|
// yypsybs Aug-14-2023 (created)
|
|
source := UnitOfMeasure_MP::FindByName( macroPlan, sourceUnitOfMeasureName );
|
target := UnitOfMeasure_MP::FindByName( macroPlan, targetUnitOfMeasureName );
|
product := null( Product_MP );
|
result := null(ConversionFactor );
|
|
if( isnull( source ) or isnull( target ) ) {
|
error( "can't find source or target unit of measure" )
|
}
|
info( source)
|
if( productId <> "" ) {
|
product := Product_MP::FindById( macroPlan, productId );
|
info( productId)
|
// if( isnull( product ) ) {
|
// info( "invalid product id" )
|
// }
|
}
|
info( product.ID()+"****")
|
if( isnull( product ) ) {
|
info( "invalid product id" )
|
}else{
|
result := BaseConversionFactor::CreateUpdate( source, target, factor, product, isEnable );
|
}
|
|
return result;
|
*]
|
}
|