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
| Quintiq file version 2.0
| #parent: #root
| StaticMethod CreateLaneleg (
| MacroPlan mp,
| Lane lane,
| String laneid,
| String originstockingpointid,
| String destinationstockingpointid,
| String name,
| Boolean hasprocessingtime,
| Duration processingtime
| ) as LaneLeg
| {
| Description: 'Create Laneleg'
| TextBody:
| [*
| // Administrator Jul-12-2023 (created)
| //Set default value
| isenabled := true;
| datestart := Date::Construct(1900, 1, 1) ;
| dateend := Date::Construct(9999, 12, 31);
| preferencebonus := 0.0;
| co2emission :=0.0;
| hasstandardleadtime := false;
| standardleadtime := Duration::Zero();
| isfromdb := true;
|
| //create new stockingpoint
| originstockingpoint := StockingPoint_MP::FindById( mp, originstockingpointid );
| lane.AddStockingPoint( originstockingpoint, true, isfromdb );
| Transaction::Transaction().Propagate();
|
| destinationstockingpoint := StockingPoint_MP::FindById( mp, destinationstockingpointid );
| lane.AddStockingPoint( destinationstockingpoint, false, isfromdb );
|
| Transaction::Transaction().Propagate();
|
| result := LaneLeg::FindByIdAndLane( lane, originstockingpointid, destinationstockingpointid );
|
| if( isnull( result ) )
| {
| result := LaneLeg::Create( lane, originstockingpointid, destinationstockingpointid, isenabled, datestart, dateend, name, hasprocessingtime, processingtime, hasstandardleadtime, standardleadtime, preferencebonus, co2emission, isfromdb );
| }
| else
| {
| // Update
| result.Update(originstockingpointid, destinationstockingpointid, isenabled, datestart, dateend, name, hasprocessingtime, processingtime, hasstandardleadtime, standardleadtime, preferencebonus, co2emission, isfromdb );
| };
|
| return result;
| *]
| }
|
|