lazhen
2024-10-09 ed070d695972cadcf9b6bbfe9e779aa5a0850125
库存汇总报表数据逻辑bug
已修改13个文件
已添加3个文件
已删除2个文件
346 ■■■■■ 文件已修改
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryColumn/Attribute_EndaDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryColumn/Attribute_StartDate.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachiningPipelineRow/Method_SetAssemblyPlanValue#0.qbl 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_GetDefaultProductParent.qbl
@@ -5,6 +5,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Aug-14-2024 (created)
    return '产成品';
    //return '产成品';
    return '发动机';
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport/StaticMethod_Initialize.qbl
@@ -13,7 +13,7 @@
    allunit                   := CCEngineLogisticsCostReport::GetDefaultAllUnit();
    ccfactory                 := CCEngineLogisticsCostReport::GetCCFactory();
    ccunit                    := CCEngineLogisticsCostReport::GetDefaultCCUnit();
    ccline                    := CCEngineLogisticsCostReport::GetStockingPointCCLine();
    //ccline                    := CCEngineLogisticsCostReport::GetStockingPointCCLine();
    ccrent                    := CCEngineLogisticsCostReport::GetStockingPointCCRent();
    
    startofplanning           := owner.StartOfPlanning().Date();
@@ -30,23 +30,23 @@
    //外租库入库费用:取自财务产量报表的产量,在产品表根据发动机号找到对应的Generation å’Œæ¨ªçºµåˆ¶ï¼Œåœ¨å‘动机成本参数表里找到对应的包装容量和入库单价,用公式计算,月度进行汇总
    traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//财务产量报表非导入
      traverse( source, FinancialProductionReport, report, not report.IsShow() ){//财务产量报表不显示
        traverse( report, FinancialProductionRow, row, row.Unit() = ccunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ) ){//财务产量报表里的长春产量, ä¸ä¸º0
        traverse( report, FinancialProductionRow, row, row.Unit() = ccunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ) ){//财务产量报表里的长春产量, ä¸ä¸º0
          product             := row.Product_MP();
          productparents      := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
            //查询对应的发动机成本
            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
                                                 and engine.MLB_MQB() = product.MQBMLB()
                                                 and engine.Factory() = ccfactory );//ccunit
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
              ccrow           := table.GetRow( row.Name() );
              products.Add( product );
              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ){
              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ){
                cellcolumn    := cell.FinancialProductionColumn();
                enginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                if( not isnull( enginecost ) ){
                  //入库量/包装容量*入库单价,入库量等于长春产量
                  quantity          := ceil( [Number]cell.Value() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                  quantity          := ceil( cell.Quantity() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                  column            := selectobject( table, Column, column, column.Name() = cell.FinancialProductionColumn().Name() );
                  //外租库入库费用 
                  ccrow.SetRentEnterCost( column, quantity );
@@ -60,23 +60,23 @@
    //外租库出库费用:出库量等于长春销量,取自财务销量报表的销量,在产品表根据发动机号找到对应的Generation å’Œæ¨ªçºµåˆ¶ï¼Œåœ¨å‘动机成本参数表里找到对应的包装容量和出库单价,用公式计算,月度进行汇总
    traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//财务销量报表非导入
      traverse( source, FinancialSalesReport, report, not report.IsShow() ){//财务销量报表不显示
        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ) ){//财务销量报表里的长春产量, ä¸ä¸º0
        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ) ){//财务销量报表里的长春产量, ä¸ä¸º0
          product             := row.Product_MP();
          productparents      := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
            //查询对应的发动机成本
            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
            enginecosts       := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
                                                 and engine.MLB_MQB() = product.MQBMLB()
                                                 and engine.Factory() = ccfactory );
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
              ccrow           := table.GetRow( row.Name() );
              products.Add( product );
              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ){
              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ){
                cellcolumn    := cell.FinancialSalesColumn();
                enginecost    := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                if( not isnull( enginecost ) ){
                  //出库量/包装容量*出库单价,入库量等于长春销量
                  quantity    := ceil( [Number]cell.Value() / enginecost.PackagingCapacity() ) * enginecost.WarehousingPrice();
                  quantity    := ceil( [Number]cell.Value() / enginecost.PackagingCapacity() ) * enginecost.OutboundPrice();
                  column      := selectobject( table, Column, column, column.Name() = cell.FinancialSalesColumn().Name() );
                  //外租库出库费用
                  ccrow.SetRentOutCost( column, quantity );
@@ -91,7 +91,7 @@
    traverse( owner, Unit.Lane.LaneLeg, laneleg ){
      //起始库存点是否是长春装配线边库
      originsp               := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.OriginStockingPointID() );
      isccspline             := table.IsInUnit( originsp, ccline );
      isccspline             := table.IsInUnit( originsp, 'CC åŽ‚å†…åº“' );
      //目的地是否是长春外租库
      destisp                := selectobject( owner, StockingPoint_MP, sp, sp.ID() = laneleg.DestinationStockingPointID() );
      isccrent               := table.IsInUnit( destisp, ccrent );
@@ -101,8 +101,8 @@
          periodname         := periodtime.Format( "M2/D2/Y" );
          
          column             := selectobject( table, Column, column, column.Name() = periodname and column.StartDate() = periodtime );
          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.StartDate() <= trip.Arrival().Date() and engine.EndDate() >= trip.Arrival().Date() );
          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.StartDate() <= trip.Arrival().Date() and trans.EndDate() >= trip.Arrival().Date() );
          enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.StartDate() <= trip.Arrival().Date() and engine.EndDate() >= trip.Arrival().Date() );
          transcosts         := selectset( owner, LogisticsCostTransport, trans, trans.LoadingCapacity() <> 0 and trans.StartDate() <= trip.Arrival().Date() and trans.EndDate() >= trip.Arrival().Date() );
          if( not isnull( enginecosts ) and enginecosts.Size() > 0 and not isnull( transcosts ) and transcosts.Size() > 0 ){
            traverse( trip, ProductInTrip, pit, pit.Quantity() <> 0 ){
              product          := pit.Product_MP();
@@ -113,7 +113,7 @@
                                                   and engine.MLB_MQB() = product.MQBMLB()
                                                   and engine.Factory() = ccfactory );
                //在运输成本参数表里找到发动机对应运输单价和装载容量
                transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = ccline
                transcost      := selectobject( transcosts, Elements, trans, trans.Origin() = 'CC åŽ‚å†…åº“'
                                                  and trans.Destination() = ccrent 
                                                  and exists( productparents, Elements, e, ifexpr( trans.Product().FindString( '发动机', 0 ) >= 0, e.ID() = produtparent,  e.ID() = trans.Product() ) ) );
                if( not isnull( enginecost ) and not isnull( transcost ) ){
@@ -142,7 +142,7 @@
          productparents       := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){////查询产品类型是发动机
            //查询对应的发动机成本
            enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.Generation().ToLower() = product.Generation().ToLower()
            enginecosts        := selectset( owner, LogisticsCostEngine, engine, engine.PackagingCapacity() <> 0 and engine.Generation().ToLower() = product.Generation().ToLower()
                                                 and engine.MLB_MQB() = product.MQBMLB()
                                                 and engine.Factory() = ccfactory );
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_GetDefaultProductParent.qbl
@@ -5,6 +5,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Aug-14-2024 (created)
    return '产成品';
    //return '产成品';
    return '发动机';
  *]
}
_Main/BL/Type_CCEngineLogisticsCostReport0/StaticMethod_InitializeNew.qbl
@@ -136,7 +136,7 @@
    //大连外租库入库费用:入库量/包装容量*入库单价,入库量等于大连工厂该产品产量减去发往长春(大连的长春外租库)的数量-newSupply
    traverse( owner, FinancialProductionSource, source, not source.IsImport() ){//财务产量报表非导入
      traverse( source, FinancialProductionReport, report, not report.IsShow() ){//财务产量报表不显示
        traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ) ){//财务产量报表里的大连产量, ä¸ä¸º0
        traverse( report, FinancialProductionRow, row, row.Unit() = dlunit and exists( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ) ){//财务产量报表里的大连产量, ä¸ä¸º0
          product            := row.Product_MP();
          productparents     := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
@@ -147,7 +147,7 @@
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
              products.Add( product );
              ccrow          := table.GetRow( row.Name() );
              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and cell.FinancialProductionColumn().IsDay() ){
              traverse( row, FinancialProductionCell, cell, cell.Value() <> '0' and not cell.FinancialProductionColumn().IsDay() ){
                cellcolumn   := cell.FinancialProductionColumn();
                enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                if( not isnull( enginecost ) ){
@@ -164,7 +164,7 @@
    //大连外租库出库费用:出库量/包装容量*出库单价,出库量等于大连工厂该产品销量减去发往长春的数量-newSupply, å¤§è¿žåŽ‚å†…åº“ï¼Œå¤§è¿žå¤–ç§Ÿåº“
    traverse( owner, FinancialSalesSource, source, not source.IsImport() ){//财务销量报表非导入
      traverse( source, FinancialSalesReport, report, not report.IsShow() ){//财务销量报表不显示
        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ) ){//财务销量报表里的大连产量, ä¸ä¸º0
        traverse( report, FinancialSalesRow, row, row.Unit() = ccunit and exists( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ) ){//财务销量报表里的大连产量, ä¸ä¸º0
          product            := row.Product_MP();
          productparents     := product.GetAllParent();
          if( exists( productparents, Elements, e, e.ID() = produtparent ) ){//查询产品类型是发动机
@@ -175,7 +175,7 @@
            if( not isnull( enginecosts ) and enginecosts.Size() > 0 ){
              products.Add( product );
              ccrow          := table.GetRow( row.Name() );
              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and cell.FinancialSalesColumn().IsDay() ){
              traverse( row, FinancialSalesCell, cell, cell.Value() <> '0' and not cell.FinancialSalesColumn().IsDay() ){
                cellcolumn   := cell.FinancialSalesColumn();
                enginecost   := selectobject( enginecosts, Elements, engine, engine.StartDate() <= cellcolumn.Period() and engine.EndDate() >= cellcolumn.Period() );
                if(  not isnull( enginecost ) ){
@@ -233,7 +233,7 @@
      salessegment            := forecast.SalesSegment_MP();
      parentsalessegments     := salessegment.GetAllParent();
      //是否属于长春
      iscc                    := salessegment.Name().StartsWith( 'Changechun' ) or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name().StartsWith( 'Changechun' ) );
      iscc                    := salessegment.Name().StartsWith( 'Changchun' ) or exists( parentsalessegments, Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) );
      if( iscc ){
        product               := forecast.Product_MP();
        productparents        := product.GetAllParent();
_Main/BL/Type_EnginePipelineReport/StaticMethod_GetDefaultProductParent.qbl
@@ -5,6 +5,7 @@
  TextBody:
  [*
    // ç”„兰鸽 Aug-14-2024 (created)
    return '产成品';
    //return '产成品';
    return '发动机';
  *]
}
_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl
@@ -8,14 +8,7 @@
  [*
    // ç”„兰鸽 Jun-24-2024 (created)
    owner.EnginePipelineSource( relflush );
    //ccunit                    := EnginePipelineReport::GetDefaultCCUnit();
    //dlunit                    := EnginePipelineReport::GetDefaultDLUnit();
    productparent             := EnginePipelineReport::GetDefaultProductParent();
    //ccalineunit               := EnginePipelineReport::GetDefaultCCALineUnit();
    //dlalienunit               := EnginePipelineReport::GetDefaultDLALineUnit()
    //ccmplineunit              := EnginePipelineReport::GetDefaultCCMPLineUnit()
    //dlmplineunit              := EnginePipelineReport::GetDefaultDLMPLineUnit();
    //allunit                   := EnginePipelineReport::GetDefaultAllUnit();
    source                    := owner.EnginePipelineSource( relnew, Name := EnginePipelineReport::GetDefaultName() );
    table                     := source.Report( relnew, ID := source.Name(), Name := source.Name() );
    showtable                 := source.Report( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true );
@@ -28,16 +21,11 @@
    endperiod                 := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() );
    
    //生成生产和库存数据
    //traverse( owner, StockingPoint_MP, stockingpoint ){
    traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '厂内库' ) ){
    //  unit                    := stockingpoint.Unit();
    //  parentunits             := unit.GetAllParent();
    traverse( owner, StockingPoint_MP, stockingpoint ){
      //是否属于长春工厂
    //  iscc                    := unit.ID() = ccalineunit or unit.ID() = ccmplineunit or exists( parentunits, Elements, punit, punit.ID() = ccalineunit or punit.ID() = ccmplineunit );
      iscc                    := stockingpoint.ID().StartsWith( 'CC' );
      iscc                    := ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '长春' ) ) and stockingpoint.ID().EndsWith( '厂内库' );
      //是否属于大连工厂
    //  isdl                    := unit.ID() = dlalienunit or unit.ID() = dlmplineunit  or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit );
      isdl                    := stockingpoint.ID().StartsWith( '大连' );
      isdl                    := ( ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '大连' ) ) and stockingpoint.ID().EndsWith( '厂内库' ) ) or  stockingpoint.ID() = '大连外租库';
      
      traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem() 
                and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
_Main/BL/Type_InventorySummaryColumn/Attribute_EndaDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute EndaDate
{
  #keys: '3[415136.0.1181174808][415136.0.1181174807][415136.0.1181174809]'
  ValueType: Date
}
_Main/BL/Type_InventorySummaryColumn/Attribute_StartDate.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
Quintiq file version 2.0
#parent: #root
Attribute StartDate
{
  #keys: '3[415136.0.1181144701][415136.0.1181144700][415136.0.1181144702]'
  ValueType: Date
}
_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
@@ -13,36 +13,40 @@
    startofendyear            := startofplanning.StartOfNextYear() - Duration::Days( 1 );
    //查询日期返回需要在计划日期之内
    if( search.StartDate().DateTime() < startofendyear and search.EndDate().DateTime() > startofyear ){
      table      := selectobject( this, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() );
      allunit    := '<All>';
      table                   := selectobject( this, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() );
      allunit                 := '<All>';
      //清空之前存储的显示数据
      this.Clear( search.Category(), search.StartDate().DateTime(), search.EndDate().DateTime() );
      //过滤后的产品id
      productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
                                        and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
                                        and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
      sumrow     := this.InventroySummaryRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.InventroySummaryRow( relsize ) );
      productids              := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
                                                     and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
                                                     and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
      sumrow                  := this.InventroySummaryRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.InventroySummaryRow( relsize ) );
      sumrow.InitializeCell( this );
      traverse( table, InventroySummaryRow, row, row.Unit() = search.Unit() ){
        productid  := construct( Strings );
        productid             := construct( Strings );
        productid.Add( row.Name() );
        
        if( productids.ContainsAll( productid ) ){
          showrow := this.InventroySummaryRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
          traverse( row, InventorySummaryCell, cell, cell.InventorySummaryColumn().TimeUnit() = search.Category() ){
            column   := selectobject( this, InventorySummaryColumn, column, column.Name() = cell.InventorySummaryColumn().Name() );
          showrow             := this.InventroySummaryRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
          traverse( this, InventorySummaryColumn, column ){
            sumcell           := selectobject( column, InventorySummaryCell, c, c.InventroySummaryRow() = sumrow );
            daycells          := selectset( row, InventorySummaryCell, cell, cell.InventorySummaryColumn().TimeUnit() = Translations::MP_GlobalParameters_Day() and
                                            cell.InventorySummaryColumn().StartDate() >= column.StartDate() and
                                            cell.InventorySummaryColumn().StartDate() <= column.EndaDate() );
            
            if( not isnull( column ) ){
              sumcell  := selectobject( column, InventorySummaryCell, c, c.InventroySummaryRow() = sumrow );
              showcell := column.InventorySummaryCell( relnew, EndingInventory := cell.EndingInventory(), MinimumInventory := cell.MinimumInventory(), MaximumInventory := cell.MaximumInventory(), AverageInventory := cell.AverageInventory() );
              showrow.InventorySummaryCell( relinsert, showcell );
              sumcell.EndingInventory( sumcell.EndingInventory() + cell.EndingInventory() );
              sumcell.MinimumInventory( sumcell.MinimumInventory() + cell.MinimumInventory() );
              sumcell.MaximumInventory( sumcell.MaximumInventory() + cell.MaximumInventory() );
              sumcell.AverageInventory( sumcell.AverageInventory() + cell.AverageInventory() );
            }
            endinginventory   := maxobject( daycells, Elements, e, e.InventorySummaryColumn().StartDate() ).EndingInventory();
            minimuminventory  := min( daycells, Elements, e, e.MinimumInventory() );
            maximuminventory  := max( daycells, Elements, e, e.MaximumInventory() );
            averageinventory  := [Number]average( daycells, Elements, e, e.AverageInventory() );
            showcell := column.InventorySummaryCell( relnew, EndingInventory := endinginventory, MinimumInventory := minimuminventory, MaximumInventory := maximuminventory, AverageInventory := averageinventory );
            showrow.InventorySummaryCell( relinsert, showcell );
            sumcell.EndingInventory( sumcell.EndingInventory() + endinginventory );
            sumcell.MinimumInventory( sumcell.MinimumInventory() + minimuminventory );
            sumcell.MaximumInventory( sumcell.MaximumInventory() + maximuminventory);
            sumcell.AverageInventory( sumcell.AverageInventory() + averageinventory );
          }
        }
      }
_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
@@ -16,31 +16,32 @@
    //查询日期返回需要在计划日期之内
    if( starttime < startofendyear and endtime > startofyear ){
      if( starttime < startofyear ){
        starttime := startofyear;
        starttime             := startofyear;
      }
      if( endtime > startofendyear ){
        endtime := startofendyear;
        endtime               := startofendyear;
      }
      for( start := starttime; start <= endtime; start := start.StartOfNextDay() ){
        periodtime := start.Date();
        periodname := periodtime.Format( "M2/D2/Y" );
        if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Day() ){
          this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
      if( timeunit = Translations::MP_GlobalParameters_Day() ){
        for( start := starttime; start <= endtime; start := start.StartOfNextDay() ){
          periodtime          := start.Date();
          periodname          := periodtime.Format( "M2/D2/Y" );
          this.InventorySummaryColumn( relnew, Name := periodname, StartDate := periodtime, EndaDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
        }
        if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
          weekend := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();
      }else if( timeunit = Translations::MP_GlobalParameters_Week() ){
        for( start := starttime; start <= endtime; start := start.StartOfNextWeek() ){
          periodtime          := start.Date();
          periodname          := periodtime.Format( "M2/D2/Y" );
          weekend             := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();
          
          if( periodtime = weekend ){
            this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Week() );
          }
          this.InventorySummaryColumn( relnew, Name := periodname, StartDate := periodtime, EndaDate := weekend, TimeUnit := Translations::MP_GlobalParameters_Week() );
        }
        if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Month() ){
          monthend := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
      }else if( timeunit = Translations::MP_GlobalParameters_Month() ){
        for( start := starttime; start <= endtime; start := start.StartOfNextMonth() ){
          periodtime          := start.Date();
          periodname          := periodtime.Format( "M2/D2/Y" );
          monthend            := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
          
          if( periodtime = monthend ){
            this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Month() );
          }
          this.InventorySummaryColumn( relnew, Name := periodname, StartDate := periodtime, EndaDate := monthend, TimeUnit := Translations::MP_GlobalParameters_Month() );
        }
      }
    }
_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -14,32 +14,24 @@
    allunit                   := InventorySummaryReport::GetDefaultAllUnit();
    ccunit                    := InventorySummaryReport::GetDefaultCCUnit();
    dlunit                    := InventorySummaryReport::GetDefaultDLUnit();
    //ccalineunit               := FinancialProductionReport::GetDefaultCCALineUnit();
    //dlalienunit               := FinancialProductionReport::GetDefaultDLALineUnit()
    //ccmplineunit              := FinancialProductionReport::GetDefaultCCMPLineUnit()
    //dlmplineunit              := FinancialProductionReport::GetDefaultDLMPLineUnit();
    
    source                    := owner.InventorySummarySource( relnew, ID := InventorySummaryReport::GetDefaultName(), Name := InventorySummaryReport::GetDefaultName() );
    table                     := source.InventorySummaryReport( relnew, ID := source.Name(), Name := source.Name() );
    showtable                 := source.InventorySummaryReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true );
    startofplanning           := owner.StartOfPlanning();
    startofyear               := startofplanning.StartOfYear() - Duration::Days( 1 );
    startofnextyear           := startofplanning.StartOfNextYear() - Duration::Days( 1 );
    startofnextyear           := startofplanning.StartOfNextYear();
    
    search                    := owner.InventorySummarySearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit, Category := Translations::MP_GlobalParameters_Day(), StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
    
    table.GenerateColumn( owner, 'All', startofyear, startofnextyear );
    //info( '-----------------------------------', table.InventorySummaryColumn( relsize ) );
    //库存数量为Actual inventories里面的点Planned inventories字段库存量加总
    traverse( owner, StockingPoint_MP, stockingpoint ){
    //traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '厂内库' ) ){
      unit                    := stockingpoint.Unit();
      parentunits             := unit.GetAllParent();
      //是否属于长春工厂
    //  iscc                    := stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID() = '长春' ;//unit.ID() = ccalineunit or unit.ID() = ccmplineunit or exists( parentunits, Elements, punit, punit.ID() = ccalineunit or punit.ID() = ccmplineunit );
      iscc                    := exists( parentunits, Elements, punit, punit.ID().StartsWith( 'VWED CC' ) );
      //是否属于大连工厂
    //  isdl                    := stockingpoint.ID().StartsWith( '大连' );//unit.ID() = dlalienunit or unit.ID() = dlmplineunit  or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit );
      isdl                    := exists( parentunits, Elements, punit, punit.ID().StartsWith( 'VWED DL' ) );
      if( iscc or isdl ){
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() ){
@@ -47,12 +39,6 @@
          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();
          
          pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() < startofnextyear 
                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
@@ -68,88 +54,42 @@
            quantity          := ifexpr( pispip.Period_MP().IsHistorical(), [Number]pispip.ActualInventoryLevelEnd(), [Number]pispip.PlannedInventoryLevelEnd() );
            factoryrow.SetCellValue( daycolumn, quantity );
            allrow.SetCellValue( daycolumn, quantity );
            //周,选择周时,期末库存为每一周最后一天的汇总库存信息,最小库存为这一周库存量最小的一天的数值,最大库存为这一周库存量最大的一天的数值,平均库存为该周的平均值
            if( period.Start() < nextweek ){
              weekpispips.Add( pispip );
              weekend := nextweek - Duration::Days( 1 );
              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, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
                mininventory  := min( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
                aveinventory  := average( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
                factoryrow.SetCellValue( weekcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
                allrow.SetCellValue( weekcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
              }
            }else{
              weekpispips.Flush();
              weekpispips.Add( pispip );
              nextweek        := nextweek.StartOfNextWeek();
            }
            //月,选择月时,期末库存为每一月最后一天的汇总库存信息,最小库存为这一个月库存量最小的一天的数值,最大库存为这一个月库存量最大的一天的数值,平均库存为该月的平均值
            if( period.Start() < nextmonth ){
              monthpispips.Add( pispip );
              monthend := nextmonth - Duration::Days( 1 );
              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, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
                mininventory := min( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
                aveinventory := average( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) );
                factoryrow.SetCellValue( monthcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
                allrow.SetCellValue( monthcolumn, quantity, mininventory, maxinventory, [Number]aveinventory );
              }
            }else{
              monthpispips.Flush();
              monthpispips.Add( pispip );
              nextmonth      := nextmonth.StartOfNextMonth();
            }
          }
        }
      }
    }
    //首先在Entities里识别父级Unit为长春/大连的所有库存点
    //长春库存点
    ccsps := construct( Strings );
    ccsps                     := construct( Strings );
    //大连库存点
    dlsps := construct( Strings );
    allsps := construct( Strings );
    dlsps                     := construct( Strings );
    allsps                    := construct( Strings );
    traverse( owner, Unit, unit, unit.ID() = ccunit or unit.ID() = dlunit ){
      if( unit.ID() = ccunit ){
        ccsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
        ccsps                 := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
      }
      if( unit.ID() = dlunit ){
        dlsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
        dlsps                 := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
      }
      allsps := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) );
      allsps                  := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) );
    }
    //再在库存更新的子界面库存点选择中找到这些库存点所关联的已勾选库位
    selections := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() );
    productids := selectuniquevalues( selections, Elements, selection, selection.ProductID() );
    selections                := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() );
    productids                := selectuniquevalues( selections, Elements, selection, selection.ProductID() );
    //最后将这些库位中零件号的数量进行加总
    traverse( table, InventorySummaryColumn, column, column.Period() < startofplanning.Date() ){
    traverse( table, InventorySummaryColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.Period() < startofplanning.Date() ){
      traverse( productids, Elements, productid ){
        if( column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){//天
          column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit );
        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Week() ){//周
          column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfWeek(), column.Period(), productid, allunit, ccunit, dlunit );
        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Month() ){//月
          column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfMonth(), column.Period(), productid, allunit, ccunit, dlunit );
        }
        column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit );
      }
    }
      
        
    rows := selectsortedset( table, InventroySummaryRow, row, row.Name() );
    i    := 0;
    rows                      := selectsortedset( table, InventroySummaryRow, row, row.Name() );
    i                         := 0;
    traverse( rows, Elements, e ){
      if( exists( e, InventorySummaryCell, cell, cell.AverageInventory() <> 0 or cell.EndingInventory() <> 0 or cell.MaximumInventory() <> 0 or cell.MinimumInventory() <> 0 ) ){
        e.RowNr( i );
        i := i + 1;
        i                     := i + 1;
      }else{
        e.Delete();
      }
_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
@@ -17,13 +17,13 @@
        periodtime          := period.StartDate();
        periodname          := periodtime.Format( "M2/D2/Y" );
        
        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, CCAssemblyPlanQty := 0, DLAssemblyPlanQty := 0, TimeUnit := Translations::MP_GlobalParameters_Day() );
        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
      }
      
      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
        if( period.StartDate() = weekstart ){
          weekperiodname    := weekstart.Format( "M2/D2/Y" );
          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), CCAssemblyPlanQty := 0, DLAssemblyPlanQty := 0, TimeUnit := Translations::MP_GlobalParameters_Week() );
          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
          weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
        }
      }
