Esempio n. 1
0
        private void print_Click(object sender, EventArgs e)
        {
            if (this.custommaterialNoTextBox.Text == "")
            {
                MessageBox.Show("客户料号为空!");
                return;
            }
            //根据客户料号,查询对应的厂商料号
            string vendormaterialNo = "";

            try
            {
                SqlConnection mConn = new SqlConnection(Constlist.ConStr);
                mConn.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = mConn;
                cmd.CommandType = CommandType.Text;

                cmd.CommandText = "select vendormaterialNo from MBMaterialCompare where custommaterialNo = '" + this.custommaterialNoTextBox.Text + "'";
                SqlDataReader querySdr = cmd.ExecuteReader();
                while (querySdr.Read())
                {
                    vendormaterialNo = querySdr[0].ToString();
                    break;
                }
                querySdr.Close();
                if (vendormaterialNo == "")
                {
                    MessageBox.Show("在物料对照表中与" + this.custommaterialNoTextBox.Text + "厂商料号不存在,请检查!");
                    mConn.Close();
                    return;
                }
                mConn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            string customMaterialSub = custommaterialNoTextBox.Text.Substring(2);

            if (customMaterialSub.Length != 8)
            {
                MessageBox.Show("客户料号的长度不是8位");
                return;
            }

            PrintUtils.printCustomMaterialNo(ordernoTextBox.Text, vendormaterialNo, custommaterialNoTextBox.Text.Substring(3), flexidcomboBox.Text, custom_serial_noTextBox.Text);
        }
Esempio n. 2
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     PrintUtils.disposePrinter();
 }