lazhen
2024-09-26 3bb308481a906e3c2c9c1670905249fb73f36100
_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
@@ -83,27 +83,29 @@
      //是否属于长春装配线
    //  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'
        traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf()
                  and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear 
                              and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ) ){//产品为MQB
          product           := pisp.Product_MP();
          allrow            := table.GetRow( allunit, product );
          ccrow             := table.GetRow( ccunit, product );
          products.Add( product );
          traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical()
                    and pispip.Period_MP().StartDate() < startofnextyear
                    and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){
            dayperiodtime   := pispip.Start().Date();
            dayperiodname   := dayperiodtime.Format( "M2/D2/Y" );
            periodtime      := pispip.Start().StartOfMonth().Date();
            periodname      := periodtime.Format( "M2/D2/Y" );
            daycolumn       := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() );
            column          := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime and not column.IsDay() );
            quantity        := ifexpr( isdl, [Number]pispip.NewSupplyQuantity(), [Number]pispip.DependentDemandAndSalesDemandQuantity() );//四舍五入
            ccrow.Initialize( column, quantity );//取Total Demand字段按月汇总需求数量
            ccrow.Initialize( daycolumn, quantity );
            allrow.Initialize( column, quantity );
          if( isdl or pisp.Product_MP().MQBMLB() = 'MQB' ){
            factoryrow      := table.GetRow( ifexpr( isdl, dlunit, ccunit ), product );
            products.Add( product );
            traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical()
                      and pispip.Period_MP().StartDate() < startofnextyear
                      and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){
              dayperiodtime := pispip.Start().Date();
              dayperiodname := dayperiodtime.Format( "M2/D2/Y" );
              periodtime    := pispip.Start().StartOfMonth().Date();
              periodname    := periodtime.Format( "M2/D2/Y" );
              daycolumn     := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() );
              column        := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime and not column.IsDay() );
              quantity      := ifexpr( isdl, [Number]pispip.NewSupplyQuantity(), [Number]pispip.DependentDemandAndSalesDemandQuantity() );//四舍五入
              factoryrow.Initialize( column, quantity );//取Total Demand字段按月汇总需求数量
              factoryrow.Initialize( daycolumn, quantity );
              allrow.Initialize( column, quantity );
            }
          }
        }
    //  }