コード例 #1
0
        private void textBoxBar_TextChanged(object sender, EventArgs e)
        {
            string strBar = textBoxBar.Text;

            if (strBar.Contains("\r\n") && strBar.Length % 10 == 0)
            {
                string[] str   = MasMXG.SplitString(strBar, "\r\n");
                int      nbar  = MasMXG.ExtractNum(str[str.Length - 2]);
                bool     blerp = false;
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    if (str[str.Length - 2] == listView1.Items[i].SubItems[1].Text)
                    {
                        listView2.BeginUpdate();
                        ListViewItem lvi = new ListViewItem();
                        lvi = listView1.Items[i];
                        listView2.Items.Add((ListViewItem)lvi.Clone());
                        listView2.EndUpdate();
                        listView1.Items.RemoveAt(i);
                        blerp         = true;
                        textBox1.Text = listView1.Items.Count.ToString();
                        textBox2.Text = listView2.Items.Count.ToString();
                        masMXG.ErpReport(nbar);
                    }
                }
                if (!blerp)
                {
                    MessageBox.Show("条形码重复,重新扫描!!!");

                    /*
                     * textBoxBar.Clear();
                     * for(int nstep=0; nstep< str.Length-1; nstep++)
                     * {
                     *  textBoxBar.AppendText(str[nstep]+" ");
                     *  textBoxBar.AppendText("\r\n");
                     * }*/
                }
                textBox3.Text = (str.Length - 1).ToString();
            }
        }
コード例 #2
0
ファイル: FileForm.cs プロジェクト: huoyanbing/MilesXuan
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (listView1.Items.Count == 0)
     {
         return;
     }
     if (listView1.SelectedItems.Count == 2)
     {
         if (MasMXG.RightSplit(listView1.SelectedItems[0].Text, '.').ToLower() == "mxg" && MasMXG.RightSplit(listView1.SelectedItems[1].Text, '.').ToLower() == "erp")
         {
             string file_path  = textBox1.Text + "\\" + listView1.SelectedItems[0].Text;
             string file_path1 = textBox1.Text + "\\" + listView1.SelectedItems[1].Text;
             ReadMxgRun(file_path);
             ReadErpRun(file_path1);
         }
         else if (MasMXG.RightSplit(listView1.SelectedItems[1].Text, '.').ToLower() == "mxg" && MasMXG.RightSplit(listView1.SelectedItems[0].Text, '.').ToLower() == "erp")
         {
             string file_path  = textBox1.Text + "\\" + listView1.SelectedItems[1].Text;
             string file_path1 = textBox1.Text + "\\" + listView1.SelectedItems[0].Text;
             ReadMxgRun(file_path);
             ReadErpRun(file_path1);
         }
         else
         {
             MessageBox.Show("选中的文件有误!!!");
             return;
         }
         Hide();
         CreateBarDir();
         masForm.ShowDialog();
     }
     else
     {
         MessageBox.Show("请同时选择两个文件!!!");
     }
 }