From 7f68c5b2e96c6707be1589ff8b5fbdcdab53f412 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 27 五月 2024 20:57:52 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeCapacity.def |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeCapacity.def b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeCapacity.def
new file mode 100644
index 0000000..4dc84ac
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_LibCal_dlgMultipleEvent/Method_InitializeCapacity.def
@@ -0,0 +1,49 @@
+Quintiq file version 2.0
+#parent: #root
+Method InitializeCapacity () id:Method_LibCal_dlgMultipleEvent_InitializeCapacity
+{
+  #keys: '[415136.0.647371166]'
+  Body:
+  [*
+    // Extensible method USE_PARTIAL_CAPACITY indicates if partial capacity is allowed.
+    // If so, then add it as possible option.
+    useParticalCapacity := LibCal_Event::USE_PARTIAL_CAPACITY();
+    
+    if( useParticalCapacity )
+    {
+      ddslType.Strings( ddslType.Strings() + ";" + LibCal_Event::TYPE_PARTIAL() );
+    }
+    
+    event     := dhEvent.Data();
+    eventType := event.Type();
+    
+    // See if the eventType can be used as is or if it should be converted first.
+    if( useParticalCapacity )
+    {
+      ddslType.Text( eventType );
+    }
+    else
+    {
+      // Partial capacity should not be used. Convert it to Unavailable or Available.
+      // This is an edge case that can only happen via import, or when using partial capacity was first enabled and later disabled.
+      if( eventType = LibCal_Event::TYPE_PARTIAL() )
+      {
+        if( event.PartialCapacity() = 0.0 )
+        {
+          eventType := LibCal_Event::TYPE_UNAVAILABLE();
+        }
+        else
+        {
+          eventType := LibCal_Event::TYPE_AVAILABLE();
+        }
+    
+        // Show a message to inform the user that the EventType and Capacity was changed.
+        capacity := LibCal_GlobalState.RealToString( event.PartialCapacity() );
+        WebMessageBox::Warning( "The event type was 'Partial' with Capacity = " + capacity + ", but partial capacity is not enabled."
+                              + "The event type is set to '" + eventType + "'.", false, false );
+      }
+    
+      ddslType.Text( eventType );
+    }
+  *]
+}

--
Gitblit v1.9.3