lazhen
2024-08-05 afbad399be481afbe886bc2ad1e22abbcd5df771
财务报表bug修复
已添加7个文件
已修改34个文件
已删除2个文件
380 ■■■■■ 文件已修改
_Main/BL/Type_FinancialSalesReport/Method_IsInUnit.qbl 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetDefaultAllUnit.qbl 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetDefaultCCUnit.qbl 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetDefaultDLUnit.qbl 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetSalesSegmentAll.qbl 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetSalesSegmentDL.qbl 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetStockingPointCCLine.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetStockingPointDLLine.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesRow/Method_Initialize0.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryCell/Attribute_AverageInventory.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryCell/Attribute_EndingInventory.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryCell/Attribute_MaximumInventory.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryCell/Attribute_MinimumInventory.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryColumn/Method_GenerateCell.qbl 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventroySummaryRow/Method_SetCellValue#0.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventroySummaryRow/Method_SetCellValue0.qbl 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelExport.def 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelFinancialProductionReportOperation.def 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonSearch_OnClick.def 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelExport#545.def 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReportOperation.def 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_545_ButtonSearch_OnClick#118.def 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelGeneration_844_ddslGeneration_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelMQBMLB_603_ddslMQBMLB_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelPower_858_ddslPower_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelExport.def 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelCategory_RadioButtonGroupUseForPlanning_OnChanged#847.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick#290.def 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPower_ddslPower_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_FinancialSalesReport/Method_IsInUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
Quintiq file version 2.0
#parent: #root
Method IsInUnit (
  StockingPoint_MP sp,
  String unitname
) as Boolean
{
  Description: '是否属于某个线'
  TextBody:
  [*
    // ç”„兰鸽 Aug-5-2024 (created)
    unit                  := sp.Unit();
    parentunits           := unit.GetAllParent();
    return unit.ID() = unitname or exists( parentunits, Elements, punit, punit.ID() = unitname );
  *]
}
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetDefaultAllUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GetDefaultAllUnit () const declarative as String
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    return '<All>';
  *]
}
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetDefaultCCUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GetDefaultCCUnit () const as String
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    return '长春工厂';
    //return 'Assembly Plant (France)';
  *]
}
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetDefaultDLUnit.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GetDefaultDLUnit () const as String
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-25-2024 (created)
    return '大连工厂';
    //return 'Assembly Plant (Spain)';
  *]
}
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetSalesSegmentAll.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetSalesSegmentDL.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetStockingPointCCLine.qbl
@@ -5,6 +5,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Jun-28-2024 (created)
    return '长春装配线边库';
    //return '长春装配线边库';
    return '长春装配线';
  *]
}
_Main/BL/Type_FinancialSalesReport/StaticMethod_GetStockingPointDLLine.qbl
@@ -5,6 +5,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Jun-28-2024 (created)
    return '大连装配线边库';
    //return '大连装配线边库';
    return '大连装配线';
  *]
}
_Main/BL/Type_FinancialSalesRow/Method_Initialize0.qbl
@@ -2,7 +2,7 @@
#parent: #root
Method Initialize (
  FinancialSalesColumn column,
  Real quantity
  Number quantity
)
{
  TextBody:
@@ -10,7 +10,7 @@
    // ç”„兰鸽 Jun-24-2024 (created)
    cell := selectobject( this, FinancialSalesCell, cell, cell.FinancialSalesColumn() = column );
          
    value := [Real]cell.Value() + quantity;
    value := [Number]cell.Value() + quantity;
    cell.Value( [String]value );
  *]
}
_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
@@ -10,9 +10,10 @@
    // ç”„兰鸽 Jun-24-2024 (created)
    owner.FinancialSalesSource( relflush );
    products                  := construct( Product_MPs );
    allsalessegment           := FinancialSalesReport::GetSalesSegmentAll();
    allunit                   := FinancialSalesReport::GetDefaultAllUnit();
    ccunit                    := FinancialSalesReport::GetDefaultCCUnit();
    dlunit                    := FinancialSalesReport::GetDefaultDLUnit();
    ccsalessegment            := FinancialSalesReport::GetSalesSegmentCC();
    dlsalessegment            := FinancialSalesReport::GetSalesSegmentDL();
    tjsalessegment            := FinancialSalesReport::GetSalesSegmentTJ();
    fssalessegment            := FinancialSalesReport::GetSalesSegmentFS();
    ccspline                  := FinancialSalesReport::GetStockingPointCCLine();
