From 887dd485907fb75b76465de86dff57eeccd9fb04 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期二, 23 七月 2024 16:43:58 +0800
Subject: [PATCH] 批量维护产能占用事件选择日期修改

---
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_ListList.def                           |    4 +-
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent#791.def                               |    7 +++
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent#778.def                       |    2 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def                               |    1 
 _Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl                                                 |   18 ++++++--
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def     |    2 
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader#144.def                    |   35 ++++++++++++++---
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Response_PanelHeader_144_dsEndDate_OnChanged.def |   30 +++++++++++++++
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_SetParticipationData.def                  |    1 
 _Main/BL/Type_LibCal_Event/Attribute_IsMultiple.qbl                                                            |    8 ++++
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def                                     |    8 +++
 11 files changed, 100 insertions(+), 16 deletions(-)

diff --git a/_Main/BL/Type_LibCal_Event/Attribute_IsMultiple.qbl b/_Main/BL/Type_LibCal_Event/Attribute_IsMultiple.qbl
new file mode 100644
index 0000000..959ef87
--- /dev/null
+++ b/_Main/BL/Type_LibCal_Event/Attribute_IsMultiple.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsMultiple
+{
+  #keys: '3[415136.0.918010824][415136.0.918010823][415136.0.918010825]'
+  Description: '鏄惁閫氳繃鎵归噺鐣岄潰鍒涘缓'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
index 76e31f8..55d6ee0 100644
--- a/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
+++ b/_Main/BL/Type_LibCal_Event/StaticMethod_CreateUpdateFromUI.qbl
@@ -45,9 +45,15 @@
     //      , 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 );
+                           and event.EventType() = eventtype_i
+                           and ( event.LeadingParticipation().EndDate() - event.LeadingParticipation().StartDate() ) = ( endDate_i - startDate_i )
+                           and event.StartTimeOfDay() = startTimeOfDay_i 
+                           and event.EndTimeOfDay() = endTimeOfDay_i );
+    //event := selectobject( owner_i, Event.LeadingParticipation, lp, lp.Event().Subject() = subject_i 
+    //                       and lp.Event().EventType() = eventtype_i
+    //                       and ( lp.EndDate() - lp.StartDate() ) = ( endDate_i - startDate_i )
+    //                       and lp.Event().StartTimeOfDay() = startTimeOfDay_i 
+    //                       and lp.Event().EndTimeOfDay() = endTimeOfDay_i );
     //鍙湁閫氳繃鎵归噺鍒涘缓鐣岄潰涓斿凡鏈夊悓鍚嶄簨浠惰繘鍏ヤ笅闈㈡搷浣�
     if( ismultiple and not isnull( event ) ){
       startdate := startDate_i;
@@ -69,7 +75,7 @@
       //淇敼鏃т簨浠剁殑闂撮殧
       nrOfOccurrences_i := enddate - startdate + 1;
       startDate_i := startdate;
-      endDate_i   := startdate;
+      endDate_i := ( event.LeadingParticipation().EndDate() - event.LeadingParticipation().StartDate() + startDate_i );
       periodStartDate_i := startdate;
       periodEndDate_i := enddate;
     //  info( startDate_i, startTimeOfDay_i, endDate_i, endTimeOfDay_i, isAllDay_i, recurrenceInterval_i, patternType_i
@@ -102,7 +108,9 @@
     if( not isnull( event ) ){
       event.EventType( relset, eventtype_i );
     }
-    
+    if( ismultiple ){
+      event.IsMultiple( ismultiple );
+    }
     return event;
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def
index 2716134..457bf56 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Component_pnlEventType.def
@@ -61,5 +61,6 @@
   [
     Orientation: 'horizontal'
     Taborder: 4
+    Visible: false
   ]
 }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def"
index a775035..a9d7c68 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_CreateEvent\043791.def"
@@ -29,6 +29,13 @@
     {
       sEvent.Type( LibCal_Event::TYPE_PARTIAL() );
     }
