From cd76160e1dcefe21c06b610bd4ef17928cbfba51 Mon Sep 17 00:00:00 2001 From: lazhen <17772815105@139.com> Date: 星期三, 04 九月 2024 18:37:48 +0800 Subject: [PATCH] 通过共用类解析binary --- /dev/null | 8 -------- _Main/BL/Relations/Relation_CustomerDemandIDS_MacroPlan_MacroPlan_CustomerDemandIDS.qbl | 23 +++++++++++++++++++++++ _Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl | 15 +++++++++------ _Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def | 2 +- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/_Main/BL/Relations/Relation_CustomerDemandIDS_InterfaceDataset_InterfaceDataset_CustomerDemandI.qbl b/_Main/BL/Relations/Relation_CustomerDemandIDS_InterfaceDataset_InterfaceDataset_CustomerDemandI.qbl deleted file mode 100644 index 2818276..0000000 --- a/_Main/BL/Relations/Relation_CustomerDemandIDS_InterfaceDataset_InterfaceDataset_CustomerDemandI.qbl +++ /dev/null @@ -1,23 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -Relation CustomerDemandIDS_InterfaceDataset_InterfaceDataset_CustomerDemandIDS -{ - #keys: '1[415136.0.1109686108]' - DefaultRelationStrategy - { - } - RelationSide.LeftSide InterfaceDataset - { - #keys: '3[415136.0.1109686110][415136.0.1109686109][415136.0.1109686111]' - Cardinality: '0to1' - ObjectDefinition: CustomerDemandIDS - OwningSide: 'Reference' - } - RelationSide.RightSide CustomerDemandIDS - { - #keys: '3[415136.0.1109686113][415136.0.1109686112][415136.0.1109686114]' - Cardinality: '1toN' - ObjectDefinition: InterfaceDataset - OwningSide: 'Owned' - } -} diff --git a/_Main/BL/Relations/Relation_CustomerDemandIDS_MacroPlan_MacroPlan_CustomerDemandIDS.qbl b/_Main/BL/Relations/Relation_CustomerDemandIDS_MacroPlan_MacroPlan_CustomerDemandIDS.qbl new file mode 100644 index 0000000..7bc0ffb --- /dev/null +++ b/_Main/BL/Relations/Relation_CustomerDemandIDS_MacroPlan_MacroPlan_CustomerDemandIDS.qbl @@ -0,0 +1,23 @@ +Quintiq file version 2.0 +#parent: #root +Relation CustomerDemandIDS_MacroPlan_MacroPlan_CustomerDemandIDS +{ + #keys: '1[415136.0.1113700065]' + DefaultRelationStrategy + { + } + RelationSide.LeftSide MacroPlan + { + #keys: '3[415136.0.1113700067][415136.0.1113700066][415136.0.1113700068]' + Cardinality: '0to1' + ObjectDefinition: CustomerDemandIDS + OwningSide: 'Reference' + } + RelationSide.RightSide CustomerDemandIDS + { + #keys: '3[415136.0.1113700070][415136.0.1113700069][415136.0.1113700071]' + Cardinality: '1toN' + ObjectDefinition: MacroPlan + OwningSide: 'Owned' + } +} diff --git a/_Main/BL/Type_CustomerDemandIDS/Method_SyncRows.qbl b/_Main/BL/Type_CustomerDemandIDS/Method_SyncRows.qbl deleted file mode 100644 index 0106865..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/Method_SyncRows.qbl +++ /dev/null @@ -1,39 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -Method SyncRows -{ - TextBody: - [* - totalRows := 0; - totalColumns := this.Column( relsize ); - - if ( totalColumns > 0 ) { - randomCol := select( this, Column, tempFPC, true ); - totalRows := randomCol.Cell( relsize ); - - this.Row( relflush ); - - cells := construct( CustomerDemandIDSCells ); - traverse ( this, Column, fpc ) { - cells.Add( fpc.FirstCellInColumn() ); - } - - for ( i := 0; i < totalRows; i++ ) { - assert( selectvalues( cells, Elements, c, true, c.Column().Index() ).ToString( "" ) = - selectvalues( selectsortedset( cells, Elements, c, true, c.Column().Index() ), Elements, c, true, c.Column().Index() ).ToString( "" ), - "Assertion error in FrockDataTable::syncRows: Cells not sorted by column index" ); - row := this.Row( relnew, RowNr := i ); - - newCells := construct( CustomerDemandIDSCells ); - - traverse ( cells, Elements, c ) { - row.Cell( relinsert, c ); - - newCells.Add( c.NextCellInColumn() ); - } - - cells := &newCells; - } - } - *] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_ReadStructure.qbl b/_Main/BL/Type_CustomerDemandIDS/StaticMethod_ReadStructure.qbl deleted file mode 100644 index f0b4327..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/StaticMethod_ReadStructure.qbl +++ /dev/null @@ -1,33 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -StaticMethod ReadStructure ( - BinaryValue binaryvalue, - InterfaceDataset owner -) -{ - TextBody: - [* - // 鐢勫叞楦� Sep-3-2024 (created) - tableGroupHandle := TableGroupHandle::Create( 'IDS鍏ㄨ〃' ); - tableGroupHandle := XLS::LoadTableGroupFromBinaryData( binaryvalue.AsBinaryData(), tableGroupHandle, true, true ); - sheets := tableGroupHandle.TableNames(); - - traverse ( sheets, Elements, sheetName ) { - tableHandle := tableGroupHandle.Table( sheetName ); - tableXML := TableHandle::ExportXML( tableHandle ); - - // info( tableXML.AsQUILL() ); - - CustomerDemandIDS::XMLFileImportCustomerDemandIDSXMLHeaders( tableXML ); - xlstable := CustomerDemandIDS::XMLImportCustomerDemandIDSXML( tableXML ); - - xlstable.SyncRows(); - - xlstable.Name( sheetName ); - owner.CustomerDemandIDS( relinsert, &xlstable ); - - Transaction::Transaction().Propagate( attribute( CustomerDemandIDSColumn, Index ) ); - - } - *] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_Key.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_Key.qbl deleted file mode 100644 index 4f408a0..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_Key.qbl +++ /dev/null @@ -1,7 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLElementId -{ - XMLAddressType { } - XMLID Key { } -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_QuintiqType.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_QuintiqType.qbl deleted file mode 100644 index 7468757..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLElementId_QuintiqType.qbl +++ /dev/null @@ -1,7 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLElementId -{ - XMLID QuintiqType { } - XMLQualifierType { } -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_cell.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_cell.qbl deleted file mode 100644 index c4fd297..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_cell.qbl +++ /dev/null @@ -1,17 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLObjectBase.ObjectDefinitions -{ - IdField: Key - ObjectTypeField: QuintiqType - TargetType: CustomerDemandIDSCell - XMLID cell { } - Attributes: - [ - XMLAttribute - { - Attribute: Value - XMLID value { } - } - ] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_column.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_column.qbl deleted file mode 100644 index 4a97560..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_column.qbl +++ /dev/null @@ -1,27 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLObjectBase.ObjectDefinitions -{ - IdField: Key - ObjectTypeField: QuintiqType - TargetType: CustomerDemandIDSColumn - XMLID column { } - Aggregates: - [ - XMLAggregate - { - ElementDefinition: cell - GenerateOutput: false - Relation: Cell - XMLID Cell { } - } - ] - Attributes: - [ - XMLAttribute - { - Attribute: Name - XMLID name { } - } - ] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_table.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_table.qbl deleted file mode 100644 index ebf311d..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/XMLObjectBase_table.qbl +++ /dev/null @@ -1,27 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLObjectBase.ObjectDefinitions -{ - IdField: Key - ObjectTypeField: QuintiqType - TargetType: CustomerDemandIDS - XMLID table { } - Aggregates: - [ - XMLAggregate - { - ElementDefinition: column - GenerateOutput: false - Relation: Column - XMLID Column { } - } - ] - Attributes: - [ - XMLAttribute - { - Attribute: Name - XMLID name { } - } - ] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/_ROOT_XML_CustomerDemandIDSXML.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/_ROOT_XML_CustomerDemandIDSXML.qbl deleted file mode 100644 index a0513a0..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXML/_ROOT_XML_CustomerDemandIDSXML.qbl +++ /dev/null @@ -1,8 +0,0 @@ -Quintiq file version 2.0 -#root -#parent: #root -XML CustomerDemandIDSXML -{ - Direction: 'ImportExport' - Root: table -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_Key.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_Key.qbl deleted file mode 100644 index 4f408a0..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_Key.qbl +++ /dev/null @@ -1,7 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLElementId -{ - XMLAddressType { } - XMLID Key { } -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_QuintiqType.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_QuintiqType.qbl deleted file mode 100644 index 7468757..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLElementId_QuintiqType.qbl +++ /dev/null @@ -1,7 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLElementId -{ - XMLID QuintiqType { } - XMLQualifierType { } -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_column.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_column.qbl deleted file mode 100644 index c3c96e9..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_column.qbl +++ /dev/null @@ -1,17 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLObjectBase.ObjectDefinitions -{ - IdField: Key - ObjectTypeField: QuintiqType - TargetType: CustomerDemandIDSColumn - XMLID column { } - Attributes: - [ - XMLAttribute - { - Attribute: Name - XMLID name { } - } - ] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_table.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_table.qbl deleted file mode 100644 index ebf311d..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/XMLObjectBase_table.qbl +++ /dev/null @@ -1,27 +0,0 @@ -Quintiq file version 2.0 -#parent: #root -XMLObjectBase.ObjectDefinitions -{ - IdField: Key - ObjectTypeField: QuintiqType - TargetType: CustomerDemandIDS - XMLID table { } - Aggregates: - [ - XMLAggregate - { - ElementDefinition: column - GenerateOutput: false - Relation: Column - XMLID Column { } - } - ] - Attributes: - [ - XMLAttribute - { - Attribute: Name - XMLID name { } - } - ] -} diff --git a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/_ROOT_XML_CustomerDemandIDSXMLHeaders.qbl b/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/_ROOT_XML_CustomerDemandIDSXMLHeaders.qbl deleted file mode 100644 index 8c8b3e2..0000000 --- a/_Main/BL/Type_CustomerDemandIDS/XML_CustomerDemandIDSXMLHeaders/_ROOT_XML_CustomerDemandIDSXMLHeaders.qbl +++ /dev/null @@ -1,8 +0,0 @@ -Quintiq file version 2.0 -#root -#parent: #root -XML CustomerDemandIDSXMLHeaders -{ - Direction: 'ImportExport' - Root: table -} diff --git a/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl b/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl index 2139612..a9645b0 100644 --- a/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl +++ b/_Main/BL/Type_CustomerDemandPPAIDS/StaticMethod_GenerateData.qbl @@ -2,6 +2,7 @@ #parent: #root StaticMethod GenerateData ( const MacroPlan macroplan, + RecycleBin recycle, const Archive archive, InterfaceDataset interfaceDataset, String executor, @@ -43,15 +44,16 @@ loginfo.CustomerDemandPPAIDS( relinsert, cd ); } binaryValue := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() ); - CustomerDemandIDS::ReadStructure( binaryValue, interfaceDataset ); - productcolumn := select( interfaceDataset, CustomerDemandIDS.Column, column, column.Index() = 1 ); + source := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" ); + source.ReadStructure(); + //productcolumn := select( recycle, ge.Column, column, column.Index() = 1 ); cnv2 := StringToDate::StandardConverter(); cnv2.SetCustomConversion(); cnv2.CustomFormatString( "dd/MM/yyyy" ); - traverse( interfaceDataset, CustomerDemandIDS.Row, row ){ - product := selectobject( row, Cell, cell, cell.Column() = productcolumn ); - traverse( row, Cell, cell, cell.Column().Index() > 3 ){ - period := cnv2.Convert( cell.Column().Name() ); + traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable.GeneralExcelImportAndExportDataRow, row ){ + product := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 1 ); + traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 3 ){ + period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() ); cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := product.Value() , DemandDate := period , DemandQty := [Number]cell.Value() @@ -62,6 +64,7 @@ loginfo.CustomerDemandPPAIDS( relinsert, cd ); } } + source.Delete(); loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) ); *] } diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def index a9043c1..b0cee42 100644 --- a/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def +++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCustomerDemandPPAIDS/Method_OnOK.def @@ -11,7 +11,7 @@ currentuser := QuintiqUser::CurrentUser().DisplayName(); isactive := ifexpr( rbgVersionFlag.BoundValue() = "true", true, false ); if( efInterfacename.Text() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){//瀹㈡埛闇�姹� - CustomerDemandPPAIDS::GenerateData( MacroPlan, InterfaceDataset, currentuser, isactive ); + CustomerDemandPPAIDS::GenerateData( MacroPlan, RecycleBin, Archive, InterfaceDataset, currentuser, isactive ); } if( efInterfacename.Text() = Translations::InterfaceDataset_AssemblyOnlinePlanPPPSPush_Name()){//瑁呴厤涓婄嚎 AssemblyOnlinePlanPPPSPush::GenerateData( MacroPlan, InterfaceDataset, currentuser, isactive ); -- Gitblit v1.9.3