@@ -22,73 +23,94 @@
    source                    := owner.FinancialSalesSource( relnew, IsImport := false, Name := FinancialSalesReport::GetDefaultName() );
    table                     := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
    showtable                 := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
    startofplanning           := owner.StartOfPlanning();
    startofplanning           := owner.StartOfPlanning().Date();
    //startofyear               := startofplanning.StartOfYear();
    startofnextyear           := startofplanning.StartOfNextYear();
    
    search                    := source.FinancialSalesSearch( relnew, Unit := allsalessegment, Generation := allsalessegment, MqbMlb := allsalessegment, Power := allsalessegment );
    search                    := source.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
    
    table.GenerateColumn( owner );
    
    //从Forecast查询
    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < startofnextyear.Date() and ( ( forecast.SalesSegmentName() = ccsalessegment and forecast.Product_MP().MQBMLB() = 'MLB' )
              or forecast.SalesSegmentName() = tjsalessegment or forecast.SalesSegmentName() = fssalessegment ) ){
    //首先在forecast界面查找sales segment为长春的所有需求,识别出MLB的所有产品,每个产品按月汇总需求数量
    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < startofnextyear ){
      salessegment            := forecast.SalesSegment_MP();
      parentsalessegments     := salessegment.GetAllParent();
      //是否属于长春
      iscc                    := salessegment.Name() = ccsalessegment or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name() = ccsalessegment );
      //是否属于大连, å³å¤©æ´¥å’Œä½›å±±
      isdl                    := salessegment.Name() = tjsalessegment or salessegment.Name() = fssalessegment
                                  or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name() = tjsalessegment )
                                  or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name() = fssalessegment );
      //Forecast的Sales Segment为长春,识别出MLB的所有产品汇总
      //大连财务销量:首先在forecast界面查找Sales Segment是天津和佛山的所有需求,每个产品按月汇总需求数量
      if( ( iscc and forecast.Product_MP().MQBMLB() = 'MLB' ) or isdl ){
      product    := forecast.Product_MP();
      allrow     := table.GetRow( allsalessegment, product.ID() );
      periodtime := forecast.StartDate().StartOfMonth();
      periodname := periodtime.Format( "M2/D2/Y" );
        //获取合计行
        allrow               := table.GetRow( allunit, product.ID() );
        //获取工厂行
        factoryrow           := table.GetRow( ifexpr( iscc and forecast.Product_MP().MQBMLB() = 'MLB', ccunit, dlunit ), product.ID() );
      
      if( products.Find( product ) < 0 ){
        products.Add( product );
      }
    //  info( '------------------------', periodname, periodtime );
        traverse( forecast, PlanningSalesDemandInPeriod, psdip ){
          periodtime         := psdip.StartDate().StartOfMonth();
          periodname         := periodtime.Format( "M2/D2/Y" );
    //      info( '-------------------------', periodname, periodtime );
      column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
    //  info( '------------------------', column.Name() );
      //Forecast的Sales Segment为长春,识别出MLB的所有产品汇总
      if( forecast.SalesSegmentName() = ccsalessegment and product.MQBMLB() = 'MLB' ){
    //    info( '------------------------', column.Name() );
        ccrow := table.GetRow( ccsalessegment, product.ID() );
    //    info( '------------------------', ccrow.FinancialSalesCell( relsize ), column.FinancialSalesCell( relsize ) );
        ccrow.Initialize( column, forecast.Quantity() );
      }else if( forecast.SalesSegmentName() = tjsalessegment or forecast.SalesSegmentName() = fssalessegment ){
        //大连财务销量:首先在forecast界面查找Sales Segment是天津和佛山的所有需求,每个产品按月汇总需求数量
    //    info( '------------------------', column.Name() );
        dlrow := table.GetRow( dlsalessegment, product.ID() );
    //    info( '------------------------', dlrow.FinancialSalesCell( relsize ), column.FinancialSalesCell( relsize ) );
        dlrow.Initialize( column, forecast.Quantity() );
    //      info( '-------------------------', column.Name() );
          quantity   := ceil( psdip.Quantity() );//向上取整
          factoryrow.Initialize( column, quantity );
          allrow.Initialize( column, quantity );
      }
      allrow.Initialize( column, forecast.Quantity() );
      }
    }
    //从Product planning查找库存点为长春装配线边库的所有MQB产品,取Total Demand字段按月汇总需求数量
    traverse( owner, Product_MP, product, product.IsLeaf() and product.MQBMLB() = 'MQB' ){//产品为MQB
      traverse( product, ProductInStockingPoint_MP, pisp, pisp.StockingPointID() = ccspline ){//库存点为长春装配线边库
        traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning
                and pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Month() ){
    traverse( owner, StockingPoint_MP, stockingpoint ){
    //  unit                  := stockingpoint.Unit();
    //  parentunits           := unit.GetAllParent();
      //是否属于长春装配线
    //  iscc                  := unit.ID() = ccspline or exists( parentunits, Elements, punit, punit.ID() = ccspline );
      if( table.IsInUnit( stockingpoint, ccspline ) ){
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and pisp.Product_MP().MQBMLB() = 'MQB' ){//产品为MQB
          allrow            := table.GetRow( allunit, pisp.ProductID() );
          ccrow             := table.GetRow( ccunit, pisp.ProductID() );
          traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear ){
          periodtime := pispip.Start().StartOfMonth().Date();
          periodname := periodtime.Format( "M2/D2/Y" );
          column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
          ccrow := table.GetRow( ccsalessegment, product.ID() );
          ccrow.Initialize( column, pispip.DependentDemandAndSalesDemandQuantity() );//取Total Demand字段按月汇总需求数量
            quantity        := ceil( pispip.DependentDemandAndSalesDemandQuantity() );//向上取整
          
          allrow     := table.GetRow( allsalessegment, product.ID() );
          allrow.Initialize( column, pispip.DependentDemandAndSalesDemandQuantity() );
            ccrow.Initialize( column, quantity );//取Total Demand字段按月汇总需求数量
            allrow.Initialize( column, quantity );
          }
        }
      }
    }
    startofnextyearlead       := startofplanning.StartOfNextYear() + FinancialSalesReport::GetDefaultTripLeadingTime();
    //大连财务销量:长春的需求需要在trip plan里面找到起始库存点为大连装配线边库,目的地为长春外租库的产品,由于需要考虑产品运输lead time,每个月的汇总数据需要推迟两天进行计算
    traverse( owner, Unit.Lane.LaneLeg, laneleg, laneleg.OriginStockingPointID() = dlspline and laneleg.DestinationStockingPointID() = ccrent ){
    traverse( owner, Unit.Lane.LaneLeg, laneleg ){
      //起始库存点是否是大连装配线边库
      originsp              := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.OriginStockingPointID() );
      isdlspline            := table.IsInUnit( originsp, dlspline );
      //目的地是否是长春外租库
      destisp               := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.DestinationStockingPointID() );
      isccrent              := table.IsInUnit( destisp, ccrent );
      if( isdlspline and isccrent ){
      traverse( laneleg, Trip, trip, trip.Arrival() < startofnextyearlead ){
        periodtime := ( trip.Arrival() - FinancialSalesReport::GetDefaultTripLeadingTime() ).StartOfMonth().Date();
        periodname := periodtime.Format( "M2/D2/Y" );
        
        column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
        traverse( trip, ProductInTrip, pit ){
          dlrow      := table.GetRow( dlsalessegment, pit.ProductID() );
          dlrow.Initialize( column, pit.Quantity() );//取Total Demand字段按月汇总需求数量
            quantity        := ceil( pit.Quantity() );//向上取整
            dlrow           := table.GetRow( dlunit, pit.ProductID() );
            dlrow.Initialize( column, quantity );//汇总数量
          
          allrow     := table.GetRow( allsalessegment, pit.ProductID() );
          allrow.Initialize( column, pit.Quantity() );
            allrow          := table.GetRow( allunit, pit.ProductID() );
            allrow.Initialize( column, quantity );
          }
        }
      }
    }
