| | |
| | | } |
| | | owner.FSImportData( relflush ); |
| | | productids := construct( Strings ); |
| | | //allunit := FinancialSalesReport::GetDefaultAllUnit(); |
| | | ccunit := FinancialSalesReport::GetDefaultCCUnit(); |
| | | dlunit := FinancialSalesReport::GetDefaultDLUnit(); |
| | | ccsalessegment := FinancialSalesReport::GetSalesSegmentCC(); |
| | |
| | | table.GenerateColumn( owner ); |
| | | |
| | | //首先在forecast界面查找sales segment为长春的所有需求,识别出MLB的所有产品,每个产品按月汇总需求数量 |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() <= startofnextyear and forecast.Quantity() <> 0 |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and ( forecast.StartDate() + Duration::Days( 1 ) ).Date() < startofnextyear and forecast.Quantity() <> 0 |
| | | and exists( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ) ){ |
| | | salessegment := forecast.SalesSegment_MP(); |
| | | parentsalessegments := salessegment.GetAllParent(); |
| | |
| | | //Forecast的Sales Segment为长春,识别出MLB的所有产品汇总 |
| | | //大连财务销量:首先在forecast界面查找Sales Segment是天津和佛山的所有需求,每个产品按月汇总需求数量 and forecast.Product_MP().MQBMLB() = 'MLB' ) |
| | | if( ( iscc and product.MQBMLB() = 'MLB' ) or ( isccrent and product.MQBMLB() = 'MQB' ) or isdl ){ |
| | | |
| | | //获取合计行 |
| | | // allrow := table.GetRow( allunit, product ); |
| | | //获取工厂行 |
| | | factoryrow := table.GetRow( ifexpr( isdl, dlunit, ccunit ), product ); |
| | | |
| | | productids.Add( forecast.ProductID() ); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ){ |
| | | dayperiodtime := psdip.StartDate(); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 and ( psdip.StartDate() + Duration::Days( 1 ) ).Date() < startofnextyear ){ |
| | | dayperiodtime := ( psdip.StartDate() + Duration::Days( 1 ) ).Date();//psdip.StartDate(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := psdip.StartDate().StartOfMonth(); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // info( '-------------------------', periodname, periodtime ); |
| | | daycolumn := selectobject( table, FinancialSalesColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() ); |
| | |
| | | |
| | | factoryrow.Initialize( column, quantity ); |
| | | factoryrow.Initialize( daycolumn, quantity ); |
| | | // allrow.Initialize( column, quantity ); |
| | | } |
| | | } |
| | | } |
| | | //从Product planning查找库存点为大连发动机的长春外租库,取New supply字段按月汇总需求数量 |
| | | traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID() = '大连发动机的长春外租库' ){ |
| | | 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 exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and ( pispip.Start() + Duration::Days( 1 ) ).Date() < startofnextyear |
| | | and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ) ){//产品为MQB |
| | | product := pisp.Product_MP(); |
| | | // allrow := table.GetRow( allunit, product ); |
| | | factoryrow := table.GetRow( dlunit, product ); |
| | | productids.Add( pisp.ProductID() ); |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() |
| | | and pispip.Period_MP().StartDate() < startofnextyear |
| | | and ( pispip.Start() + Duration::Days( 1 ) ).Date() < startofnextyear |
| | | and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | dayperiodtime := pispip.Start().Date(); |
| | | dayperiodtime := ( pispip.Start() + Duration::Days( 1 ) ).Date();//pispip.Start().Date(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | |
| | | |
| | | factoryrow.Initialize( column, quantity );//取Total Demand字段按月汇总需求数量 |
| | | factoryrow.Initialize( daycolumn, quantity ); |
| | | // allrow.Initialize( column, quantity ); |
| | | } |
| | | } |
| | | // } |