_Main/BL/Type_MachiningPipelineRow/Method_SetAssemblyPlanValue#0.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
Quintiq file version 2.0
#parent: #root
Method SetAssemblyPlanValue (
  MachiningPipelineColumn column,
  Boolean iscc,
  Real quantity
)
{
  TextBody:
  [*
    // ç”„兰鸽 Jun-24-2024 (created)
    cell := selectobject( this, Cell, cell, cell.Column() = column );
    if( iscc ){
      cell.CCAssemblyPlanQty( cell.CCAssemblyPlanQty() + quantity );
    } else {
      cell.DLAssemblyPlanQty( cell.DLAssemblyPlanQty() + quantity );
    }
  *]
}
_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -48,43 +48,37 @@
          pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 or pispip.DependentDemandAndSalesDemandQuantity() <> 0 ), pispip.Start() );
          traverse( pispips, Elements, pispip ){
            supplyquantity    := [Number]pispip.NewSupplyQuantity();//四舍五入
            products.Add( pisp.Product_MP() );
            //天
            daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
            //周
            weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
            
            product           := pisp.Product_MP();
            productparents    := product.GetAllParent();
            row               := table.GetRow( pisp.ProductID() );
            //装配线
            if( isccassemnly or isdlassemnly ){
              quantity        := [Number]pispip.DependentDemandAndSalesDemandQuantity();//四舍五入
              if( isccassemnly ){
                daycolumn.CCAssemblyPlanQty( daycolumn.CCAssemblyPlanQty() + quantity );
                weekcolumn.CCAssemblyPlanQty( weekcolumn.CCAssemblyPlanQty() + quantity );
              } else {
                daycolumn.DLAssemblyPlanQty( daycolumn.DLAssemblyPlanQty() + quantity );
                weekcolumn.DLAssemblyPlanQty( weekcolumn.DLAssemblyPlanQty() + quantity );
              }
              row.SetCellProductionValue( daycolumn, isccassemnly, [Real]quantity );
              row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]quantity );
            }
            //机加线
            if( isccproduction or isdlproduction ){
              supplyqty       := [Number]pispip.NewSupplyQuantity();//四舍五入
              row.SetCellProductionValue( daycolumn, isccproduction, [Real]supplyqty );
              row.SetCellProductionValue( weekcolumn, isccproduction, [Real]supplyqty );
            }
            
            product           := pisp.Product_MP();
            productparents    := product.GetAllParent();
            if( exists( productparents, Elements, e, e.ID() = productparent ) ){//查询产品类型是发动机
              row             := table.GetRow( pisp.ProductID() );
              products.Add( pisp.Product_MP() );
              inventoryquantity:= [Number]pispip.PlannedInventoryLevelEnd();//四舍五入
              //机加线
              if( isccproduction or isdlproduction ){
                row.SetCellProductionValue( daycolumn, isccproduction, [Real]supplyquantity );
                row.SetCellProductionValue( weekcolumn, isccproduction, [Real]supplyquantity );
              }
              //库存
              if( iscc or isdl ){
                row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryquantity );
                if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
                  row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryquantity );
                }
            //库存
            if( iscc or isdl ){
              inventoryqty    := [Number]pispip.PlannedInventoryLevelEnd();//四舍五入
              row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryqty );
              if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
                row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryqty );
              }
            }
          }
