From 3bd62f5f68dfab21885d9b3f6c5d4e4defadae42 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期一, 30 十月 2023 15:21:58 +0800
Subject: [PATCH] 年度产销复盘BUG修改

---
 _Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl |  247 ++++++++++++++++++++++++++++--------------------
 1 files changed, 144 insertions(+), 103 deletions(-)

diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
index 64a208a..0ba67ec 100644
--- a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
@@ -11,35 +11,22 @@
   Description: 'todo : mappingParent鏀逛负mpSync, random鍒犱簡'
   TextBody:
   [*
-    // yypsybs Sep-18-2023 (created)
     // ====涓嶉�夋椂榛樿鍏ㄩ��====
-    if( years.Size() = 0 ) {
-      years := selectsortedset( this, CapacityAndSaleBudgeFilterYear, item, item.YearNo() );
+    if ( years.Size() = 0 ) {
+      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
     }
-    if( months.Size() = 0 ) {
+    if ( months.Size() = 0 ) {
       months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, item, item.MonthNo() );
     }
-    traverse( macroPlans, Elements, item ) {
-      debuginfo( "scenario : " + item.ScenarioName() );
-    }
-    traverse( items, Elements, item ) {
-      debuginfo( "item : " + item.ItemName() );
-    }
-    traverse( years, Elements, item ) {
-      debuginfo( "year : " + [String]item.YearNo() );
-    }
-    traverse( months, Elements, item ) {
-      debuginfo( "month : " + [String]item.MonthNo() );
-    }
-    // ====娓呯悊鏃ф暟鎹�====
+    
     this.CapacityAndSaleBudgeCompareItemRow( relflush );
     this.CapacityAndSaleBudgeCompareItemColumn( relflush );
-    // ====姹囨�绘墍鏈夊嚭鐜扮殑浜у搧====
-    historyData := selectset( otdTable, Global_MappingAnnualBudgetData, item, true );
-    debuginfo( "historyData : " + [String]historyData.Size() );
     
-    traverse( historyData, Elements, one ) {
-      productCode := one.ProductID();
+    // ====姹囨�绘墍鏈夊嚭鐜扮殑浜у搧====
+    targetglobal_MappingAnnualBudgetData := selectset( otdTable, Global_MappingAnnualBudgetData, item, true );
+    
+    traverse ( targetglobal_MappingAnnualBudgetData, Elements, gmabd ) {
+      productCode := gmabd.ProductID();
     //  Global_MappingOperationBOM::CreateTestData( otdTable, "浜嬩笟閮�" + [String](productCode.Length() mod 3), "闈㈡澘鍩哄湴" + [String](productCode.Length() mod 4), productCode );
     //  boms := selectset( otdTable, Global_MappingOperationBOM, bom, bom.ProductCode() = productCode );
     //  if( boms.Size() > 0 ) {
@@ -47,17 +34,16 @@
     //    businessType := bom.BusinessType();
     //    placeOfProductionOfArray := bom.OrganCode();
         // 鐩稿悓闈㈡澘鍩哄湴鍜屼簨涓氶儴鐨勬斁涓�琛�
-        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, one.BusinessType(), one.OrgCodeFromBom() );
+        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
         // 璁板綍姣忚鍖呭惈鍝簺product
         CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
     //  } else {
     //    debuginfo( "no boms for product : " + productCode );
     //  }
     }
-    debuginfo( "CapacityAndSaleBudgeCompareItemRow : " + [String]selectset( this, CapacityAndSaleBudgeCompareItemRow, item, true ).Size() );
+    
     // ====浠庡乏鍚戝彸鐢熸垚鍒楀ご涓庡唴瀹�====
     // 浜嬩笟閮紝闈㈡澘鍩哄湴
-    debuginfo( "dealing businessType and placeOfProductionOfArray" )
     columnBusinessType := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜嬩笟閮�" );
     columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍩哄湴" );
     traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
@@ -66,100 +52,159 @@
       cell := columnPlaceOfProductionOfArray.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.PlaceOfProductionOfArray() );
       cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
     }
+    
     // 闈㈡澘鍒嗛厤閲� - 骞村害棰勭畻 (sheets)
     // 鏍煎紡锛� 闈㈡澘鍒嗛厤閲� - 骞� - 鏈堬紙1-12 & total锛� - 骞村害棰勭畻/scenarioName
