From 9a26b08165a48bec8014d22abec587cb2c7d8c28 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期二, 20 八月 2024 11:52:43 +0800
Subject: [PATCH] 修复了一些bug

---
 _Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl       |   26 ++++++++-----
 _Main/BL/Type_MP_Cell_AnnualPlanReport/StaticMethod_CreateFullTable.qbl        |    9 ----
 _Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl                |    2 
 _Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_ScheduleSummary.qbl           |   26 +++++++++++++
 _Main/BL/Type_MP_Cell_AnnualPlanReport/_ROOT_Type_MP_Cell_AnnualPlanReport.qbl |    1 
 _Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_AnnualPlanReport.qbl          |   26 +++++++++++++
 _Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl             |    5 +-
 7 files changed, 74 insertions(+), 21 deletions(-)

diff --git a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
index c29bb51..d9f9b75 100644
--- a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
+++ b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
@@ -88,8 +88,8 @@
               if( columnName = "鍙戝姩鏈洪浂浠跺彿" ){
                 row.ProductID( ifexpr( isnull( baseVersionCell ), ifexpr( isnull( compareVersionCell ),"绌�",compareVersionCell.Value()), baseVersionCell.Value()) );
               }
-              if( columnName = "浜у湴" ){
-                row.CustomName( row.ProductID() + " > " + ifexpr( isnull( baseVersionCell ), ifexpr( isnull( compareVersionCell ),"绌�",compareVersionCell.Value()), baseVersionCell.Value()) );
+              if( columnName = "杞﹀瀷" ){
+                row.CustomName( " > " + ifexpr( isnull( baseVersionCell ), ifexpr( isnull( compareVersionCell ),"绌�",compareVersionCell.Value()), baseVersionCell.Value()) );
               }
             }else{
               row.LocalCell( relnew,LocalCell_DemandComparison,LocalColumn := column,
@@ -97,6 +97,7 @@
                              CompareVersion := ifexpr( isnull( compareVersionCell ), 0 ,[Real]compareVersionCell.Value() ));
             }
           }
+          row.CustomName( row.ProductID() + row.CustomName() );
         }
       }
       // 鍚庣画鍒犻櫎
diff --git a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl
index 480f365..0990048 100644
--- a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl
+++ b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_Create.qbl
@@ -26,7 +26,7 @@
       columnIndexTree.Root().AddChild( columnHandle,columns.Size() - 1 );
     }
     
