From ead7f5c6ccba143a88fb38568606a8a8e8be419d Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 06 九月 2024 14:54:31 +0800
Subject: [PATCH] 删除无用方法

---
 /dev/null                                                        |    8 ----
 _Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl    |   74 +++++++++++++++++++++++++++++++++++++
 _Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl |   35 ++++++++++-------
 3 files changed, 95 insertions(+), 22 deletions(-)

diff --git a/_Main/BL/Type_CustomerDemandIDS/Method_SyncRows.qbl b/_Main/BL/Type_CustomerDemandIDS/Method_SyncRows.qbl
deleted file mode 100644
index 0106865..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/Method_SyncRows.qbl
+++ /dev/null
@@ -1,39 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method SyncRows
-{
-  TextBody:
-  [*
-    totalRows := 0;
-    totalColumns := this.Column( relsize );
-    
-    if ( totalColumns > 0 ) {
-      randomCol := select( this, Column, tempFPC, true );
-      totalRows := randomCol.Cell( relsize );
-      
-      this.Row( relflush );
-      
-      cells := construct( CustomerDemandIDSCells );
-      traverse ( this, Column, fpc ) {
-        cells.Add( fpc.FirstCellInColumn() );
-      }
-      
-      for ( i := 0; i < totalRows; i++ ) {
-        assert( selectvalues( cells, Elements, c, true, c.Column().Index() ).ToString( "" ) = 
-                selectvalues( selectsortedset( cells, Elements, c, true, c.Column().Index() ), Elements, c, true, c.Column().Index() ).ToString( "" ),
-                "Assertion error in FrockDataTable::syncRows: Cells not sorted by column index" );
-        row := this.Row( relnew, RowNr := i );
-        
-        newCells := construct( CustomerDemandIDSCells );
-        
-        traverse ( cells, Elements, c ) {
-          row.Cell( relinsert, c );
-          
-          newCells.Add( c.NextCellInColumn() );
-        }
-        
-        cells := &newCells;
-      }
-    }
-  *]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
new file mode 100644
index 0000000..1ccd93d
--- /dev/null
+++ b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_GenerateData.qbl
@@ -0,0 +1,74 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GenerateData (
+  const MacroPlan macroplan,
+  RecycleBin recycle,
+  const Archive archive,
+  InterfaceDataset interfaceDataset,
+  String executor,
+  Boolean versionflag
+)
+{
+  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 );
+    }
+    binaryValue           := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() );
+    source                := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
+    source.ReadStructure();
+    Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) );
+    cnv2 := StringToDate::StandardConverter();
+    cnv2.SetCustomConversion();
+    cnv2.CustomFormatString( "dd/MM/yyyy" );
+    traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){
+      traverse( table, GeneralExcelImportAndExportDataRow, row ){
+        product             := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 );
+        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 );
+        }
+      }
+    }
+    source.Delete();
+    loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
+  *]
+}
diff --git a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_ReadStructure.qbl b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_ReadStructure.qbl
deleted file mode 100644
index f0b4327..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_ReadStructure.qbl
+++ /dev/null
@@ -1,33 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod ReadStructure (
-  BinaryValue binaryvalue,
-  InterfaceDataset owner
-)
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Sep-3-2024 (created)
-    tableGroupHandle := TableGroupHandle::Create( 'IDS鍏ㄨ〃' );
-    tableGroupHandle := XLS::LoadTableGroupFromBinaryData( binaryvalue.AsBinaryData(), tableGroupHandle, true, true );
-    sheets := tableGroupHandle.TableNames();
-    
-    traverse ( sheets, Elements, sheetName ) {
-      tableHandle := tableGroupHandle.Table( sheetName );
-      tableXML := TableHandle::ExportXML( tableHandle );
-      
-    //  info( tableXML.AsQUILL() );
-      
-      CustomerDemandIDS::XMLFileImportCustomerDemandIDSXMLHeaders( tableXML );
-      xlstable := CustomerDemandIDS::XMLImportCustomerDemandIDSXML( tableXML );
-    
-      xlstable.SyncRows();
-    
-      xlstable.Name( sheetName );
-      owner.CustomerDemandIDS( relinsert, &xlstable ); 
-      
-      Transaction::Transaction().Propagate( attribute( CustomerDemandIDSColumn, Index ) );
-    
-    }
-  *]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_Key.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_Key.qbl
deleted file mode 100644
index 4f408a0..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_Key.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLElementId
-{
-  XMLAddressType { }
-  XMLID Key { }
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_QuintiqType.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_QuintiqType.qbl
deleted file mode 100644
index 7468757..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_QuintiqType.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLElementId
-{
-  XMLID QuintiqType { }
-  XMLQualifierType { }
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_cell.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_cell.qbl
deleted file mode 100644
index c4fd297..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_cell.qbl
+++ /dev/null
@@ -1,17 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLObjectBase.ObjectDefinitions
-{
-  IdField: Key
-  ObjectTypeField: QuintiqType
-  TargetType: CustomerDemandIDSCell
-  XMLID cell { }
-  Attributes:
-  [
-    XMLAttribute
-    {
-      Attribute: Value
-      XMLID value { }
-    }
-  ]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_column.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_column.qbl
deleted file mode 100644
index 4a97560..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_column.qbl
+++ /dev/null
@@ -1,27 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLObjectBase.ObjectDefinitions
-{
-  IdField: Key
-  ObjectTypeField: QuintiqType
-  TargetType: CustomerDemandIDSColumn
-  XMLID column { }
-  Aggregates:
-  [
-    XMLAggregate
-    {
-      ElementDefinition: cell
-      GenerateOutput: false
-      Relation: Cell
-      XMLID Cell { }
-    }
-  ]
-  Attributes:
-  [
-    XMLAttribute
-    {
-      Attribute: Name
-      XMLID name { }
-    }
-  ]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_table.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_table.qbl
deleted file mode 100644
index ebf311d..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_table.qbl
+++ /dev/null
@@ -1,27 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLObjectBase.ObjectDefinitions
-{
-  IdField: Key
-  ObjectTypeField: QuintiqType
-  TargetType: CustomerDemandIDS
-  XMLID table { }
-  Aggregates:
-  [
-    XMLAggregate
-    {
-      ElementDefinition: column
-      GenerateOutput: false
-      Relation: Column
-      XMLID Column { }
-    }
-  ]
-  Attributes:
-  [
-    XMLAttribute
-    {
-      Attribute: Name
-      XMLID name { }
-    }
-  ]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/_ROOT_XML_CustomerDemandIDSXML.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/_ROOT_XML_CustomerDemandIDSXML.qbl
deleted file mode 100644
index a0513a0..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/_ROOT_XML_CustomerDemandIDSXML.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#root
-#parent: #root
-XML CustomerDemandIDSXML
-{
-  Direction: 'ImportExport'
-  Root: table
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_Key.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_Key.qbl
deleted file mode 100644
index 4f408a0..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_Key.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLElementId
-{
-  XMLAddressType { }
-  XMLID Key { }
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_QuintiqType.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_QuintiqType.qbl
deleted file mode 100644
index 7468757..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_QuintiqType.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLElementId
-{
-  XMLID QuintiqType { }
-  XMLQualifierType { }
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_column.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_column.qbl
deleted file mode 100644
index c3c96e9..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_column.qbl
+++ /dev/null
@@ -1,17 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLObjectBase.ObjectDefinitions
-{
-  IdField: Key
-  ObjectTypeField: QuintiqType
-  TargetType: CustomerDemandIDSColumn
-  XMLID column { }
-  Attributes:
-  [
-    XMLAttribute
-    {
-      Attribute: Name
-      XMLID name { }
-    }
-  ]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_table.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_table.qbl
deleted file mode 100644
index ebf311d..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_table.qbl
+++ /dev/null
@@ -1,27 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-XMLObjectBase.ObjectDefinitions
-{
-  IdField: Key
-  ObjectTypeField: QuintiqType
-  TargetType: CustomerDemandIDS
-  XMLID table { }
-  Aggregates:
-  [
-    XMLAggregate
-    {
-      ElementDefinition: column
-      GenerateOutput: false
-      Relation: Column
-      XMLID Column { }
-    }
-  ]
-  Attributes:
-  [
-    XMLAttribute
-    {
-      Attribute: Name
-      XMLID name { }
-    }
-  ]
-}
diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/_ROOT_XML_CustomerDemandIDSXMLHeaders.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/_ROOT_XML_CustomerDemandIDSXMLHeaders.qbl
deleted file mode 100644
index 8c8b3e2..0000000
--- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/_ROOT_XML_CustomerDemandIDSXMLHeaders.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#root
-#parent: #root
-XML CustomerDemandIDSXMLHeaders
-{
-  Direction: 'ImportExport'
-  Root: table
-}
diff --git a/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
index 2139612..1ccd93d 100644
--- a/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl
@@ -2,6 +2,7 @@
 #parent: #root
 StaticMethod GenerateData (
   const MacroPlan macroplan,
+  RecycleBin recycle,
   const Archive archive,
   InterfaceDataset interfaceDataset,
   String executor,
@@ -33,6 +34,7 @@
                                                                  , 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()
@@ -43,25 +45,30 @@
       loginfo.CustomerDemandPPAIDS( relinsert, cd );
     }
     binaryValue           := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() );
-    CustomerDemandIDS::ReadStructure( binaryValue, interfaceDataset );
-    productcolumn         := select( interfaceDataset, CustomerDemandIDS.Column, column, column.Index() = 1 );
+    source                := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" );
+    source.ReadStructure();
+    Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) );
     cnv2 := StringToDate::StandardConverter();
     cnv2.SetCustomConversion();
     cnv2.CustomFormatString( "dd/MM/yyyy" );
-    traverse( interfaceDataset, CustomerDemandIDS.Row, row ){
-      product             := selectobject( row, Cell, cell, cell.Column() = productcolumn );
-      traverse( row, Cell, cell, cell.Column().Index() > 3 ){
-        period := cnv2.Convert( cell.Column().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 );
+    traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){
+      traverse( table, GeneralExcelImportAndExportDataRow, row ){
+        product             := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 );
+        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 );
+        }
       }
     }
+    source.Delete();
     loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
   *]
 }

--
Gitblit v1.9.3