From de982da373b3a8df0f1d6f28263fa591403e39d0 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 12 六月 2024 14:41:07 +0800
Subject: [PATCH] 日历不可用时间表修改

---
 _Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_Start.qbl                                   |    6 +
 _Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_Start.qbl                                      |    7 +
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl                                  |    6 -
 _Main/BL/Relations/Relation_LibCal_SubscriberEventPeriod_Cell_LibCal_SubscriberEventCell_Period.qbl |   23 +++++
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl                                 |   30 ++++---
 _Main/BL/Type_LibCal_SubscriberEventCell/Method_GetMatrixTooltip.qbl                                |    6 +
 _Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_End.qbl                                     |    6 +
 /dev/null                                                                                           |    7 -
 _Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_End.qbl                                        |    7 +
 _Main/UI/MacroPlannerWebApp/Views/Calendar_unavailable_event_view.vw                                |   29 +++++++
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl                                |   29 ++++---
 _Main/BL/Type_LibCal_SubscriberEventPeriod/_ROOT_Type_LibCal_SubscriberEventPeriod.qbl              |   10 ++
 _Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl                                |   46 ++++++-----
 13 files changed, 153 insertions(+), 59 deletions(-)

diff --git a/_Main/BL/Relations/Relation_LibCal_SubscriberEventPeriod_Cell_LibCal_SubscriberEventCell_Period.qbl b/_Main/BL/Relations/Relation_LibCal_SubscriberEventPeriod_Cell_LibCal_SubscriberEventCell_Period.qbl
new file mode 100644
index 0000000..7d3f7c3
--- /dev/null
+++ b/_Main/BL/Relations/Relation_LibCal_SubscriberEventPeriod_Cell_LibCal_SubscriberEventCell_Period.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation LibCal_SubscriberEventPeriod_Cell_LibCal_SubscriberEventCell_Period
+{
+  #keys: '1[415136.0.780371764]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide Cell
+  {
+    #keys: '3[415136.0.780371766][415136.0.780371765][415136.0.780371767]'
+    Cardinality: '0to1'
+    ObjectDefinition: LibCal_SubscriberEventPeriod
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide Period
+  {
+    #keys: '3[415136.0.780371769][415136.0.780371768][415136.0.780371770]'
+    Cardinality: '1toN'
+    ObjectDefinition: LibCal_SubscriberEventCell
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventCell/Attribute_End.qbl b/_Main/BL/Type_LibCal_SubscriberEventCell/Attribute_End.qbl
deleted file mode 100644
index 956531d..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventCell/Attribute_End.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute End
-{
-  #keys: '3[415136.0.722560047][415136.0.722560046][415136.0.722560048]'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventCell/Attribute_Start.qbl b/_Main/BL/Type_LibCal_SubscriberEventCell/Attribute_Start.qbl
deleted file mode 100644
index 5854198..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventCell/Attribute_Start.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Start
-{
-  #keys: '3[415136.0.722560040][415136.0.722560039][415136.0.722560041]'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventCell/Method_GetMatrixTooltip.qbl b/_Main/BL/Type_LibCal_SubscriberEventCell/Method_GetMatrixTooltip.qbl
index b14cf04..245f5b9 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventCell/Method_GetMatrixTooltip.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventCell/Method_GetMatrixTooltip.qbl
@@ -7,8 +7,10 @@
   [*
     // 鐢勫叞楦� May-30-2024 (created)
     tooltip := '<table>';
-    tooltip := tooltip + '<tr><td><b>Start time:</b></td><td>' + this.Start() + '</td></tr>';
-    tooltip := tooltip + '<tr><td><b>End time:</b></td><td>' + this.End() + '</td></tr>';
+    traverse( this, Period, period ){
+      tooltip := tooltip + '<tr><td><b>Start time:</b></td><td>' + period.Start() + '</td></tr>';
+      tooltip := tooltip + '<tr><td><b>End time:</b></td><td>' + period.End() + '</td></tr>';
+    }
     tooltip := tooltip + '<tr><td><b>Description:</b></td><td>';
     if( this.Description() <> '' ){
       tooltip := tooltip + this.Description() + '</td></tr>';
diff --git a/_Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_End.qbl b/_Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_End.qbl
new file mode 100644
index 0000000..7776e8e
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_End.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute End
+{
+  #keys: '3[415136.0.780371748][415136.0.780371747][415136.0.780371749]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_Start.qbl b/_Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_Start.qbl
new file mode 100644
index 0000000..5360f07
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventPeriod/Attribute_Start.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Start
+{
+  #keys: '3[415136.0.780371751][415136.0.780371750][415136.0.780371752]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_End.qbl b/_Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_End.qbl
new file mode 100644
index 0000000..8c1fda2
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_End.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: End
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_Start.qbl b/_Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_Start.qbl
new file mode 100644
index 0000000..7d57475
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventPeriod/DefaultValue_Start.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: Start
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventPeriod/_ROOT_Type_LibCal_SubscriberEventPeriod.qbl b/_Main/BL/Type_LibCal_SubscriberEventPeriod/_ROOT_Type_LibCal_SubscriberEventPeriod.qbl
new file mode 100644
index 0000000..3c0aa83
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventPeriod/_ROOT_Type_LibCal_SubscriberEventPeriod.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type LibCal_SubscriberEventPeriod
+{
+  #keys: '5[415136.0.780371742][415136.0.780371740][0.0.0][415136.0.780371741][415136.0.780371743]'
+  BaseType: Object
+  Description: '鏃ュ巻涓嶅彲鐢ㄤ簨浠惰〃鐨勫崟鍏冩牸缁戝畾鐨勬棩鏈熷尯闂�'
+  StructuredName: 'LibCal_SubscriberEventPeriods'
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl
index e332105..247b3c4 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl
@@ -21,16 +21,14 @@
       if( startTime.StartOfNextDay() > endtime ){
         duration := endtime - startTime;
         cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
-                                                   , Start := startTime.Format( 'M/D/Y H:m' )
-                                                   , End := endtime.Format( 'M/D/Y H:m' )
                                                    , Description := desc );
+        cell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) );
         row.LibCal_SubscriberEventCell( relinsert, cell );
       }else{
         duration := startTime.StartOfNextDay() - startTime;
         cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
-                                                   , Start := startTime.Format( 'M/D/Y H:m' )
-                                                   , End := startTime.StartOfNextDay().Format( 'M/D/Y H:m' )
                                                    , Description := desc );
+        cell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextDay().Format( 'M/D/Y H:m' ) );
         row.LibCal_SubscriberEventCell( relinsert, cell );
       }
     //  info( startTime, column.Name(), duration.AsQUILL(), duration.HoursAsReal() );
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl
index c5ee580..096e9f4 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl
@@ -21,21 +21,24 @@
         column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time.Date() );
       }
       
-      if( startTime.StartOfNextMonth() > endtime ){
-        duration := endtime - startTime;
-        cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
-                                                   , Start := startTime.Format( 'M/D/Y H:m' )
-                                                   , End := endtime.Format( 'M/D/Y H:m' )
-                                                   , Description := desc );
-        row.LibCal_SubscriberEventCell( relinsert, cell );
-      }else{
-        duration := startTime.StartOfNextMonth() - startTime;
-        cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
-                                                   , Start := startTime.Format( 'M/D/Y H:m' )
-                                                   , End := startTime.StartOfNextMonth().Format( 'M/D/Y H:m' )
-                                                   , Description := desc );
+      cell := selectobject( column, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row );
+      if( isnull( cell ) ){
+        cell := column.LibCal_SubscriberEventCell( relnew, Value := '0'
+                                                     , Description := desc );
         row.LibCal_SubscriberEventCell( relinsert, cell );
       }
+      
+      value := [Real]cell.Value();
+      if( startTime.StartOfNextMonth() > endtime ){
+        duration := endtime - startTime;
+        value := value + duration.HoursAsReal();
+        cell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) );
+      }else{
+        duration := startTime.StartOfNextMonth() - startTime;
+        value := value + duration.HoursAsReal();
+        cell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextMonth().Format( 'M/D/Y H:m' ) );
+      }
+      cell.Value( [String]value );
     //  info( startTime, column.Name(), duration.AsQUILL(), duration.HoursAsReal() );
     }
   *]
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
index 89da25f..cbe5916 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -16,18 +16,19 @@
     if( isnull( eventcolumn ) ){
       eventcolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Event' );
     }
