From bc27afe76dc7bfbb63c8d078d546b97746ebddde Mon Sep 17 00:00:00 2001
From: yypsybs <yypsybs@foxmail.com>
Date: 星期二, 19 九月 2023 11:49:22 +0800
Subject: [PATCH] 年度预算产销复盘填数据

---
 _Main/BL/Relations/Relation_CapacityAndSaleBudgeCompareItemColumn_ScenarioManager_ScenarioManag.qbl                                      |    5 
 _Main/BL/Type_CapacityAndSaleBudge/Method_GetCapacityInSheetInYear.qbl                                                                   |   15 +
 _Main/BL/Type_CapacityAndSaleBudge/Method_GetSaleAmountInYear.qbl                                                                        |   15 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnNo.qbl                                                               |    7 
 _Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByYear.qbl                                                                        |   20 ++
 _Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByMonth.qbl                                                                       |   22 ++
 _Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByYear.qbl                                                                       |   20 ++
 _Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl                                                                     |   75 ++++++---
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_ButtonCapacityAndSaleBudgeCompare_OnClick.def             |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def                |    1 
 _Main/BL/Type_PRData/StaticMethod_TestData.qbl                                                                                           |    2 
 _Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByYear.qbl                                                                             |   20 ++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixeditorContextMenuCapacityAndSaleBudgeCompare.def   |   10 +
 _Main/BL/Type_MappingForecast/StaticMethod_GetByYear.qbl                                                                                 |   20 ++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_MatrixEditorCapacityAndSaleBudgeCompare.def              |   98 ++++++++++++
 /dev/null                                                                                                                                |    7 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Method_GetProductCodes.qbl                                                              |   10 +
 _Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByMonth.qbl                                                                      |   22 ++
 _Main/BL/Type_MappingForecast/StaticMethod_GetByMonth.qbl                                                                                |   21 ++
 _Main/BL/Type_PRData/Method_DoCall.qbl                                                                                                   |    4 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowNo.qbl                                                                     |    7 
 _Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByMonth.qbl                                                                            |   22 ++
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixEditorActionBarPageCapacityAndSaleBudgeCompare.def |   10 +
 23 files changed, 399 insertions(+), 35 deletions(-)