-    debuginfo( "dealing 闈㈡澘鍒嗛厤閲�" )
-    if( CapacityAndSaleBudgeFilterItem::Contains( items, "闈㈡澘鍒嗛厤閲�" ) ) {
-      traverse( years, Elements, year ) {
-        debuginfo( "闈㈡澘鍒嗛厤閲�" + [String]year.YearNo() + "骞�" );
+    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "闈㈡澘鍒嗛厤閲�" ) ) {
+      traverse ( years, Elements, year ) {
         // 鍘嗗彶鏁版嵁
-        debuginfo( "闈㈡澘鍒嗛厤閲�" + [String]year.YearNo() + "骞村巻鍙叉暟鎹�" );
-        traverse( months, Elements, month ) {
-          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
-          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-            cellReal := Global_MappingForecast::GetQuantityByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
-            cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //    traverse ( months, Elements, month ) {
+    //      columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
+    //      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //        cellReal := Global_MappingForecast::GetQuantityByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
+    //        cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+    //        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //      }
+    //    }
+    //    columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-骞村害棰勭畻" );
+    //    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //      cellReal := Global_MappingForecast::GetQuantityByYear( row.GetProductCodes(), otdTable, year.YearNo() );
+    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //    }
+        
+        traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+          total := 0.0;
+          traverse ( months, Elements, m ) {
+            columnName  := "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]m.MonthNo() + "鏈�-骞村害棰勭畻";
+            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
+            cellReal    := Global_MappingForecast::GetQuantityByMonth( casbcir.GetProductCodes(), otdTable, DateTime::Now().Year(), m.MonthNo() );
+            cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+            total       := total + cellReal;
+            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
           }
+          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-骞村害棰勭畻" );
+          cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
+          columnYear.TotalIdentification( year.YearNo() );
+          cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
         }
-        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-骞村害棰勭畻" );
-        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cellReal := Global_MappingForecast::GetQuantityByYear( row.GetProductCodes(), otdTable, year.YearNo() );
-          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
-        }
-        debuginfo( "闈㈡澘鍒嗛厤閲�" + [String]year.YearNo() + "骞碨&OP鏁版嵁" );
+        
         // S&OP鏁版嵁
-        traverse( macroPlans, Elements, macroPlan ) {
-          traverse( months, Elements, month ) {
-            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, 
-                                                                                    "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
-            traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-              cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() );
-              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-              cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //    traverse ( macroPlans, Elements, macroPlan ) {
+    //      traverse ( months, Elements, month ) {
+    //        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, 
+    //                                                                                "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
+    //        traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //          cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, 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() );
+    //      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //        cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
+    //        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+    //        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //      }
+    //    }
+        traverse ( macroPlans, Elements, mp ) {
+          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+            total := 0.0;
+            traverse ( months, Elements, m ) {
+              columnName  := "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]m.MonthNo() + "鏈�-" + mp.ScenarioName();
+              columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
+              cellReal    := Product_MP::GetNewSupplyByMonth( casbcir.GetProductCodes(), mp, year.YearNo(), m.MonthNo() );
+              cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+              total       := total + cellReal;
+              cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
             }
-          }
-          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, 
-                                                                                 "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() );
-          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-            cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
-            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+            columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-" + mp.ScenarioName() );
+            cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
+            columnYear.TotalIdentification( year.YearNo() );
+            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
           }
         }
       }
     }
+    
     // 骞村害閿�鍞
