From 7b39e3bb5227a90b8a96b027f71436e435badce9 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 13 十二月 2024 16:33:27 +0800
Subject: [PATCH] 修复一些bug

---
 _Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl   |    2 
 _Main/BL/Type_LocalCell_Default/StaticMethod_GenerateAnnualPlanReport.qbl |   72 ++++++++++++++++++++++++++++++-----
 _Main/BL/Type_MP_Cell_AnnualPlanReport0/StaticMethod_CreateFullTable.qbl  |   36 +++++++++--------
 3 files changed, 81 insertions(+), 29 deletions(-)

diff --git a/_Main/BL/Type_LocalCell_Default/StaticMethod_GenerateAnnualPlanReport.qbl b/_Main/BL/Type_LocalCell_Default/StaticMethod_GenerateAnnualPlanReport.qbl
index 5f86d1d..eb6865b 100644
--- a/_Main/BL/Type_LocalCell_Default/StaticMethod_GenerateAnnualPlanReport.qbl
+++ b/_Main/BL/Type_LocalCell_Default/StaticMethod_GenerateAnnualPlanReport.qbl
@@ -75,20 +75,70 @@
                               and pispippl.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day());
     
       if( pispippls.Size() <> 0 ){
-        localRow := null( LocalRow );
-        {
-          localRowHandle := localRowIndexTree.GetHandle( pisp_mp.ProductID() + pisp_mp.StockingPoint_MP().Unit().Name() );
-          localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
-          if( isnull( localRowIndex )){
-            localRow := localTable.LocalRow( relnew,CustomName := pisp_mp.ProductID() + " in " + pisp_mp.StockingPoint_MP().Unit().Name(),ProductID := pisp_mp.ProductID(),ProductionLine := pisp_mp.StockingPoint_MP().Unit().Name(),Index := localTable.GetRowIndexCache() );
-            localRows.Add( localRow );
-            localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 );
+        traverse( pispippls,Elements.NewSupply,newSupply ){
+          unit := newSupply.PeriodTask_MP().UnitPeriod().Unit();
+          
+          localRow := null( LocalRow );
+          {
+            localRowHandle := localRowIndexTree.GetHandle( pisp_mp.ProductID() + unit.Name() );
+            localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
+            if( isnull( localRowIndex )){
+              localRow := localTable.LocalRow( relnew,CustomName := pisp_mp.ProductID() + " in " + unit.Name(),
+                                               ProductID := pisp_mp.ProductID(),
+                                               ProductionLine := unit.Name(),
+                                               Index := localTable.GetRowIndexCache() );
+              localRows.Add( localRow );
+              localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 );
+            }else{
+              localRow := localRows.Element( localRowIndex.GetValueAsNumber() );
+            }
+          }
+          
+          column := null( LocalColumn );
+          {
+            columnHandle := localColumnIndexTree.GetHandle( newSupply.PeriodTask_MP().UnitPeriod().Period_MP().StartDate().AsQUILL() );
+            columnIndex := guard( localColumnIndexTree.Root().Child( columnHandle ),null( NamedValue ));
+            if( not isnull( columnIndex )){
+              column := localColumns.Element( columnIndex.GetValueAsNumber() );
+            }else{
+              column := localTable.LocalColumn( relnew,CustomDate := newSupply.PeriodTask_MP().UnitPeriod().Period_MP().StartDate() ,TimeUnit := "Day");
+              localColumns.Add( column );
+              localColumnIndexTree.Root().AddChild( columnHandle,localColumns.Size() - 1 );
+            }
+          }
+          
+          localCellHandle := localCellIndexTree.GetHandle( localRow.ProductID() + localRow.ProductionLine() + column.CustomDate().AsQUILL() + column.TimeUnit() );
+          localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue ));
+          if( isnull( localCellIndex )){
+            localCell := localRow.LocalCell( relnew,LocalCell_Default,LocalColumn := column );
+            localCell.RealValue( newSupply.Quantity() );
+            localCells.Add( localCell );
+            localCellIndexTree.Root().AddChild( localCellHandle,localCells.Size() - 1 );
           }else{
-            localRow := localRows.Element( localRowIndex.GetValueAsNumber() );
+            localCell := localCells.Element( localCellIndex.GetValueAsNumber() );
+            localCell.RealValue( localCell.RealValue() + newSupply.Quantity() );
           }
         }
