From 32f0336643e045587fca0b513564ee68f6f801ab Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 18 十二月 2024 15:42:30 +0800
Subject: [PATCH] 日历不可用时间报表优化
---
_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl | 2
_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def | 2
_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl | 39 +++++++++++++++++--
/dev/null | 13 ------
_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl | 8 +---
_Main/BL/Type_LibCal_SubscriberEventRow/Attribute_RowNr.qbl | 1
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl | 40 ++++++++-----------
7 files changed, 55 insertions(+), 50 deletions(-)
diff --git a/_Main/BL/Type_LibCal_SubscriberEventRow/Attribute_RowNr.qbl b/_Main/BL/Type_LibCal_SubscriberEventRow/Attribute_RowNr.qbl
index d1182a6..030c700 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventRow/Attribute_RowNr.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventRow/Attribute_RowNr.qbl
@@ -3,6 +3,5 @@
Attribute RowNr
{
#keys: '3[415136.0.671975114][415136.0.671975113][415136.0.671975115]'
- IsReadOnly: true
ValueType: Number
}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
index fdff292..d715c17 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
@@ -10,15 +10,25 @@
TextBody:
[*
// 鐢勫叞楦� May-29-2024 (created)
- startTime := starttime;
- nextweektime := starttime;
- nextmonthtime := starttime;
+ startTime := starttime;
+ nextweektime := starttime;
+ nextmonthtime := starttime;
while( startTime < endtime ){
//for( startTime := starttime; startTime < endtime; startTime := startTime.StartOfNextDay() ){
//澶�
daytime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Day() );
daycolumn := table.GetColumnByTimeUnit( table, daytime, Translations::MP_GlobalParameters_Day() );
daycell := daycolumn.GetCellByTimeUnit( this, desc );
+ if( table.MaxDayDate().IsInfinite() ){
+ table.MaxDayDate( daytime );
+ }else{
+ table.MaxDayDate( ifexpr( table.MaxDayDate() < daytime, daytime, table.MaxDayDate() ) );
+ }
+ if( table.MinDayDate().IsInfinite() ){
+ table.MinDayDate( daytime );
+ }else{
+ table.MinDayDate( ifexpr( table.MinDayDate() > daytime, daytime, table.MinDayDate() ) );
+ }
dayvalue := [Real]daycell.Value();
if( startTime.StartOfNextDay() > endtime ){
@@ -36,7 +46,16 @@
weektime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Week() );
weekcolumn := table.GetColumnByTimeUnit( table, weektime, Translations::MP_GlobalParameters_Week() );
weekcell := weekcolumn.GetCellByTimeUnit( this, desc );
-
+ if( table.MaxWeekDate().IsInfinite() ){
+ table.MaxWeekDate( weektime );
+ }else{
+ table.MaxWeekDate( ifexpr( table.MaxWeekDate() < weektime, weektime, table.MaxWeekDate() ) );
+ }
+ if( table.MinWeekDate().IsInfinite() ){
+ table.MinWeekDate( weektime );
+ }else{
+ table.MinWeekDate( ifexpr( table.MinWeekDate() > weektime, weektime, table.MinWeekDate() ) );
+ }
weekvalue := [Real]weekcell.Value();
if( startTime.StartOfNextWeek() > endtime ){
duration := endtime - startTime;
@@ -56,7 +75,17 @@
monthtime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Month() );
monthcolumn := table.GetColumnByTimeUnit( table, monthtime, Translations::MP_GlobalParameters_Month() );
monthcell := monthcolumn.GetCellByTimeUnit( this, desc );
- info( nextmonthtime, startTime, monthtime, isnull( monthcolumn ), isnull( monthcell ) );
+ if( table.MaxMonthDate().IsInfinite() ){
+ table.MaxMonthDate( monthtime );
+ }else{
+ table.MaxMonthDate( ifexpr( table.MaxMonthDate() < monthtime, monthtime, table.MaxMonthDate() ) );
+ }
+ if( table.MinMonthDate().IsInfinite() ){
+ table.MinMonthDate( monthtime );
+ }else{
+ table.MinMonthDate( ifexpr( table.MinMonthDate() > monthtime, monthtime, table.MinMonthDate() ) );
+ }
+ // info( nextmonthtime, startTime, monthtime, isnull( monthcolumn ), isnull( monthcell ) );
monthvalue := [Real]monthcell.Value();
if( startTime.StartOfNextMonth() > endtime ){
duration := endtime - startTime;
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl
deleted file mode 100644
index 03052fe..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxDayDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index ea3887c..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxMonthDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index ed0f2bd..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMaxWeekDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index 6965360..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinDayDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index 02cc12a..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinMonthDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-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
deleted file mode 100644
index e5564d3..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Function_CalcMinWeekDate.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-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 00583cb..9131f6c 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.TimeUnit() = timeunit );
+ column := selectobject( table, LibCal_SubscriberEventColumn, column, column.TimeUnit() = timeunit and column.Period() = time );
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 1171045..abd3094 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -7,27 +7,21 @@
TextBody:
[*
// 鐢勫叞楦� May-28-2024 (created)
- rownr := this.LibCal_SubscriberEventRow( relsize );
-
- traverse( subscribers, Elements, subscriber ){
-
- traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' ){
- event := participation.Event();
-
- row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID()
- and row.Event() = event.Subject()
- and row.EventType() = guard( event.EventType().Name(), '' )
- );
+ //rownr := this.LibCal_SubscriberEventRow( relsize );
+ traverse( this.LibCal_Calendar(), Event.LeadingParticipation, lp, lp.Event().EventCategory().Name() = 'Unavailable' ){
+ event := lp.Event();
+ rows := selectset( this, LibCal_SubscriberEventRow, row, row.Event() = event.Subject() and row.EventType() = guard( event.EventType().Name(), '' ) );
+ traverse( lp, Subscription, subscription ){
+ row := selectobject( rows, Elements, row, row.Subscriber() = subscription.Calendar().CalendarID() );
if( isnull( row ) ){
- row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(),
- Event := event.Subject(),
- EventType := guard( event.EventType().Name(), '' ) );
+ row := this.LibCal_SubscriberEventRow( relnew, Subscriber := subscription.Calendar().CalendarID()
+ , Event := event.Subject()
+ , EventType := guard( event.EventType().Name(), '' ) );
- rownr := rownr + 1;
}
- traverse( participation, ExplicitTimeInterval, eti ){
+ traverse( subscription, ExplicitTimeInterval, eti ){
row.InitializeDate( this, eti.Start(), eti.End(), event.Description() );
}
@@ -37,13 +31,13 @@
//traverse( this, LibCal_SubscriberEventColumn, column ){
// 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 ) );
+ //
+ //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();
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
index e95dfc4..f2ede4c 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
@@ -9,12 +9,8 @@
[*
// 鐢勫叞楦� May-28-2024 (created)
owner.LibCal_SubscriberEventTable( relflush );
- if( owner.LibCal_SubscriberEventTable( relsize ) < 1 ){
- owner.LibCal_SubscriberEventTable( relnew, ID := LibCal_SubscriberEventTable::GetDefaultName(), Name := LibCal_SubscriberEventTable::GetDefaultName() );
- }
+ table := owner.LibCal_SubscriberEventTable( relnew, ID := LibCal_SubscriberEventTable::GetDefaultName(), Name := LibCal_SubscriberEventTable::GetDefaultName() );
- traverse( owner, LibCal_SubscriberEventTable, table ){
- table.InitializeTable( subscribers );
- }
+ table.InitializeTable( subscribers );
*]
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def
index f0cf4a9..eacae66 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Component_MatrixEditorTable.def
@@ -54,7 +54,7 @@
Properties:
[
Legend: 'Name'
- SortCriteria: 'RowNr'
+ SortCriteria: 'Name'
Taborder: 1
]
}
--
Gitblit v1.9.3