From 7858c560390ea9fd2aed8b6a9b3e663250daf359 Mon Sep 17 00:00:00 2001
From: administrator <administrator@administrator.com>
Date: 星期四, 30 五月 2024 11:14:38 +0800
Subject: [PATCH] 新增IDS全表下载

---
 _Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Response_pnlActionsLeft_bIDSFullTableTemplateDownload_OnClick.def |   18 +++++++++
 _Main/BL/Type_TemplateManager/StaticMethod_GetIDSFullTable.qbl                                                                  |   43 +++++++++++++++++++++
 2 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/_Main/BL/Type_TemplateManager/StaticMethod_GetIDSFullTable.qbl b/_Main/BL/Type_TemplateManager/StaticMethod_GetIDSFullTable.qbl
new file mode 100644
index 0000000..bcaa717
--- /dev/null
+++ b/_Main/BL/Type_TemplateManager/StaticMethod_GetIDSFullTable.qbl
@@ -0,0 +1,43 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetIDSFullTable (
+  const Archive archive,
+  Number year
+) as BinaryValue
+{
+  TextBody:
+  [*
+    // Administrator May-30-2024 (created)
+    // Akari May-18-2024 (created)
+    // 璋冪敤鎺ュ彛
+    url := "/IDSPPACurve/GetIDSFullTableXML" + "?year=" +[String]year;
+    
+    i := HTTPInterface::Create( archive.JavaInterfaceAddress(), archive.JavaInterfacePort() );
+    i.URL( url );
+    i.PostMethod( false );
+    
+    i.TimeOut( Duration::Minutes( 5 ) );
+    
+    i.Call( );
+      
+    htmlresult := i.Result();
+    
+    respJSON   := JSON::Parse( htmlresult );
+    
+    code    := respJSON.Get( "code" ).GetNumber();
+    message := respJSON.Get( "message" ).GetString();
+    xmlTemplate := "";
+    if( code = 200 ){
+      xmlTemplate := message;
+    }else{
+      error( message ); 
+    }
+    
+    tableHandle := TableHandle::ImportXML( BinaryValue::Construct( xmlTemplate ) );
+    XLS::SaveTable( tableHandle, OS::TempPath() + "template.xlsx" );
+    file := OSFile::Construct();
+    file.Open( OS::TempPath() + "template.xlsx", "Read", true );
+    data := file.ReadBinary();
+    return data;
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Response_pnlActionsLeft_bIDSFullTableTemplateDownload_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Response_pnlActionsLeft_bIDSFullTableTemplateDownload_OnClick.def
new file mode 100644
index 0000000..1f98d97
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Response_pnlActionsLeft_bIDSFullTableTemplateDownload_OnClick.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: pnlActionsLeft/bIDSFullTableTemplateDownload
+Response OnClick () id:Response_pnlActionsLeft_bIDSFullTableTemplateDownload_OnClick
+{
+  #keys: '[411860.0.31051373]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      binaryValue := TemplateManager::GetIDSFullTable( Archive, Date::ActualDate().Year() );
+      
+      Application.Download( "IDS鍏ㄨ〃锛� "+ [String]Date::ActualDate().Year() +".xlsx", binaryValue.AsBinaryData() );
+    *]
+    GroupServerCalls: false
+  }
+}

--
Gitblit v1.9.3