private void button1_Click(object sender, EventArgs e) { if (txtpn.Text != "") { string sn = null; if (txtsn.Visible == true && txtsn.Text != "") { sn = txtsn.Text.Trim(); } else { sn = null; } string tmepid = null, Olid = null; string strsql = $"exec usp_OLNotnullInsertPN '{txtpn.Text.Trim()}','{sn}'"; DataSet ds = new DataSet(); ds = SqlHelper.ExcuteDataSet(strsql); if (ds != null) { tmepid = ds.Tables[0].Rows[0]["out"].ToString(); Olid = ds.Tables[0].Rows[0]["ol"].ToString(); } if (tmepid == "1") { labloc.Text = Olid; Server_Class.onoffled(Olid, 0); affirmloc(); } else { Server_Class.Error("3"); groupview(); } } }
private void olnullinsert() { if (txtloc.Text != "") { string sn = null; if (txtsn.Visible == true && txtsn.Text != "") { sn = txtsn.Text.Trim(); } else { sn = null; } string strsql = $"exec usp_OLNullInsertPN '{txtloc.Text.Trim()}','{txtpn.Text.Trim()}','{sn}'"; if (SqlHelper.ExcuteStr(strsql) == "1") { groupBox.Visible = false; labsn.Visible = false; txtsn.Visible = false; txtpn.Clear(); txtpn.Focus(); leds(txtloc.Text); } else { Server_Class.Error("0"); str = "库位不存在或库位上有料,请扫描正确的库位"; txtloc.Clear(); txtloc.Focus(); } } }
private void txtpn_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtpn.Text.Substring(0, 4) == "TDN-" || txtpn.Text.Substring(0, 5) == "PTDN-") { if (txtpn.Text.Substring(0, 1) == "P") { txtpn.Text = txtpn.Text.Remove(0, 1); } txtsn.Clear(); string strsql = $"exec usp_SNDesired '{txtpn.Text}'"; if (SqlHelper.ExcuteStr(strsql) == "1") { Server_Class.Error("1"); labsn.Visible = true; txtsn.Visible = true; txtsn.Focus(); } else { button1_Click(sender, e); } } else { str = "请输入正确的料号"; Server_Class.Error("0"); txtpn.Clear(); txtpn.Focus(); } } }
private void butpo_Click(object sender, EventArgs e) { if (Regex.IsMatch(txtpo.Text, @"^\d{6}")) { string strsql = $"exec usp_insertPO '{txtpo.Text}','{txtpoloc.Text}'"; if (SqlHelper.ExcuteStr(strsql) == "1") { leds(txtpoloc.Text); txtpo.Clear(); txtpoloc.Clear(); txtpo.Focus(); } else { Server_Class.Error("0"); str = "库位上有料,请使用新的库位"; txtpoloc.Clear(); txtpoloc.Focus(); } } }
private void thled() { Server_Class.Error("1"); Thread.Sleep(1000); this.Invoke((EventHandler) delegate { num1 = 0; for (int i = 0; i < GridViewPO.RowCount; i++) { if (GridViewPO.Rows[i].Cells["Location"].Value.ToString() != "") { num1++; Server_Class.onoffled(GridViewPO.Rows[i].Cells["Location"].Value.ToString(), 0); } } }); }
private void textBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { temp = 0; for (int i = 0; i < GridViewPO.RowCount; i++) { if (GridViewPO.Rows[i].Cells["Location"].Value != null) { if (textBox2.Text == GridViewPO.Rows[i].Cells["Location"].Value.ToString() && GridViewPO.Rows[i].Cells["zt"].Value == null) { GridViewPO.Rows[i].Cells["zt"].Value = "√"; TakePart(textBox2.Text.Trim()); Server_Class.onoffled(textBox2.Text.Trim(), 1); textBox2.Clear(); num++; temp = 1; break; } } } if (temp != 1) { Server_Class.Error("0"); str = "请扫描正确的库位"; textBox2.Clear(); textBox2.Focus(); } if (num == num1) { Thread.Sleep(1000); Server_Class.Error("2"); MessageBox.Show("备料完成", "系统消息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); GridViewPO.DataSource = null; tabControl1.Visible = false; txtpo.Clear(); txtpo.Focus(); } } }
private void txtrloc_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtrloc.Text == labloc.Text) { Server_Class.onoffled(txtrloc.Text, 1); Thread.Sleep(200); Server_Class.Error("2"); panel1.Visible = false; txtpn.Focus(); } else { Server_Class.Error("0"); str = "扫描正确的库位"; txtrloc.Clear(); txtrloc.Focus(); } } }
private void txtrloc_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtrloc.Text == label6.Text) { string strsql = $"exec usp_pnout '{txtrloc.Text.Trim()}'"; if (SqlHelper.ExecuteNonQuery(strsql)) { Server_Class.onoffled(txtrloc.Text, 1); panel1.Visible = false; txtpn.Clear(); txtsn.Clear(); txtpn.Focus(); } } else { Server_Class.Error("0"); str = "请扫描正确的库位"; txtrloc.Clear(); txtrloc.Focus(); } } }
private void button1_Click(object sender, EventArgs e) { if (txtpn.Text != "" && txtol.Text != "") { if (txtpn.Text.Substring(0, 1) == "P") { txtpn.Text = txtpn.Text.Remove(0, 1); } string strsql = $"exec usp_insertDefloc '{txtpn.Text}','{txtol.Text}'"; if (SqlHelper.ExecuteNonQuery(strsql)) { Server_Class.Error("2"); if (checkBox1.Checked == false) { txtpn.Clear(); txtol.Clear(); txtpn.Focus(); } else { txtol.Clear(); txtol.Focus(); } } } }