From 107f0e4b79a6189e5f61ca0a4d77dd8d047a8f2b Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 16 八月 2024 12:01:21 +0800
Subject: [PATCH] 机加件管线报表装配数据

---
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl |   54 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
index 3cd2e3a..23633d0 100644
--- a/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -41,31 +41,35 @@
       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() 
-                  and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
+    //              and exists( pisp.Product_MP().GetAllParent(), Elements, e, e.ID() = productparent ) 
                   and exists( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ) ) ){
-          product             := pisp.Product_MP();
-          productparents      := product.GetAllParent();
-          if( exists( productparents, Elements, e, e.ID() = productparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
-            row               := table.GetRow( pisp.ProductID() );
-            products.Add( pisp.Product_MP() );
-    //        weekstart         := owner.StartOfPlanning().Date();
-            pispips           := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
-                                                    and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ), pispip.Start() );
+          pispips             := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical() 
+                                                  and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day() and ( pispip.NewSupplyQuantity() <> 0 or pispip.PlannedInventoryLevelEnd() <> 0 ), pispip.Start() );
+          traverse( pispips, Elements, pispip ){
+            supplyquantity    := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+            //澶�
+            daycolumn         := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
+            //鍛�
+            weekcolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
             
-            traverse( pispips, Elements, pispip ){
-              //澶�
-              daycolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), pispip.Start().Date() );
-              //鍛�
-              weekcolumn       := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), pispip.Start().Date() );
-              
-              supplyquantity   := [Number]pispip.NewSupplyQuantity();//鍥涜垗浜斿叆
+            //瑁呴厤绾�
+            if( isccassemnly or isdlassemnly ){
+              if( isccassemnly ){
+                daycolumn.CCAssemblyPlanQty( daycolumn.CCAssemblyPlanQty() + supplyquantity );
+                weekcolumn.CCAssemblyPlanQty( weekcolumn.CCAssemblyPlanQty() + supplyquantity );
+              } else {
+                daycolumn.DLAssemblyPlanQty( daycolumn.DLAssemblyPlanQty() + supplyquantity );
+                weekcolumn.DLAssemblyPlanQty( weekcolumn.DLAssemblyPlanQty() + supplyquantity );
+              } 
+            }
+            
+            product           := pisp.Product_MP();
+            productparents    := product.GetAllParent();
+            if( exists( productparents, Elements, e, e.ID() = productparent ) ){//鏌ヨ浜у搧绫诲瀷鏄彂鍔ㄦ満
+              row             := table.GetRow( pisp.ProductID() );
+              products.Add( pisp.Product_MP() );
+    
               inventoryquantity:= [Number]pispip.PlannedInventoryLevelEnd();//鍥涜垗浜斿叆
-              
-              //瑁呴厤绾�
-              if( isccassemnly or isdlassemnly ){
-                row.SetCellAssemblyValue( daycolumn, isccassemnly, [Real]supplyquantity );
-                row.SetCellAssemblyValue( weekcolumn, isccassemnly, [Real]supplyquantity );
-              }
               
               //鏈哄姞绾�
               if( isccproduction or isdlproduction ){
@@ -103,7 +107,7 @@
         destiiscc             := destisp.ID() = ccunit or destiunit.ID() = ccunit or exists( destiparentunits, Elements, punit, punit.ID() = ccunit );
         destiisdl             := destisp.ID() = dlunit or destiunit.ID() = dlunit or exists( destiparentunits, Elements, punit, punit.ID() = dlunit );
         if( ( originiscc and destiisdl ) or ( originisdl and destiiscc ) ){
-          row := selectobject( table, Row, row, row.Name() = tprow.Name() );
+          row := table.GetRow( tprow.ProductID() );
           traverse( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() <> Date::MinDate() ){
             //澶�
             daycolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), tpcell.TransferPlanColumn().ColumnDate() );
@@ -122,6 +126,10 @@
     i    := 0;
     traverse( rows, Elements, e ){
       e.RowNr( i );
+      traverse( e, Cell, cell ){
+        cell.CCAssemblyPlanQty( cell.Column().CCAssemblyPlanQty() );
+        cell.DLAssemblyPlanQty( cell.Column().DLAssemblyPlanQty() );
+      }
       i := i + 1;
     }
     showtable.Generate( search, products );

--
Gitblit v1.9.3