From 63edfee9e4f8b3f5810386815816e126312eb6a6 Mon Sep 17 00:00:00 2001
From: lihongji <3117313295@qq.com>
Date: 星期三, 05 六月 2024 15:05:03 +0800
Subject: [PATCH] 库存更新优化

---
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnOk_OnClick.def                      |   15 ++
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl                                                                          |   15 -
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Method_OnOK.def                                            |   17 ++
 _Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl                                                  |   52 ++++++++
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlContent.def                                   |   51 ++++++++
 _Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_MatrixEditorActualInventories#537.def                         |    8 +
 _Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Response_MacroPlanner_pHeader_bSynchronizeStartingInventory_OnClick.def |   22 +++
 _Main/UI/MacroPlannerWebApp/Component_FormInventoryPointSelection/Response_ListInventoryPointSelection_mEnable_OnClick.def          |    4 
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnCancel_OnClick.def                  |   15 ++
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlActions.def                                   |   40 ++++++
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlContent_dsDate_OnCreated.def                   |   16 ++
 _Main/UI/MacroPlannerWebApp/Component_FormActualInventories/_ROOT_Component_FormActualInventories.def                               |   10 +
 _Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def     |   23 +++
 _Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_pHeader.def                                                   |   27 ++++
 _Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_PanelActualInventoriesMatrix.def                              |    9 +
 15 files changed, 313 insertions(+), 11 deletions(-)

diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl
new file mode 100644
index 0000000..c68f399
--- /dev/null
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl
@@ -0,0 +1,52 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeStartingInventory (
+  MacroPlan macroPlan,
+  Product_MPs products,
+  const InterfaceDataset interfaceDataset,
+  Date date
+)
+{
+  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 );
+    //      }
+    //    }
+    //  }
+    }
+    
+    //info( "涓暟: ", icis.Size() );
+  *]
+}
diff --git a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
index 7291d1d..0f1b61e 100644
--- a/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
+++ b/_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
@@ -9,16 +9,9 @@
     interfaceDataset.InventoryInterfaceData( relflush );
     interfaceDataset.InventoryPointSelection( relflush );
     