_Main/BL/Type_InventorySummaryCell/Attribute_AverageInventory.qbl
@@ -4,5 +4,5 @@
{
  #keys: '3[415136.0.865305024][415136.0.865305023][415136.0.865305025]'
  Description: '评价库存'
  ValueType: Real
  ValueType: Number
}
_Main/BL/Type_InventorySummaryCell/Attribute_EndingInventory.qbl
@@ -4,5 +4,5 @@
{
  #keys: '3[415136.0.865304924][415136.0.865304923][415136.0.865304925]'
  Description: '期末库存'
  ValueType: Real
  ValueType: Number
}
_Main/BL/Type_InventorySummaryCell/Attribute_MaximumInventory.qbl
@@ -4,5 +4,5 @@
{
  #keys: '3[415136.0.865304944][415136.0.865304943][415136.0.865304945]'
  Description: '最大库存'
  ValueType: Real
  ValueType: Number
}
_Main/BL/Type_InventorySummaryCell/Attribute_MinimumInventory.qbl
@@ -4,5 +4,5 @@
{
  #keys: '3[415136.0.865304934][415136.0.865304933][415136.0.865304935]'
  Description: '最小库存'
  ValueType: Real
  ValueType: Number
}
_Main/BL/Type_InventorySummaryColumn/Method_GenerateCell.qbl
@@ -20,20 +20,20 @@
    alldetails := selectset( selections, Elements.InventoryInterfaceDataDetail, detail, detail.PartNumber() = productid and detail.Date() >= start and detail.Date() <= end );
    if( alldetails.Size() > 0 ){
      allrow     := table.GetRow( allunit, productid );
      allvalue := sum( alldetails, Elements, e, e.Quantity() );
      allvalue := sum( alldetails, Elements, e, [Number]e.Quantity() );
      allrow.SetCellValue( this, allvalue );
      //长春
      ccdetails := selectset( alldetails, Elements, detail, ccstockingpointids.Find( detail.InventoryPointSelection().StockpoingPoint() ) >= 0 );
      if( ccdetails.Size() > 0 ){
        ccrow := table.GetRow( ccunit, productid );
        value := sum( ccdetails, Elements, e, e.Quantity() );
        value := sum( ccdetails, Elements, e, [Number]e.Quantity() );
        ccrow.SetCellValue( this, value );
      }
      //大连
      dldetails := selectset( alldetails, Elements, detail, dlstockingpointids.Find( detail.InventoryPointSelection().StockpoingPoint() ) >= 0 );
      if( dldetails.Size() > 0 ){
        dlrow := table.GetRow( dlunit, productid );
        value := sum( dldetails, Elements, e, e.Quantity() );
        value := sum( dldetails, Elements, e, [Number]e.Quantity() );
        dlrow.SetCellValue( this, value );
      }
    }
