using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Kanban { public partial class FrmICMOBillNo : Form { public FrmICMOBillNo() { InitializeComponent(); } private void txtHICMOBillNo_KeyDown(object sender, KeyEventArgs e) { DataSet Ds; SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); long sICMOInterID = DBUtility.ClsPub.isLong(txtHICMOBillNo.Text.Trim()); if (e.KeyCode == Keys.Return) { //得到信息 Ds = oCn.RunProcReturn("select * from h_v_K3_ICMOBillList where hmainid=" + sICMOInterID.ToString() + " and hsubid=0", "h_v_K3_ICMOBillList"); //写入信息 if (Ds == null || Ds.Tables[0].Rows.Count == 0) { txtHICMOBillNo.Text = ""; MessageBox.Show("任务单内码错误,请重新扫描!"); return; } for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { Sub_WriteInForm_SM(Ds.Tables[0], i); } } } //根据TABLE写入界面 private void Sub_WriteInForm_SM(DataTable oTable, int i) { // this.txtHICMOBillNo.Tag = oTable.Rows[0]["HMainID"].ToString(); this.txtHICMOBillNo.Text = oTable.Rows[0]["单据号"].ToString(); } private void cmdOK_Click(object sender, EventArgs e) { this.Visible = false; } private void cmdCancel_Click(object sender, EventArgs e) { this.Visible = false; } private void FrmICMOBillNo_Load(object sender, EventArgs e) { txtHICMOBillNo.Tag = ""; txtHICMOBillNo.Text = ""; } } }