示例#1
0
        public static void AddCGRInfo(AxVIA3DXMLPluginLib.AxVIA3DXMLPlugin cgr, TabControl tabcontrol)
        {
            cgr.Visible = false;
            Label l = new Label();
            l.Width = 500; l.Height = 50;
            l.Text = "��û�в�ѯ����СƱ��άģ��������ݣ�";
            Font f = new Font("����", 16, FontStyle.Bold);
            l.Font = f;
            cgr.Parent.Controls.Add(l);
            int x = tabcontrol.Width / 2 - 200;

            l.Location = new Point(x, 0);
            l.Anchor = AnchorStyles.Left; l.Anchor = AnchorStyles.Right; l.Anchor = AnchorStyles.Top;
        }
示例#2
0
        public static void ProjectDrawingVersion_TabHop(TextBox tb1, TextBox tb2, TextBox tb3, TextBox tb4, TextBox tb5, TextBox tb6, TextBox tb7, TextBox tb8, System.Windows.Forms.TabControl tab, System.Windows.Forms.ComboBox cb1, System.Windows.Forms.ComboBox cb2,DataGridView dgv1, DataGridView dgv2, DataGridView dgv3, DataGridView dgv4, DataGridView dgv5, AxAcroPDFLib.AxAcroPDF pdf1, AxVIA3DXMLPluginLib.AxVIA3DXMLPlugin via, AxAcroPDFLib.AxAcroPDF pdf2, AxVIA3DXMLPluginLib.AxVIA3DXMLPlugin cat)
        {
            string spname = cb1.Text.ToString();
            int version = Convert.ToInt16( cb2.SelectedItem.ToString());
            int cb2count = cb2.Items.Count;
            OracleConnection conn = new OracleConnection(DataAccess.OIDSConnStr);//���conn����
            string queryString = "SP_GetHistorySpoolFieldContent";
            conn.Open();
            OracleCommand cmd = new OracleCommand(queryString, conn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            OracleParameter pram = new OracleParameter("V_CS", OracleType.Cursor);
            pram.Direction = System.Data.ParameterDirection.Output;
            cmd.Parameters.Add(pram);

            cmd.Parameters.Add("spool_in", OracleType.VarChar).Value = spname;
            cmd.Parameters["spool_in"].Direction = System.Data.ParameterDirection.Input;

            cmd.Parameters.Add("version_in", OracleType.Number).Value = version;
            cmd.Parameters["version_in"].Direction = System.Data.ParameterDirection.Input;

            cmd.Parameters.Add("cb2count_in", OracleType.Number).Value = cb2count;
            cmd.Parameters["cb2count_in"].Direction = System.Data.ParameterDirection.Input;

            try
            {
                OracleDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    tb1.Text = dr.GetOracleString(0).ToString();
                    tb2.Text = dr.GetOracleString(1).ToString();
                    tb3.Text = dr.GetOracleString(2).ToString();
                    tb4.Text = dr.GetOracleString(3).ToString();
                    tb5.Text = dr.GetOracleString(4).ToString();
                    tb6.Text = dr.GetOracleString(5).ToString();
                    tb7.Text = dr.GetOracleString(6).ToString();
                    tb8.Text = dr.GetOracleString(7).ToString();
                }
                dr.Close();
                conn.Close();
            }
            catch (OracleException ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return;
            }
            string sqlstr = string.Empty;
            string querystr = "SP_GetSpoolMaterialDetail";
            string tabt = tab.SelectedTab.Text.ToString();
            if (tab.SelectedTab.Text == "������Ϣ")
            {
                DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, version,cb2count,dgv1);
            }

            else if (tab.SelectedTab.Text == "���Ӽ���Ϣ")
            {
                DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, version, cb2count, dgv2);
            }

            else if (tab.SelectedTab.Text == "�ӹ���Ϣ")
            {
                DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, version, cb2count, dgv3);
            }

            else if (tab.SelectedTab.Text == "������Ϣ")
            {
                DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, version, cb2count, dgv4);
            }
            else if (tab.SelectedTab.Text == "���������Ϣ")
            {
                DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, version, cb2count, dgv5);
            }
            else if (tab.SelectedTab.Text == "��άͼ")
            {

                string filepath = User.rootpath + "\\" + "temp";
                if (!Directory.Exists(filepath))//���ļ��в��������½��ļ���
                {
                    Directory.CreateDirectory(filepath); //�½��ļ���
                }

                DataSet ds = new DataSet();
                if (cb2count == version + 1)
                {
                    sqlstr = @"select t.pdfpath from sp_pdf_tab t where t.spoolname = '" + cb1.SelectedItem.ToString() + "' and t.flag = 'Y'";
                }
                else
                {
                    sqlstr = @"select t.pdfpath from sp_pdf_tab t where t.ID = (select s.sp_id from sp_spool_tab s where s.revision = '"+version+"'  and s.flowstatus >= 2 and s.flowstatus != 3 and s.spoolname = '" + cb1.SelectedItem.ToString() + "')";
                }
                //sqlstr = "select t.pdfpath from sp_pdf_tab t where t.spoolname = '" + cb1.SelectedItem.ToString() + "' and t.flag = 'Y'";
                User.DataBaseConnect(sqlstr, ds);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    if (ds.Tables[0].Rows[0][0].ToString() != string.Empty)
                    {
                        string pdfpath = ds.Tables[0].Rows[0][0].ToString();
                        ds.Dispose();
                        string filenamestr = pdfpath.Substring(pdfpath.LastIndexOf("\\"));
                        string despath = filepath + filenamestr;
                        System.IO.File.Copy(pdfpath, despath, true);
                        pdf1.Visible = true;
                        pdf1.src = despath;
                    }
                    else
                    {
                        AddPDFInfo(pdf1, tab);
                    }
                }

                else
                {
                    AddPDFInfo(pdf1, tab);
                }
            }

            else if (tab.SelectedTab.Text == "��άģ��")
            {
                string filepath = User.rootpath + "\\" + "temp";
                if (!Directory.Exists(filepath))//���ļ��в��������½��ļ���
                {
                    Directory.CreateDirectory(filepath); //�½��ļ���
                }

                DataSet ds = new DataSet();
                if (cb2count == version + 1)
                {
                    sqlstr = "select t.cgrpath from sp_cgr_tab t where t.spoolname = '" + cb1.SelectedItem.ToString() + "' and t.flag = 'Y'";
                }
                else
                {
                    sqlstr = @"select t.cgrpath from sp_cgr_tab t where t.ID = (select s.sp_id from sp_spool_tab s where s.revision = '" + version + "'  and s.flowstatus >= 2 and s.flowstatus != 3 and s.spoolname = '" + cb1.SelectedItem.ToString() + "')";
                }
                //string sqlstr = "select t.cgrpath from sp_cgr_tab t where t.spoolname = '" + cb.SelectedItem.ToString() + "' and t.flag = 'Y'";
                User.DataBaseConnect(sqlstr, ds);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    if (ds.Tables[0].Rows[0][0].ToString() != string.Empty)
                    {
                        User.DataBaseConnect(sqlstr, ds);
                        string cgrpath = ds.Tables[0].Rows[0][0].ToString();
                        ds.Dispose();
                        string filenamestr = cgrpath.Substring(cgrpath.LastIndexOf("\\"));
                        string despath = filepath + filenamestr;
                        System.IO.File.Copy(cgrpath, despath, true);
                        via.Visible = true;
                        via.DocumentFile = despath;
                    }
                    else
                    {
                        AddCGRInfo(via, tab);
                    }

                }
                else
                {
                    AddCGRInfo(via, tab);
                }
            }
        }
