private void LEDONOFF(object sender, EventArgs e) { string gip, gmsg; int gport; i++; if (i <= PB.Maximum) { PB.Value = i; label2.Text = i + " 盏灯"; if (LabLEDview.Text == "l") { LabLEDview.Text = ""; } else { LabLEDview.Text = "l"; } gip = ds.Tables[0].Rows[i - 1]["LED_IP"].ToString(); gport = int.Parse(ds.Tables[0].Rows[i - 1]["LED_Port"].ToString()); gmsg = $"{ds.Tables[0].Rows[i-1]["LED_Message"].ToString()}{onoff}"; Server_Class.LEDOnOff(gip, gport, gmsg); } else { button1.Text = "打开LED"; button2.Text = "关闭LED"; button4.Visible = false; PB.Visible = false; label1.Visible = false; label2.Visible = false; } }
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 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 dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 4) { if (dataGridView1.CurrentRow.Cells ["Column5"].Value.ToString() == "取料") { label6.Text = dataGridView1.CurrentRow.Cells["Column1"].Value.ToString(); Server_Class.onoffled(label6.Text, 0); dataGridView1.CurrentRow.Cells["Column5"].Value = "拿走了"; enterloc(); } } }
public static void offled() { string strsql = "exec usp_updatePortStatus"; SqlHelper.ExecuteNonQuery(strsql); int s = Server_Class.list1.Count; if (s > 0) { for (int i = 0; i < s; i++) { Server_Class.onoffled(Server_Class.list1[0].ToString(), 1); } } }
private void button1_Click(object sender, EventArgs e) { if (txtloc.Text != "") { int a = 0; if (radioButton1.Checked == true) { a = 0; } else if (radioButton2.Checked == true) { a = 1; } Server_Class.onoffled(txtloc.Text, a); txtloc.Clear(); txtloc.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(); } } } }
private void FrmShip_FormClosed(object sender, FormClosedEventArgs e) { upmark(); Server_Class.offled(); }
private void Frmin_FormClosed(object sender, FormClosedEventArgs e) { Server_Class.offled(); }
private void leds(string ol) { Server_Class.onoffled(ol, 0); Thread.Sleep(1000); Server_Class.onoffled(ol, 1); }
private void button1_Click(object sender, EventArgs e) { Server_Class.LEDOnOff(textBox1.Text, int.Parse(textBox2.Text), textBox3.Text); }