1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
| Quintiq file version 2.0
| #parent: #root
| StaticMethod ValidateInput (
| output String feedback_o,
| output String sanitychkfeedback_o,
| MacroPlan macroplan,
| Unit unit,
| Lane lane,
| String id,
| String name,
| Boolean hasstart,
| Date start,
| Boolean hasend,
| Date end,
| Duration leadtime,
| Boolean checkunique
| ) declarative remote as Boolean
| {
| Description: 'Validate input, triggered when user create lane from the UI or edit it.'
| TextBody:
| [*
| str := '';
| feedback_o := '';
| sanitychkfeedback_o := '';
|
| // Length limit of name
| lengthlimit := GlobalParameters_MP::GetLengthOfNames();
|
| // Check if ID is valid
| if( id = '' or id.Length() > lengthlimit )
| {
| feedback_o := Translations::MP_Lane_ValidateInput_InvalidID( lengthlimit );
| sanitychkfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
| }
| // Check if ID is unique
| else if( checkunique
| and exists( macroplan, Unit.Lane, l, l <> lane, l.ID() = id ) )
| {
| feedback_o := Translations::MP_Lane_ValidateInput_IsNotUnique();
| sanitychkfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
| }
| // Cannot have zero lead time
| else if( leadtime = Duration::Zero() )
| {
| feedback_o := Translations::MP_Lane_ValidateInput_InvalidLeadTime();
| sanitychkfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
| }
| // Validate input as Process_MP
| else if( not Process_MP::ValidateInput( str,
| sanitychkfeedback_o,
| macroplan,
| unit,
| name,
| hasstart,
| start,
| hasend,
| end,
| false, // HasUserLotSize: Lot definitions are not required for lane
| 0.0, // UserMinimumQuantity
| false, // HasUserMaximumQuantity
| 0.0, // UserMaximumQuantity
| 0.0, // UserLotSize
| 0.0, // co2 emission
| Lane::GetDefinitionName() ) ) // As we need to re-use the translation
| {
| feedback_o := str;
| }
|
| // Add feedback text if any of the precondition above is violated
| if( feedback_o <> '' )
| {
| instancetext := Translations::MP_Process_Instance( Lane::GetDefinitionName(), MacroPlan::GetSubstituteName( name ) )
| msg := SanityCheckMessage::GetFormattedMessage( instancetext, feedback_o );
| feedback_o := msg;
| }
|
| return feedback_o = '';
| *]
| }
|
|