240 lines
10 KiB
C#
240 lines
10 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using Microsoft.VisualBasic;
|
|||
|
using DBFactory;
|
|||
|
namespace SystemConfig
|
|||
|
{
|
|||
|
public partial class FrmLaneFlashInfo : Form
|
|||
|
{
|
|||
|
bool IfUpdate = false;
|
|||
|
DBOperator dbo = CStaticClass.dbo;
|
|||
|
private static FrmLaneFlashInfo _formInstance;
|
|||
|
|
|||
|
public static FrmLaneFlashInfo FormInstance
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_formInstance == null)
|
|||
|
{
|
|||
|
_formInstance = new FrmLaneFlashInfo();
|
|||
|
|
|||
|
}
|
|||
|
return _formInstance;
|
|||
|
}
|
|||
|
set { _formInstance = value; }
|
|||
|
}
|
|||
|
public FrmLaneFlashInfo()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
_formInstance = this;
|
|||
|
}
|
|||
|
|
|||
|
private void btSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (MessageBox.Show("<22><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (this.tbLaneDeviceIndex.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbLaneDeviceIndex.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (this.tbStartCol.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><>ʼ<EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbStartCol.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbEndCol.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbEndCol.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbLeftX.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD>겻<EFBFBD><EAB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbLeftX.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbLeftY.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD>겻<EFBFBD><EAB2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbLeftY.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (this.tbTotalWidth.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbTotalWidth.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.tbShelfWidth.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbShelfWidth.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (this.tbShelfHeight.Text.Trim().Length == 0)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC>߶Ȳ<DFB6><C8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbShelfHeight.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
int ldi, sc, ec, lx, ly, sw, sh, tw;
|
|||
|
ldi = Convert.ToInt32(tbLaneDeviceIndex.Text);
|
|||
|
sc = Convert.ToInt32(tbStartCol.Text );
|
|||
|
ec = Convert.ToInt32(tbEndCol.Text);
|
|||
|
lx = Convert.ToInt32(tbLeftX.Text);
|
|||
|
ly = Convert.ToInt32(tbLeftY.Text);
|
|||
|
sw = Convert.ToInt32(tbShelfWidth.Text);
|
|||
|
sh = Convert.ToInt32(tbShelfHeight.Text);
|
|||
|
tw = Convert.ToInt32(tbTotalWidth.Text);
|
|||
|
string sql = "SELECT F_LaneDeviceIndex AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, F_StartCol AS <20><>ʼ<EFBFBD><CABC>, F_EndCol AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,"+
|
|||
|
" F_LeftX AS <20><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>, F_LeftY AS <20><><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>, F_TotalWidth AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, "+
|
|||
|
"F_ShelfWidth AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, F_ShelfHeight AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC>߶<EFBFBD> FROM T_Base_LaneInfo "+
|
|||
|
" Where F_LaneDeviceIndex='" + tbLaneDeviceIndex.Text + "'";
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
if ((ds.Tables[0].DefaultView.Count > 0))
|
|||
|
{
|
|||
|
if (IfUpdate == false)
|
|||
|
{
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3>벻Ҫ<EBB2BB>ظ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|||
|
this.tbLaneDeviceIndex.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
IfUpdate = false;
|
|||
|
}
|
|||
|
ds.Clear();
|
|||
|
if (IfUpdate == true)
|
|||
|
{
|
|||
|
sql = "UPDATE T_Base_LaneInfo SET F_StartCol =" + sc + ", F_EndCol =" + ec + ",F_LeftX=" + lx + ",F_LeftY=" + ly + ",F_ShelfWidth=" + sw + ",F_ShelfHeight=" + sh + ",F_TotalWidth=" + tw + " where F_LaneDeviceIndex=" + ldi;
|
|||
|
dbo.ExceSQL(sql);
|
|||
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ<EFBFBD>ijɹ<C4B3><C9B9><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
IfUpdate = false;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
sql = "INSERT INTO T_Base_LaneInfo(F_LaneDeviceIndex,F_StartCol, F_EndCol, F_LeftX, F_LeftY,F_ShelfWidth,F_ShelfHeight,F_TotalWidth)VALUES" +
|
|||
|
" (" + ldi + "," + sc + "," + ec + "," + lx + "," + ly + "," + sw + "," + sh + "," + tw + ")";
|
|||
|
dbo.ExceSQL(sql);
|
|||
|
MessageBox.Show("<22>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>Ϣ¼<CFA2><C2BC><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|||
|
}
|
|||
|
sql = "SELECT F_LaneDeviceIndex AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, F_StartCol AS <20><>ʼ<EFBFBD><CABC>, F_EndCol AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>," +
|
|||
|
" F_LeftX AS <20><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>, F_LeftY AS <20><><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>, F_TotalWidth AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, " +
|
|||
|
"F_ShelfWidth AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, F_ShelfHeight AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC>߶<EFBFBD> FROM T_Base_LaneInfo " +
|
|||
|
" Where F_LaneDeviceIndex='" + tbLaneDeviceIndex.Text + "'";
|
|||
|
ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
throw ex;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
IfUpdate = false;
|
|||
|
}
|
|||
|
|
|||
|
private void btNull_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.tbLaneDeviceIndex.Text = "";
|
|||
|
this.tbLeftX.Text = "";
|
|||
|
this.tbLeftY.Text = "";
|
|||
|
this.tbStartCol.Text = "";
|
|||
|
this.tbEndCol.Text = "";
|
|||
|
this.tbShelfHeight.Text = "";
|
|||
|
this.tbShelfWidth.Text = "";
|
|||
|
this.tbTotalWidth.Text = "";
|
|||
|
}
|
|||
|
|
|||
|
private void btQuery_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (tbContent.Text.Trim() == "") return;
|
|||
|
string sql = "SELECT F_LaneDeviceIndex AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, F_StartCol AS <20><>ʼ<EFBFBD><CABC>, F_EndCol AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,"+
|
|||
|
" F_LeftX AS <20><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>, F_LeftY AS <20><><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>, F_TotalWidth AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, "+
|
|||
|
"F_ShelfWidth AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, F_ShelfHeight AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC>߶<EFBFBD> FROM T_Base_LaneInfo "+
|
|||
|
" Where F_LaneDeviceIndex='"+ tbContent.Text +"'" ;
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
|
|||
|
private void btNullQuery_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.cbField.Text = "";
|
|||
|
this.tbContent.Text = "";
|
|||
|
}
|
|||
|
|
|||
|
private void FrmLaneFlashInfo_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void tsmEdit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (dataGridView1.RowCount <= 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
this.tabControl1.SelectTab("tabPage1");
|
|||
|
|
|||
|
this.tbLaneDeviceIndex.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "";
|
|||
|
this.tbStartCol.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString() + "";
|
|||
|
this.tbEndCol.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
|
|||
|
this.tbLeftX.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString() + "";
|
|||
|
this.tbLeftY.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString() + "";
|
|||
|
this.tbTotalWidth.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString() + "";
|
|||
|
this.tbShelfWidth.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString() + "";
|
|||
|
this.tbShelfHeight.Text = this.dataGridView1.CurrentRow.Cells[7].Value.ToString() + "";
|
|||
|
|
|||
|
|
|||
|
IfUpdate = true;
|
|||
|
}
|
|||
|
|
|||
|
private void tsmDel_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (dataGridView1.RowCount <= 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (MessageBox.Show("<22><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE>ѡ<EFBFBD><D1A1><EFBFBD>еġ<D0B5><C4A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ<EFBFBD><CFA2>" + this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "<22><><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
dbo.ExceSQL("delete from T_Base_LaneInfo where F_LaneDeviceIndex =" + Convert.ToInt32(this.dataGridView1.CurrentRow.Cells[0].Value));
|
|||
|
button2_Click(sender, e);
|
|||
|
}
|
|||
|
|
|||
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
string sql = "SELECT F_LaneDeviceIndex AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, F_StartCol AS <20><>ʼ<EFBFBD><CABC>, F_EndCol AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>," +
|
|||
|
" F_LeftX AS <20><><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>, F_LeftY AS <20><><EFBFBD><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>, F_TotalWidth AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, " +
|
|||
|
"F_ShelfWidth AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>, F_ShelfHeight AS <20><>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>ͼƬ<CDBC>߶<EFBFBD> FROM T_Base_LaneInfo ";
|
|||
|
DataSet ds = dbo.ExceSQL(sql);
|
|||
|
this.dataGridView1.DataSource = ds.Tables[0].DefaultView;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|