From 61803718fc381b9df10d48de6865f9eb0d766364 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 05 六月 2024 16:15:46 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg

---
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl                                                                      |    2 +-
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl                                              |   53 ++++++++++++++++++++++++-----------------------------
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def |    2 +-
 3 files changed, 26 insertions(+), 31 deletions(-)

diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl
index c68f399..0c51b96 100644
--- a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl
@@ -9,44 +9,39 @@
 {
   TextBody:
   [*
-    // 鑾峰彇鎸囧畾鏃ユ湡搴撳瓨鏁版嵁
+    // 鑾峰彇鎸囧畾鏃ユ湡搴撳瓨鎺ュ彛鏁版嵁
     iids := selectset( interfaceDataset, InventoryInterfaceData, tempIID, tempIID.Date() = date );
     
+    // 娓呯┖鍘熸湰鏁伴噺
     traverse ( iids, Elements.InventoryInterfaceDataDetail, iidd, iidd.InventoryPointSelection().IsIncluded() ) {
       product_MP    := select( products, Elements, tempPMP, tempPMP.ID() = iidd.PartNumber() );
       pisp          := guard( select( product_MP, ProductInStockingPoint_MP, tempPISPMP, tempPISPMP.StockingPointID() = iidd.InventoryPointSelection().StockpoingPoint() ),
                               null( ProductInStockingPoint_MP ) );
       
       if ( not isnull( pisp ) ) {
-        
-      }    
-    //      if ( not isnull( product_MP ) and not isnull( stockpoing_MP ) ) {
-    //        apispip := select( targetMacroPlan, Actual.astype( ActualProductInStockingPointInPeriod ), tempA,
-    //                           tempA.ProductID() = product_MP.ID()              and
-    //                           tempA.StockingPointID() = stockpoing_MP.ID()     and
-    //                           tempA.Date() = ici.DateTime().Date()                 and 
-    //                           tempA.ManufacturedDate() = Date::MinDate() );
-    //        if ( isnull( apispip ) ) {
-    //          ActualProductInStockingPointInPeriod::Create( targetMacroPlan, product_MP, stockpoing_MP, ici.DateTime().Date(),
-    //                                                        Date::MinDate(), [Real]ici.ActualInventoryLevelEnd(), "", false );
-    //        } else {
-    //          apispip.Update( apispip.ActualInventoryLevelEnd() + [Real]ici.ActualInventoryLevelEnd(), "", false );
-    //        }
-    //      }
-    //    } else if ( guard( lisp.StockingPointID() = "HQ-鎬讳粨RF寰呰繑", false ) or
-    //                guard( lisp.StockingPointID() = "HQ-鎬讳粨2D寰呰繑", false ) ) {
-    //      // 鍒涘缓缈绘柊搴撳瓨
-    //      product_MP    := select( targetMacroPlan, Product_MP, tempPMP, tempPMP.ID() = ici.ProductID() );
-    //      stockpoing_MP := select( targetMacroPlan, StockingPoint_MP, tempSPMP, tempSPMP.ID() = "寰呯炕鏂板簱瀛樹粨" );
-    //      
-    //      if ( not isnull( product_MP ) and not isnull( stockpoing_MP ) ) {
-    //        InventorySupply::Create( OS::GenerateGUIDAsString(), product_MP, stockpoing_MP, ici.DateTime().Date(),
-    //                                 Date::MinDate(), guard( [Real]ici.ActualInventoryLevelEnd(), 0.0 ), "", false );
-    //      }
-    //    }
-    //  }
+        apispip := select( pisp, ActualProductInStockingPointInPeriod, tempAPISPIP, tempAPISPIP.Date() = date );
+        if ( not isnull( apispip ) ) {
+          apispip.Update( 0.0, "", false );
+        }
+      }
     }
     
-    //info( "涓暟: ", icis.Size() );
+    // 鍚屾鎺ュ彛鏁版嵁
+    traverse ( iids, Elements.InventoryInterfaceDataDetail, iidd, iidd.InventoryPointSelection().IsIncluded() ) {
+      product_MP    := select( products, Elements, tempPMP, tempPMP.ID() = iidd.PartNumber() );
+      pisp          := guard( select( product_MP, ProductInStockingPoint_MP, tempPISPMP, tempPISPMP.StockingPointID() = iidd.InventoryPointSelection().StockpoingPoint() ),
+                              null( ProductInStockingPoint_MP ) );
+                              
+      if ( not isnull( pisp ) ) {
+        apispip := select( pisp, ActualProductInStockingPointInPeriod, tempAPISPIP, tempAPISPIP.Date() = date );
+        if ( isnull( apispip ) ) {
+          ActualProductInStockingPointInPeriod::Create( macroPlan, product_MP, pisp.StockingPoint_MP(), date,
+                                                        Date::MinDate(), [Real]iidd.Quantity(), "", false );
+          Transaction::Transaction().Propagate( relation( ActualProductInStockingPointInPeriod, ProductInStockingPoint_MP ) ); 
+        } else {
+          apispip.Update( apispip.ActualInventoryLevelEnd() + [Real]iidd.Quantity(), "", false );
+        }
+      }
+    }
   *]
 }
diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
index 0f1b61e..6c9a968 100644
--- a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
@@ -9,7 +9,7 @@
     interfaceDataset.InventoryInterfaceData( relflush );
     interfaceDataset.InventoryPointSelection( relflush );
     
-    iid1 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::ActualDate(), PartNumber := "BLEU EV2 Sports" );
+    iid1 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports" );
     iid1.InventoryInterfaceDataDetail( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports", InventoryPoint := "PXSN", Quantity := 900 );
     iid1.InventoryInterfaceDataDetail( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports", InventoryPoint := "LPLE", Quantity := 800 );
     iid1.InventoryInterfaceDataDetail( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports", InventoryPoint := "3PLE", Quantity := 3100 );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def
index 4f302e2..0195094 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def
@@ -16,7 +16,7 @@
     EnterButton: 'btnOk'
     EscapeButton: 'btnCancel'
     ExcludeFromActiveComponent: true
-    MinimumRows: 30
+    MinimumColumns: 30
     Padding: 'false'
     Title: 'Synchronize Starting Inventory'
   ]

--
Gitblit v1.9.3