From c5fdf09f90b8f8f62116674e20a15c799e9d7017 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 26 七月 2024 14:59:33 +0800
Subject: [PATCH] 日历不可用事件速度问题优化
---
_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl | 18 ++++
_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl | 76 +++++++++++++++++++
/dev/null | 46 -----------
_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonSearch_OnClick.def | 4
_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl | 5
_Main/BL/Type_LibCal_SubscriberEventRow/Method_GetTimeByTimeUnit.qbl | 22 +++++
_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl | 6 -
_Main/BL/Type_LibCal_SubscriberEventColumn/Attribute_TimeUnit.qbl | 8 ++
_Main/BL/Type_LibCal_SubscriberEventColumn/Method_GetCellByTimeUnit.qbl | 19 ++++
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl | 34 --------
10 files changed, 152 insertions(+), 86 deletions(-)
diff --git a/_Main/BL/Type_LibCal_SubscriberEventColumn/Attribute_TimeUnit.qbl b/_Main/BL/Type_LibCal_SubscriberEventColumn/Attribute_TimeUnit.qbl
new file mode 100644
index 0000000..f017187
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventColumn/Attribute_TimeUnit.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute TimeUnit
+{
+ #keys: '3[415136.0.941300421][415136.0.941300420][415136.0.941300422]'
+ Description: '鏃堕棿绫诲瀷'
+ ValueType: String
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl b/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl
index 508df7f..0bf30d1 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl
@@ -2,7 +2,8 @@
#parent: #root
Method FilterByDatePeriod (
Date start,
- Date end
+ Date end,
+ String timeunit
) declarative remote as Boolean
{
TextBody:
@@ -10,7 +11,7 @@
// 鐢勫叞楦� May-29-2024 (created)
value := false;
//info( this.Index(), this.LibCal_SubscriberEventTable().Name(), this.Period(), start, end );
- if( this.Period() >= start and this.Period() <= end ){
+ if( this.Period() >= start and this.Period() <= end and this.TimeUnit() = timeunit ){
value := true;
}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_GetCellByTimeUnit.qbl b/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_GetCellByTimeUnit.qbl
new file mode 100644
index 0000000..fedb5be
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventColumn/Method_GetCellByTimeUnit.qbl
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetCellByTimeUnit (
+ LibCal_SubscriberEventRow row,
+ String desc
+) as LibCal_SubscriberEventCell
+{
+ TextBody:
+ [*
+ // 鐢勫叞楦� Jul-26-2024 (created)
+ cell := selectobject( this, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row );
+ if( isnull( cell ) ){
+ cell := this.LibCal_SubscriberEventCell( relnew, Value := '0'
+ , Description := desc );
+ row.LibCal_SubscriberEventCell( relinsert, cell );
+ }
+ return cell;
+ *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_GetTimeByTimeUnit.qbl b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_GetTimeByTimeUnit.qbl
new file mode 100644
index 0000000..9d2ad1c
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_GetTimeByTimeUnit.qbl
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetTimeByTimeUnit (
+ DateTime starttime,
+ DateTime starttimetmp,
+ String timeunit
+) as Date
+{
+ TextBody:
+ [*
+ // 鐢勫叞楦� Jul-26-2024 (created)
+ time := starttime.Date();
+ if( starttime = starttimetmp ){
+ if ( timeunit = Translations::MP_GlobalParameters_Week() ){
+ time := starttime.StartOfWeek().Date();
+ } else if ( timeunit = Translations::MP_GlobalParameters_Month() ){
+ time := starttime.StartOfMonth().Date();
+ }
+ }
+ return time;
+ *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
new file mode 100644
index 0000000..fdff292
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
@@ -0,0 +1,76 @@
+Quintiq file version 2.0
+#parent: #root
+Method InitializeDate (
+ LibCal_SubscriberEventTable table,
+ DateTime starttime,
+ DateTime endtime,
+ String desc
+)
+{
+ TextBody:
+ [*
+ // 鐢勫叞楦� May-29-2024 (created)
+ 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 );
+
+ dayvalue := [Real]daycell.Value();
+ if( startTime.StartOfNextDay() > endtime ){
+ duration := endtime - startTime;
+ dayvalue := dayvalue + duration.HoursAsReal();
+ daycell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) );
+ }else{
+ duration := startTime.StartOfNextDay() - startTime;
+ dayvalue := dayvalue + duration.HoursAsReal();
+ daycell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextDay().Format( 'M/D/Y H:m' ) );
+ }
+ daycell.Value( [String]dayvalue );
+ //鍛�
+ if( nextweektime = startTime ){
+ weektime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Week() );
+ weekcolumn := table.GetColumnByTimeUnit( table, weektime, Translations::MP_GlobalParameters_Week() );
+ weekcell := weekcolumn.GetCellByTimeUnit( this, desc );
+
+ weekvalue := [Real]weekcell.Value();
+ if( startTime.StartOfNextWeek() > endtime ){
+ duration := endtime - startTime;
+ weekvalue := weekvalue + duration.HoursAsReal();
+ weekcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) );
+ }else{
+ duration := startTime.StartOfNextWeek() - startTime;
+ weekvalue := weekvalue + duration.HoursAsReal();
+ weekcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextWeek().Format( 'M/D/Y H:m' ) );
+ }
+ weekcell.Value( [String]weekvalue );
+ nextweektime := startTime.StartOfNextWeek();
+ }
+ // info( '-----------------------------1------------------------', nextmonthtime, startTime, nextweektime );
+ //鏈�
+ if( nextmonthtime = startTime ){
+ 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 ) );
+ monthvalue := [Real]monthcell.Value();
+ if( startTime.StartOfNextMonth() > endtime ){
+ duration := endtime - startTime;
+ monthvalue := monthvalue + duration.HoursAsReal();
+ monthcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) );
+ }else{
+ duration := startTime.StartOfNextMonth() - startTime;
+ monthvalue := monthvalue + duration.HoursAsReal();
+ monthcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextMonth().Format( 'M/D/Y H:m' ) );
+ }
+ monthcell.Value( [String]monthvalue );
+ nextmonthtime := startTime.StartOfNextMonth();
+ }
+ startTime := startTime.StartOfNextDay();
+ }
+ *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl
new file mode 100644
index 0000000..757b1d4
--- /dev/null
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetColumnByTimeUnit (
+ LibCal_SubscriberEventTable table,
+ Date time,
+ String timeunit
+) as LibCal_SubscriberEventColumn
+{
+ TextBody:
+ [*
+ // 鐢勫叞楦� Jul-26-2024 (created)
+ column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time.Format( 'M/D/Y' ) );
+ if( isnull( column ) ){
+ column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time, TimeUnit := timeunit );
+ }
+ return column;
+ *]
+}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl
deleted file mode 100644
index 247b3c4..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl
+++ /dev/null
@@ -1,37 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method InitializeDay (
- LibCal_SubscriberEventTable table,
- LibCal_SubscriberEventRow row,
- DateTime starttime,
- DateTime endtime,
- String desc
-)
-{
- TextBody:
- [*
- // 鐢勫叞楦� May-29-2024 (created)
- for( startTime := starttime; startTime < endtime; startTime := startTime.StartOfNextDay() ){
- time := startTime.Format( 'M/D/Y' );
- column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time );
- if( isnull( column ) ){
- column := table.LibCal_SubscriberEventColumn( relnew, Name := time, Period := startTime.Date() );
- }
-
- if( startTime.StartOfNextDay() > endtime ){
- duration := endtime - startTime;
- cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal()
- , 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()
- , 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
deleted file mode 100644
index 096e9f4..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl
+++ /dev/null
@@ -1,45 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method InitializeMonth (
- LibCal_SubscriberEventTable table,
- LibCal_SubscriberEventRow row,
- DateTime starttime,
- DateTime endtime,
- String desc
-)
-{
- TextBody:
- [*
- // 鐢勫叞楦� May-29-2024 (created)
- for( startTime := starttime; startTime < endtime; startTime := startTime.StartOfNextMonth() ){
- time := startTime;
- if( starttime = startTime ){
- time := startTime.StartOfMonth();
- }
- column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time.Format( 'M/D/Y' ) );
- if( isnull( column ) ){
- column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time.Date() );
- }
-
- 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 e3cd1e0..0df1514 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl
@@ -8,20 +8,10 @@
[*
// 鐢勫叞楦� May-28-2024 (created)
rownr := this.LibCal_SubscriberEventRow( relsize );
- //subscribercolumn := selectobject( this, LibCal_SubscriberEventColumn, column, column.RowName() = 'Line' );
- //if( isnull( subscribercolumn ) ){
- // subscribercolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Line' );
- //}
- //eventcolumn := selectobject( this, LibCal_SubscriberEventColumn, column, column.RowName() = 'Event' );
- //if( isnull( eventcolumn ) ){
- // eventcolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Event' );
- //}
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' ){
- // info( '---------------1---------', participation.Event().Subject(), '------', participation.Event().EventCategory().Name() );
event := participation.Event();
row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID()
@@ -34,32 +24,12 @@
Event := event.Subject(),
EventType := event.EventType().Name() );
- // subscribercell := subscribercolumn.LibCal_SubscriberEventCell( relnew, Value := row.Subscriber() );
- // if( counter( this, LibCal_SubscriberEventRow, linerow, linerow.Subscriber() = row.Subscriber() ) <> 1 ){
- // subscribercell.Value( '' );
- // }
- // row.LibCal_SubscriberEventCell( relinsert, subscribercell );
- //
- // eventcell := eventcolumn.LibCal_SubscriberEventCell( relnew, Value := row.Event() );
- // row.LibCal_SubscriberEventCell( relinsert, eventcell );
rownr := rownr + 1;
}
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() );
- }
+ row.InitializeDate( this, eti.Start(), eti.End(), event.Description() );
}
-
-
- //
- // endTime := participation.EndDate().DateTime( timezone ).AddAsPeriod( timezone, event.EndTimeOfDay() );
- // startTime := participation.StartDate().DateTime( timezone ).AddAsPeriod( timezone, event.StartTimeOfDay() );
}
}
diff --git a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl
deleted file mode 100644
index e543a38..0000000
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl
+++ /dev/null
@@ -1,46 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method InitializeWeek (
- LibCal_SubscriberEventTable table,
- LibCal_SubscriberEventRow row,
- DateTime starttime,
- DateTime endtime,
- String desc
-)
-{
- TextBody:
- [*
- // 鐢勫叞楦� May-29-2024 (created)
- for( startTime := starttime; startTime < endtime; startTime := startTime.StartOfNextWeek() ){
- time := startTime;
- if( starttime = startTime ){
- time := startTime.StartOfWeek();
- }
- column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time.Format( 'M/D/Y' ) );
- if( isnull( column ) ){
- column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time.Date() );
- }
-
- 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/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
index f6e41d1..e95dfc4 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl
@@ -10,11 +10,9 @@
// 鐢勫叞楦� May-28-2024 (created)
owner.LibCal_SubscriberEventTable( relflush );
if( owner.LibCal_SubscriberEventTable( relsize ) < 1 ){
- owner.LibCal_SubscriberEventTable( relnew, ID := 'Day', Name := 'Day' );
- owner.LibCal_SubscriberEventTable( relnew, ID := 'Week', Name := 'Week' );
- owner.LibCal_SubscriberEventTable( relnew, ID := 'Month', Name := 'Month' );
+ owner.LibCal_SubscriberEventTable( relnew, ID := LibCal_SubscriberEventTable::GetDefaultName(), Name := LibCal_SubscriberEventTable::GetDefaultName() );
}
- info('-----------------------------', owner.LibCal_SubscriberEventTable( relsize ), subscribers.Size() );
+
traverse( owner, LibCal_SubscriberEventTable, table ){
table.InitializeTable( subscribers );
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonSearch_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonSearch_OnClick.def
index 43d167d..5fc08f4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonSearch_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonSearch_OnClick.def
@@ -14,8 +14,8 @@
subscribers := dhSubscribers.Data();
eventtypes := dhEventTypes.Data();
date := dhDate.Data();
- traverse( dhCalendar.Data(), LibCal_SubscriberEventTable, table, table.ID() = RadioButtonGroupUseForPlanning.BoundValue() ){
- columns := selectset( table, LibCal_SubscriberEventColumn, column, column.FilterByDatePeriod( date.Start(), date.End() ) );
+ traverse( dhCalendar.Data(), LibCal_SubscriberEventTable, table ){
+ columns := selectset( table, LibCal_SubscriberEventColumn, column, column.FilterByDatePeriod( date.Start(), date.End(), RadioButtonGroupUseForPlanning.BoundValue() ) );
rows := selectset( table, LibCal_SubscriberEventRow, row, row.FilterBySubscriberAndEventType( subscribers, eventtypes ) );
}
dhColumns.Data( &columns );
--
Gitblit v1.9.3