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
| Quintiq file version 2.0
| #parent: #root
| StaticMethod CreateOrUpdate (
| Operation operation,
| UnitPeriod unitperiod,
| Real quantity,
| Boolean hasuserquantity
| ) as PeriodTaskOperation
| {
| Description:
| [*
| Create if not found and update if found.
| ONLY use for period roll. Use this method with care.
| *]
| TextBody:
| [*
| // DWE2 May-13-2016 (created)
|
| pto := PeriodTaskOperation::FindPeriodTaskOperationTypeIndex( unitperiod.Start(), operation.ID() );
|
| if( isnull( pto ) )
| {
| info( "isnull pto");
| pto := PeriodTaskOperation::Create( operation, unitperiod, quantity, hasuserquantity );
| }
| else
| {
| info( "update pto");
| pto.Update( quantity, hasuserquantity );
| pto.AsPeriodTaskOperationOfUnitPeriod( relset, unitperiod ); // Shfit the period task to new base unit period
| }
|
| return pto;
| *]
| }
|
|