_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl
@@ -5,7 +5,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Jun-28-2024 (created)
    return '长春工程';
    return '长春工厂';
    //return 'Assembly Plant (France)';
  *]
}
_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -27,29 +27,40 @@
    table.GenerateColumn( owner, 'All', startofyear, startofnextyear );
    //info( '-----------------------------------', table.InventorySummaryColumn( relsize ) );
    //库存数量为Actual inventories里面的点Planned inventories字段库存量加总
    traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() and not isnull( pisp.StockingPoint_MP() ) and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
      unit := pisp.StockingPoint_MP().UnitID();
      product := pisp.Product_MP();
    //  info( '-----------------------------------', unit, product.ID() );
    traverse( owner, StockingPoint_MP, stockingpoint ){
      unit                    := stockingpoint.Unit();
      parentunits             := unit.GetAllParent();
      //是否属于长春工厂
      iscc                    := unit.ID() = ccunit or exists( parentunits, Elements, punit, punit.ID() = ccunit );
      //是否属于大连工厂
      isdl                    := unit.ID() = dlunit or exists( parentunits, Elements, punit, punit.ID() = dlunit );
      if( iscc or isdl ){
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() ){
          //获取工厂行
          factoryrow          := table.GetRow( ifexpr( iscc, ccunit, dlunit ), pisp.ProductID() );
          //获取合计行
          allrow              := table.GetRow( allunit, pisp.ProductID() );
          //周度的数据
      weekpispips := construct( ProductInStockingPointInPeriods );
          //月度的数据
      monthpispips := construct( ProductInStockingPointInPeriods );
      nextweek := startofplanning.StartOfNextWeek();
      nextmonth := startofplanning.StartOfNextMonth();
      
      unitrow := table.GetRow( unit, product.ID() );
      allrow     := table.GetRow( allunit, product.ID() );
      pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning and pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
    //  info( '-----------------------------------', isnull( allrow ), pispips.Size() );
      traverse( pispips, Elements, pispip, pispip.Start() = startofplanning ){
    //    info( '-----------------------------------', pispip.Start() );
          pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical()
                                                  and pispip.Start() < startofnextyear
                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
          traverse( pispips, Elements, pispip ){
        period     := pispip.Period_MP();
        periodtime := period.Start().Date();
        periodname := periodtime.Format( "M2/D2/Y" );
        //天,选择日颗粒度时,期末库存,最小库存,最大库存和平均库存的数值保持一致
        daycolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Day() );
        info( daycolumn.Name(), daycolumn.Period(), daycolumn.TimeUnit() );
        unitrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
        allrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
            factoryrow.SetCellValue( daycolumn, [Number]pispip.PlannedInventoryLevelEnd() );
            allrow.SetCellValue( daycolumn, [Number]pispip.PlannedInventoryLevelEnd() );
        
        //周,选择周时,期末库存为每一周最后一天的汇总库存信息,最小库存为这一周库存量最小的一天的数值,最大库存为这一周库存量最大的一天的数值,平均库存为该周的平均值
        if( period.Start() < nextweek ){
@@ -59,11 +70,11 @@
          if( period.Start() = weekend ){
            weekcolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Week() );
            
            maxinventory := max( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
            mininventory := min( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
            aveinventory := average( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
            unitrow.SetCellValue( weekcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
            allrow.SetCellValue( weekcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
                maxinventory  := max( weekpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
                mininventory  := min( weekpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
                aveinventory  := average( weekpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
                factoryrow.SetCellValue( weekcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
                allrow.SetCellValue( weekcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
          }
        }else{
          weekpispips.Flush();
@@ -79,11 +90,11 @@
          if( period.Start() = monthend ){
            monthcolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Month() );
            
            maxinventory := max( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
            mininventory := min( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
            aveinventory := average( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
            unitrow.SetCellValue( monthcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
            allrow.SetCellValue( monthcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
                maxinventory := max( monthpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
                mininventory := min( monthpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
                aveinventory := average( monthpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
                factoryrow.SetCellValue( monthcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
                allrow.SetCellValue( monthcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
          }
        }else{
          monthpispips.Flush();
@@ -92,6 +103,8 @@
        }
      }
    }
      }
    }
    //首先在Entities里识别父级Unit为长春/大连的所有库存点
    //长春库存点
    ccsps := construct( Strings );
_Main/BL/Type_InventroySummaryRow/Method_SetCellValue#0.qbl
@@ -2,7 +2,7 @@
#parent: #root
Method SetCellValue (
  InventorySummaryColumn column,
  Real quantity
  Number quantity
)
{
  TextBody:
_Main/BL/Type_InventroySummaryRow/Method_SetCellValue0.qbl
@@ -2,10 +2,10 @@
#parent: #root
Method SetCellValue (
  InventorySummaryColumn column,
  Real endinginventory,
  Real minimuminventory,
  Real maximuminventory,
  Real averageinventory
  Number endinginventory,
  Number minimuminventory,
  Number maximuminventory,
  Number averageinventory
)
{
  TextBody:
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelExport.def
@@ -12,6 +12,16 @@
      Properties:
      [
        Image: 'EXPORT1'
        Taborder: 1
      ]
    }
    Component ButtonSearch
    {
      #keys: '[415136.0.972170614]'
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'VIEW'
        Taborder: 0
      ]
    }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_PanelFinancialProductionReportOperation.def
@@ -22,7 +22,7 @@
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'EXPORT1'
        Image: 'IMPORT1'
        Taborder: 1
      ]
    }
@@ -32,7 +32,7 @@
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'IMPORT1'
        Image: 'EXPORT1'
        Taborder: 2
      ]
    }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonSearch_OnClick.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
Quintiq file version 2.0
#parent: PanelExport/ButtonSearch
Response OnClick () id:Response_PanelExport_ButtonSearch_OnClick
{
  #keys: '[415136.0.972170823]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  QuillAction
  {
    Body:
    [*
      DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
    *]
    GroupServerCalls: false
  }
}
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def
@@ -11,7 +11,7 @@
    [*
      if( dhSearch.Data().Generation() <> selection ){
        dhSearch.Data().Generation( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def
@@ -11,7 +11,7 @@
    [*
      if( dhSearch.Data().MqbMlb() <> selection ){
        dhSearch.Data().MqbMlb( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def
@@ -11,7 +11,7 @@
    [*
      if( dhSearch.Data().Power() <> selection ){
        dhSearch.Data().Power( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def
@@ -11,7 +11,7 @@
    [*
      if( dhSearch.Data().Unit() <> selection ){
        dhSearch.Data().Unit( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelExport#545.def
@@ -12,6 +12,16 @@
      Properties:
      [
        Image: 'EXPORT1'
        Taborder: 1
      ]
    }
    Component ButtonSearch id:ButtonSearch_75
    {
      #keys: '[415136.0.972100211]'
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'VIEW'
        Taborder: 0
      ]
    }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Component_PanelFinancialSalesReportOperation.def
@@ -22,7 +22,7 @@
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'EXPORT1'
        Image: 'IMPORT1'
        Taborder: 1
      ]
    }
@@ -32,7 +32,7 @@
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'IMPORT1'
        Image: 'EXPORT1'
        Taborder: 2
      ]
    }
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_545_ButtonSearch_OnClick#118.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
Quintiq file version 2.0
#parent: PanelExport_545/ButtonSearch_75
Response OnClick () id:Response_PanelExport_ButtonSearch_OnClick_118
{
  #keys: '[415136.0.972100210]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  QuillAction
  {
    Body:
    [*
      DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
    *]
    GroupServerCalls: false
  }
}
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelGeneration_844_ddslGeneration_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //代数改变后刷新显示
      if( dhSearch.Data().Generation() <> selection ){
        dhSearch.Data().Generation( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelMQBMLB_603_ddslMQBMLB_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //横纵制改变后刷新显示
      if( dhSearch.Data().MqbMlb() <> selection ){
        dhSearch.Data().MqbMlb( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelPower_858_ddslPower_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //功率改变后刷新显示
      if( dhSearch.Data().Power() <> selection ){
        dhSearch.Data().Power( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def
@@ -10,7 +10,7 @@
    Body:
    [*
      
      valueString := "<All>;" + FinancialSalesReport::GetSalesSegmentCC() + ";" + FinancialSalesReport::GetSalesSegmentDL();
      valueString := FinancialSalesReport::GetDefaultAllUnit() + ";" + FinancialSalesReport::GetDefaultCCUnit() + ";" + FinancialSalesReport::GetDefaultDLUnit();
      
      this.Strings( valueString );
    *]
_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //Unit更新后生成新的显示
      if( dhSearch.Data().Unit() <> selection ){
        dhSearch.Data().Unit( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelExport.def
@@ -11,7 +11,17 @@
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'IMPORT1'
        Image: 'EXPORT1'
        Taborder: 1
      ]
    }
    Component ButtonSearch id:ButtonSearch_612
    {
      #keys: '[415136.0.972100788]'
      BaseType: 'WebButton'
      Properties:
      [
        Image: 'VIEW'
        Taborder: 0
      ]
    }
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelCategory_RadioButtonGroupUseForPlanning_OnChanged#847.def
@@ -12,7 +12,7 @@
      //区间改变后刷新显示
      if( dhSearch.Data().Category() <> this.BoundValue() ){
        dhSearch.Data().Category( this.BoundValue() );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick#290.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
Quintiq file version 2.0
#parent: PanelExport/ButtonSearch_612
Response OnClick () id:Response_PanelExport_ButtonSearch_OnClick_290
{
  #keys: '[415136.0.972100787]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  QuillAction
  {
    Body:
    [*
      DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
    *]
    GroupServerCalls: false
  }
}
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //代数改变后刷新显示
      if( dhSearch.Data().Generation() <> selection ){
        dhSearch.Data().Generation( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //横纵制改变后刷新显示
      if( dhSearch.Data().MqbMlb() <> selection ){
        dhSearch.Data().MqbMlb( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def
@@ -15,7 +15,7 @@
      }else{
        if( dhSearch.Data().EndDate() <> this.Date() ){
          dhSearch.Data().EndDate( this.Date() );
          DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //    DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
        }
      }
    *]
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def
@@ -15,7 +15,7 @@
      }else{
        if( dhSearch.Data().StartDate() <> this.Date() ){
          dhSearch.Data().StartDate( this.Date() );
          DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //    DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
        }
      }
    *]
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPower_ddslPower_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //功率改变后刷新显示
      if( dhSearch.Data().Power() <> selection ){
        dhSearch.Data().Power( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false
_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def
@@ -12,7 +12,7 @@
      //Unit更新后生成新的显示
      if( dhSearch.Data().Unit() <> selection ){
        dhSearch.Data().Unit( selection );
        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      //  DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
      }
    *]
    GroupServerCalls: false