lazhen
2024-07-26 c5fdf09f90b8f8f62116674e20a15c799e9d7017
日历不可用事件速度问题优化
已添加5个文件
已修改4个文件
已删除3个文件
320 ■■■■ 文件已修改
_Main/BL/Type_LibCal_SubscriberEventColumn/Attribute_TimeUnit.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventColumn/Method_FilterByDatePeriod.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventColumn/Method_GetCellByTimeUnit.qbl 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventRow/Method_GetTimeByTimeUnit.qbl 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventTable/Method_GetColumnByTimeUnit.qbl 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeTable.qbl 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LibCal_SubscriberEventTable/StaticMethod_InitializeTable.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormCalendarUnavailableEvent/Response_PanelExport_ButtonSearch_OnClick.def 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_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
}
_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;
    }
    
_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;
  *]
}
_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;
  *]
}
_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();
    }
  *]
}
_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;
  *]
}
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeDay.qbl
ÎļþÒÑɾ³ý
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeMonth.qbl
ÎļþÒÑɾ³ý
_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() );
    
      }
    }
_Main/BL/Type_LibCal_SubscriberEventTable/Method_InitializeWeek.qbl
ÎļþÒÑɾ³ý
_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 );
    }
_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 );