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
| Method MappingUnitData (
| Strings businessTypes
| )
| {
| Description: 'Get unit data from operation mapping'
| TextBody:
| [*
| listToDeal := selectset( this, MappingOperation, item, true );
| if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
| listToDeal := selectset( this, MappingOperation, item, businessTypes.Find( item.BusinessType() ) >= 0 );
| }
| // 常量
| unitOfMeasureName := "PCS";
| currencyId := "CNY";
| startDate := Date::Date( 1900, 1, 1 );
| endDate := Date::Date( 9999, 12, 31 );
| capacityType := "Infinite";
| // 逐级创建
| IOUnit::CreateIfNotExistByTree( this, "天马集团", "天马集团", "", unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| IOUnit::CreateIfNotExistByTree( this, "生产", "生产", "天马集团", unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| IOUnit::CreateIfNotExistByTree( this, "供应商", "供应商", "天马集团", unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| IOUnit::CreateIfNotExistByTree( this, "整车运输", "整车运输", "天马集团", unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| // 根据operation创建
| traverse( listToDeal, Elements, op ) {
| // 一级 orgCode
| levelOne := op.OrganCode();
| IOUnit::CreateIfNotExistByTree( this,
| levelOne, op.OrganName(), "生产",
| unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| // 二级 orgCode + plantName
| levelTwo := op.OrganCode() + "_" + op.PlantName();
| IOUnit::CreateIfNotExistByTree( this,
| levelTwo, levelTwo, levelOne,
| unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| // 三级 二级 + processSection
| levelThree := levelTwo + "_" + op.ProcessSection();
| IOUnit::CreateIfNotExistByTree( this,
| levelThree, levelThree, levelTwo,
| unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| // 四级 三级 + line
| if( op.Line() <> "" ) {
| levelFour := levelThree + "_" + op.Line();
| IOUnit::CreateIfNotExistByTree( this,
| levelFour, levelFour, levelThree,
| unitOfMeasureName, currencyId, startDate, endDate, capacityType );
| }
|
| }
| *]
| }
|
|