From bbc05c39743320fd2aa804c4522e58a90a460c57 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 06 九月 2024 17:45:11 +0800
Subject: [PATCH] 客户需求报表页面
---
_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl | 84 ++++++++++++++++++------------------------
1 files changed, 36 insertions(+), 48 deletions(-)
diff --git a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
index 1ccd93d..b40e9e5 100644
--- a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
@@ -1,49 +1,18 @@
Quintiq file version 2.0
#parent: #root
StaticMethod GenerateData (
- const MacroPlan macroplan,
+ MacroPlan macroplan,
RecycleBin recycle,
- const Archive archive,
- InterfaceDataset interfaceDataset,
- String executor,
- Boolean versionflag
+ const Archive archive
)
{
Description: '鐢熸垚鍙互涓嬪彂鐨勫鎴烽渶姹傦紙PPA+IDS锛夋暟鎹�'
TextBody:
[*
// 鐢勫叞楦� Aug-20-2024 (created)
- loginfo := maxobject( interfaceDataset, InterfaceLoginfo, loginfo, loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name(), loginfo.InterfaceDateTime() );
- if( not isnull( loginfo ) ){
- if( not loginfo.IsShow() ){
- loginfo.Delete();
- }else{
- loginfo.Last( false );
- }
- interfaceDataset.CustomerDemandPPAIDS( relflush );
- }
- nowdate := DateTime::ActualTime();
- loginfo := interfaceDataset.InterfaceLoginfo( relnew, ExecuteUser := executor
- , Name := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name()
- , InterfaceDateTime := nowdate
- , Message := '瀹㈡埛闇�姹傦紙PPA+IDS锛夋暟鎹帹閫�'
- , Last := true
- , IsShow := false
- , ReturnSuccess := true
- , ReturnMsg := 'Success'
- , Success := true
- );
- traverse( macroplan, SalesDemand.astype( Forecast ), forecast, forecast.Origin() = 'PPA' ){
- info( forecast.ProductID() );
- cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := forecast.ProductID()
- , DemandDate := forecast.StartDate()
- , DemandQty := [Number]forecast.Quantity()
- , VersionName := macroplan.ScenarioName()
- , InterfaceTime := nowdate
- , VersionFlag := versionflag
- );
- loginfo.CustomerDemandPPAIDS( relinsert, cd );
- }
+ allunit := CustomerDemandIDS::GetDefaultAllUnit();
+ macroplan.CustomerDemandIDSSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit );
+ idstable := macroplan.CustomerDemandIDS( relnew, ID := '瀹㈡埛闇�姹�', Name := '瀹㈡埛闇�姹�' );
binaryValue := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() );
source := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
source.ReadStructure();
@@ -51,24 +20,43 @@
cnv2 := StringToDate::StandardConverter();
cnv2.SetCustomConversion();
cnv2.CustomFormatString( "dd/MM/yyyy" );
+ idsdates := selectuniquevalues( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, cnv2.Convert( column.Name() ) );
+ ppadates := construct( Dates );
+ traverse( macroplan, SalesDemand.astype( Forecast ), forecast, forecast.Origin() = 'PPA' ){
+ ppadates := ppadates.Union( selectuniquevalues( forecast, PlanningSalesDemandInPeriod, salesdemand, salesdemand.StartDate() ) );
+ }
+ periods := idsdates.Union( ppadates );
+ idstable.GenerateColumn( periods.Sort() );
traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){
traverse( table, GeneralExcelImportAndExportDataRow, row ){
- product := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 );
+ productcell := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 );
+ factorycell := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 0 );
+ product := selectobject( macroplan, Product_MP, product, product.ID() = productcell.Value() );
+ idsrow := idstable.GetRowByUnit( product, factorycell.Value() );
traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){
- info( cell.GeneralExcelImportAndExportDataColumn().ColumnIndex(), cell.Value(), product.Value() );
- period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() );
- cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := product.Value()
- , DemandDate := period
- , DemandQty := [Number]cell.Value()
- , VersionName := macroplan.ScenarioName()
- , InterfaceTime := nowdate
- , VersionFlag := versionflag
- );
- loginfo.CustomerDemandPPAIDS( relinsert, cd );
+ period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() );
+ daycolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), period );
+ weekcolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), period );
+ monthcolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), period );
+ idsrow.SetCellValue( daycolumn, [Number]cell.Value() );
+ idsrow.SetCellValue( weekcolumn, [Number]cell.Value() );
+ idsrow.SetCellValue( monthcolumn, [Number]cell.Value() );
}
}
}
+ traverse( macroplan, SalesDemand.astype( Forecast ), forecast, forecast.Origin() = 'PPA' ){
+ product := forecast.Product_MP();
+ idsrow := idstable.GetRowByUnit( product, forecast.SalesSegmentName() );
+ traverse( forecast, PlanningSalesDemandInPeriod, salesdemand ){
+ daycolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), salesdemand.StartDate() );
+ weekcolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), salesdemand.StartDate() );
+ monthcolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), salesdemand.StartDate() );
+ idsrow.SetCellValue( daycolumn, [Number]salesdemand.Quantity() );
+ idsrow.SetCellValue( weekcolumn, [Number]salesdemand.Quantity() );
+ idsrow.SetCellValue( monthcolumn, [Number]salesdemand.Quantity() );
+ }
+ }
+
source.Delete();
- loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
*]
}
--
Gitblit v1.9.3