diff --git a/_Main/BL/Relations/Relation_CapacityAndSaleBudgeCompareItemColumn_ScenarioManager_ScenarioManag.qbl b/_Main/BL/Relations/Relation_CapacityAndSaleBudgeCompareItemColumn_ScenarioManager_ScenarioManag.qbl
index a2327e4..07afbdf 100644
--- a/_Main/BL/Relations/Relation_CapacityAndSaleBudgeCompareItemColumn_ScenarioManager_ScenarioManag.qbl
+++ b/_Main/BL/Relations/Relation_CapacityAndSaleBudgeCompareItemColumn_ScenarioManager_ScenarioManag.qbl
@@ -3,8 +3,11 @@
 Relation CapacityAndSaleBudgeCompareItemColumn_ScenarioManager_ScenarioManager_CapacityAndSaleBudgeCompareItemColumn
 {
   #keys: '1[414384.0.816631032]'
-  DefaultRelationStrategy
+  ProceduralSequenceRelationStrategy
   {
+    #keys: '13[0.0.0][414384.0.827659683][414384.0.827659677][414384.0.827659684][414384.0.827659678][414384.0.827659685][414384.0.827659679][414384.0.827659686][414384.0.827659680][414384.0.827659687][414384.0.827659681][414384.0.827659688][414384.0.827659682]'
+    SequenceElementSuffix: 'ColumnInManager'
+    SequenceSuffix: 'ColumnInManager'
   }
   RelationSide.LeftSide ScenarioManager
   {
diff --git a/_Main/BL/Type_CapacityAndSaleBudge/Method_GetCapacityInSheetInYear.qbl b/_Main/BL/Type_CapacityAndSaleBudge/Method_GetCapacityInSheetInYear.qbl
new file mode 100644
index 0000000..561b9d9
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudge/Method_GetCapacityInSheetInYear.qbl
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetCapacityInSheetInYear () as Real
+{
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    result := 0.0;
+    for( i := 1; i <= 12; i := i + 1 ) {
+      field := Reflection::FindAttribute( "CapacityAndSaleBudge", "CapacityInSheetInMonth" + [String]i );
+      result := result + field.GetReal( this );
+    }
+    return result;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudge/Method_GetSaleAmountInYear.qbl b/_Main/BL/Type_CapacityAndSaleBudge/Method_GetSaleAmountInYear.qbl
new file mode 100644
index 0000000..04efa9c
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudge/Method_GetSaleAmountInYear.qbl
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetSaleAmountInYear () as Real
+{
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    result := 0.0;
+    for( i := 1; i <= 12; i := i + 1 ) {
+      field := Reflection::FindAttribute( "CapacityAndSaleBudge", "SaleAmountInMonth" + [String]i );
+      result := result + field.GetReal( this );
+    }
+    return result;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByMonth.qbl b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByMonth.qbl
new file mode 100644
index 0000000..be9cd98
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByMonth.qbl
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetSaleByMonth (
+  Strings productNo,
+  GlobalOTDTable parent,
+  Number yearNo,
+  Number monthNo
+) as Real
+{
+  Description: '閿�鍞锛圵锛�'
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    field := Reflection::FindAttribute( "CapacityAndSaleBudge", "SaleAmountInMonth" + [String]monthNo );
+    value := sum( parent, 
+                  CapacityAndSaleBudge, 
+                  item, 
+                  productNo.Find( item.ProductCode() ) > -1,
+                  field.GetReal( item ) );
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByYear.qbl b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByYear.qbl
new file mode 100644
index 0000000..ef150ed
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSaleByYear.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetSaleByYear (
+  Strings productNo,
+  GlobalOTDTable parent,
+  Number yearNo
+) as Real
+{
+  Description: '閿�鍞锛圵锛�'
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    result := sum( parent, 
+                   CapacityAndSaleBudge, 
+                   item, 
+                   productNo.Find( item.ProductCode() ) > -1,
+                   item.GetSaleAmountInYear() );
+    return result;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByMonth.qbl b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByMonth.qbl
new file mode 100644
index 0000000..35ab669
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByMonth.qbl
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetSheetByMonth (
+  Strings productNo,
+  GlobalOTDTable parent,
+  Number yearNo,
+  Number monthNo
+) as Real
+{
+  Description: '浜ц兘-瀹炴暟澶у紶'
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    field := Reflection::FindAttribute( "CapacityAndSaleBudge", "CapacityInSheetInMonth" + [String]monthNo );
+    value := sum( parent, 
+                  CapacityAndSaleBudge, 
+                  item, 
+                  productNo.Find( item.ProductCode() ) > -1,
+                  field.GetReal( item ) );
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByYear.qbl b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByYear.qbl
new file mode 100644
index 0000000..997d801
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudge/StaticMethod_GetSheetByYear.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetSheetByYear (
+  Strings productNo,
+  GlobalOTDTable parent,
+  Number yearNo
+) as Real
+{
+  Description: '浜ц兘 - 瀹炴暟澶у紶'
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    result := sum( parent, 
+                   CapacityAndSaleBudge, 
+                   item, 
+                   productNo.Find( item.ProductCode() ) > -1,
+                   item.GetCapacityInSheetInYear() );
+    return result;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnNo.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnNo.qbl
new file mode 100644
index 0000000..5e047a1
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnNo.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ColumnNo
+{
+  #keys: '3[414384.0.829650697][414384.0.829650696][414384.0.829650698]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowName.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowName.qbl
deleted file mode 100644
index 296ffa6..0000000
--- a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowName.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute RowName
-{
-  #keys: '3[414384.0.816630960][414384.0.816630959][414384.0.816630961]'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowNo.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowNo.qbl
new file mode 100644
index 0000000..28babc0
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Attribute_RowNo.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute RowNo
+{
+  #keys: '3[414384.0.829650684][414384.0.829650683][414384.0.829650685]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Method_GetProductCodes.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Method_GetProductCodes.qbl
new file mode 100644
index 0000000..a756994
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemRow/Method_GetProductCodes.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+Method GetProductCodes () as owning Strings
+{
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    return selectuniquevalues( this, CapacityAndSaleBudgeCompareItemRowProduct, item, item.ProductCode() );
+  *]
+}
diff --git a/_Main/BL/Type_MappingForecast/StaticMethod_GetByMonth.qbl b/_Main/BL/Type_MappingForecast/StaticMethod_GetByMonth.qbl
new file mode 100644
index 0000000..f289073
--- /dev/null
+++ b/_Main/BL/Type_MappingForecast/StaticMethod_GetByMonth.qbl
@@ -0,0 +1,21 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetByMonth (
+  Strings productCodes,
+  MacroPlan parent,
+  Number monthNo,
+  Number yearNo
+) as Real
+{
+  Description: 'todo changeParent'
+  TextBody:
+  [*
+    // yypsybs Sep-19-2023 (created)
+    value := sum( parent, 
+                  MappingForecast, 
+                  item,
+                  productCodes.Find( item.ProductID() ) > -1 and yearNo = item.StartDate().Year() and monthNo = item.StartDate().Month(), 
+                  item.Price() * item.Quantity() );
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_MappingForecast/StaticMethod_GetByYear.qbl b/_Main/BL/Type_MappingForecast/StaticMethod_GetByYear.qbl
new file mode 100644
index 0000000..ddf0484
--- /dev/null
+++ b/_Main/BL/Type_MappingForecast/StaticMethod_GetByYear.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetByYear (
+  Strings productCodes,
+  MacroPlan parent,
+  Number yearNo
+) as Real
+{
+  Description: 'todo changeParent'
+  TextBody:
+  [*
+    // yypsybs Sep-19-2023 (created)
+    value := sum( parent, 
+                  MappingForecast, 
+                  item,
+                  productCodes.Find( item.ProductID() ) > -1 and yearNo = item.StartDate().Year(), 
+                  item.Price() * item.Quantity() );
+    return value;
+  *]
+}
diff --git a/_Main/BL/Type_PRData/Method_DoCall.qbl b/_Main/BL/Type_PRData/Method_DoCall.qbl
index 9866803..9c99344 100644
--- a/_Main/BL/Type_PRData/Method_DoCall.qbl
+++ b/_Main/BL/Type_PRData/Method_DoCall.qbl
@@ -49,10 +49,10 @@
     result.ReceiveTime( DateTime::Now() );
     
     // 涓昏褰曚慨鏀�
-    result.SendStatus( "T" );
+    result.SendStatus( "宸插彂閫�" );
     result.ReleaseBy( callBy );
     result.SendTime( DateTime::Now() );
-    this.SendStatus( "T" );
+    this.SendStatus( "宸插彂閫�" );
     this.SendTIme( DateTime::Now() );
     this.SendBy( callBy );
     
diff --git a/_Main/BL/Type_PRData/StaticMethod_TestData.qbl b/_Main/BL/Type_PRData/StaticMethod_TestData.qbl
index c70fa0d..0cbffa7 100644
--- a/_Main/BL/Type_PRData/StaticMethod_TestData.qbl
+++ b/_Main/BL/Type_PRData/StaticMethod_TestData.qbl
@@ -21,7 +21,7 @@
                                                                   Number::Random( 9, 12 ),
                                                                   Number::Random( 13, 28 ) ),
                           DataID := [String]Number::Random( 1, Number::MaxNumber() ), 
-                          SendStatus := ifexpr( Number::Random( 1, 5 ) = 1, "T", "" ) );     
+                          SendStatus := ifexpr( Number::Random( 1, 5 ) = 1, "宸插彂閫�", "" ) );     
       }
     }
   *]
diff --git a/_Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByMonth.qbl b/_Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByMonth.qbl
new file mode 100644
index 0000000..1f3fc6a
--- /dev/null
+++ b/_Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByMonth.qbl
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetNewSupplyByMonth (
+  Strings productNo,
+  MacroPlan macroPlan,
+  Number yearNo,
+  Number monthNo
+) as Real
+{
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    result := sum( macroPlan, 
+                   Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, 
+                   item, 
+                   productNo.Find( item.ProductInStockingPoint_MP().Product_MP().ID() ) > -1 
+                   and item.Period_MP().StartDate().Year() = yearNo
+                   and item.Period_MP().StartDate().Month() = monthNo,
+                   item.NewSupplyQuantity() );
+    return result;
+  *]
+}
diff --git a/_Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByYear.qbl b/_Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByYear.qbl
new file mode 100644
index 0000000..4759b98
--- /dev/null
+++ b/_Main/BL/Type_Product_MP/StaticMethod_GetNewSupplyByYear.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetNewSupplyByYear (
+  Strings productNo,
+  MacroPlan macroPlan,
+  Number yearNo
+) as Real
+{
+  TextBody:
+  [*
+    // yypsybs Sep-18-2023 (created)
+    result := sum( macroPlan, 
+                         Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, 
+                         item, 
+                         productNo.Find( item.ProductInStockingPoint_MP().Product_MP().ID() ) > -1 
+                         and item.Period_MP().StartDate().Year() = yearNo, 
+                         item.NewSupplyQuantity() );
+    return result;
+  *]
+}
diff --git a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
index 1c3a3e5..7451626 100644
--- a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
+++ b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
@@ -6,10 +6,11 @@
   CapacityAndSaleBudgeFilterYears years,
   CapacityAndSaleBudgeFilterMonths months,
   MPSync mpSync,
+  GlobalOTDTable otdTable,
   MacroPlan mappingParent
 )
 {
-  Description: 'todo : mappingParent鏀逛负mpSync'
+  Description: 'todo : mappingParent鏀逛负mpSync, random鍒犱簡'
   TextBody:
   [*
     // yypsybs Sep-18-2023 (created)
@@ -77,15 +78,19 @@
     if( CapacityAndSaleBudgeFilterItem::Contains( items, "闈㈡澘鍒嗛厤閲�" ) ) {
       // 鍘嗗彶鏁版嵁
       traverse( months, Elements, month ) {
-        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + "-" + [String]month.MonthNo() + "-骞村害棰勭畻" );
+        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + "-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
         traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+          cellReal := CapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
+          cellReal := Real::Random( 1.0, 999.0 );
+          cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
           cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
         }
       }
-      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + "-total-骞村害棰勭畻" );
+      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-total-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+        cellReal := CapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), otdTable, DateTime::Now().Year() );
+        cellReal := Real::Random( 1.0, 999.0 );
+        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
       // S&OP鏁版嵁
@@ -93,16 +98,20 @@
         traverse( macroPlans, Elements, macroPlan ) {
           traverse( months, Elements, month ) {
             columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, 
-                                                                                    "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "-" + [String]month.MonthNo() + "-" + macroPlan.ScenarioName() );
+                                                                                    "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
             traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+              cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() );
+              cellReal := Real::Random( 1.0, 999.0 );
+              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
               cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
             }
           }
           columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, 
-                                                                                 "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "-total-" + macroPlan.ScenarioName() );
+                                                                                 "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() );
           traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+            cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
+            cellReal := Real::Random( 1.0, 999.0 );
+            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
             cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
           }
         }