-    
+        
         traverse( pispippls,Elements,pispippl ){
+          unit := pispippl.ProductInStockingPoint_MP().StockingPoint_MP().Unit();
+          
+          localRow := null( LocalRow );
+          {
+            localRowHandle := localRowIndexTree.GetHandle( pisp_mp.ProductID() + unit.Name() );
+            localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
+            if( isnull( localRowIndex )){
+              localRow := localTable.LocalRow( relnew,CustomName := pisp_mp.ProductID() + " in " + unit.Name(),
+                                               ProductID := pisp_mp.ProductID(),
+                                               ProductionLine := unit.Name(),
+                                               Index := localTable.GetRowIndexCache() );
+              localRows.Add( localRow );
+              localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 );
+            }else{
+              localRow := localRows.Element( localRowIndex.GetValueAsNumber() );
+            }
+          }
+          
           column := null( LocalColumn );
           {
             columnHandle := localColumnIndexTree.GetHandle( pispippl.Period_MP().StartDate().AsQUILL() );
@@ -106,7 +156,7 @@
           localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue ));
           if( isnull( localCellIndex )){
             localCell := localRow.LocalCell( relnew,LocalCell_Default,LocalColumn := column );
-            localCell.RealValue( pispippl.NewSupplyQuantity() );
+            localCell.RealValue( pispippl.NewSupplyQuantity());
             localCells.Add( localCell );
             localCellIndexTree.Root().AddChild( localCellHandle,localCells.Size() - 1 );
           }else{
diff --git a/_Main/BL/Type_MP_Cell_AnnualPlanReport0/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_MP_Cell_AnnualPlanReport0/StaticMethod_CreateFullTable.qbl
index 73b4888..8e6f089 100644
--- a/_Main/BL/Type_MP_Cell_AnnualPlanReport0/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_MP_Cell_AnnualPlanReport0/StaticMethod_CreateFullTable.qbl
@@ -74,28 +74,30 @@
                               and pispippl.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day());
     
       if( pispippls.Size() <> 0 ){
-        localRow := null( LocalRow );
-        {
-          localRowHandle := localRowIndexTree.GetHandle( pisp_mp.ProductID() + pisp_mp.StockingPoint_MP().Unit().Name() );
-          localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
-          if( isnull( localRowIndex )){
-            localRow := localTable.LocalRow( relnew,CustomName := pisp_mp.Name(),ProductID := pisp_mp.ProductID(),ProductionLine := pisp_mp.StockingPoint_MP().Unit().Name(),Index := localTable.GetRowIndexCache() );
-            localRows.Add( localRow );
-            localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 );
-          }else{
-            localRow := localRows.Element( localRowIndex.GetValueAsNumber() );
+        traverse( pispippls,Elements.NewSupply,newSupply ){
+          unit := newSupply.PeriodTask_MP().UnitPeriod().Unit();
+          
+          localRow := null( LocalRow );
+          {
+            localRowHandle := localRowIndexTree.GetHandle( pisp_mp.ProductID() + unit.Name() );
+            localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
+            if( isnull( localRowIndex )){
+              localRow := localTable.LocalRow( relnew,CustomName := pisp_mp.Name(),ProductID := pisp_mp.ProductID(),ProductionLine := unit.Name(),Index := localTable.GetRowIndexCache() );
+              localRows.Add( localRow );
+              localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 );
+            }else{
+              localRow := localRows.Element( localRowIndex.GetValueAsNumber() );
+            }
           }
-        }
-    
-        traverse( pispippls,Elements,pispippl ){
+          
           column := null( LocalColumn );
           {
-            columnHandle := localColumnIndexTree.GetHandle( pispippl.Period_MP().StartDate().AsQUILL() );
+            columnHandle := localColumnIndexTree.GetHandle( newSupply.PeriodTask_MP().UnitPeriod().Period_MP().StartDate().AsQUILL() );
             columnIndex := guard( localColumnIndexTree.Root().Child( columnHandle ),null( NamedValue ));
             if( not isnull( columnIndex )){
               column := localColumns.Element( columnIndex.GetValueAsNumber() );
             }else{
-              column := localTable.LocalColumn( relnew,CustomDate := pispippl.Period_MP().StartDate() ,TimeUnit := "Day");
+              column := localTable.LocalColumn( relnew,CustomDate := newSupply.PeriodTask_MP().UnitPeriod().Period_MP().StartDate() ,TimeUnit := "Day");
               localColumns.Add( column );
               localColumnIndexTree.Root().AddChild( columnHandle,localColumns.Size() - 1 );
             }
@@ -105,12 +107,12 @@
           localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue ));
           if( isnull( localCellIndex )){
             localCell := localRow.LocalCell( relnew,LocalCell_Default,LocalColumn := column );
-            localCell.RealValue( pispippl.NewSupplyQuantity() );
+            localCell.RealValue( newSupply.Quantity() );
             localCells.Add( localCell );
             localCellIndexTree.Root().AddChild( localCellHandle,localCells.Size() - 1 );
           }else{
             localCell := localCells.Element( localCellIndex.GetValueAsNumber() );
-            localCell.RealValue( localCell.RealValue() + pispippl.NewSupplyQuantity() );
+            localCell.RealValue( localCell.RealValue() + newSupply.Quantity() );
           }
         }
       }
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
index e99f055..0d02b18 100644
--- a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
@@ -169,7 +169,7 @@
          }
        }
        // 寰幆鏃堕棿涓鸿鍒掑紑濮嬫棩鏈熶箣鍓嶇殑鏃堕棿
-       traverse( localColumns,Elements,localColumn , localColumn.CustomDate() < macroPlan.StartOfPlanning().Date() or LocalTool::GetYYYYMM( localColumn.CustomDate() ) = LocalTool::GetYYYYMM( macroPlan.StartOfPlanning().Date() )){
+       traverse( localColumns,Elements,localColumn , (localColumn.CustomDate() < macroPlan.StartOfPlanning().Date() or LocalTool::GetYYYYMM( localColumn.CustomDate() ) = LocalTool::GetYYYYMM( macroPlan.StartOfPlanning().Date() )) and localColumn.CustomDate() <> macroPlan.StartOfPlanning().Date()){
           archiveCells := selectset( row,LocalCell.astype( LocalCell_ScheduleSummary ),cell,
                               cell.LocalColumn().CustomDate() >= localColumn.CustomDate() and 
                               cell.LocalColumn().CustomDate() < localColumn.CustomDate().StartOfNextMonth() );

--
Gitblit v1.9.3