+    if( guard( category_i.Name() = LibCal_Event::TYPE_UNAVAILABLE(), false ) )
+    {
+      pnlEventType.Visible( true );
+    }else
+    {
+      pnlEventType.Visible( false );
+    }
     
     // Set the Event and the related controls...
     // The values are explicitly assigned here 'at the beginning' to the controls,
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def
index c5a9ec4..df85806 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgEvent/Method_EditEvent.def
@@ -29,7 +29,13 @@
     this.InitializeEventTypes();
     // Must be done here, when done in the OnCreated() the checkmarks are not always set.
     this.InitializeSubscribers();
-    
+    if( guard( sEvent.EventCategory().Name() = LibCal_Event::TYPE_UNAVAILABLE(), false ) )
+    {
+      pnlEventType.Visible( true );
+    }else
+    {
+      pnlEventType.Visible( false );
+    }
     // Open the dialog.
     this.Show( "modal" );
   *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_ListList.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_ListList.def
index f978bc7..e5d9661 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_ListList.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_ListList.def
@@ -12,7 +12,7 @@
       Properties:
       [
         DataType: 'LibCal_EventCategory'
-        FixedFilter: "object.Participation().Calendar().CalendarID() <> 'Common Calendar'"
+        FixedFilter: "object.Participation().Calendar().CalendarID() <> 'Common Calendar' and object.Participation().Event().IsMultiple()"
         Source: 'dhCategory'
         Taborder: 0
         Transformation: 'Event.Participation.ExplicitTimeInterval'
@@ -29,7 +29,7 @@
       ]
       Properties:
       [
-        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Calendar.CalendarID","title":"浜х嚎","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Calendar.CalendarID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.EventType.Name","title":"浜嬩欢绫诲瀷","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.EventType.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.Subject","title":"浜嬩欢","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.Subject"}},{"attribute":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"StartDate","title":"鏃ユ湡","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"object.Start().Date()"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.StartTimeOfDay","title":"寮�濮嬫椂闂�","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.StartTimeOfDay"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.EndTimeOfDay","title":"缁撴潫鏃堕棿","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.EndTimeOfDay"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.Description","title":"澶囨敞","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.Description"}}]'
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Calendar.CalendarID","title":"浜х嚎","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Calendar.CalendarID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.EventType.Name","title":"浜嬩欢绫诲瀷","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.EventType.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.Subject","title":"浜嬩欢","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.Subject"}},{"attribute":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"StartDate","title":"寮�濮嬫棩鏈�","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"object.Start().Date()"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.StartTimeOfDay","title":"寮�濮嬫椂闂�","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.StartTimeOfDay"}},{"attribute":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"缁撴潫鏃ユ湡","title":"缁撴潫鏃ユ湡","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"object.End().Date()"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.EndTimeOfDay","title":"缁撴潫鏃堕棿","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.EndTimeOfDay"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Participation.Event.Description","title":"澶囨敞","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Participation.Event.Description"}}]'
         ContextMenu: 'listContextMenu967'
         SortCriteria: 'desc:Start'
         Taborder: 2
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def"
index 2e8c0e5..c4af7a8 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Component_PanelHeader\043144.def"
@@ -28,6 +28,7 @@
         Label: '寮�濮嬫棩鏈�'
         MaxDuration: P0DT23H59M0S
         MinDuration: P0DT0H0M0S
+        ShowLabel: false
         Taborder: 8
       ]
     }
@@ -52,7 +53,8 @@
         Label: '缁撴潫鏃ユ湡'
         MaxDuration: P0DT23H59M0S
         MinDuration: P0DT0H0M0S
-        Taborder: 10
+        ShowLabel: false
+        Taborder: 12
       ]
     }
     Component dhEndTimeOfDay
@@ -62,7 +64,7 @@
       Databinding: 'Duration'
       Properties:
       [
-        Taborder: 11
+        Taborder: 13
       ]
     }
     Component edtDescription
@@ -77,7 +79,7 @@
         Multiline: true
         NumberOfColumns: 29
         ShowLabel: false
-        Taborder: 13
+        Taborder: 15
       ]
     }
     Component dsStartDate
@@ -87,7 +89,7 @@
       Properties:
       [
         DateFormat: 'DMMY'
-        Label: '鏃ユ湡'
+        Label: '寮�濮嬫棩鏈�'
         Taborder: 6
       ]
     }
