yanweiyuan3
2023-09-26 0d728947dc4e717bc81f77be4810281cf7eeb15f
Update Dosync method for organcode

对可添加组织编码过滤的部分添加了过滤,值得数以的是对于部分无组织编码但有库存点ID的数据时也了库存点ID的前3位作为组织编码
已修改11个文件
65 ■■■■ 文件已修改
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingSalesSegmentData.qbl 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
@@ -9,7 +9,12 @@
  TextBody:
  [*
    // renhao Aug-14-2023 (created)
    listtodeal := selectset( globalOTDTable,Global_MappingActualProductInStockingPointInPeriod,actual,actual.ActualInventoryLevelEnd() > 0 );
    organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
    listtodeal := selectset( globalOTDTable,
                             Global_MappingActualProductInStockingPointInPeriod,
                             actual,
                             ( actual.ActualInventoryLevelEnd() > 0 ) and
                             ( organcodelist.Find( actual.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
    totalcount := listtodeal.Size();
    info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" );
    
@@ -24,7 +29,7 @@
      if( not isnull(businessTypes)){
      
        for( i :=0 ;i < businessTypes.Size();i++ ){
          businessType := businessTypes.Element( i);
          businessType := businessTypes.Element( i );
          if( product.BusinessType() = businessType and not product.IsCommon()){
            ActualProductInStockingPointInPeriod::CreateOrUpdate( this,
                                                                  actual.ProductID(),
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
@@ -14,7 +14,12 @@
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, true );
    } else {
        listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, businessTypes.Find( item.BusinessType() ) <> -1 );
        organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
        listToDeal := selectset( globalOTDTable,
                                 Global_MappingCustomOrder,
                                 item,
                                 ( businessTypes.Find( item.BusinessType() ) <> -1 ) and
                                 ( organcodelist.Find( item.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
    }
    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() );
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -11,7 +11,13 @@
    // 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() );
    listtodeal := selectset( globalOTDTable,Global_MappingInventorySupply,externalSupply, externalSupply.UserQuantity()>0 and externalSupply.Date() >= queryStartDate /*and externalSupply.Date() <= queryEndDate*/);
    organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
    listtodeal := selectset( globalOTDTable,
                             Global_MappingInventorySupply,
                             externalSupply,
                             ( externalSupply.UserQuantity()>0 ) and
                             ( externalSupply.Date() >= queryStartDate ) and
                             ( organcodelist.Find( externalSupply.StockingPointID().SubString( 0, 3 ) ) >= 0 )/*and externalSupply.Date() <= queryEndDate*/);
    totalcount := listtodeal.Size();
    description := "在途在制";
    info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
@@ -32,7 +38,7 @@
        if( not isnull(businessTypes)){
        
          for( i :=0 ;i < businessTypes.Size();i++ ){
            businessType := businessTypes.Element( i);
            businessType := businessTypes.Element( i );
            if( product.BusinessType() = businessType and not product.IsCommon()){
              InventorySupply::CreateOrUpdate( externalSupply.ID(),
                                               productMP,
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl
@@ -14,7 +14,13 @@
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, item.Quantity() > 0 );
    } else {
        listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, businessTypes.Find( item.BusinessType() ) <> -1 and item.Quantity()>0 );
        organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
        listToDeal := selectset( globalOTDTable,
                                 Global_MappingForecast,
                                 item,
                                 ( businessTypes.Find( item.BusinessType() ) <> -1 ) and
                                 ( item.Quantity()>0 ) and
                                 ( organcodelist.Find( item.StockingPointID().SubString( 0, 3 ) ) >= 0 ) );
    }
    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() );
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
@@ -15,11 +15,13 @@
    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, 
    //                                     businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 )
                                         businessTypes.Find( item.BusinessType() ) >= 0 )
                                         ( businessTypes.Find( item.BusinessType() ) >= 0 ) and
                                         ( organcodelist.Find( item.OrganCode() ) >= 0 ) )
    //                             and ifexpr( isKeyProduct, 
    //                                         keyProductList.Size() > 0 and keyProductList.Find( item.ComponentCode() ) >= 0,
    //                                         true )
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
@@ -1,6 +1,7 @@
Quintiq file version 2.0
#parent: #root
Method MappingOperationCostData (
  GlobalOTDTable globalOTDTable,
  Strings businesstypes
)
{
@@ -14,7 +15,12 @@
    if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
        listtodeal := selectset( this, MappingOperation, item, true );
    } else {
        listtodeal := selectset( this, MappingOperation, item, businesstypes.Find( item.BusinessType() ) <> -1 );
        organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businesstypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
        listtodeal := selectset( this,
                                 MappingOperation,
                                 item,
                                 ( businesstypes.Find( item.BusinessType() ) <> -1 ) and
                                 ( organcodelist.Find( item.OrganCode() ) >= 0 ) );
    }
    
    // Get the list to deal with max sequence number
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl
@@ -11,8 +11,10 @@
    // 获取有序的待处理记录
    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,
                                       ( businessTypes.Find( item.BusinessType() ) >= 0 ) and
                                       ( organcodelist.Find( item.OrganCode() ) >= 0 ),
    //                                   businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0, 
                                       item.SequenceNumber() );
    } else {
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
@@ -23,10 +23,10 @@
          }
    } else {
        if( iskeyproduct = true ){
          listToDeal := selectset( globalOTDTable, Global_MappingProduct_MP, item, item.KeyProduct() = true and businesstypes.Find(  item.BusinessType()) >= 0 );
          listToDeal := selectset( globalOTDTable, Global_MappingProduct_MP, item, item.KeyProduct() = true and businesstypes.Find( item.BusinessType() ) >= 0 );
         }
        else{
          listToDeal := selectset( globalOTDTable, Global_MappingProduct_MP, item, businesstypes.Find(  item.BusinessType()) >= 0 );
          listToDeal := selectset( globalOTDTable, Global_MappingProduct_MP, item, businesstypes.Find( item.BusinessType() ) >= 0 );
        }
    }
    totalcount := listToDeal.Size();
_Main/BL/Type_MacroPlan/Method_MappingSalesSegmentData.qbl
@@ -14,7 +14,10 @@
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( globalOTDTable, Global_MappingSalesSegment_MP, item, true );
    } else {
        listToDeal := selectset( globalOTDTable, Global_MappingSalesSegment_MP, item, businessTypes.Find( item.BusinessType() ) <> -1 );
        listToDeal := selectset( globalOTDTable,
                                 Global_MappingSalesSegment_MP,
                                 item,
                                 businessTypes.Find( item.BusinessType() ) <> -1 );
    }
    //nameList := construct( structured[String] );
    //nameList := selectvalues( listToDeal, Elements, item, true, item.Name() );
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
@@ -15,9 +15,11 @@
    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
                                 ( businesstypes.Find( item.BusinessType() ) >= 0 ) and
                                 ( organcodelist.Find( item.OrganCode() ) >= 0 )
                                );
    }
    
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -131,7 +131,7 @@
    
    // todo 制造成本-16
    info( "InventoryCost Finished, Start OperationCost Mapping" );
    macroPlan.MappingOperationCostData( businessTypes );
    macroPlan.MappingOperationCostData( globalOTDTable, businessTypes );
    
    // 订单预测-17
    Forecast::DoSync( macroPlan, businessTypes ,globalOTDTable);