From 2216fba3cc0585064f370ae8348bf6b90ef99e5a Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期二, 03 九月 2024 18:03:34 +0800
Subject: [PATCH] 修复一些bug

---
 _Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl                                                       |   40 ++++++++++--
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionBudget_dhBaseVersionBudget_OnDataChanged.def     |   20 ++++++
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionIDS.def                                         |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPPA.def                                         |    2 
 _Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_ImportOutput.qbl                                                          |    3 +
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPR.def                                          |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionCurve.def                                       |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionPP_dhBaseVersionPP_OnDataChanged.def             |   20 ++++++
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupDebug_ButtonTest_OnClick.def |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPP.def                                          |    6 +
 _Main/BL/Type_Test/StaticMethod_Test.qbl                                                                                       |   20 +++++-
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionBudget.def                                      |    6 +
 _Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_PanelSelection.def                                        |   10 +++
 _Main/BL/Type_LocalCell_DemandComparison/StaticMethod_FillRows.qbl                                                             |   10 +++
 _Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl                                                             |    6 +
 15 files changed, 130 insertions(+), 21 deletions(-)

diff --git a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
index d9f9b75..6d6bf49 100644
--- a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
+++ b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_Compared.qbl
@@ -32,12 +32,14 @@
         
         //鐢熸垚琛屾暟鎹�
         rowKeys := construct( Strings );
+        rowKeyIndexTree := NamedValueTree::Create();
+        
         baseVersionRowTree := NamedValueTree::Create();
         baseVersionRows := construct( GeneralExcelImportAndExportDataRows ,constcontent);
         compareVersionRowTree := NamedValueTree::Create();
         compareVersionRows := construct( GeneralExcelImportAndExportDataRows ,constcontent);
-        LocalCell_DemandComparison::FillRows( baseVersionTable,rowKeys,baseVersionRowTree,baseVersionRows );
-        LocalCell_DemandComparison::FillRows( compareVersionTable,rowKeys,compareVersionRowTree,compareVersionRows );
+        LocalCell_DemandComparison::FillRows( baseVersionTable,rowKeys,rowKeyIndexTree,baseVersionRowTree,baseVersionRows );
+        LocalCell_DemandComparison::FillRows( compareVersionTable,rowKeys,rowKeyIndexTree,compareVersionRowTree,compareVersionRows );
         
         // 鐢熸垚鍒楁暟鎹�
         columnTree := NamedValueTree::Create();
diff --git a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_FillRows.qbl b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_FillRows.qbl
index 391100a..f056d05 100644
--- a/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_FillRows.qbl
+++ b/_Main/BL/Type_LocalCell_DemandComparison/StaticMethod_FillRows.qbl
@@ -3,6 +3,7 @@
 StaticMethod FillRows (
   const GeneralExcelImportAndExportDataTable general,
   Strings rowKeys,
+  NamedValueTree rowKeyIndexTree,
   NamedValueTree rowTree,
   constcontent GeneralExcelImportAndExportDataRows rows
 )
@@ -30,7 +31,14 @@
       tempHandle := rowTree.GetHandle( rowKey );
       rowTree.Root().AddChild( tempHandle ,i);
       rows.Add( tempRowKeyCell1.GeneralExcelImportAndExportDataRow());
-      rowKeys.Add( rowKey );
+      
+      rowKeyHanlde := rowKeyIndexTree.GetHandle( rowKey );
+      rowKeyIndex := guard( rowKeyIndexTree.Root().Child( rowKeyHanlde ),null( NamedValue ));
+      if( isnull( rowKeyIndex )){
+        rowKeys.Add( rowKey );
+        rowKeyIndexTree.Root().AddChild( rowKeyHanlde,rowKeys.Size() - 1 );
+      }
+      
     }
   *]
 }
diff --git a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
index 7da96f0..8c27522 100644
--- a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_CreateFullTable.qbl
@@ -42,6 +42,15 @@
     localCells := construct( LocalCell_ScheduleSummarys );
     localCellIndexTree := NamedValueTree::Create();
     
