yanweiyuan3
2023-10-10 528e3f2b8bc550d672656faab2c4dbc2a26dfef8
Fix Organcode filter

添加了场景名称做筛选的情况下事业部为空及组织编码为空等情况的代码处理,目前:
①事业部非空组织编码非空:按事业部、维护的组织编码筛选
②事业部非空组织编码空:按事业部、BOM中所有组织编码筛选
③事业部空组织编码非空:按全事业部、维护的组织编码筛选
④事业部空组织编码空:按全事业部、BOM中所有组织编码筛选
已修改12个文件
83 ■■■■■ 文件已修改
_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_GlobalDTOTable/Method_SynchronizationAllMappingBrokerAndAPIByOption.qbl 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_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 );
  *]
}
_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 );
  *]
}
_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 );
    }
  *]
}
_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,
_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, 
_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, 
_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, 
_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, 
_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 
_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 ), 
_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 
_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();