From d8f056609cbecb8851fdaf5b8f74131ee2ebb2c0 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 01 八月 2024 17:31:26 +0800
Subject: [PATCH] 日历不可用事件日期列补充

---
 _Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxMonthDate.qbl   |   13 +++
 _Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinMonthDate.qbl      |    8 ++
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnMonth#1.qbl |   17 ++++
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnWeek.qbl    |   17 ++++
 _Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxWeekDate.qbl    |   13 +++
 _Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinWeekDate.qbl    |   13 +++
 _Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl       |    2 
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnDay.qbl     |   17 ++++
 _Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxDayDate.qbl        |    8 ++
 _Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl     |   13 +++
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl  |    2 
 _Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxWeekDate.qbl       |    8 ++
 _Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinDayDate.qbl        |    8 ++
 _Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinDayDate.qbl     |   13 +++
 _Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinWeekDate.qbl       |    8 ++
 _Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl          |    2 
 _Main/BL/Type_LibCal_Event/StaticMethod_ValidDate.qbl                     |    1 
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl      |   27 +++++-
 _Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinMonthDate.qbl   |   13 +++
 _Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxMonthDate.qbl      |    8 ++
 20 files changed, 201 insertions(+), 10 deletions(-)

diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
index 7a5ef26..e9e00a2 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
@@ -25,7 +25,7 @@
     
     table.GenerateColumn( owner );
     
-    traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
+    traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and not isnull( pisp.StockingPoint_MP() ) and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
       unit := pisp.StockingPoint_MP().UnitID();
       info( unit, pisp.ProductID() );
       ccrow := null( FinancialProductionRow );
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
index 455d0bc..f3c7208 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -27,7 +27,7 @@
     table.GenerateColumn( owner, 'All', startofyear, startofnextyear );
     //info( '-----------------------------------', table.InventorySummaryColumn( relsize ) );
     //搴撳瓨鏁伴噺涓篈ctual inventories閲岄潰鐨勭偣Planned inventories瀛楁搴撳瓨閲忓姞鎬�
-    traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
+    traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() and not isnull( pisp.StockingPoint_MP() ) and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
       unit := pisp.StockingPoint_MP().UnitID();
       product := pisp.Product_MP();
     //  info( '-----------------------------------', unit, product.ID() );
diff --git a/_Main/BL/Type_LibCal_Event/StaticMethod_ValidDate.qbl b/_Main/BL/Type_LibCal_Event/StaticMethod_ValidDate.qbl
index 5b0cd8e..b96238b 100644
--- a/_Main/BL/Type_LibCal_Event/StaticMethod_ValidDate.qbl
+++ b/_Main/BL/Type_LibCal_Event/StaticMethod_ValidDate.qbl
@@ -22,5 +22,6 @@
       feedback_o := Translations::MP_LibCal_Event_ValidDate();
     }
     return feedback_o = '';
