123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using AGV_WPF.DLL;
- using AGV_WPF.Model;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace AGV_WPF.ExtraUI
- {
- public partial class SNChange : Form
- {
- PLCSqlDLL PLCSql = new PLCSqlDLL();
- String resultRead1, resultRead2, resultRead3;
- public SNChange()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("是否要解除" + this.textBox1.Text + "号AGV绑定?", "警告", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- {
- if (PLCSql.PLCSqlMES(this.textBox1.Text, resultRead1, resultRead2, resultRead3, "3")) //删除数据
- {
- MessageBox.Show("解除绑定成功!");
- textBox1.Text = "";
- textBox1.Enabled = true;
- textBox2.Text = "";
- textBox3.Text = "";
- textBox4.Text = "";
- textBox2.Enabled = false;
- textBox3.Enabled = false;
- textBox4.Enabled = false;
- button1.Enabled = false;
- button2.Enabled = false;
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show("是否要修改" + this.textBox1.Text + "号AGV绑定?", "警告", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- {
- resultRead1 = this.textBox2.Text;
- resultRead2 = this.textBox3.Text;
- resultRead3 = this.textBox4.Text;
- if (PLCSql.PLCSqlMES(this.textBox1.Text, resultRead1, resultRead2, resultRead3, "1")) //修改数据
- {
- MessageBox.Show("修改绑定成功!");
- textBox1.Text = ""; textBox1.Enabled = true;
- textBox2.Text = "";
- textBox3.Text = "";
- textBox4.Text = "";
- textBox2.Enabled = false;
- textBox3.Enabled = false;
- textBox4.Enabled = false;
- button1.Enabled = false;
- button2.Enabled = false;
- }
- }
- }
- private void SNChange_FormClosed(object sender, FormClosedEventArgs e)
- {
- SNShow sn = new SNShow();
- DataTable data = PLCSql.PLCSqlSelectAll();
- sn.dataInit(data);
- }
- private void textBox1_TextChanged(object sender, EventArgs e)
- {
- }
- private void label4_Click(object sender, EventArgs e)
- {
- }
- private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- {
- if (this.textBox1.Text == "")
- {
- MessageBox.Show("请输入AGV号!");
- return;
- }
- else
- {
- AGVInfo Agvinfo = new AGVInfo();
- PLCSql.PLCMESSelect(this.textBox1.Text, "2", ref Agvinfo); //查询数据
- resultRead1 = Agvinfo.ProductCode;
- resultRead2 = Agvinfo.HolderBarCode;
- resultRead3 = Agvinfo.ProductType;
- //if (resultRead1 == null || resultRead1 == "")
- //{
- // textBox1.Text = "";
- // MessageBox.Show("该AGV号暂无绑定记录!");
- //}
- //else
- //{
- textBox1.Enabled = false;
- textBox2.Enabled = true;
- textBox3.Enabled = true;
- textBox4.Enabled = true;
- button1.Enabled = true;
- button2.Enabled = true;
- textBox2.Text = resultRead1;
- textBox3.Text = resultRead2;
- textBox4.Text = resultRead3;
- //}
- }
- }
- }
- }
- }
|