| | |
| | | // 甄兰鸽 Jun-24-2024 (created) |
| | | owner.FinancialSalesSource( relflush ); |
| | | owner.FSImportData( relflush ); |
| | | products := construct( Product_MPs ); |
| | | productids := construct( Strings ); |
| | | allunit := FinancialSalesReport::GetDefaultAllUnit(); |
| | | ccunit := FinancialSalesReport::GetDefaultCCUnit(); |
| | | dlunit := FinancialSalesReport::GetDefaultDLUnit(); |
| | | ccsalessegment := FinancialSalesReport::GetSalesSegmentCC(); |
| | | tjsalessegment := FinancialSalesReport::GetSalesSegmentTJ(); |
| | | fssalessegment := FinancialSalesReport::GetSalesSegmentFS(); |
| | | //ccspline := FinancialSalesReport::GetStockingPointCCLine(); |
| | | //dlspline := FinancialSalesReport::GetStockingPointDLLine(); |
| | | //ccrent := FinancialSalesReport::GetStockingPointCCRent(); |
| | | |
| | | source := owner.FinancialSalesSource( relnew, IsImport := false, Name := FinancialSalesReport::GetDefaultName() ); |
| | | table := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false ); |
| | | showtable := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true ); |
| | | startofplanning := owner.StartOfPlanning().Date(); |
| | | startofyear := ( startofplanning.StartOfYear() - Duration::Days( 1 ) ).Date(); |
| | | startofnextyear := ( startofplanning.StartOfNextYear() - Duration::Days( 1 ) ).Date(); |
| | | //startofyear := startofplanning.StartOfYear(); |
| | | startofnextyear := startofplanning.StartOfNextYear(); |
| | | |
| | | search := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit ); |
| | | |
| | |
| | | //获取工厂行 |
| | | factoryrow := table.GetRow( ifexpr( isdl, dlunit, ccunit ), product ); |
| | | |
| | | products.Add( product ); |
| | | productids.Add( forecast.ProductID() ); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ){ |
| | | dayperiodtime := psdip.StartDate(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | |
| | | //从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, pispip.Period_MP().StartDate() >= startofyear and pispip.Period_MP().StartDate() < startofnextyear |
| | | 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 ); |
| | | factoryrow := table.GetRow( dlunit, product ); |
| | | products.Add( product ); |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Period_MP().StartDate() >= startofyear |
| | | productids.Add( pisp.ProductID() ); |
| | | 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() + Duration::Days( 1 ) ).Date(); |
| | |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | rows := selectsortedset( table, FinancialSalesRow, row, row.Name() ); |
| | | i := 0; |
| | | traverse( rows, Elements, e ){ |
| | | e.RowNr( i ); |
| | | i := i + 1; |
| | | } |
| | | showtable.Generate( search, products ); |
| | | factorys := selectset( owner, Factory, factory, factory.ID() = FinancialProductionReport::GetDefaultAllUnit() ); |
| | | showtable.Generate( search, factorys, productids ); |
| | | *] |
| | | } |