示例#3
0
        public static void CellEvent_TabHop(TextBox tb1, TextBox tb2,TextBox tb3, TextBox tb4, TextBox tb5, TextBox tb6, TextBox tb7,TextBox tb8, System.Windows.Forms.TabControl tab,System.Windows.Forms.ComboBox cb, DataGridView dgv1, DataGridView dgv2, DataGridView dgv3, DataGridView dgv4, DataGridView dgv5, AxAcroPDFLib.AxAcroPDF pdf1, AxVIA3DXMLPluginLib.AxVIA3DXMLPlugin via, AxAcroPDFLib.AxAcroPDF pdf2, AxVIA3DXMLPluginLib.AxVIA3DXMLPlugin cat)
        {
            string spname = cb.SelectedItem.ToString();
            OracleConnection conn = new OracleConnection(DataAccess.OIDSConnStr);//���conn����
            string queryString = "SP_GetSpoolFieldContent";
            conn.Open();
            OracleCommand cmd = new OracleCommand(queryString, conn);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            OracleParameter pram = new OracleParameter("V_CS", OracleType.Cursor);
            pram.Direction = System.Data.ParameterDirection.Output;
            cmd.Parameters.Add(pram);

            cmd.Parameters.Add("spool_in", OracleType.VarChar).Value = spname;
            cmd.Parameters["spool_in"].Direction = System.Data.ParameterDirection.Input;
            try
            {
                OracleDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    tb1.Text = dr.GetOracleString(0).ToString();
                    tb2.Text = dr.GetOracleString(1).ToString();
                    tb3.Text = dr.GetOracleString(2).ToString();
                    tb4.Text = dr.GetOracleString(3).ToString();
                    tb5.Text = dr.GetOracleString(4).ToString();
                    tb6.Text = dr.GetOracleString(5).ToString();
                    tb7.Text = dr.GetOracleString(6).ToString();
                    tb8.Text = dr.GetOracleString(7).ToString();
                }
                dr.Close();
                conn.Close();
            }
            catch (OracleException ex)
            {
                MessageBox.Show("���ݿ����");
                return;
            }

            //string querystr = "SP_GetSpoolMaterialDetail";
            //string tabt = tab.SelectedTab.Text.ToString();
            //if (tab.SelectedTab.Text == "������Ϣ")
            //{
            //    DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, dgv1);

            //}

            //else if (tab.SelectedTab.Text == "���Ӽ���Ϣ")
            //{
            //    DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, dgv2);
            //}

            //else if (tab.SelectedTab.Text == "�ӹ���Ϣ")
            //{

            //    DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, dgv3);

            //}

            //else if (tab.SelectedTab.Text == "������Ϣ")
            //{

            //    DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, dgv4);

            //}
            //else if (tab.SelectedTab.Text == "���������Ϣ")
            //{

            //    DBConnection.GetSpoolMaterialDetail(querystr, tabt, spname, dgv5);

            //}
            //else if (tab.SelectedTab.Text == "��άͼ")
            //{
            //    string filepath = User.rootpath + "\\" + "temp";
            //    if (!Directory.Exists(filepath))//���ļ��в��������½��ļ���
            //    {
            //        Directory.CreateDirectory(filepath); //�½��ļ���
            //    }

            //    DataSet ds = new DataSet();
            //    string sqlstr = "select t.pdfpath from sp_pdf_tab t where t.spoolname = '" + cb.SelectedItem.ToString() + "' and t.flag = 'Y'";
            //    User.DataBaseConnect(sqlstr,ds);
            //    if (ds.Tables[0].Rows.Count != 0)
            //    {
            //        if (ds.Tables[0].Rows[0][0].ToString() != string.Empty)
            //        {
            //            string pdfpath = ds.Tables[0].Rows[0][0].ToString();
            //            ds.Dispose();
            //            string filenamestr = pdfpath.Substring(pdfpath.LastIndexOf("\\"));
            //            string despath = filepath + filenamestr;
            //            System.IO.File.Copy(pdfpath, despath, true);
            //            pdf1.src = despath;
            //        }
            //        else
            //        {
            //            AddPDFInfo(pdf1, tab);
            //        }
            //    }

            //    else
            //    {
            //        AddPDFInfo(pdf1, tab);
            //    }

            //}
            //else if (tab.SelectedTab.Text == "��άģ��")
            //{
            //    string filepath = User.rootpath + "\\" + "temp";
            //    if (!Directory.Exists(filepath))//���ļ��в��������½��ļ���
            //    {
            //        Directory.CreateDirectory(filepath); //�½��ļ���
            //    }

            //    DataSet ds = new DataSet();
            //    string sqlstr = "select t.cgrpath from sp_cgr_tab t where t.spoolname = '" + cb.SelectedItem.ToString() + "' and t.flag = 'Y'";
            //    User.DataBaseConnect(sqlstr,ds);
            //    if (ds.Tables[0].Rows.Count != 0 )
            //    {
            //        if (ds.Tables[0].Rows[0][0].ToString() != string.Empty)
            //        {
            //            User.DataBaseConnect(sqlstr, ds);
            //            string cgrpath = ds.Tables[0].Rows[0][0].ToString();
            //            ds.Dispose();
            //            string filenamestr = cgrpath.Substring(cgrpath.LastIndexOf("\\"));
            //            string despath = filepath + filenamestr;
            //            System.IO.File.Copy(cgrpath, despath, true);
            //            via.DocumentFile = despath;
            //        }
            //        else
            //        {
            //            AddCGRInfo(via,tab);
            //        }

            //    }
            //    else
            //    {
            //        AddCGRInfo(via, tab);
            //    }
            //}

            //else if (tab.SelectedTab.Text == "��άISOͼ")
            //{
            //    using (OracleConnection connection = new OracleConnection(DataAccess.OIDSConnStr))
            //    {
            //        connection.Open();
            //        OracleCommand command = connection.CreateCommand();
            //        command.CommandText = "select * from  SP_LINE_ISOMETRIC_TAB WHERE 1=1  AND FLAG = 'Y' AND LINENAME = (SELECT LINENAME FROM SP_SPOOL_TAB WHERE SPOOLNAME = '" + cb.SelectedItem.ToString() + "' AND FLAG = 'Y')";
            //        OracleDataReader dr = command.ExecuteReader();
            //        string filepath = string.Empty;
            //        while (dr.Read())
            //        {
            //            if (dr["PDF_ISOMETRIC"] != null)//�����������Ϊ�� ����ת������
            //            {
            //                try
            //                {
            //                    byte[] b1 = (byte[])dr["PDF_ISOMETRIC"];

            //                    string pathstr = User.rootpath + "\\" + "temp";
            //                    if (!Directory.Exists(pathstr))//���ļ��в��������½��ļ���
            //                    {
            //                        Directory.CreateDirectory(pathstr); //�½��ļ���
            //                    }

            //                    filepath = pathstr + "\\" + dr["LINENAME"] + ".pdf";
            //                    FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate);
            //                    BinaryWriter bw = new BinaryWriter(fs);
            //                    bw.Write(b1, 0, b1.Length);
            //                    bw.Close();
            //                    fs.Close();
            //                }
            //                catch (SystemException ex)
            //                {
            //                    return;
            //                }
            //            }
            //            pdf2.src = filepath;
            //        }
            //        dr.Close();
            //        if (pdf2.src == null)
            //        {
            //            pdf2.Visible = false;
            //            Label l = new Label();
            //            l.Width = 500; l.Height = 50;
            //            l.Text = "��û�в�ѯ����صĶ�άISOͼ�����ݣ�";
            //            Font f = new Font("����", 16, FontStyle.Bold);
            //            l.Font = f;
            //            pdf2.Parent.Controls.Add(l);
            //            int x = tab.Width / 2 - 200;

            //            l.Location = new Point(x, 0);
            //            l.Anchor = AnchorStyles.Left; l.Anchor = AnchorStyles.Right; l.Anchor = AnchorStyles.Top;
            //        }
            //    }

            //}

            //else if (tab.SelectedTab.Text == "��άISOģ��")
            //{
            //    using (OracleConnection connection = new OracleConnection(DataAccess.OIDSConnStr))
            //    {
            //        connection.Open();
            //        OracleCommand command = connection.CreateCommand();
            //        command.CommandText = "select * from  SP_LINE_ISOMETRIC_TAB WHERE 1=1  AND FLAG = 'Y' AND LINENAME = (SELECT LINENAME FROM SP_SPOOL_TAB WHERE SPOOLNAME = '" + cb.SelectedItem.ToString() + "' AND FLAG = 'Y')";
            //        OracleDataReader dr = command.ExecuteReader();
            //        string filepath = string.Empty;
            //        while (dr.Read())
            //        {
            //            if (dr["XML_ISOMETRIC"] != null)//�����������Ϊ�� ����ת������
            //            {
            //                try
            //                {
            //                    byte[] b1 = (byte[])dr["XML_ISOMETRIC"];

            //                    string pathstr = User.rootpath + "\\" + "temp";
            //                    if (!Directory.Exists(pathstr))//���ļ��в��������½��ļ���
            //                    {
            //                        Directory.CreateDirectory(pathstr); //�½��ļ���
            //                    }

            //                    filepath = pathstr + "\\" + dr["LINENAME"] + ".cgr";
            //                    FileStream fs = new FileStream(filepath, FileMode.OpenOrCreate);
            //                    BinaryWriter bw = new BinaryWriter(fs);
            //                    bw.Write(b1, 0, b1.Length);
            //                    bw.Close();
            //                    fs.Close();
            //                }
            //                catch (SystemException ex)
            //                {
            //                    return;
            //                }
            //            }
            //            cat.DocumentFile = filepath;
            //        }
            //        dr.Close();
            //        if (cat.DocumentFile == string.Empty)
            //        {
            //            cat.Visible = false;
            //            Label l = new Label();
            //            l.Width = 500; l.Height = 50;
            //            l.Text = "��û�в�ѯ�������άISOģ�����ݣ�";
            //            Font f = new Font("����", 16, FontStyle.Bold);
            //            l.Font = f;
            //            cat.Parent.Controls.Add(l);
            //            int x = tab.Width / 2 - 200;

            //            l.Location = new Point(x, 0);
            //            l.Anchor = AnchorStyles.Left; l.Anchor = AnchorStyles.Right; l.Anchor = AnchorStyles.Top;
            //        }
            //    }
            //}
        }