From ed070d695972cadcf9b6bbfe9e779aa5a0850125 Mon Sep 17 00:00:00 2001 From: lazhen <17772815105@139.com> Date: 星期三, 09 十月 2024 09:15:28 +0800 Subject: [PATCH] 库存汇总报表数据逻辑bug --- _Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl | 88 +++++++------------------------------------- 1 files changed, 14 insertions(+), 74 deletions(-) diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl index cc7d847..407d96a 100644 --- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl +++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl @@ -14,32 +14,24 @@ allunit := InventorySummaryReport::GetDefaultAllUnit(); ccunit := InventorySummaryReport::GetDefaultCCUnit(); dlunit := InventorySummaryReport::GetDefaultDLUnit(); - //ccalineunit := FinancialProductionReport::GetDefaultCCALineUnit(); - //dlalienunit := FinancialProductionReport::GetDefaultDLALineUnit() - //ccmplineunit := FinancialProductionReport::GetDefaultCCMPLineUnit() - //dlmplineunit := FinancialProductionReport::GetDefaultDLMPLineUnit(); source := owner.InventorySummarySource( relnew, ID := InventorySummaryReport::GetDefaultName(), Name := InventorySummaryReport::GetDefaultName() ); table := source.InventorySummaryReport( relnew, ID := source.Name(), Name := source.Name() ); showtable := source.InventorySummaryReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true ); startofplanning := owner.StartOfPlanning(); startofyear := startofplanning.StartOfYear() - Duration::Days( 1 ); - startofnextyear := startofplanning.StartOfNextYear() - Duration::Days( 1 ); + startofnextyear := startofplanning.StartOfNextYear(); search := owner.InventorySummarySearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit, Category := Translations::MP_GlobalParameters_Day(), StartDate := Date::MinDate(), EndDate := Date::MaxDate() ); table.GenerateColumn( owner, 'All', startofyear, startofnextyear ); - //info( '-----------------------------------', table.InventorySummaryColumn( relsize ) ); //搴撳瓨鏁伴噺涓篈ctual inventories閲岄潰鐨勭偣Planned inventories瀛楁搴撳瓨閲忓姞鎬� traverse( owner, StockingPoint_MP, stockingpoint ){ - //traverse( owner, StockingPoint_MP, stockingpoint, stockingpoint.ID().EndsWith( '鍘傚唴搴�' ) ){ unit := stockingpoint.Unit(); parentunits := unit.GetAllParent(); //鏄惁灞炰簬闀挎槬宸ュ巶 - // iscc := stockingpoint.ID().StartsWith( 'CC' ) or stockingpoint.ID() = '闀挎槬' ;//unit.ID() = ccalineunit or unit.ID() = ccmplineunit or exists( parentunits, Elements, punit, punit.ID() = ccalineunit or punit.ID() = ccmplineunit ); iscc := exists( parentunits, Elements, punit, punit.ID().StartsWith( 'VWED CC' ) ); //鏄惁灞炰簬澶ц繛宸ュ巶 - // isdl := stockingpoint.ID().StartsWith( '澶ц繛' );//unit.ID() = dlalienunit or unit.ID() = dlmplineunit or exists( parentunits, Elements, punit, punit.ID() = dlalienunit or punit.ID() = dlmplineunit ); isdl := exists( parentunits, Elements, punit, punit.ID().StartsWith( 'VWED DL' ) ); if( iscc or isdl ){ traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() ){ @@ -47,12 +39,6 @@ factoryrow := table.GetRow( ifexpr( iscc, ccunit, dlunit ), pisp.ProductID() ); //鑾峰彇鍚堣琛� allrow := table.GetRow( allunit, pisp.ProductID() ); - //鍛ㄥ害鐨勬暟鎹� - weekpispips := construct( ProductInStockingPointInPeriods ); - //鏈堝害鐨勬暟鎹� - monthpispips := construct( ProductInStockingPointInPeriods ); - nextweek := startofplanning.StartOfNextWeek(); - nextmonth := startofplanning.StartOfNextMonth(); pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() ); @@ -68,88 +54,42 @@ quantity := ifexpr( pispip.Period_MP().IsHistorical(), [Number]pispip.ActualInventoryLevelEnd(), [Number]pispip.PlannedInventoryLevelEnd() ); factoryrow.SetCellValue( daycolumn, quantity ); allrow.SetCellValue( daycolumn, quantity ); - - //鍛紝閫夋嫨鍛ㄦ椂锛屾湡鏈簱瀛樹负姣忎竴鍛ㄦ渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鍛ㄧ殑骞冲潎鍊� - if( period.Start() < nextweek ){ - weekpispips.Add( pispip ); - - weekend := nextweek - Duration::Days( 1 ); - if( period.Start() = weekend ){ - weekcolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Week() ); - - maxinventory := max( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) ); - mininventory := min( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) ); - aveinventory := average( weekpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) ); - factoryrow.SetCellValue( weekcolumn, quantity, mininventory, maxinventory, [Number]aveinventory ); - allrow.SetCellValue( weekcolumn, quantity, mininventory, maxinventory, [Number]aveinventory ); - } - }else{ - weekpispips.Flush(); - weekpispips.Add( pispip ); - nextweek := nextweek.StartOfNextWeek(); - } - - //鏈堬紝閫夋嫨鏈堟椂锛屾湡鏈簱瀛樹负姣忎竴鏈堟渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴涓湀搴撳瓨閲忔渶灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴涓湀搴撳瓨閲忔渶澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鏈堢殑骞冲潎鍊� - if( period.Start() < nextmonth ){ - monthpispips.Add( pispip ); - - monthend := nextmonth - Duration::Days( 1 ); - if( period.Start() = monthend ){ - monthcolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Month() ); - - maxinventory := max( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) ); - mininventory := min( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) ); - aveinventory := average( monthpispips, Elements, e, ifexpr( pispip.Period_MP().IsHistorical(), [Number]e.ActualInventoryLevelEnd(), [Number]e.PlannedInventoryLevelEnd() ) ); - factoryrow.SetCellValue( monthcolumn, quantity, mininventory, maxinventory, [Number]aveinventory ); - allrow.SetCellValue( monthcolumn, quantity, mininventory, maxinventory, [Number]aveinventory ); - } - }else{ - monthpispips.Flush(); - monthpispips.Add( pispip ); - nextmonth := nextmonth.StartOfNextMonth(); - } } } } } //棣栧厛鍦‥ntities閲岃瘑鍒埗绾nit涓洪暱鏄�/澶ц繛鐨勬墍鏈夊簱瀛樼偣 //闀挎槬搴撳瓨鐐� - ccsps := construct( Strings ); + ccsps := construct( Strings ); //澶ц繛搴撳瓨鐐� - dlsps := construct( Strings ); - allsps := construct( Strings ); + dlsps := construct( Strings ); + allsps := construct( Strings ); traverse( owner, Unit, unit, unit.ID() = ccunit or unit.ID() = dlunit ){ if( unit.ID() = ccunit ){ - ccsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ); + ccsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ); } if( unit.ID() = dlunit ){ - dlsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ); + dlsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ); } - allsps := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) ); + allsps := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) ); } //鍐嶅湪搴撳瓨鏇存柊鐨勫瓙鐣岄潰搴撳瓨鐐归�夋嫨涓壘鍒拌繖浜涘簱瀛樼偣鎵�鍏宠仈鐨勫凡鍕鹃�夊簱浣� - selections := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() ); - productids := selectuniquevalues( selections, Elements, selection, selection.ProductID() ); + selections := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() ); + productids := selectuniquevalues( selections, Elements, selection, selection.ProductID() ); //鏈�鍚庡皢杩欎簺搴撲綅涓浂浠跺彿鐨勬暟閲忚繘琛屽姞鎬� - traverse( table, InventorySummaryColumn, column, column.Period() < startofplanning.Date() ){ + traverse( table, InventorySummaryColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.Period() < startofplanning.Date() ){ traverse( productids, Elements, productid ){ - if( column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){//澶� - column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit ); - }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Week() ){//鍛� - column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfWeek(), column.Period(), productid, allunit, ccunit, dlunit ); - }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Month() ){//鏈� - column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfMonth(), column.Period(), productid, allunit, ccunit, dlunit ); - } + column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit ); } } - rows := selectsortedset( table, InventroySummaryRow, row, row.Name() ); - i := 0; + rows := selectsortedset( table, InventroySummaryRow, row, row.Name() ); + i := 0; traverse( rows, Elements, e ){ if( exists( e, InventorySummaryCell, cell, cell.AverageInventory() <> 0 or cell.EndingInventory() <> 0 or cell.MaximumInventory() <> 0 or cell.MinimumInventory() <> 0 ) ){ e.RowNr( i ); - i := i + 1; + i := i + 1; }else{ e.Delete(); } -- Gitblit v1.9.3