From 91413a3e42e7df36207ece0c7908a7dbb9b8727a Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期四, 30 五月 2024 17:07:29 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg
---
_Main/BL/Type_Archive/StaticMethod_Archive.qbl | 53 +++++++++++++
_Main/BL/Type_ArchivePPA/Attribute_SourceFileBinaryValue.qbl | 7 +
_Main/BL/Type_Archive/StaticMethod_WriteTempFile.qbl | 14 ++-
_Main/BL/Type_Archive/StaticMethod_HandlePR.qbl | 18 ++--
_Main/BL/Type_Archive/StaticMethod_OnException.qbl | 3
_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Method_OnOK.def | 4
_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Response_pnlActionsLeft_bIDSFullTableTemplateDownload_OnClick.def | 18 ++++
_Main/BL/Type_Archive/StaticMethod_Success.qbl | 4
_Main/BL/Type_TemplateManager/StaticMethod_GetIDSFullTable.qbl | 43 ++++++++++
_Main/BL/Type_Archive/StaticMethod_HandlePPA_Curve_IDS.qbl | 57 ++++++++------
_Main/BL/Type_Archive/StaticMethod_RequirementProcessing.qbl | 17 +++-
11 files changed, 191 insertions(+), 47 deletions(-)
diff --git a/_Main/BL/Type_Archive/StaticMethod_Archive.qbl b/_Main/BL/Type_Archive/StaticMethod_Archive.qbl
new file mode 100644
index 0000000..8452813
--- /dev/null
+++ b/_Main/BL/Type_Archive/StaticMethod_Archive.qbl
@@ -0,0 +1,53 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Archive (
+ JSON respJSON,
+ Archive archive,
+ String archiveType
+)
+{
+ TextBody:
+ [*
+ code := respJSON.Get( "code" ).GetNumber();
+ archiveFileJSONs := respJSON.Get( "archiveFiles" );
+ info( archiveFileJSONs.AsString() );
+ if ( code = 200 ) {
+ for ( i := 0; i < archiveFileJSONs.Size(); i++ ) {
+ archiveFileJSON := archiveFileJSONs.Get( i );
+
+ fileName := archiveFileJSON.Get( "fileName" ).GetString();
+ filePath := archiveFileJSON.Get( "fileFullPath" ).GetString();
+
+ if ( archiveType = "PR" ) {
+ apr := select( archive, ArchivePR, tempAPR, tempAPR.Name() = fileName );
+ if ( not isnull( apr ) ) {
+ apr.FilePath( filePath );
+ } else {
+ archive.ArchivePR( relnew, Name := fileName, FilePath := filePath );
+ }
+ } else if ( archiveType = "PP" ) {
+ app := select( archive, ArchivePP, tempAPP, tempAPP.Name() = fileName );
+ if ( not isnull( app ) ) {
+ app.FilePath( filePath );
+ } else {
+ archive.ArchivePP( relnew, Name := fileName, FilePath := filePath );
+ }
+ } else if ( archiveType = "Budget" ) {
+ ab := select( archive, ArchiveBudget, tempAB, tempAB.Name() = fileName );
+ if ( not isnull( ab ) ) {
+ ab.FilePath( filePath );
+ } else {
+ archive.ArchiveBudget( relnew, Name := fileName, FilePath := filePath );
+ }
+ } else if ( archiveType = "PPA" ) {
+ appa := select( archive, ArchivePPA, tempAPPA, tempAPPA.Name() = fileName );
+ if ( not isnull( appa ) ) {
+ appa.FilePath( filePath );
+ } else {
+ archive.ArchivePPA( relnew, Name := fileName, FilePath := filePath );
+ }
+ }
+ }
+ }
+ *]
+}
diff --git a/_Main/BL/Type_Archive/StaticMethod_HandlePPA_Curve_IDS.qbl b/_Main/BL/Type_Archive/StaticMethod_HandlePPA_Curve_IDS.qbl
index 9291f91..6474582 100644
--- a/_Main/BL/Type_Archive/StaticMethod_HandlePPA_Curve_IDS.qbl
+++ b/_Main/BL/Type_Archive/StaticMethod_HandlePPA_Curve_IDS.qbl
@@ -11,22 +11,28 @@
BinaryValue curveBinaryValue,
String idsFileName,
BinaryValue idsBinaryValue,
- String filePath
-)
+ String filePath,
+ Boolean isOverwriteFile
+) as stream[JSON]
{
TextBody:
[*
// 璇锋眰鍙傛暟
- pathPPA := filePath + ppaFileName;
- pathCurve := filePath + curveFileName;
- pathIDS := filePath + idsFileName;
- //isArchive := ifexpr( isPRArchive, "true", "false" );
- minorKey := [String]macroPlan.MDSID().MinorKey();
- json := JSON::Object()
- .Add( "pathPPA", pathPPA )
- .Add( "pathCurve", pathCurve )
- .Add( "pathIDS", pathIDS )
- .Add( "minorKey", minorKey ).Build().AsString();
+ pathPPA := filePath + ppaFileName;
+ pathCurve := filePath + curveFileName;
+ pathIDS := filePath + idsFileName;
+ info( pathPPA );
+ info( pathCurve );
+ isArchivePPA := ifexpr( isPPAArchive, "true", "false" );
+ isOverridePPA := ifexpr( isOverwriteFile, "true", "false" );
+ minorKey := [String]macroPlan.MDSID().MinorKey();
+ json := JSON::Object()
+ .Add( "pathPPA", pathPPA )
+ .Add( "isArchivePPA", isArchivePPA )
+ .Add( "pathCurve", pathCurve )
+ .Add( "pathIDS", pathIDS )
+ .Add( "minorKey", minorKey )
+ .Add( "isOverridePPA", isOverridePPA ).Build().AsString();
// 鍐欏叆涓存椂鏂囦欢
Archive::WriteTempFile( pathPPA, ppaBinaryValue );
@@ -36,17 +42,20 @@
info( json );
// 璋冪敤鎺ュ彛
- //url := "/PR/Import";
- //i := HTTPInterface::Create( archive.JavaInterfaceAddress(), archive.JavaInterfacePort() );
- //i.URL( url );
- //i.PostMethod( true );
- //
- //try {
- // i.Call( json );
- //
- // htmlresult := i.Result();
- //} onerror {
- //
- //}
+ url := "/IDSPPACurve/Import";
+
+ i := HTTPInterface::Create( archive.JavaInterfaceAddress(), archive.JavaInterfacePort() );
+ i.URL( url );
+ i.PostMethod( true );
+ i.MediaType( "application/json" );
+ i.TimeOut( Duration::Minutes( 5 ) );
+
+ i.Call( json );
+
+ htmlresult := i.Result();
+
+ respJSON := JSON::Parse( htmlresult );
+
+ return emit( respJSON );
*]
}
diff --git a/_Main/BL/Type_Archive/StaticMethod_HandlePR.qbl b/_Main/BL/Type_Archive/StaticMethod_HandlePR.qbl
index 24d0b71..abd6fc9 100644
--- a/_Main/BL/Type_Archive/StaticMethod_HandlePR.qbl
+++ b/_Main/BL/Type_Archive/StaticMethod_HandlePR.qbl
@@ -14,15 +14,15 @@
TextBody:
[*
// 璇锋眰鍙傛暟
- pathPR := filePath + prFileName;
- isArchive := ifexpr( isPRArchive, "true", "false" );
- isOverride := ifexpr( isOverwriteFile, "true", "false" );
- minorKey := [String]macroPlan.MDSID().MinorKey();
- json := JSON::Object()
- .Add( "pathPR", pathPR )
- .Add( "isArchive", isArchive )
- .Add( "isOverride", isOverride )
- .Add( "minorKey", minorKey ).Build().AsString();
+ pathPR := filePath + prFileName;
+ isArchive := ifexpr( isPRArchive, "true", "false" );
+ isOverride := ifexpr( isOverwriteFile, "true", "false" );
+ macroPlanKey := [String]macroPlan.MDSID().MinorKey();
+ json := JSON::Object()
+ .Add( "pathPR", pathPR )
+ .Add( "isArchive", isArchive )
+ .Add( "isOverride", isOverride )
+ .Add( "minorKey", macroPlanKey ).Build().AsString();
// 鍐欏叆涓存椂鏂囦欢
Archive::WriteTempFile( pathPR, prBinaryValue );
diff --git a/_Main/BL/Type_Archive/StaticMethod_OnException.qbl b/_Main/BL/Type_Archive/StaticMethod_OnException.qbl
index d231716..2b9ec51 100644
--- a/_Main/BL/Type_Archive/StaticMethod_OnException.qbl
+++ b/_Main/BL/Type_Archive/StaticMethod_OnException.qbl
@@ -8,6 +8,9 @@
{
TextBody:
[*
+ // 娓呯┖涓存椂鏁版嵁搴�
+ archiveExecutionStatus.AES_TemporaryDemandData().Source().FlatQuery( "truncate table A_Forecasts" );
+
archiveExecutionStatus.RequirementImportExecutionStatus( relnew,
ExecutionCode := 500,
ExecutionIsSuccess := false,
diff --git a/_Main/BL/Type_Archive/StaticMethod_RequirementProcessing.qbl b/_Main/BL/Type_Archive/StaticMethod_RequirementProcessing.qbl
index b03e1bd..e61f9a7 100644
--- a/_Main/BL/Type_Archive/StaticMethod_RequirementProcessing.qbl
+++ b/_Main/BL/Type_Archive/StaticMethod_RequirementProcessing.qbl
@@ -37,21 +37,28 @@
if ( prBinaryValue.Size() > 0 ) {
archive -> Archive::HandlePR( macroPlan, userName, prFileName, prBinaryValue, isPRArchive, filePath, isOverwriteFile )
- -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
+ -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
+ -> Archive::Archive( archive, "PR" )
-> Exception()
-> Archive::OnException( archiveExecutionStatus, userName );
} else if ( ppBinaryValue.Size() > 0 ) {
archive -> Archive::HandlePP( macroPlan, userName, ppFileName, ppBinaryValue, isPPArchive, filePath, isOverwriteFile )
- -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
+ -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
+ -> Archive::Archive( archive, "PP" )
-> Exception()
-> Archive::OnException( archiveExecutionStatus, userName );
} else if ( budgetBinaryValue.Size() > 0 ) {
archive -> Archive::HandleBudget( macroPlan, userName, budgetFileName, budgetBinaryValue, isBudgetArchive, filePath, isOverwriteFile )
- -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
- -> Exception()
+ -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
+ -> Archive::Archive( archive, "Budget" )
+ -> Exception()
-> Archive::OnException( archiveExecutionStatus, userName );
} else {
- Archive::HandlePPA_Curve_IDS( archive, macroPlan, userName, ppaFileName, ppaBinaryValue, isPPAArchive, curveFileName, curveBinaryValue, idsFileName, idsBinaryValue, filePath );
+ archive -> Archive::HandlePPA_Curve_IDS( macroPlan, userName, ppaFileName, ppaBinaryValue, isPPAArchive, curveFileName, curveBinaryValue, idsFileName, idsBinaryValue, filePath, isOverwriteFile )
+ -> Archive::Success( macroPlan, archiveExecutionStatus, userName )
+ -> Archive::Archive( archive, "PPA" )
+ -> Exception()
+ -> Archive::OnException( archiveExecutionStatus, userName );
}
*]
}
diff --git a/_Main/BL/Type_Archive/StaticMethod_Success.qbl b/_Main/BL/Type_Archive/StaticMethod_Success.qbl
index 8b945f0..5844f72 100644
--- a/_Main/BL/Type_Archive/StaticMethod_Success.qbl
+++ b/_Main/BL/Type_Archive/StaticMethod_Success.qbl
@@ -5,7 +5,7 @@
MacroPlan macroPlan,
ArchiveExecutionStatus archiveExecutionStatus,
String userName
-)
+) as stream[JSON]
{
TextBody:
[*
@@ -27,5 +27,7 @@
} else {
RequirementImportExecutionStatus::Create( archiveExecutionStatus, code, "Complete", userName, message, false );
}
+
+ return emit( respJSON );
*]
}
diff --git a/_Main/BL/Type_Archive/StaticMethod_WriteTempFile.qbl b/_Main/BL/Type_Archive/StaticMethod_WriteTempFile.qbl
index 4dbc847..5d861d9 100644
--- a/_Main/BL/Type_Archive/StaticMethod_WriteTempFile.qbl
+++ b/_Main/BL/Type_Archive/StaticMethod_WriteTempFile.qbl
@@ -7,11 +7,13 @@
{
TextBody:
[*
- file := OSFile::Construct();
-
- file.Open( filePath, "Write", false );
- file.WriteBinary( binaryValue );
-
- file.Close();
+ if ( binaryValue.Size() > 0 ) {
+ file := OSFile::Construct();
+
+ file.Open( filePath, "Write", false );
+ file.WriteBinary( binaryValue );
+
+ file.Close();
+ }
*]
}
diff --git a/_Main/BL/Type_ArchivePPA/Attribute_SourceFileBinaryValue.qbl b/_Main/BL/Type_ArchivePPA/Attribute_SourceFileBinaryValue.qbl
new file mode 100644
index 0000000..e7278b1
--- /dev/null
+++ b/_Main/BL/Type_ArchivePPA/Attribute_SourceFileBinaryValue.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute SourceFileBinaryValue
+{
+ #keys: '3[414996.0.408054600][414996.0.408054599][414996.0.408054601]'
+ ValueType: BinaryValue
+}
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/Method_OnOK.def b/_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Method_OnOK.def
index 44983ad..3dede70 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Method_OnOK.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogRequirementUpload/Method_OnOK.def
@@ -11,8 +11,8 @@
efPR.Text() , guard( dhBinaryDataPR.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ), cPR.Checked(),
efPP.Text() , guard( dhBinaryDataPP.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ), cPP.Checked(),
efBudget.Text() , guard( dhBinaryDataBudget.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ), cBudget.Checked(),
- ifexpr( cPPAPPAArchiveEnable.Checked(), ddlPPAArchive.Data().Name(), efCurve.Text() ), guard( dhBinaryDataPPA.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ), cPPA.Checked(),
- efCurve.Text() , guard( dhBinaryDataCurve.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ),
+ dhOriginalFileNamePPA.Data() , guard( dhBinaryDataPPA.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ), cPPA.Checked(),
+ dhOriginalFileNameCurve.Data() , guard( dhBinaryDataCurve.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ),
efIDS.Text() , guard( dhBinaryDataIDS.Data().AsBinaryValue(), BinaryValue::Construct( 0 ) ),
false );
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