+    units := selectset( owner,Unit,unit,unit.HasCapacityTypeTime() and not unit.HasChild());
+    unitIndexTree := NamedValueTree::Create();
+    for( i := 0 ; i< units.Size() ; i++ ){
+      unit := units.Element( i );
+      unitHandle := unitIndexTree.GetHandle( unit.ID() );
+      unitIndexTree.Root().AddChild( unitHandle,i );
+    }
+    
+    
     //shiftPatternCount := NamedValueTree::Create();
     traverse( tables,Elements.MP_Row,row ){
        rowMacroPlan := row.MP_Table().MacroPlan();
@@ -63,14 +72,27 @@
                               cell.MP_Column().CustomDate() >= localColumn.CustomDate() and 
                               cell.MP_Column().CustomDate() < localColumn.CustomDate().StartOfNextMonth() );
           
-          output := 0.0;
+          isFuture := owner.StartOfPlanning().Date() >= localColumn.CustomDate();
           
-          scheduleSummaryOutputDataKey := row.Name() + localColumn.CustomDate().AsQUILL();
-          scheduleSummaryOutputDataHandle := scheduleSummaryOutputDataIndexTree.GetHandle( scheduleSummaryOutputDataKey );
-          scheduleSummaryOutputDataIndex := guard( scheduleSummaryOutputDataIndexTree.Root().Child( scheduleSummaryOutputDataHandle ),null( NamedValue ));
-          if( not isnull( scheduleSummaryOutputDataIndex )){
-            scheduleSummaryOutputData := scheduleSummaryOutputDatas.Element( scheduleSummaryOutputDataIndex.GetValueAsNumber() );
-            output := scheduleSummaryOutputData.Output();
+          output := 0.0;
+          if( isFuture ){
+            unitHandle := unitIndexTree.GetHandle( row.Name() );
+            unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue ));
+            if( not isnull( unitIndex )){
+              unit := units.Element( unitIndex.GetValueAsNumber() );
+              output := sum( unit,UnitPeriod.PeriodTask_MP.NewSupply,np,
+                             np.PeriodTask_MP().UnitPeriod().StartDate() >= localColumn.CustomDate() and 
+                             np.PeriodTask_MP().UnitPeriod().StartDate() < localColumn.CustomDate(),
+                             np.Quantity() );
+            }
+          }else{
+            scheduleSummaryOutputDataKey := row.Name() + localColumn.CustomDate().AsQUILL();
+            scheduleSummaryOutputDataHandle := scheduleSummaryOutputDataIndexTree.GetHandle( scheduleSummaryOutputDataKey );
+            scheduleSummaryOutputDataIndex := guard( scheduleSummaryOutputDataIndexTree.Root().Child( scheduleSummaryOutputDataHandle ),null( NamedValue ));
+            if( not isnull( scheduleSummaryOutputDataIndex )){
+              scheduleSummaryOutputData := scheduleSummaryOutputDatas.Element( scheduleSummaryOutputDataIndex.GetValueAsNumber() );
+              output := scheduleSummaryOutputData.Output();
+            }
           }
           
           maxShiftPattern := "";
@@ -115,7 +137,9 @@
             }
           }
           
-          localCell.ShiftPattern( maxShiftPattern );
+          if( not maxShiftPattern = "" ){
+            localCell.ShiftPattern( maxShiftPattern );
+          }
           localCell.WorkingDay( localCell.WorkingDay() + workingDay );
           localCell.Capacity( localCell.Capacity() + capacity );
           localCell.Output( localCell.Output() + output );
diff --git a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_ImportOutput.qbl b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_ImportOutput.qbl
index d07e7cf..fb50032 100644
--- a/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_ImportOutput.qbl
+++ b/_Main/BL/Type_LocalCell_ScheduleSummary/StaticMethod_ImportOutput.qbl
@@ -13,6 +13,9 @@
     if( isnull( outputTable )){
       error( "瀵煎叆鐨勬枃浠朵笉姝g‘" ); 
     }
