From 2f15110a6b35c72d993d7ea46e8a9be9868ddd81 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 26 七月 2024 17:15:16 +0800
Subject: [PATCH] 接口数据同步到库存更新页面

---
 /dev/null                                                                                                                                         |    8 ----
 _Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Response_listContextMenuInventoryInterfaceData_MenuSynchronizeInventory_OnCl.def |   16 ++++++++
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl                                                                                    |   23 +++++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Component_listContextMenuInventoryInterfaceData.def                              |   11 +++++
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl                                                                        |   30 +++++++++++++++
 5 files changed, 80 insertions(+), 8 deletions(-)

diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl
new file mode 100644
index 0000000..ea304d5
--- /dev/null
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Generate.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Generate (
+  InterfaceDataset interfaceDataset,
+  Date date,
+  String partno,
+  String inventory,
+  Number quantitiy
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jul-26-2024 (created)
+    iid := selectobject( interfaceDataset, InventoryInterfaceData, iid, iid.Date() = date and iid.PartNumber() = partno );
+    if( isnull( iid ) ){
+      iid := interfaceDataset.InventoryInterfaceData( relnew, Date := date, PartNumber := partno );
+    }
+    iidl := selectobject( iid, InventoryInterfaceDataDetail, detail, detail.InventoryPoint() = inventory );
+    if( isnull( iidl ) ){
+      iid.InventoryInterfaceDataDetail( relnew, Date := date, PartNumber := partno, InventoryPoint := inventory, Quantity := quantitiy );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl
new file mode 100644
index 0000000..e2cb5e9
--- /dev/null
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeInventory.qbl
@@ -0,0 +1,30 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeInventory (
+  const MacroPlan macroPlan,
+  InterfaceDataset interfaceDataset
+)
+{
+  TextBody:
+  [*
+    
+    //娓呯┖鍘熸湁鐨勫簱瀛樻洿鏂版暟鎹�
+    //traverse( interfaceDataset, InventoryInterfaceData, iid, iid.Date() = date ){
+    //  iid.Delete();
+    //}
+    // 鑾峰彇鎸囧畾鏃ユ湡搴撳瓨鎺ュ彛鏁版嵁
+    traverse( interfaceDataset, InterfaceLoginfo, loginfo, loginfo.Last() 
+              and ( loginfo.Name() = Translations::InterfaceDataset_MachineStockData_Name() 
+                    or loginfo.Name() = Translations::InterfaceDataset_FinishedEngineInventory_Name() ) ){
+      //鏈哄姞搴撳瓨
+      traverse( loginfo, MachineStockData, inventory ){
+        InventoryInterfaceData::Generate( interfaceDataset, inventory.DDay(), inventory.MaterialNo(), inventory.LineType(), [Number]inventory.Total() );
+      }
+      //鍙戝姩鏈烘垚鍝佸簱瀛�
+      traverse( loginfo, FinishedEngineInventory, inventory ){
+        product    := select( macroPlan, Product_MP, product, product.Notes() = inventory.FourCode() );
+        InventoryInterfaceData::Generate( interfaceDataset, inventory.DDay(), product.ID(), inventory.BIPlace(), [Number]inventory.Total() );
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_MachineStockData/Attribute_Date.qbl b/_Main/BL/Type_MachineStockData/Attribute_Date.qbl
deleted file mode 100644
index 4bc883d..0000000
--- a/_Main/BL/Type_MachineStockData/Attribute_Date.qbl
+++ /dev/null
@@ -1,7 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Date
-{
-  #keys: '3[415136.0.931886848][415136.0.931886847][415136.0.931886849]'
-  ValueType: Date
-}
diff --git a/_Main/BL/Type_MachineStockData/Attribute_Inventory.qbl b/_Main/BL/Type_MachineStockData/Attribute_Inventory.qbl
deleted file mode 100644
index b983b8f..0000000
--- a/_Main/BL/Type_MachineStockData/Attribute_Inventory.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Inventory
-{
-  #keys: '3[415136.0.931886842][415136.0.931886841][415136.0.931886843]'
-  Description: '瀵瑰簲鏃ユ湡鐨勫疄闄呭簱瀛樻暟閲�'
-  ValueType: Real
-}
diff --git a/_Main/BL/Type_MachineStockData/Attribute_Product.qbl b/_Main/BL/Type_MachineStockData/Attribute_Product.qbl
deleted file mode 100644
index a249e20..0000000
--- a/_Main/BL/Type_MachineStockData/Attribute_Product.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Product
-{
-  #keys: '3[415136.0.931886845][415136.0.931886844][415136.0.931886846]'
-  Description: '浜у搧'
-  ValueType: String
-}
diff --git a/_Main/BL/Type_MachineStockData/Attribute_Unit.qbl b/_Main/BL/Type_MachineStockData/Attribute_Unit.qbl
deleted file mode 100644
index 0fb83f7..0000000
--- a/_Main/BL/Type_MachineStockData/Attribute_Unit.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Attribute Unit
-{
-  #keys: '3[415136.0.931886839][415136.0.931886838][415136.0.931886840]'
-  Description: '搴撳瓨鐐逛俊鎭�'
-  ValueType: String
-}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Component_listContextMenuInventoryInterfaceData.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Component_listContextMenuInventoryInterfaceData.def
index 6d00296..0c89602 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Component_listContextMenuInventoryInterfaceData.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Component_listContextMenuInventoryInterfaceData.def
@@ -16,6 +16,17 @@
         Title: '娴嬭瘯浣跨敤'
       ]
     }
+    Component MenuSynchronizeInventory
+    {
+      #keys: '[415136.0.952610516]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'ARROW_CIRCLE2'
+        Taborder: 4
+        Title: 'Synchronize inventory'
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Response_listContextMenuInventoryInterfaceData_MenuSynchronizeInventory_OnCl.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Response_listContextMenuInventoryInterfaceData_MenuSynchronizeInventory_OnCl.def
new file mode 100644
index 0000000..d34a5fc
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventoryInterfaceData/Response_listContextMenuInventoryInterfaceData_MenuSynchronizeInventory_OnCl.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: listContextMenuInventoryInterfaceData/MenuSynchronizeInventory
+Response OnClick () id:Response_listContextMenuInventoryInterfaceData_MenuSynchronizeInventory_OnClick
+{
+  #keys: '[415136.0.953720206]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebMenu_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      InventoryInterfaceData::SynchronizeInventory( MacroPlan, InterfaceDataset );
+    *]
+    GroupServerCalls: false
+  }
+}

--
Gitblit v1.9.3