+    //return true;
   *]
 }
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxDayDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxDayDate.qbl
new file mode 100644
index 0000000..beb02f5
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxDayDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MaxDayDate
+{
+  #keys: '3[415136.0.960591378][415136.0.960591377][415136.0.960591379]'
+  Description: '鏈�澶ф棩鏈�-澶�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxMonthDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxMonthDate.qbl
new file mode 100644
index 0000000..dd8ffe2
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxMonthDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MaxMonthDate
+{
+  #keys: '3[415136.0.960591412][415136.0.960591411][415136.0.960591413]'
+  Description: '鏈�澶ф棩鏈�-鏈�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxWeekDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxWeekDate.qbl
new file mode 100644
index 0000000..420f1c1
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MaxWeekDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MaxWeekDate
+{
+  #keys: '3[415136.0.960591398][415136.0.960591397][415136.0.960591399]'
+  Description: '鏈�澶ф棩鏈�-鍛�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinDayDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinDayDate.qbl
new file mode 100644
index 0000000..d57dbac
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinDayDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MinDayDate
+{
+  #keys: '3[415136.0.960591388][415136.0.960591387][415136.0.960591389]'
+  Description: '鏈�灏忔棩鏈�-澶�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinMonthDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinMonthDate.qbl
new file mode 100644
index 0000000..aa63d99
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinMonthDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MinMonthDate
+{
+  #keys: '3[415136.0.960591419][415136.0.960591418][415136.0.960591420]'
+  Description: '鏈�灏忔棩鏈�-鏈�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinWeekDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinWeekDate.qbl
new file mode 100644
index 0000000..96a3954
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Attribute_MinWeekDate.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MinWeekDate
+{
+  #keys: '3[415136.0.960591405][415136.0.960591404][415136.0.960591406]'
+  Description: '鏈�灏忔棩鏈�-鍛�'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl
new file mode 100644
index 0000000..03052fe
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMaxDayDate
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    
+    value := maxobject( this,LibCal_SubscriberEventColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day(), column.Period() );
+    
+    this.MaxDayDate( value.Period() );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxMonthDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxMonthDate.qbl
new file mode 100644
index 0000000..ea3887c
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxMonthDate.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMaxMonthDate
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    
+    value := maxobject( this,LibCal_SubscriberEventColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Month(), column.Period() );
+    
+    this.MaxMonthDate( value.Period() );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxWeekDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxWeekDate.qbl
new file mode 100644
index 0000000..ed0f2bd
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxWeekDate.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMaxWeekDate
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    
+    value := maxobject( this,LibCal_SubscriberEventColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Week(), column.Period() );
+    
+    this.MaxWeekDate( value.Period() );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinDayDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinDayDate.qbl
new file mode 100644
index 0000000..6965360
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinDayDate.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMinDayDate
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    
+    value := minobject( this, LibCal_SubscriberEventColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Day(), column.Period() );
+    
+    this.MinDayDate( value.Period() );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinMonthDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinMonthDate.qbl
new file mode 100644
index 0000000..02cc12a
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinMonthDate.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMinMonthDate
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    
+    value := minobject( this, LibCal_SubscriberEventColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Month(), column.Period() );
+    
+    this.MinMonthDate( value.Period() );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinWeekDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinWeekDate.qbl
new file mode 100644
index 0000000..e5564d3
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinWeekDate.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMinWeekDate
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    
+    value := minobject( this, LibCal_SubscriberEventColumn, column, column.TimeUnit() = Translations::MP_GlobalParameters_Week(), column.Period() );
+    
+    this.MinWeekDate( value.Period() );
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl
index 757b1d4..00583cb 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl
@@ -9,7 +9,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jul-26-2024 (created)
-    column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time.Format( 'M/D/Y' ) );
+    column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time.Format( 'M/D/Y' ), column.TimeUnit() = timeunit );
     if( isnull( column ) ){
       column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time, TimeUnit := timeunit );
     }
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
index 1c22d42..1171045 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -33,14 +33,27 @@
     
       }
     }
-    
+    //info( '----------------------1------------------------', this.LibCal_SubscriberEventColumn( relsize ) );
     //traverse( this, LibCal_SubscriberEventColumn, column ){
-    //  traverse( this, LibCal_SubscriberEventRow, row ){
-    //    if( not exists( column, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row ) ) {
-    //      cell := column.LibCal_SubscriberEventCell( relnew, Value := '' );
-    //      row.LibCal_SubscriberEventCell( relinsert, cell );
-    //    }
-    //  }
+    //  info( '------------------------', column.Name(), column.Period(), column.TimeUnit() );
     //}
+            
+    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxDayDate ) );
+    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxWeekDate ) );
+    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MaxMonthDate ) );
+    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinDayDate ) );
+    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinWeekDate ) );
+    Transaction::Transaction().Propagate( attribute( LibCal_SubscriberEventTable, MinMonthDate ) );
+    this.ProcessColumnDay();
+    this.ProcessColumnWeek();
+    this.ProcessColumnMonth();
+    traverse( this, LibCal_SubscriberEventColumn, column ){
+      traverse( this, LibCal_SubscriberEventRow, row ){
+        if( not exists( column, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row ) ) {
+          cell := column.LibCal_SubscriberEventCell( relnew, Value := '' );
+          row.LibCal_SubscriberEventCell( relinsert, cell );
+        }
+      }
+    }
   *]
 }
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnDay.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnDay.qbl
new file mode 100644
index 0000000..c754148
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnDay.qbl
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method ProcessColumnDay
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    day      := ( this.MinDayDate() + Duration::Days( 1 ) ).Date();
+    
+    while( day < this.MaxDayDate() ){
+      if( not exists( this, LibCal_SubscriberEventColumn, column, column.Period() = day and column.TimeUnit() = Translations::MP_GlobalParameters_Day() ) ){
+        this.LibCal_SubscriberEventColumn( relnew, Name := day.Format( 'M/D/Y' ), Period := day, TimeUnit := Translations::MP_GlobalParameters_Day() );
+      }
+      day      := ( day + Duration::Days( 1 ) ).Date();
+    }
+  *]
+}
diff --git "a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnMonth\0431.qbl" "b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnMonth\0431.qbl"
new file mode 100644
index 0000000..c603849
--- /dev/null
+++ "b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnMonth\0431.qbl"
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method ProcessColumnMonth
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    day      := this.MinDayDate().StartOfNextMonth();
+    
+    while( day < this.MaxDayDate() ){
+      if( not exists( this, LibCal_SubscriberEventColumn, column, column.Period() = day and column.TimeUnit() = Translations::MP_GlobalParameters_Day() ) ){
+        this.LibCal_SubscriberEventColumn( relnew, Name := day.Format( 'M/D/Y' ), Period := day, TimeUnit := Translations::MP_GlobalParameters_Month() );
+      }
+      day      := this.MinDayDate().StartOfNextMonth();
+    }
+  *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnWeek.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnWeek.qbl
new file mode 100644
index 0000000..ebd45a9
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_ProcessColumnWeek.qbl
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method ProcessColumnWeek
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Aug-1-2024 (created)
+    day      := this.MinDayDate().StartOfNextWeek();
+    
+    while( day < this.MaxDayDate() ){
+      if( not exists( this, LibCal_SubscriberEventColumn, column, column.Period() = day and column.TimeUnit() = Translations::MP_GlobalParameters_Day() ) ){
+        this.LibCal_SubscriberEventColumn( relnew, Name := day.Format( 'M/D/Y' ), Period := day, TimeUnit := Translations::MP_GlobalParameters_Week() );
+      }
+      day      := day.StartOfNextWeek();
+    }
+  *]
+}

--
Gitblit v1.9.3