| | |
| | | |
| | | products := construct( Product_MPs ); |
| | | //初始化列 |
| | | table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() ); |
| | | table.GenerateColumn( owner, Translations::MP_GlobalParameters_Day(), search.StartDate(), search.EndDate() ); |
| | | endperiod := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() ); |
| | | |
| | | //生成生产和库存数据 |
| | | traverse( owner, StockingPoint_MP, stockingpoint ){ |
| | | unit := stockingpoint.Unit(); |
| | | parentunits := unit.GetAllParent(); |
| | | //是否属于长春工厂 |
| | | iscc := ( stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID().StartsWith( '长春' ) ) and stockingpoint.ID().EndsWith( '厂内库' ); |
| | | iscc := stockingpoint.ID().StartsWith( 'CC' ) or unit.ID().StartsWith( 'CC' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'CC' ) ); |
| | | //是否属于大连工厂 |
| | | isdl := ( ( stockingpoint.ID().StartsWith( 'DL' ) or stockingpoint.ID().StartsWith( '大连' ) ) and stockingpoint.ID().EndsWith( '厂内库' ) ) or stockingpoint.ID() = '大连外租库'; |
| | | |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not pisp.IsSystem() |
| | | and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) |
| | | and exists( 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 ) ) ){ |
| | | pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() |
| | | and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() ); |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | products.Add( pisp.Product_MP() ); |
| | | traverse( pispips, Elements, pispip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() ); |
| | | supplyquantity := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | inventoryquantity := [Number]pispip.PlannedInventoryLevelEnd();//四舍五入 |
| | | //产量是加总 |
| | | if( iscc or isdl ){ |
| | | row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity ); |
| | | row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity ); |
| | | isdl := stockingpoint.ID().StartsWith( 'DL' ) or unit.ID().StartsWith( 'DL' ) or exists( parentunits, Elements, punit, punit.ID().StartsWith( 'DL' ) ); |
| | | //是否属于长春产量 |
| | | isccproduction := iscc and stockingpoint.ID().EndsWith( '厂内库' ); |
| | | //是否属于大连产量 |
| | | isdlproduction := isdl and stockingpoint.ID().EndsWith( '厂内库' ) or stockingpoint.ID() = '大连外租库'; |
| | | if( isccproduction or isdlproduction ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not pisp.IsSystem() |
| | | and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) |
| | | and exists( 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 ) ) ){ |
| | | 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 ), pispip.Start() ); |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | products.Add( pisp.Product_MP() ); |
| | | traverse( pispips, Elements, pispip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() ); |
| | | //周 |
| | | // weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() ); |
| | | supplyquantity := pispip.NewSupplyQuantity();//四舍五入 |
| | | inventoryquantity := pispip.PlannedInventoryLevelEnd(); |
| | | //产量是加总 |
| | | if( isccproduction or isdlproduction ){ |
| | | row.SetCellProductionValue( daycolumn, iscc, supplyquantity ); |
| | | // row.SetCellProductionValue( weekcolumn, iscc, supplyquantity ); |
| | | } |
| | | //库存需要取最后一天 |
| | | row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity ); |
| | | |
| | | // if( pispip.Start().Date() = weekcolumn.EndDate() or pispip.Period_MP() = endperiod ){ |
| | | // |
| | | // row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity ); |
| | | // } |
| | | } |
| | | //库存需要取最后一天 |
| | | row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity ); |
| | | |
| | | if( pispip.Start().Date() = weekcolumn.EndDate() or pispip.Period_MP() = endperiod ){ |
| | | |
| | | row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //生成需求数据 |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.SalesSegment_MP() ) and forecast.StartDate() < endperiod.StartDate() and forecast.Quantity() <> 0 |
| | | and exists( forecast.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) |
| | |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() ); |
| | | // weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), psdip.StartDate() ); |
| | | |
| | | if( not isnull( daycolumn ) ){ |
| | | row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() ); |
| | | } |
| | | if( not isnull( weekcolumn ) ){ |
| | | row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() ); |
| | | } |
| | | // if( not isnull( weekcolumn ) ){ |
| | | // row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() ); |
| | | // } |
| | | // if( psdip.StartDate() = ( weekstart + Duration::Days( 6 ) ).Date() or psdip.PeriodStart() = endperiod.StartDate() ){ |
| | | // weekstart := ( weekstart + Duration::Days( 7 ) ).Date(); |
| | | // } |
| | | } |
| | | } |
| | | |
| | | rows := selectsortedset( table, Row, row, row.Name() ); |
| | | i := 0; |
| | | traverse( rows, Elements, e ){ |
| | | e.RowNr( i ); |
| | | i := i + 1; |
| | | } |
| | | //rows := selectsortedset( table, Row, row, row.Name() ); |
| | | //i := 0; |
| | | //traverse( rows, Elements, e ){ |
| | | // e.RowNr( i ); |
| | | // i := i + 1; |
| | | //} |
| | | showtable.Generate( search, products ); |
| | | *] |
| | | } |