hongji.li
2023-11-01 8fe535effe8ad184a82e565c3c066a94a8525606
产能分配Bug fix
已修改5个文件
已添加6个文件
406 ■■■■ 文件已修改
_Main/BL/EDI/Broker_GlobalOTDTable_CAR_Export.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CapacityAllocationResults/StaticMethod_Export.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateData.qbl 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationBudget.qbl 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationByScenario.qbl 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolume.qbl 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeByScenario.qbl 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Forecast/StaticMethod_GetFulfilledBalanceByMonth.qbl 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl 243 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_Export_OnClick.def 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_var/_Main/Data/.keep 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/EDI/Broker_GlobalOTDTable_CAR_Export.qbl
@@ -2,7 +2,7 @@
#parent: #root
EDIBroker GlobalOTDTable_CAR_Export
{
  MDSDefinition: GlobalOTDTable
  MDSDefinition: GlobalOTDSOP
  TimeZone: 'ACT'
  UseOSTimeZone: false
  EDIModelLink.Source Source13
_Main/BL/Type_CapacityAllocationResults/StaticMethod_Export.qbl
@@ -1,12 +1,12 @@
Quintiq file version 2.0
#parent: #root
StaticMethod Export (
  GlobalOTDTable globalOTDTable
  GlobalOTDSOP globalOTDSOP
) as BinaryValue
{
  TextBody:
  [*
    binaryData := globalOTDTable.GlobalOTDTable_CAR_Export().ExecuteToXLS( true );
    binaryData := globalOTDSOP.GlobalOTDTable_CAR_Export().ExecuteToXLS( true );
    
    return binaryData.AsBinaryValue();
  *]
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateData.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateData (
  const GlobalOTDTable globalOTDTable,
  GlobalOTDSOP this
)
{
  TextBody:
  [*
    traverse ( globalOTDTable, Global_MappingAnnualBudgetData, gmabd ) {
      productCode := gmabd.ProductID();
      row         := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
      CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
    }
    columnBusinessType             := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "事业部" );
    columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板基地" );
    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
      cell := columnBusinessType.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.BusinessType() );
      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
      cell := columnPlaceOfProductionOfArray.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.PlaceOfProductionOfArray() );
      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    }
  *]
}
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationBudget.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreatePanelAllocationBudget (
  GlobalOTDSOP this,
  CapacityAndSaleBudgeFilterMonths months,
  CapacityAndSaleBudgeFilterYear year,
  const GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
      total := 0.0;
      traverse ( months, Elements, m ) {
        columnName  := "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-年度预算";
        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
        cellReal    := Global_MappingForecast::GetQuantityByMonth( casbcir.GetProductCodes(), globalOTDTable, DateTime::Now().Year(), m.MonthNo() );
        cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
        total       := total + cellReal;
        cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
      }
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-total-年度预算" );
      cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
      columnYear.TotalIdentification( year.YearNo() );
      cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
    }
  *]
}
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationByScenario.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreatePanelAllocationByScenario (
  MacroPlans macroPlans,
  GlobalOTDSOP this,
  CapacityAndSaleBudgeFilterMonths months,
  CapacityAndSaleBudgeFilterYear year
)
{
  TextBody:
  [*
    traverse ( macroPlans, Elements, mp ) {
      traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
        total := 0.0;
        traverse ( months, Elements, m ) {
          columnName  := "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-" + mp.ScenarioName();
          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
          cellReal    := Product_MP::GetNewSupplyByMonth( casbcir.GetProductCodes(), mp, year.YearNo(), m.MonthNo() );
          cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          total       := total + cellReal;
          cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
        }
        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-total-" + mp.ScenarioName() );
        cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
        columnYear.TotalIdentification( year.YearNo() );
        cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
      }
    }
  *]
}
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolume.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateSalesVolume (
  GlobalOTDSOP this,
  CapacityAndSaleBudgeFilterMonths months,
  CapacityAndSaleBudgeFilterYear year,
  const GlobalOTDTable globalOTDTable
)
{
  TextBody:
  [*
    traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
      total := 0.0;
      traverse ( months, Elements, m ) {
        columnName  := "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-年度预算";
        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
        cellReal    := Global_MappingAnnualBudgetData::GetSaleByMonth( casbcir.GetProductCodes(), globalOTDTable, year.YearNo(), m.MonthNo() );
        cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
        total       := total + cellReal;
        cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
      }
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-total-年度预算" );
      cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
      columnYear.TotalIdentification( year.YearNo() );
      cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
    }
  *]
}
_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeByScenario.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
Quintiq file version 2.0
#parent: #root
StaticMethod CreateSalesVolumeByScenario (
  MacroPlans macroPlans,
  GlobalOTDSOP this,
  CapacityAndSaleBudgeFilterMonths months,
  CapacityAndSaleBudgeFilterYear year
)
{
  TextBody:
  [*
    traverse ( macroPlans, Elements, mp ) {
      traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
        total := 0.0;
        traverse ( months, Elements, m ) {
          columnName  := "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-" + mp.ScenarioName();
          columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
          cellReal    := Forecast::GetFulfilledBalanceByMonth( casbcir.GetProductCodes(), mp, year.YearNo(), m.MonthNo() );
          cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
          total       := total + cellReal;
          cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
        }
        columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-total-" + mp.ScenarioName() );
        cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
        columnYear.TotalIdentification( year.YearNo() );
        cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
      }
    }
  *]
}
_Main/BL/Type_Forecast/StaticMethod_GetFulfilledBalanceByMonth.qbl
@@ -12,11 +12,11 @@
    // yypsybs Sep-18-2023 (created)
    result := sum( macroPlan, 
                   Product_MP.SalesDemand,
                   item,
                   item.istype( Forecast ) and productNo.Find( item.ProductID() ) > -1
                   and item.StartDate().Year() = yearNo
                   and item.StartDate().Month() = monthNo,
                   item.FulfilledQuantity() * item.Price() );
                   tempSD,
                   productNo.Find( tempSD.ProductID() ) > -1
                   and tempSD.StartDate().Year() = yearNo
                   and tempSD.StartDate().Month() = monthNo,
                   tempSD.FulfilledQuantity() * tempSD.Price() );
    return result;
  *]
}
_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
@@ -5,13 +5,12 @@
  CapacityAndSaleBudgeFilterItems items,
  CapacityAndSaleBudgeFilterYears years,
  CapacityAndSaleBudgeFilterMonths months,
  const GlobalOTDTable otdTable
  const GlobalOTDTable globalOTDTable
)
{
  Description: 'todo : mappingParent改为mpSync, random删了'
  TextBody:
  [*
    // ====不选时默认全选====
    if ( years.Size() = 0 ) {
      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
    }
@@ -22,219 +21,57 @@
    this.CapacityAndSaleBudgeCompareItemRow( relflush );
    this.CapacityAndSaleBudgeCompareItemColumn( relflush );
    
    // ====汇总所有出现的产品====
    targetglobal_MappingAnnualBudgetData := selectset( otdTable, Global_MappingAnnualBudgetData, item, true );
    CapacityAndSaleBudgeCompareItemCell::CreateData( globalOTDTable, this );
    
    traverse ( targetglobal_MappingAnnualBudgetData, Elements, gmabd ) {
      productCode := gmabd.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();
        // ç›¸åŒé¢æ¿åŸºåœ°å’Œäº‹ä¸šéƒ¨çš„æ”¾ä¸€è¡Œ
        row := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
        // è®°å½•每行包含哪些product
        CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
    //  } else {
    //    debuginfo( "no boms for product : " + productCode );
    //  }
    }
    // ====从左向右生成列头与内容====
    // äº‹ä¸šéƒ¨ï¼Œé¢æ¿åŸºåœ°
    columnBusinessType := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "事业部" );
    columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板基地" );
    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
      cell := columnBusinessType.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.BusinessType() );
      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
      cell := columnPlaceOfProductionOfArray.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.PlaceOfProductionOfArray() );
      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    }
    // é¢æ¿åˆ†é…é‡ - å¹´åº¦é¢„ç®— (sheets)
    // æ ¼å¼ï¼š é¢æ¿åˆ†é…é‡ - å¹´ - æœˆï¼ˆ1-12 & total) - å¹´åº¦é¢„ç®—/scenarioName
    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "面板分配量" ) ) {
      traverse ( years, Elements, year ) {
        // åŽ†å²æ•°æ®
    //    traverse ( months, Elements, month ) {
    //      columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]month.MonthNo() + "月-年度预算" );
    //      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //        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(), otdTable, year.YearNo() );
    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //    }
        traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
          total := 0.0;
          traverse ( months, Elements, m ) {
            columnName  := "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-年度预算";
            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
            cellReal    := Global_MappingForecast::GetQuantityByMonth( casbcir.GetProductCodes(), otdTable, DateTime::Now().Year(), m.MonthNo() );
            cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            total       := total + cellReal;
            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
          }
          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-total-年度预算" );
          cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
          columnYear.TotalIdentification( year.YearNo() );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
        }
        // S&OP数据
    //    traverse ( macroPlans, Elements, macroPlan ) {
    //      traverse ( months, Elements, month ) {
    //        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this,
    //                                                                                "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]month.MonthNo() + "月-" + macroPlan.ScenarioName() );
    //        traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //          cellReal := Product_MP::GetNewSupplyByMonth( row.GetProductCodes(), macroPlan, 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() );
    //      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //        cellReal := Product_MP::GetNewSupplyByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
    //        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
    //        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //      }
    //    }
        traverse ( macroPlans, Elements, mp ) {
          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
            total := 0.0;
            traverse ( months, Elements, m ) {
              columnName  := "面板分配量-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-" + mp.ScenarioName();
              columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
              cellReal    := Product_MP::GetNewSupplyByMonth( casbcir.GetProductCodes(), mp, year.YearNo(), m.MonthNo() );
              cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
              total       := total + cellReal;
              cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
            }
            columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "面板分配量-" + [String]year.YearNo() + "å¹´-total-" + mp.ScenarioName() );
            cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
            columnYear.TotalIdentification( year.YearNo() );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
          }
        }
        CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationBudget( this, months, year, globalOTDTable );
        CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationByScenario( macroPlans, this, months, year );
      }
    }
    
    // å¹´åº¦é”€å”®é¢
    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "销售额" ) ) {
      traverse ( years, Elements, year ) {
        // åŽ†å²æ•°æ®
    //    traverse ( months, Elements, month ) {
    //      columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]month.MonthNo() + "月-年度预算" );
    //      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //        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(), otdTable, year.YearNo() );
    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //    }
        traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
          total := 0.0;
          traverse ( months, Elements, m ) {
            columnName  := "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-年度预算";
            columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
            cellReal    := Global_MappingAnnualBudgetData::GetSaleByMonth( casbcir.GetProductCodes(), otdTable, year.YearNo(), m.MonthNo() );
            cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
            total       := total + cellReal;
            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
          }
          columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-total-年度预算" );
          cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
          columnYear.TotalIdentification( year.YearNo() );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
        }
        // S&OP数据
    //    traverse ( macroPlans, Elements, macroPlan ) {
    //      traverse ( months, Elements, month ) {
    //        columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]month.MonthNo() + "月-" + macroPlan.ScenarioName() );
    //        traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //          cellReal := Forecast::GetFulfilledBalanceByMonth( row.GetProductCodes(), macroPlan, 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() );
    //      traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //        // QID 23
    //        cellReal := Forecast::GetFulfilledBalanceByYear( row.GetProductCodes(), macroPlan, year.YearNo() );
    //        cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
    //        cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //      }
    //    }
        traverse ( macroPlans, Elements, mp ) {
          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
            total := 0.0;
            traverse ( months, Elements, m ) {
              columnName  := "对外销售额-" + [String]year.YearNo() + "å¹´-" + [String]m.MonthNo() + "月-" + mp.ScenarioName();
              columnMonth := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, columnName );
              cellReal    := Forecast::GetFulfilledBalanceByMonth( casbcir.GetProductCodes(), mp, year.YearNo(), m.MonthNo() );
              cell        := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]cellReal );
              total       := total + cellReal;
              cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
            }
            columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "对外销售额-" + [String]year.YearNo() + "å¹´-total-" + mp.ScenarioName() );
            cell       := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
            columnYear.TotalIdentification( year.YearNo() );
            cell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
          }
        }
        CapacityAndSaleBudgeCompareItemCell::CreateSalesVolume( this, months, year, globalOTDTable );
        CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeByScenario( macroPlans, this, months, year );
      }
    }
    
    // å¤§å¼ ç›ˆåˆ©é¢
    traverse ( years, Elements, year ) {
      // åŽ†å²æ•°æ®
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "大张盈利额-" + [String]year.YearNo() + "å¹´-年度预算" );
      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
        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() + "å¹´-" + macroPlan.ScenarioName() );
        traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
      }
    }
    // äº§å“ç›ˆåˆ©é¢
    traverse ( years, Elements, year ) {
      // åŽ†å²æ•°æ®
      columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "产品盈利额-" + [String]year.YearNo() + "å¹´-年度预算" );
      traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
        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() + "å¹´-" + macroPlan.ScenarioName() );
        traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
          // todo
          cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
          cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
        }
      }
    }
    //traverse ( years, Elements, year ) {
    //  // åŽ†å²æ•°æ®
    //  columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "大张盈利额-" + [String]year.YearNo() + "å¹´-年度预算" );
    //  traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //    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() + "å¹´-" + macroPlan.ScenarioName() );
    //    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //    }
    //  }
    //}
    //// äº§å“ç›ˆåˆ©é¢
    //traverse ( years, Elements, year ) {
    //  // åŽ†å²æ•°æ®
    //  columnYear := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "产品盈利额-" + [String]year.YearNo() + "å¹´-年度预算" );
    //  traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //    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() + "å¹´-" + macroPlan.ScenarioName() );
    //    traverse ( this, CapacityAndSaleBudgeCompareItemRow, row ) {
    //      // todo
    //      cell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]Number::Random( 0, 0 ) );
    //      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
    //    }
    //  }
    //}
    
    // è®¾ç½®rowNo和columnNo
    rowNo := 1;
_Main/UI/MacroPlannerWebApp/Component_FormCapacityAllocationResults/Response_PanelCapacityAllocationResults_Export_OnClick.def
@@ -5,11 +5,15 @@
  #keys: '[414702.0.391791234]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  Precondition:
  [*
    return not isnull( GlobalOTDSOP );
  *]
  QuillAction
  {
    Body:
    [*
      Application.Download( "产能分配结果.xlsx", CapacityAllocationResults::Export( GlobalOTDTable ).AsBinaryData() );
      Application.Download( "产能分配结果.xlsx", CapacityAllocationResults::Export( GlobalOTDSOP ).AsBinaryData() );
    *]
    GroupServerCalls: false
  }
_var/_Main/Data/.keep