lazhen
2024-10-09 f9c8e9e3438d19dc7a3ee087b631dbe593663112
_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -9,9 +9,6 @@
    // 甄兰鸽 Jun-24-2024 (created)
    owner.FinancialProductionSource( relflush );
    productparent             := MachiningPipelineReport::GetDefaultProductParent();
    //ccunit                    := MachiningPipelineReport::GetDefaultCCUnit();
    //dlunit                    := MachiningPipelineReport::GetDefaultDLUnit();
    //allunit                   := EnginePipelineReport::GetDefaultAllUnit();
    source                    := owner.MachiningPipelineSource( relnew, Name := MachiningPipelineReport::GetDefaultName() );
    table                     := source.Report( relnew, ID := source.Name(), Name := source.Name() );
    showtable                 := source.Report( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true );
@@ -31,23 +28,15 @@
      iscc                    := stockingpoint.ID().StartsWith( 'CC' ) or unit.ID().StartsWith( 'CC' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'CC' ) );//unit.ID() = ccunit or exists( parentunits, Elements, punit, punit.ID() = ccunit );
      //是否属于大连工厂
      isdl                    := stockingpoint.ID().StartsWith( 'DL' ) or unit.ID().StartsWith( 'DL' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'DL' ) );//unit.ID() = dlunit or exists( parentunits, Elements, punit, punit.ID() = dlunit );
      //是否属于长春装配线CC厂内库
    //  isccassemnly            := stockingpoint.ID().EndsWith( '厂内库' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '长春' ) );//unit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() );
      //是否属于大连装配线DL厂内库
    //  isdlassemnly            := stockingpoint.ID().EndsWith( '厂内库' ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '大连' ) );//unit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() );
      //是否属于长春机加产线
      isccproduction          := stockingpoint.ID().EndsWith( '线边库' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '长春' ) );//unit.ID() = MachiningPipelineReport::GetDefaultCCProductionUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCProductionUnit() );
      //是否属于大连机加产线
      isdlproduction          := unit.ID().EndsWith( 'MoMo' ) and unit.ID().StartsWith( 'DL' );//unit.ID() = MachiningPipelineReport::GetDefaultDLProductionUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLProductionUnit() );
      if( iscc or isdl ){
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem()
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp,  pisp.Product_MP().IsLeaf() and not pisp.IsSystem()// and pisp.ProductID() = '06K103011CM'
                  and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
                  and exists( 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 ) ) ){
          isccassemnly        := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() + '线边库' ) and ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '长春' ) );
          isdlassemnly        := stockingpoint.ID().EndsWith( pisp.Product_MP().ParentID() ) and ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '大连' ) );
          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 ){
          traverse( pispips, Elements, pispip){//, pispip.Start().Month() = 1 and pispip.Start().Day() = 2
            products.Add( pisp.Product_MP() );
            
            //天
@@ -57,18 +46,17 @@
            
            row               := table.GetRow( pisp.ProductID() );
              
            //装配线
            if( isccassemnly or isdlassemnly ){
              //装配线
              quantity        := [Number]pispip.DependentDemandAndSalesDemandQuantity();//四舍五入
              row.SetCellProductionValue( daycolumn, isccassemnly, [Real]quantity );
              row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]quantity );
            }
            //机加线
            if( isccproduction or isdlproduction ){
              row.SetAssemblyPlanValue(  daycolumn, isccassemnly, [Real]quantity );
              row.SetAssemblyPlanValue( weekcolumn, isccassemnly, [Real]quantity );
              //生产
              supplyqty       := [Number]pispip.NewSupplyQuantity();//四舍五入
              row.SetCellProductionValue( daycolumn, isccproduction, [Real]supplyqty );
              row.SetCellProductionValue( weekcolumn, isccproduction, [Real]supplyqty );
    //          info( '****************', quantity, supplyqty );
              row.SetCellProductionValue( daycolumn, isccassemnly, [Real]supplyqty );
              row.SetCellProductionValue( weekcolumn, isccassemnly, [Real]supplyqty );
            }
            
            //库存