From 7a55464720fcef69fc4362dcb570dff763ff026b Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 07 十一月 2024 17:00:05 +0800
Subject: [PATCH] 下线计划不显示bug

---
 _Main/BL/Type_InventoryPlanArchiveVersion/Method_Clear.qbl                                                            |    5 
 _Main/BL/Type_OfflinePlanArchiveVersion/Method_Clear.qbl                                                              |   17 ++
 _Main/BL/InfoMessages.qbl                                                                                             |    4 
 _Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl                                               |    8 
 _Main/BL/Type_InventoryPlanArchiveVersion/Method_GenerateColumn.qbl                                                   |   48 ++++---
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelHeader.def                                |    2 
 _Main/BL/Type_OfflinePlanArchiveVersion/Method_Generate.qbl                                                           |   37 ++++++
 _Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl                                                  |   16 +-
 _Main/BL/Type_OfflinePlanArchiveVersion/Method_GenerateColumn.qbl                                                     |   52 +++++---
 _Main/BL/Type_AssemblyOnlinePlanVersion/Method_Clear.qbl                                                              |    5 
 _Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl                                                      |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelOperation.def                             |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonSearch_OnClick.def          |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_OnCreated.def                                   |   17 ++
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelTable.def                                 |    2 
 _Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_InitiateSearch.qbl                                               |   29 ++++
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonSearch_OnClick.def |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_MatrixEditorTable.def                          |   24 +--
 /dev/null                                                                                                             |    7 -
 _Main/BL/Relations/Relation_OfflinePlanArchiveSearch_InterfaceDataset_InterfaceDataset_OfflineP.qbl                   |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/_ROOT_Component_FormOfflinePlanArchive.def               |   12 +
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick.def        |    4 
 _Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter.qbl                                            |    4 
 _Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl                                                  |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_PanelOperation_ButtonSearch_OnCreated.def       |   18 +++
 25 files changed, 236 insertions(+), 91 deletions(-)

diff --git a/_Main/BL/InfoMessages.qbl b/_Main/BL/InfoMessages.qbl
index e157030..fa4f3d3 100644
--- a/_Main/BL/InfoMessages.qbl
+++ b/_Main/BL/InfoMessages.qbl
@@ -122,6 +122,10 @@
   {
     DefaultText: 'Assembly online plan - PPPS'
   }
+  InfoMessage InterfaceDataset_AssemblyOnlinePlanPPPSPush_URL
+  {
+    DefaultText: '/api/assembly-online-plan/saveList'
+  }
   InfoMessage InterfaceDataset_ContentType
   {
     DefaultText: 'application/json'
diff --git a/_Main/BL/Relations/Relation_OfflinePlanArchiveSearch_InterfaceDataset_InterfaceDataset_OfflineP.qbl b/_Main/BL/Relations/Relation_OfflinePlanArchiveSearch_InterfaceDataset_InterfaceDataset_OfflineP.qbl
index 19d2b7b..452e5b8 100644
--- a/_Main/BL/Relations/Relation_OfflinePlanArchiveSearch_InterfaceDataset_InterfaceDataset_OfflineP.qbl
+++ b/_Main/BL/Relations/Relation_OfflinePlanArchiveSearch_InterfaceDataset_InterfaceDataset_OfflineP.qbl
@@ -16,7 +16,7 @@
   RelationSide.RightSide OfflinePlanArchiveSearch
   {
     #keys: '3[415136.0.1246981143][415136.0.1246981142][415136.0.1246981144]'
-    Cardinality: '1toN'
+    Cardinality: '0to1'
     ObjectDefinition: InterfaceDataset
     OwningSide: 'Owned'
   }
diff --git a/_Main/BL/Type_AssemblyOnlinePlanVersion/Method_Clear.qbl b/_Main/BL/Type_AssemblyOnlinePlanVersion/Method_Clear.qbl
index 31b3c2e..6c71c5f 100644
--- a/_Main/BL/Type_AssemblyOnlinePlanVersion/Method_Clear.qbl
+++ b/_Main/BL/Type_AssemblyOnlinePlanVersion/Method_Clear.qbl
@@ -9,7 +9,8 @@
     // 鐢勫叞楦� Jun-25-2024 (created)
     this.Column( relflush );
     this.Row( relflush );
-    
-    this.GenerateColumn( periods, true );
+    if( periods.Size() > 0 ){
+      this.GenerateColumn( periods, true );
+    }
   *]
 }
