From 3eef7fe58684ad3e12f23af24ff3442a0c3bceda Mon Sep 17 00:00:00 2001
From: yanweiyuan3 <yanweiyuan3@gmail.com>
Date: 星期四, 12 十月 2023 17:31:34 +0800
Subject: [PATCH] Add Api trans to MacroPlan
---
_Main/BL/Type_Global_MappingCurrencyRate_MP/StaticMethod_SynchronizeMacroPlanData.qbl | 45 +++++++
_Main/BL/Type_Global_MappingLaneLeg/StaticMethod_SynchronizeMacroPlanData.qbl | 60 ++++++++++
_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan#127.qbl | 52 +++-----
_Main/BL/Type_Global_MappingStockingPoint_MP/StaticMethod_SynchronizeMacroPlanData.qbl | 45 +++++++
_Main/BL/Type_Global_MappingCurrency_MP/StaticMethod_SynchronizeMacroPlanData.qbl | 45 +++++++
_Main/BL/Type_Global_MappingLane/StaticMethod_SynchronizeMacroPlanData.qbl | 77 ++++++++++++
6 files changed, 294 insertions(+), 30 deletions(-)
diff --git "a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl" "b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
index 6d84c07..12a5633 100644
--- "a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
+++ "b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
@@ -47,6 +47,8 @@
organcodelist := selectvalues( this, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
}
+ macroPlan.InitialUnitAndStockingPoint();
+
if ( isUnitOfMeasure_MP ) {
Global_MappingUnitOfMeasure_MP::SynchronizeMacroPlanData( this, macroPlan );
}
@@ -106,35 +108,25 @@
//if ( isCustomerGrade ) {
// Global_MappingCustomerGrade::SynchronizeInterfaceData( this, executionUser, "GlobalOTDTable_CustomerGrade" );
//}
- //
- //if ( isStockingPoint_MP ) {
- // this.Global_MappingStockingPoint_MP( relflush );
- // Global_BrokerExecuteLog::CreateInOperation( this, "StockingPoint_MP", executionUser );
- //// this -> Global_MappingStockingPoint_MP::CreateByAPI() -> Exception() -> Global_MappingStockingPoint_MP::OnException( this );
- //}
- //
- //if ( isCurrency_MP ) {
- // this.Global_MappingCurrency_MP( relflush );
- // Global_BrokerExecuteLog::CreateInOperation( this, "Currency_MP", executionUser );
- //// this -> Global_MappingCurrency_MP::CreateByAPI() -> Exception() -> Global_MappingCurrency_MP::OnException( this );
- //}
- //
- //if ( isCurrencyRate_MP ) {
- // this.Global_MappingCurrencyRate_MP( relflush );
- // Global_BrokerExecuteLog::CreateInOperation( this, "CurrencyRate_MP", executionUser );
- //// this -> Global_MappingCurrencyRate_MP::CreateByAPI() -> Exception() -> Global_MappingCurrencyRate_MP::OnException( this );
- //}
- //
- //if ( isLane ) {
- // this.Global_MappingLane( relflush );
- // Global_BrokerExecuteLog::CreateInOperation( this, "Lane", executionUser );
- //// this -> Global_MappingLane::CreateByAPI() -> Exception() -> Global_MappingLane::OnException( this );
- //}
- //
- //if ( isLaneLeg ) {
- // this.Global_MappingLaneLeg( relflush );
- // Global_BrokerExecuteLog::CreateInOperation( this, "LaneLeg", executionUser );
- //// this -> Global_MappingLaneLeg::CreateByAPI() -> Exception() -> Global_MappingLaneLeg::OnException( this );
- //}
+
+ if ( isStockingPoint_MP ) {
+ Global_MappingStockingPoint_MP::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+ }
+
+ if ( isCurrency_MP ) {
+ Global_MappingCurrency_MP::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+ }
+
+ if ( isCurrencyRate_MP ) {
+ Global_MappingCurrencyRate_MP::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+ }
+
+ if ( isLane ) {
+ Global_MappingLane::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+ }
+
+ if ( isLaneLeg ) {
+ Global_MappingLaneLeg::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+ }
*]
}
diff --git a/_Main/BL/Type_Global_MappingCurrencyRate_MP/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingCurrencyRate_MP/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..5913ebe
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCurrencyRate_MP/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,45 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+ GlobalOTDTable globalOTDTable,
+ MacroPlan macroPlan,
+ String executionUser
+)
+{
+ TextBody:
+ [*
+ global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+ Name := "鍚屾璐у竵姹囩巼鏁版嵁",
+ IsSuccess := true,
+ ExecuteUser := executionUser
+ );
+
+
+ try {
+ updates := construct( CurrencyRate_MPs );
+ traverse( globalOTDTable, Global_MappingCurrencyRate_MP, gcr, true )
+ {
+ a := CurrencyRate_MP::CreateCurrencyRate( gcr.CurrencyID(), gcr.Start(), gcr.Rate() );
+ updates.Add( a );
+ }
+ origindataset := selectset( macroPlan, Currency_MP.CurrencyRate_MP, cr, true );
+ obsoletes := origindataset.Difference( updates );
+ // delete obsoleted
+ difflength := obsoletes.Size();
+ for( j:=0; j<difflength; j++ )
+ {
+ obsolete := obsoletes.Element( j );
+ obsolete.Delete();
+ }
+
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ } onerror {
+ global_BrokerExecuteLog.IsSuccess( false );
+ global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+ global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+ global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ }
+ *]
+}
diff --git a/_Main/BL/Type_Global_MappingCurrency_MP/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingCurrency_MP/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..38ac6bb
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingCurrency_MP/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,45 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+ GlobalOTDTable globalOTDTable,
+ MacroPlan macroPlan,
+ String executionUser
+)
+{
+ TextBody:
+ [*
+ global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+ Name := "鍚屾璐у竵鏁版嵁",
+ IsSuccess := true,
+ ExecuteUser := executionUser
+ );
+
+
+ try {
+ updates := construct( Currency_MPs );
+ traverse( globalOTDTable, Global_MappingCurrency_MP, gc, true )
+ {
+ a := Currency_MP::CreateCurrency( macroPlan, gc.ID(), gc.Name(), " ", gc.IsBase() );
+ updates.Add( a );
+ }
+ origindataset := selectset( macroPlan, Currency_MP, c, true );
+ obsoletes := origindataset.Difference( updates );
+ // delete obsoleted
+ difflength := obsoletes.Size();
+ for( j:=0; j<difflength; j++ )
+ {
+ obsolete := obsoletes.Element( j );
+ obsolete.Delete();
+ }
+
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ } onerror {
+ global_BrokerExecuteLog.IsSuccess( false );
+ global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+ global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+ global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ }
+ *]
+}
diff --git a/_Main/BL/Type_Global_MappingLane/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingLane/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..60224b2
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingLane/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,77 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+ GlobalOTDTable globalOTDTable,
+ MacroPlan macroPlan,
+ String executionUser
+)
+{
+ TextBody:
+ [*
+ global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+ Name := "鍚屾杞﹂亾鏁版嵁",
+ IsSuccess := true,
+ ExecuteUser := executionUser
+ );
+
+
+ try {
+ updates := construct( Lanes );
+ traverse( globalOTDTable, Global_MappingLane, gl, true )
+ {
+ id := gl.ID();
+ unitid := gl.UnitID();
+ name := gl.Name();
+ userleadtime := gl.UserLeadTime();
+ processingtime := Duration::Zero();
+
+ unitofmeasurename := "PCS";
+ currencyid := "CNY";
+ startdate := Date::Date( 1900, 1, 1 );
+ enddate := Date::Date( 9999, 12, 31 );
+ capacitytype := "Transport quantity";
+ if( userleadtime.Length() = 0 )
+ {
+ processingtime := Duration::Zero();
+ }
+ else
+ {
+ processingtime := Duration::Hours( [Number]userleadtime );
+ };
+
+ unit := Unit::FindUnitTypeIndex( unitid );
+ if( isnull( unit)){
+ unit :=macroPlan.Unit( relnew,
+ ID := unitid,
+ Name := unitid,
+ UnitOfMeasureName := unitofmeasurename,
+ CurrencyID := currencyid,
+ StartDate := startdate,
+ EndDate := enddate,
+ CapacityType := capacitytype );
+ }
+
+ a := Lane::CreateLane( unit, id, name, processingtime);
+ updates.Add( a );
+ }
+ origindataset := selectset( macroPlan, Unit.Lane, l, true );
+ obsoletes := origindataset.Difference( updates );
+ // delete obsoleted
+ difflength := obsoletes.Size();
+ for( j:=0; j<difflength; j++ )
+ {
+ obsolete := obsoletes.Element( j );
+ obsolete.Delete();
+ }
+
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ } onerror {
+ global_BrokerExecuteLog.IsSuccess( false );
+ global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+ global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+ global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ }
+ *]
+}
diff --git a/_Main/BL/Type_Global_MappingLaneLeg/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingLaneLeg/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..d1743ec
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingLaneLeg/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,60 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+ GlobalOTDTable globalOTDTable,
+ MacroPlan macroPlan,
+ String executionUser
+)
+{
+ TextBody:
+ [*
+ global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+ Name := "鍚屾杞﹂亾璺嚎鏁版嵁",
+ IsSuccess := true,
+ ExecuteUser := executionUser
+ );
+
+
+ try {
+ updates := construct( LaneLegs );
+ traverse( globalOTDTable, Global_MappingLaneLeg, gll, true )
+ {
+ processingtime := Duration::Zero();
+ hasprocessingtime := true;
+ userleadtime := gll.UserLeadTime();
+ if( userleadtime.Length() = 0 )
+ {
+ hasprocessingtime := false;
+ processingtime := Duration::Zero();
+ }
+ else
+ {
+ hasprocessingtime := true;
+ processingtime := Duration::Hours( [Number]userleadtime );
+ };
+
+ lane := Lane::FindLaneTypeIndex( gll.LaneID() );
+ a := LaneLeg::CreateLaneleg(lane, gll.LaneID(), gll.OriginStockingPointID(), gll.DestinationStockingPointID(), gll.Name(), hasprocessingtime, processingtime);
+ updates.Add( a );
+ }
+ origindataset := selectset( macroPlan, Unit.Lane.LaneLeg, ll, true );
+ obsoletes := origindataset.Difference( updates );
+ // delete obsoleted
+ difflength := obsoletes.Size();
+ for( j:=0; j<difflength; j++ )
+ {
+ obsolete := obsoletes.Element( j );
+ obsolete.Delete();
+ }
+
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ } onerror {
+ global_BrokerExecuteLog.IsSuccess( false );
+ global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+ global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+ global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ }
+ *]
+}
diff --git a/_Main/BL/Type_Global_MappingStockingPoint_MP/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingStockingPoint_MP/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..7db4814
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingStockingPoint_MP/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,45 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+ GlobalOTDTable globalOTDTable,
+ MacroPlan macroPlan,
+ String executionUser
+)
+{
+ TextBody:
+ [*
+ global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+ Name := "鍚屾搴撳瓨鐐规暟鎹�",
+ IsSuccess := true,
+ ExecuteUser := executionUser
+ );
+
+
+ try {
+ updates := construct( StockingPoint_MPs );
+ traverse( globalOTDTable, Global_MappingStockingPoint_MP, sp, true )
+ {
+ a := StockingPoint_MP::CreateStockingpoint( macroPlan, sp.ID(), sp.UnitID(), sp.Name() );
+ updates.Add( a );
+ }
+ origindataset := selectset( macroPlan, StockingPoint_MP, sp, true );
+ obsoletes := origindataset.Difference( updates );
+ // delete obsoleted
+ difflength := obsoletes.Size();
+ for( j:=0; j<difflength; j++ )
+ {
+ obsolete := obsoletes.Element( j );
+ obsolete.Delete();
+ }
+
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ } onerror {
+ global_BrokerExecuteLog.IsSuccess( false );
+ global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+ global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+ global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+ global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+ }
+ *]
+}
--
Gitblit v1.9.3