From c6e8187d8a90489b985609fe7d94d4996ecee491 Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期五, 15 十一月 2024 16:53:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 _Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
index db43831..546ae21 100644
--- a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
@@ -2,7 +2,7 @@
 #parent: #root
 StaticMethod GenerateData (
   InterfaceDataset interface,
-  const MacroPlan macroplan,
+  MacroPlan macroplan,
   RecycleBin recycle,
   const Archive archive
 )
@@ -15,12 +15,15 @@
     //interface.CustomerDemandIDSSearch( relflush );
     info( '-------------------------Start---------------------');
     allunit               := CustomerDemandIDS::GetDefaultAllUnit();
-    if( isnull( interface.CustomerDemandIDSSearch() ) ){
-      interface.CustomerDemandIDSSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit );
-    }
-    idstable              := selectobject( interface, CustomerDemandIDS, idstable, idstable.ID() = '瀹㈡埛闇�姹�' );
+    search                := interface.CustomerDemandIDSSearch( relnew, Product := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit );
+    name                  := '瀹㈡埛闇�姹�';
+    idstable              := selectobject( interface, CustomerDemandIDS, idstable, idstable.ID() = name );
     if( isnull( idstable ) ){
-      idstable            := interface.CustomerDemandIDS( relnew, ID := '瀹㈡埛闇�姹�', Name := '瀹㈡埛闇�姹�' );
+      idstable            := interface.CustomerDemandIDS( relnew, ID := name, Name := name );
+    }
+    showtable             := selectobject( interface, CustomerDemandIDS, version, version.IsShow() );
+    if( isnull( showtable ) ){
+      showtable           := interface.CustomerDemandIDS( relnew, ID := name + 'Show', Name := name, IsShow := true );
     }
     binaryValue           := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() );
     source                := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
@@ -34,7 +37,7 @@
     periods               := idsdates.Union( ppadates );
     periods               := selectuniquevalues( periods, Elements, e, not exists( idstable, Column, column, column.StartDate() = e ), e );
     if( periods.Size() > 0 ){
-      idstable.GenerateColumn( periods.Sort() );
+      idstable.GenerateColumn( periods.Sort(), false );
     }
     traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){
       traverse( table, GeneralExcelImportAndExportDataRow, row ){
@@ -54,8 +57,12 @@
       }
     }
     traverse ( macroplan, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.Product_MP() ) and forecast.Origin() = 'PPA' ){
+      unitname              := ifexpr( forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) 
+                                       or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) )
+                                       , FinancialProductionReport::GetDefaultCCUnit()
+                                       , FinancialProductionReport::GetDefaultDLUnit() );
       traverse( forecast, PlanningSalesDemandInPeriod, sdip ){
-        idsrow              := idstable.GetRowByUnit( forecast.ProductID(), forecast.SalesSegmentName() );
+        idsrow              := idstable.GetRowByUnit( forecast.ProductID(), unitname );
         daycolumn           := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), sdip.StartDate() );
         weekcolumn          := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), sdip.StartDate() );
         monthcolumn         := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), sdip.StartDate() );
@@ -68,5 +75,6 @@
     
     source.Delete();
     info( '-------------------------End---------------------');
+    showtable.Generate( search );
   *]
 }

--
Gitblit v1.9.3