-    timezone := this.LibCal_Calendar().GetTimeZone();
     
     traverse( subscribers, Elements, subscriber ){
     //  info( '------------------------', subscriber.CalendarID(), subscriber.CalendarType() );
     //  traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation ){
-      traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' ){
+      traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' and participation.Event().Subject() = '娴嬭瘯' ){
     //    info( '------------------------', participation.Event().Subject(), '------', participation.Event().EventCategory().Name() );
         event := participation.Event();
+        
         row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID() 
                              and row.Event() = event.Subject() 
                              and row.EventType() = event.EventType().Name() 
                              );
+        
         if( isnull( row ) ){
           row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(), 
                                                  Event := event.Subject(), 
@@ -43,28 +44,33 @@
           row.LibCal_SubscriberEventCell( relinsert, eventcell );
           rownr := rownr + 1;
         }
-    
-        endTime     := participation.EndDate().DateTime( timezone ).AddAsPeriod( timezone, event.EndTimeOfDay() );
-        startTime   := participation.StartDate().DateTime( timezone ).AddAsPeriod( timezone, event.StartTimeOfDay() );
-    //    info( this.ID(), startTime, endTime );
-        if( this.ID() = 'Day' ){
-          this.InitializeDay( this, row, startTime, endTime, event.Description() );
-        }else if( this.ID() = 'Week' ){
-          this.InitializeWeek( this, row, startTime, endTime, event.Description() );
-        }else{
-          this.InitializeMonth( this, row, startTime, endTime, event.Description() );
+        
+        traverse( participation, ExplicitTimeInterval, eti ){
+          info( eti.Start(), eti.End(), eti.DefinitionName() );
+          if( this.ID() = 'Day' ){
+            this.InitializeDay( this, row, eti.Start(), eti.End(), event.Description() );
+          }else if( this.ID() = 'Week' ){
+            this.InitializeWeek( this, row, eti.Start(), eti.End(), event.Description() );
+          }else{
+            this.InitializeMonth( this, row, eti.Start(), eti.End(), event.Description() );
+          }
         }
+        
+        
+    //
+    //    endTime     := participation.EndDate().DateTime( timezone ).AddAsPeriod( timezone, event.EndTimeOfDay() );
+    //    startTime   := participation.StartDate().DateTime( timezone ).AddAsPeriod( timezone, event.StartTimeOfDay() );
     
       }
     }
     
