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_GlobalDTOTable/Method_InitTestDataByYear.qbl |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl b/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
index c84f323..98dddf0 100644
--- a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
+++ b/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
@@ -2,28 +2,45 @@
 #parent: #root
 Method InitTestDataByYear (
   MacroPlan macroPlan,
-  CapacityAndSaleBudgeFilterYears years
+  GlobalOTDSOP globalOTDSOP,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterBusinessTypes businessTypes,
+  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays placeOfProductionOfArrays,
+  Product_MPs product_MPs
 )
 {
   TextBody:
   [*
-    // yypsybs Oct-7-2023 (created)
-    productCodeList := selectuniquevalues( macroPlan, Product_MP, item, item.ID() );
-    debuginfo( "productCodeList : " + [String]productCodeList.Size() );
+    product_MPs := selectset( product_MPs, Elements, tempPMP, tempPMP.IsLeaf() and not tempPMP.IsSystem() );
     
     this.Global_MappingAnnualBudgetData( relflush );
-    debuginfo( "create Global_MappingAnnualBudgetData test data" );
-    id := 1;
-    traverse( years, Elements, year ) {
-      for( i := 1; i <= productCodeList.Size(); i := i + 1 ) {
-        productCode := productCodeList.Element( i - 1 );
+    
+    if ( years.Size() = 0 ) {
+      years := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterYear, tempCASBFY, 
+                          tempCASBFY.YearNo() = Date::ActualDate().Year()     or
+                          tempCASBFY.YearNo() = Date::ActualDate().Year() - 1 or
+                          tempCASBFY.YearNo() = Date::ActualDate().Year() + 1
+                         );
+    }
+    if ( businessTypes.Size() = 0 ) {
+      businessTypes := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, true );
+    }
+    if ( placeOfProductionOfArrays.Size() = 0 ) {
+      placeOfProductionOfArrays := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, true );
+    }
+    
+    traverse ( years, Elements, year ) {
+      traverse ( product_MPs, Elements, pmp ) {
+        businessType             := businessTypes.Element( Number::Random( 0, businessTypes.Size() - 1 ) ).BusinessType();
+        placeOfProductionOfArray := placeOfProductionOfArrays.Element( Number::Random( 0, placeOfProductionOfArrays.Size() - 1 ) ).PlaceOfProductionOfArray();
         mappingAnnualBudget := this.Global_MappingAnnualBudgetData( relnew, 
-                                                                    ID := [String]id,
-                                                                    YearNo := [String]year.YearNo(),
-                                                                    BusinessType := "浜嬩笟閮�" + [String](productCode.Length() mod 3),
-                                                                    OrganCode := "I13",
-                                                                    ProductID := productCode);
-        id := id + 1;
+                                                                    ID           := OS::GenerateGUIDAsString(),
+                                                                    YearNo       := [String]year.YearNo(),
+                                                                    BusinessType := businessType,
+                                                                    OrganCode    := placeOfProductionOfArray,
+                                                                    ProductID    := pmp.ID()
+                                                                   );
+                                                                   
         mappingAnnualBudget.MonthlyModCapacity1( [String]Real::Random( 20000.0, 30000.0 ) );
         mappingAnnualBudget.MonthlyModCapacity2( [String]Real::Random( 20000.0, 30000.0 ) );
         mappingAnnualBudget.MonthlyModCapacity3( [String]Real::Random( 20000.0, 30000.0 ) );
@@ -62,7 +79,5 @@
         mappingAnnualBudget.MonthlySales12(  [String]Real::Random( 20000.0, 30000.0 ) );
       }
     }
-    result2 := selectset( this, Global_MappingAnnualBudgetData, item, true );
-    debuginfo( "test MappingAnnualBudget size : " + [String]result2.Size() );
   *]
 }

--
Gitblit v1.9.3