From 91f5cf28f64aa9c990738398dd62f253647a3639 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期四, 21 九月 2023 10:25:00 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_lhj

---
 _Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl |   62 +++++++++++++++----------------
 1 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
index a2a5dc7..6688d88 100644
--- a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
+++ b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
@@ -37,39 +37,34 @@
     this.CapacityAndSaleBudgeCompareItemRow( relflush );
     this.CapacityAndSaleBudgeCompareItemColumn( relflush );
     // ====姹囨�绘墍鏈夊嚭鐜扮殑浜у搧====
-    productCodeList := construct( Strings );
     historyData := selectset( mpSync, MappingCapacityAndSaleBudge, item, true );
+    info( "historyData : " + [String]historyData.Size() )
     traverse( historyData, Elements, one ) {
-      productCodeList.Add( one.ProductCode() );
-    }
-    traverse( macroPlans, Elements, macroPlan ) {
-      traverse( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, pispip ) {
-        productCodeList.Add( pispip.ProductInStockingPoint_MP().Product_MP().ID() );
-      }
-    }
-    productCodeList := selectuniquevalues( productCodeList, Elements, item, item );
-    info( "product count : " + [String]productCodeList.Size() )
-    // ====鏍规嵁浜у搧鏌ヤ簨涓氶儴鍜岀粍缁囩紪鐮侊紝鐒跺悗鎸変簨涓氶儴鍜岀粍缁囩紪鐮佹眹鎬�====
-    traverse( productCodeList, Elements, productCode ) {
-      bom := MappingBOM::CreateTestData( mappingParent, [String](productCode.Length() mod 3), [String](productCode.Length() mod 4) );
-    //  bom := select( mappingParent, MappingBOM, bom, bom.ProductCode() = productCode );
-      if( not isnull( bom ) ) {
+      productCode := one.ProductCode();
+      MappingBOM::CreateTestData( mappingParent, "浜嬩笟閮�" + [String](productCode.Length() mod 3), [String](productCode.Length() mod 4), productCode );
+      boms := selectset( mappingParent, MappingBOM, bom, bom.ProductCode() = productCode );
+      if( boms.Size() > 0 ) {
+        bom := boms.First();
         businessType := bom.BusinessType();
-        orgCode := bom.OrganCode();
-        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, businessType, orgCode );
+        placeOfProductionOfArray := one.PlaceOfProductionOfArray();
+        // 鐩稿悓闈㈡澘鍩哄湴鍜屼簨涓氶儴鐨勬斁涓�琛�
+        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, businessType, placeOfProductionOfArray );
         // 璁板綍姣忚鍖呭惈鍝簺product
         CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
+      } else {
+    //    info( "111111" );
       }
     }
+    info( "CapacityAndSaleBudgeCompareItemRow : " + [String]selectset( this, CapacityAndSaleBudgeCompareItemRow, item, true ).Size() );
     // ====浠庡乏鍚戝彸鐢熸垚鍒楀ご涓庡唴瀹�====
     // 浜嬩笟閮紝缁勭粐
-    info( "dealing businessType and orgCode" )
+    info( "dealing businessType and placeOfProductionOfArray" )
     columnBusinessType := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜嬩笟閮�" );
-    columnOrgCode := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "缁勭粐缂栫爜" );
+    columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍩哄湴" );
     traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
       cell := columnBusinessType.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.BusinessType() );
       cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
-      cell := columnOrgCode.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.OrgCode() );
+      cell := columnPlaceOfProductionOfArray.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.PlaceOfProductionOfArray() );
       cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
     }
     // 闈㈡澘鍒嗛厤閲� - 骞村害棰勭畻 (sheets)
@@ -78,18 +73,18 @@
     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 ) {
-          cellReal := CapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
-          cellReal := Real::Random( 1.0, 999.0 );
+          cellReal := MappingCapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), mpSync, 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-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        cellReal := CapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), otdTable, DateTime::Now().Year() );
-        cellReal := Real::Random( 1.0, 999.0 );
+        cellReal := MappingCapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), mpSync, DateTime::Now().Year() );
+    //    cellReal := Real::Random( 1.0, 999.0 );
         cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
@@ -101,7 +96,7 @@
                                                                                     "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() );
             traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
               cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() );
-              cellReal := Real::Random( 1.0, 999.0 );
+    //          cellReal := Real::Random( 1.0, 999.0 );
               cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
               cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
             }
@@ -110,7 +105,7 @@
                                                                                  "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() );
           traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
             cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
-            cellReal := Real::Random( 1.0, 999.0 );
+    //        cellReal := Real::Random( 1.0, 999.0 );
             cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
             cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
           }
@@ -124,16 +119,16 @@
       traverse( months, Elements, month ) {
         columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + "-" + [String]month.MonthNo() + "鏈�-骞村害棰勭畻" );
         traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-          cellReal := CapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
-          cellReal := Real::Random( 1.0, 999.0 );
+          cellReal := MappingCapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), mpSync, 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-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-        cellReal := CapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), otdTable, DateTime::Now().Year() );
-        cellReal := Real::Random( 1.0, 999.0 );
+        cellReal := MappingCapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), mpSync, DateTime::Now().Year() );
+    //    cellReal := Real::Random( 1.0, 999.0 );
         cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
@@ -163,6 +158,7 @@
       // 鍘嗗彶鏁版嵁
       columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+        // todo
         cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
@@ -181,6 +177,7 @@
       // 鍘嗗彶鏁版嵁
       columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-骞村害棰勭畻" );
       traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+        // todo
         cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
         cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
       }
@@ -188,6 +185,7 @@
       traverse( macroPlans, Elements, macroPlan ) {
         columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() + "骞�" );
         traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
+          // todo
           cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
           cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
         }
@@ -197,7 +195,7 @@
     // 璁剧疆rowNo鍜宑olumnNo
     info( "set rowNo and columnNo" );
     rowNo := 1;
-    rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.BusinessType() + "_" + item.OrgCode() );
+    rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.PlaceOfProductionOfArray() + "_" + item.BusinessType() );
     traverse( rowSorted, Elements, item ) {
       item.RowNo( rowNo );
       rowNo := rowNo + 1;

--
Gitblit v1.9.3