From 89c96171bb971dcaed7cf289b58ef44ca689523c Mon Sep 17 00:00:00 2001
From: limj <limj@taizhitech.com>
Date: 星期四, 21 九月 2023 09:11:20 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/TIANMA_JITUAN into dev_lmj
---
_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl | 115 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 70 insertions(+), 45 deletions(-)
diff --git a/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_ScenarioManager/Method_CapacityAndSaleBudgeCompare.qbl
index 1c3a3e5..6688d88 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)
@@ -36,56 +37,55 @@
this.CapacityAndSaleBudgeCompareItemRow( relflush );
this.CapacityAndSaleBudgeCompareItemColumn( relflush );
// ====姹囨�绘墍鏈夊嚭鐜扮殑浜у搧====
- productCodeList := construct( Strings );
historyData := selectset( mpSync, MappingCapacityAndSaleBudge, item, true );
+ info( "historyData : " + [String]historyData.Size() )
traverse( historyData, Elements, one ) {
- productCodeList.Add( one.ProductCode() );
- }
- traverse( macroPlans, Elements, macroPlan ) {
- traverse( macroPlan, Product_MP.ProductInStockingPoint_MP.ProductInStockingPointInPeriod, pispip ) {
- productCodeList.Add( pispip.ProductInStockingPoint_MP().Product_MP().ID() );
- }
- }
- productCodeList := selectuniquevalues( productCodeList, Elements, item, item );
- info( "product count : " + [String]productCodeList.Size() )
- // ====鏍规嵁浜у搧鏌ヤ簨涓氶儴鍜岀粍缁囩紪鐮侊紝鐒跺悗鎸変簨涓氶儴鍜岀粍缁囩紪鐮佹眹鎬�====
- traverse( productCodeList, Elements, productCode ) {
- bom := MappingBOM::CreateTestData( mappingParent, [String](productCode.Length() mod 3), [String](productCode.Length() mod 4) );
- // bom := select( mappingParent, MappingBOM, bom, bom.ProductCode() = productCode );
- if( not isnull( bom ) ) {
+ productCode := one.ProductCode();
+ MappingBOM::CreateTestData( mappingParent, "浜嬩笟閮�" + [String](productCode.Length() mod 3), [String](productCode.Length() mod 4), productCode );
+ boms := selectset( mappingParent, MappingBOM, bom, bom.ProductCode() = productCode );
+ if( boms.Size() > 0 ) {
+ bom := boms.First();
businessType := bom.BusinessType();
- orgCode := bom.OrganCode();
- row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, businessType, orgCode );
+ placeOfProductionOfArray := one.PlaceOfProductionOfArray();
+ // 鐩稿悓闈㈡澘鍩哄湴鍜屼簨涓氶儴鐨勬斁涓�琛�
+ row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, businessType, placeOfProductionOfArray );
// 璁板綍姣忚鍖呭惈鍝簺product
CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
+ } else {
+ // info( "111111" );
}
}
+ info( "CapacityAndSaleBudgeCompareItemRow : " + [String]selectset( this, CapacityAndSaleBudgeCompareItemRow, item, true ).Size() );
// ====浠庡乏鍚戝彸鐢熸垚鍒楀ご涓庡唴瀹�====
// 浜嬩笟閮紝缁勭粐
- info( "dealing businessType and orgCode" )
+ info( "dealing businessType and placeOfProductionOfArray" )
columnBusinessType := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜嬩笟閮�" );
- columnOrgCode := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "缁勭粐缂栫爜" );
+ columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍩哄湴" );
traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
cell := columnBusinessType.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.BusinessType() );
cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
- cell := columnOrgCode.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.OrgCode() );
+ cell := columnPlaceOfProductionOfArray.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.PlaceOfProductionOfArray() );
cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
}
- // 闈㈡澘鍒嗛厤閲� - 骞村害棰勭畻
+ // 闈㈡澘鍒嗛厤閲� - 骞村害棰勭畻 (sheets)
// 鏍煎紡锛� 闈㈡澘鍒嗛厤閲� - 骞� - 鏈堬紙1-12 & total锛� - 骞村害棰勭畻/scenarioName
info( "dealing 闈㈡澘鍒嗛厤閲�" )
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 := MappingCapacityAndSaleBudge::GetSheetByMonth( row.GetProductCodes(), mpSync, 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 := MappingCapacityAndSaleBudge::GetSheetByYear( row.GetProductCodes(), mpSync, 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 +93,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 +117,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 := MappingCapacityAndSaleBudge::GetSaleByMonth( row.GetProductCodes(), mpSync, 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 := MappingCapacityAndSaleBudge::GetSaleByYear( row.GetProductCodes(), mpSync, 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::GetBalanceByMonth( 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::GetBalanceByYear( row.GetProductCodes(), mappingParent, year.YearNo() );
+ cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
}
}
@@ -148,14 +158,15 @@
// 鍘嗗彶鏁版嵁
columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "澶у紶鐩堝埄棰�-骞村害棰勭畻" );
traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
- cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+ // todo
+ 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 +177,34 @@
// 鍘嗗彶鏁版嵁
columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜у搧鐩堝埄棰�-骞村害棰勭畻" );
traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
- cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 100 ) );
+ // todo
+ 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 ) );
+ // todo
+ 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.PlaceOfProductionOfArray() + "_" + item.BusinessType() );
+ 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