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.
568 lines
25 KiB
568 lines
25 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraEditors;
|
|
using System.Data.SqlClient;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using ICSSoft.Base.UserControl.MessageControl;
|
|
using ICSSoft.Base.Report.Filter;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.UserControl.FormControl;
|
|
using ICSSoft.Base.ReferForm.AppReferForm;
|
|
using ICSSoft.Base.Lable.PrintTool;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.Report.GridReport;
|
|
using ICSSoft.Frame.APP.Entity;
|
|
using ICSSoft.Frame.APP;
|
|
|
|
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSEQPSTPAdd : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
FormICSEQPSTPUIModelNew EQPSTPUIModel;
|
|
int flag;
|
|
string eqpstpid;
|
|
public FormICSEQPSTPAdd()
|
|
{
|
|
InitializeComponent();
|
|
init();
|
|
chargeFormState("Add");
|
|
flag = 0;
|
|
eqpstpid = AppConfig.GetGuid();
|
|
}
|
|
public FormICSEQPSTPAdd(string id)
|
|
{
|
|
InitializeComponent();
|
|
init();
|
|
chargeFormState("Edit");
|
|
SearchTypeInfo(id);
|
|
flag = 1;
|
|
eqpstpid = id;
|
|
}
|
|
|
|
|
|
private void chargeFormState(string state)
|
|
{
|
|
switch (state)
|
|
{
|
|
case "Add":
|
|
txtMUSERName.Text = AppConfig.UserName;
|
|
txtMTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
|
|
txtMUSERName.Properties.ReadOnly = true;
|
|
txtMTIME.Properties.ReadOnly = true;
|
|
|
|
break;
|
|
case "Edit":
|
|
//txtItemCode.Properties.Buttons[0].Visible = false;
|
|
//txtItemCode.Enabled = false;
|
|
gluItemCode.Properties.Buttons[0].Visible = false;
|
|
gluItemCode.Enabled = false;
|
|
|
|
txtOPCODE.Properties.Buttons[0].Visible = false;
|
|
txtOPCODE.Enabled = false;
|
|
|
|
txtEQPCODE.Properties.Buttons[0].Visible = false;
|
|
txtEQPCODE.Enabled = false;
|
|
|
|
txtEQPTypeCode.Properties.Buttons[0].Visible = false;
|
|
txtEQPTypeCode.Enabled = false;
|
|
|
|
txtMUSERName.Properties.ReadOnly = true;
|
|
txtMTIME.Properties.ReadOnly = true;
|
|
break;
|
|
}
|
|
}
|
|
private void SearchTypeInfo(string id)
|
|
{
|
|
DataTable dt = ICSEQPSTPBLL.searchInfoByID(id, AppConfig.AppConnectString);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
eqpstpid = dt.Rows[0]["ID"].ToString();
|
|
//txtItemCode.Text = dt.Rows[0]["ITEMCODE"].ToString();
|
|
gluItemCode.Text = dt.Rows[0]["ITEMCODE"].ToString();
|
|
txtOPCODE.Text = dt.Rows[0]["OPCODE"].ToString();
|
|
txtEQPCODE.Text = dt.Rows[0]["EQPCODE"].ToString();
|
|
txtItemName.Text = dt.Rows[0]["ItemName"].ToString();
|
|
txtOPDESC.Text = dt.Rows[0]["OPDESC"].ToString();
|
|
//txtEQPDESC.Text = dt.Rows[0]["EQPName"].ToString();
|
|
txtETTRCODE.Text = dt.Rows[0]["ETTRCOde"].ToString();
|
|
if (!string.IsNullOrEmpty(dt.Rows[0]["STIME"].ToString()))
|
|
{
|
|
txtSTIME.Text = dt.Rows[0]["STIME"].ToString();
|
|
}
|
|
else
|
|
{
|
|
txtSTIME.Text = "0";
|
|
}
|
|
if (!string.IsNullOrEmpty(dt.Rows[0]["RTIME"].ToString()))
|
|
{
|
|
txtRTIME.Text = dt.Rows[0]["RTIME"].ToString();
|
|
}
|
|
else
|
|
{
|
|
txtRTIME.Text = "0";
|
|
}
|
|
|
|
txtisRef.Text = dt.Rows[0]["ISREF"].ToString();
|
|
txtMUSERName.Text = AppConfig.UserName;
|
|
txtMTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
|
|
txtEQPTypeCode.Text = dt.Rows[0]["EQPTypeCode"].ToString();
|
|
txtEQPTypeName.Text = dt.Rows[0]["EQPTypeName"].ToString();
|
|
|
|
txtBladeModelAndBrand.Text = dt.Rows[0]["BladeModelAndBrand"].ToString();
|
|
txtOutsourcingProperties.Text = dt.Rows[0]["OutsourcingProperties"].ToString();
|
|
txtToolingNo.Text = dt.Rows[0]["ToolingNo"].ToString();
|
|
|
|
}
|
|
|
|
}
|
|
private string check()
|
|
{
|
|
string msg = "";
|
|
Decimal decValue = 0m;
|
|
|
|
//if (txtItemCode.Text.Trim() == "")
|
|
// msg += "存货编码不能为空!\n";
|
|
if (gluItemCode.Text.Trim() == "")
|
|
msg += "存货编码不能为空!\n";
|
|
if (txtOPCODE.Text.Trim() == "")
|
|
msg += "工序代码不能为空!\n";
|
|
if (txtEQPTypeCode.Text.Trim() == "")
|
|
msg += "工作中心不能为空!\n";
|
|
|
|
if (txtSTIME.Text.Trim() == "")
|
|
msg += "标准工时不能为空!\n";
|
|
else
|
|
{
|
|
if (!Decimal.TryParse(txtSTIME.Text.Trim(), out decValue))
|
|
{
|
|
msg += "标准工时格式不正确!\n";
|
|
}
|
|
}
|
|
if (txtRTIME.Text.Trim() == "")
|
|
msg += "准备工时不能为空!\n";
|
|
else
|
|
{
|
|
if (!Decimal.TryParse(txtRTIME.Text.Trim(), out decValue))
|
|
{
|
|
msg += "准备工时格式不正确!\n";
|
|
}
|
|
}
|
|
if (flag == 0)
|
|
{
|
|
//if (!ICSEQPSTPBLL.IsIncluding(txtItemCode.Text.Trim(), txtOPCODE.Text.Trim(), txtEQPCODE.Text.Trim(), AppConfig.AppConnectString))
|
|
if (!ICSEQPSTPBLL.IsIncluding(gluItemCode.Text.Trim(), txtOPCODE.Text.Trim(), txtEQPTypeCode.Text.Trim(), AppConfig.AppConnectString))
|
|
msg += "该产品工序工作中心内对应的标准工时信息已存在!\n";
|
|
}
|
|
if (txtisRef.Text=="")
|
|
{
|
|
msg += "请选择是否为默认标准工时!\n";
|
|
}
|
|
return msg;
|
|
}
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string msg = check();
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(msg);
|
|
return;
|
|
}
|
|
FormICSEQPSTPUIModelNew eqpstp = new FormICSEQPSTPUIModelNew();
|
|
eqpstp.ID = eqpstpid;
|
|
//eqpstp.ITEMCODE = txtItemCode.Text;
|
|
eqpstp.ITEMCODE = gluItemCode.Text;
|
|
eqpstp.OPCODE = txtOPCODE.Text;
|
|
eqpstp.EQPCODE = txtEQPCODE.Text;
|
|
eqpstp.ETTRCODE = txtETTRCODE.Text;
|
|
|
|
eqpstp.ISREF = txtisRef.Text;
|
|
eqpstp.STIME =Convert.ToDecimal(txtSTIME.Text.Equals("")? "0":txtSTIME.Text);
|
|
eqpstp.MUSER = AppConfig.UserId;
|
|
eqpstp.MUSERName = AppConfig.UserName;
|
|
eqpstp.MTIME = DateTime.Now;
|
|
eqpstp.RTIME = Convert.ToDecimal(txtRTIME.Text.Equals("") ? "0" : txtRTIME.Text);
|
|
eqpstp.WorkPoint = AppConfig.WorkPointCode;
|
|
eqpstp.EATTRIBUTE1 = "" ;
|
|
eqpstp.EQPTypeCode = txtEQPTypeCode.Text;
|
|
//20180626新增
|
|
eqpstp.BladeModelAndBrand = this.txtBladeModelAndBrand.Text.Trim();
|
|
eqpstp.OutsourcingProperties = this.txtOutsourcingProperties.Text.Trim();
|
|
eqpstp.ToolingNo = this.txtToolingNo.Text.Trim();
|
|
|
|
ICSEQPSTPBLL.Add(eqpstp, AppConfig.AppConnectString);
|
|
//this.Close();
|
|
//this.DialogResult = DialogResult.Yes;
|
|
if (flag == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("增加成功");
|
|
this.Close();
|
|
this.DialogResult = DialogResult.Yes;
|
|
}
|
|
else if (flag == 1)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("修改成功");
|
|
this.Close();
|
|
this.DialogResult = DialogResult.Yes;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex) {
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
#region 关闭
|
|
private void btnCancle_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
//this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
//this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
#endregion
|
|
|
|
#region 存货编码按钮
|
|
private void txtItemCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = "select distinct guid as [产品ID],ItemCode as [存货编码],ItemName as [存货名称] from dbo.Base_Inventory with(nolock) WHERE 1=1";
|
|
//object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetHuaRongErpConnectString", new object[] { });
|
|
//if (obj == null)
|
|
//{
|
|
// ICSBaseSimpleCode.AppshowMessageBox(1, "ERP数据库连接取得失败!");
|
|
|
|
//}
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), 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 = 500;
|
|
reForm.FormHeight = 500;
|
|
//reForm.FilterKey = btn.Text;
|
|
//grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtItemCode.Text = dr["存货编码"].ToString();
|
|
//itemid = dr["产品ID"].ToString();
|
|
txtItemName.Text = dr["存货名称"].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 工序代码按钮
|
|
private void txtOPCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = "";
|
|
sql = @"select distinct a.OPID as [工序ID],
|
|
a.OPCODE as [工序代码],
|
|
b.OPDESC as [工序]
|
|
from ICSITEMROUTE2OP a
|
|
left join ICSOP b on a.OPCODE=b.OPCODE
|
|
where a.ITEMCODE='" + gluItemCode.Text + "' and 1=1";
|
|
//where a.ITEMCODE='" + txtItemCode.Text + "' and 1=1";
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
// if (data == null || data.Rows.Count == 0)
|
|
// {
|
|
// sql = @"select distinct a.OPID as [工序ID],
|
|
// a.OPCODE as [工序代码],
|
|
// c.OPDESC as [工序]
|
|
// from ICSMODELROUTE2OP a
|
|
// left join Base_Inventory b on a.MODELCODE=b.ItemMainCategoryCode
|
|
// left join ICSOP c on a.OPCODE=c.OPCODE
|
|
//where b.ITEMCODE='" + gluItemCode.Text + "' and 1=1";
|
|
////where b.ITEMCODE='" + txtItemCode.Text + "' and 1=1";
|
|
// //object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetHuaRongErpConnectString", new object[] { });
|
|
// //if (obj == null)
|
|
// //{
|
|
// // ICSBaseSimpleCode.AppshowMessageBox(1, "ERP数据库连接取得失败!");
|
|
|
|
// //}
|
|
// data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), 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 = 500;
|
|
reForm.FormHeight = 500;
|
|
//reForm.FilterKey = btn.Text;
|
|
//grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtOPCODE.Text = dr["工序代码"].ToString();
|
|
//opid = dr["工序ID"].ToString();
|
|
txtOPDESC.Text = dr["工序"].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设备编号按钮
|
|
private void txtEQPCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = @"select distinct EQPID as [设备ID], EQPCode as [设备编号],EQPName as [设备名称] from dbo.ICSEquipment
|
|
where EType='"+txtEQPTypeName.Text+"'";
|
|
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), 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 = 500;
|
|
reForm.FormHeight = 500;
|
|
//reForm.FilterKey = btn.Text;
|
|
//grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtEQPCODE.Text = dr["设备编号"].ToString();
|
|
//opid = dr["设备ID"].ToString();
|
|
txtEQPDESC.Text = dr["设备名称"].ToString();
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void gluItemCode_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
var o = gluItemCode.Properties.GetRowByKeyValue(gluItemCode.EditValue);
|
|
if (o is DataRowView)
|
|
{
|
|
DataRowView RowView = o as DataRowView;
|
|
txtItemName.Text = RowView.Row["存货名称"].ToString();
|
|
}
|
|
init3();
|
|
|
|
}
|
|
private void init3()
|
|
{
|
|
|
|
#region 工序代码
|
|
string sql2 = @"select distinct
|
|
a.OPCODE as [工序代码],
|
|
b.OPDESC as [工序]
|
|
from ICSITEMROUTE2OP a
|
|
left join ICSOP b on a.OPCODE=b.OPCODE
|
|
where a.ITEMCODE='" + gluItemCode.Text + "' and 1=1";
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql2).Tables[0];
|
|
if (data == null || data.Rows.Count == 0)
|
|
{
|
|
sql2 = @"select distinct
|
|
a.OPCODE as [工序代码],
|
|
c.OPDESC as [工序]
|
|
from ICSITEMROUTE2OP a
|
|
left join ICSINVENTORY b on a.ITEMCODE=b.INVCODE
|
|
left join ICSOP c on a.OPCODE=c.OPCODE
|
|
where b.INVCODE='" + gluItemCode.Text + "' and 1=1";
|
|
data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql2).Tables[0];
|
|
}
|
|
txtOPCODE.Properties.ValueMember = "工序代码";
|
|
txtOPCODE.Properties.DisplayMember = "工序代码";
|
|
|
|
txtOPCODE.Properties.DataSource = data;
|
|
txtOPCODE.Properties.NullText = "";//空时的值
|
|
txtOPCODE.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtOPCODE.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtOPCODE.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtOPCODE.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtOPCODE.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
|
|
#endregion
|
|
}
|
|
#region 初始化查询条件
|
|
private void init()
|
|
{
|
|
#region 存货编码
|
|
string sql = "SELECT DISTINCT INVCODE AS [存货编码],INVNAME AS [存货名称] FROM ICSINVENTORY ORDER BY INVCODE";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
gluItemCode.Properties.ValueMember = "存货编码";
|
|
gluItemCode.Properties.DisplayMember = "存货编码";
|
|
gluItemCode.Properties.DataSource = dt;
|
|
gluItemCode.Properties.NullText = "";//空时的值
|
|
gluItemCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
gluItemCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
gluItemCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
gluItemCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
gluItemCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
|
|
|
|
#region 工序代码
|
|
string sql2 = "SELECT DISTINCT null AS [工序代码],null as [工序] ";
|
|
|
|
DataTable dt2 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql2).Tables[0];
|
|
txtOPCODE.Properties.ValueMember = "工序代码";
|
|
txtOPCODE.Properties.DisplayMember = "工序代码";
|
|
txtOPCODE.Properties.DataSource = dt2;
|
|
txtOPCODE.Properties.NullText = "";//空时的值
|
|
txtOPCODE.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtOPCODE.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtOPCODE.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtOPCODE.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtOPCODE.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
|
|
|
|
#region 设备类型代码
|
|
//string sql1 = "select distinct EnumValue as [类型编码],EnumText as [设备类型] from dbo.Sys_EnumValues with(nolock) WHERE EnumKey='001' and 1=1";
|
|
string sql1 = "SELECT TypeCODE as [工作中心编码],TypeDESC as [工作中心] FROM ICSEquipmentType WHERE WorkPoint = '6000' and 1=1 ";
|
|
|
|
DataTable dt1 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql1).Tables[0];
|
|
//txtEQPTypeCode.Properties.ValueMember = "类型编码";
|
|
//txtEQPTypeCode.Properties.DisplayMember = "类型编码";
|
|
|
|
txtEQPTypeCode.Properties.ValueMember = "工作中心编码";
|
|
txtEQPTypeCode.Properties.DisplayMember = "工作中心编码";
|
|
|
|
txtEQPTypeCode.Properties.DataSource = dt1;
|
|
txtEQPTypeCode.Properties.NullText = "";//空时的值
|
|
txtEQPTypeCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtEQPTypeCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtEQPTypeCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtEQPTypeCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtEQPTypeCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
//设备类型按钮
|
|
private void txtEQPType_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = "select distinct EnumValue as [类型编码],EnumText as [设备类型] from dbo.Sys_EnumValues with(nolock) WHERE EnumKey='001' and 1=1";
|
|
//object obj = AppConfig.InvokeWebservice(AppConfig.BaseServiceUri, "WebBaseService", "BaseService", "GetHuaRongErpConnectString", new object[] { });
|
|
//if (obj == null)
|
|
//{
|
|
// ICSBaseSimpleCode.AppshowMessageBox(1, "ERP数据库连接取得失败!");
|
|
|
|
//}
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), 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 = 500;
|
|
reForm.FormHeight = 500;
|
|
//reForm.FilterKey = btn.Text;
|
|
//grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtEQPTypeCode.Text = dr["类型编码"].ToString();
|
|
txtEQPTypeName.Text = dr["设备类型"].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void txtEQPTypeCode_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
var o = txtEQPTypeCode.Properties.GetRowByKeyValue(txtEQPTypeCode.EditValue);
|
|
if (o is DataRowView)
|
|
{
|
|
DataRowView RowView = o as DataRowView;
|
|
//txtEQPTypeName.Text = RowView.Row["设备类型"].ToString();
|
|
txtEQPTypeName.Text = RowView.Row["工作中心"].ToString();
|
|
txtEQPTypeCode.Text = RowView.Row["工作中心编码"].ToString();
|
|
|
|
}
|
|
init2();
|
|
}
|
|
|
|
private void init2()
|
|
{
|
|
|
|
#region 设备编号
|
|
string sql2 = @"select distinct EQPCode as [设备编号],EQPName as [设备名称] from dbo.ICSEquipment
|
|
where EType='"+txtEQPTypeName.Text+"'";
|
|
DataTable dt2 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql2).Tables[0];
|
|
txtEQPCODE.Properties.ValueMember = "设备编号";
|
|
txtEQPCODE.Properties.DisplayMember = "设备编号";
|
|
|
|
txtEQPCODE.Properties.DataSource = dt2;
|
|
txtEQPCODE.Properties.NullText = "";//空时的值
|
|
txtEQPCODE.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtEQPCODE.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtEQPCODE.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtEQPCODE.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtEQPCODE.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
|
|
#endregion
|
|
}
|
|
|
|
private void txtEQPCODE_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
var o = txtEQPCODE.Properties.GetRowByKeyValue(txtEQPCODE.EditValue);
|
|
if (o is DataRowView)
|
|
{
|
|
DataRowView RowView = o as DataRowView;
|
|
txtEQPDESC.Text = RowView.Row["设备名称"].ToString();
|
|
}
|
|
}
|
|
|
|
private void txtOPCODE_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
var o = txtOPCODE.Properties.GetRowByKeyValue(txtOPCODE.EditValue);
|
|
if (o is DataRowView)
|
|
{
|
|
DataRowView RowView = o as DataRowView;
|
|
txtOPCODE.Text = RowView.Row["工序代码"].ToString();
|
|
txtOPDESC.Text = RowView.Row["工序"].ToString();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|