@@ -113,30 +122,36 @@
     if( CapacityAndSaleBudgeFilterItem::Contains( items, "閿�鍞" ) ) {
       // 鍘嗗彶鏁版嵁
       traverse( months, Elements, month ) {
-        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + "-" + [String]month.MonthNo() + "-骞村害棰勭畻" );
+        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + "-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
         traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+          cellReal := CapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
+          cellReal := Real::Random( 1.0, 999.0 );
+          cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
           cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
         }
       }
-      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + "-total-骞村害棰勭畻" );
+      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-total-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+        cellReal := CapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), otdTable, DateTime::Now().Year() );
+        cellReal := Real::Random( 1.0, 999.0 );
+        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
       // S&OP鏁版嵁
       traverse( years, Elements, year ) {
         traverse( macroPlans, Elements, macroPlan ) {
           traverse( months, Elements, month ) {
-            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "-" + [String]month.MonthNo() + "-" + macroPlan.ScenarioName() );
+            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
             traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+              cellReal := MappingForecast::GetByMonth( row.GetProductCodes(), mappingParent, year.YearNo(), month.MonthNo() );
+              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
               cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
             }
           }
-          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "-total-" + macroPlan.ScenarioName() );
+          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() );
           traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+            cellReal := MappingForecast::GetByYear( row.GetProductCodes(), mappingParent, year.YearNo() );
