From 025a7a3dadeca98a40cfe13431d154593f8fa17a Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期三, 22 一月 2025 12:17:25 +0800
Subject: [PATCH] 接口优化
---
_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/_ROOT_Component_FormPackagingPlan.def | 27 +++++++++
_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Response_pHeader_bDownload_OnClick.def | 6 ++
_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForSAPGet.qbl | 5 +
_Main/BL/Type_PackagingPlanCell/StaticMethod_Export.qbl | 122 ++++++++++++++++++++++++++++++++++++++++
_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def | 8 +-
5 files changed, 162 insertions(+), 6 deletions(-)
diff --git a/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForSAPGet.qbl b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForSAPGet.qbl
index 7783353..26a316c 100644
--- a/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForSAPGet.qbl
+++ b/_Main/BL/Type_InterfaceLoginfo/StaticMethod_CallInterfaceForSAPGet.qbl
@@ -10,7 +10,10 @@
[*
// 鐢勫叞楦� Jul-22-2024 (created)
address := Translations::InterfaceDataset_SAP_Address();
- httpinterface := HTTPInterface::Create( address,8080);
+ httpinterface := HTTPInterface::Create( address,8080); // 娴嬭瘯
+
+ //httpinterface := HTTPInterface::Create( "10.120.76.32",8080); // 鐢熶骇
+
httpinterface.PostMethod( true ); ;
httpinterface.MediaType( Translations::InterfaceDataset_ContentType() );
try{
diff --git a/_Main/BL/Type_PackagingPlanCell/StaticMethod_Export.qbl b/_Main/BL/Type_PackagingPlanCell/StaticMethod_Export.qbl
new file mode 100644
index 0000000..b229c99
--- /dev/null
+++ b/_Main/BL/Type_PackagingPlanCell/StaticMethod_Export.qbl
@@ -0,0 +1,122 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Export (
+ MacroPlan macroPlan,
+ PackagingPlanRows pprs
+) as BinaryValue
+{
+ TextBody:
+ [*
+ xmlDOMI := XMLDOMImplementation::Create();
+ xmlDOM := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>Sheet1</name></table>' );
+
+ tableElement := xmlDOM.GetElementByTagName( "table", 0 );
+
+ // 绗竴鍒楋紙鍚嶇О锛�
+ pprs := selectsortedset( pprs, Elements, tempPPR, true, tempPPR.ProductID(), tempPPR.StockingPointID() );
+ firstColumn := xmlDOM.CreateElement( "column" );
+ firstName := xmlDOM.CreateElement( "name" );
+ firstType := xmlDOM.CreateElement( "type" );
+ firstName.TextContent( "*" );
+ firstType.TextContent( "String" );
+ firstColumn.AppendChild( firstName );
+ firstColumn.AppendChild( firstType );
+ traverse ( pprs, Elements, ppr ) {
+ firstCell := xmlDOM.CreateElement( "cell" );
+ firstCell.SetAttribute( "value", ppr.ProductID() );
+ firstColumn.AppendChild( firstCell );
+
+ for ( i := 0; i < 8; i++ ) {
+ firstCell := xmlDOM.CreateElement( "cell" );
+ firstCell.SetAttribute( "value", "" );
+ firstColumn.AppendChild( firstCell );
+ }
+ }
+ tableElement.AppendChild( firstColumn );
+
+
+ // 绗簩鍒�
+ attrs := construct( Strings ); attrs.Add( "Demand" ); attrs.Add( "New supply" ); attrs.Add( "Inventory end" ); attrs.Add( "Transport-out" ); attrs.Add( "Transport-in" );
+ attrs.Add( "Unpackaged inventory" ); attrs.Add( "Packaged inventory" ); attrs.Add( "Package" ); attrs.Add( "Unpackage" );
+ secondColumn := xmlDOM.CreateElement( "column" );
+ secondName := xmlDOM.CreateElement( "name" );
+ secondType := xmlDOM.CreateElement( "type" );
+ secondName.TextContent( "*" );
+ secondType.TextContent( "String" );
+ secondColumn.AppendChild( secondName );
+ secondColumn.AppendChild( secondType );
+ for ( i := 0; i < pprs.Size(); i++ ) {
+ traverse ( attrs, Elements, attr ) {
+ secondCell := xmlDOM.CreateElement( "cell" );
+ secondCell.SetAttribute( "value", attr );
+ secondColumn.AppendChild( secondCell );
+ }
+ }
+ tableElement.AppendChild( secondColumn );
+
+ // 鏃堕棿鍒�
+ ppcs := selectsortedset( macroPlan, PackagingPlanColumn, tempPPC, true, tempPPC.StartDate() );
+ traverse ( ppcs, Elements, ppc ) {
+ cellColumn := xmlDOM.CreateElement( "column" );
+ cellName := xmlDOM.CreateElement( "name" );
+ cellType := xmlDOM.CreateElement( "type" );
+ cellName.TextContent( ppc.StartDate().Format( "Y-M2-D2" ) );
+ cellType.TextContent( "Real" );
+ cellColumn.AppendChild( cellName );
+ cellColumn.AppendChild( cellType );
+ cells := selectsortedset( ppc, PackagingPlanCell, tempPPCell,
+ exists( pprs, Elements, tempPPR, tempPPR = tempPPCell.PackagingPlanRow() ),
+ tempPPCell.PackagingPlanRow().ProductID(), tempPPCell.PackagingPlanRow().StockingPointID() );
+ traverse ( cells, Elements, c ) {
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.NetDemand().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.NewSupply().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.EndingInventory().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.Out().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.TransferIn().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.UnpackagedInventory().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.PackagingInventory().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.Package().Round( 0 ) );
+ cellColumn.AppendChild( cell );
+
+ cell := xmlDOM.CreateElement( "cell" );
+ cell.SetAttribute( "value", [String]c.Unpacking().Round( 2 ) );
+ cellColumn.AppendChild( cell );
+ }
+ tableElement.AppendChild( cellColumn );
+ }
+
+ xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM )
+
+ //info( xmlString );
+
+ tableGroupHandle := TableGroupHandle::Create( "Sheet1" );
+ tableHandle := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
+ tableGroupHandle.Add( tableHandle );
+
+ binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
+
+ return binaryData.AsBinaryValue();
+ *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
index 6a2a171..94a74aa 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
@@ -44,12 +44,10 @@
BaseType: 'WebDataExtractor'
Properties:
[
- DataType: 'MacroPlan'
- FilterArguments: 'products:QLibMacroPlannerWebUI::ApplicationMacroPlanner.DataHolderCheckedProduct;factory:QLibMacroPlannerWebUI::ApplicationMacroPlanner.dhSelectedFactory'
- FixedFilter: 'object.FilterProduct( products, factory )'
- Source: 'MacroPlan'
+ DataType: 'structured[PackagingPlanRow]'
+ Source: 'dhSelectedRows'
Taborder: 0
- Transformation: 'PackagingPlanRow'
+ Transformation: 'Elements'
]
}
]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Response_pHeader_bDownload_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Response_pHeader_bDownload_OnClick.def
index bab8a27..eadaf44 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Response_pHeader_bDownload_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Response_pHeader_bDownload_OnClick.def
@@ -7,6 +7,12 @@
DefinitionID: 'Responsedef_WebButton_OnClick'
QuillAction
{
+ Body:
+ [*
+ binaryValue := PackagingPlanCell::Export( MacroPlan, dhSelectedRows.Data() );
+
+ Application.Download( ddslFactorySelection.Text() + "_鍖呰璁″垝.xlsx", binaryValue.AsBinaryData() );
+ *]
GroupServerCalls: false
}
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/_ROOT_Component_FormPackagingPlan.def b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/_ROOT_Component_FormPackagingPlan.def
index 9b37580..90f7ec4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/_ROOT_Component_FormPackagingPlan.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/_ROOT_Component_FormPackagingPlan.def
@@ -9,6 +9,33 @@
[
#child: pContent
#child: pHeader
+ Component dhSelectedRows
+ {
+ #keys: '[415754.0.905483662]'
+ BaseType: 'WebDataHolder'
+ Databinding: 'structured[PackagingPlanRow]*'
+ Children:
+ [
+ Component deSelectedRows
+ {
+ #keys: '[415754.0.905483700]'
+ BaseType: 'WebDataExtractor'
+ Properties:
+ [
+ DataType: 'MacroPlan'
+ FilterArguments: 'products:QLibMacroPlannerWebUI::ApplicationMacroPlanner.DataHolderCheckedProduct;factory:QLibMacroPlannerWebUI::ApplicationMacroPlanner.dhSelectedFactory'
+ FixedFilter: 'object.FilterProduct( products, factory )'
+ Source: 'MacroPlan'
+ Taborder: 0
+ Transformation: 'PackagingPlanRow'
+ ]
+ }
+ ]
+ Properties:
+ [
+ Taborder: 2
+ ]
+ }
]
Properties:
[
--
Gitblit v1.9.3