From 1416622ccad797dc3602b6672ca59137bab49c7e Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 31 十月 2024 17:12:30 +0800
Subject: [PATCH] 机加管线报表库存值逻辑修改

---
 _Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl |   68 +++++++++++-----------------------
 1 files changed, 22 insertions(+), 46 deletions(-)

diff --git a/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl b/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl
index 733701c..61f7d47 100644
--- a/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl
+++ b/_Main/BL/Type_EnginePipelineReport/Method_Generate0.qbl
@@ -43,7 +43,7 @@
       showrowccproduction   := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '闀挎槬浜ч噺' ), row.Name(), '', showrowdlproduction.RowNr() + 1 );
       showrowdemand         := EnginePipelineRow::CraeteCellValueForRow( this, rowname.Concat( '鎬婚渶姹�' ), row.Name(), '', showrowccproduction.RowNr() + 1 );
       rownr                 := showrowdemand.RowNr() + 1;
-      modelsnr              := showrowdemand.RowNr() + 3;
+      modelsnr              := showrowdemand.RowNr() + 4;
       uniquemodels          := selectuniquevalues( row, Cell.Demand, demand, true, demand.Model() );
       demandrows            := construct( EnginePipelineRows );
       traverse( uniquemodels, Elements, e ){
@@ -67,87 +67,63 @@
         
         //鐢熶骇
         productionqty       := sum( daycells, Elements, cell, cell.ProductionQuantity() );
-        production          := column.CellValue( relnew, Value := [String]productionqty );
-        showrowproduction.CellValue( relinsert, production );
+        production          := selectobject( column, CellValue, c, c.Row() = showrowproduction );
+        production.Value( [String]productionqty );
         sumproduction       := selectobject( column, CellValue, c, c.Row() = sumrowproduction );
-        if( isnull( sumproduction ) ){
-          sumproduction     := column.CellValue( relnew, Value := [String]0 );
-          sumrowproduction.CellValue( relinsert, sumproduction );
-        }
         sumproduction.Value( [String]( [Real]sumproduction.Value() + productionqty ) );
         //澶ц繛浜ч噺
-        dlproductionqty     := sum( daycells, Elements, cell, cell.Production().DLProduction() );
-        dlproduction        := column.CellValue( relnew, Value := [String]dlproductionqty );
-        showrowdlproduction.CellValue( relinsert, dlproduction );
+        dlproductionqty     := sum( daycells, Elements.Production, cellproduction, cellproduction.DLProduction() );
+        dlproduction        := selectobject( column, CellValue, c, c.Row() = showrowdlproduction );
+        dlproduction.Value( [String]dlproductionqty );
         sumdlproduction     := selectobject( column, CellValue, c, c.Row() = sumrowdlproduction );
-        if( isnull( sumdlproduction ) ){
-          sumdlproduction   := column.CellValue( relnew, Value := [String]0 );
-          sumrowdlproduction.CellValue( relinsert, sumdlproduction );
-        }
         sumdlproduction.Value( [String]( [Real]sumdlproduction.Value() + dlproductionqty ) );
         //闀挎槬浜ч噺
-        ccproductionqty     := sum( daycells, Elements, cell, cell.Production().CCProduction() );
-        ccproduction        := column.CellValue( relnew, Value := [String]ccproductionqty );
-        showrowccproduction.CellValue( relinsert, ccproduction );
+        ccproductionqty     := sum( daycells, Elements.Production, cellproduction, cellproduction.CCProduction() );
+        ccproduction        := selectobject( column, CellValue, c, c.Row() = showrowccproduction );
+        ccproduction.Value( [String]ccproductionqty );
         sumccproduction     := selectobject( column, CellValue, c, c.Row() = sumrowccproduction );
-        if( isnull( sumccproduction ) ){
-          sumccproduction   := column.CellValue( relnew, Value := [String]0 );
-          sumrowccproduction.CellValue( relinsert, sumccproduction );
-        }
         sumccproduction.Value( [String]( [Real]sumccproduction.Value() + ccproductionqty ) );
         //闇�姹�
         totaldemandqty      := sum( daycells, Elements, cell, cell.DemandQuantity() );
-        totaldemand         := column.CellValue( relnew, Value := [String]totaldemandqty );
-        showrowdemand.CellValue( relinsert, totaldemand );
+        totaldemand         := selectobject( column, CellValue, c, c.Row() = showrowdemand );
+        totaldemand.Value( [String]totaldemandqty );
         sumdemand           := selectobject( column, CellValue, c, c.Row() = sumrowdemand );
-        if( isnull( sumdemand ) ){
-          sumdemand         := column.CellValue( relnew, Value := [String]0 );
-          sumrowdemand.CellValue( relinsert, sumdemand );
-        }
         sumdemand.Value( [String]( [Real]sumdemand.Value() + totaldemandqty ) );
         //鍏蜂綋闇�姹�
         traverse( demandrows, Elements, demandrow ){
           demandqty         :=  sum( daycells, Elements.Demand, celldemand, celldemand.Model() = demandrow.Demand(), celldemand.Quantity() );
-          demandcell        := column.CellValue( relnew, Value := [String]demandqty );
-          demandrow.CellValue( relinsert, demandcell );
+          demandcell        := selectobject( column, CellValue, c, c.Row() = demandrow );
+          demandcell.Value( [String]demandqty );
           sumdemandrow      := selectobject( sumdemandrows, Elements, r, r.Demand() = demandrow.Demand() );
           if( not isnull( sumdemandrow ) ){
             sumdemandcell   := selectobject( column, CellValue, c, c.Row() = sumdemandrow );
-            if( isnull( sumdemandcell ) ){
-              sumdemandcell := column.CellValue( relnew, Value := [String]0 );
-              sumdemandrow.CellValue( relinsert, sumdemandcell );
-            }
             sumdemandcell.Value( [String]( [Real]sumdemandcell.Value() + demandqty ) );
           }
         }
         //搴撳瓨
-        inventroyqty             := maxobject( daycells, Elements, e, e.Column().StartDate() ).InventoryQuantity();
-        inventory                := column.CellValue( relnew, Value := [String]inventroyqty );
-        showrowinventory.CellValue( relinsert, inventory );
-        suminventory             := selectobject( column, CellValue, c, c.Row() = sumrowinventory );
-        if( isnull( suminventory ) ){
-          suminventory           := column.CellValue( relnew, Value := [String]0 );
-          sumrowinventory.CellValue( relinsert, suminventory );
-        }
+        inventroyqty        := maxobject( daycells, Elements, e, e.Column().StartDate() ).InventoryQuantity();
+        inventory           := selectobject( column, CellValue, c, c.Row() = showrowinventory );
+        inventory.Value( [String]inventroyqty );
+        suminventory        := selectobject( column, CellValue, c, c.Row() = sumrowinventory );
         suminventory.Value( [String]( [Real]suminventory.Value() + inventroyqty ) );
       }
     }
     traverse( this, Column, column ){
       for( demandr := sumrowdemand.RowNr() + 1; demandr < sumrowinventory.RowNr(); demandr := demandr + 1 ){
-        demandrow              := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = sumname );
+        demandrow           := selectobject( this, Row, r, r.RowNr() = demandr and r.Name() = sumname );
     //    info( '------------------14----------------' );
         if( not isnull( demandrow ) and not exists( demandrow, CellValue, cv, cv.Column() = column ) ){
-          demandcell           := column.CellValue( relnew, Value := '' );
+          demandcell        := column.CellValue( relnew, Value := '' );
           demandrow.CellValue( relinsert, demandcell );
         }
       }
     }
     
-    rows := selectsortedset( this, Row, row, row.Name(), row.RowNr() );
-    i    := 0;
+    rows                    := selectsortedset( this, Row, row, row.Name(), row.RowNr() );
+    i                       := 0;
     traverse( rows, Elements, e ){
       e.RowNr( i );
-      i := i + 1;
+      i                     := i + 1;
     }
   *]
 }

--
Gitblit v1.9.3