Add Api trans to MacroPlan
在原有基础上处理了剩余的五个API接口的数据转换逻辑,目前仅剩DOSDOI及Customer Grade两项数据未完成该部分逻辑编写
| | |
| | | organcodelist := selectvalues( this, Global_MappingOperationBOM, bom,true, bom.OrganCode() ); |
| | | } |
| | | |
| | | macroPlan.InitialUnitAndStockingPoint(); |
| | | |
| | | if ( isUnitOfMeasure_MP ) { |
| | | Global_MappingUnitOfMeasure_MP::SynchronizeMacroPlanData( this, macroPlan ); |
| | | } |
| | |
| | | //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 ); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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" ); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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" ); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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" ); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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" ); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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" ); |
| | | } |
| | | *] |
| | | } |