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_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl |    8 ++++
 _Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl |    8 ++++
 /dev/null                                                              |   20 ----------
 _Main/BL/Type_MachiningPipelineCell/StaticMethod_Initialize.qbl        |   14 +++---
 _Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl        |    4 +-
 _Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl     |   54 +++++++++++++++-----------
 6 files changed, 56 insertions(+), 52 deletions(-)

diff --git a/_Main/BL/Type_MachiningPipelineCell/StaticMethod_Initialize.qbl b/_Main/BL/Type_MachiningPipelineCell/StaticMethod_Initialize.qbl
index ba284fe..46090ff 100644
--- a/_Main/BL/Type_MachiningPipelineCell/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_MachiningPipelineCell/StaticMethod_Initialize.qbl
@@ -8,13 +8,13 @@
   [*
     // 鐢勫叞楦� Jul-12-2024 (created)
     cell := column.Cell( relnew, CCAssemblyPlanQty := 0, 
-                         CCProductionQty := 0, 
-                         CCTransferQty := 0,
-                         CCInventoryQty := 0, 
-                         DLAssemblyPlanQty := 0, 
-                         DLProductionQty := 0, 
-                         DLTransferQty := 0,
-                         DLInventoryQty := 0 );
+                         CCProductionQty           := 0, 
+                         CCTransferQty             := 0,
+                         CCInventoryQty            := 0, 
+                         DLAssemblyPlanQty         := 0,
+                         DLProductionQty           := 0, 
+                         DLTransferQty             := 0,
+                         DLInventoryQty            := 0 );
     
     return cell;
   *]
diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl
new file mode 100644
index 0000000..af5f2ec
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_CCAssemblyPlanQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CCAssemblyPlanQty
+{
+  #keys: '3[415136.0.1006432687][415136.0.1006432686][415136.0.1006432688]'
+  Description: '闀挎槬瑁呴厤璁″垝'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl
new file mode 100644
index 0000000..38d7472
--- /dev/null
+++ b/_Main/BL/Type_MachiningPipelineColumn0/Attribute_DLAssemblyPlanQty.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute DLAssemblyPlanQty
+{
+  #keys: '3[415136.0.1006432691][415136.0.1006432690][415136.0.1006432692]'
+  Description: '澶ц繛瑁呴厤璁″垝'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl b/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
index c4e150b..8a122c3 100644
--- a/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_MachiningPipelineReport/Method_GenerateColumn.qbl
@@ -17,13 +17,13 @@
         periodtime          := period.StartDate();
         periodname          := periodtime.Format( "M2/D2/Y" );
         
-        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
+        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, CCAssemblyPlanQty := 0, DLAssemblyPlanQty := 0, TimeUnit := Translations::MP_GlobalParameters_Day() );
       }
       
       if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
         if( period.StartDate() = weekstart ){
           weekperiodname    := weekstart.Format( "M2/D2/Y" );
-          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
+          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), CCAssemblyPlanQty := 0, DLAssemblyPlanQty := 0, TimeUnit := Translations::MP_GlobalParameters_Week() );
           weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
         }
       }
diff --git a/_Main/BL/Type_MachiningPipelineRow/Method_SetCellAssemblyValue.qbl b/_Main/BL/Type_MachiningPipelineRow/Method_SetCellAssemblyValue.qbl
deleted file mode 100644
index 7e188ba..0000000
--- a/_Main/BL/Type_MachiningPipelineRow/Method_SetCellAssemblyValue.qbl
+++ /dev/null
@@ -1,20 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method SetCellAssemblyValue (
-  MachiningPipelineColumn column,
-  Boolean iscc,
-  Real quantity
-)
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jun-24-2024 (created)
-    cell := selectobject( this, Cell, cell, cell.Column() = column );
-    
-    if( iscc ){
-      cell.CCAssemblyPlanQty( cell.CCAssemblyPlanQty() + quantity );
-    } else {
-      cell.DLAssemblyPlanQty( cell.DLAssemblyPlanQty() + quantity );
-    }
-  *]
-}
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