示例#1
0
        public void getEqInfo(string otype, string name, ref DataTable dtEqList)
        {
            DataRow   r  = dtEqList.NewRow();
            CP2Object eq = (CP2Object)cp2File.ActivateObject(otype, name);

            r["eqtype"]     = otype;
            r["eqname"]     = name;
            r["sourcefile"] = fileName;
            if (otype == "Column" || otype == "SideColumn")
            {
                foreach (string s in arrColumnAttributes)
                {
                    object v    = eq.GetAttribute(s);
                    string strV = UnitConverter.convertData(v);
                    r[s] = strV;
                }
                P2Wrap91.CP2Object obj = (P2Wrap91.CP2Object)cp2File.ActivateObject("ColumnIn", name);
                foreach (string s in arrColumnInAttributes)
                {
                    object v    = obj.GetAttribute(s);
                    string strV = UnitConverter.convertData(v);
                    r[s] = strV;
                }
                string[] feeds     = r["feeddata"].ToString().Split(',');
                string[] feedtrays = r["feedtrays"].ToString().Split(',');
                string[] prods     = r["ProductData"].ToString().Split(',');
                string[] prodtypes = r["prodtype"].ToString().Split(',');
                string[] prodtrays = r["prodtrays"].ToString().Split(',');
                for (int i = 0; i < feeds.Length; i++)
                {
                    arrFeedData.Add(feeds[i]);
                    arrFeedTrays.Add(feedtrays[i]);
                }
                for (int i = 0; i < prods.Length; i++)
                {
                    arrProductData.Add(prods[i]);
                    arrProdTrays.Add(prodtrays[i]);
                    arrProdTypes.Add(prodtypes[i]);
                }
            }
            dtEqList.Rows.Add(r);
            //Close();
        }
示例#2
0
        private void getEqDataFromFile(string otype, string name, ref List <string> streamList, ref DataTable dtEqlist, ref DataTable dtStream)
        {
            DataRow   r              = dtEqlist.NewRow();
            CP2Object eq             = (CP2Object)cp2File.ActivateObject(otype, name);
            object    feeddata       = eq.GetAttribute("FeedData");
            object    productdata    = eq.GetAttribute("ProductData");
            string    strfeeddata    = UnitConverter.convertData(feeddata);
            string    strproductdata = UnitConverter.convertData(productdata);
            string    strprodtype    = string.Empty;

            r["eqtype"]      = otype;
            r["eqname"]      = name;
            r["sourcefile"]  = fileName;
            r["FeedData"]    = strfeeddata;
            r["ProductData"] = strproductdata;
            if (otype == "Column")
            {
                foreach (string s in arrColumnAttributes)
                {
                    object v    = eq.GetAttribute(s);
                    string strV = UnitConverter.convertData(v);
                    r[s] = strV;
                }
                P2Wrap91.CP2Object obj = (P2Wrap91.CP2Object)cp2File.ActivateObject("ColumnIn", name);
                foreach (string s in arrColumnInAttributes)
                {
                    object v    = obj.GetAttribute(s);
                    string strV = UnitConverter.convertData(v);
                    r[s] = strV;
                }


                Marshal.FinalReleaseComObject(obj);
                GC.ReRegisterForFinalize(obj);
            }
            dtEqlist.Rows.Add(r);
            Marshal.FinalReleaseComObject(eq);
            GC.ReRegisterForFinalize(eq);


            string[] feeds     = r["feeddata"].ToString().Split(',');
            string[] feedtrays = r["feedtrays"].ToString().Split(',');
            for (int i = 0; i < feeds.Length; i++)
            {
                string s = feeds[i];
                if (!streamList.Contains(s))
                {
                    streamList.Add(s);
                    if (otype == "Column")
                    {
                        getStreamDataFromFile(s, "", feedtrays[i], ref dtStream);
                    }
                    else
                    {
                        getStreamDataFromFile(s, "", "", ref dtStream);
                    }
                }
            }
            string[] prods     = r["ProductData"].ToString().Split(',');
            string[] prodtypes = r["prodtype"].ToString().Split(',');
            string[] prodtrays = r["prodtrays"].ToString().Split(',');
            for (int i = 0; i < prods.Length; i++)
            {
                string s = prods[i];
                if (!streamList.Contains(s))
                {
                    streamList.Add(s);
                    if (otype == "Column")
                    {
                        getStreamDataFromFile(s, prodtypes[i], prodtrays[i], ref dtStream);
                    }
                    else
                    {
                        getStreamDataFromFile(s, "", "", ref dtStream);
                    }
                }
            }
        }