From b343b593893e2f3278f2695d1411f3aacaeedfc8 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 13 九月 2024 16:33:50 +0800
Subject: [PATCH] 客户需求报表数据调整

---
 _Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl |   42 ++++++++++++++++++++----------------------
 1 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
index a380250..0cbe54d 100644
--- a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod GenerateData (
-  MacroPlan macroplan,
+  InterfaceDataset interface,
   RecycleBin recycle,
   const Archive archive
 )
@@ -10,11 +10,11 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-20-2024 (created)
-    macroplan.CustomerDemandIDS( relflush );
-    macroplan.CustomerDemandIDSSearch( relflush );
+    interface.CustomerDemandIDS( relflush );
+    interface.CustomerDemandIDSSearch( relflush );
     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 := '瀹㈡埛闇�姹�' );
+    interface.CustomerDemandIDSSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit );
+    idstable              := interface.CustomerDemandIDS( relnew, ID := '瀹㈡埛闇�姹�', Name := '瀹㈡埛闇�姹�' );
     binaryValue           := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() );
     source                := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
     source.ReadStructure();
@@ -23,18 +23,19 @@
     cnv2.SetCustomConversion();
     cnv2.CustomFormatString( "yyyy/MM/dd" );
     idsdates              := selectuniquevalues( source, GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataColumn, column, column.ColumnIndex() > 2, 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() ) );
-    }
+    ppadates              := selectuniquevalues( interface, InterfaceForecast, forecast, forecast.Origin() = 'PPA', forecast.Date() );
+    //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 );
+    periods               := selectuniquevalues( periods, Elements, e, e );
     idstable.GenerateColumn( periods.Sort() );
     traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){
       traverse( table, GeneralExcelImportAndExportDataRow, row ){
         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() );
+        idsrow            := idstable.GetRowByUnit( productcell.Value(), factorycell.Value() );
         traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){
           period          := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() );
           daycolumn       := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), period );
@@ -46,17 +47,14 @@
         }
       }
     }
-    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() );
-      }
+    traverse( interface, InterfaceForecast, forecast, forecast.Origin() = 'PPA' ){
+      idsrow              := idstable.GetRowByUnit( forecast.PartNumber(), forecast.Factory() );
+      daycolumn           := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), forecast.Date() );
+      weekcolumn          := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), forecast.Date() );
+      monthcolumn         := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), forecast.Date() );
+      idsrow.SetCellValue( daycolumn, [Number]forecast.Quantity() );
+      idsrow.SetCellValue( weekcolumn, [Number]forecast.Quantity() );
+      idsrow.SetCellValue( monthcolumn, [Number]forecast.Quantity() );
     }
     
     source.Delete();

--
Gitblit v1.9.3