diff --git a/_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl b/_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl
index 9d13f21..c4eac3f 100644
--- a/_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl
+++ b/_Main/BL/Type_AssemblyOnlinePlanVersion/StaticMethod_RefreshData.qbl
@@ -21,7 +21,9 @@
       showtable               := interface.AssemblyOnlinePlanVersion( relnew, ID := name, Name := name, IsShow := true );
     }
     aopcolumns             := selectuniquevalues(  macroPlan, NewAssemblyOnlinePlanColumn, aopcolumn, not exists( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = aopcolumn.StartDate() ), aopcolumn.StartDate() );
-    table.GenerateColumn( aopcolumns, false );
+    if( aopcolumns.Size() > 0 ){
+      table.GenerateColumn( aopcolumns, false );
+    }
     traverse( macroPlan, NewAssemblyOnlinePlanRow, aoprow, aoprow.Type() = '1' ){
       row                  := table.GetRow( aoprow );
       traverse( aoprow, NewAssemblyOnlinePlanCell, aopcell ){
diff --git a/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter.qbl b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter.qbl
index 5bd309f..923a893 100644
--- a/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter.qbl
+++ b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForDataCenter.qbl
@@ -18,6 +18,10 @@
     try{
       if( loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){//瀹㈡埛闇�姹�
         httpinterface.URL( Translations::InterfaceDataset_CustomerDemandPPAIDS_URL() );
+      } else if( loginfo.Name() = Translations::InterfaceDataset_AssemblyOnlinePlanPPPSPush_Name() ){//瑁呴厤涓婄嚎璁″垝
+        httpinterface.URL( Translations::InterfaceDataset_AssemblyOnlinePlanPPPSPush_URL() );
+      } else if( loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){//瀹㈡埛闇�姹�
+        httpinterface.URL( Translations::InterfaceDataset_CustomerDemandPPAIDS_URL() );
       } 
       httpinterface.Call( loginfo.RequestBody() );
       result := httpinterface.Result();
diff --git a/_Main/BL/Type_InventoryPlanArchiveVersion/DefaultValue_IsShow.qbl b/_Main/BL/Type_InventoryPlanArchiveVersion/DefaultValue_IsShow.qbl
deleted file mode 100644
index 8bd79cf..0000000
--- a/_Main/BL/Type_InventoryPlanArchiveVersion/DefaultValue_IsShow.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-DefaultValue
-{
-  ISOValue: 'true'
-  TargetAttribute: IsShow
-}
diff --git a/_Main/BL/Type_InventoryPlanArchiveVersion/Method_Clear.qbl b/_Main/BL/Type_InventoryPlanArchiveVersion/Method_Clear.qbl
index 83d7a64..6da9602 100644
--- a/_Main/BL/Type_InventoryPlanArchiveVersion/Method_Clear.qbl
+++ b/_Main/BL/Type_InventoryPlanArchiveVersion/Method_Clear.qbl
@@ -9,7 +9,8 @@
     // 鐢勫叞楦� Jun-25-2024 (created) 
     this.Column( relflush );
     this.Row( relflush );
-    
-    this.GenerateColumn( periods, true );
+    if( periods.Size() > 0 ){
+      this.GenerateColumn( periods, true );
+    }
   *]
 }
diff --git a/_Main/BL/Type_InventoryPlanArchiveVersion/Method_GenerateColumn.qbl b/_Main/BL/Type_InventoryPlanArchiveVersion/Method_GenerateColumn.qbl
index 6647fa0..4153da1 100644
--- a/_Main/BL/Type_InventoryPlanArchiveVersion/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_InventoryPlanArchiveVersion/Method_GenerateColumn.qbl
@@ -8,35 +8,41 @@
   Description: '鐢熸垚鏃ユ湡鍒�'
   TextBody:
   [*
-    // 鐢勫叞楦� Jun-25-2024 (created) 
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    timeunit              := guard( this.InterfaceDataset().AssemblyOnlinePlanVersionSearch().TimeUnit(), Translations::MP_GlobalParameters_Day() ) ;
     weekstart             := periods.Element( 0 );
     
     monthstart            := periods.Element( 0 );
     traverse( periods, Elements, periodtime ){
-      periodname          := periodtime.Format( "M2/D2/Y" );
-      
-      this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
-      
-      weekend             := ( weekstart + Duration::Days( 6 ) ).Date();
-      if( ( weekend.Year() <> periodtime.Year() and weekend.Month() > 1 ) or ( abs( weekstart.Week() - periodtime.Week() ) > 1 and weekend.Year() = periodtime.Year() ) ){
-        weekstart         := periodtime;
-      }
-      if( periodtime = weekstart ){
-        weekperiodname    := weekstart.Format( "M2/D2/Y" );
-        this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart.StartOfNextWeek() - Duration::Days( 1 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
+      if( not isshow or timeunit = Translations::MP_GlobalParameters_Day() ){
+        periodname        := periodtime.Format( "M2/D2/Y" );
         
+        this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
       }
-      if( ( monthstart.Year() <> periodtime.Year() and abs( monthstart.Month() - periodtime.Month() ) <> 11 ) or ( abs( monthstart.Month() - periodtime.Month() ) > 1 and monthstart.Year() = periodtime.Year() ) ){
-        monthstart        := periodtime;
+      if( not isshow or timeunit = Translations::MP_GlobalParameters_Week() ){
+        weekend           := ( weekstart + Duration::Days( 6 ) ).Date();
+        if( ( weekend.Year() <> periodtime.Year() and weekend.Month() > 1 ) or ( abs( weekstart.Week() - periodtime.Week() ) > 1 and weekend.Year() = periodtime.Year() ) ){
+          weekstart       := periodtime;
+        }
+        if( periodtime = weekstart ){
+          weekperiodname  := weekstart.Format( "M2/D2/Y" );
+          this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart.StartOfNextWeek() - Duration::Days( 1 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
+          
+        }
+        weekstart         := periodtime.StartOfNextWeek();
       }
-      if( periodtime = monthstart ){
-        monthperiodname   := monthstart.Format( "M2/D2/Y" );
-        enddate           := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
-        this.Column( relnew, Name := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
-        
+      if( not isshow or timeunit = Translations::MP_GlobalParameters_Month() ){
+        if( ( monthstart.Year() <> periodtime.Year() and abs( monthstart.Month() - periodtime.Month() ) <> 11 ) or ( abs( monthstart.Month() - periodtime.Month() ) > 1 and monthstart.Year() = periodtime.Year() ) ){
+          monthstart      := periodtime;
+        }
+        if( periodtime = monthstart ){
+          monthperiodname := monthstart.Format( "M2/D2/Y" );
+          enddate         := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
+          this.Column( relnew, Name := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
+          
+        }
+        monthstart        := periodtime.StartOfNextMonth();
       }
-      weekstart         := periodtime.StartOfNextWeek();
-      monthstart        := periodtime.StartOfNextMonth();
     }
   *]
 }
diff --git a/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl b/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
index 9909a0e..b664b69 100644
--- a/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
@@ -8,7 +8,7 @@
   Description: '鐢熸垚璁″垝搴撳瓨瀛樻。鏁版嵁'
   TextBody:
   [*
-    interfaceDataset.InventoryPlanArchiveVersion( relflush );
+    //interfaceDataset.InventoryPlanArchiveVersion( relflush );
     info( '-------------------------Start---------------------');
     allunit                := AssemblyOnlinePlanVersion::GetDefaultAllUnit();
     name                   := InventoryPlanArchiveVersion::GetDefaultName();
@@ -18,12 +18,14 @@
       table                := interfaceDataset.InventoryPlanArchiveVersion( relnew, ID := name, Name := name );
     }
     showtable              := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, version.IsShow() );
-    if( isnull( table ) ){ 
+    if( isnull( showtable ) ){ 
       showtable               := interfaceDataset.InventoryPlanArchiveVersion( relnew, ID := name, Name := name, IsShow := true );
     }
     periods                := selectuniquevalues(  macroPlan, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day()
                                                    and not exists( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = period.StartDate() ), period.StartDate() );
-    table.GenerateColumn( periods, false );
+    if( periods.Size() > 0 ){
+      table.GenerateColumn( periods, false );
+    }
     actinventorytree       := NamedValueTree::Create();
     inventoryqrys          := construct( Reals );
     inventoryindex         := 0;
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
index acab2f9..bd2d81c 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -9,6 +9,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-24-2024 (created)
+    //娣诲姞杩愯緭閫斾腑瀛楁锛屽彇leadingtime銆�1鐨勶紝浠ラ�斾腑鏃ユ湡涓哄噯锛屾瘮濡�1.8鍑哄彂1.10鍒拌揪锛屽垯鏃ユ湡涓�1.9锛屽伐鍘傛寜鍒濆鍦拌绠�
     owner.InventorySummarySource( relflush );
     productids                := construct( Strings );
     allunit                   := InventorySummaryReport::GetDefaultAllUnit();
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/Method_Clear.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_Clear.qbl
new file mode 100644
index 0000000..de0d97e
--- /dev/null
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_Clear.qbl
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method Clear (
+  Dates periods
+)
+{
+  Description: '娓呴櫎涔嬪墠鐨勬樉绀烘暟鎹�'
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)  
+    this.Column( relflush );
+    this.Row( relflush );
+    if( periods.Size() > 0 ){
+      this.GenerateColumn( periods, true );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/Method_Generate.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_Generate.qbl
new file mode 100644
index 0000000..be82731
--- /dev/null
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_Generate.qbl
@@ -0,0 +1,37 @@
+Quintiq file version 2.0
+#parent: #root
+Method Generate (
+  OfflinePlanArchiveSearch search
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    info( '-----------Search start-------' );
+    table                   := selectobject( this,InterfaceDataset.OfflinePlanArchiveVersion, report, not report.IsShow() );
+    //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
+    aopcolumns              := selectuniquevalues(  table, Column, aopcolumn, aopcolumn.TimeUnit() = search.TimeUnit() and aopcolumn.StartDate() >= search.StartDate() and aopcolumn.StartDate() <= search.EndDate(), aopcolumn.StartDate() );
+    this.Clear( aopcolumns );
+    traverse( table, Row, row, ( search.Unit() = FinancialProductionReport::GetDefaultAllUnit() or row.Unit() = search.Unit() ) 
+              and ( search.Product() = FinancialProductionReport::GetDefaultAllUnit() or search.Product() = row.Name() )){
+      
+      showrow               := selectobject( this, Row, showrow, showrow.Name() = row.Name() and showrow.Unit() = search.Unit() );
+      if( isnull( showrow ) ){
+        showrow             := this.Row( relnew, Name := row.Name(), ProductID := row.ProductID(), Unit := search.Unit() );
+      }
+      traverse( row, Cell, cell, cell.Column().TimeUnit() = search.TimeUnit() ){
+        column              := selectobject( this, Column, column, column.ColumnName() = cell.Column().ColumnName() );
+        if( not isnull( column ) ){
+          showcell          := selectobject( showrow, Cell, showcell, showcell.Column() = column );
+          if( isnull( showcell ) ){
+            showcell        := showrow.Cell( relnew, Quantity := 0, ActualProductionQty := 0 );
+            column.Cell( relinsert, showcell );
+          }
+          showcell.Quantity( cell.Quantity() + showcell.Quantity() );
+          showcell.ActualProductionQty( cell.ActualProductionQty() + showcell.ActualProductionQty() );
+        }
+      }
+    }
+    info( '-----------Search end-------' );
+  *]
+}
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GenerateColumn.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GenerateColumn.qbl
index 5e80a3f..2a3b3f3 100644
--- a/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/Method_GenerateColumn.qbl
@@ -1,40 +1,48 @@
 Quintiq file version 2.0
 #parent: #root
 Method GenerateColumn (
-  Dates periods
+  Dates periods,
+  Boolean isshow
 )
 {
+  Description: '鐢熸垚鏃ユ湡鍒�'
   TextBody:
   [*
-    // 鐢勫叞楦� Jun-25-2024 (created) 
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    timeunit              := guard( this.InterfaceDataset().AssemblyOnlinePlanVersionSearch().TimeUnit(), Translations::MP_GlobalParameters_Day() ) ;
     weekstart             := periods.Element( 0 );
     
     monthstart            := periods.Element( 0 );
     traverse( periods, Elements, periodtime ){
-      periodname          := periodtime.Format( "M2/D2/Y" );
-      
-      this.Column( relnew, ColumnName := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
-      
-      weekend             := ( weekstart + Duration::Days( 6 ) ).Date();
-      if( ( weekend.Year() <> periodtime.Year() and weekend.Month() > 1 ) or ( abs( weekstart.Week() - periodtime.Week() ) > 1 and weekend.Year() = periodtime.Year() ) ){
-        weekstart         := periodtime;
-      }
-      if( periodtime = weekstart ){
-        weekperiodname    := weekstart.Format( "M2/D2/Y" );
-        this.Column( relnew, ColumnName := weekperiodname, StartDate := weekstart, EndDate := ( weekstart.StartOfNextWeek() - Duration::Days( 1 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
+      if( not isshow or timeunit = Translations::MP_GlobalParameters_Day() ){
+        periodname        := periodtime.Format( "M2/D2/Y" );
         
+        this.Column( relnew, ColumnName := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
       }
-      if( ( monthstart.Year() <> periodtime.Year() and abs( monthstart.Month() - periodtime.Month() ) <> 11 ) or ( abs( monthstart.Month() - periodtime.Month() ) > 1 and monthstart.Year() = periodtime.Year() ) ){
-        monthstart        := periodtime;
+      if( not isshow or timeunit = Translations::MP_GlobalParameters_Week() ){
+        weekend           := ( weekstart + Duration::Days( 6 ) ).Date();
+        if( ( weekend.Year() <> periodtime.Year() and weekend.Month() > 1 ) or ( abs( weekstart.Week() - periodtime.Week() ) > 1 and weekend.Year() = periodtime.Year() ) ){
+          weekstart       := periodtime;
+        }
+        if( periodtime = weekstart ){
+          weekperiodname  := weekstart.Format( "M2/D2/Y" );
+          this.Column( relnew, ColumnName := weekperiodname, StartDate := weekstart, EndDate := ( weekstart.StartOfNextWeek() - Duration::Days( 1 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
+          
+        }
+        weekstart         := periodtime.StartOfNextWeek();
       }
-      if( periodtime = monthstart ){
-        monthperiodname   := monthstart.Format( "M2/D2/Y" );
-        enddate           := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
-        this.Column( relnew, ColumnName := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
-        
+      if( not isshow or timeunit = Translations::MP_GlobalParameters_Month() ){
+        if( ( monthstart.Year() <> periodtime.Year() and abs( monthstart.Month() - periodtime.Month() ) <> 11 ) or ( abs( monthstart.Month() - periodtime.Month() ) > 1 and monthstart.Year() = periodtime.Year() ) ){
+          monthstart      := periodtime;
+        }
+        if( periodtime = monthstart ){
+          monthperiodname := monthstart.Format( "M2/D2/Y" );
+          enddate         := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
+          this.Column( relnew, ColumnName := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
+          
+        }
+        monthstart        := periodtime.StartOfNextMonth();
       }
-      weekstart         := periodtime.StartOfNextWeek();
-      monthstart        := periodtime.StartOfNextMonth();
     }
   *]
 }
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_InitiateSearch.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_InitiateSearch.qbl
new file mode 100644
index 0000000..18ac911
--- /dev/null
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_InitiateSearch.qbl
@@ -0,0 +1,29 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod InitiateSearch (
+  InterfaceDataset owner
+) as OfflinePlanArchiveVersion
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Sep-29-2024 (created)
+    allunit                   := FinancialProductionReport::GetDefaultAllUnit();
+    search                    := owner.OfflinePlanArchiveSearch();
+    if( isnull( owner.OfflinePlanArchiveSearch() ) ){
+      search                  := owner.OfflinePlanArchiveSearch( relnew, Product := allunit, ProductionLine := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
+    }else{
+      search                  := owner.OfflinePlanArchiveSearch();
+      search.Product( allunit );
+      search.ProductionLine( allunit );
+      search.TimeUnit(  Translations::MP_GlobalParameters_Day() );
+      search.Unit( allunit );
+      search.StartDate( Date::MinDate() );
+      search.EndDate( Date::MaxDate() );
+    }
+    table                     := selectobject( owner, OfflinePlanArchiveVersion, table, table.IsShow() );
+    if( not isnull( table ) ){
+      table.Generate( search);
+    }
+    return table;
+  *]
+}
diff --git a/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl b/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl
index 6fc7c82..ee7c9fd 100644
--- a/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl
+++ b/_Main/BL/Type_OfflinePlanArchiveVersion/StaticMethod_RefreshData.qbl
@@ -11,17 +11,19 @@
     //鏍规嵁褰撳墠鐗堟湰鐨勪笅绾胯鍒�
     allunit                := OfflinePlanArchiveVersion::GetDefaultAllUnit();
     name                   := OfflinePlanArchiveVersion::GetDefaultName();
-    interface.OfflinePlanArchiveSearch( relnew, Product := allunit, ProductionLine := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
+    search                 := interface.OfflinePlanArchiveSearch( relnew, Product := allunit, ProductionLine := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
     table                  := selectobject( interface, OfflinePlanArchiveVersion, version, not version.IsShow() );
     if( isnull( table ) ){
       table                := interface.OfflinePlanArchiveVersion( relnew, ID := name, Name := name );
     }
-    //showtable              := selectobject( interface, OfflinePlanArchiveVersion, version, version.IsShow() );
-    //if( isnull( table ) ){
-    //  showtable               := interface.OfflinePlanArchiveVersion( relnew, ID := name, Name := name, IsShow := true );
-    //}
+    showtable              := selectobject( interface, OfflinePlanArchiveVersion, version, version.IsShow() );
+    if( isnull( showtable ) ){
+      showtable               := interface.OfflinePlanArchiveVersion( relnew, ID := name, Name := name, IsShow := true );
+    }
     nopcolumns             := selectuniquevalues(  macroPlan, NewOfflinePlanTable.NewOfflinePlanColumn, nopcolumn, not exists( table, Column, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day() and column.StartDate() = nopcolumn.StartDate() ), nopcolumn.StartDate() );
-    table.GenerateColumn( nopcolumns );
+    if( nopcolumns.Size() > 0 ){
+      table.GenerateColumn( nopcolumns, false );
+    }
     noptable               := maxobject( macroPlan, NewOfflinePlanTable, noptable, noptable.SaveDateTime() );
     actproductiondatas     := selectset( archive,ActualDailyProductionData,data,true );
     actproductiontree      := NamedValueTree::Create();
@@ -53,6 +55,6 @@
     //      cell.Value( nopcell.Value() );
       }
     }
-    //showtable.Generate( search, products );
+    showtable.Generate( search );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonSearch_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonSearch_OnClick.def
index c947d88..2fddff8 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonSearch_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_369_ButtonSearch_OnClick.def
@@ -11,8 +11,8 @@
     [*
       if( not isnull( DataHolderTable.Data() ) ){
         productids              := selectuniquevalues( DataHolderProduct.Data(), Elements, product, ( dhGenerations.Data().Size() = 0 or exists( dhGenerations.Data(), Elements, e, e.Generation() = product.Generation() ) )
-                                                       and ( dhGenerations.Data().Size() = 0 or exists( dhMQBMLBs.Data(), Elements, e, e.MLBMQB() = product.MQBMLB() ) )
-                                                       and ( dhGenerations.Data().Size() = 0 or exists( dhPowers.Data(), Elements, e, e.Power() = product.Power() ) ), product.ID() );
+                                                       and ( dhMQBMLBs.Data().Size() = 0 or exists( dhMQBMLBs.Data(), Elements, e, e.MLBMQB() = product.MQBMLB() ) )
+                                                       and ( dhPowers.Data().Size() = 0 or exists( dhPowers.Data(), Elements, e, e.Power() = product.Power() ) ), product.ID() );
         DataHolderTable.Data().Generate( dhSearch.Data(), dhFactorys.Data(), productids );
       }
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonSearch_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonSearch_OnClick.def
index 2523688..43c2742 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonSearch_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelExport_ButtonSearch_OnClick.def
@@ -11,8 +11,8 @@
     [*
       if( not isnull( DataHolderTable.Data() ) ){
         productids              := selectuniquevalues( DataHolderProduct.Data(), Elements, product, ( dhGenerations.Data().Size() = 0 or exists( dhGenerations.Data(), Elements, e, e.Generation() = product.Generation() ) )
-                                                       and ( dhGenerations.Data().Size() = 0 or exists( dhMQBMLBs.Data(), Elements, e, e.MLBMQB() = product.MQBMLB() ) )
-                                                       and ( dhGenerations.Data().Size() = 0 or exists( dhPowers.Data(), Elements, e, e.Power() = product.Power() ) ), product.ID() );
+                                                       and ( dhMQBMLBs.Data().Size() = 0 or exists( dhMQBMLBs.Data(), Elements, e, e.MLBMQB() = product.MQBMLB() ) )
+                                                       and ( dhPowers.Data().Size() = 0 or exists( dhPowers.Data(), Elements, e, e.Power() = product.Power() ) ), product.ID() );
         DataHolderTable.Data().Generate( dhSearch.Data(), dhFactorys.Data(), productids );
       }
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick.def
index 221196c..cb8c985 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelExport_ButtonSearch_OnClick.def
@@ -11,8 +11,8 @@
     [*
       if( not isnull( DataHolderTable.Data() ) ){
         productids              := selectuniquevalues( DataHolderProduct.Data(), Elements, product, ( dhGenerations.Data().Size() = 0 or exists( dhGenerations.Data(), Elements, e, e.Generation() = product.Generation() ) )
-                                                       and ( dhGenerations.Data().Size() = 0 or exists( dhMQBMLBs.Data(), Elements, e, e.MLBMQB() = product.MQBMLB() ) )
-                                                       and ( dhGenerations.Data().Size() = 0 or exists( dhPowers.Data(), Elements, e, e.Power() = product.Power() ) ), product.ID() );
+                                                       and ( dhMQBMLBs.Data().Size() = 0 or exists( dhMQBMLBs.Data(), Elements, e, e.MLBMQB() = product.MQBMLB() ) )
+                                                       and ( dhPowers.Data().Size() = 0 or exists( dhPowers.Data(), Elements, e, e.Power() = product.Power() ) ), product.ID() );
         DataHolderTable.Data().Generate( dhSearch.Data(), dhFactorys.Data(), productids );
       }
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_MatrixEditorTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_MatrixEditorTable.def
index ef8ec56..8514752 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_MatrixEditorTable.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_MatrixEditorTable.def
@@ -17,12 +17,10 @@
           BaseType: 'WebDataExtractor'
           Properties:
           [
-            DataType: 'InterfaceDataset'
-            FilterArguments: 'search:QMacroPlanner::FormAssemblyOnlinePlanVersion.dhSearch'
-            FixedFilter: 'object.Column().TimeUnit() = search.TimeUnit() and object.Column().StartDate() >= search.StartDate() and object.Column().StartDate() <= search.EndDate()'
-            Source: 'InterfaceDataset'
+            DataType: 'OfflinePlanArchiveVersion'
+            Source: 'DataHolderTable'
             Taborder: 0
-            Transformation: 'OfflinePlanArchiveVersion.Row.Cell'
+            Transformation: 'Row.Cell'
           ]
         }
       ]
@@ -46,13 +44,11 @@
           BaseType: 'WebDataExtractor'
           Properties:
           [
-            DataType: 'InterfaceDataset'
+            DataType: 'OfflinePlanArchiveVersion'
             Description: "( search.Generation() = '<All>' or object.Product_MP().Generation() = search.Generation() ) and ( search.MqbMlb() = '<All>' or object.Product_MP().MQBMLB() = search.MqbMlb() ) and ( search.Power() = '<All>' or object.Product_MP().Power() = search.Power() )"
-            FilterArguments: 'search:QMacroPlanner::FormAssemblyOnlinePlanVersion.dhSearch'
-            FixedFilter: "( search.Product() = '<All>' or object.ProductID() = search.Product() ) and ( search.ProductionLine() = '<All>' or object.ProductionLine() = search.ProductionLine() ) and ( search.Unit() = '<All>' or object.Unit() = search.Unit() )"
-            Source: 'InterfaceDataset'
+            Source: 'DataHolderTable'
             Taborder: 0
-            Transformation: 'OfflinePlanArchiveVersion.Row'
+            Transformation: 'Row'
           ]
         }
       ]
@@ -75,12 +71,10 @@
           BaseType: 'WebDataExtractor'
           Properties:
           [
-            DataType: 'InterfaceDataset'
-            FilterArguments: 'search:QMacroPlanner::FormAssemblyOnlinePlanVersion.dhSearch'
-            FixedFilter: 'object.TimeUnit() = search.TimeUnit() and  ( search.StartDate().IsMinInfinity() or object.StartDate() >= search.StartDate() )  and ( search.EndDate().IsMaxInfinity() or object.StartDate() <= search.EndDate() )'
-            Source: 'InterfaceDataset'
+            DataType: 'OfflinePlanArchiveVersion'
+            Source: 'DataHolderTable'
             Taborder: 0
-            Transformation: 'OfflinePlanArchiveVersion.Column'
+            Transformation: 'Column'
           ]
         }
       ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelHeader.def
index 9799f95..d89266b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelHeader.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelHeader.def
@@ -16,6 +16,6 @@
   [
     FixedSize: true
     Orientation: 'horizontal'
-    Taborder: 1
+    Taborder: 2
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelOperation.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelOperation.def
index e4f2a8d..b681559 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelOperation.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelOperation.def
@@ -19,6 +19,5 @@
   Properties:
   [
     Taborder: 5
-    Visible: false
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelTable.def
index 4c488b9..2a2b19f 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelTable.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Component_PanelTable.def
@@ -9,6 +9,6 @@
   ]
   Properties:
   [
-    Taborder: 2
+    Taborder: 3
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_OnCreated.def
new file mode 100644
index 0000000..6c0f728
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_OnCreated.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Response OnCreated () id:Response_FormOfflinePlanArchive_OnCreated
+{
+  #keys: '[415136.0.1286390827]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      table := OfflinePlanArchiveVersion::InitiateSearch( InterfaceDataset ); 
+      DataHolderTable.Data( table );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_PanelOperation_ButtonSearch_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_PanelOperation_ButtonSearch_OnCreated.def
new file mode 100644
index 0000000..455fd37
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/Response_PanelOperation_ButtonSearch_OnCreated.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: PanelOperation/ButtonSearch
+Response OnCreated () id:Response_PanelOperation_ButtonSearch_OnCreated
+{
+  #keys: '[415136.0.1286390995]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      if( not isnull( DataHolderTable.Data() ) ){ 
+        DataHolderTable.Data().Generate( dhSearch.Data() );
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/_ROOT_Component_FormOfflinePlanArchive.def b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/_ROOT_Component_FormOfflinePlanArchive.def
index 49b088f..883de0c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/_ROOT_Component_FormOfflinePlanArchive.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormOfflinePlanArchive/_ROOT_Component_FormOfflinePlanArchive.def
@@ -29,11 +29,21 @@
       ]
       Properties:
       [
-        Taborder: 0
+        Taborder: 1
       ]
     }
     #child: PanelHeader
     #child: PanelTable
+    Component DataHolderTable id:DataHolderTable_265
+    {
+      #keys: '[415136.0.1286390735]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'OfflinePlanArchiveVersion'
+      Properties:
+      [
+        Taborder: 0
+      ]
+    }
   ]
   Properties:
   [

--
Gitblit v1.9.3