| | |
| | | #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 ) ); |
| | |
| | | mappingAnnualBudget.MonthlySales12( [String]Real::Random( 20000.0, 30000.0 ) ); |
| | | } |
| | | } |
| | | result2 := selectset( this, Global_MappingAnnualBudgetData, item, true ); |
| | | debuginfo( "test MappingAnnualBudget size : " + [String]result2.Size() ); |
| | | *] |
| | | } |