Kevin Kok Khah Whey
2023-10-18 d5e46a7a9f2cb9123b9aafb39a20e14059faa2e4
_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
ÎļþÃû´Ó _Main/BL/Type_GlobalDTOTable/Method_CapacityAndSaleBudgeCompare.qbl ÐÞ¸Ä
@@ -5,7 +5,7 @@
  CapacityAndSaleBudgeFilterItems items,
  CapacityAndSaleBudgeFilterYears years,
  CapacityAndSaleBudgeFilterMonths months,
  GlobalOTDTable otdTable
  const GlobalOTDTable otdTable
)
{
  Description: 'todo : mappingParent改为mpSync, random删了'
@@ -35,23 +35,24 @@
    this.CapacityAndSaleBudgeCompareItemRow( relflush );
    this.CapacityAndSaleBudgeCompareItemColumn( relflush );
    // ====汇总所有出现的产品====
    historyData := selectset( this, Global_MappingAnnualBudgetData, item, true );
    debuginfo( "historyData : " + [String]historyData.Size() )
    historyData := selectset( otdTable, Global_MappingAnnualBudgetData, item, true );
    debuginfo( "historyData : " + [String]historyData.Size() );
    traverse( historyData, Elements, one ) {
      productCode := one.ProductID();
      Global_MappingOperationBOM::CreateTestData( otdTable, "事业部" + [String](productCode.Length() mod 3), "面板基地" + [String](productCode.Length() mod 4), productCode );
      boms := selectset( otdTable, Global_MappingOperationBOM, bom, bom.ProductCode() = productCode );
      if( boms.Size() > 0 ) {
        bom := boms.First();
        businessType := bom.BusinessType();
        placeOfProductionOfArray := bom.OrganCode();
    //  Global_MappingOperationBOM::CreateTestData( otdTable, "事业部" + [String](productCode.Length() mod 3), "面板基地" + [String](productCode.Length() mod 4), productCode );
    //  boms := selectset( otdTable, Global_MappingOperationBOM, bom, bom.ProductCode() = productCode );
    //  if( boms.Size() > 0 ) {
    //    bom := boms.First();
    //    businessType := bom.BusinessType();
    //    placeOfProductionOfArray := bom.OrganCode();
        // ç›¸åŒé¢æ¿åŸºåœ°å’Œäº‹ä¸šéƒ¨çš„æ”¾ä¸€è¡Œ
        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, businessType, placeOfProductionOfArray );
        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, one.BusinessType(), one.OrgCodeFromBom() );
        // è®°å½•每行包含哪些product
        CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
      } else {
        debuginfo( "no boms for product : " + productCode );
      }
    //  } else {
    //    debuginfo( "no boms for product : " + productCode );
    //  }
    }
    debuginfo( "CapacityAndSaleBudgeCompareItemRow : " + [String]selectset( this, CapacityAndSaleBudgeCompareItemRow, item, true ).Size() );
    // ====从左向右生成列头与内容====
@@ -76,14 +77,14 @@
        traverse( months, Elements, month ) {
          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]month.MonthNo() + "月-年度预算" );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            cellReal := Global_MappingForecast::GetQuantityByMonth( row.GetProductCodes(), this, DateTime::Now().Year(), month.MonthNo() );
            cellReal := Global_MappingForecast::GetQuantityByMonth( row.GetProductCodes(), otdTable, DateTime::Now().Year(), month.MonthNo() );
            cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }
        }
        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-total-年度预算" );
        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
          cellReal := Global_MappingForecast::GetQuantityByYear( row.GetProductCodes(), this, year.YearNo() );
          cellReal := Global_MappingForecast::GetQuantityByYear( row.GetProductCodes(), otdTable, year.YearNo() );
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
@@ -119,14 +120,14 @@
        traverse( months, Elements, month ) {
          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]month.MonthNo() + "月-年度预算" );
          traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
            cellReal := Global_MappingAnnualBudgetData::GetSaleByMonth( row.GetProductCodes(), this, year.YearNo(), month.MonthNo() );
            cellReal := Global_MappingAnnualBudgetData::GetSaleByMonth( row.GetProductCodes(), otdTable, year.YearNo(), month.MonthNo() );
            cell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
          }
        }
        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-年度预算" );
        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
          cellReal := Global_MappingAnnualBudgetData::GetSaleByYear( row.GetProductCodes(), this, year.YearNo() );
          cellReal := Global_MappingAnnualBudgetData::GetSaleByYear( row.GetProductCodes(), otdTable, year.YearNo() );
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }