| | |
| | | products := construct( Product_MPs ); |
| | | //初始化列 |
| | | table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() ); |
| | | endperiod := maxobject( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day(), period.StartDate() ); |
| | | |
| | | //生成装配、生产和库存数据 |
| | | traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() ){ |
| | | unit := pisp.StockingPoint_MP().UnitID(); |
| | | //初始化行 |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | |
| | | traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() |
| | | and ( pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() |
| | | or pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Week() ) ){ |
| | | periodtime := pispip.Period_MP().StartDate(); |
| | | periodname := periodtime.Format( "M2/D2/Y" ); |
| | | column := selectobject( table, Column, column, column.Name() = periodname and column.Period() = periodtime and column.TimeUnit() = pispip.Period_MP().TimeUnit() ); |
| | | |
| | | //装配线 |
| | | if( unit = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() or unit = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() ){ |
| | | row.SetCellAssemblyValue( column, unit, pispip.NewSupplyProductionQuantity() ); |
| | | } |
| | | //机加线 |
| | | if( unit = MachiningPipelineReport::GetDefaultCCProductionUnit() or unit = MachiningPipelineReport::GetDefaultDLProductionUnit() ){ |
| | | row.SetCellProductionValue( column, unit, pispip.NewSupplyProductionQuantity() ); |
| | | } |
| | | if( unit = ccunit or unit = dlunit ){ |
| | | row.SetCellInventoryValue( column, unit, pispip.PlannedInventoryLevelEnd() ); |
| | | traverse( owner, StockingPoint_MP, stockingpoint ){ |
| | | unit := stockingpoint.Unit(); |
| | | parentunits := unit.GetAllParent(); |
| | | //是否属于长春工厂 |
| | | iscc := unit.ID() = ccunit or exists( parentunits, Elements, punit, punit.ID() = ccunit ); |
| | | //是否属于大连工厂 |
| | | isdl := unit.ID() = dlunit or exists( parentunits, Elements, punit, punit.ID() = dlunit ); |
| | | //是否属于长春装配线 |
| | | isccassemnly := unit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCAssemnlyUnit() ); |
| | | //是否属于大连装配线 |
| | | isdlassemnly := unit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLAssemnlyUnit() ); |
| | | //是否属于长春机加产线 |
| | | isccproduction := unit.ID() = MachiningPipelineReport::GetDefaultCCProductionUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultCCProductionUnit() ); |
| | | //是否属于大连机加产线 |
| | | isdlproduction := unit.ID() = MachiningPipelineReport::GetDefaultDLProductionUnit() or exists( parentunits, Elements, punit, punit.ID() = MachiningPipelineReport::GetDefaultDLProductionUnit() ); |
| | | if( iscc or isdl ){ |
| | | traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not pisp.IsSystem() ){ |
| | | row := table.GetRow( pisp.ProductID() ); |
| | | |
| | | 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() ); |
| | | |
| | | traverse( pispips, Elements, pispip ){ |
| | | //天 |
| | | daycolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() ); |
| | | //周 |
| | | weekcolumn := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), weekstart ); |
| | | |
| | | supplyquantity := [Real]ceil( pispip.NewSupplyQuantity() );//向上取整 |
| | | inventoryquantity := [Real]ceil( pispip.PlannedInventoryLevelEnd() );//向上取整 |
| | | |
| | | //装配线 |
| | | if( isccassemnly or isdlassemnly ){ |
| | | row.SetCellAssemblyValue( daycolumn, isccassemnly, supplyquantity ); |
| | | row.SetCellAssemblyValue( weekcolumn, isccassemnly, supplyquantity ); |
| | | } |
| | | |
| | | //机加线 |
| | | if( isccproduction or isdlproduction ){ |
| | | row.SetCellProductionValue( daycolumn, isccproduction, supplyquantity ); |
| | | row.SetCellProductionValue( weekcolumn, isccproduction, supplyquantity ); |
| | | } |
| | | //库存 |
| | | if( iscc or isdl ){ |
| | | row.SetCellInventoryValue( daycolumn, iscc, inventoryquantity ); |
| | | if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){ |
| | | weekstart := ( weekstart + Duration::Days( 7 ) ).Date(); |
| | | row.SetCellInventoryValue( weekcolumn, iscc, inventoryquantity ); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |