yy
2023-09-25 ab6a21c73e6507923beb22611af772641321c256
Merge branch 'dev_hrh_global'
已修改32个文件
已添加1个文件
413 ■■■■ 文件已修改
LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd#969.qbl 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_BaseConversionFactor/StaticMethod_DoSync.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Forecast/StaticMethod_CreateOrUpdate.qbl 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Global_MappingOperation/StaticMethod_FindMinSeq.qbl 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventoryValueAndCost/StaticMethod_DoSync.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingBaseConversionFactorData.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingSalesSegmentData.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitOfMeasureData.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync#618.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_SalesSegment_MP/StaticMethod_DoSync.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpoint.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_UnitOfMeasure_MP/StaticMethod_DoSync.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd#969.qbl
@@ -16,10 +16,14 @@
      //get period of start 
      ddstartperiod := select( gp.MacroPlan(), PlanningPeriod, pp, pp.Start() <= start and pp.End() > start );
      
      // if not start from middle and leadtime < period task period duration, make sure dependent demand end before period start
      periodstart :=  ifexpr( not gp.IsOperationLeadTimeLogicFromMiddle() and period.Duration() < process.LeadTime(), period.Start(), DateTime::MaxDateTime() );
      value := minvalue( start + process.LeadTime(), start + ddstartperiod.Duration(), periodstart );
      // Tianma fix 20230920
      if( not isnull( ddstartperiod ) )
      {
        // if not start from middle and leadtime < period task period duration, make sure dependent demand end before period start
        periodstart :=  ifexpr( not gp.IsOperationLeadTimeLogicFromMiddle() and period.Duration() < process.LeadTime(), period.Start(), DateTime::MaxDateTime() );
        value := minvalue( start + process.LeadTime(), start + ddstartperiod.Duration(), periodstart );
      }
    }
    
    return value;
