lazhen
2024-08-16 107f0e4b79a6189e5f61ca0a4d77dd8d047a8f2b
_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -41,31 +41,35 @@
      isdlproduction          := 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() 
                  and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent )
    //              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 ) ) ){
          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() );
    //        weekstart         := owner.StartOfPlanning().Date();
            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 ), pispip.Start() );
          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 ), pispip.Start() );
          traverse( pispips, Elements, pispip ){
            supplyquantity    := [Number]pispip.NewSupplyQuantity();//四舍五入
            //天
            daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
            //周
            weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
            
            traverse( pispips, Elements, pispip ){
              //天
              daycolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
              //周
              weekcolumn       := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
              supplyquantity   := [Number]pispip.NewSupplyQuantity();//四舍五入
            //装配线
            if( isccassemnly or isdlassemnly ){
              if( isccassemnly ){
                daycolumn.CCAssemblyPlanQty( daycolumn.CCAssemblyPlanQty() + supplyquantity );
                weekcolumn.CCAssemblyPlanQty( weekcolumn.CCAssemblyPlanQty() + supplyquantity );
              } else {
                daycolumn.DLAssemblyPlanQty( daycolumn.DLAssemblyPlanQty() + supplyquantity );
                weekcolumn.DLAssemblyPlanQty( weekcolumn.DLAssemblyPlanQty() + supplyquantity );
              }
            }
            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( isccassemnly or isdlassemnly ){
                row.SetCellAssemblyValue( daycolumn, isccassemnly, [Real]supplyquantity );
                row.SetCellAssemblyValue( weekcolumn, isccassemnly, [Real]supplyquantity );
              }
              
              //机加线
              if( isccproduction or isdlproduction ){
@@ -103,7 +107,7 @@
        destiiscc             := destisp.ID() = ccunit or destiunit.ID() = ccunit or exists( destiparentunits, Elements, punit, punit.ID() = ccunit );
        destiisdl             := destisp.ID() = dlunit or destiunit.ID() = dlunit or exists( destiparentunits, Elements, punit, punit.ID() = dlunit );
        if( ( originiscc and destiisdl ) or ( originisdl and destiiscc ) ){
          row := selectobject( table, Row, row, row.Name() = tprow.Name() );
          row := table.GetRow( tprow.ProductID() );
          traverse( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() ){
            //天
            daycolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), tpcell.TransferPlanColumn().ColumnDate() );
@@ -122,6 +126,10 @@
    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 );