private void btn_commit_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == string.Empty)
            {
                MessageBox.Show("请选择要合并的标准件编号", "Error");
                return;
            }
            if (cmb_parttype.Text.ToString() == string.Empty)
            {
                MessageBox.Show("请选择要合并的零件类型", "Error");
                return;
            }
            for (int i = 0; i < StrPartList.Count; i++)
            {
                string       strOne   = StrPartList[i].ToString();
                string       site     = strOne.Split(',')[0];
                string       partno   = strOne.Split(',')[1];
                string       partname = strOne.Split(',')[2];
                PartRelative pr       = new PartRelative();
                pr.CREATOR     = Username;
                pr.ACTIVITYSEQ = Convert.ToInt32(ActivitySeq);
                pr.ERP_PART_NO = partno;
                pr.PART_NAME   = partname;
                pr.PROJECTID   = ProjectId;
                pr.SITE        = site;
                pr.STA_PART_NO = textBox1.Text.ToString();
                if (partno == textBox1.Text.ToString())
                {
                    pr.STA_IF = "Y";
                }
                else
                {
                    pr.STA_IF = "N";
                }
                if (pr.IFmerged1())
                {
                    if (partno != textBox1.Text.ToString())
                    {
                        MessageBox.Show("零件" + partno + "已经被合并,请确认", "Error");
                        return;
                    }
                }
                pr.STA_PART_NO = partno;
                if (pr.IFStandardPart())
                {
                    if (partno != textBox1.Text.ToString())
                    {
                        MessageBox.Show("零件" + partno + "已经是标准件,不能被合并", "Error");
                        return;
                    }
                }
                pr.STA_PART_NO = textBox1.Text.ToString();
                if (!pr.FindExistRelative())
                {
                    pr.Add();
                }
            }
            StandartPart sp = new StandartPart();

            sp.PART_NAME   = txt_partname.Text.ToString();
            sp.PROJECTID   = ProjectId;
            sp.SITE        = txt_site.Text.ToString();
            sp.STA_PART_NO = textBox1.Text.ToString();
            sp.TYPEID      = Convert.ToInt32(cmb_parttype.SelectedValue.ToString());
            sp.CREATOR     = Username;
            if (!sp.FindExistStanPart())
            {
                sp.Add();
            }
            MessageBox.Show("合并成功");
            FindErpParts(textBox1.Text.ToString(), txt_site.Text.ToString());
        }
        private void btn_copy_Click(object sender, EventArgs e)
        {
            if (groupBox3.Visible == false)
            {
                groupBox3.Visible = true;
            }
            if (cmb_parttype.Text == string.Empty)
            {
                MessageBox.Show("请选择材料种类。", "提示");
                return;
            }
            int count = 0;

            for (int i = 0; i < this.dgv1.Rows.Count; i++)
            {
                if ((bool)dgv1.Rows[i].Cells[0].EditedFormattedValue == true)
                {
                    count++;
                }
            }
            if (count == 0)
            {
                MessageBox.Show("请至少选择一条数据。", "提示");
                return;
            }
            else
            {
                ArrayList partList = new ArrayList();
                string    site     = string.Empty;
                for (int j = 0; j < this.dgv1.Rows.Count; j++)
                {
                    if ((bool)dgv1.Rows[j].Cells[0].EditedFormattedValue == true)
                    {
                        site = dgv1.Rows[j].Cells[2].Value.ToString();

                        string erp_partno   = dgv1.Rows[j].Cells[3].Value.ToString();
                        string erp_partname = dgv1.Rows[j].Cells[4].Value.ToString();
                        //partList.Add(site+","+ erp_partno + "," + erp_partname);
                        PartRelative pr = new PartRelative();
                        pr.CREATOR     = LogUser;
                        pr.ACTIVITYSEQ = Convert.ToInt32(Str_activity);
                        pr.ERP_PART_NO = erp_partno;
                        pr.PART_NAME   = erp_partname;
                        pr.PROJECTID   = Projectid;
                        pr.SITE        = site;
                        pr.STA_PART_NO = erp_partno;
                        pr.STA_IF      = "Y";

                        if (pr.IFmerged1())
                        {
                            MessageBox.Show("零件" + erp_partno + "已经被合并,请确认", "Error");
                            return;
                        }
                        pr.STA_PART_NO = erp_partno;
                        if (pr.IFStandardPart())
                        {
                            MessageBox.Show("零件" + erp_partno + "已经是标准件,不能被合并", "Error");
                            return;
                        }
                        pr.STA_PART_NO = erp_partno;
                        if (!pr.FindExistRelative())
                        {
                            pr.Add();
                        }
                        StandartPart sp = new StandartPart();
                        sp.PART_NAME   = erp_partname;
                        sp.PROJECTID   = Projectid;
                        sp.SITE        = site;
                        sp.STA_PART_NO = erp_partno;
                        sp.TYPEID      = Convert.ToInt32(cmb_parttype.SelectedValue.ToString());
                        sp.CREATOR     = LogUser;
                        if (!sp.FindExistStanPart())
                        {
                            sp.Add();
                        }
                    }

                    // FindErpParts(textBox1.Text.ToString(), txt_site.Text.ToString());
                }
                MessageBox.Show("选中零件已经成功复制到标准零件库");
            }
        }