山东时代原料后WCS代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
4.1 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DBFactory;
namespace wcfControlMonitorClient
{
public partial class FrmTaskManage : Form
{//20151120
DBOperator dbo = CStaticClass.dbo;
private static FrmTaskManage _formInstance;
public static FrmTaskManage FormInstance
{
get
{
if (_formInstance == null)
{
_formInstance = new FrmTaskManage();
}
return _formInstance;
}
set { _formInstance = value; }
}
public FrmTaskManage()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
button_Refresh_Click(null, EventArgs.Empty);
}
private void dataGridView1_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if ((e.ColumnIndex >= 0) && (e.RowIndex >= 0) && (e.Button == MouseButtons.Right))
{
dataGridView1.ClearSelection();
dataGridView1.Rows[e.RowIndex].Selected = true;
dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
}
}
private void tsmEdit_Click(object sender, EventArgs e)
{
if (dataGridView1.RowCount <= 0)
{
return;
}
this.tbUserID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString() + "";
this.tbMaxCount.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString() + "";
// this.tbExeMaxCount.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString() + "";
}
private void btSave_Click(object sender, EventArgs e)
{
try
{
int GetCount, ExeCount;
if (tbUserID.Text == "")
{
MessageBox.Show("请先选定要修改的记录!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
if (int.TryParse(tbMaxCount.Text.Trim(), out GetCount) == false)
//if (int.TryParse(tbMaxCount.Text.Trim(), out GetCount) == false
// ||(int.TryParse(tbExeMaxCount.Text.Trim(), out ExeCount) == false))
{
MessageBox.Show("请输入有效的数字!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
string sql = string.Format("update T_Base_TaskCount2 set F_MaxCount={0} where F_Id={1}", GetCount, tbUserID.Text);
int i_ret = dbo.ExecuteSql(sql);
if (i_ret == 1)
{
MessageBox.Show("保存成功!", "操作提示:");
button_Refresh_Click(null, EventArgs.Empty);
}
else
{
MessageBox.Show("保存失败!", "操作提示:", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch(Exception ex )
{
throw ex;
}
}
private void FrmTaskManage_FormClosing(object sender, FormClosingEventArgs e)
{
_formInstance = null;
}
private void button_Refresh_Click(object sender, EventArgs e)
{
string CommomSql = "select F_Id as 编号,F_DeviceIndex_Start as 起点编号,F_DeviceIndex_End as 终点编号, F_MaxCount as 出库任务数,F_REMARK as 描述 from T_Base_TaskCount2";
DataView dv = dbo.ExceSQL(CommomSql).Tables[0].DefaultView;
this.dataGridView1.DataSource = dv;
dataGridView1.AutoResizeColumn(0, DataGridViewAutoSizeColumnMode.DisplayedCells);
// this.dataGridView1.Columns.AutoSize
}
private void Label3_Click(object sender, EventArgs e)
{
}
}
}