| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod Download ( | 
|   MacroPlan macroPlan | 
| ) as BinaryValue | 
| { | 
|   Description: '下载发动机管线数据' | 
|   TextBody: | 
|   [* | 
|      | 
|     table := selectobject( macroPlan, MachiningPipelineSource.Report, table, table.IsShow() ); | 
|      | 
|     xmlDOMI := XMLDOMImplementation::Create(); | 
|     xmlDOM  := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' ); | 
|      | 
|     tableElement := xmlDOM.GetElementByTagName( "table", 0 ); | 
|     //Product | 
|     productcolumnelement := xmlDOM.CreateElement( "column" ); | 
|     productnameelement   := xmlDOM.CreateElement( "name" ); | 
|     producttypeelement   := xmlDOM.CreateElement( "type" ); | 
|     productnameelement.TextContent( 'Product' ); | 
|     producttypeelement.TextContent( "String" ); | 
|     productcolumnelement.AppendChild( productnameelement ); | 
|     productcolumnelement.AppendChild( producttypeelement ); | 
|     //Attribute | 
|     attricolumnelement := xmlDOM.CreateElement( "column" ); | 
|     attrinameelement   := xmlDOM.CreateElement( "name" ); | 
|     attritypeelement   := xmlDOM.CreateElement( "type" ); | 
|     attrinameelement.TextContent( 'Attribute' ); | 
|     attritypeelement.TextContent( "String" ); | 
|     attricolumnelement.AppendChild( attrinameelement ); | 
|     attricolumnelement.AppendChild( attritypeelement ); | 
|      | 
|     tableElement.AppendChild( productcolumnelement );  | 
|     tableElement.AppendChild( attricolumnelement ); | 
|     traverse ( table, Column, column ) { | 
|       columnelement := xmlDOM.CreateElement( "column" ); | 
|       nameelement   := xmlDOM.CreateElement( "name" ); | 
|       typeelement   := xmlDOM.CreateElement( "type" ); | 
|       nameelement.TextContent( column.Name() ); | 
|       typeelement.TextContent( "String" ); | 
|       columnelement.AppendChild( nameelement ); | 
|       columnelement.AppendChild( typeelement ); | 
|        | 
|       cells := selectsortedset( column, Cell, cell, cell.Row().RowNr() ); | 
|      | 
|       traverse ( cells, Elements, c ) { | 
|         if( column.Index() = 0 ){ | 
|           row := c.Row(); | 
|           //Product | 
|           productcellElement1 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement1.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement1 ); | 
|           productcellElement2 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement2.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement2 ); | 
|           productcellElement3 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement3.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement3 ); | 
|           productcellElement4 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement4.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement4 ); | 
|           productcellElement5 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement5.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement5 ); | 
|           productcellElement6 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement6.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement6 ); | 
|           productcellElement7 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement7.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement7 ); | 
|           productcellElement8 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement8.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement8 ); | 
|           productcellElement9 := xmlDOM.CreateElement( "cell" ); | 
|           productcellElement9.SetAttribute( "value", row.Name() ); | 
|           productcolumnelement.AppendChild( productcellElement9 ); | 
|           //Attribute | 
|           //长春装配计划 | 
|           ccaqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           ccaqcellElement.SetAttribute( "value", 'CC装配计划' );//CCAssemblyPlanQty | 
|           attricolumnelement.AppendChild( ccaqcellElement ); | 
|           //长春生产计划 | 
|           ccpqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           ccpqcellElement.SetAttribute( "value", 'CC机加计划' );//CCProductionQty | 
|           attricolumnelement.AppendChild( ccpqcellElement ); | 
|           //长春调拨计划 | 
|           cctqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           cctqcellElement.SetAttribute( "value", 'CC to DL' );//CCTransferQty | 
|           attricolumnelement.AppendChild( cctqcellElement ); | 
|           //长春库存 | 
|           cciqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           cciqcellElement.SetAttribute( "value", 'CC库存' );//CCInventoryQty | 
|           attricolumnelement.AppendChild( cciqcellElement ); | 
|           //大连装配计划 | 
|           dlaqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           dlaqcellElement.SetAttribute( "value", 'DL装配计划' );//DLAssemblyPlanQty | 
|           attricolumnelement.AppendChild( dlaqcellElement ); | 
|           //大连生产计划 | 
|           dlpqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           dlpqcellElement.SetAttribute( "value", 'DL机加计划' );//DLProductionQty | 
|           attricolumnelement.AppendChild( dlpqcellElement ); | 
|           //大连调拨计划 | 
|           dltqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           dltqcellElement.SetAttribute( "value", 'DL to CC' );//DLTransferQty | 
|           attricolumnelement.AppendChild( dltqcellElement ); | 
|           //大连库存 | 
|           dliqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           dliqcellElement.SetAttribute( "value", 'DL库存' );//DLInventoryQty | 
|           attricolumnelement.AppendChild( dliqcellElement ); | 
|           //长春 + 大连 库存 | 
|           tiqcellElement := xmlDOM.CreateElement( "cell" ); | 
|           tiqcellElement.SetAttribute( "value", 'CC + DL库存' );//TotalInventoryQty | 
|           attricolumnelement.AppendChild( tiqcellElement ); | 
|         } | 
|         //长春装配计划 | 
|         ccaqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         ccaqcellElement.SetAttribute( "value", [String]c.CCAssemblyPlanQty() ); | 
|         columnelement.AppendChild( ccaqcellElement ); | 
|         //长春生产计划 | 
|         ccpqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         ccpqcellElement.SetAttribute( "value", [String]c.CCProductionQty() ); | 
|         columnelement.AppendChild( ccpqcellElement ); | 
|         //长春调拨计划 | 
|         cctqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         cctqcellElement.SetAttribute( "value", [String]c.CCTransferQty() ); | 
|         columnelement.AppendChild( cctqcellElement ); | 
|         //长春库存 | 
|         cciqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         cciqcellElement.SetAttribute( "value", [String]c.CCInventoryQty() ); | 
|         columnelement.AppendChild( cciqcellElement ); | 
|         //大连装配计划 | 
|         dlaqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         dlaqcellElement.SetAttribute( "value", [String]c.DLAssemblyPlanQty() ); | 
|         columnelement.AppendChild( dlaqcellElement ); | 
|         //大连生产计划 | 
|         dlpqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         dlpqcellElement.SetAttribute( "value", [String]c.DLProductionQty() ); | 
|         columnelement.AppendChild( dlpqcellElement ); | 
|         //大连调拨计划 | 
|         dltqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         dltqcellElement.SetAttribute( "value", [String]c.DLTransferQty() ); | 
|         columnelement.AppendChild( dltqcellElement ); | 
|         //大连库存 | 
|         dliqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         dliqcellElement.SetAttribute( "value", [String]c.DLInventoryQty() ); | 
|         columnelement.AppendChild( dliqcellElement ); | 
|         //长春 + 大连 库存 | 
|         tiqcellElement := xmlDOM.CreateElement( "cell" ); | 
|         tiqcellElement.SetAttribute( "value", [String]c.TotalInventoryQty() ); | 
|         columnelement.AppendChild( tiqcellElement ); | 
|       } | 
|       tableElement.AppendChild( columnelement );   | 
|     } | 
|      | 
|     xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM ); | 
|      | 
|     //info( xmlString ); | 
|      | 
|     tableGroupHandle := TableGroupHandle::Create( MachiningPipelineReport::GetDefaultName() ); | 
|     tableHandle      := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) ); | 
|     tableGroupHandle.Add( tableHandle ); | 
|      | 
|     binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true ); | 
|      | 
|     return binaryData.AsBinaryValue(); | 
|   *] | 
| } |