コード例 #1
0
 async private void Btn_search_LastTestRes_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(tb_sn.Text))
         {
             MessageBox.Show("追溯号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (string.IsNullOrEmpty(cb_typeNo.Text))
         {
             MessageBox.Show("零件号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (string.IsNullOrEmpty(cb_station.Text))
         {
             MessageBox.Show("站位名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         //由追溯码+型号+当前站位
         DataTable dt = (await serviceClient.SelectLastTestResultUpperAsync(tb_sn.Text.Trim(), cb_typeNo.Text.Trim(), cb_station.Text.Trim())).Tables[0];
         listView_TestRes.DataSource = dt;
     }
     catch (Exception ex)
     {
         LogHelper.Log.Error(ex.Message + "\r\n" + ex.StackTrace);
     }
 }