@@ -132,10 +126,6 @@
    i    := 0;
    traverse( rows, Elements, e ){
      e.RowNr( i );
      traverse( e, Cell, cell ){
        cell.CCAssemblyPlanQty( cell.Column().CCAssemblyPlanQty() );
        cell.DLAssemblyPlanQty( cell.Column().DLAssemblyPlanQty() );
      }
      i := i + 1;
    }
    showtable.Generate( search, products );
_Main/UI/MacroPlannerWebApp/Component_FormEnginePipelineReport/Response_PanelExport_570_bRefresh_OnClick.def
@@ -19,7 +19,7 @@
      
      DataHolderTable.Data( table );
      
      dhSearch.Data( MacroPlan.EnginePipelineSearch() );
      //dhSearch.Data( MacroPlan.EnginePipelineSearch() );
    *]
    GroupServerCalls: false
  }
_Main/UI/MacroPlannerWebApp/Component_FormMachiningPipelineReport/Response_PanelExport_bRefresh_OnClick.def
@@ -19,7 +19,7 @@
      
      DataHolderTable.Data( table );
      
      dhSearch.Data( MacroPlan.MachiningPipelineSearch() );
      //dhSearch.Data( MacroPlan.MachiningPipelineSearch() );
    *]
    GroupServerCalls: false
  }