private void btnDele_Click(object sender, EventArgs e) { if (this.dgvData.DataSource != null && this.dgvData.SelectedRows != null && this.dgvData.SelectedRows.Count > 0) { if (MessageBox.Show("是否删除该跑钩记录?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly) == DialogResult.Yes) { try { DataGridViewRow row = this.dgvData.SelectedRows[0]; Public.WriteManLog("", 0, "", Convert.ToInt32(row.Cells[1].Value), 0, "", Convert.ToInt32(row.Cells[1].Value), "跑钩删除", Public.userno); string strDele = "delete from WMS_Bms_Rec_WGD_PaoGou where gh=" + row.Cells[1].Value.ToString() + " and pch='" + row.Cells[2].Value.ToString() + "'"; DbEntry.Context.ExecuteNonQuery(strDele); BindGrid(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
private void btnPrint_Click(object sender, EventArgs e) { if (this.dgvData.DataSource == null) { MessageBox.Show("请先查询!"); return; } if (this.dgvData.SelectedRows == null || this.dgvData.SelectedRows.Count == 0) { MessageBox.Show("请选择要打印的信息!"); return; } DataGridViewRow row = this.dgvData.SelectedRows[0]; string ph, gg, pch, jz, rq, bb, gh, bz, xlh, tm, ErrSeason, psx; bool isckflag; int pchint, iType; double fjz, ffjz; if (this.txtPCH.Text.Length != 9) { MessageBox.Show("批次号位数不够"); return; } jz = this.txtJZZL.Text.Trim();//输入的重量信息 //如果是取原始重量 if (this.chkYZL.Checked) { ffjz = Convert.ToDouble(this.txtZL.Text) * 1000; jz = ffjz.ToString(); } else { //根据获得重量范围参数值 getsysparam(); //获取原始钢坯重量 GetgpZL(row.Cells[3].Value.ToString()); if (!IsCheckZL(Convert.ToDouble(jz)))//验证重量是否满足 { return; } //修改20180104 //fjz = Convert.ToDouble(jz) / 1000 - getbzzl(row.Cells[2].Value.ToString(), row.Cells[11].Value.ToString(), Convert.ToDouble(this.txtJZZL.Text)); fjz = Convert.ToDouble(jz) / 1000 - getbzzl(row.Cells[2].Value.ToString(), row.Cells[11].Value.ToString(), Convert.ToDouble(this.txtJZZL.Text)) - gettwzl(row.Cells[2].Value.ToString()); jz = (fjz * 1000).ToString(); } if (string.IsNullOrEmpty(jz) || Convert.ToDouble(jz) == 0) { this.txtJZZL.Text = "000000"; MessageBox.Show("重量错误!"); return; } if (MessageBox.Show("打印信息是否确认无误,是否打印?", "操作提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly) == DialogResult.No) { return; } try { Public.WriteManLog(row.Cells[0].Value.ToString(), Convert.ToDouble(jz), this.txtSX.Text, Convert.ToInt32(this.txtGH.Text), Convert.ToDouble(this.txtZL.Text), this.txtSX.Text, Convert.ToInt32(this.txtGH.Text), "标牌补打", Public.userno); string strq = "update " + tablename + " set zl=" + (Convert.ToDouble(jz) / 1000).ToString() + " where barcode='" + row.Cells[0].Value.ToString() + "'"; DbEntry.Context.ExecuteNonQuery(strq); row.Cells[6].Value = (Convert.ToDouble(jz) / 1000).ToString(); if (this.chkYZL.Checked == false) { string upYS = "update WMS_Bms_Rec_Log_Print set ysmz=" + this.txtJZZL.Text + ",usertime=getdate() where barcode='" + row.Cells[0].Value.ToString() + "'"; DbEntry.Context.ExecuteNonQuery(upYS); } } catch (Exception ex) { MessageBox.Show("系统错误:" + ex.Message); return; } if (this.numTxt.Value <= 0) { return; } printpq(row.Cells[0].Value.ToString(), jz); //if (this.WindowState == FormWindowState.Minimized) // this.WindowState = FormWindowState.Normal; //Thread.Sleep(1000); //this.Activate(); }