From f3dec8f5b480474c9a3b2ea0fabb0f6b9fdc0423 Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期五, 13 十月 2023 17:11:34 +0800
Subject: [PATCH] Merge branch 'dev'
---
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl | 170 +++++++++++++++++++++-----------------------------------
1 files changed, 65 insertions(+), 105 deletions(-)
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
index 47e25d4..712b51b 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
@@ -1,7 +1,9 @@
Quintiq file version 2.0
#parent: #root
Method MappingUnitData (
- Strings businesstypes
+ Strings businesstypes,
+ GlobalOTDTable globalOTDTable,
+ Strings organcodelist
)
{
Description: 'Get unit data from operation mapping'
@@ -9,137 +11,95 @@
[*
// Administrator Aug-21-2023 (created)
// list to deal
- listtodeal := construct( structured[MappingOperation] );
+ listtodeal := construct( Global_MappingOperations);
if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
- listtodeal := selectset( this, MappingOperation, item, true );
+ listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true );
} else {
- listtodeal := selectset( this, MappingOperation, item,
- // businesstypes.Find( item.BusinessType() ) <> -1,
- businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0
- );
+ 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";
- currencyid := "CNY";
- startdate := Date::Date( 1900, 1, 1 );
- enddate := Date::Date( 9999, 12, 31 );
- capacitytype := "Infinite";
+ infinite := "Infinite";
+ capacitytype := "Transport quantity";
// Get the root data
- existroot := Unit::FindById( this, "澶╅┈闆嗗洟" );
- if( isnull( existroot ) ){
- this.Unit( relnew,
- ID := "澶╅┈闆嗗洟",
- Name := "澶╅┈闆嗗洟",
- UnitOfMeasureName := unitofmeasurename,
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate,
- CapacityType := capacitytype );
- }
+ Unit::CreateOrUpdate( this,
+ "澶╅┈闆嗗洟",
+ "澶╅┈闆嗗洟",
+ "",
+ infinite,
+ unitofmeasurename );
// Get the sub root data
- existsubroot := Unit::FindById( this, "鐢熶骇" );
- if( isnull( existsubroot ) ){
- this.Unit( relnew, ID := "鐢熶骇",
- Name := "鐢熶骇",
- ParentUnitID := "澶╅┈闆嗗洟",
- UnitOfMeasureName := unitofmeasurename,
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate,
- CapacityType := capacitytype );
- }
+ Unit::CreateOrUpdate( this,
+ "鐢熶骇",
+ "鐢熶骇",
+ "澶╅┈闆嗗洟",
+ infinite,
+ unitofmeasurename );
- existsubroot := Unit::FindById( this, "渚涘簲鍟�" );
- if( isnull( existsubroot ) ){
- this.Unit( relnew, ID := "渚涘簲鍟�",
- Name := "渚涘簲鍟�",
- ParentUnitID := "澶╅┈闆嗗洟",
- UnitOfMeasureName := unitofmeasurename,
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate,
- CapacityType := capacitytype );
- }
+ supplyunit := Unit::CreateOrUpdate( this,
+ "渚涘簲鍟�",
+ "渚涘簲鍟�",
+ "澶╅┈闆嗗洟",
+ infinite,
+ unitofmeasurename );
+ supplyunit.IsSupplier(true);
- existsubroot := Unit::FindById( this, "鏁磋溅杩愯緭" );
- if( isnull( existsubroot ) ){
- this.Unit( relnew, ID := "鏁磋溅杩愯緭",
- Name := "鏁磋溅杩愯緭",
- ParentUnitID := "澶╅┈闆嗗洟",
- UnitOfMeasureName := unitofmeasurename,
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate,
- CapacityType := capacitytype );
- }
+ Unit::CreateOrUpdate( this,
+ "鏁磋溅杩愯緭",
+ "鏁磋溅杩愯緭",
+ "澶╅┈闆嗗洟",
+ capacitytype,
+ unitofmeasurename );
// Get the unit list
traverse( listtodeal, Elements, item){
- //Get the first level unit
- existfirstlevelunit := Unit::FindById( this, item.OrganCode() );
- // info( item.OrganCode().AsQUILL() );
OrgName := item.OrganName();
if( OrgName = ''){
OrgName := item.OrganCode();
}
- if( isnull( existfirstlevelunit ) ){
- this.Unit( relnew, ID := item.OrganCode(),
- // Name := item.OrganName(),
- Name :=OrgName,
- ParentUnitID := "鐢熶骇",
- UnitOfMeasureName := unitofmeasurename,
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate,
- CapacityType := capacitytype );
- }
+ //Get the first level unit
+ Unit::CreateOrUpdate( this,
+ item.OrganCode(),
+ OrgName,
+ "鐢熶骇",
+ infinite,
+ unitofmeasurename );
+
//Get the second level unit
secondlevelid := item.OrganCode() + "_" + item.PlantName();
- // info( secondlevelid.AsQUILL() );
- existsecondlevelunit := Unit::FindById( this, secondlevelid );
- if( isnull( existsecondlevelunit ) ){
- this.Unit( relnew, ID := secondlevelid,
- Name := secondlevelid,
- ParentUnitID := item.OrganCode(),
- UnitOfMeasureName := unitofmeasurename,
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate,
- CapacityType := capacitytype );
- }
+ Unit::CreateOrUpdate( this,
+ secondlevelid,
+ secondlevelid,
+ item.OrganCode(),
+ infinite,
+ unitofmeasurename );
+
//Get the third level unit
thirdlevelid := secondlevelid + "_" + item.ProcessSection();
- // info( thirdlevelid.AsQUILL() );
- existthirdlevelunit := Unit::FindById( this, thirdlevelid );
- if( isnull( existthirdlevelunit ) ){
- this.Unit( relnew, ID := thirdlevelid,
- Name := thirdlevelid,
- ParentUnitID := secondlevelid,
- CapacityType := "Time",
- UnitOfMeasureName := item.UnitOfMeasureName(),
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate );
- }
+ Unit::CreateOrUpdate( this,
+ thirdlevelid,
+ thirdlevelid,
+ secondlevelid,
+ "Time",
+ item.UnitOfMeasureName() );
+
//Get the last level unit
if( item.Line()<>"" ){
lastlevelid := thirdlevelid + "_" + item.Line();
- // info( lastlevelid.AsQUILL() );
- existlastlevelunit := Unit::FindById( this, lastlevelid );
- if( isnull( existlastlevelunit ) ){
- this.Unit( relnew, ID := lastlevelid,
- Name := lastlevelid,
- ParentUnitID := thirdlevelid,
- CapacityType := "Time",
- UnitOfMeasureName := item.UnitOfMeasureName(),
- CurrencyID := currencyid,
- StartDate := startdate,
- EndDate := enddate );
- }
+ Unit::CreateOrUpdate( this,
+ lastlevelid,
+ lastlevelid,
+ thirdlevelid,
+ "Time",
+ item.UnitOfMeasureName() );
}
}
*]
--
Gitblit v1.9.3