| | |
| | | allunit := '<All>'; |
| | | //清空之前存储的显示数据 |
| | | this.Clear(); |
| | | //年汇总 |
| | | yearcolumn := this.FinancialProductionColumn( relnew, Name := '汇总', Period := search.MacroPlan().StartOfPlanning().StartOfNextYear().Date() ); |
| | | //过滤后的产品id |
| | | productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() ) |
| | | and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() ) |
| | | and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() ); |
| | | sumrow := this.FinancialProductionRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.FinancialProductionRow( relsize ) ); |
| | | sumyearcell := yearcolumn.FinancialProductionCell( relnew, Quantity := 0 ); |
| | | sumrow.FinancialProductionCell( relinsert, sumyearcell ); |
| | | traverse( table, FinancialProductionRow, row, row.Unit() = search.Unit() ){ |
| | | productid := construct( Strings ); |
| | | productid.Add( row.Name() ); |
| | | |
| | | if( productids.ContainsAll( productid ) ){ |
| | | showrow := this.FinancialProductionRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() ); |
| | | yearcell := yearcolumn.FinancialProductionCell( relnew, Quantity := 0 ); |
| | | showrow.FinancialProductionCell( relinsert, yearcell ); |
| | | |
| | | traverse( row, FinancialProductionCell, cell, not cell.FinancialProductionColumn().IsDay() ){ |
| | | column := selectobject( this, FinancialProductionColumn, column, column.Name() = cell.FinancialProductionColumn().Name() and not column.IsDay() ); |
| | |
| | | |
| | | showcell := column.FinancialProductionCell( relnew, Quantity := cell.Quantity() ); |
| | | showrow.FinancialProductionCell( relinsert, showcell ); |
| | | yearcell.Quantity( yearcell.Quantity() + cell.Quantity() ); |
| | | sumyearcell.Quantity( sumyearcell.Quantity() + cell.Quantity() ); |
| | | // value := [Real]cell.Value() + [Real]sumcell.Value(); |
| | | sumcell.Quantity( sumcell.Quantity() + cell.Quantity() ); |
| | | } |
| | |
| | | table := source.FinancialProductionReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false ); |
| | | showtable := source.FinancialProductionReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true ); |
| | | startofplanning := owner.StartOfPlanning().Date(); |
| | | //startofnextmonth := startofplanning.StartOfNextMonth(); |
| | | startofnextyear := startofplanning.StartOfNextYear(); |
| | | startofyear := ( startofplanning.StartOfYear() - Duration::Days( 1 ) ).Date(); |
| | | startofnextyear := ( startofplanning.StartOfNextYear() - Duration::Days( 1 ) ).Date(); |
| | | |
| | | search := owner.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit ); |
| | | |
| | |
| | | // isdl := unit.ID() = dlalienunit or unit.ID() = dlmplineunit or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit ); |
| | | if( iscc or isdl ){ |
| | | 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.NewSupplyQuantity() <> 0 ) ){ |
| | | and exists( pisp, ProductInStockingPointInPeriod, pispip, pispip.Period_MP().StartDate() >= startofyear and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | //获取工厂行 |
| | | factoryrow := table.GetRowByUnit( pisp.Product_MP(), ifexpr( iscc, ccunit, dlunit ) ); |
| | | //获取合计行 |
| | | allrow := table.GetRowByUnit( pisp.Product_MP(), allunit ); |
| | | products.Add( pisp.Product_MP() ); |
| | | //当product planning的日期区间在需要的日期区间内 |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){ |
| | | dayperiodtime := pispip.Start().Date(); |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Period_MP().StartDate() >= startofyear and pispip.Period_MP().StartDate() < startofnextyear and pispip.NewSupplyQuantity() <> 0 ){ |
| | | dayperiodtime := ( pispip.Start() + Duration::Days( 1 ) ).Date(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := pispip.Start().StartOfMonth().Date(); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | // quantity := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | daycolumn := selectobject( table, FinancialProductionColumn, column, column.Name() = dayperiodname and column.Period() = dayperiodtime and column.IsDay() ); |
| | |
| | | allunit := '<All>'; |
| | | //清空之前存储的显示数据 |
| | | this.Clear(); |
| | | //年汇总 |
| | | yearcolumn := this.FinancialSalesColumn( relnew, Name := '汇总', Period := search.MacroPlan().StartOfPlanning().StartOfNextYear().Date() ); |
| | | //过滤后的产品id |
| | | productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() ) |
| | | and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() ) |
| | | and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() ); |
| | | sumrow := this.FinancialSalesRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.FinancialSalesRow( relsize ) ); |
| | | sumyearcell := yearcolumn.FinancialSalesCell( relnew, Value := '0' ); |
| | | sumrow.FinancialSalesCell( relinsert, sumyearcell ); |
| | | traverse( table, FinancialSalesRow, row, row.Unit() = search.Unit() ){ |
| | | productid := construct( Strings ); |
| | | productid.Add( row.Name() ); |
| | | |
| | | if( productids.ContainsAll( productid ) ){ |
| | | showrow := this.FinancialSalesRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() ); |
| | | yearcell := yearcolumn.FinancialSalesCell( relnew, Value := '0' ); |
| | | showrow.FinancialSalesCell( relinsert, yearcell ); |
| | | |
| | | traverse( row, FinancialSalesCell, cell, not cell.FinancialSalesColumn().IsDay() ){ |
| | | column := selectobject( this, FinancialSalesColumn, column, column.Name() = cell.FinancialSalesColumn().Name() and not column.IsDay()); |
| | |
| | | |
| | | showcell := column.FinancialSalesCell( relnew, Value := cell.Value() ); |
| | | showrow.FinancialSalesCell( relinsert, showcell ); |
| | | yearcell.Value( [String]( [Real]yearcell.Value() + [Real]cell.Value() ) ); |
| | | sumyearcell.Value( [String]( [Real]sumyearcell.Value() + [Real]cell.Value() ) ); |
| | | value := [Real]cell.Value() + [Real]sumcell.Value(); |
| | | sumcell.Value( [String]value ); |
| | | } |
| | |
| | | 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(); |
| | | startofnextyear := startofplanning.StartOfNextYear(); |
| | | startofyear := ( startofplanning.StartOfYear() - Duration::Days( 1 ) ).Date(); |
| | | startofnextyear := ( startofplanning.StartOfNextYear() - Duration::Days( 1 ) ).Date(); |
| | | |
| | | search := owner.FinancialSalesSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit ); |
| | | |
| | | 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() <= startofnextyear and forecast.Quantity() <> 0 |
| | | and exists( forecast, PlanningSalesDemandInPeriod, psdip, psdip.Quantity() <> 0 ) ){ |
| | | salessegment := forecast.SalesSegment_MP(); |
| | | parentsalessegments := salessegment.GetAllParent(); |
| | |
| | | //从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, pispip.Period_MP().StartDate() >= startofyear 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, not pispip.Period_MP().IsHistorical() |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Period_MP().StartDate() >= startofyear |
| | | and pispip.Period_MP().StartDate() < startofnextyear |
| | | and ( pispip.DependentDemandAndSalesDemandQuantity() <> 0 or pispip.NewSupplyQuantity() <> 0 ) ){ |
| | | dayperiodtime := pispip.Start().Date(); |
| | | dayperiodtime := ( pispip.Start() + Duration::Days( 1 ) ).Date(); |
| | | dayperiodname := dayperiodtime.Format( "M2/D2/Y" ); |
| | | periodtime := pispip.Start().StartOfMonth().Date(); |
| | | periodtime := dayperiodtime.StartOfMonth(); |
| | | 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() ); |