锐腾搅拌上料功能
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.

752 lines
30 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Linq;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.BandedGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid;
using System.IO;
using System.Threading;
using ICSSoft.Base.Language.Tool;
using ICSSoft.Base.Config.AppConfig;
using ICSSoft.Base.UserControl.MessageControl;
using ICSSoft.Base.Config.DBHelper;
using ICSSoft.Base.Report.Filter;
using ICSSoft.Base.UserControl.FormControl;
using ICSSoft.Base.Report.GridReport;
using ICSSoft.Base.ReferForm.AppReferForm;
using ICSSoft.Frame.Data.BLL;
using ICSSoft.Frame.Data.Entity;
namespace ICSSoft.Frame.APP
{
public partial class FormICSTS : DevExpress.XtraEditors.XtraForm
{
private string sqltxt = "";
private string sqlconn = "";
String guid = AppConfig.GetGuid();
private DataTable dataSource = null;
private string ecscode = "";
private string ecode = "";
private string ecsgcode = "";
private string dutycode = "";
private string solcode = "";
private string tsid = "";
private FormICSTSUIModel TS;
private string fnode = "";
private string snode = "";
TreeNode theLastNode = null;
#region 构造函数
public FormICSTS()
{
InitializeComponent();
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
this.WindowState = FormWindowState.Maximized;
txtECGDESC.Properties.ReadOnly = true;
txtECDESC.Properties.ReadOnly = true;
groupBox1.Visible = false;
}
#endregion
private void InitDataTable()
{
string sql = @"select distinct ECGCODE
from ICSTSERRORCODE
where RCARD='" + txtRCARD.Text + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
BindRoot(data);
}
private void BindRoot(DataTable data)
{
//取根
foreach (DataRow dr in data.Rows)
{
TreeNode rootNode = new TreeNode();
rootNode.Tag = dr;
rootNode.Text = dr["ECGCODE"].ToString();
treeView1.Nodes.Add(rootNode);
BindChildAreas(rootNode, data);
}
}
//递归绑定子区域
private void BindChildAreas(TreeNode fNode, DataTable data)
{
string sql = @"select ECODE
from ICSTSERRORCODE
where RCARD='" + txtRCARD.Text + "' and ECGCODE='" + fNode .Text+ "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data1 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
//DataRow dr = (DataRow)fNode.Tag;
////父节点数据关联的数据行
//string fid = (string)dr["ECGCODE"];
////父节点ID
//DataRow[] rows = data1.Rows;//子区域
if (data1.Rows.Count == 0) //递归终止,区域不包含子区域时
{ return; }
foreach (DataRow dr in data1.Rows)
{
TreeNode node = new TreeNode();
node.Tag = dr;
node.Text = dr["ECODE"].ToString(); //添加子点
fNode.Nodes.Add(node); //递归
//BindChildAreas(node, data);
}
}
private void TreeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
foreach (TreeNode node in treeView1.Nodes)
{
if (node.IsSelected)
{
return;
}
foreach (TreeNode childnode in node.Nodes)
{
if (childnode.IsSelected)
{
fnode = node.Text;
snode = childnode.Text;
groupBox1.Visible = true;
string sql = @"select ECGDESC
from ICSECG
where ECGCODE='" + fnode + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
foreach (DataRow dr in data.Rows)
{
txtECGDESC.Text = dr["ECGDESC"].ToString();
}
string sql2 = @"select ECDESC
from ICSEC
where ECODE='" + snode + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql2 = string.Format(sql2);
DataTable data2 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql2).Tables[0];
foreach (DataRow dr2 in data2.Rows)
{
txtECDESC.Text = dr2["ECDESC"].ToString();
}
string sql3 = @"select a.EPART,b.PARTNAME
from ICSTSERRORCAUSE2EPART a
left join ICSPART b on a.EPART=b.PARTCODE
where a.RCARD='" + txtRCARD.Text + "' and a.ECGCODE='" + fnode + "' and a.ECODE='" + snode + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "'";
sql3 = string.Format(sql3);
DataTable data3 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql3).Tables[0];
if (data3.Rows.Count > 0)
{
foreach (DataRow dr3 in data3.Rows)
{
txtEPART.Text = dr3["PARTNAME"].ToString();
}
}
else
{
txtEPART.Text = "";
}
string sql4 = @"select a.ECSCODE,a.ECSGCODE,a.DUTYCODE,a.SOLCODE,a.PREVENTION,b.ECSDESC,c.ECSGDESC,d.DUTYDESC,e.SOLDESC
from ICSTSERRORCAUSE a
left join ICSECS b on a.ECSCODE=b.ECSCODE
left join ICSECSG c on a.ECSGCODE=c.ECSGCODE
left join ICSDUTY d on a.DUTYCODE=d.DUTYCODE
left join ICSSOLUTION e on a.SOLCODE=e.SOLCODE
where a.RCARD='" + txtRCARD.Text + "' and a.ECGCODE='" + fnode + "' and a.ECODE='" + snode + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "'";
sql4 = string.Format(sql4);
DataTable data4 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql4).Tables[0];
if (data4.Rows.Count > 0)
{
foreach (DataRow dr4 in data4.Rows)
{
txtECSCODE.Text = dr4["ECSDESC"].ToString();
txtECSGCODE.Text = dr4["ECSGDESC"].ToString();
txtDUTYCODE.Text = dr4["DUTYDESC"].ToString();
txtSOLCODE.Text = dr4["SOLDESC"].ToString();
txtPREVENTION.Text = dr4["PREVENTION"].ToString();
}
}
else
{
txtECSCODE.Text = "";
txtECSGCODE.Text = "";
txtDUTYCODE.Text = "";
txtSOLCODE.Text = "";
txtPREVENTION.Text = "";
}
string sql5 = @"select ELOC
from ICSTSERRORCODE2LOC
where RCARD='" + txtRCARD.Text + "' and ECGCODE='" + fnode + "' and ECODE='" + snode + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql5 = string.Format(sql5);
DataTable data5 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql5).Tables[0];
if (data5.Rows.Count > 0)
{
foreach (DataRow dr5 in data5.Rows)
{
txtELOC.Text = dr5["ELOC"].ToString();
}
}
else
{
txtELOC.Text = "";
}
}
}
}
}
#region 操作权限
public DataTable RightOfExute()
{
DataTable rData = new DataTable();
rData.Columns.Add("BtnName");
rData.Columns.Add("ActionName");
//查看权限(必须有)
DataRow seeRow = rData.NewRow();
seeRow["BtnName"] = "see";
seeRow["ActionName"] = "查看";
rData.Rows.Add(seeRow);
List<Control> ControlList = new List<Control>();
ControlList.Add(btnSave);
//ControlList.Add(btnModify);
//ControlList.Add(btnDel);
//ControlList.Add(btnOutPut);
foreach (Control ctr in ControlList)
{
if (ctr.GetType() == typeof(SimpleButton))
{
DataRow dr = rData.NewRow();
dr["BtnName"] = ctr.Name;
dr["ActionName"] = ctr.Text;
rData.Rows.Add(dr);
}
}
rData.AcceptChanges();
return rData;
}
public DataTable RightOfData()// 数据权限
{
DataTable rData = new DataTable();
rData.Columns.Add("BodyName");
rData.Columns.Add("ControlName");
rData.Columns.Add("ControlCaption");
rData.AcceptChanges();
return rData;
}
#endregion
#region 退出
private void btnClose_Click(object sender, EventArgs e)
{
AppConfig.CloseFormShow(this.Text);
this.Close();
}
private void btnExit_Click(object sender, EventArgs e)
{
AppConfig.CloseFormShow(this.Text);
this.Close();
}
#endregion
#region 移动窗体
private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
//首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
//系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
//假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
//同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
//重写窗体,使窗体可以不通过自带标题栏实现移动
protected override void WndProc(ref Message m)
{
//当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
//当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
//这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
//注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
if ((int)m.Result == HTCLIENT)
m.Result = (IntPtr)HTCAPTION;
return;
}
//拦截双击标题栏、移动窗体的系统消息
if (m.Msg != 0xA3)
{
base.WndProc(ref m);
}
}
#endregion
#region 列表
private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
e.Info.DisplayText = (e.RowHandle + 1).ToString();
}
#endregion
// #region 根据选择的不良代码组为不良代码赋值
// private void txtECSCODE_SelectedValueChanged(object sender, EventArgs e)
// {
// string sql = @"select a.ECODE,b.ECDESC
// from ICSTSERRORCODE a
// left join ICSEC b on a.ECODE=b.ECODE
// where a.RCARD='" + txtRCARD.Text + "' and a.ECGCODE='" + txtECGCODE.Text + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "'";
// sql = string.Format(sql);
// DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
// txtECODE.Items.Clear();
// foreach (DataRow dr in data.Rows)
// {
// txtECODE.Items.Add(dr[0].ToString());
// }
// }
//#endregion
#region 根据输入的产品序列号
private void txtRCARD_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
treeView1.Nodes.Clear();
groupBox1.Visible = false;
string rcard = "";
rcard = txtRCARD.Text;
bool include = ICSTSBLL.IsIncludingInICSTS(rcard);
if (include)
{
ICSBaseSimpleCode.AppshowMessageBox("产品序列号不存在或状态不正确!");
return;
}
string sql1 = @"select TSID,MODELCODE,ITEMCODE,MOCODE,SHIFTDAY,MOSEQ,RCARDSEQ
from ICSTS
where RCARD='" + txtRCARD.Text + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
sql1 = string.Format(sql1);
DataTable data1 = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql1).Tables[0];
tsid = data1.Rows[0]["TSID"].ToString();
TS = new FormICSTSUIModel();
TS.MODELCODE = data1.Rows[0]["MODELCODE"].ToString();
TS.ITEMCODE = data1.Rows[0]["ITEMCODE"].ToString();
TS.MOCODE = data1.Rows[0]["MOCODE"].ToString();
TS.SHIFTDAY = Convert.ToInt32(data1.Rows[0]["SHIFTDAY"].ToString());
TS.MOSEQ = Convert.ToDecimal(data1.Rows[0]["MOSEQ"].ToString());
TS.RCARDSEQ = Convert.ToInt32(data1.Rows[0]["RCARDSEQ"].ToString());
InitDataTable();
}
}
#endregion
#region 不良组件按钮
private void txtEPART_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select ID,PARTCODE as [组件编码],PARTNAME as [组件名称] from ICSPART";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "产品信息";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("ID");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
//reForm.FilterKey = btn.Text;
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
txtEPART.Text = dr["组件编码"].ToString();
}
}
}
#endregion
#region 保存
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (fnode == "" || snode=="")
{
ICSBaseSimpleCode.AppshowMessageBox("请选择不良代码!");
return;
}
if (txtRCARD.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请输入产品序列号!");
return;
}
//if (txtECGCODE.Text.Trim() == "")
//{
// ICSBaseSimpleCode.AppshowMessageBox("请选择不良代码组!");
// return;
//}
//if (txtECODE.Text.Trim() == "")
//{
// ICSBaseSimpleCode.AppshowMessageBox("请选择不良代码!");
// return;
//}
if (txtEPART.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请选择不良组件!");
return;
}
if (txtECSCODE.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请选择不良原因!");
return;
}
if (txtECSGCODE.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请选择不良原因组!");
return;
}
if (txtDUTYCODE.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请选择责任别!");
return;
}
if (txtSOLCODE.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请选择解决方案!");
return;
}
if (txtELOC.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("请输入不良位置!");
return;
}
FormICSTSERRORCAUSEUIModel errorcause = new FormICSTSERRORCAUSEUIModel();
errorcause.ECODE = snode;
errorcause.ECSCODE = ecscode;
errorcause.ECGCODE = fnode;
errorcause.ECSGCODE = ecsgcode;
errorcause.TSID = tsid;
errorcause.RCARD = txtRCARD.Text;
errorcause.RCARDSEQ = TS.RCARDSEQ;
errorcause.MODELCODE = TS.MODELCODE;
errorcause.ITEMCODE = TS.ITEMCODE;
errorcause.MOCODE = TS.MOCODE;
errorcause.SHIFTDAY = TS.SHIFTDAY;
errorcause.MOSEQ = Convert.ToInt32(TS.MOSEQ);
errorcause.RRESCODE = "";
errorcause.ROPCODE = "";
errorcause.SOLCODE = solcode;
errorcause.DUTYCODE = dutycode;
errorcause.SOLMEMO = "";
errorcause.PREVENTION = txtPREVENTION.Text;
errorcause.MUSER = AppConfig.UserCode;
errorcause.MUSERName = AppConfig.UserName;
errorcause.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
errorcause.WorkPoint = AppConfig.WorkPointCode;
errorcause.EATTRIBUTE1 = "";
FormICSTSERRORCODE2LOCUIModel erCode2loc = new FormICSTSERRORCODE2LOCUIModel();
erCode2loc.ECODE = snode;
erCode2loc.ECGCODE =fnode;
erCode2loc.ELOC = txtELOC.Text;
erCode2loc.AB = "";
erCode2loc.TSID = tsid;
erCode2loc.SUBELOC = "";
erCode2loc.RCARD = txtRCARD.Text;
erCode2loc.RCARDSEQ = TS.RCARDSEQ;
erCode2loc.MODELCODE = TS.MODELCODE;
erCode2loc.ITEMCODE = TS.ITEMCODE;
erCode2loc.MOCODE = TS.MOCODE;
erCode2loc.SHIFTDAY = TS.SHIFTDAY;
erCode2loc.MOSEQ = Convert.ToInt32(TS.MOSEQ);
erCode2loc.MEMO = "";
erCode2loc.MUSER = AppConfig.UserCode;
erCode2loc.MUSERName = AppConfig.UserName;
erCode2loc.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
erCode2loc.WorkPoint = AppConfig.WorkPointCode;
erCode2loc.EATTRIBUTE1 = "";
FormICSTSERRORCAUSE2LOCUIModel erCause2loc = new FormICSTSERRORCAUSE2LOCUIModel();
erCause2loc.ECSCODE = ecscode;
erCause2loc.ECGCODE = fnode;
erCause2loc.ECODE = snode;
erCause2loc.ELOC = txtELOC.Text;
erCause2loc.AB = "";
erCause2loc.TSID = tsid;
erCause2loc.SUBELOC = "";
erCause2loc.RCARD = txtRCARD.Text;
erCause2loc.RCARDSEQ = TS.RCARDSEQ;
erCause2loc.MODELCODE = TS.MODELCODE;
erCause2loc.ITEMCODE = TS.ITEMCODE;
erCause2loc.MOCODE = TS.MOCODE;
erCause2loc.RRESCODE = "";
erCause2loc.ROPCODE = "";
erCause2loc.ECSGCODE = ecsgcode;
erCause2loc.MOSEQ = TS.MOSEQ;
erCause2loc.EPART = txtEPART.Text;
erCause2loc.MUSER = AppConfig.UserCode;
erCause2loc.MUSERName = AppConfig.UserName;
erCause2loc.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
erCause2loc.WorkPoint = AppConfig.WorkPointCode;
erCause2loc.EATTRIBUTE1 = "";
FormICSTSERRORCAUSE2EPARTUIModel erCause2epart = new FormICSTSERRORCAUSE2EPARTUIModel();
erCause2epart.TSID = tsid;
erCause2epart.ECODE = snode;
erCause2epart.ECSCODE = ecscode;
erCause2epart.ECGCODE = fnode;
erCause2epart.EPART = txtEPART.Text;
erCause2epart.RCARD = txtRCARD.Text;
erCause2epart.RCARDSEQ = TS.RCARDSEQ;
erCause2epart.MODELCODE = TS.MODELCODE;
erCause2epart.ITEMCODE = TS.ITEMCODE;
erCause2epart.MOCODE = TS.MOCODE;
erCause2epart.ECSGCODE = ecsgcode;
erCause2epart.MOSEQ = TS.MOSEQ;
erCause2epart.RRESCODE = "";
erCause2epart.ROPCODE = "";
erCause2epart.MUSER = AppConfig.UserCode;
erCause2epart.MUSERName = AppConfig.UserName;
erCause2epart.MTIME = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
erCause2epart.WorkPoint = AppConfig.WorkPointCode;
erCause2epart.EATTRIBUTE1 = "";
ICSTSBLL.Add(errorcause, erCode2loc, erCause2loc, erCause2epart, AppConfig.AppConnectString);
ICSBaseSimpleCode.AppshowMessageBox("保存成功");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
#endregion
#region 不良原因按钮
private void txtECSCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select distinct a.RCARD as [产品序列号],b.ECSCODE as [不良原因代码],c.ECSDESC as [不良原因描述]
from ICSTSERRORCODE a
left join ICSMODEL2ECS b on a.MODELCODE=b.MODELCODE
left join ICSECS c on b.ECSCODE=c.ECSCODE
where a.RCARD='" + txtRCARD.Text + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "不良原因";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("产品序列号");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
//reForm.FilterKey = btn.Text;
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
txtECSCODE.Text = dr["不良原因描述"].ToString();
ecscode = dr["不良原因代码"].ToString();
}
}
}
#endregion
#region 不良原因组按钮
private void txtECSGCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select a.ECSGCODE as [不良原因组代码],b.ECSGDESC as [不良原因组描述]
from ICSECSG2ECS a
left join ICSECSG b on a.ECSGCODE=b.ECSGCODE
where a.ECSCODE='" + ecscode + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "不良原因组";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("ID");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
//reForm.FilterKey = btn.Text;
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
txtECSGCODE.Text = dr["不良原因组描述"].ToString();
ecsgcode = dr["不良原因组代码"].ToString();
}
}
}
#endregion
#region 责任别按钮
private void txtDUTYCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select DUTYCODE as [责任别代码],DUTYDESC as [责任别描述]
from ICSDUTY
where WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "责任别";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("ID");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
//reForm.FilterKey = btn.Text;
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
txtDUTYCODE.Text = dr["责任别描述"].ToString();
dutycode = dr["责任别代码"].ToString();
}
}
}
#endregion
#region 解决方案按钮
private void txtSOLCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select distinct a.MODELCODE as [产品别代码], b.SOLCODE as [解决方案代码],c.SOLDESC as [解决方案描述]
from ICSTSERRORCODE a
left join ICSMODEL2SOLUTION b on a.MODELCODE=b.MODELCODE
left join ICSSOLUTION c on b.SOLCODE=c.SOLCODE
where a.RCARD='" + txtRCARD.Text + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "责任别";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("产品别代码");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
//reForm.FilterKey = btn.Text;
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
txtSOLCODE.Text = dr["解决方案描述"].ToString();
solcode = dr["解决方案代码"].ToString();
}
}
}
#endregion
#region 增加不良代码
private void btnAddEcode_Click(object sender, EventArgs e)
{
if (txtRCARD.Text.Trim() == "" || (ICSTSBLL.IsIncludingInICSTS(txtRCARD.Text.Trim())))
{
ICSBaseSimpleCode.AppshowMessageBox("请先输入正确的产品序列号!");
return;
}
groupBox1.Visible = false;
treeView1.Nodes.Clear();
SimpleButton btntemp = (SimpleButton)sender;
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
{
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
return;
}
FormICSTSECodeAdd add = new FormICSTSECodeAdd(txtRCARD.Text.Trim());
add.ShowDialog();
}
#endregion
//private void txtECODE_SelectedValueChanged(object sender, EventArgs e)
//{
//}
}
}