From 3f1616593f199f969223abbd64e3f8cf9a85cc3b Mon Sep 17 00:00:00 2001
From: rislai <risheng.lai@capgemini.com>
Date: 星期一, 17 六月 2024 10:09:23 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_UnitPeriodQuantity/Function_CalcMaxCapacityPerTimeUnit.qbl                                      |   14 +++++++
 _Main/BL/InfoMessages.qbl                                                                                     |    4 ++
 _Main/BL/Type_Routing/StaticMethod_ThermalTrialRatio.qbl                                                      |    6 +-
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_OnOK.def                       |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Response_pnlActions_btnOk_OnClick.def |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_SetDefaultValue.def            |    4 +-
 _Main/BL/Type_UnitPeriodQuantity/_ROOT_Type_UnitPeriodQuantity.qbl                                            |    6 +++
 _Main/BL/Type_Routing/StaticMethod_ValidateThermalTrialRatio.qbl                                              |    7 ++-
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Component_pnlRouting.def              |   17 ++++----
 _Main/BL/Type_Unit/StaticMethod_GetThermalTrial.qbl                                                           |   10 +++++
 10 files changed, 54 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/InfoMessages.qbl b/_Main/BL/InfoMessages.qbl
index ee5f15b..c2762b7 100644
--- a/_Main/BL/InfoMessages.qbl
+++ b/_Main/BL/InfoMessages.qbl
@@ -106,6 +106,10 @@
   {
     DefaultText: 'The Event type of binding Event exists.'
   }
