lazhen
2024-10-09 ed070d695972cadcf9b6bbfe9e779aa5a0850125
_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 );