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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
| Quintiq file version 2.0
| #parent: #root
| Method DoASyncMappingUnitData (
| Strings businesstypes,
| const GlobalOTDTable globalOTDTable,
| Strings organcodelist
| )
| {
| Description: 'Get unit data from operation mapping'
| TextBody:
| [*
| // Administrator Aug-21-2023 (created)
| // list to deal
| listtodeal := construct( Global_MappingOperations, constcontent );
|
| if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
| listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true );
| } else {
| listtodeal := selectset( globalOTDTable, Global_MappingOperation, item,
| // businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0
| ( businesstypes.Find( item.BusinessType() ) >= 0 ) and
| ( organcodelist.Find( item.OrganCode() ) >= 0 )
| );
| }
|
| //Set the Default values
| unitofmeasurename := "PCS";
| infinite := "Infinite";
| capacitytype := "Transport quantity";
|
| // Get the root data
| Unit::CreateOrUpdate( this,
| "天马集团",
| "天马集团",
| "",
| infinite,
| unitofmeasurename );
|
| // Get the sub root data
| Unit::CreateOrUpdate( this,
| "生产",
| "生产",
| "天马集团",
| infinite,
| unitofmeasurename );
|
| supplyunit := Unit::CreateOrUpdate( this,
| "供应商",
| "供应商",
| "天马集团",
| infinite,
| unitofmeasurename );
| supplyunit.IsSupplier(true);
|
| Unit::CreateOrUpdate( this,
| "运输",
| "运输",
| "天马集团",
| capacitytype,
| unitofmeasurename );
|
| // Get the unit list
| traverse( listtodeal, Elements, item){
| OrgName := item.OrganName();
| if( OrgName = ''){
| OrgName := item.OrganCode();
| }
| //Get the first level unit
| Unit::CreateOrUpdate( this,
| item.OrganCode(),
| OrgName,
| "生产",
| infinite,
| unitofmeasurename );
|
| //Get the second level unit
| secondlevelid := item.OrganCode() + "_" + item.PlantName();
| Unit::CreateOrUpdate( this,
| secondlevelid,
| secondlevelid,
| item.OrganCode(),
| infinite,
| unitofmeasurename );
|
| //Get the third level unit
| thirdlevelid := secondlevelid + "_" + item.ProcessSection();
| Unit::CreateOrUpdate( this,
| thirdlevelid,
| thirdlevelid,
| secondlevelid,
| infinite,
| item.UnitOfMeasureName() );
|
| //Get the last level unit
| if( item.Line()<>"" ){
| lastlevelid := thirdlevelid + "_" + item.Line();
| Unit::CreateOrUpdate( this,
| lastlevelid,
| lastlevelid,
| thirdlevelid,
| "Time",
| item.UnitOfMeasureName() );
| }
| }
| *]
| }
|
|