From afbad399be481afbe886bc2ad1e22abbcd5df771 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期一, 05 八月 2024 14:56:46 +0800
Subject: [PATCH] 财务报表bug修复
---
_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl | 129 +++++++++++++++++++++++-------------------
1 files changed, 71 insertions(+), 58 deletions(-)
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
index f3c7208..47f1246 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -27,68 +27,81 @@
table.GenerateColumn( owner, 'All', startofyear, startofnextyear );
//info( '-----------------------------------', table.InventorySummaryColumn( relsize ) );
//搴撳瓨鏁伴噺涓篈ctual inventories閲岄潰鐨勭偣Planned inventories瀛楁搴撳瓨閲忓姞鎬�
- traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() and not isnull( pisp.StockingPoint_MP() ) and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
- unit := pisp.StockingPoint_MP().UnitID();
- product := pisp.Product_MP();
- // info( '-----------------------------------', unit, product.ID() );
- weekpispips := construct( ProductInStockingPointInPeriods );
- monthpispips := construct( ProductInStockingPointInPeriods );
- nextweek := startofplanning.StartOfNextWeek();
- nextmonth := startofplanning.StartOfNextMonth();
-
- unitrow := table.GetRow( unit, product.ID() );
- allrow := table.GetRow( allunit, product.ID() );
- pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning and pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
- // info( '-----------------------------------', isnull( allrow ), pispips.Size() );
- traverse( pispips, Elements, pispip, pispip.Start() = startofplanning ){
- // info( '-----------------------------------', pispip.Start() );
- period := pispip.Period_MP();
- periodtime := period.Start().Date();
- periodname := periodtime.Format( "M2/D2/Y" );
- //澶╋紝閫夋嫨鏃ラ绮掑害鏃讹紝鏈熸湯搴撳瓨锛屾渶灏忓簱瀛橈紝鏈�澶у簱瀛樺拰骞冲潎搴撳瓨鐨勬暟鍊间繚鎸佷竴鑷�
- daycolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Day() );
- info( daycolumn.Name(), daycolumn.Period(), daycolumn.TimeUnit() );
- unitrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
- allrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
-
- //鍛紝閫夋嫨鍛ㄦ椂锛屾湡鏈簱瀛樹负姣忎竴鍛ㄦ渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鍛ㄧ殑骞冲潎鍊�
- if( period.Start() < nextweek ){
- weekpispips.Add( pispip );
+ 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 );
+ if( iscc or isdl ){
+ traverse( stockingpoint, ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() ){
+ //鑾峰彇宸ュ巶琛�
+ 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();
- 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() );
+ pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical()
+ and pispip.Start() < startofnextyear
+ and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
+
+ traverse( pispips, Elements, pispip ){
+ period := pispip.Period_MP();
+ periodtime := period.Start().Date();
+ periodname := periodtime.Format( "M2/D2/Y" );
- maxinventory := max( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
- mininventory := min( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
- aveinventory := average( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
- unitrow.SetCellValue( weekcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
- allrow.SetCellValue( weekcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, 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() );
+ //澶╋紝閫夋嫨鏃ラ绮掑害鏃讹紝鏈熸湯搴撳瓨锛屾渶灏忓簱瀛橈紝鏈�澶у簱瀛樺拰骞冲潎搴撳瓨鐨勬暟鍊间繚鎸佷竴鑷�
+ daycolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Day() );
+ info( daycolumn.Name(), daycolumn.Period(), daycolumn.TimeUnit() );
+ factoryrow.SetCellValue( daycolumn, [Number]pispip.PlannedInventoryLevelEnd() );
+ allrow.SetCellValue( daycolumn, [Number]pispip.PlannedInventoryLevelEnd() );
- maxinventory := max( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
- mininventory := min( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
- aveinventory := average( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
- unitrow.SetCellValue( monthcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
- allrow.SetCellValue( monthcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
+ //鍛紝閫夋嫨鍛ㄦ椂锛屾湡鏈簱瀛樹负姣忎竴鍛ㄦ渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鍛ㄧ殑骞冲潎鍊�
+ 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, [Number]e.PlannedInventoryLevelEnd() );
+ mininventory := min( weekpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
+ aveinventory := average( weekpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
+ factoryrow.SetCellValue( weekcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
+ allrow.SetCellValue( weekcolumn, [Number]pispip.PlannedInventoryLevelEnd(), 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, [Number]e.PlannedInventoryLevelEnd() );
+ mininventory := min( monthpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
+ aveinventory := average( monthpispips, Elements, e, [Number]e.PlannedInventoryLevelEnd() );
+ factoryrow.SetCellValue( monthcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
+ allrow.SetCellValue( monthcolumn, [Number]pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, [Number]aveinventory );
+ }
+ }else{
+ monthpispips.Flush();
+ monthpispips.Add( pispip );
+ nextmonth := nextmonth.StartOfNextMonth();
+ }
}
- }else{
- monthpispips.Flush();
- monthpispips.Add( pispip );
- nextmonth := nextmonth.StartOfNextMonth();
}
}
}
--
Gitblit v1.9.3