From 528e3f2b8bc550d672656faab2c4dbc2a26dfef8 Mon Sep 17 00:00:00 2001 From: yanweiyuan3 <yanweiyuan3@gmail.com> Date: 星期二, 10 十月 2023 10:20:00 +0800 Subject: [PATCH] Fix Organcode filter --- _Main/BL/Type_Forecast/StaticMethod_DoSync.qbl | 5 +- _Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl | 5 +- _Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl | 31 +++++++++++---- _Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl | 4 +- _Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl | 4 +- _Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl | 4 +- _Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl | 4 +- _Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl | 4 +- _Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl | 4 +- _Main/BL/Type_GlobalDTOTable/Method_SynchronizationAllMappingBrokerAndAPIByOption.qbl | 10 ++-- _Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl | 4 +- _Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl | 4 +- 12 files changed, 50 insertions(+), 33 deletions(-) diff --git a/_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl b/_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl index 170d328..4994e49 100644 --- a/_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl +++ b/_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl @@ -3,7 +3,8 @@ StaticMethod DoSync ( MacroPlan macroPlan, Strings businessTypes, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { TextBody: @@ -12,6 +13,6 @@ //info( "Forecast Finished, Start CustomerOrder Data Broker" ); //macroPlan.Broker_OTD_CustomerOrder().Execute(); info( "CustomerOrder Data Broker Finished, Start CustomerOrder Mapping" ); - macroPlan.MappingCustomerOrderData( businessTypes,globalOTDTable ); + macroPlan.MappingCustomerOrderData( businessTypes,globalOTDTable, organcodelist ); *] } diff --git a/_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl b/_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl index 1fdba27..e952521 100644 --- a/_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl +++ b/_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl @@ -3,7 +3,8 @@ StaticMethod DoSync ( MacroPlan macroPlan, Strings businessTypes, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { TextBody: @@ -12,6 +13,6 @@ //info( "OperationCost Finished, Start Forecast Data Broker" ); //macroPlan.Broker_OTD_Forecast().Execute(); info( "Forecast Data Broker Finished, Start Forecast Mapping" ); - macroPlan.MappingForecastData( businessTypes,globalOTDTable ); + macroPlan.MappingForecastData( businessTypes,globalOTDTable, organcodelist ); *] } diff --git a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizationAllMappingBrokerAndAPIByOption.qbl b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizationAllMappingBrokerAndAPIByOption.qbl index 8c6686f..31f8b7b 100644 --- a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizationAllMappingBrokerAndAPIByOption.qbl +++ b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizationAllMappingBrokerAndAPIByOption.qbl @@ -89,31 +89,31 @@ 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 ); + // 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 ); + // 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 ); + // 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 ); + // 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 ); + // this -> Global_MappingLaneLeg::CreateByAPI() -> Exception() -> Global_MappingLaneLeg::OnException( this ); } *] } diff --git a/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl index a6f9a24..9385366 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl @@ -3,13 +3,13 @@ Method MappingActualPISPIPData ( Strings businessTypes, GlobalOTDTable globalOTDTable, - Boolean nuclear + Boolean nuclear, + Strings organcodelist ) { TextBody: [* // renhao Aug-14-2023 (created) - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); listtodeal := selectset( globalOTDTable, Global_MappingActualProductInStockingPointInPeriod, actual, diff --git a/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl index 9d01ece..da901cc 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl @@ -2,7 +2,8 @@ #parent: #root Method MappingCustomerOrderData ( Strings businessTypes, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { Description: 'ETL璁㈠崟棰勬祴' @@ -14,7 +15,6 @@ if( isnull( businessTypes ) or businessTypes.Size() = 0 ) { listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, true ); } else { - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, diff --git a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl index 39675d3..4db0d6c 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl @@ -3,7 +3,8 @@ Method MappingExternalSupplyData ( Strings businessTypes, Boolean nuclear, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { TextBody: @@ -11,7 +12,6 @@ // renhao Aug-14-2023 (created) queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date(); queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() ); - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); listtodeal := selectset( globalOTDTable, Global_MappingInventorySupply, externalSupply, diff --git a/_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl index 5fbb66c..1c79534 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl @@ -2,7 +2,8 @@ #parent: #root Method MappingForecastData ( Strings businessTypes, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { Description: 'ETL璁㈠崟棰勬祴' @@ -14,7 +15,6 @@ if( isnull( businessTypes ) or businessTypes.Size() = 0 ) { listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, item.Quantity() > 0 ); } else { - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl index 663464c..208a5e8 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl @@ -4,7 +4,8 @@ Strings businessTypes, Boolean isKeyProduct, Boolean createPurchaseSupplyMaterial, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { TextBody: @@ -14,7 +15,6 @@ if( isKeyProduct ) { keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="鎴愬搧" or item.ProductMajorType()="鍗婃垚鍝�", item.ID() ); } - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); bomList := selectsortedset( globalOTDTable, Global_MappingOperationBOM, item, ifexpr( isnull( businessTypes ) or businessTypes.Size() = 0, true, diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl index e6907cc..cdcd7f1 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl @@ -2,7 +2,8 @@ #parent: #root Method MappingOperationCostData ( GlobalOTDTable globalOTDTable, - Strings businesstypes + Strings businesstypes, + Strings organcodelist ) { Description: 'Get operation cost data from operation mapping' @@ -15,7 +16,6 @@ if( isnull( businesstypes ) or businesstypes.Size() = 0 ) { listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true ); } else { - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businesstypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, ( businesstypes.Find( item.BusinessType() ) <> -1 ) and diff --git a/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl index b09ed68..21238e0 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl @@ -2,7 +2,8 @@ #parent: #root Method MappingOperationData ( Strings businessTypes, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { TextBody: @@ -11,7 +12,6 @@ // 鑾峰彇鏈夊簭鐨勫緟澶勭悊璁板綍 toDealList := construct( Global_MappingOperations ) ; if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) { - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); toDealList := selectsortedset( globalOTDTable, Global_MappingOperation, item, ( businessTypes.Find( item.BusinessType() ) >= 0 ) and ( organcodelist.Find( item.OrganCode() ) >= 0 ), diff --git a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl index 671fe30..712b51b 100644 --- a/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl +++ b/_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl @@ -2,7 +2,8 @@ #parent: #root Method MappingUnitData ( Strings businesstypes, - GlobalOTDTable globalOTDTable + GlobalOTDTable globalOTDTable, + Strings organcodelist ) { Description: 'Get unit data from operation mapping' @@ -15,7 +16,6 @@ if( isnull( businesstypes ) or businesstypes.Size() = 0 ) { listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true ); } else { - organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businesstypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, // businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 ( businesstypes.Find( item.BusinessType() ) >= 0 ) and diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl index 875645b..5178d37 100644 --- a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl +++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl @@ -15,11 +15,26 @@ // 甯佺鍜屽竵绉嶆眹鐜� //Currency_MP::CreateCurrencyFromJson( macroPlan, jsonDataRow ); info( "Prepare to do sync" ) + info( "Get organ code list" ) + organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() ); if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) { traverse( businessTypes, Elements, item ) { info( "Business type : " + item ) } + organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() ); } + else{ + if( businessTypes.Size() = 0 ){ + if( not isnull( selectset( globalOTDTable, BusinessType, b, b.BusinessTypeName() = "" ) ) ){ + organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, organ.BusinessType().BusinessTypeName() = "", organ.OrganCodeName() ); + } + } + } + + if( organcodelist.Size() = 0 ){ + organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() ); + } + info( "KeyProduct : " + [String]isKeyProduct ) info( "Create purchase supply material : " + [String]createPurchaseSupplyMaterial ) @@ -38,7 +53,7 @@ //info( "BaseConversionFactor Finished, Start Operation Data Broker" ); //macroPlan.Broker_OTD_Operation().Execute(); info( "Operation Data Broker Finished, Start Unit Mapping" ); - macroPlan.MappingUnitData( businessTypes ,globalOTDTable); + macroPlan.MappingUnitData( businessTypes ,globalOTDTable, organcodelist); // 搴撳瓨鐐�-3 info( "Sales Segment Finished, Start Get StockingPoint From Api" ) @@ -82,11 +97,11 @@ // 宸ヨ壓璺嚎 + BOM-9 info( "Unit Finished, Start Operation Mapping" ); - macroPlan.MappingOperationData( businessTypes ,globalOTDTable); + macroPlan.MappingOperationData( businessTypes ,globalOTDTable, organcodelist ); //info( "Operation Finished, Start BOM Data Broker" ); //macroPlan.Broker_OTD_BOM().Execute(); info( "BOM Data Broker Finished, Start BOM Mapping" ); - macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable ); + macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist ); //杞﹂亾淇℃伅-10 info( "BOM Finished, Start Get Lanes From Api" ); @@ -118,26 +133,26 @@ //info( "ProductInLane Finished, Start ActualPISPIP Data Broker" ); //macroPlan.Broker_OTD_ActualPISPIP().Execute(); info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" ); - macroPlan.MappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct ); + macroPlan.MappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct, organcodelist ); // 鍦ㄩ�斿簱瀛�-14 //info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" ); //macroPlan.Broker_OTD_ExternalSupply().Execute(); info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" ); - macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable); + macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable, organcodelist ); // 搴撳瓨鎴愭湰-15 InventoryValueAndCost::DoSync( macroPlan,globalOTDTable ); // todo 鍒堕�犳垚鏈�-16 info( "InventoryCost Finished, Start OperationCost Mapping" ); - macroPlan.MappingOperationCostData( globalOTDTable, businessTypes ); + macroPlan.MappingOperationCostData( globalOTDTable, businessTypes, organcodelist ); // 璁㈠崟棰勬祴-17 - Forecast::DoSync( macroPlan, businessTypes ,globalOTDTable); + Forecast::DoSync( macroPlan, businessTypes, globalOTDTable, organcodelist ); // 璁㈠崟闇�姹�-18 - CustomerOrder::DoSync( macroPlan, businessTypes, globalOTDTable); + CustomerOrder::DoSync( macroPlan, businessTypes, globalOTDTable, organcodelist ); //鍒犻櫎澶氫綑鎶ラ敊鏁版嵁-19 macroPlan.DeleteSnaityCheck(); -- Gitblit v1.9.3