Quintiq file version 2.0
|
#parent: #root
|
StaticMethod ValidateInput (
|
output String feedback_o,
|
MacroPlan macroplan,
|
Unit unit,
|
String name,
|
Boolean hasstart,
|
Date start,
|
Boolean hasend,
|
Date end,
|
Boolean hasuserlotsize,
|
Real userminimumquantity,
|
Boolean hasusermaximumquantity,
|
Real usermaximumquantity,
|
Real userlotsize,
|
String processtype
|
) declarative remote as Boolean
|
{
|
Description: 'Validate input, triggered when user create operation from the UI or edit it.'
|
TextBody:
|
[*
|
feedback_o := '';
|
lengthlimit := GlobalParameters_MP::GetLengthOfNames();
|
|
if( isnull( unit ) )
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsNullUnit( processtype );
|
}
|
// name should not be blank and name length should not be more than length limit
|
else if( name = '' or name.Length() > lengthlimit )
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsNameEmpty( lengthlimit, processtype );
|
}
|
else if( hasend and hasstart and ( start >= end ) )
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsStartDateAfterEndDate( end, start );
|
}
|
// if has user lot size, check the remaining
|
else if( hasuserlotsize )
|
{
|
if( userminimumquantity < 0 )
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsNegativeMinimumQuantity( userminimumquantity );
|
}
|
else if( hasusermaximumquantity
|
and usermaximumquantity < 0 ) // check only when hasusermaxquantity is true
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsNegativeMaximumQuantity( usermaximumquantity );
|
}
|
else if( userlotsize < 0 )
|
{
|
feedback_o := Translations::MP_ValidateInput_IsNegativeLotSize( userlotsize );
|
}
|
else if( hasusermaximumquantity
|
and userminimumquantity > usermaximumquantity )
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsMinimumQuantityGreaterThanMaximumQuantity( usermaximumquantity, userminimumquantity );
|
}
|
|
else if( hasusermaximumquantity
|
and userlotsize > usermaximumquantity )
|
{
|
feedback_o := Translations::MP_Process_ValidateInput_IsLotSizeGreaterThanMaximumQuantity( usermaximumquantity, userlotsize );
|
}
|
}
|
|
if( feedback_o <> '' )
|
{
|
processname := MacroPlan::GetSubstituteName( name );
|
// add instance text
|
feedback_o := SanityCheckMessage::GetFormattedMessage( Translations::MP_Process_Instance( processtype, processname ),
|
feedback_o );
|
}
|
|
return feedback_o = '';
|
*]
|
}
|