-    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 );
-        }
-      }
-    }
+    //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_InitializeWeek.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl
index f9cfed4..e543a38 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl
@@ -21,21 +21,25 @@
         column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time.Date() );
       }
       
-      if( startTime.StartOfNextWeek() > endtime ){
-        duration := endtime - startTime;
-        cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
-                                                   , Start := startTime.Format( 'M/D/Y H:m' )
-                                                   , End := endtime.Format( 'M/D/Y H:m' )
-                                                   , Description := desc );
-        row.LibCal_SubscriberEventCell( relinsert, cell );
-      }else{
-        duration := startTime.StartOfNextWeek() - startTime;
-        cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
-                                                   , Start := startTime.Format( 'M/D/Y H:m' )
-                                                   , End := startTime.StartOfNextWeek().Format( 'M/D/Y H:m' )
-                                                   , Description := desc );
+      cell := selectobject( column, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row );
+      if( isnull( cell ) ){
+        cell := column.LibCal_SubscriberEventCell( relnew, Value := '0'
+                                                     , Description := desc );
         row.LibCal_SubscriberEventCell( relinsert, cell );
       }
+      
+      value := [Real]cell.Value();
+      if( startTime.StartOfNextWeek() > endtime ){
+        duration := endtime - startTime;
+        value := value + duration.HoursAsReal();
+        cell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) );
+      }else{
+        duration := startTime.StartOfNextWeek() - startTime;
+        value := value + duration.HoursAsReal();
+        cell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextWeek().Format( 'M/D/Y H:m' ) );
+      }
+      cell.Value( [String]value );
+      
     //  info( startTime, column.Name(), duration.AsQUILL(), duration.HoursAsReal() );
     }
   *]
diff --git a/_Main/UI/MacroPlannerWebApp/Views/Calendar_unavailable_event_view.vw b/_Main/UI/MacroPlannerWebApp/Views/Calendar_unavailable_event_view.vw
index 6391363..4b625b8 100644
--- a/_Main/UI/MacroPlannerWebApp/Views/Calendar_unavailable_event_view.vw
+++ b/_Main/UI/MacroPlannerWebApp/Views/Calendar_unavailable_event_view.vw
@@ -51,6 +51,35 @@
           {
             sizeRatio: 1
           }
+          FormCalendarUnavailableEvent_ListCalendarEventTypes
+          {
+          }
+          FormCalendarUnavailableEvent_DataSetLevelCalendarEventTypes
+          {
+            groupDepth: -1
+            column_Name
+            {
+              columnId: 'Name'
+              dataPath: 'Name'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 150
+            }
+          }
+          FormCalendarUnavailableEvent_DataSetLevelChildEventType
+          {
+            groupDepth: -1
+            column_Name
+            {
+              columnId: 'Name'
+              dataPath: 'Name'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 150
+            }
+          }
           FormCalendarUnavailableEvent_PanelCalendarUnavailableEventSearchList
           {
             sizeRatio: 1

--
Gitblit v1.9.3