From 79b612b28a40fa1836ebbeb5b4cc23ad30588d92 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 26 十二月 2024 16:18:27 +0800
Subject: [PATCH] 库存接口数据自动推送bug修改

---
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate0.qbl    |   20 ++++++++++
 _Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl        |   10 ++++-
 _Main/BL/Type_FinishedEngineInventory/StaticMethod_Synchronize.qbl |   13 +++++-
 _Main/BL/Type_InventorySummaryReport/Method_GenerateShow#925.qbl   |   27 +++++++------
 4 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/_Main/BL/Type_FinishedEngineInventory/StaticMethod_Synchronize.qbl b/_Main/BL/Type_FinishedEngineInventory/StaticMethod_Synchronize.qbl
index efe4c0f..a0bd2ee 100644
--- a/_Main/BL/Type_FinishedEngineInventory/StaticMethod_Synchronize.qbl
+++ b/_Main/BL/Type_FinishedEngineInventory/StaticMethod_Synchronize.qbl
@@ -28,11 +28,18 @@
         sadata := FinishedEngineInventory::GenerateData( loginfo, cnv2, item );
         sadatalist.Add( sadata );
       }
-      
-      options := DatasetFindOptions::Construct( 'MacroPlan' ).IncludeOffline( true ); //to load we must search offline datasets.
+      options := DatasetFindOptions::Construct( 'ScenarioManager' );//.IncludeOffline( true ); //to load we must search offline datasets.
       mdskey := DatasetController::FindUnique( options );
     
-      MDSMacroPlan::Root( mdskey ) -> InventoryInterfaceData::SynchronizeInventory( owner, sadatalist );
+      MDSScenarioManager::Root( mdskey ) -> ( scenariomanager ) {
+        traverse( scenariomanager, ScenarioMP, smp ){
+          MDSMacroPlan::Root( smp.DatasetMDSID() ) -> InventoryInterfaceData::SynchronizeInventory( owner, sadatalist );
+        }
+      } 
+    //  options := DatasetFindOptions::Construct( 'MacroPlan' );//.IncludeOffline( true ); //to load we must search offline datasets.
+    //  mdskey := DatasetController::FindUnique( options );
+    //
+    //  MDSMacroPlan::Root( mdskey ) -> InventoryInterfaceData::SynchronizeInventory( owner, sadatalist );
     }
   *]
 }
diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate0.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate0.qbl
new file mode 100644
index 0000000..d42d542
--- /dev/null
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate0.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Generate (
+  ScenarioManager scenariomanager,
+  InterfaceDataset interfaceDataset,
+  Date date,
+  String partno,
+  String inventory,
+  String fac,
+  Number quantitiy
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jul-26-2024 (created)
+    traverse( scenariomanager, ScenarioMP, smp ){
+      MDSMacroPlan::Root( smp.DatasetMDSID() ) -> InventoryInterfaceData::Generate( interfaceDataset, date, partno, inventory, fac, quantitiy );
+    }
+  *]
+}
diff --git "a/_Main/BL/Type_InventorySummaryReport/Method_GenerateShow\043925.qbl" "b/_Main/BL/Type_InventorySummaryReport/Method_GenerateShow\043925.qbl"
index 43e03de..feef906 100644
--- "a/_Main/BL/Type_InventorySummaryReport/Method_GenerateShow\043925.qbl"
+++ "b/_Main/BL/Type_InventorySummaryReport/Method_GenerateShow\043925.qbl"
@@ -22,19 +22,20 @@
           daycells            := selectset( row, InventorySummaryCell, cell, cell.InventorySummaryColumn().TimeUnit() = Translations::MP_GlobalParameters_Day() and
                                             cell.InventorySummaryColumn().StartDate() >= column.StartDate() and 
                                             cell.InventorySummaryColumn().StartDate() <= column.EndaDate() );
-            
-          endinginventory     := maxobject( daycells, Elements, e, e.InventorySummaryColumn().StartDate() ).EndingInventory();
-          minimuminventory    := min( daycells, Elements, e, e.MinimumInventory() );
-          maximuminventory    := max( daycells, Elements, e, e.MaximumInventory() );
-          averageinventory    := [Number]average( daycells, Elements, e, e.AverageInventory() );
-            
-          showcell := column.InventorySummaryCell( relnew, EndingInventory := endinginventory, MinimumInventory := minimuminventory, MaximumInventory := maximuminventory, AverageInventory := averageinventory );
-          showrow.InventorySummaryCell( relinsert, showcell );
-            
-          sumcell.EndingInventory( sumcell.EndingInventory() + endinginventory );
-          sumcell.MinimumInventory( sumcell.MinimumInventory() + minimuminventory );
-          sumcell.MaximumInventory( sumcell.MaximumInventory() + maximuminventory);
-          sumcell.AverageInventory( sumcell.AverageInventory() + averageinventory );
+          if( daycells.Size() > 0 ){
+            endinginventory     := maxobject( daycells, Elements, e, e.InventorySummaryColumn().StartDate() ).EndingInventory();
+            minimuminventory    := min( daycells, Elements, e, e.MinimumInventory() );
+            maximuminventory    := max( daycells, Elements, e, e.MaximumInventory() );
+            averageinventory    := [Number]average( daycells, Elements, e, e.AverageInventory() );
+              
+            showcell := column.InventorySummaryCell( relnew, EndingInventory := endinginventory, MinimumInventory := minimuminventory, MaximumInventory := maximuminventory, AverageInventory := averageinventory );
+            showrow.InventorySummaryCell( relinsert, showcell );
+              
+            sumcell.EndingInventory( sumcell.EndingInventory() + endinginventory );
+            sumcell.MinimumInventory( sumcell.MinimumInventory() + minimuminventory );
+            sumcell.MaximumInventory( sumcell.MaximumInventory() + maximuminventory);
+            sumcell.AverageInventory( sumcell.AverageInventory() + averageinventory );
+          }
         }
       }
     }
diff --git a/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl b/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl
index e850149..f3dd8a8 100644
--- a/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl
+++ b/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl
@@ -30,10 +30,16 @@
         if( inventory.Fac() = 'DL' and inventory.Lgort() = 'All' ){
           inventoryname := inventory.LineType();
         }
-        options := DatasetFindOptions::Construct( 'MacroPlan' ).IncludeOffline( true ); //to load we must search offline datasets.
+        
+        options := DatasetFindOptions::Construct( 'ScenarioManager' );//.IncludeOffline( true ); //to load we must search offline datasets.
         mdskey := DatasetController::FindUnique( options );
       
-        MDSMacroPlan::Root( mdskey ) -> InventoryInterfaceData::Generate( owner, inventory.DDay(), inventory.MaterialNo(), inventoryname, inventory.Fac(), [Number]inventory.Total() );
+        MDSScenarioManager::Root( mdskey ) -> InventoryInterfaceData::Generate( owner, inventory.DDay(), inventory.MaterialNo(), inventoryname, inventory.Fac(), [Number]inventory.Total() );
+        
+    //    options := DatasetFindOptions::Construct( 'MacroPlan' );//.IncludeOffline( true ); //to load we must search offline datasets.
+    //    mdskey := DatasetController::FindUnique( options );
+    //  
+    //    MDSMacroPlan::Root( mdskey ) -> InventoryInterfaceData::Generate( owner, inventory.DDay(), inventory.MaterialNo(), inventoryname, inventory.Fac(), [Number]inventory.Total() );
     //    sadatalist.Add( sadata );
       }
     }

--
Gitblit v1.9.3