_Main/BL/Type_BaseConversionFactor/StaticMethod_CreateOrUpdate.qbl
@@ -19,19 +19,22 @@
    result := null(ConversionFactor );
    
    if( isnull( source ) or isnull( target ) ) {
        error( "can't find source or target unit of measure" )
        info(  "can't find source or target unit of measure" )
    }
    if( productId <> "" ) {
    if( not isnull( source) and not isnull( target)){
      if( productId <> "" ) {
        product := Product_MP::FindById( macroPlan, productId );
    }else{
      result := BaseConversionFactor::CreateUpdate( source, target, factor, product, isEnable )
      }else{
        result := BaseConversionFactor::CreateUpdate( source, target, factor, product, isEnable )
      }
    
    if( isnull( product ) ) {
          info( "invalid product id" )
      if( isnull( product ) ) {
          info( "单位转换出现无效id,"+productId )
        }else{
          result := BaseConversionFactor::CreateUpdate( source, target, factor, product, isEnable );
        }
    }
    
    return result;
  *]
_Main/BL/Type_BaseConversionFactor/StaticMethod_DoSync.qbl
@@ -1,16 +1,17 @@
Quintiq file version 2.0
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan
  MacroPlan macroPlan,
  GlobalOTDTable globalOTDTable
)
{
  Description: '单次同步'
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    info( "Product Finished, Start BaseConversionFactor Data Broker" )
    macroPlan.Broker_OTD_BaseConversionFactor().Execute();
    //info( "Product Finished, Start BaseConversionFactor Data Broker" )
    //macroPlan.Broker_OTD_BaseConversionFactor().Execute();
    info( "BaseConversionFactor Data Broker Finished, Start BaseConversionFactor Mapping" )
    macroPlan.MappingBaseConversionFactorData();
    macroPlan.MappingBaseConversionFactorData(globalOTDTable);
  *]
}
_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
@@ -38,23 +38,23 @@
    }
    // æ£€æŸ¥ä¾èµ–项
    if( isnull( product) ) {
        info( "product not found" );
        info( "product not found" + productId);
    }
    if( isnull( salesSegment) ) {
        info( "sales segment not found" );
        info( "sales segment not found" + salesSegmentName);
    }
    if( isnull( stockingPoint) ) {
        info( "stock point not found" );
        info( "stock point not found" + stockingPointId);
    }
    //if( isnull( currency) ) {
    //    error( "currency not found" );  
    //}
    if( unitOfMeasureName <> "" and isnull( unitOfMeasure) ) {
        info( "unit of measure not found" );
        info( "unit of measure not found" + unitOfMeasureName);
    }
    if( priorityName <> "" and isnull( stockingPoint) ) {
        info( "priority not found" );
    }
    //if( priorityName <> "" and isnull( stockingPoint) ) {
    //    info( "priority not found" );
    //}
    // æ–°å¢ž/更新
    result := CustomerOrder::FindById( macroPlan, id );
    if( isnull( result ) ) {
_Main/BL/Type_CustomerOrder/StaticMethod_DoSync.qbl
@@ -2,15 +2,16 @@
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan,
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    info( "Forecast Finished, Start CustomerOrder Data Broker" );
    macroPlan.Broker_OTD_CustomerOrder().Execute();
    //info( "Forecast Finished, Start CustomerOrder Data Broker" );
    //macroPlan.Broker_OTD_CustomerOrder().Execute();
    info( "CustomerOrder Data Broker Finished, Start CustomerOrder Mapping" );
    macroPlan.MappingCustomerOrderData( businessTypes );
    macroPlan.MappingCustomerOrderData( businessTypes,globalOTDTable );
  *]
}
_Main/BL/Type_Forecast/StaticMethod_CreateOrUpdate.qbl
@@ -33,23 +33,23 @@
    }
    // æ£€æŸ¥ä¾èµ–项
    if( isnull( product ) ) {
        error( "product not found" );
        info(  "product not found" + productId);
    }
    if( isnull( salesSegment ) ) {
        error( "sales segment not found" );
        info( "sales segment not found" + salesSegmentName);
    }
    if( isnull( stockingPoint ) ) {
        error( "stock point not found" );
        info( "stock point not found" + stockingPointId);
    }
    if( isnull( currency ) ) {
        error( "currency not found" );
        info(  "currency not found" + currencyId);
    }
    if( unitOfMeasureName <> "" and isnull( unitOfMeasure) ) {
        error( "unit of measure not found" );
        info( "unit of measure not found" + unitOfMeasureName );
    }
    if( priorityName <> "" and isnull( stockingPoint) ) {
        error( "priority not found" );
    }
    //if( priorityName <> "" and isnull( stockingPoint) ) {
    //    info( "priority not found" );
    //}
    // æ–°å¢ž/更新
    result := Forecast::FindById( macroPlan, id );
    if( isnull( result) ) {
_Main/BL/Type_Forecast/StaticMethod_DoSync.qbl
@@ -2,15 +2,16 @@
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan,
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    info( "OperationCost Finished, Start Forecast Data Broker" );
    macroPlan.Broker_OTD_Forecast().Execute();
    //info( "OperationCost Finished, Start Forecast Data Broker" );
    //macroPlan.Broker_OTD_Forecast().Execute();
    info( "Forecast Data Broker Finished, Start Forecast Mapping" );
    macroPlan.MappingForecastData( businessTypes );
    macroPlan.MappingForecastData( businessTypes,globalOTDTable );
  *]
}
_Main/BL/Type_Global_MappingOperation/StaticMethod_FindMinSeq.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
Quintiq file version 2.0
#parent: #root
StaticMethod FindMinSeq (
  GlobalOTDTable globalOTDTable,
  String orgCode,
  String productId,
  String processSection
) as Number
{
  TextBody:
  [*
    // renhao Sep-20-2023 (created)
    return guard (min( globalOTDTable, Global_MappingOperation, item,
                item.OrganCode() = orgCode and item.ProductID() = productId and item.ProcessSection() = processSection,
                item.SequenceNumber() ), Number::MinNumber() );
  *]
}
_Main/BL/Type_InventoryValueAndCost/StaticMethod_DoSync.qbl
@@ -1,15 +1,16 @@
Quintiq file version 2.0
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan
  MacroPlan macroPlan,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    info( "ActualPISPIP Finished, Start InventoryCost Data Broker" );
    macroPlan.Broker_OTD_InventoryCost().Execute();
    //info( "ActualPISPIP Finished, Start InventoryCost Data Broker" );
    //macroPlan.Broker_OTD_InventoryCost().Execute();
    info( "InventoryCost Data Broker Finished, Start InventoryCost Mapping" );
    macroPlan.MappingInventoryValueAndCostData();
    macroPlan.MappingInventoryValueAndCostData(globalOTDTable);
  *]
}
_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl
@@ -7,88 +7,12 @@
    // Administrator Sep-1-2023 (created)
    
    //Set the Default values
    unitofmeasurename := "PCS";
    currencyid := "CNY";
    startdate := Date::Date( 1900, 1, 1 );
    enddate := Date::Date( 9999, 12, 31 );
    capacitytype := "Transport quantity";
    //unitofMeasureName := "PCS";
    //currencyid := "CNY";
    //startdate := Date::Date( 1900, 1, 1 );
    //enddate := Date::Date( 9999, 12, 31 );
    //capacitytype := "Transport quantity";
    
    if( isnull( Unit::FindById( this, "空运" ) ) ){
      this.Unit( relnew,
                 ID := "空运",
                 Name := "空运",
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
      }
    if( isnull( Unit::FindById( this, "库存事务处理" ) ) ){
      this.Unit( relnew,
                 ID := "库存事务处理",
                 Name := "库存事务处理",
                 UnitOfMeasureName := unitofmeasurename,
                 CurrencyID := currencyid,
                 StartDate := startdate,
                 EndDate := enddate,
                 CapacityType := capacitytype );
    }
    unitofmeasurename := "PCS";
    name := "手动创建库存点";
    currencyname := "CNY";
    isplannedinfinite := false;
    datestart := Date::Construct(1900, 1, 1) ;
    dateend := Date::Construct(9999, 12, 31);
    groupname := " ";
    description := " ";
    isfromdb := true;
    if( isnull( StockingPoint_MP::FindById( this, "F13_FG_STOCK" ) ) ){
      StockingPoint_MP::Create( this,
                                "F13_FG_STOCK",
                                "F13",
                                name,
                                unitofmeasurename,
                                currencyname,
                                isplannedinfinite,
                                datestart,
                                dateend,
                                groupname,
                                description,
                                isfromdb );
    }
    if( isnull( StockingPoint_MP::FindById( this, "H10_SA_STOCK" ) ) ){
      StockingPoint_MP::Create( this,
                                "H10_SA_STOCK",
                                "H10",
                                name,
                                unitofmeasurename,
                                currencyname,
                                isplannedinfinite,
                                datestart,
                                dateend,
                                groupname,
                                description,
                                isfromdb );
    }
    if( isnull( StockingPoint_MP::FindById( this, "Q10_FG_STOCK" ) ) ){
      StockingPoint_MP::Create( this,
                                "Q10_FG_STOCK",
                                "Q10",
                                name,
                                unitofmeasurename,
                                currencyname,
                                isplannedinfinite,
                                datestart,
                                dateend,
                                groupname,
                                description,
                                isfromdb );
    }
    
    existcurrency := Currency_MP::FindById( this, "CNY" );
    if( isnull( existcurrency ) ){
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
@@ -2,21 +2,21 @@
#parent: #root
Method MappingActualPISPIPData (
  Strings businessTypes,
  GlobalOTDTable globalOTDTable,
  Boolean nuclear
)
{
  TextBody:
  [*
    // renhao Aug-14-2023 (created)
    date := Date :: Today();
    listtodeal := selectset( this,MappingActualPISPIP,actual,true );
    listtodeal := selectset( globalOTDTable,Global_MappingActualProductInStockingPointInPeriod,actual,actual.ActualInventoryLevelEnd() > 0 );
    totalcount := listtodeal.Size();
    info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
    traverse( listtodeal,Elements,actual){
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "ActualPISPIP " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
      product := select( this,MappingProduct,product,product.ID() = actual.ProductID() and product.KeyProduct() = nuclear,true);
_Main/BL/Type_MacroPlan/Method_MappingBaseConversionFactorData.qbl
@@ -1,19 +1,21 @@
Quintiq file version 2.0
#parent: #root
Method MappingBaseConversionFactorData
Method MappingBaseConversionFactorData (
  GlobalOTDTable globalOTDTable
)
{
  Description: 'ETL数据转模型数据'
  TextBody:
  [*
    // yypsybs Aug-15-2023 (created)
    traverse( this, MappingBaseConversionFactor, item ) {
    traverse( globalOTDTable, Global_MappingConversionFactor, item ) {
      //如果ProductID不为空,且匹配不到Product,则不创建,返回为空
    //    info( item.ProductId().AsQUILL() );
        BaseConversionFactor::CreateOrUpdate( this, 
                                              item.SourceUnitOfMeasureName(), 
                                              item.TargetUnitOfMeasureName(), 
                                              item.IsEnabled(), 
                                              item.ProductId(),
                                              item.ProductID(),
                                              item.Factor() );
    }
  *]
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
@@ -1,7 +1,8 @@
Quintiq file version 2.0
#parent: #root
Method MappingCustomerOrderData (
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  Description: 'ETL订单预测'
@@ -9,15 +10,15 @@
  [*
    // yypsybs Aug-15-2023 (created)
    // å¾…处理数据
    listToDeal := construct( structured[MappingCustomerOrder] );
    listToDeal := construct( Global_MappingCustomOrders );
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( this, MappingCustomerOrder, item, true );
        listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, true );
    } else {
        listToDeal := selectset( this, MappingCustomerOrder, item, businessTypes.Find( item.BusinessType() ) <> -1 );
        listToDeal := selectset( globalOTDTable, Global_MappingCustomOrder, item, businessTypes.Find( item.BusinessType() ) <> -1 );
    }
    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( listToDeal, Elements, item, item.OrderDate() >= queryStartDate /*and item.OrderDate() <= queryEndDate*/, not isnull( Product_MP::FindById( this, item.ProductID() ) ) and not isnull( StockingPoint_MP::FindById( this, item.StockPointID() ) ) and not isnull( SalesSegment_MP::FindByName( this, item.SalesSegmentName() ) ) );
    listToDeal := selectset( listToDeal, Elements, item, item.OrderDate() >= queryStartDate /*and item.OrderDate() <= queryEndDate*/, not isnull( Product_MP::FindById( this, item.ProductID() ) ) and not isnull( StockingPoint_MP::FindById( this, item.StockingPointID() ) ) and not isnull( SalesSegment_MP::FindByName( this, item.SalesSegmentName() ) ) );
    
    totalcount := listToDeal.Size();
    info( "CustomerOrder has " + totalcount.AsQUILL() + " rows in total" );
@@ -35,7 +36,7 @@
      CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(), 
                                     item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(), 
                                     priorityName, item.ProductID(), 
                                     item.StockPointID(),
                                     item.StockingPointID(),
                                     item.SalesSegmentName(), 
                                     item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable());
    //  }else{
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -2,7 +2,8 @@
#parent: #root
Method MappingExternalSupplyData (
  Strings businessTypes,
  Boolean nuclear
  Boolean nuclear,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
@@ -10,7 +11,7 @@
    // 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( this,MappingExternalSupply,externalSupply, externalSupply.UserQuantity()>0 and externalSupply.Date() >= queryStartDate /*and externalSupply.Date() <= queryEndDate*/);
    listtodeal := selectset( globalOTDTable,Global_MappingInventorySupply,externalSupply, externalSupply.UserQuantity()>0 and externalSupply.Date() >= queryStartDate /*and externalSupply.Date() <= queryEndDate*/);
    totalcount := listtodeal.Size();
    description := "在途在制";
    info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
@@ -21,7 +22,7 @@
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
       }
      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID(),true);
      product := select( globalOTDTable,Global_MappingProduct_MP,product,product.ID() = externalSupply.ProductID(),true);
      
      
      if( not isnull( product)){
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl
@@ -1,7 +1,8 @@
Quintiq file version 2.0
#parent: #root
Method MappingForecastData (
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  Description: 'ETL订单预测'
@@ -9,11 +10,11 @@
  [*
    // yypsybs Aug-15-2023 (created)
    // å¾…处理数据
    listToDeal := construct( structured[MappingForecast] );
    listToDeal := construct( Global_MappingForecasts );
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( this, MappingForecast, item, item.Quantity() > 0 );
        listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, item.Quantity() > 0 );
    } else {
        listToDeal := selectset( this, MappingForecast, item, businessTypes.Find( item.BusinessType() ) <> -1 and item.Quantity()>0 );
        listToDeal := selectset( globalOTDTable, Global_MappingForecast, item, businessTypes.Find( item.BusinessType() ) <> -1 and item.Quantity()>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_MappingInventoryValueAndCostData.qbl
@@ -1,11 +1,13 @@
Quintiq file version 2.0
#parent: #root
Method MappingInventoryValueAndCostData
Method MappingInventoryValueAndCostData (
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    // yypsybs Aug-15-2023 (created)
    listtodeal := selectset( this,MappingInventoryValueAndCost,item,true );
    listtodeal := selectset( globalOTDTable,Global_MappingStockingPointCost,item,true );
    totalcount := listtodeal.Size();
    
    info( "InventoryCost has " + totalcount.AsQUILL() + " rows in total" );
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
@@ -3,7 +3,8 @@
Method MappingOperationBOMData (
  Strings businessTypes,
  Boolean isKeyProduct,
  Boolean createPurchaseSupplyMaterial
  Boolean createPurchaseSupplyMaterial,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
@@ -12,9 +13,9 @@
    
    keyProductList := construct( Strings );
    if( isKeyProduct ) {
        keyProductList := selectuniquevalues( this, MappingProduct, item, item.ProductMajorType()="成品" or item.ProductMajorType()="半成品", item.ID() );
        keyProductList := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, item, item.ProductMajorType()="成品" or item.ProductMajorType()="半成品", item.ID() );
    }
    bomList := selectsortedset(  this, MappingBOM, item,
    bomList := selectsortedset(  globalOTDTable, Global_MappingOperationBOM, item,
                                 ifexpr( isnull( businessTypes ) or businessTypes.Size() = 0, 
                                         true, 
    //                                     businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 )
@@ -61,9 +62,9 @@
                if( not isnull( stockingPoint)){
                  if( isKeyProduct){
                      keyRows := selectset( routingRows,Elements,routingrow,keyProductList.Find( routingrow.ComponentCode())>=0);
                      this.MappingOperationBOMDataRouting( routing,keyRows);
                      this.MappingOperationBOMDataRouting( routing,globalOTDTable,keyRows);
                    }else{
                      this.MappingOperationBOMDataRouting( routing,routingRows);
                      this.MappingOperationBOMDataRouting( routing,globalOTDTable,routingRows);
                    }
                    
                }
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl
@@ -2,7 +2,8 @@
#parent: #root
Method MappingOperationBOMDataRouting (
  Routing routing,
  MappingBOMs routingRows
  GlobalOTDTable globalOTDTable,
  Global_MappingOperationBOMs routingRows
)
{
  TextBody:
@@ -15,7 +16,7 @@
        rows := selectset( routingRows, Elements, row, row.ProcessSection() = processSection );
        firstRow := rows.Element( 0 );
        // æ‰¾orgCode/productId/processSection匹配且sequence最小的一组数据
        minSeq := MappingOperation::FindMinSeq( this, firstRow.OrganCode(), firstRow.ProductCode(), processSection );
        minSeq := Global_MappingOperation::FindMinSeq( globalOTDTable, firstRow.OrganCode(), firstRow.ProductCode(), processSection );
        routingStepId := processSection + "_" + [String]minSeq;
        // æ‰¾å¯¹åº”routingStep
        routingStep := RoutingStep::FindByName( routing, routingStepId );
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl
@@ -1,21 +1,22 @@
Quintiq file version 2.0
#parent: #root
Method MappingOperationData (
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    // yypsybs Aug-18-2023 (created)
    // èŽ·å–æœ‰åºçš„å¾…å¤„ç†è®°å½•
    toDealList := construct( MappingOperations );
    toDealList := construct( Global_MappingOperations ) ;
    if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
        toDealList := selectsortedset( this, MappingOperation, item,
        toDealList := selectsortedset( globalOTDTable, Global_MappingOperation, item,
                                       businessTypes.Find( item.BusinessType() ) >= 0, 
    //                                   businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0, 
                                       item.SequenceNumber() );
    } else {
        toDealList := selectsortedset( this, MappingOperation, item,
        toDealList := selectsortedset( globalOTDTable, Global_MappingOperation, item,
                                       true, 
                                       item.SequenceNumber() );
    }
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
@@ -2,6 +2,7 @@
#parent: #root
Method MappingProductData (
  Strings businesstypes,
  GlobalOTDTable globalOTDTable,
  Boolean iskeyproduct
)
{
@@ -11,21 +12,21 @@
    // Administrator Aug-16-2023 (created)
    // list to deal
    info( "Get list to deal of product" );
    listToDeal := construct( structured[MappingProduct] );
    listToDeal := construct( Global_MappingProduct_MPs );
    
    if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
        if( iskeyproduct = true ){
          listToDeal := selectset( this, MappingProduct, item, item.KeyProduct() = true );
          listToDeal := selectset( globalOTDTable, Global_MappingProduct_MP, item, item.KeyProduct() = true );
          }
        else{
          listToDeal := selectset( this, MappingProduct, item, true );
          listToDeal := selectset( globalOTDTable, Global_MappingProduct_MP, item, true );
          }
    } else {
        if( iskeyproduct = true ){
          listToDeal := selectset( this, MappingProduct, 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( this, MappingProduct, 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_MappingProductInLaneData.qbl
@@ -1,13 +1,15 @@
Quintiq file version 2.0
#parent: #root
Method MappingProductInLaneData
Method MappingProductInLaneData (
  GlobalOTDTable globalOTDTable
)
{
  Description: 'Get Product In Line data'
  TextBody:
  [*
    // Administrator Aug-17-2023 (created)
    // list to deal
    listtodeal := selectset( this, MappingProductInLane, item ,true );
    listtodeal := selectset( globalOTDTable, Global_MappingProductInLane, item ,true );
    totalcount := listtodeal.Size();
    info( "ProductInLane has " + totalcount.AsQUILL() + " rows in total" );
    
_Main/BL/Type_MacroPlan/Method_MappingSalesSegmentData.qbl
@@ -1,7 +1,8 @@
Quintiq file version 2.0
#parent: #root
Method MappingSalesSegmentData (
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  Description: 'ETL销售部门'
@@ -9,11 +10,11 @@
  [*
    // yypsybs Aug-15-2023 (created)
    // å¾…处理数据
    listToDeal := construct( structured[MappingSalesSegment] );
    listToDeal := construct( Global_MappingSalesSegment_MPs );
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( this, MappingSalesSegment, item, true );
        listToDeal := selectset( globalOTDTable, Global_MappingSalesSegment_MP, item, true );
    } else {
        listToDeal := selectset( this, MappingSalesSegment, 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
@@ -1,7 +1,8 @@
Quintiq file version 2.0
#parent: #root
Method MappingUnitData (
  Strings businesstypes
  Strings businesstypes,
  GlobalOTDTable globalOTDTable
)
{
  Description: 'Get unit data from operation mapping'
@@ -9,12 +10,12 @@
  [*
    // Administrator Aug-21-2023 (created)
    // list to deal
    listtodeal := construct( structured[MappingOperation] );
    listtodeal := construct( Global_MappingOperations);
    
    if( isnull( businesstypes ) or businesstypes.Size() = 0 ) {
        listtodeal := selectset( this, MappingOperation, item, true );
        listtodeal := selectset( globalOTDTable, Global_MappingOperation, item, true );
    } else {
        listtodeal := selectset( this, MappingOperation, item,
        listtodeal := selectset( globalOTDTable, Global_MappingOperation, item,
    //                             businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0
                                 businesstypes.Find( item.BusinessType() ) >= 0
                                );
_Main/BL/Type_MacroPlan/Method_MappingUnitOfMeasureData.qbl
@@ -1,6 +1,8 @@
Quintiq file version 2.0
#parent: #root
Method MappingUnitOfMeasureData
Method MappingUnitOfMeasureData (
  GlobalOTDTable globalotdtable
)
{
  Description: 'ETL数据转模型数据'
  TextBody:
@@ -16,7 +18,7 @@
        //error( "multi default unit of measure" )
    }
    
    traverse( this, MappingUnitOfMeasure, item ) {
    traverse( globalotdtable, Global_MappingUnitOfMeasure_MP, item ) {
        UnitOfMeasure_MP::CreateOrUpdate( this, item.Name(), item.IsDefault() );
    }
  *]
_Main/BL/Type_MacroPlan/StaticMethod_DoSync#618.qbl
@@ -4,7 +4,8 @@
  MacroPlan macroPlan,
  String businessTypeStr,
  Boolean isKeyProduct,
  Boolean createPurchaseSupplyMaterial
  Boolean createPurchaseSupplyMaterial,
  GlobalOTDTable globalOTDTable
)
{
  Description: '单次同步'
@@ -15,6 +16,6 @@
    if( businessTypeStr.Length() > 0 ) {
        businessTypes := businessTypeStr.Tokenize( ',' );
    }
    MacroPlan::DoSync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial );
    MacroPlan::DoSync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial ,globalOTDTable);
  *]
}
_Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl
@@ -3,7 +3,8 @@
StaticMethod DoSync (
  MacroPlan macroPlan,
  Boolean isKeyProduct,
  Boolean createPurchaseSupplyMaterial
  Boolean createPurchaseSupplyMaterial,
  GlobalOTDTable globalOTDTable
)
{
  Description: '单次同步'
@@ -11,6 +12,6 @@
  [*
    // yypsybs Aug-17-2023 (created)
    businessTypes := construct( Strings );
    MacroPlan::DoSync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial );
    MacroPlan::DoSync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial ,globalOTDTable);
  *]
}
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -4,7 +4,8 @@
  MacroPlan macroPlan,
  Strings businessTypes,
  Boolean isKeyProduct,
  Boolean createPurchaseSupplyMaterial
  Boolean createPurchaseSupplyMaterial,
  GlobalOTDTable globalOTDTable
)
{
  Description: '单次同步'
@@ -27,10 +28,17 @@
    macroPlan.InitialUnitAndStockingPoint();
    
    // å•位-1
    UnitOfMeasure_MP::DoSync( macroPlan );
    UnitOfMeasure_MP::DoSync( globalOTDTable,macroPlan );
    
    // é”€å”®éƒ¨é—¨-2
    SalesSegment_MP::DoSync( macroPlan, businessTypes );
    SalesSegment_MP::DoSync( macroPlan, businessTypes,globalOTDTable );
    // Unit-9
    // ä¸ŽOperation一同处理
    //info( "BaseConversionFactor Finished, Start Operation Data Broker" );
    //macroPlan.Broker_OTD_Operation().Execute();
    info( "Operation Data Broker Finished, Start Unit Mapping" );
    macroPlan.MappingUnitData( businessTypes ,globalOTDTable);
    
    // åº“存点-3
    info( "Sales Segment Finished, Start Get StockingPoint From Api" )
@@ -63,29 +71,22 @@
    macroPlan.ApiCurencyRatesData( data );
    
    // äº§å“ç‰©æ–™-6
    info( "Get CurrencyRates From Api Finished, Start Product Data Broker" )
    macroPlan.Broker_OTD_Product().Execute();
    //info( "Get CurrencyRates From Api Finished, Start Product Data Broker" )
    //macroPlan.Broker_OTD_Product().Execute();
    info( "Product Data Broker Finished, Start Product Mapping" );
    //testproduct := construct( Strings );
    macroPlan.MappingProductData( businessTypes, isKeyProduct );
    macroPlan.MappingProductData( businessTypes, globalOTDTable,isKeyProduct );
    
    //单位转换-7
    BaseConversionFactor::DoSync( macroPlan );
    // Unit-9
    // ä¸ŽOperation一同处理
    info( "BaseConversionFactor Finished, Start Operation Data Broker" );
    macroPlan.Broker_OTD_Operation().Execute();
    info( "Operation Data Broker Finished, Start Unit Mapping" );
    macroPlan.MappingUnitData( businessTypes );
    BaseConversionFactor::DoSync( macroPlan ,globalOTDTable);
    
    // å·¥è‰ºè·¯çº¿ + BOM-9
    info( "Unit Finished, Start Operation Mapping" );
    macroPlan.MappingOperationData( businessTypes );
    info( "Operation Finished, Start BOM Data Broker" );
    macroPlan.Broker_OTD_BOM().Execute();
    macroPlan.MappingOperationData( businessTypes ,globalOTDTable);
    //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 );
    macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable );
    
    //车道信息-10
    info( "BOM Finished, Start Get Lanes From Api" );
@@ -108,37 +109,35 @@
    macroPlan.ApiLaneLegsData( data );
    
    // ä¾›åº”网络(车道)-12
    info( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" );
    macroPlan.Broker_OTD_ProductInLane().Execute();
    //info( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" );
    //macroPlan.Broker_OTD_ProductInLane().Execute();
    info( "ProductInLane Data Broker Finished, Start ProductInLane Mapping" );
    macroPlan.MappingProductInLaneData();
    macroPlan.MappingProductInLaneData(globalOTDTable);
    
    // åœ¨åº“库存数据-13
    info( "ProductInLane Finished, Start ActualPISPIP Data Broker" );
    macroPlan.Broker_OTD_ActualPISPIP().Execute();
    //info( "ProductInLane Finished, Start ActualPISPIP Data Broker" );
    //macroPlan.Broker_OTD_ActualPISPIP().Execute();
    info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" );
    //macroPlan.MappingActualPISPIPData( businessTypes, true );
    macroPlan.MappingActualPISPIPData( businessTypes, isKeyProduct );
    macroPlan.MappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct );
    
    // åœ¨é€”库存-14
    info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" );
    macroPlan.Broker_OTD_ExternalSupply().Execute();
    //macroPlan.MappingExternalSupplyData( businessTypes, true );
    //info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" );
    //macroPlan.Broker_OTD_ExternalSupply().Execute();
    info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" );
    macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct );
    macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable);
    
    // åº“存成本-15
    InventoryValueAndCost::DoSync( macroPlan );
    InventoryValueAndCost::DoSync( macroPlan,globalOTDTable );
    
    // todo åˆ¶é€ æˆæœ¬-16
    info( "InventoryCost Finished, Start OperationCost Mapping" );
    //macroPlan.MappingOperationCostData( businessTypes );
    
    // è®¢å•预测-17
    Forecast::DoSync( macroPlan, businessTypes );
    Forecast::DoSync( macroPlan, businessTypes ,globalOTDTable);
    
    // è®¢å•需求-18
    CustomerOrder::DoSync( macroPlan, businessTypes );
    CustomerOrder::DoSync( macroPlan, businessTypes,globalOTDTable);
    
    //删除多余报错数据-19
    macroPlan.DeleteSnaityCheck();
_Main/BL/Type_SalesSegment_MP/StaticMethod_DoSync.qbl
@@ -2,15 +2,16 @@
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan,
  Strings businessTypes
  Strings businessTypes,
  GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    info( "UnitOfMeasure_MP Finished, Start Sales Segment Data Broker" )
    macroPlan.Broker_OTD_SalesSegment().Execute();
    //info( "UnitOfMeasure_MP Finished, Start Sales Segment Data Broker" )
    //macroPlan.Broker_OTD_SalesSegment().Execute();
    info( "Sales Segment Data Broker Finished, Start Sales Segment Mapping" )
    macroPlan.MappingSalesSegmentData( businessTypes );
    macroPlan.MappingSalesSegmentData( businessTypes,globalOTDTable );
  *]
}
_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpoint.qbl
@@ -33,7 +33,7 @@
      // Update
      result.Update( unitid, id, name, unitofmeasurename, currencyname, isplannedinfinite, datestart, dateend, groupname, description, isfromdb );
    };
    result.IsPlannedInfinite(true);
    return result;
  *]
}
_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl
@@ -13,6 +13,11 @@
    unitid := datarow.Get( "unitid" ).GetString();
    name := datarow.Get( "name" ).GetString();
    
    unit := Unit::FindUnitTypeIndex( unitid);
    if( isnull( unit)){
      unitid := "生产";
    }
    result := StockingPoint_MP::CreateStockingpoint( mp, id, unitid, name );
    
    return result;
_Main/BL/Type_UnitOfMeasure_MP/StaticMethod_DoSync.qbl
@@ -1,16 +1,17 @@
Quintiq file version 2.0
#parent: #root
StaticMethod DoSync (
  MacroPlan macroPlan
  GlobalOTDTable globalotdtable,
  MacroPlan macroplan
)
{
  Description: '单次同步'
  TextBody:
  [*
    // yypsybs Aug-17-2023 (created)
    info( "Inital Finished, Start UnitOfMeasure_MP Data Broker" )
    macroPlan.Broker_OTD_UnitOfMeasure().Execute();
    //info( "Inital Finished, Start UnitOfMeasure_MP Data Broker" )
    //macroPlan.Broker_OTD_UnitOfMeasure().Execute();
    info( "UnitOfMeasure_MP Data Broker Finished, Start UnitOfMeasure_MP Mapping" )
    macroPlan.MappingUnitOfMeasureData();
    macroplan.MappingUnitOfMeasureData(globalotdtable);
  *]
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
@@ -108,7 +108,7 @@
    // sync data
    if( data.EnableSync() ) {
        MacroPlan::DoSync( macroPlanNew, 
                           data.BusinessType(), data.IsKeyProduct(), data.CreatePurchaseSupplyMaterial() );
                           data.BusinessType(), data.IsKeyProduct(), data.CreatePurchaseSupplyMaterial() ,GlobalOTDTable);
    }
    
    this.Close();
_Main/UI/MacroPlannerWebApp/_ROOT_Project_MacroPlannerWebApp.qp
@@ -5,7 +5,7 @@
  ProjectProperties
  {
    ApplicationComponentName: 'ApplicationMacroPlanner'
    BuildVersion: '2022.3.0.32'
    BuildVersion: '2022.3.0.34'
    Description: 'Quintiq Macro Planner'
    ProjectKind: 'WebClient'
  }