From 3cf4ce0c94be1a8928ffe280429d6297583b3b8d Mon Sep 17 00:00:00 2001 From: rislai <risheng.lai@capgemini.com> Date: 星期三, 07 八月 2024 17:23:30 +0800 Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev --- _Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl | 81 ++++++++++++++++++++++++---------------- 1 files changed, 49 insertions(+), 32 deletions(-) diff --git a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl index 9d263fc..b18fbac 100644 --- a/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl +++ b/_Main/BL/Type_EnginePipelineSource/StaticMethod_Initialize.qbl @@ -20,48 +20,65 @@ 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(); - // info( unit, pisp.ProductID() ); - //鍒濆鍖栬 - row := table.GetRow( pisp.ProductID() ); + 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 ); - 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" ); - // info( '---------------------------------', periodtime, table.Column( relsize ), pispip.Period_MP().TimeUnit() ); - column := selectobject( table, Column, column, column.Name() = periodname and column.Period() = periodtime and column.TimeUnit() = pispip.Period_MP().TimeUnit() ); - // info( '---------------------------------', isnull( column ), isnull( row ) ); - // info( '---------------------------------', column.Name(), row.Name() ); - if( unit = ccunit or unit = dlunit ){ - row.SetCellProductionValue( column, unit, pispip.NewSupplyProductionQuantity() ); + 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 := [Real]ceil( pispip.NewSupplyQuantity() );//鍚戜笂鍙栨暣 + inventoryquantity := [Real]ceil( pispip.PlannedInventoryLevelEnd() );//鍚戜笂鍙栨暣 + //浜ч噺鏄姞鎬� + if( iscc or isdl ){ + row.SetCellProductionValue( daycolumn, iscc, supplyquantity ); + row.SetCellProductionValue( weekcolumn, iscc, supplyquantity ); + } + //搴撳瓨闇�瑕佸彇鏈�鍚庝竴澶� + row.SetCellInventoryValue( daycolumn, pispip.PlannedInventoryLevelEnd() ); + + if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){ + weekstart := ( weekstart + Duration::Days( 7 ) ).Date(); + + row.SetCellInventoryValue( weekcolumn, inventoryquantity ); + } } - row.SetCellInventoryValue( column, pispip.PlannedInventoryLevelEnd() ); } } //鐢熸垚闇�姹傛暟鎹� - traverse( owner, SalesDemand.astype( Forecast ), forecast, ( forecast.EndDate() - forecast.StartDate() ) < 8){ - row := table.GetRow( forecast.ProductID() ); - weekdate := ( forecast.StartDate() - Duration::Days( 7 ) ).Date(); - periodtime := forecast.StartDate(); - periodname := periodtime.Format( "M2/D2/Y" ); - - column := selectobject( table, Column, column, column.Name() = periodname and column.Period() = periodtime and column.TimeUnit() = Translations::MP_GlobalParameters_Day() ); - weekcolumn := minobject( table, Column, wcolumn, wcolumn.Period() <= weekdate and wcolumn.TimeUnit() = Translations::MP_GlobalParameters_Week(), wcolumn.Period() ); - - if( not isnull( column ) ){ - row.SetCellDemandValue( column, forecast.SalesSegmentName(), forecast.Quantity() ); - } - - if( not isnull( weekcolumn ) ){ - row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() ); + 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() ); + } } } + rows := selectsortedset( table, Row, row, row.Name() ); i := 0; traverse( rows, Elements, e ){ -- Gitblit v1.9.3