Esempio n. 1
0
 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 + "�Ѿ��DZ�׼�������ܱ��ϲ�", "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());
 }
Esempio n. 2
0
        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 + "�Ѿ��DZ�׼�������ܱ��ϲ�", "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("ѡ������Ѿ��ɹ����Ƶ���׼�����");
                }
        }