From c673b37d38537c136cd488b8430146573975d5e3 Mon Sep 17 00:00:00 2001
From: yanyuan <yuan.yan@capgemini.com>
Date: 星期三, 01 十一月 2023 14:28:59 +0800
Subject: [PATCH] Merge branch 'dev' into dev_yy

---
 _Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl |   93 ++++++++++++++++------------------------------
 1 files changed, 33 insertions(+), 60 deletions(-)

diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl
index f860d1f..b96a8a8 100644
--- a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl
@@ -15,73 +15,47 @@
   Description: '鎸夊叆鍙傚鐞嗘暟鎹紝浜х敓闇�瑕佺殑CapacityAndSaleBudgeChartElement'
   TextBody:
   [*
-    // yypsybs Sep-19-2023 (created)
-    // true, false
-    //info( saleOrCapacity );
-    // 鏈�;瀛e害;鍗婂勾;骞�
-    //info( groupBy );
-    // 闈㈡澘鍩哄湴;浜嬩笟閮�
-    //info( byBusinessTypeOrByOrgCode );
-    //traverse( businessTypes, Elements, businessType ) {
-    //  info( "businessType : " + businessType.BusinessType() );
-    //}
-    //traverse( placeOfProductionOfArrays, Elements, placeOfProductionOfArray ) {
-    //  info( "placeOfProductionOfArray : " + placeOfProductionOfArray.PlaceOfProductionOfArray() );
-    //}
-    //traverse( macroPlans, Elements, macroPlan ) {
-    //  info( "macroPlan : " + macroPlan.ScenarioName() );  
-    //}
+    info( "浜ц兘/閿�鍞锛�", saleOrCapacity, "    鏃堕棿鍒嗙粍锛�", groupBy, "    鍩哄湴/浜嬩笟閮細", byBusinessTypeOrByOrgCode );
     // 骞翠唤涓嶉�夋椂鍏ㄩ��
-    if( years.Size() = 0 ) {
-      years := selectsortedset( this, CapacityAndSaleBudgeFilterYear, item, true, item.YearNo() );
+    if ( years.Size() = 0 ) {
+      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
     }
-    //traverse( years, Elements, year ) {
-    //  debuginfo( "yearNo : " + [String]year.YearNo() );
-    //}
     // 鏈堜唤涓嶉�夋椂鍏ㄩ��
-    if( months.Size() = 0 ) {
+    if ( months.Size() = 0 ) {
       months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, item, true, item.MonthNo() );
     }
-    //traverse( months, Elements, month ) {
-    //  debuginfo( "monthNo : " + [String]month.MonthNo() );
-    //}
     
     // ====娓呯悊鏃ф暟鎹�====
     this.CapacityAndSaleBudgeChartRow( relflush );
     this.CapacityAndSaleBudgeChartElement( relflush );
     
     // ====鎸夐潰鏉垮熀鍦板拰浜嬩笟閮ㄥ浜у搧杩涜绛涢�夊垎缁�====
-    historyData := selectset( otdTable, Global_MappingAnnualBudgetData, item, true );
-    if( businessTypes.Size() > 0 ) {
+    targeGlobal_MappingAnnualBudgetDatas := selectset( otdTable, Global_MappingAnnualBudgetData, tempGMABD, true );
+    if ( businessTypes.Size() > 0 ) {
       businessTypeStrings := selectuniquevalues( businessTypes, Elements, item, true, item.BusinessType() );
-      historyData := selectset( historyData, Elements, item, businessTypeStrings.Find( item.BusinessType() ) > -1 );
+      targeGlobal_MappingAnnualBudgetDatas := selectset( targeGlobal_MappingAnnualBudgetDatas, Elements, item, businessTypeStrings.Find( item.BusinessType() ) > -1 );
     }
-    if( placeOfProductionOfArrays.Size() > 0 ) {
+    if ( placeOfProductionOfArrays.Size() > 0 ) {
       placeOfProductionOfArrayStrings := selectuniquevalues( placeOfProductionOfArrays, Elements, item, true, item.PlaceOfProductionOfArray() );
-      historyData := selectset( historyData, Elements, item, placeOfProductionOfArrayStrings.Find( item.OrgCodeFromBom() ) > -1 );
+      targeGlobal_MappingAnnualBudgetDatas := selectset( targeGlobal_MappingAnnualBudgetDatas, Elements, item, placeOfProductionOfArrayStrings.Find( item.OrganCode() ) > -1 );
     }
-    //info( "historyData : " + [String]historyData.Size() );
-    traverse( historyData, Elements, item ) {
-      row := CapacityAndSaleBudgeChartRow::CreateIfNotExist( this, item.BusinessType(), item.OrgCodeFromBom() );
+    info( "閫変腑鐨勪釜鏁�:", targeGlobal_MappingAnnualBudgetDatas.Size() );
+    
+    traverse ( targeGlobal_MappingAnnualBudgetDatas, Elements, gmabd ) {
+      row := CapacityAndSaleBudgeChartRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
       // 璁板綍姣忚鍖呭惈鍝簺product
-      CapacityAndSaleBudgeChartRowProduct::CreateIfNotExist( row, item.ProductID() );
+      CapacityAndSaleBudgeChartRowProduct::CreateIfNotExist( row, gmabd.ProductID() );
     }
+    
     rows := selectset( this, CapacityAndSaleBudgeChartRow, item, true );
-    //info( "rows : " + [String]rows.Size() );
-    placeOfProductionOfArrayList := selectuniquevalues( historyData, Elements, item, item.OrgCodeFromBom() );
-    //traverse( placeOfProductionOfArrayList, Elements, item ) {
-    //  info( "placeOfProduction : " + item );  
-    //}
-    businessTypeList := selectuniquevalues( historyData, Elements, item, item.BusinessType() );
-    //traverse( businessTypeList, Elements, item ) {
-    //  info( "businessType : " + item );  
-    //}
+    placeOfProductionOfArrayList := selectuniquevalues( targeGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, tempGMABD.OrganCode() );
+    businessTypeList := selectuniquevalues( targeGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, tempGMABD.BusinessType() );
+    
     // 鐢熸垚鍥捐〃鍏冪礌
-    traverse( years, Elements, year ) {
-    //  debuginfo( "process year start : " + [String]year.YearNo() );
-      if( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "骞�" ) {
+    traverse ( years, Elements, year ) {
+      if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "骞�" ) {
         // 鐩爣
-        traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+        traverse ( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
           productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
           this.CapacityAndSaleBudgeChartElement( relnew, 
                                                  TimeStringAndScenarioName := [String]year.YearNo() + "骞�-鐩爣",
@@ -89,9 +63,9 @@
                                                  Quantity := ifexpr( saleOrCapacity = "閿�鍞",
                                                                      Global_MappingAnnualBudgetData::GetSaleByYear( productCodeList, otdTable, year.YearNo() ),
                                                                      Global_MappingForecast::GetQuantityByYear( productCodeList, otdTable, year.YearNo() ) )
-                                                 );  
+                                                );
           // S&OP
-          traverse( macroPlans, Elements, macroPlan ) {
+          traverse ( macroPlans, Elements, macroPlan ) {
             this.CapacityAndSaleBudgeChartElement( relnew, 
                                                    TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + macroPlan.ScenarioName(),
                                                    BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
@@ -286,17 +260,16 @@
     //      debuginfo( "process month end : " + [String]month.MonthNo() );
         }
       }
-    //  debuginfo( "process year end : " + [String]year.YearNo() )
     }
-    //info( "CapacityAndSaleBudgeChartElement : " + [String]selectset( this, CapacityAndSaleBudgeChartElement, item, true ).Size() );
-    //traverse( this, CapacityAndSaleBudgeChartRow, row ) {
-    //  info( "==鈫�==" );
-    //  info( row.BusinessType() );
-    //  info( row.PlaceOfProductionOfArray() );
-    //  elements := selectset( row, CapacityAndSaleBudgeChartRowProduct, cell, true );
-    //  info( elements.Size() );
-    //  info( row.GetProductCodes().Concatenate( " | " ) );
-    //  info( "==鈫�==" );
-    //}
+    ////info( "CapacityAndSaleBudgeChartElement : " + [String]selectset( this, CapacityAndSaleBudgeChartElement, item, true ).Size() );
+    ////traverse( this, CapacityAndSaleBudgeChartRow, row ) {
+    ////  info( "==鈫�==" );
+    ////  info( row.BusinessType() );
+    ////  info( row.PlaceOfProductionOfArray() );
+    ////  elements := selectset( row, CapacityAndSaleBudgeChartRowProduct, cell, true );
+    ////  info( elements.Size() );
+    ////  info( row.GetProductCodes().Concatenate( " | " ) );
+    ////  info( "==鈫�==" );
+    ////}
   *]
 }

--
Gitblit v1.9.3