Example #1
0
 /// <summary>
 /// 出库查看
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_Check_Click(object sender, EventArgs e)
 {
     if (dataGridView_HasPallet.DataSource == null)
     {
         MessageBox.Show("没有可用的数据。");
     }
     else
     {
         if (dataGridView_HasPallet.SelectedRows.Count == 0)
         {
             MessageBox.Show("没有选定数据,请先选定数据在进行操作。");
         }
         else
         {
             //组合,按逗号分隔
             string workNums = "";
             foreach (DataGridViewRow dr in dataGridView_HasPallet.SelectedRows)
             {
                 workNums += dr.Cells["nWorkId"].Value.ToString().Trim();
                 workNums += ",";
             }
             //移除最后一个逗号
             workNums = workNums.TrimEnd(',');
             try
             {
                 //执行存储过程
                 DataTable dt = PubDBCommFuns.SP_SG_OutCheck(base.AppInformation.SvrSocket, workNums);
                 if (dt == null)
                 {
                     MessageBox.Show("执行失败。");
                 }
                 else
                 {
                     if (dt.Rows[0][0].ToString() == "-1")
                     {
                         MessageBox.Show("执行出错,详情:" + dt.Rows[0][1].ToString());
                     }
                     else
                     {
                         MessageBox.Show("执行成功。");
                     }
                 }
             }
             catch (Exception)
             {
                 MessageBox.Show("内部异常,可能已经失去网络连接。");
             }
         }
     }
 }