-    debuginfo( "dealing 閿�鍞" )
-    if( CapacityAndSaleBudgeFilterItem::Contains( items, "閿�鍞" ) ) {
-      traverse( years, Elements, year ) {
-        debuginfo( "閿�鍞" + [String]year.YearNo() + "骞�" );
+    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "閿�鍞" ) ) {
+      traverse ( years, Elements, year ) {
         // 鍘嗗彶鏁版嵁
-        debuginfo( "閿�鍞" + [String]year.YearNo() + "骞村巻鍙叉暟鎹�" );
-        traverse( months, Elements, month ) {
-          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
-          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-            cellReal := Global_MappingAnnualBudgetData::GetSaleByMonth( row.GetProductCodes(), otdTable, year.YearNo(), month.MonthNo() );
-            cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //    traverse ( months, Elements, month ) {
+    //      columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
+    //      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //        cellReal := Global_MappingAnnualBudgetData::GetSaleByMonth( row.GetProductCodes(), otdTable, year.YearNo(), month.MonthNo() );
+    //        cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+    //        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //      }
+    //    }
+    //    columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-骞村害棰勭畻" );
+    //    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //      cellReal := Global_MappingAnnualBudgetData::GetSaleByYear( row.GetProductCodes(), otdTable, year.YearNo() );
+    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //    }
+        traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+          total := 0.0;
+          traverse ( months, Elements, m ) {
+            columnName  := "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]m.MonthNo() + "鏈�-骞村害棰勭畻";
+            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
+            cellReal    := Global_MappingAnnualBudgetData::GetSaleByMonth( casbcir.GetProductCodes(), otdTable, year.YearNo(), m.MonthNo() );
+            cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+            total       := total + cellReal;
+            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
           }
+          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-total-骞村害棰勭畻" );
+          cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
+          columnYear.TotalIdentification( year.YearNo() );
+          cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
         }
-        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-骞村害棰勭畻" );
-        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cellReal := Global_MappingAnnualBudgetData::GetSaleByYear( row.GetProductCodes(), otdTable, year.YearNo() );
-          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
-        }
-        debuginfo( "閿�鍞" + [String]year.YearNo() + "骞村巻鍙叉暟鎹甋&OP鏁版嵁" );
+        
         // S&OP鏁版嵁
-        traverse( macroPlans, Elements, macroPlan ) {
-          traverse( months, Elements, month ) {
-            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
-            traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-              cellReal := Forecast::GetFulfilledBalanceByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() );
-              cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-              cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //    traverse ( macroPlans, Elements, macroPlan ) {
+    //      traverse ( months, Elements, month ) {
+    //        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
+    //        traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //          cellReal := Forecast::GetFulfilledBalanceByMonth( row.GetProductCodes(), macroPlan, 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() );
+    //      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+    //        // QID 23
+    //        cellReal := Forecast::GetFulfilledBalanceByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
+    //        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+    //        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+    //      }
+    //    }
+        traverse ( macroPlans, Elements, mp ) {
+          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+            total := 0.0;
+            traverse ( months, Elements, m ) {
+              columnName  := "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]m.MonthNo() + "鏈�-" + mp.ScenarioName();
+              columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
+              cellReal    := Forecast::GetFulfilledBalanceByMonth( casbcir.GetProductCodes(), mp, year.YearNo(), m.MonthNo() );
+              cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
+              total       := total + cellReal;
+              cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
             }
-          }
-          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() );
-          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-            // QID 23
-            cellReal := Forecast::GetFulfilledBalanceByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
-            cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
-            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
+            columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-total-" + mp.ScenarioName() );
+            cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
+            columnYear.TotalIdentification( year.YearNo() );
+            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
           }
         }
       }
     }
+    
     // 澶у紶鐩堝埄棰�
-    debuginfo( "dealing 澶у紶鐩堝埄棰�" )
-    traverse( years, Elements, year ) {
+    traverse ( years, Elements, year ) {
       // 鍘嗗彶鏁版嵁
       columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-" + [String]year.YearNo() + "骞�-骞村害棰勭畻" );
-      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        // todo 
-        // QID 23
+      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
         cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
@@ -173,19 +218,17 @@
       }
     }
     // 浜у搧鐩堝埄棰�
-    debuginfo( "dealing 浜у搧鐩堝埄棰�" )
-    traverse( years, Elements, year ) {
+    traverse ( years, Elements, year ) {
       // 鍘嗗彶鏁版嵁
       columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() + "骞�-骞村害棰勭畻" );
-      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        // todo
+      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
         cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
       // S&OP鏁版嵁
-      traverse( macroPlans, Elements, macroPlan ) {
+      traverse ( macroPlans, Elements, macroPlan ) {
         columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() + "骞�-" + macroPlan.ScenarioName() );
-        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+        traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
           // todo
           cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
           cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
@@ -194,7 +237,6 @@
     }
     
     // 璁剧疆rowNo鍜宑olumnNo
-    debuginfo( "set rowNo and columnNo" );
     rowNo := 1;
     rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.PlaceOfProductionOfArray() + "_" + item.BusinessType() );
     traverse( rowSorted, Elements, item ) {
@@ -206,6 +248,5 @@
       item.ColumnNo( columnNo );
       columnNo := columnNo + 1;
     }
-    debuginfo( "done" );
   *]
 }

--
Gitblit v1.9.3