+    
+    archive.ScheduleSummaryOutputLine( relflush );
+    
     lines := construct( ScheduleSummaryOutputLines );
     lineIndexTree := NamedValueTree::Create();
     
diff --git a/_Main/BL/Type_Test/StaticMethod_Test.qbl b/_Main/BL/Type_Test/StaticMethod_Test.qbl
index 721ec63..3b45a67 100644
--- a/_Main/BL/Type_Test/StaticMethod_Test.qbl
+++ b/_Main/BL/Type_Test/StaticMethod_Test.qbl
@@ -4,7 +4,8 @@
   ScenarioManager scenarioManager,
   MacroPlan macroPlan,
   Archive archive,
-  RecycleBin recycleBin
+  RecycleBin recycleBin,
+  ArchiveExecutionStatus archiveExecutionStatus
 )
 {
   TextBody:
@@ -20,9 +21,18 @@
     //  } 
     //}
     
-    table := select( macroPlan,MP_Table,table,table.Name() = MP_Cell_ScheduleSummary::GetTableName() );
-    if( not isnull( table )){
-      table.Delete(); 
-    }
+    //table := select( macroPlan,MP_Table,table,table.Name() = MP_Cell_ScheduleSummary::GetTableName() );
+    //if( not isnull( table )){
+    //  table.Delete(); 
+    //}
+    
+    
+    
+    archiveExecutionStatus.RequirementImportExecutionStatus( relnew, 
+                                                             ExecutionCode        := 500,
+                                                             ExecutionIsSuccess   := false,
+                                                             ExecutionRespMessage := "11111",
+                                                             ExecutionStatus      := "Complete",
+                                                             ExecutionUserName    := "vwedadmin" );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupDebug_ButtonTest_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupDebug_ButtonTest_OnClick.def
index ea79d88..73ce7f1 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupDebug_ButtonTest_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupDebug_ButtonTest_OnClick.def
@@ -9,7 +9,7 @@
   {
     Body:
     [*
-      Test::Test( ScenarioManager,MacroPlan,Archive,RecycleBin );
+      Test::Test( ScenarioManager,MacroPlan,Archive,RecycleBin,ArchiveExecutionStatus );
       
       WebMessageBox::Success( "Success");
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_PanelSelection.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_PanelSelection.def
index 51b4cfe..6e39dc5 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_PanelSelection.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_PanelSelection.def
@@ -12,6 +12,16 @@
     #child: pSelectionCurve
     #child: pSelectionPP
     #child: PanelSelectionChecks
+    Component dhDateUnit
+    {
+      #keys: '[414996.1.58048570]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'String*'
+      Properties:
+      [
+        Taborder: 7
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionBudget.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionBudget.def
index a1b3224..0c2a781 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionBudget.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionBudget.def
@@ -29,6 +29,7 @@
       [
         DisplayField: 'Name'
         Label: '鍩哄噯闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 0
       ]
     }
@@ -56,8 +57,8 @@
           Properties:
           [
             DataType: 'Archive'
-            FilterArguments: 'baseSelection:QMacroPlanner::FormDemandComparison.dhBaseVersionBudget'
-            FixedFilter: 'object <> baseSelection'
+            FilterArguments: 'baseSelection:QMacroPlanner::FormDemandComparison.dhBaseVersionBudget;dateUnit:QMacroPlanner::FormDemandComparison.dhDateUnit'
+            FixedFilter: 'object <> baseSelection and object.Name().LikeUserLocale( dateUnit )'
             Source: 'Archive'
             Taborder: 0
             Transformation: 'ArchiveBudget'
@@ -68,6 +69,7 @@
       [
         DisplayField: 'Name'
         Label: '瀵规瘮闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionCurve.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionCurve.def
index 38f1b91..ecc0d24 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionCurve.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionCurve.def
@@ -29,6 +29,7 @@
       [
         DisplayField: 'Name'
         Label: '鍩哄噯闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 0
       ]
     }
@@ -68,6 +69,7 @@
       [
         DisplayField: 'Name'
         Label: '瀵规瘮闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionIDS.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionIDS.def
index 3288024..ebaefd0 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionIDS.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionIDS.def
@@ -29,6 +29,7 @@
       [
         DisplayField: 'Name'
         Label: '鍩哄噯闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 0
       ]
     }
@@ -68,6 +69,7 @@
       [
         DisplayField: 'Name'
         Label: '瀵规瘮闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPP.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPP.def
index 6e60227..e2a2f25 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPP.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPP.def
@@ -29,6 +29,7 @@
       [
         DisplayField: 'Name'
         Label: '鍩哄噯闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 0
       ]
     }
@@ -56,8 +57,8 @@
           Properties:
           [
             DataType: 'Archive'
-            FilterArguments: 'baseSelection:QMacroPlanner::FormDemandComparison.dhBaseVersionPP'
-            FixedFilter: 'object <> baseSelection'
+            FilterArguments: 'baseSelection:QMacroPlanner::FormDemandComparison.dhBaseVersionPP;dateUnit:QMacroPlanner::FormDemandComparison.dhDateUnit'
+            FixedFilter: 'object <> baseSelection and object.Name().LikeUserLocale( dateUnit )'
             Source: 'Archive'
             Taborder: 0
             Transformation: 'ArchivePP'
@@ -68,6 +69,7 @@
       [
         DisplayField: 'Name'
         Label: '瀵规瘮闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPPA.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPPA.def
index 2993ca2..5438664 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPPA.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPPA.def
@@ -29,6 +29,7 @@
       [
         DisplayField: 'Name'
         Label: '鍩哄噯闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 0
       ]
     }
@@ -68,6 +69,7 @@
       [
         DisplayField: 'Name'
         Label: '瀵规瘮闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPR.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPR.def
index 6ea8065..84251b8 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPR.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Component_pSelectionPR.def
@@ -29,6 +29,7 @@
       [
         DisplayField: 'Name'
         Label: '鍩哄噯闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 0
       ]
     }
@@ -68,6 +69,7 @@
       [
         DisplayField: 'Name'
         Label: '瀵规瘮闇�姹傜増鏈細'
+        NumberOfColumns: 50
         Taborder: 2
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionBudget_dhBaseVersionBudget_OnDataChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionBudget_dhBaseVersionBudget_OnDataChanged.def
new file mode 100644
index 0000000..7efaf4f
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionBudget_dhBaseVersionBudget_OnDataChanged.def
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: pSelectionBudget/dhBaseVersionBudget
+Response OnDataChanged () id:Response_pSelectionBudget_dhBaseVersionBudget_OnDataChanged
+{
+  #keys: '[414996.1.58018748]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnDataChanged'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      if( this.Name().LikeUserLocale( "M" )){
+        dhDateUnit.Data( "M" );
+      }else{
+        dhDateUnit.Data( "W" );
+      }
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionPP_dhBaseVersionPP_OnDataChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionPP_dhBaseVersionPP_OnDataChanged.def
new file mode 100644
index 0000000..6033e79
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDemandComparison/Response_pSelectionPP_dhBaseVersionPP_OnDataChanged.def
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: pSelectionPP/dhBaseVersionPP
+Response OnDataChanged () id:Response_pSelectionPP_dhBaseVersionPP_OnDataChanged
+{
+  #keys: '[414996.1.55350834]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnDataChanged'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      if( this.Name().LikeUserLocale( "M" )){
+        dhDateUnit.Data( "M" );
+      }else{
+        dhDateUnit.Data( "W" );
+      }
+    *]
+  }
+}

--
Gitblit v1.9.3