From ffaf414878991048ab4bc55d9bab172a9eb853ae Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 30 八月 2024 13:34:33 +0800
Subject: [PATCH] 前端界面调用生成库存报表接口数据

---
 _Main/BL/Type_InterfaceInventoryReport/StaticMethod_GenerateData.qbl                                                                           |   41 +++++++++++++-------
 _Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Method_OnOk.def                                                                         |    2 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_MenuInterfaceInventoryReport_OnCl.def |   19 +++++++++
 _Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def                                                                          |    2 
 _Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def                                                               |    2 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuInterface.def                                               |   11 +++++
 6 files changed, 60 insertions(+), 17 deletions(-)

diff --git a/_Main/BL/Type_InterfaceInventoryReport/StaticMethod_GenerateData.qbl b/_Main/BL/Type_InterfaceInventoryReport/StaticMethod_GenerateData.qbl
index 51feb14..9c48e2d 100644
--- a/_Main/BL/Type_InterfaceInventoryReport/StaticMethod_GenerateData.qbl
+++ b/_Main/BL/Type_InterfaceInventoryReport/StaticMethod_GenerateData.qbl
@@ -9,36 +9,49 @@
   TextBody:
   [*
     // 鐢勫叞楦� Aug-30-2024 (created)
-    loginfo                := maxobject(  interfaceDataset, InterfaceLoginfo, loginfo, loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name(), loginfo.InterfaceDateTime() );
+    loginfo                := maxobject(  interfaceDataset, InterfaceLoginfo, loginfo, loginfo.Name() = Translations::InterfaceDataset_InventoryReport_Name(), loginfo.InterfaceDateTime() );
     if( not isnull( loginfo ) ){
       if( not loginfo.IsShow() ){
         loginfo.Delete();
       }else{
         loginfo.Last( false );
       }
-      interfaceDataset.CustomerDemandPPAIDS( relflush );
+      interfaceDataset.InventoryReport( relflush );
     }
     nowdate                := DateTime::ActualTime();
     loginfo                := interfaceDataset.InterfaceLoginfo( relnew, ExecuteUser         := executor
-                                                                 , Name                      := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name()
+                                                                 , Name                      := Translations::InterfaceDataset_InventoryReport_Name()
                                                                  , InterfaceDateTime         := nowdate
-                                                                 , Message                   := '瀹㈡埛闇�姹傦紙PPA+IDS锛夋暟鎹帹閫�'
+                                                                 , Message                   := '搴撳瓨鎶ヨ〃- 鏁版嵁涓彴'
                                                                  , Last                      := true
                                                                  , IsShow                    := false
                                                                  , ReturnSuccess             := true
                                                                  , ReturnMsg                 := 'Success'
                                                                  , Success                   := true
                                                                   );
-    traverse( macroplan, SalesDemand.astype( Forecast ), forecast ){
-      cd                  :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product           := forecast.ProductID()
-                                                                   , DemandDate              := forecast.StartDate()
-                                                                   , DemandQty               := [Number]forecast.Quantity()
-                                                                   , VersionName             := macroplan.ScenarioName()
-                                                                   , InterfaceTime           := nowdate
-                                                                   , VersionFlag             := versionflag
-                                                                   );
-      loginfo.CustomerDemandPPAIDS( relinsert, cd );
+    traverse( macroplan, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() ){
+      traverse( report,InventroySummaryRow, row ){
+        product           := selectobject( macroplan, Product_MP, product, product.ID() = row.Name() );
+        traverse( row, InventorySummaryCell, cell ){
+          column          := cell.InventorySummaryColumn();
+          inventory       :=interfaceDataset.InventoryReport( relnew, Category          := column.TimeUnit()
+                                                              , Generation              := product.Generation()
+                                                              , MLBMQB                  := product.MQBMLB()
+                                                              , Power                   := product.Power()
+                                                              , Product                 := product.ID()
+                                                              , InventoryDate           := column.Period()
+                                                              , InventoryEndQty         := cell.EndingInventory()
+                                                              , InventoryMinQty         := cell.MinimumInventory()
+                                                              , InventoryMaxQty         := cell.MaximumInventory()
+                                                              , InventoryAveQty         := cell.AverageInventory()
+                                                              , FactoryName             := row.Unit()
+                                                              , VersionName             := macroplan.ScenarioName()
+                                                              , InterfaceTime           := nowdate
+                                                              );
+          loginfo.InventoryReport( relinsert, inventory );
+        }
+      }
     }
-    loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) );
+    loginfo.TotalRow( loginfo.InventoryReport( relsize ) );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuInterface.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuInterface.def
index da19376..3bde815 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuInterface.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ContextMenuInterface.def
@@ -113,6 +113,17 @@
         Title: '瑁呴厤涓婄嚎璁″垝+鏈哄姞涓嬬嚎璁″垝-MS64'
       ]
     }
+    Component MenuInterfaceInventoryReport
+    {
+      #keys: '[415136.0.1097611829]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'WAREHOUSE'
+        Taborder: 10
+        Title: 'Inventory report'
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_MenuInterfaceInventoryReport_OnCl.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_MenuInterfaceInventoryReport_OnCl.def
new file mode 100644
index 0000000..204f33a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ContextMenuInterface_MenuInterfaceInventoryReport_OnCl.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: ContextMenuInterface/MenuInterfaceInventoryReport
+Response OnClick () id:Response_MacroPlanner_ContextMenuInterface_MenuInterfaceInventoryReport_OnClick
+{
+  #keys: '[415136.0.1097612114]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebMenu_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      currentuser     := QuintiqUser::CurrentUser().DisplayName();
+      InterfaceInventoryReport::GenerateData( MacroPlan, InterfaceDataset, currentuser );
+      
+      WebMessageBox::Success( "鎺ㄩ�佹垚鍔燂紒" );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def
index f3e8113..a9043c1 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def
@@ -17,7 +17,7 @@
       AssemblyOnlinePlanPPPSPush::GenerateData( MacroPlan, InterfaceDataset, currentuser, isactive );
     }
     
-    
+    WebMessageBox::Success( "鎺ㄩ�佹垚鍔燂紒" );
     Form.Close();
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Method_OnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Method_OnOk.def
index 47c63f3..46c7a34 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Method_OnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSMS64/Method_OnOk.def
@@ -18,7 +18,7 @@
     currentuser     := QuintiqUser::CurrentUser().DisplayName();
     
     AOnlineAndMOfflinePlanMS64::GenerateData( InterfaceDataset, ddslFactory.Text(), dsStartDate.Date(), dsEndDate.Date(), efVersionFrom.Text(), efVersionTo.Text(), cbActiveVersion.Checked(), dhProducts.Data(), currentuser );
-    
+    WebMessageBox::Success( "鎺ㄩ�佹垚鍔燂紒" );
     Form.Close();
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def
index 45026ea..83c953c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogZEDPPSPIR/Method_OnOk.def
@@ -11,7 +11,7 @@
     handle          := mdsinstance.GetMDSHandle()
     macroplan       := handle.AsMacroPlan();
     AOnlineAndMOfflinePlanPIR::GenerateData( InterfaceDataset, ddslFactory.Text(), macroplan, dsStartDate.Date(), dsEndDate.Date(), QuintiqUser::CurrentUser().DisplayName() );
-    
+    WebMessageBox::Success( "鎺ㄩ�佹垚鍔燂紒" );
     Form.Close();
   *]
 }

--
Gitblit v1.9.3