From bc27afe76dc7bfbb63c8d078d546b97746ebddde Mon Sep 17 00:00:00 2001 From: yypsybs <yypsybs@foxmail.com> Date: 星期二, 19 九月 2023 11:49:22 +0800 Subject: [PATCH] 年度预算产销复盘填数据 --- _Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl | 75 +++++++++++++++++++++++++------------ 1 files changed, 51 insertions(+), 24 deletions(-) diff --git a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl index 1c3a3e5..7451626 100644 --- a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl +++ b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl @@ -6,10 +6,11 @@ CapacityAndSaleBudgeFilterYears years, CapacityAndSaleBudgeFilterMonths months, MPSync mpSync, + GlobalOTDTable otdTable, MacroPlan mappingParent ) { - Description: 'todo : mappingParent鏀逛负mpSync' + Description: 'todo : mappingParent鏀逛负mpSync, random鍒犱簡' TextBody: [* // yypsybs Sep-18-2023 (created) @@ -77,15 +78,19 @@ 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 ) { - cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := CapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), otdTable, 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-骞村害棰勭畻" ); + columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍒嗛厤閲�-total-骞村害棰勭畻" ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := CapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), otdTable, DateTime::Now().Year() ); + cellReal := Real::Random( 1.0, 999.0 ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } // S&OP鏁版嵁 @@ -93,16 +98,20 @@ traverse( macroPlans, Elements, macroPlan ) { traverse( months, Elements, month ) { columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, - "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "-" + [String]month.MonthNo() + "-" + macroPlan.ScenarioName() ); + "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, year.YearNo(), month.MonthNo() ); + cellReal := Real::Random( 1.0, 999.0 ); + cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } } columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, - "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "-total-" + macroPlan.ScenarioName() ); + "闈㈡澘鍒嗛厤閲�-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() ); + cellReal := Real::Random( 1.0, 999.0 ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } } @@ -113,30 +122,36 @@ 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 ) { - cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := CapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), otdTable, 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-骞村害棰勭畻" ); + columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-total-骞村害棰勭畻" ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := CapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), otdTable, DateTime::Now().Year() ); + cellReal := Real::Random( 1.0, 999.0 ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } // S&OP鏁版嵁 traverse( years, Elements, year ) { traverse( macroPlans, Elements, macroPlan ) { traverse( months, Elements, month ) { - columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "-" + [String]month.MonthNo() + "-" + macroPlan.ScenarioName() ); + columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-" + [String]month.MonthNo() + "鏈�-" + macroPlan.ScenarioName() ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := MappingForecast::GetByMonth( row.GetProductCodes(), mappingParent, year.YearNo(), month.MonthNo() ); + cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } } - columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "-total-" + macroPlan.ScenarioName() ); + columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "瀵瑰閿�鍞-" + [String]year.YearNo() + "骞�-total-" + macroPlan.ScenarioName() ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cellReal := MappingForecast::GetByYear( row.GetProductCodes(), mappingParent, year.YearNo() ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } } @@ -148,14 +163,14 @@ // 鍘嗗彶鏁版嵁 columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-骞村害棰勭畻" ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } // S&OP鏁版嵁 traverse( macroPlans, Elements, macroPlan ) { - columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-" + [String]year.YearNo() ); + columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-" + [String]year.YearNo() + "骞�" ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } } @@ -166,20 +181,32 @@ // 鍘嗗彶鏁版嵁 columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-骞村害棰勭畻" ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } // S&OP鏁版嵁 traverse( macroPlans, Elements, macroPlan ) { - columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() ); + columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-" + [String]year.YearNo() + "骞�" ); traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) { - cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) ); + cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) ); cell.CapacityAndSaleBudgeCompareItemRow( relset, row ); } } } - + // 璁剧疆rowNo鍜宑olumnNo + info( "set rowNo and columnNo" ); + rowNo := 1; + rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.BusinessType() + "_" + item.OrgCode() ); + traverse( rowSorted, Elements, item ) { + item.RowNo( rowNo ); + rowNo := rowNo + 1; + } + columnNo := 1; + traverse( this, CapacityAndSaleBudgeCompareItemColumn, item ) { + item.ColumnNo( columnNo ); + columnNo := columnNo + 1; + } info( "done" ); *] } -- Gitblit v1.9.3