From d6bd7a69bc31efa79b21c7be12ba9547a921c251 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期五, 03 十一月 2023 16:28:41 +0800
Subject: [PATCH] 年度产销预算BUG修改

---
 _Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData#500.qbl |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl "b/_Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData\043500.qbl"
similarity index 84%
rename from _Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
rename to "_Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData\043500.qbl"
index 98dddf0..06ec0cb 100644
--- a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
+++ "b/_Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData\043500.qbl"
@@ -1,38 +1,29 @@
 Quintiq file version 2.0
 #parent: #root
-Method InitTestDataByYear (
-  MacroPlan macroPlan,
+Method CreateCapacityAndSaleBudgeTestData (
   GlobalOTDSOP globalOTDSOP,
+  const GlobalOTDTable globalOTDTable,
   CapacityAndSaleBudgeFilterYears years,
-  CapacityAndSaleBudgeFilterBusinessTypes businessTypes,
-  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays placeOfProductionOfArrays,
   Product_MPs product_MPs
 )
 {
   TextBody:
   [*
-    product_MPs := selectset( product_MPs, Elements, tempPMP, tempPMP.IsLeaf() and not tempPMP.IsSystem() );
-    
     this.Global_MappingAnnualBudgetData( relflush );
     
+    product_MPs := selectset( product_MPs, Elements, tempPMP, tempPMP.IsLeaf() and not tempPMP.IsSystem() );
     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
+                          tempCASBFY.YearNo() = Date::ActualDate().Year()
                          );
     }
-    if ( businessTypes.Size() = 0 ) {
-      businessTypes := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, true );
-    }
-    if ( placeOfProductionOfArrays.Size() = 0 ) {
-      placeOfProductionOfArrays := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, true );
-    }
+    businessTypes             := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, tempGMPMP, true, tempGMPMP.BusinessType() );
+    placeOfProductionOfArrays := selectuniquevalues( globalOTDTable, Global_MappingOperation, tempGMO, true, tempGMO.OrganCode() );
     
-    traverse ( years, Elements, year ) {
+    traverse ( years, Elements, year, businessTypes.Size() > 0 and placeOfProductionOfArrays.Size() > 0 ) {
       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();
+        businessType             := businessTypes.Element( Number::Random( 0, businessTypes.Size() - 1 ) );
+        placeOfProductionOfArray := placeOfProductionOfArrays.Element( Number::Random( 0, placeOfProductionOfArrays.Size() - 1 ) );
         mappingAnnualBudget := this.Global_MappingAnnualBudgetData( relnew, 
                                                                     ID           := OS::GenerateGUIDAsString(),
                                                                     YearNo       := [String]year.YearNo(),

--
Gitblit v1.9.3