@@ -109,7 +111,7 @@
       [
         Label: '澶囨敞'
         NumberOfColumns: 0
-        Taborder: 12
+        Taborder: 14
       ]
     }
     Component ButtonCreate
@@ -119,7 +121,7 @@
       Properties:
       [
         Label: '鏂板'
-        Taborder: 14
+        Taborder: 16
       ]
     }
     Component ddslType id:ddslType_360
@@ -205,6 +207,27 @@
         Taborder: 3
       ]
     }
+    Component dsEndDate
+    {
+      #keys: '[415136.0.923680588]'
+      BaseType: 'WebDateSelector'
+      Properties:
+      [
+        DateFormat: 'DMMY'
+        Label: '缁撴潫鏃ユ湡'
+        Taborder: 10
+      ]
+    }
+    Component dhEndDate
+    {
+      #keys: '[415136.0.923671132]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'Date'
+      Properties:
+      [
+        Taborder: 11
+      ]
+    }
   ]
   Properties:
   [
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def" "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
index a3ed57b..ddcfc95 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateEvent\043778.def"
@@ -48,7 +48,7 @@
     // Set the Participation and the related controls
     // (only the DataHolders, the Date-controls are set later on, after the recurrence has been initialized)
     dhStartDate.Data( sLeadPart.StartDate() );
-    //dhEndDate.Data(   sLeadPart.EndDate()   );
+    dhEndDate.Data(   sLeadPart.EndDate()   );
     dhLeadingParticipation.Data( &sLeadPart );
     dhCategory.Data(category_i);
     //info( '-----------------------', isnull( dhLeadingParticipation.Data() ) );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
index 1b3e681..57599a5 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_CreateUpdateEventAndParticipation.def
@@ -18,7 +18,7 @@
     isDefault      := ckbApplyToNewResources.Checked();
     startDate      := dsStartDate.Date();
     startTimeOfDay := durStartTimeOfDay.Duration();
-    endDate        := dsStartDate.Date();
+    endDate        := dsEndDate.Date();
     endTimeOfDay   := durEndTimeOfDay.Duration();
     isAllDay       := false;
     
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_SetParticipationData.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_SetParticipationData.def
index 12e8065..d57cae5 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_SetParticipationData.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_SetParticipationData.def
@@ -23,6 +23,7 @@
     // the value of the other controls are then set via the responses of these controls.
     //dhEndDate  .Data( sParticipation.EndDate() + delta );
     dsStartDate.Date( startDate );
+    dsEndDate.Date( startDate );
     
     // Directly initialize the Duration
     //this.InitializeDuration();
diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Response_PanelHeader_144_dsEndDate_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Response_PanelHeader_144_dsEndDate_OnChanged.def
new file mode 100644
index 0000000..626e3ed
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Response_PanelHeader_144_dsEndDate_OnChanged.def
@@ -0,0 +1,30 @@
+Quintiq file version 2.0
+#parent: PanelHeader_144/dsEndDate
+Response OnChanged () id:Response_PanelHeader_144_dsEndDate_OnChanged
+{
+  #keys: '[415136.0.923680587]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebDateTimeFieldBase_OnChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      // Adjust the EndDate accordingly.
+      //if( dhStartDate.Data().IsFinite() )
+      //{
+      //  // Use the EndDate of the instance if the value of the control has not been set yet.
+      //  endDate := ifexpr( dsEndDate.Date().IsFinite(), dsEndDate.Date(), dhLeadingParticipation.Data().EndDate() );
+      //
+      //  delta := this.Date() - dhStartDate.Data();
+      //  dsEndDate.Date( endDate + delta );
+      //}
+       
+      // Update the 'memory' for later delta-calculation, and/or setting the time back when AllDay is turned off.
+      dhEndDate.Data( this.Date() );
+      
+      // Also set StartOfPeriod (always, also in case of a non-recurring event).
+      //dsStartOfPeriod.Date( this.Date() );
+    *]
+    GroupServerCalls: false
+  }
+}

--
Gitblit v1.9.3