-    interfaceDataset.InventoryPointSelection( relnew, ProductID := "065100010N", InventoryPoint := "PXSN" );
-    
-    iid1 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::ActualDate() + 1, PartNumber := "065100010N" );
-    iid1.InventoryInterfaceDataDetail( relnew, Date := Date::ActualDate() + 1, PartNumber := "065100010N", InventoryPoint := "PXSN", Quantity := 900 );
-    iid1.InventoryInterfaceDataDetail( relnew, Date := Date::ActualDate() + 1, PartNumber := "065100010N", InventoryPoint := "LPLE", Quantity := 800 );
-    iid1.InventoryInterfaceDataDetail( relnew, Date := Date::ActualDate() + 1, PartNumber := "065100010N", InventoryPoint := "3PLE", Quantity := 3100 );
-    
-    iid2 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::ActualDate() - 1, PartNumber := "065100010S" );
-    iid2.InventoryInterfaceDataDetail( relnew, Date := Date::ActualDate() - 1, PartNumber := "065100010S", InventoryPoint := "ABCD", Quantity := 234 );
-    iid2.InventoryInterfaceDataDetail( relnew, Date := Date::ActualDate() - 1, PartNumber := "065100010S", InventoryPoint := "EIOI", Quantity := 454 );
-    iid2.InventoryInterfaceDataDetail( relnew, Date := Date::ActualDate() - 1, PartNumber := "065100010S", InventoryPoint := "SDNL", Quantity := 232 );
+    iid1 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::ActualDate(), 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/Component_pnlActions.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlActions.def
new file mode 100644
index 0000000..7c29ce9
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlActions.def
@@ -0,0 +1,40 @@
+Quintiq file version 2.0
+Component pnlActions
+{
+  #keys: '[413988.0.1235980439]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component btnOk
+    {
+      #keys: '[413988.0.1235980443]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Label: 'OK'
+        Taborder: 0
+      ]
+    }
+    Component btnCancel
+    {
+      #keys: '[413988.0.1235980445]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Label: 'Cancel'
+        Taborder: 1
+      ]
+    }
+  ]
+  Properties:
+  [
+    Alignment: 'trailing'
+    Border: true
+    ExcludeFromActiveComponent: true
+    FixedSize: true
+    Orientation: 'horizontal'
+    Padding: 'true'
+    Style: 'footer'
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlContent.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlContent.def
new file mode 100644
index 0000000..76c2af9
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Component_pnlContent.def
@@ -0,0 +1,51 @@
+Quintiq file version 2.0
+Component pnlContent
+{
+  #keys: '[413988.0.1235980437]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component ddlProduct_MP
+    {
+      #keys: '[413988.0.1238312575]'
+      BaseType: 'WebDropDownList'
+      Databinding: 'Product_MP'
+      Children:
+      [
+        Component deContent
+        {
+          #keys: '[413988.0.1238312577]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'MacroPlan'
+            Source: 'MacroPlan'
+            Taborder: 0
+            Transformation: 'Product_MP'
+          ]
+        }
+      ]
+      Properties:
+      [
+        DisplayField: 'ID'
+        Label: 'Product'
+        Taborder: 0
+      ]
+    }
+    Component dsDate
+    {
+      #keys: '[413988.0.1238312655]'
+      BaseType: 'WebDateSelector'
+      Properties:
+      [
+        Label: 'Date'
+        Taborder: 1
+      ]
+    }
+  ]
+  Properties:
+  [
+    Padding: 'true'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Method_OnOK.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Method_OnOK.def
new file mode 100644
index 0000000..f13db21
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Method_OnOK.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: #root
+Method OnOK () id:Method_DialogSynchronizeStartingInventory_OnOK
+{
+  #keys: '[413988.0.1239043906]'
+  Body:
+  [*
+    Form.ApplyChanges();
+    
+    InventoryInterfaceData::SynchronizeStartingInventory( MacroPlan,
+                                                          selectset( ddlProduct_MP.Data(), AllChildren.AsChildren, tempPMP, tempPMP.IsLeaf() ),
+                                                          InterfaceDataset,
+                                                          dsDate.Date() );
+    
+    Form.Close();
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnCancel_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnCancel_OnClick.def
new file mode 100644
index 0000000..bac3f88
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnCancel_OnClick.def
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: pnlActions/btnCancel
+Response OnClick () id:Response_pnlActions_btnCancel_OnClick
+{
+  #keys: '[413988.0.1235980449]'
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      Form.Close();
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnOk_OnClick.def
new file mode 100644
index 0000000..a4ebe34
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlActions_btnOk_OnClick.def
@@ -0,0 +1,15 @@
+Quintiq file version 2.0
+#parent: pnlActions/btnOk
+Response OnClick () id:Response_pnlActions_btnOk_OnClick
+{
+  #keys: '[413988.0.1235980448]'
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      Form.OnOK();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlContent_dsDate_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlContent_dsDate_OnCreated.def
new file mode 100644
index 0000000..bf58aa1
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/Response_pnlContent_dsDate_OnCreated.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: pnlContent/dsDate
+Response OnCreated () id:Response_pnlContent_dsDate_OnCreated
+{
+  #keys: '[413988.0.1239043849]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      this.Date( Date::ActualDate() );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def
new file mode 100644
index 0000000..4f302e2
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent DialogSynchronizeStartingInventory
+{
+  #keys: '[413988.0.1235980435]'
+  BaseType: 'WebForm'
+  Children:
+  [
+    #child: pnlContent
+    #child: pnlActions
+  ]
+  Properties:
+  [
+    Alignment: 'trailing'
+    EnterButton: 'btnOk'
+    EscapeButton: 'btnCancel'
+    ExcludeFromActiveComponent: true
+    MinimumRows: 30
+    Padding: 'false'
+    Title: 'Synchronize Starting Inventory'
+  ]
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_MatrixEditorActualInventories\043537.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_MatrixEditorActualInventories\043537.def"
new file mode 100644
index 0000000..979c52c
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_MatrixEditorActualInventories\043537.def"
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+Component MatrixEditorActualInventories id:MatrixEditorActualInventories_537 #extension
+{
+  Properties:
+  [
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_PanelActualInventoriesMatrix.def b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_PanelActualInventoriesMatrix.def
new file mode 100644
index 0000000..dd60853
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_PanelActualInventoriesMatrix.def
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+Component PanelActualInventoriesMatrix #extension
+{
+  Children:
+  [
+    #child: pHeader
+    #child: MatrixEditorActualInventories_537
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_pHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_pHeader.def
new file mode 100644
index 0000000..a5d0e70
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Component_pHeader.def
@@ -0,0 +1,27 @@
+Quintiq file version 2.0
+Component pHeader
+{
+  #keys: '[413988.0.1238563747]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component bSynchronizeStartingInventory
+    {
+      #keys: '[413988.0.1235991035]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'STAR_BLUE'
+        Label: 'Synchronize Starting Inventory'
+        Taborder: 0
+      ]
+    }
+  ]
+  Properties:
+  [
+    Border: true
+    FixedSize: true
+    Orientation: 'horizontal'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Response_MacroPlanner_pHeader_bSynchronizeStartingInventory_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Response_MacroPlanner_pHeader_bSynchronizeStartingInventory_OnClick.def
new file mode 100644
index 0000000..df6cc91
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/Response_MacroPlanner_pHeader_bSynchronizeStartingInventory_OnClick.def
@@ -0,0 +1,22 @@
+Quintiq file version 2.0
+#parent: pHeader/bSynchronizeStartingInventory
+Response OnClick () id:Response_MacroPlanner_pHeader_bSynchronizeStartingInventory_OnClick
+{
+  #keys: '[413988.0.1235901581]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    return not isnull( MacroPlan ) and not isnull( InterfaceDataset );
+  *]
+  QuillAction
+  {
+    Body:
+    [*
+      dlg := construct( DialogSynchronizeStartingInventory );
+      
+      ApplicationMacroPlanner.ShowFormModal( dlg );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/_ROOT_Component_FormActualInventories.def b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/_ROOT_Component_FormActualInventories.def
new file mode 100644
index 0000000..786b969
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormActualInventories/_ROOT_Component_FormActualInventories.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: LibMacroPlannerWebUI
+OrphanComponent FormActualInventories #extension
+{
+  Children:
+  [
+    #child: PanelActualInventoriesMatrix
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventoryPointSelection/Response_ListInventoryPointSelection_mEnable_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventoryPointSelection/Response_ListInventoryPointSelection_mEnable_OnClick.def
index c36de39..23c8be4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventoryPointSelection/Response_ListInventoryPointSelection_mEnable_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventoryPointSelection/Response_ListInventoryPointSelection_mEnable_OnClick.def
@@ -7,6 +7,10 @@
   #keys: '[413988.0.1235645466]'
   DefinitionID => /ListInventoryPointSelection/Responsedef_ListInventoryPointSelection_WebMenu_OnClick
   Initiator: 'mEnable'
+  Precondition:
+  [*
+    return selection.StockpoingPoint() <> "";
+  *]
   QuillAction
   {
     Body:

--
Gitblit v1.9.3