| | |
| | | isdl := unit.ID() = dlalienunit or unit.ID() = dlmplineunit or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit ); |
| | | |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not pisp.IsSystem() ){ |
| | | weekstart := owner.StartOfPlanning().Date(); |
| | | 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() ); |
| | | traverse( pispips, Elements, pispip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart ); |
| | | supplyquantity := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | inventoryquantity := [Number]pispip.PlannedInventoryLevelEnd();//四舍五入 |
| | | //产量是加总 |
| | | if( iscc or isdl ){ |
| | | row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity ); |
| | | row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity ); |
| | | product := pisp.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = '发动机' ) ){//查询产品类型是发动机 |
| | | weekstart := owner.StartOfPlanning().Date(); |
| | | 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() ); |
| | | traverse( pispips, Elements, pispip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart ); |
| | | supplyquantity := [Number]pispip.NewSupplyQuantity();//四舍五入 |
| | | inventoryquantity := [Number]pispip.PlannedInventoryLevelEnd();//四舍五入 |
| | | //产量是加总 |
| | | if( iscc or isdl ){ |
| | | row.SetCellProductionValue( daycolumn, iscc, [Real]supplyquantity ); |
| | | row.SetCellProductionValue( weekcolumn, iscc, [Real]supplyquantity ); |
| | | } |
| | | //库存需要取最后一天 |
| | | row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity ); |
| | | |
| | | if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){ |
| | | weekstart := ( weekstart + Duration::Days( 7 ) ).Date(); |
| | | |
| | | row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity ); |
| | | } |
| | | } |
| | | //库存需要取最后一天 |
| | | row.SetCellInventoryValue( daycolumn, [Real]inventoryquantity ); |
| | | |
| | | if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){ |
| | | weekstart := ( weekstart + Duration::Days( 7 ) ).Date(); |
| | | |
| | | row.SetCellInventoryValue( weekcolumn, [Real]inventoryquantity ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //生成需求数据 |
| | | traverse( owner, SalesDemand.astype( Forecast ), forecast ){ |
| | | row := table.GetRow( forecast.ProductID() ); |
| | | weekstart := owner.StartOfPlanning().Date(); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart ); |
| | | |
| | | if( not isnull( daycolumn ) ){ |
| | | row.SetCellDemandValue( daycolumn, forecast.SalesSegmentName(), forecast.Quantity() ); |
| | | } |
| | | if( not isnull( weekcolumn ) ){ |
| | | row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() ); |
| | | product := forecast.Product_MP(); |
| | | productparents := product.GetAllParent(); |
| | | if( exists( productparents, Elements, e, e.ID() = '发动机' ) ){//查询产品类型是发动机 |
| | | row := table.GetRow( forecast.ProductID() ); |
| | | weekstart := owner.StartOfPlanning().Date(); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, psdip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), psdip.StartDate() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart ); |
| | | |
| | | if( not isnull( daycolumn ) ){ |
| | | row.SetCellDemandValue( daycolumn, 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(); |
| | | } |
| | | } |
| | | } |
| | | } |