From 2237ad24deb34ca1aeaf659ea1d4f523d708cd26 Mon Sep 17 00:00:00 2001
From: yypsybs <yypsybs@foxmail.com>
Date: 星期三, 20 九月 2023 14:57:53 +0800
Subject: [PATCH] PRData现场测试用
---
_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart.qbl | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 222 insertions(+), 9 deletions(-)
diff --git a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart.qbl b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart.qbl
index 133fe60..43f414f 100644
--- a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart.qbl
+++ b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeChart.qbl
@@ -4,9 +4,9 @@
MacroPlans macroPlans,
Boolean isCapacity,
String groupBy,
- String byBusinessTypeOrByOrgCodde,
- String businessType,
- String orgCode,
+ String byBusinessTypeOrByOrgCode,
+ String businessTypeChosen,
+ String placeOfProductionOfArrayChosen,
String year,
MPSync mpSync,
GlobalOTDTable otdTable,
@@ -17,13 +17,226 @@
TextBody:
[*
// yypsybs Sep-19-2023 (created)
+ // true, false
+ info( isCapacity );
+ // 鏈�;瀛e害;鍗婂勾;骞�
+ info( groupBy );
+ // 闈㈡澘鍩哄湴;浜嬩笟閮�
+ info( byBusinessTypeOrByOrgCode );
+ info( businessTypeChosen );
+ info( placeOfProductionOfArrayChosen );
+ info( year );
+
+ // ====娓呯悊鏃ф暟鎹�====
+ this.CapacityAndSaleBudgeChartRow( relflush );
this.CapacityAndSaleBudgeChartElement( relflush );
- info( isCapacity );
- info( groupBy );
- info( byBusinessTypeOrByOrgCodde );
- info( businessType );
- info( orgCode );
- info( year );
+ // ====鎸夐潰鏉垮熀鍦板拰浜嬩笟閮ㄥ浜у搧杩涜绛涢�夊垎缁�====
+ historyData := selectset( otdTable, CapacityAndSaleBudge, item, true );
+ if( placeOfProductionOfArrayChosen <> "" ) {
+ historyData := selectset( historyData, Elements, item, item.PlaceOfProductionOfArray() = placeOfProductionOfArrayChosen );
+ }
+ if( businessTypeChosen <> "" ) {
+ historyData := selectset( historyData, Elements, item, item.BusinessType() = businessTypeChosen );
+ }
+ traverse( historyData, Elements, item ) {
+ row := CapacityAndSaleBudgeChartRow::CreateIfNotExist( this, item.BusinessType(), item.PlaceOfProductionOfArray() );
+ // 璁板綍姣忚鍖呭惈鍝簺product
+ CapacityAndSaleBudgeChartRowProduct::CreateIfNotExist( row, item.ProductCode() );
+ }
+ rows := selectset( this, CapacityAndSaleBudgeChartRow, item, true );
+ placeOfProductionOfArrayList := selectuniquevalues( historyData, Elements, item, item.PlaceOfProductionOfArray() );
+ businessTypeList := selectuniquevalues( historyData, Elements, item, item.BusinessType() );
+ // 鐢熸垚鍥捐〃鍏冪礌
+ if( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "骞�" ) {
+ // 鐩爣
+ traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-鐩爣",
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetByYear( productCodeList, otdTable, [Number]year ),
+ MappingForecast::GetQuantityByYear( productCodeList, mappingParent, [Number]year ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, [Number]year ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "鍗婂勾" ) {
+ for( halfNo := 1; halfNo <= 2; halfNo := halfNo + 1 ) {
+ traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-鐩爣",
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, otdTable, [Number]year, halfNo ),
+ MappingForecast::GetQuantityByHalfYear( productCodeList, mappingParent, [Number]year, halfNo ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, [Number]year, halfNo ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ }
+ if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "瀛e害" ) {
+ for( seasonNo := 1; seasonNo <= 4; seasonNo := seasonNo + 1 ) {
+ traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]seasonNo + "瀛e害-鐩爣",
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetBySeason( productCodeList, otdTable, [Number]year, seasonNo ),
+ MappingForecast::GetQuantityBySeason( productCodeList, mappingParent, [Number]year, seasonNo ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]seasonNo + "瀛e害-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, [Number]year, seasonNo ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ }
+ if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "鏈�" ) {
+ for( monthNo := 1; monthNo <= 12; monthNo := monthNo + 1 ) {
+ traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]monthNo + "鏈�-鐩爣",
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetByMonth( productCodeList, otdTable, [Number]year, monthNo ),
+ MappingForecast::GetQuantityByMonth( productCodeList, mappingParent, [Number]year, monthNo ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]monthNo + "鏈�-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := placeOfProductionOfArray,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, [Number]year, monthNo ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ }
+ if( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "骞�" ) {
+ // 鐩爣
+ traverse( businessTypeList, Elements, businessType ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-鐩爣",
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetByYear( productCodeList, otdTable, [Number]year ),
+ MappingForecast::GetQuantityByYear( productCodeList, mappingParent, [Number]year ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, [Number]year ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ if ( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "鍗婂勾" ) {
+ for( halfNo := 1; halfNo <= 2; halfNo := halfNo + 1 ) {
+ traverse( businessTypeList, Elements, businessType ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-鐩爣",
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetByHalfYear( productCodeList, otdTable, [Number]year, halfNo ),
+ MappingForecast::GetQuantityByHalfYear( productCodeList, mappingParent, [Number]year, halfNo ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, [Number]year, halfNo ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ }
+ if ( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "瀛e害" ) {
+ for( seasonNo := 1; seasonNo <= 4; seasonNo := seasonNo + 1 ) {
+ traverse( businessTypeList, Elements, businessType ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]seasonNo + "瀛e害-鐩爣",
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetBySeason( productCodeList, otdTable, [Number]year, seasonNo ),
+ MappingForecast::GetQuantityBySeason( productCodeList, mappingParent, [Number]year, seasonNo ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]seasonNo + "瀛e害-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, [Number]year, seasonNo ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ }
+ if ( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "鏈�" ) {
+ for( monthNo := 1; monthNo <= 12; monthNo := monthNo + 1 ) {
+ traverse( businessTypeList, Elements, businessType ) {
+ productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]monthNo + "鏈�-鐩爣",
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ CapacityAndSaleBudge::GetSheetByMonth( productCodeList, otdTable, [Number]year, monthNo ),
+ MappingForecast::GetQuantityByMonth( productCodeList, mappingParent, [Number]year, monthNo ) )
+ );
+ // S&OP
+ traverse( macroPlans, Elements, macroPlan ) {
+ this.CapacityAndSaleBudgeChartElement( relnew,
+ TimeStringAndScenarioName := [String]year + "骞�-绗�" + [String]monthNo + "鏈�-" + macroPlan.ScenarioName(),
+ BusinessTypeOrOrgCode := businessType,
+ Quantity := ifexpr( isCapacity,
+ Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, [Number]year, monthNo ),
+ 0.0 )
+ );
+ }
+ }
+ }
+ }
*]
}
--
Gitblit v1.9.3