From 0d6690da8177b3dab9a714dbb9ec3e3344631e9a Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 12 六月 2024 11:23:25 +0800
Subject: [PATCH] 批量创建的事件逻辑修正
---
_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def | 2
_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl | 62 +++++++++++++++++++++++++++++--
_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def | 14 +++---
_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def | 36 ++++++++++++++++++
_Main/UI/MacroPlannerWebApp/Component_FormRoutings/Response_MacroPlanner_ListRoutings_MenuThermalTrialRatio_OnClick.def | 2
5 files changed, 103 insertions(+), 13 deletions(-)
diff --git a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
index 812c8aa..76e31f8 100644
--- a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
+++ b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
@@ -33,21 +33,75 @@
Date periodStartDate_i,
Number nrOfOccurrences_i,
Date periodEndDate_i,
- LibCal_Calendars subscribers_i
+ LibCal_Calendars subscribers_i,
+ Boolean ismultiple
) as LibCal_Event
{
Description: 'Create and/or update an Event and its LeadingParticipation, based on information from the UI.'
TextBody:
[*
- event := LibCal_Event::CreateUpdateFromUI( owner_i, participation_i, subject_i, description_i, type_i, capacity_i, category_i, isDefault_i,
+ //浜嬩欢鍒涘缓浜屽紑鏂规硶
+ //info( startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i, recurrenceInterval_i, patternType_i
+ // , patternDaily_IsEveryWeekday_i, periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i );
+ //鏌ヨ鏄惁宸叉湁鍚屽悕浜嬩欢
+ event := selectobject( owner_i, Event, event, event.Subject() = subject_i
+ and event.StartTimeOfDay() = startTimeOfDay_i
+ and event.EndTimeOfDay() = endTimeOfDay_i
+ and event.EventType() = eventtype_i );
+ //鍙湁閫氳繃鎵归噺鍒涘缓鐣岄潰涓斿凡鏈夊悓鍚嶄簨浠惰繘鍏ヤ笅闈㈡搷浣�
+ if( ismultiple and not isnull( event ) ){
+ startdate := startDate_i;
+ enddate := startDate_i;
+ dates := construct( Dates );
+ dates.Add( startDate_i );
+ //鑾峰彇鏃т簨浠剁殑寮�濮嬩簨浠跺拰缁撴潫浜嬩欢锛屼互鍙婃墍鏈夋椂闂寸偣
+ traverse( event, Participation.ExplicitTimeInterval, eti ){
+ if( startdate > eti.Start().Date() ){
+ startdate := eti.Start().Date();
+ }
+ if( enddate < eti.Start().Date() ) {
+ enddate := eti.Start().Date();
+ }
+ if( not exists( dates, Elements, e, e = eti.Start().Date() ) ){
+ dates.Add( eti.Start().Date() );
+ }
+ }
+ //淇敼鏃т簨浠剁殑闂撮殧
+ nrOfOccurrences_i := enddate - startdate + 1;
+ startDate_i := startdate;
+ endDate_i := startdate;
+ periodStartDate_i := startdate;
+ periodEndDate_i := enddate;
+ // info( startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i, recurrenceInterval_i, patternType_i
+ // , patternDaily_IsEveryWeekday_i, periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i );
+ event := LibCal_Event::CreateUpdateFromUI( owner_i, event.LeadingParticipation(), subject_i, description_i, type_i, capacity_i, category_i, isDefault_i,
startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i,
isRecurring_i, recurrenceInterval_i,
patternType_i, patternDaily_IsEveryWeekday_i, patternWeekly_Weekdays_i,
patternMonthly_IsDay_i, patternMonthly_Day_i, patternMonthly_WeekOfMonth_i, patternMonthly_DayOfWeek_i,
patternYearly_IsDate_i, patternYearly_Month_i, patternYearly_Day_i, patternYearly_WeekOfMonth_i, patternYearly_DayOfWeek_i,
periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i, subscribers_i );
-
- event.EventType( relset, eventtype_i );
+ //鍒犳帀涓嶉渶瑕佺殑鏃堕棿鐐�
+ timeIntervals := construct( LibCal_ExplicitTimeIntervals );
+ traverse( event, Participation.ExplicitTimeInterval, eti ){
+ // info( '------------------------------', eti.Start(), eti.End(), exists( dates, Elements, e, e = eti.Start().Date() ), '------------------', dates.Find( eti.Start().Date() ) );
+ if( dates.Find( eti.Start().Date() ) < 0 ){
+ timeIntervals.Add( eti );
+ }
+ }
+ LibCal_ExplicitTimeInterval::Delete( timeIntervals, true );
+ } else {
+ event := LibCal_Event::CreateUpdateFromUI( owner_i, participation_i, subject_i, description_i, type_i, capacity_i, category_i, isDefault_i,
+ startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i,
+ isRecurring_i, recurrenceInterval_i,
+ patternType_i, patternDaily_IsEveryWeekday_i, patternWeekly_Weekdays_i,
+ patternMonthly_IsDay_i, patternMonthly_Day_i, patternMonthly_WeekOfMonth_i, patternMonthly_DayOfWeek_i,
+ patternYearly_IsDate_i, patternYearly_Month_i, patternYearly_Day_i, patternYearly_WeekOfMonth_i, patternYearly_DayOfWeek_i,
+ periodType_i, periodStartDate_i, nrOfOccurrences_i, periodEndDate_i, subscribers_i );
+ }
+ if( not isnull( event ) ){
+ event.EventType( relset, eventtype_i );
+ }
return event;
*]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormRoutings/Response_MacroPlanner_ListRoutings_MenuThermalTrialRatio_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormRoutings/Response_MacroPlanner_ListRoutings_MenuThermalTrialRatio_OnClick.def
index 6cef285..c85b4f6 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormRoutings/Response_MacroPlanner_ListRoutings_MenuThermalTrialRatio_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormRoutings/Response_MacroPlanner_ListRoutings_MenuThermalTrialRatio_OnClick.def
@@ -2,7 +2,7 @@
#parent: ListRoutings
Response OnClick (
Routing selection
-) id:Response_MacroPlanner_ListRoutings_MenuThermalTrialRatio_OnClick
+) id:Response_ListRoutings_MenuThermalTrialRatio_OnClick
{
#keys: '[415136.0.761890849]'
CanBindMultiple: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def
index 0c659fb..f864a6d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateUpdateEventAndParticipation.def
@@ -74,7 +74,7 @@
// RecurrencePeriod
periodType, periodStartDate, nrOfOccurrences, periodEndDate,
// Subscribers
- dhSubscribers.Data() );
+ dhSubscribers.Data(), false );
return event;
*]
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def
new file mode 100644
index 0000000..c5a9ec4
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def
@@ -0,0 +1,36 @@
+Quintiq file version 2.0
+#parent: #root
+Method EditEvent (
+ LibCal_LeadingParticipation leadPart_i
+) id:Method_LibCal_dlgEvent_EditEvent #extension
+{
+ Body:
+ [*
+ // Set the Event and the related controls.
+ // The values are explicitly assigned here 'at the beginning' to the controls,
+ // so that the values can be used by the rest of the logic. Databinding is executed too late for that.
+ // Further initialization is done in the OnCreated of the Dialog.
+ sEvent := shadow( leadPart_i.Event() );
+ dhEvent.Data( &sEvent );
+ this.SetEventData();
+
+ // Set the Participation and the related controls
+ // (only the DataHolders, the Date-controls are set later on, after the recurrence has been initialized)
+ sLeadPart := shadow( leadPart_i );
+ dhStartDate.Data( sLeadPart.StartDate() );
+ dhEndDate.Data( sLeadPart.EndDate() );
+ dhLeadingParticipation.Data( &sLeadPart );
+
+ // Initialize the capacity here, when done in the OnCreated() edtCapacity is not enabled correctly when the type is Capacity.
+ this.InitializeCapacity();
+
+ // Must be done here, when done in the OnCreated() there is no selection in the DropDownList.
+ this.InitializeCategories();
+ this.InitializeEventTypes();
+ // Must be done here, when done in the OnCreated() the checkmarks are not always set.
+ this.InitializeSubscribers();
+
+ // Open the dialog.
+ this.Show( "modal" );
+ *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
index 0a7dd6c..1b3e681 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
@@ -26,9 +26,9 @@
capacity := Real::MinReal(); // Always fill the capacity.
// RecurrencePattern
- isRecurring := false;
+ isRecurring := true;
recurrenceInterval := 1;
- patternType := LibCal_RecurrencePeriod::TYPE_WITHOUTEND();
+ patternType := LibCal_RecurrencePattern::TYPE_DAILY();
// Daily
daily_IsEveryWeekday := false;
@@ -51,10 +51,10 @@
yearly_DayOfWeek := '';
// RecurrencePeriod
- periodType := LibCal_RecurrencePeriod::TYPE_WITHOUTEND();
- periodStartDate := Date::MinDate();
- periodEndDate := Date::MinDate();
- nrOfOccurrences := 0;
+ periodType := LibCal_RecurrencePeriod::TYPE_NROFOCCURRENCES();
+ periodStartDate := dsStartDate.Date();
+ periodEndDate := startDate + 1;
+ nrOfOccurrences := 1;
// All values are passed to the Server, only the relevant values are used there.
event := LibCal_Event::CreateUpdateFromUI( sEvent.Calendar(), sLeadPart.WrappedInstance(),
@@ -69,7 +69,7 @@
// RecurrencePeriod
periodType, periodStartDate, nrOfOccurrences, periodEndDate,
// Subscribers
- dhSubscribers.Data() );
+ dhSubscribers.Data(), true );
return event;
*]
--
Gitblit v1.9.3