From b6e625253aef34494a2e6e0ba70f02281b50302f Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期一, 06 十一月 2023 10:08:45 +0800
Subject: [PATCH] 年度产销增加运行状态

---
 _Main/BL/Type_CapacityAndSaleBudgeRunStatus/_ROOT_Type_CapacityAndSaleBudgeRunStatus.qbl                                                 |    9 ++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def                |   25 ++++++
 _Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl                                                                        |   41 ++++++++-
 _Main/BL/Type_CapacityAndSaleBudgeRunStatus/Attribute_RunSataus.qbl                                                                      |    7 +
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_pButton.def                                              |    1 
 _Main/BL/Type_GlobalOTDSOP/Method_AsyncCapacityAndSaleBudgeCompare.qbl                                                                   |   24 ++++++
 _Main/BL/Type_GlobalOTDSOP/Method_SetCapacityAndSaleBudgeRunStatus.qbl                                                                   |   10 ++
 _Main/BL/Relations/Relation_CapacityAndSaleBudgeRunStatus_GlobalOTDSOP_GlobalOTDSOP_CapacityAnd.qbl                                      |   23 +++++
 _Main/BL/Type_GlobalOTDSOP/StaticMethod_Test.qbl                                                                                         |   14 +++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_dhStatus_OnDataChanged.def                                |   25 ++++++
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_ExecuteAsyncCapacityAndSaleBudgeCompare.qbl                               |   12 +++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Method_CreateCapacityAndSaleBudgeCompareData.def                   |   22 +++-
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick#231.def |    2 
 13 files changed, 199 insertions(+), 16 deletions(-)

