From d043f7992783c85310aab0afd2c13f2e63839c3d Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 03 七月 2024 15:58:05 +0800
Subject: [PATCH] 库存汇总下载完成

---
 _Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl   |   85 +++++++++++++++++++++++++++++++++++-------
 _Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl |    7 ++-
 2 files changed, 75 insertions(+), 17 deletions(-)

diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl
index 6fe5b7f..2f2dbb5 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl
@@ -8,7 +8,7 @@
   TextBody:
   [*
     
-    table := selectobject( macroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
+    table := selectobject( macroPlan, InventorySummarySource.InventorySummaryReport, table, table.IsShow() );
     
     xmlDOMI := XMLDOMImplementation::Create();
     xmlDOM  := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
@@ -30,10 +30,19 @@
     unittypeelement.TextContent( "String" );
     unitcolumnelement.AppendChild( unitnameelement );
     unitcolumnelement.AppendChild( unittypeelement );
+    //Attribute
+    attricolumnelement := xmlDOM.CreateElement( "column" );
+    attrinameelement   := xmlDOM.CreateElement( "name" );
+    attritypeelement   := xmlDOM.CreateElement( "type" );
+    attrinameelement.TextContent( 'Attribute' );
+    attritypeelement.TextContent( "String" );
+    attricolumnelement.AppendChild( attrinameelement );
+    attricolumnelement.AppendChild( attritypeelement );
     
     tableElement.AppendChild( productcolumnelement ); 
     tableElement.AppendChild( unitcolumnelement ); 
-    traverse ( table, FinancialSalesColumn, column ) {
+    tableElement.AppendChild( attricolumnelement );
+    traverse ( table, InventorySummaryColumn, column ) {
       columnelement := xmlDOM.CreateElement( "column" );
       nameelement   := xmlDOM.CreateElement( "name" );
       typeelement   := xmlDOM.CreateElement( "type" );
@@ -42,23 +51,71 @@
       columnelement.AppendChild( nameelement );
       columnelement.AppendChild( typeelement );
       
-      cells := selectsortedset( column, FinancialSalesCell, cell, cell.FinancialSalesRow().RowNr() );
+      cells := selectsortedset( column, InventorySummaryCell, cell, cell.InventroySummaryRow().RowNr() );
     
       traverse ( cells, Elements, c ) {
         if( column.Index() = 0 ){
-          row := c.FinancialSalesRow();
+          row := c.InventroySummaryRow();
           //Product
-          productcellElement := xmlDOM.CreateElement( "cell" );
-          productcellElement.SetAttribute( "value", row.Name() );
-          productcolumnelement.AppendChild( productcellElement );
+          productcellElement1 := xmlDOM.CreateElement( "cell" );
+          productcellElement1.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement1 );
+          productcellElement2 := xmlDOM.CreateElement( "cell" );
+          productcellElement2.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement2 );
+          productcellElement3 := xmlDOM.CreateElement( "cell" );
+          productcellElement3.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement3 );
+          productcellElement4 := xmlDOM.CreateElement( "cell" );
+          productcellElement4.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement4 );
           //Unit
-          unitcellElement := xmlDOM.CreateElement( "cell" );
-          unitcellElement.SetAttribute( "value", row.Unit() );
-          unitcolumnelement.AppendChild( unitcellElement );
+          unitcellElement1 := xmlDOM.CreateElement( "cell" );
+          unitcellElement1.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement1 );
+          unitcellElement2 := xmlDOM.CreateElement( "cell" );
+          unitcellElement2.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement2 );
+          unitcellElement3 := xmlDOM.CreateElement( "cell" );
+          unitcellElement3.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement3 );
+          unitcellElement4 := xmlDOM.CreateElement( "cell" );
+          unitcellElement4.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement4 );
+          //Attribute
+          //鏈熸湯搴撳瓨
+          endcellElement := xmlDOM.CreateElement( "cell" );
+          endcellElement.SetAttribute( "value", 'EndingInventory' );
+          attricolumnelement.AppendChild( endcellElement );
+          //鏈�灏忓簱瀛�
+          mincellElement := xmlDOM.CreateElement( "cell" );
+          mincellElement.SetAttribute( "value", 'MinimumInventory' );
+          attricolumnelement.AppendChild( mincellElement );
+          //鏈�澶у簱瀛�
+          maxcellElement := xmlDOM.CreateElement( "cell" );
+          maxcellElement.SetAttribute( "value", 'MaximumInventory' );
+          attricolumnelement.AppendChild( maxcellElement );
+          //骞冲潎搴撳瓨
+          avecellElement := xmlDOM.CreateElement( "cell" );
+          avecellElement.SetAttribute( "value", 'AverageInventory' );
+          attricolumnelement.AppendChild( avecellElement );
         }
-        cellElement := xmlDOM.CreateElement( "cell" );
-        cellElement.SetAttribute( "value", c.Value() ); 
-        columnelement.AppendChild( cellElement );
+        //鏈熸湯搴撳瓨
+        endcellElement := xmlDOM.CreateElement( "cell" );
+        endcellElement.SetAttribute( "value", [String]c.EndingInventory() );
+        columnelement.AppendChild( endcellElement );
+        //鏈�灏忓簱瀛�
+        mincellElement := xmlDOM.CreateElement( "cell" );
+        mincellElement.SetAttribute( "value", [String]c.MinimumInventory() );
+        columnelement.AppendChild( mincellElement );
+        //鏈�澶у簱瀛�
+        maxcellElement := xmlDOM.CreateElement( "cell" );
+        maxcellElement.SetAttribute( "value", [String]c.MaximumInventory() );
+        columnelement.AppendChild( maxcellElement );
+        //骞冲潎搴撳瓨
+        avecellElement := xmlDOM.CreateElement( "cell" );
+        avecellElement.SetAttribute( "value", [String]c.AverageInventory() );
+        columnelement.AppendChild( avecellElement );
       }
       tableElement.AppendChild( columnelement );  
     }
@@ -67,7 +124,7 @@
     
     //info( xmlString );
     
-    tableGroupHandle := TableGroupHandle::Create( FinancialSalesReport::GetDefaultName() );
+    tableGroupHandle := TableGroupHandle::Create( InventorySummaryReport::GetDefaultName() );
     tableHandle      := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
     tableGroupHandle.Add( tableHandle );
     
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
index 183c900..455d0bc 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -39,14 +39,15 @@
       unitrow := table.GetRow( unit, product.ID() );
       allrow     := table.GetRow( allunit, product.ID() );
       pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning and pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
-      info( '-----------------------------------', isnull( allrow ), pispips.Size() );
-      traverse( pispips, Elements, pispip ){
-        info( '-----------------------------------', pispip.Start() );
+    //  info( '-----------------------------------', isnull( allrow ), pispips.Size() );
+      traverse( pispips, Elements, pispip, pispip.Start() = startofplanning ){
+    //    info( '-----------------------------------', pispip.Start() );
         period     := pispip.Period_MP();
         periodtime := period.Start().Date();
         periodname := periodtime.Format( "M2/D2/Y" );
         //澶╋紝閫夋嫨鏃ラ绮掑害鏃讹紝鏈熸湯搴撳瓨锛屾渶灏忓簱瀛橈紝鏈�澶у簱瀛樺拰骞冲潎搴撳瓨鐨勬暟鍊间繚鎸佷竴鑷�
         daycolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Day() );
+        info( daycolumn.Name(), daycolumn.Period(), daycolumn.TimeUnit() );
         unitrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
         allrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
         

--
Gitblit v1.9.3