From 6031e3a259a15dff61ef18bfe90f8c1b27cfcb12 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期二, 03 十二月 2024 17:09:27 +0800
Subject: [PATCH] 接口同步过来的库存数据如果属于PL则除4向下取整

---
 _Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl                    |    5 ++++-
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl                 |    7 +++++++
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory#575.qbl |    2 +-
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl     |    6 +++---
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl
index e25faf2..6f4953b 100644
--- a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl
@@ -1,6 +1,7 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Generate (
+  MacroPlan macroplan,
   InterfaceDataset interfaceDataset,
   Date date,
   String partno,
@@ -16,9 +17,15 @@
     if( isnull( iid ) ){
       iid := interfaceDataset.InventoryInterfaceData( relnew, Date := date, PartNumber := partno );
     }
+    product    := selectobject( macroplan, Product_MP, product, product.ID() = partno );
+    if( not isnull( product ) and exists( product.GetAllParent(), Elements, proparent, proparent.ID() = 'PL' ) ){
+      quantitiy   := floor( [Real]quantitiy / 4 );
+    }
     iidl := selectobject( iid, InventoryInterfaceDataDetail, detail, detail.InventoryPoint() = inventory and detail.Fac() = fac );
     if( isnull( iidl ) ){
       iid.InventoryInterfaceDataDetail( relnew, Date := date, PartNumber := partno, InventoryPoint := inventory, Fac := fac, Quantity := quantitiy );
+    }else{
+      iidl.Quantity( );
     }
   *]
 }
diff --git "a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory\043575.qbl" "b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory\043575.qbl"
index 8e54a36..4f320fb 100644
--- "a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory\043575.qbl"
+++ "b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory\043575.qbl"
@@ -17,7 +17,7 @@
     // 鑾峰彇鎸囧畾鏃ユ湡搴撳瓨鎺ュ彛鏁版嵁
     //鍙戝姩鏈烘垚鍝佸簱瀛�
     traverse( inventorys, Elements, inventory ){
-      InventoryInterfaceData::Generate( owner, inventory.DDay(), inventory.FourCode(), inventory.BIPlace(), inventory.Fac(), [Number]inventory.Total() );
+      InventoryInterfaceData::Generate( macroplan, owner, inventory.DDay(), inventory.FourCode(), inventory.BIPlace(), inventory.Fac(), [Number]inventory.Total() );
     }
   *]
 }
diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl
index 5265de1..9b85645 100644
--- a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl
@@ -1,7 +1,7 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod SynchronizeInventory (
-  const MacroPlan macroPlan,
+  MacroPlan macroPlan,
   InterfaceDataset interfaceDataset
 )
 {
@@ -22,11 +22,11 @@
         if( inventory.Fac() = 'DL' and inventory.Lgort() = 'All' ){
           inventoryname := inventory.LineType();
         }
-        InventoryInterfaceData::Generate( interfaceDataset, inventory.DDay(), inventory.MaterialNo(), inventoryname, inventory.Fac(), [Number]inventory.Total() );
+        InventoryInterfaceData::Generate( macroPlan, interfaceDataset, inventory.DDay(), inventory.MaterialNo(), inventoryname, inventory.Fac(), [Number]inventory.Total() );
       }
       //鍙戝姩鏈烘垚鍝佸簱瀛�
       traverse( loginfo, FinishedEngineInventory, inventory ){
-        InventoryInterfaceData::Generate( interfaceDataset, inventory.DDay(), inventory.FourCode(), inventory.BIPlace(), inventory.Fac(), [Number]inventory.Total() );
+        InventoryInterfaceData::Generate( macroPlan, interfaceDataset, inventory.DDay(), inventory.FourCode(), inventory.BIPlace(), inventory.Fac(), [Number]inventory.Total() );
       }
     }
   *]
diff --git a/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl b/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl
index 292e5e8..e850149 100644
--- a/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl
+++ b/_Main/BL/Type_MachineStockData/StaticMethod_Synchronize.qbl
@@ -30,7 +30,10 @@
         if( inventory.Fac() = 'DL' and inventory.Lgort() = 'All' ){
           inventoryname := inventory.LineType();
         }
-        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