+            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
             cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
           }
         }
@@ -148,14 +163,14 @@
       // 鍘嗗彶鏁版嵁
       columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
       // S&OP鏁版嵁
       traverse( macroPlans, Elements, macroPlan ) {
-        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-" + [String]year.YearNo() );
+        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-" + [String]year.YearNo() + "骞�" );
         traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
           cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
         }
       }
@@ -166,20 +181,32 @@
       // 鍘嗗彶鏁版嵁
       columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
       // S&OP鏁版嵁
       traverse( macroPlans, Elements, macroPlan ) {
-        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() );
+        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() + "骞�" );
         traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
           cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
         }
       }
     }
     
-    
+    // 璁剧疆rowNo鍜宑olumnNo
+    info( "set rowNo and columnNo" );
+    rowNo := 1;
+    rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.BusinessType() + "_" + item.OrgCode() );
+    traverse( rowSorted, Elements, item ) {
+      item.RowNo( rowNo );
+      rowNo := rowNo + 1;
+    }
+    columnNo := 1;
+    traverse( this, CapacityAndSaleBudgeCompareItemColumn, item ) {
+      item.ColumnNo( columnNo );
+      columnNo := columnNo + 1;
+    }
     info( "done" );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_MatrixEditorCapacityAndSaleBudgeCompare.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_MatrixEditorCapacityAndSaleBudgeCompare.def