-    traverse( owner,Unit,unit,unit.HasCapacityTypeTime()){
+    traverse( owner,Unit,unit,unit.HasCapacityTypeTime() and not unit.HasChild()){
       // unit.AsEntity().DisplayNameForSelection()
       row := table.MP_Row( relnew,CustomName := unit.ID(),Index := table.GetRowIndexCache() ); 
       throughput := sum( unit,Operation,operation,operation.Throughput() ) / unit.Operation( relsize );
diff --git a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
index f3fb6c4..557d70d 100644
--- a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
@@ -3,20 +3,14 @@
 StaticMethod CreateFullTable (
   const MacroPlans owners,
   RecycleBin recycleBin,
-  const Archive archive
+  const Archive archive,
+  const MacroPlan owner
 ) as LocalTable
 {
   TextBody:
   [*
     // rislai Aug-7-2024 (created)
-    tables := construct( MP_Tables );
-    traverse( owners,Elements,owner ){
-      table := select( owner,MP_Table,table,table.Name() = MP_Cell_ScheduleSummary::GetTableName() ); 
-      if( isnull( table )){
-        table :=  MP_Cell_ScheduleSummary::Create( owner );
-      }
-      tables.Add( table );
-    }
+    tables := MP_Table::GetMP_Tables_ScheduleSummary( owners );
     
     scheduleSummaryOutputDataIndexTree := NamedValueTree::Create();
     scheduleSummaryOutputDatas := selectset( archive,ScheduleSummaryOutputLine.ScheduleSummaryOutputData,data,
@@ -42,7 +36,7 @@
        localColumnIndexTree.Root().AddChild( localColumnHandle,localColumns.Size() - 1 );
     }
     traverse( tables,Elements.MP_Row,row ){
-    
+     
        localRow := localTable.LocalRow( relnew,CustomName := row.Name(),Index := localTable.GetRowIndexCache() );
     
        traverse( localColumns,Elements,localColumn ){
@@ -88,6 +82,18 @@
        }
     }
     
+    //startDate := owner.StartOfPlanning().Date() + 7;
+    //endDate := maxselect( owner,Unit.UnitPeriod.astype( UnitPeriodTime ).Period_MP,period,period.EndDate(),period.TimeUnit() = "Month" ).EndDate();
+    //columns := construct( MP_Columns );
+    //columnIndexTree := NamedValueTree::Create();
+    //for( i := startDate;i < endDate; i := i + 1){
+    //  column := table.MP_Column( relnew,CustomDate := i );
+    //  columnHandle := columnIndexTree.GetHandle( i.AsQUILL() );
+    //  columns.Add( column );
+    //  columnIndexTree.Root().AddChild( columnHandle,columns.Size() - 1 );
+    //}
+    
+    
     return localTable;
   *]
 }
diff --git a/_Main/BL/Type_MP_Cell_AnnualPlanReport/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_MP_Cell_AnnualPlanReport/StaticMethod_CreateFullTable.qbl
index 3a8b313..562676c 100644
--- a/_Main/BL/Type_MP_Cell_AnnualPlanReport/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_MP_Cell_AnnualPlanReport/StaticMethod_CreateFullTable.qbl
@@ -8,14 +8,7 @@
   TextBody:
   [*
     // rislai Aug-7-2024 (created)
-    tables := construct( MP_Tables );
-    traverse( owners,Elements,owner ){
-      table := select( owner,MP_Table,table,table.Name() = MP_Cell_AnnualPlanReport::GetTableName() ); 
-      if( isnull( table )){
-        table :=  MP_Cell_AnnualPlanReport::Create( owner );
-      }
-      tables.Add( table );
-    }
+    tables := MP_Table::GetMP_Tables_AnnualPlanReport( owners );
     
     localTable := recycleBin.LocalTable( relnew,Name := MP_Cell_AnnualPlanReport::GetTableName() );
     startDate := minselect( tables,Elements.MP_Column,column,column.CustomDate() ).CustomDate();
diff --git a/_Main/BL/Type_MP_Cell_AnnualPlanReport/_ROOT_Type_MP_Cell_AnnualPlanReport.qbl b/_Main/BL/Type_MP_Cell_AnnualPlanReport/_ROOT_Type_MP_Cell_AnnualPlanReport.qbl
index 8f10ada..d096ec9 100644
--- a/_Main/BL/Type_MP_Cell_AnnualPlanReport/_ROOT_Type_MP_Cell_AnnualPlanReport.qbl
+++ b/_Main/BL/Type_MP_Cell_AnnualPlanReport/_ROOT_Type_MP_Cell_AnnualPlanReport.qbl
@@ -4,6 +4,7 @@
 TypeSpecialization MP_Cell_AnnualPlanReport
 {
   #keys: '2[412672.1.107700065][412672.1.107700060]'
+  Description: '鍏ㄥ勾璁″垝鎶ヨ〃'
   Parent: MP_Cell
   StructuredName: 'MP_Cell_AnnualPlanReports'
 }
diff --git a/_Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_AnnualPlanReport.qbl b/_Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_AnnualPlanReport.qbl
new file mode 100644
index 0000000..c732421
--- /dev/null
+++ b/_Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_AnnualPlanReport.qbl
@@ -0,0 +1,26 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetMP_Tables_AnnualPlanReport (
+  const MacroPlans owners
+) as owning MP_Tables
+{
+  TextBody:
+  [*
+    // Akari Aug-19-2024 (created)
+    tables := construct( MP_Tables );
+    traverse( owners,Elements,owner ){
+      table := select( owner,MP_Table,table,table.Name() = MP_Cell_AnnualPlanReport::GetTableName() );
+      if( isnull( table )){
+        table :=  MP_Cell_AnnualPlanReport::Create( owner );
+      }else{
+        startDate := minselect( table,MP_Column,column,column.CustomDate() ).CustomDate();
+        planStartDate := owner.StartOfPlanning().Date();
+        if( startDate <> planStartDate ){
+          table :=  MP_Cell_AnnualPlanReport::Create( owner );
+        }
+      }
+      tables.Add( table );
+    }
+    return &tables;
+  *]
+}
diff --git a/_Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_ScheduleSummary.qbl b/_Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_ScheduleSummary.qbl
new file mode 100644
index 0000000..d125d15
--- /dev/null
+++ b/_Main/BL/Type_MP_Table/StaticMethod_GetMP_Tables_ScheduleSummary.qbl
@@ -0,0 +1,26 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetMP_Tables_ScheduleSummary (
+  const MacroPlans owners
+) as owning MP_Tables
+{
+  TextBody:
+  [*
+    // Akari Aug-19-2024 (created)
+    tables := construct( MP_Tables );
+    traverse( owners,Elements,owner ){
+      table := select( owner,MP_Table,table,table.Name() = MP_Cell_ScheduleSummary::GetTableName() );
+      if( isnull( table )){
+        table :=  MP_Cell_ScheduleSummary::Create( owner );
+      }else{
+        startDate := minselect( table,MP_Column,column,column.CustomDate() ).CustomDate();
+        planStartDate := owner.StartOfPlanning().Date();
+        if( startDate <> planStartDate ){
+          table :=  MP_Cell_ScheduleSummary::Create( owner );
+        }
+      }
+      tables.Add( table );
+    }
+    return &tables;
+  *]
+}

--
Gitblit v1.9.3