Ejemplo n.º 1
0
        public override void Export(AnalysisHomo analysis, string fileName)
        {
            Solution sol = analysis.Solution;

            // build orderDocument element
            orderDocument document = new orderDocument()
            {
                date      = DateTime.Now,
                unit      = CurrentUnit,
                author    = analysis.ParentDocument != null ? analysis.ParentDocument.Author : string.Empty,
                orderType = new orderDocumentOrderType()
                {
                    orderNumber = analysis.Name,
                    orderLine   = new orderLine()
                    {
                        itemId   = 1,
                        quantity = analysis.Solution.ItemCount
                    },
                    loadSpace = BuildLoadSpace(analysis),
                    item      = BuildItem(analysis),
                    load      = new load()
                    {
                        loadSpaceId = 1,
                        statistics  = new statistics()
                        {
                            loadVolume        = sol.LoadVolume,
                            loadWeight        = sol.LoadWeight,
                            volumeUtilization = sol.VolumeEfficiency,
                            weightUtilization = sol.WeightEfficiency.ToDouble(),
                            cOfG = new cOfG()
                            {
                                x = sol.COfG.X, y = sol.COfG.Y, z = sol.COfG.Z
                            },
                            loadHeight = sol.BBoxLoad.Height
                        },
                        placement = BuildPlacementArray(sol)
                    }
                }
            };

            // serialization
            using (Stream stream = File.Open(fileName, FileMode.Create))
            {
                XmlSerializer serializer = new XmlSerializer(typeof(orderDocument));
                serializer.Serialize(stream, document);
                stream.Flush();
            }
        }
Ejemplo n.º 2
0
        public override void Export(AnalysisLayered analysis, ref Stream stream)
        {
            SolutionLayered sol = analysis.SolutionLay;

            // build orderDocument element
            orderDocument document = new orderDocument()
            {
                date      = DateTime.Now,
                unit      = CurrentUnit,
                author    = analysis.ParentDocument != null ? analysis.ParentDocument.Author : string.Empty,
                orderType = new orderDocumentOrderType()
                {
                    orderNumber = analysis.Name,
                    orderLine   = new orderLine()
                    {
                        itemId   = 1,
                        quantity = analysis.Solution.ItemCount
                    },
                    loadSpace = BuildLoadSpace(analysis),
                    itemList  = BuildItemArray(analysis),
                    load      = new load()
                    {
                        loadSpaceId = 1,
                        statistics  = new statistics()
                        {
                            loadVolume        = sol.LoadVolume,
                            weightLoad        = sol.LoadWeight,
                            volumeUtilization = sol.VolumeEfficiency,
                            weightUtilization = sol.WeightEfficiency.ToDouble(),
                            cOfG = new cOfG()
                            {
                                x = sol.COfG.X, y = sol.COfG.Y, z = sol.COfG.Z
                            },
                            loadHeight = sol.BBoxLoad.Height
                        },
                        placement = BuildPlacementArray(sol, analysis)
                    }
                }
            };

            // serialization
            XmlSerializer serializer = new XmlSerializer(typeof(orderDocument));

            serializer.Serialize(stream, document);
            stream.Flush();
            stream.Seek(0, SeekOrigin.Begin);
        }