diff --git a/_Main/BL/Relations/Relation_CapacityAndSaleBudgeRunStatus_GlobalOTDSOP_GlobalOTDSOP_CapacityAnd.qbl b/_Main/BL/Relations/Relation_CapacityAndSaleBudgeRunStatus_GlobalOTDSOP_GlobalOTDSOP_CapacityAnd.qbl
new file mode 100644
index 0000000..8f4f50d
--- /dev/null
+++ b/_Main/BL/Relations/Relation_CapacityAndSaleBudgeRunStatus_GlobalOTDSOP_GlobalOTDSOP_CapacityAnd.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation CapacityAndSaleBudgeRunStatus_GlobalOTDSOP_GlobalOTDSOP_CapacityAndSaleBudgeRunStatus
+{
+  #keys: '1[414702.1.385990039]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide GlobalOTDSOP
+  {
+    #keys: '3[414702.1.385990041][414702.1.385990040][414702.1.385990042]'
+    Cardinality: '0to1'
+    ObjectDefinition: CapacityAndSaleBudgeRunStatus
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide CapacityAndSaleBudgeRunStatus
+  {
+    #keys: '3[414702.1.385990044][414702.1.385990043][414702.1.385990045]'
+    Cardinality: '0to1'
+    ObjectDefinition: GlobalOTDSOP
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_ExecuteAsyncCapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_ExecuteAsyncCapacityAndSaleBudgeCompare.qbl
new file mode 100644
index 0000000..b4c7ae8
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_ExecuteAsyncCapacityAndSaleBudgeCompare.qbl
@@ -0,0 +1,12 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod ExecuteAsyncCapacityAndSaleBudgeCompare (
+  GlobalOTDSOP globalOTDSOP,
+  MacroPlans macroPlans
+)
+{
+  TextBody:
+  [*
+    // hongjli Nov-6-2023 (created)
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeRunStatus/Attribute_RunSataus.qbl b/_Main/BL/Type_CapacityAndSaleBudgeRunStatus/Attribute_RunSataus.qbl
new file mode 100644
index 0000000..9dd2404
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeRunStatus/Attribute_RunSataus.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute RunSataus
+{
+  #keys: '3[414702.1.385990030][414702.1.385990029][414702.1.385990031]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeRunStatus/_ROOT_Type_CapacityAndSaleBudgeRunStatus.qbl b/_Main/BL/Type_CapacityAndSaleBudgeRunStatus/_ROOT_Type_CapacityAndSaleBudgeRunStatus.qbl
new file mode 100644
index 0000000..83963ff
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeRunStatus/_ROOT_Type_CapacityAndSaleBudgeRunStatus.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type CapacityAndSaleBudgeRunStatus
+{
+  #keys: '5[414702.1.385990024][414702.1.385990022][0.0.0][414702.1.385990023][414702.1.385990025]'
+  BaseType: Object
+  StructuredName: 'CapacityAndSaleBudgeRunStatuss'
+}
diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_AsyncCapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_AsyncCapacityAndSaleBudgeCompare.qbl
new file mode 100644
index 0000000..2794ebb
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_AsyncCapacityAndSaleBudgeCompare.qbl
@@ -0,0 +1,24 @@
+Quintiq file version 2.0
+#parent: #root
+Method AsyncCapacityAndSaleBudgeCompare (
+  MacroPlans macroPlans,
+  CapacityAndSaleBudgeFilterItems items,
+  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months,
+  const GlobalOTDTable globalOTDTable
+)
+{
+  TextBody:
+  [*
+    this -> CapacityAndSaleBudgeCompare( macroPlans,
+                                         items,
+                                         casbfpopoas,
+                                         casbfbts,
+                                         years,
+                                         months,
+                                         globalOTDTable )
+         -> SetCapacityAndSaleBudgeRunStatus();
+  *]
+}
diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
index 3c6bcf9..8a96743 100644
--- a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
@@ -2,13 +2,13 @@
 #parent: #root
 Method CapacityAndSaleBudgeCompare (
   MacroPlans macroPlans,
-  owning CapacityAndSaleBudgeFilterItems items,
-  owning CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
-  owning CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
-  owning CapacityAndSaleBudgeFilterYears years,
-  owning CapacityAndSaleBudgeFilterMonths months,
+  CapacityAndSaleBudgeFilterItems items,
+  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months,
   const GlobalOTDTable globalOTDTable
-)
+) as stream[GlobalOTDSOP]
 {
   Description: 'todo : mappingParent鏀逛负mpSync, random鍒犱簡'
   TextBody:
@@ -16,12 +16,39 @@
     this.CapacityAndSaleBudgeCompareItemRow( relflush );
     this.CapacityAndSaleBudgeCompareItemColumn( relflush );
     
-    CapacityAndSaleBudgeCompareItemCell::SetFilterCriteria( this, &items, &casbfpopoas, &casbfbts, &years, &months );
+    //CapacityAndSaleBudgeCompareItemCell::SetFilterCriteria( this, &items, &casbfpopoas, &casbfbts, &years, &months );
+    //---------------------------------------------------------------------------
+    if ( items.Size() = 0 ) {
+      items := selectset( this, CapacityAndSaleBudgeFilterItem, tempCASBFI, tempCASBFI.ItemName() = "閿�鍞" );
+    }
+    
+    if ( casbfpopoas.Size() = 0 ) {
+      casbfpopoas := selectset( this, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, true );
+    }
+    
+    if ( casbfbts.Size() = 0 ) {
+      casbfbts := selectset( this, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, true );
+    }
+    
+    if ( years.Size() = 0 ) {
+      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
+    } else {
+      years := selectsortedset( years, Elements, tempCASBFY, true, tempCASBFY.YearNo() );
+    }
+    
+    if ( months.Size() = 0 ) {
+      months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, tempCASBFM, true, tempCASBFM.MonthNo() );
+    } else {
+      months := selectsortedset( months, Elements, tempCASBFM, true, tempCASBFM.MonthNo() );
+    }
+    //---------------------------------------------------------------------------
     
     CapacityAndSaleBudgeCompareItemCell::GenerateBasicDataBasedOnFilteringCriteria( this, globalOTDTable, items, casbfpopoas, casbfbts );
     
     CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeData( macroPlans, globalOTDTable, this, items, years, months );
     
     CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocation( macroPlans, globalOTDTable, this, items, years, months );
+    
+    return emit( this );
   *]
 }
diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_SetCapacityAndSaleBudgeRunStatus.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_SetCapacityAndSaleBudgeRunStatus.qbl
new file mode 100644
index 0000000..e51a52c
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_SetCapacityAndSaleBudgeRunStatus.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetCapacityAndSaleBudgeRunStatus
+{
+  TextBody:
+  [*
+    this.CapacityAndSaleBudgeRunStatus( relflush );
+    this.CapacityAndSaleBudgeRunStatus( relnew, RunSataus := 0 );
+  *]
+}
diff --git a/_Main/BL/Type_GlobalOTDSOP/StaticMethod_Test.qbl b/_Main/BL/Type_GlobalOTDSOP/StaticMethod_Test.qbl
new file mode 100644
index 0000000..4845329
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDSOP/StaticMethod_Test.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Test (
+  GlobalOTDSOP this,
+  MacroPlans macroPlans,
+  owning CapacityAndSaleBudgeFilterItems items,
+  owning CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  owning CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
+  owning CapacityAndSaleBudgeFilterYears years,
+  owning CapacityAndSaleBudgeFilterMonths months,
+  const GlobalOTDTable globalOTDTable
+)
+{
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_pButton.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_pButton.def
index 17752fe..9c37840 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_pButton.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_pButton.def
@@ -35,7 +35,6 @@
       [
         Image: 'CHECK'
         Taborder: 2
-        Visible: false
       ]
     }
   ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Method_CreateCapacityAndSaleBudgeCompareData.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Method_CreateCapacityAndSaleBudgeCompareData.def
index a5f829e..209916a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Method_CreateCapacityAndSaleBudgeCompareData.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Method_CreateCapacityAndSaleBudgeCompareData.def
@@ -21,12 +21,20 @@
                                                        exists( DataHolderCapacityAndSaleBudgeFilterMonth.Data(), Elements, tempCASBFM1, tempCASBFM1 = tempCASBFM ) );
     
     
-    GlobalOTDSOP.CapacityAndSaleBudgeCompare( DataHolderMacroPlansForScenarioComparison.Data(), 
-                                              &targetCapacityAndSaleBudgeFilterItem,
-                                              &targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray,
-                                              &targetCapacityAndSaleBudgeFilterBusinessType,
-                                              &targetCapacityAndSaleBudgeFilterYear, 
-                                              &targetCapacityAndSaleBudgeFilterMonth,
-                                              GlobalOTDTable );
+    //GlobalOTDSOP.CapacityAndSaleBudgeCompare( DataHolderMacroPlansForScenarioComparison.Data(), 
+    //                                          targetCapacityAndSaleBudgeFilterItem,
+    //                                          targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray,
+    //                                          targetCapacityAndSaleBudgeFilterBusinessType,
+    //                                          targetCapacityAndSaleBudgeFilterYear, 
+    //                                          targetCapacityAndSaleBudgeFilterMonth,
+    //                                          GlobalOTDTable );
+    
+    GlobalOTDSOP.AsyncCapacityAndSaleBudgeCompare( DataHolderMacroPlansForScenarioComparison.Data(), 
+                                                   targetCapacityAndSaleBudgeFilterItem,
+                                                   targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray,
+                                                   targetCapacityAndSaleBudgeFilterBusinessType,
+                                                   targetCapacityAndSaleBudgeFilterYear, 
+                                                   targetCapacityAndSaleBudgeFilterMonth,
+                                                   GlobalOTDTable );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_dhStatus_OnDataChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_dhStatus_OnDataChanged.def
new file mode 100644
index 0000000..3b2161a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_dhStatus_OnDataChanged.def
@@ -0,0 +1,25 @@
+Quintiq file version 2.0
+#parent: dhStatus
+Response OnDataChanged () id:Response_FormCapacityAndSaleBudgeCompare_dhStatus_OnDataChanged
+{
+  #keys: '[414702.1.383710704]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnDataChanged'
+  QuillAction
+  {
+    Body:
+    [*
+      if ( guard( this.Data().RunSataus() = 1, false ) ) {
+        ButtonCapacityAndSaleBudgeCompare.Enabled( false, "姝e湪杩愯" );
+        Image116.Image( "MEDIA_PLAY_GREEN" );
+      } else if ( guard( this.Data().RunSataus() = 0, false ) ) {
+        ButtonCapacityAndSaleBudgeCompare.Enabled( true, "姝e湪杩愯" );
+        Image116.Image( "CHECK" );
+      } else {
+        ButtonCapacityAndSaleBudgeCompare.Enabled( true, "姝e湪杩愯" );
+        Image116.Image( "CHECK" );
+      }
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def"
index 0362709..3e8cd8f 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def"
@@ -10,7 +10,7 @@
     Body:
     [*
       GlobalOTDSOP.CapacityAndSaleBudgeRunStatus( relflush );
-      GlobalOTDSOP.CapacityAndSaleBudgeRunStatus( relnew, RunStatus := 1 );
+      GlobalOTDSOP.CapacityAndSaleBudgeRunStatus( relnew, RunSataus := 1 );
       
       Form.CreateCapacityAndSaleBudgeCompareData();
       
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def
index d5e9525..fd88e20 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def
@@ -9,6 +9,31 @@
   [
     #child: MatrixEditorCapacityAndSaleBudgeCompare
     #child: pButton
+    Component dhStatus
+    {
+      #keys: '[414702.1.386200525]'
+      BaseType: 'WebDataHolder'
+      Databinding: 'CapacityAndSaleBudgeRunStatus'
+      Children:
+      [
+        Component deStatus
+        {
+          #keys: '[414702.1.386200546]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'GlobalOTDSOP'
+            Source: 'GlobalOTDSOP'
+            Taborder: 0
+            Transformation: 'CapacityAndSaleBudgeRunStatus'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Taborder: 2
+      ]
+    }
   ]
   Properties:
   [

--
Gitblit v1.9.3