new file mode 100644
index 0000000..db394b0
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_MatrixEditorCapacityAndSaleBudgeCompare.def
@@ -0,0 +1,98 @@
+Quintiq file version 2.0
+Component MatrixEditorCapacityAndSaleBudgeCompare
+{
+  #keys: '[414384.0.828942477]'
+  BaseType: 'WebMatrixEditor'
+  Children:
+  [
+    Component MatrixEditorCellCapacityAndSaleBudgeCompare
+    {
+      #keys: '[414384.0.828942478]'
+      BaseType: 'WebMatrixEditorCell'
+      Children:
+      [
+        Component DataExtractorCapacityAndSaleBudgeCompare
+        {
+          #keys: '[414384.0.828942479]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'ScenarioManager'
+            Source: 'ScenarioManager'
+            Taborder: 0
+            Transformation: 'CapacityAndSaleBudgeCompareItemColumn.CapacityAndSaleBudgeCompareItemCell'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Attributes: 'CellContent'
+        Column: 'CapacityAndSaleBudgeCompareItemColumn'
+        Row: 'CapacityAndSaleBudgeCompareItemRow'
+        Taborder: 0
+      ]
+    }
+    Component MatrixEditorRowsCapacityAndSaleBudgeCompare
+    {
+      #keys: '[414384.0.828942482]'
+      BaseType: 'WebMatrixEditorHeaderLevel'
+      Children:
+      [
+        Component DataExtractor385
+        {
+          #keys: '[414384.0.828942483]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'ScenarioManager'
+            Source: 'ScenarioManager'
+            Taborder: 0
+            Transformation: 'CapacityAndSaleBudgeCompareItemRow'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Legend: 'RowNo'
+        SortCriteria: 'RowNo'
+        Taborder: 1
+      ]
+    }
+    Component MatrixEditorColumnsCapacityAndSaleBudgeCompare
+    {
+      #keys: '[414384.0.828942486]'
+      BaseType: 'WebMatrixEditorHeaderLevel'
+      Children:
+      [
+        Component DataExtractor224
+        {
+          #keys: '[414384.0.828942487]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'ScenarioManager'
+            Source: 'ScenarioManager'
+            Taborder: 0
+            Transformation: 'CapacityAndSaleBudgeCompareItemColumn'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Legend: 'ColumnName'
+        SortCriteria: 'ColumnNo'
+        Taborder: 2
+      ]
+    }
+    #child: matrixEditorActionBarPageCapacityAndSaleBudgeCompare
+    #child: matrixeditorContextMenuCapacityAndSaleBudgeCompare
+  ]
+  Properties:
+  [
+    Columns: 'MatrixEditorColumnsCapacityAndSaleBudgeCompare'
+    ContextMenu: 'matrixeditorContextMenuCapacityAndSaleBudgeCompare'
+    Editable: false
+    Rows: 'MatrixEditorRowsCapacityAndSaleBudgeCompare'
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixEditorActionBarPageCapacityAndSaleBudgeCompare.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixEditorActionBarPageCapacityAndSaleBudgeCompare.def
new file mode 100644
index 0000000..4311894
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixEditorActionBarPageCapacityAndSaleBudgeCompare.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component matrixEditorActionBarPageCapacityAndSaleBudgeCompare
+{
+  #keys: '[414384.0.828942490]'
+  BaseType: 'matrixEditorActionBarPage'
+  Properties:
+  [
+    Taborder: 3
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixeditorContextMenuCapacityAndSaleBudgeCompare.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixeditorContextMenuCapacityAndSaleBudgeCompare.def
new file mode 100644
index 0000000..24036f0
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Component_matrixeditorContextMenuCapacityAndSaleBudgeCompare.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component matrixeditorContextMenuCapacityAndSaleBudgeCompare
+{
+  #keys: '[414384.0.828942493]'
+  BaseType: 'matrixeditorContextMenu'
+  Properties:
+  [
+    Taborder: 4
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_ButtonCapacityAndSaleBudgeCompare_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_ButtonCapacityAndSaleBudgeCompare_OnClick.def
index 1309dca..33f805e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_ButtonCapacityAndSaleBudgeCompare_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_ButtonCapacityAndSaleBudgeCompare_OnClick.def
@@ -15,6 +15,7 @@
                                                    DataHolderCapacityAndSaleBudgeFilterYear.Data(), 
                                                    DataHolderCapacityAndSaleBudgeFilterMonth.Data(),
                                                    MPSync, 
+                                                   GlobalOTDTable,
                                                    MacroPlan );
     *]
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def
index 499f57c..ec18fe9 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/_ROOT_Component_FormCapacityAndSaleBudgeCompare.def
@@ -17,6 +17,7 @@
         Taborder: 0
       ]
     }
+    #child: MatrixEditorCapacityAndSaleBudgeCompare
   ]
   Properties:
   [

--
Gitblit v1.9.3