+  InfoMessage MP_Routing_IllegalDateRange
+  {
+    DefaultText: 'The start date cannot be longer than the end date.'
+  }
   InfoMessage MP_Routing_RequiredField
   {
     DefaultText: 'All fields Required This parameter is mandatory.'
diff --git a/_Main/BL/Type_Routing/StaticMethod_ThermalTrialRatio.qbl b/_Main/BL/Type_Routing/StaticMethod_ThermalTrialRatio.qbl
index 601bc91..63d74ca 100644
--- a/_Main/BL/Type_Routing/StaticMethod_ThermalTrialRatio.qbl
+++ b/_Main/BL/Type_Routing/StaticMethod_ThermalTrialRatio.qbl
@@ -2,6 +2,7 @@
 #parent: #root
 StaticMethod ThermalTrialRatio (
   Routing routing,
+  Unit unit,
   Number capacity,
   Date start,
   Date end,
@@ -12,16 +13,15 @@
   TextBody:
   [*
     // Adhi Feb-10-2016 (created)
-    thermaltrial := '鐑紡';
+    thermaltrial := Unit::GetThermalTrial();
     newroutings := construct( Routings );
-    unit := selectobject( routing.MacroPlan(), Unit, unit, unit.ID() = thermaltrial and unit.HasCapacityTypeQuantity() );
     
     for( starttime := start; starttime <= end; starttime := starttime + 1 ){
       uc := selectobject( unit, UnitCapacity, uc, uc.Start().Date() = starttime );
       if( isnull( uc ) ){
         uc := UnitCapacity::Create( unit, starttime.DateTime(), 'Day', 0.0, [Real]capacity, 100.0, 1, false );
       }
-      uc.MaxCapacity( [Real]capacity );
+      uc.MaxCapacity( [Real]capacity * ratio );
     }
     
     newrouting := routing.Copy();
diff --git a/_Main/BL/Type_Routing/StaticMethod_ValidateThermalTrialRatio.qbl b/_Main/BL/Type_Routing/StaticMethod_ValidateThermalTrialRatio.qbl
index ad8089d..9884441 100644
--- a/_Main/BL/Type_Routing/StaticMethod_ValidateThermalTrialRatio.qbl
+++ b/_Main/BL/Type_Routing/StaticMethod_ValidateThermalTrialRatio.qbl
@@ -2,7 +2,7 @@
 #parent: #root
 StaticMethod ValidateThermalTrialRatio (
   output String feedback_o,
-  Routing routing,
+  Unit unit,
   Number capacity,
   Date start,
   Date end,
@@ -15,10 +15,13 @@
     // Adhi Feb-10-2016 (created)
     feedback_o := '';
     
-    if( isnull( routing ) or capacity < 1 or start = Date::MinDate() or end = Date::MinDate() or ratio < 1 ){
+    if( isnull( unit ) or capacity < 1 or start = Date::MinDate() or end = Date::MinDate() or ratio < 1 ){
       feedback_o := Translations::MP_Routing_RequiredField();
     }
     
+    if( start > end ){
+      feedback_o := Translations::MP_Routing_IllegalDateRange();
+    }
     
     return feedback_o = '';
   *]
diff --git a/_Main/BL/Type_Unit/StaticMethod_GetThermalTrial.qbl b/_Main/BL/Type_Unit/StaticMethod_GetThermalTrial.qbl
new file mode 100644
index 0000000..2776c17
--- /dev/null
+++ b/_Main/BL/Type_Unit/StaticMethod_GetThermalTrial.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetThermalTrial () const declarative as String
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-14-2024 (created)
+    return '鐑紡';
+  *]
+}
diff --git a/_Main/BL/Type_UnitPeriodQuantity/Function_CalcMaxCapacityPerTimeUnit.qbl b/_Main/BL/Type_UnitPeriodQuantity/Function_CalcMaxCapacityPerTimeUnit.qbl
new file mode 100644
index 0000000..8e83a4d
--- /dev/null
+++ b/_Main/BL/Type_UnitPeriodQuantity/Function_CalcMaxCapacityPerTimeUnit.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcMaxCapacityPerTimeUnit #extension
+{
+  TextBody:
+  [*
+    value := ifexpr( this.HasUnitCapacity(), this.UnitCapacity().MaxCapacity(), this.MacroPlan().GlobalParameters_MP().DefaultMaxCapacityPerDayForUnit() );
+    
+    if( this.Unit().Name().FindString( Unit::GetThermalTrial(), 0 ) >= 0 ){
+      value := ifexpr( this.HasUnitCapacity() and this.Unit().Name().FindString( '鍓嶆壒閲忕儹寮�', 0 ) >= 0 and this.UnitCapacity().Start() = this.Start(), this.UnitCapacity().MaxCapacity(), this.MacroPlan().GlobalParameters_MP().DefaultMaxCapacityPerDayForUnit() );
+    }
+    this.MaxCapacityPerTimeUnit( value );
+  *]
+}
diff --git a/_Main/BL/Type_UnitPeriodQuantity/_ROOT_Type_UnitPeriodQuantity.qbl b/_Main/BL/Type_UnitPeriodQuantity/_ROOT_Type_UnitPeriodQuantity.qbl
new file mode 100644
index 0000000..c6e12ac
--- /dev/null
+++ b/_Main/BL/Type_UnitPeriodQuantity/_ROOT_Type_UnitPeriodQuantity.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+TypeSpecialization UnitPeriodQuantity #extension
+{
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Component_pnlRouting.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Component_pnlRouting.def
index 0ebdb18..733da60 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Component_pnlRouting.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Component_pnlRouting.def
@@ -5,21 +5,21 @@
   BaseType: 'WebPanel'
   Children:
   [
-    Component ddlRouting
+    Component ddlUnit
     {
       #keys: '[415136.0.756140276]'
       BaseType: 'WebDropDownList'
-      Databinding: 'Routing'
+      Databinding: 'Unit'
       Children:
       [
-        Component DataExtractorRouting
+        Component DataExtractorUnit
         {
           #keys: '[415136.0.756140277]'
           BaseType: 'WebDataExtractor'
           Properties:
           [
-            DataType: 'structured[Routing]'
-            Source: 'dhRoutingSelection'
+            DataType: 'structured[Unit]'
+            Source: 'dhUnitSelection'
             Taborder: 0
             Transformation: 'Elements'
           ]
@@ -28,18 +28,17 @@
       Properties:
       [
         AllowEmpty: true
-        DataBinding: 'dhDialogData.Data'
         DisplayField: 'Name'
         FixedSize: false
-        Label: 'Routing'
+        Label: 'Unit'
         Taborder: 1
       ]
     }
-    Component dhRoutingSelection
+    Component dhUnitSelection
     {
       #keys: '[415136.0.756140424]'
       BaseType: 'WebDataHolder'
-      Databinding: 'structured[Routing]*'
+      Databinding: 'structured[Unit]*'
       Properties:
       [
         MergeStyle: 'Union'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_OnOK.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_OnOK.def
index 6abc3b1..0c62b57 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_OnOK.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_OnOK.def
@@ -12,7 +12,7 @@
     
     data := dhDialogData.Data();
     
-    newroutings := Routing::ThermalTrialRatio( data, [Number]efMaxCapacity.Text(), dsStartTime.Date(), dsEndTime.Date(), [Number]efThermalTrialRatio.Text() );
+    newroutings := Routing::ThermalTrialRatio( data, ddlUnit.Data(), [Number]efMaxCapacity.Text(), dsStartTime.Date(), dsEndTime.Date(), [Number]efThermalTrialRatio.Text() );
     info( '------------web---------------' );
     traverse( newroutings, Elements, e ){
       info( e.Key(), e.Name() );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_SetDefaultValue.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_SetDefaultValue.def
index 331efba..3930cf2 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_SetDefaultValue.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Method_SetDefaultValue.def
@@ -7,8 +7,8 @@
   [*
     // Set default + init dialog
     
-    routings := selectset( MacroPlan, Routing, routing , true );
+    units := selectset( MacroPlan, Unit, unit , unit.HasCapacityTypeQuantity() and unit.Name().FindString( Unit::GetThermalTrial(), 0 ) >= 0 );
     
-    dhRoutingSelection.Data( routings.Copy() );
+    dhUnitSelection.Data( units.Copy() );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Response_pnlActions_btnOk_OnClick.def
index 94cd36f..20dc8c9 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditThermalTrialRatio/Response_pnlActions_btnOk_OnClick.def
@@ -7,7 +7,7 @@
   GroupServerCalls: true
   Precondition:
   [*
-    return Routing::ValidateThermalTrialRatio( feedback, ddlRouting.Data(), [Number]efMaxCapacity.Text(), dsStartTime.Date(), dsEndTime.Date(), [Number]efThermalTrialRatio.Text() );
+    return Routing::ValidateThermalTrialRatio( feedback, ddlUnit.Data(), [Number]efMaxCapacity.Text(), dsStartTime.Date(), dsEndTime.Date(), [Number]efThermalTrialRatio.Text() );
   *]
   QuillAction
   {

--
Gitblit v1.9.3