|
|
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; using ICSSoft.Frame.Data.Entity; using System.Linq;
namespace ICSSoft.Frame.APP { public partial class FormICSEQPSTPAdd : DevExpress.XtraEditors.XtraForm { FormICSEQPSTPUIModelNew EQPSTPUIModel; int flag = 0; string eqpstpid; bool first = true;
public FormICSEQPSTPAdd() { InitializeComponent(); init(); chargeFormState("Add"); flag = 0; eqpstpid = AppConfig.GetGuid(); cboEQPSetting.SelectedIndex = 0; tabControl1.ItemSize = new Size(0, 1); } public FormICSEQPSTPAdd(string id) { InitializeComponent(); init(); chargeFormState("Edit"); SearchTypeInfo(id); flag = 1; eqpstpid = id; tabControl1.ItemSize = new Size(0, 1); }
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;
txtROUTECODE.Properties.Buttons[0].Visible = false; txtROUTECODE.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();
//cboRouteCode.Text = dt.Rows[0]["EATTRIBUTE1"].ToString();
txtItemCode.Text = dt.Rows[0]["ITEMCODE"].ToString(); txtItemName.Text = dt.Rows[0]["ItemName"].ToString();
txtROUTECODE.Text = dt.Rows[0]["ROUTECODE"].ToString(); txtRouteName.Text = dt.Rows[0]["ROUTECODE"].ToString(); txtROUTEMEMO.Text = dt.Rows[0]["ROUTEMEMO"].ToString();
txtOPCODE.Text = dt.Rows[0]["OPCODE"].ToString(); txtOPDESC.Text = dt.Rows[0]["OPDESC"].ToString();
//txtEQPTypeCode.Text = dt.Rows[0]["EQPTypeCode"].ToString();
//txtEQPTypeName.Text = dt.Rows[0]["EQPTypeName"].ToString();
//JiaGongTime,JianYanTime,TiaoJiTime,JiaZhuangTime
//txtSTIME.Text = dt.Rows[0]["STIME"].ToString();
//txtRTIME.Text = dt.Rows[0]["RTIME"].ToString();
txtJiagongTime.Text = dt.Rows[0]["JiaGongTime"].ToString(); txtJiazhuangTime.Text = dt.Rows[0]["JiaZhuangTime"].ToString(); txtJianyanTime.Text = dt.Rows[0]["JianYanTime"].ToString(); txtTiaojiTime.Text = dt.Rows[0]["TiaoJiTime"].ToString();
lookupOPLVL.Text = dt.Rows[0]["OPLVL"].ToString();
cboIsRef.Checked = dt.Rows[0]["ISREF"].ToString() == "是" ? true : false; ; txtMUSERName.Text = AppConfig.UserName; txtMTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString();
lookupOPLVL.Text = dt.Rows[0]["OPLVL"].ToString(); if (dt.Rows[0]["EQPTypeCode"].ToString() == "固定设备") { cboEQPSetting.SelectedIndex = 0; lookupClass.Text = dt.Rows[0]["cClass"].ToString(); lookupHandles.Text = dt.Rows[0]["cHandles"].ToString(); lookupAxis.Text = dt.Rows[0]["cAxis"].ToString(); lookupToolMagazine.Text = dt.Rows[0]["cToolMagazine"].ToString(); lookupMachinableProfiles.Text = dt.Rows[0]["cMachinableProfiles"].ToString(); lookupAccuracy.Text = dt.Rows[0]["cAccuracy"].ToString(); } else if (dt.Rows[0]["EQPTypeCode"].ToString() == "加工中心" || dt.Rows[0]["EQPTypeCode"].ToString() == "设备类型") { cboEQPSetting.SelectedIndex = 1; txtEQPCODE.Text = dt.Rows[0]["EQPCODE"].ToString(); } else if (dt.Rows[0]["EQPTypeCode"].ToString() == "车削中心") { cboEQPSetting.SelectedIndex =2; txtcxjd.EditValue = dt.Rows[0]["CXJD"].ToString(); txtcxtype.EditValue = dt.Rows[0]["CXType"].ToString(); if(!string.IsNullOrEmpty(dt.Rows[0]["CXBrand1"].ToString())) txtpp1.EditValue = dt.Rows[0]["CXBrand1"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["CXBrand2"].ToString())) txtpp2.EditValue = dt.Rows[0]["CXBrand2"].ToString(); if (!string.IsNullOrEmpty(dt.Rows[0]["CXBrand3"].ToString())) txtpp3.EditValue = dt.Rows[0]["CXBrand3"].ToString(); }
//txtETTRCODE.Text = dt.Rows[0]["ETTRCOde"].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 (txtROUTECODE.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 (txtJianyanTime.Text == "0")
//{
// msg += "请填写工时,且不可为 0 !\n";
//}
//if (flag == 0)
//{
// //if (!ICSEQPSTPBLL.IsIncluding(txtItemCode.Text.Trim(), txtOPCODE.Text.Trim(), txtEQPCODE.Text.Trim(), AppConfig.AppConnectString))
// if (!ICSEQPSTPBLL.IsIncluding(txtItemCode.Text.Trim(), txtOPCODE.Text.Trim(), txtEQPTypeCode.Text.Trim(), AppConfig.AppConnectString))
// msg += "该产品工序设备类型内对应的标准工时信息已存在!\n";
//}
//if (!cboIsRef.Checked)
//{
// msg += "请选择是否为默认标准工时!\n";
//}
return msg; }
private void btnOK_Click(object sender, EventArgs e) { string EQPTypeCode = ""; string eqpCode = ""; string eqpName = ""; string cClass = ""; string cHandles = ""; string cAxis = ""; string cToolMagazine = ""; string cMachinableProfiles = ""; string cAccuracy = ""; decimal? WTIME = 0; string OPLVL = ""; string cxpp1 = ""; string cxpp2 = ""; string cxpp3 = ""; string cxtype = ""; string cxjd = ""; try { string msg = check(); if (!string.IsNullOrEmpty(msg)) { ICSBaseSimpleCode.AppshowMessageBox(msg); return; } if (!chkIsWW.Checked) { if (cboEQPSetting.SelectedIndex == 0) { EQPTypeCode = "加工中心"; cClass = lookupClass.Text; cHandles = lookupHandles.Text; cAxis = lookupAxis.Text; cToolMagazine = lookupToolMagazine.Text; cMachinableProfiles = lookupMachinableProfiles.Text; cAccuracy = lookupAccuracy.Text; if (cClass == "") { ICSBaseSimpleCode.AppshowMessageBox("类别不能为空!"); return; } if (cHandles == "") { ICSBaseSimpleCode.AppshowMessageBox("刀柄不能为空!"); return; } if (cAxis == "") { ICSBaseSimpleCode.AppshowMessageBox("轴数不能为空!"); return; } if (cToolMagazine == "") { ICSBaseSimpleCode.AppshowMessageBox("刀库不能为空!"); return; } if (cMachinableProfiles == "") { ICSBaseSimpleCode.AppshowMessageBox("可加工外形不能为空!"); return; } if (cAccuracy == "") { ICSBaseSimpleCode.AppshowMessageBox("精度不能为空!"); return; } } else if (cboEQPSetting.SelectedIndex == 1) { EQPTypeCode = "固定设备"; eqpCode = txtEQPCODE.Text; eqpName = txtEQPNAME.Text; if (eqpCode == "" || eqpName == "") { ICSBaseSimpleCode.AppshowMessageBox("请选择设备"); return; } } else if(cboEQPSetting.SelectedIndex ==2) { EQPTypeCode = "车削中心"; if (string.IsNullOrEmpty(txtcxtype.Text)) { ICSBaseSimpleCode.AppshowMessageBox("车削类型不能为空"); return; } if (string.IsNullOrEmpty(txtcxjd.Text)) { ICSBaseSimpleCode.AppshowMessageBox("车削精度不能为空"); return; } List<string> pp = new List<string>(); if (!string.IsNullOrEmpty(txtpp1.Text)) { pp.Add(txtpp1.Text); cxpp1 = txtpp1.Text;
} else { cxpp1 = "00"; } if (!string.IsNullOrEmpty(txtpp2.Text)) { pp.Add(txtpp2.Text); cxpp2 = txtpp2.Text; } else cxpp2 = "00"; if (!string.IsNullOrEmpty(txtpp3.Text)) { pp.Add(txtpp3.Text); cxpp3 = txtpp3.Text; } else cxpp3 = "00"; IEnumerable<IGrouping<string,string>> count=pp.GroupBy(a => a); foreach (var B in count) { if (B.Count() > 1) { ICSBaseSimpleCode.AppshowMessageBox("存在重复车床品牌,请确认!"); return; } } cxjd = txtcxjd.Text; cxtype = txtcxtype.Text;
} OPLVL = lookupOPLVL.Text; if (OPLVL == "") { ICSBaseSimpleCode.AppshowMessageBox("工序等级不能为空!"); return; } WTIME = 3; } else { EQPTypeCode = "委外"; string WWTIME = txtWWTIME.Text; if (WWTIME == "" || WWTIME == "0") { throw new Exception("委外工序时,委外工时必须填写"); } WTIME = Convert.ToDecimal(WWTIME); if (WTIME <= 0) { throw new Exception("委外工时必须大于 0"); } OPLVL = null; } ICSEQPSTP eqpstp = new ICSEQPSTP(); eqpstp.ID = eqpstpid; eqpstp.ITEMCODE = txtItemCode.Text; eqpstp.OPCODE = txtOPCODE.Text; eqpstp.EQPCODE = eqpCode; eqpstp.ETTRCODE = txtETTRCODE.Text; eqpstp.ISREF = cboIsRef.Checked ? "是" : "否";
eqpstp.JiaGongTime = eqpstp.STIME = Convert.ToDecimal(txtJiagongTime.Text.Equals("") ? "0" : txtJiagongTime.Text); eqpstp.TiaoJiTime = eqpstp.RTIME = Convert.ToDecimal(txtTiaojiTime.Text.Equals("") ? "0" : txtTiaojiTime.Text); eqpstp.JiaZhuangTime = Convert.ToDecimal(txtJiazhuangTime.Text.Equals("") ? "0" : txtJiazhuangTime.Text); eqpstp.JianYanTime = Convert.ToDecimal(txtJianyanTime.Text.Equals("") ? "0" : txtJianyanTime.Text);
eqpstp.MUSER = AppConfig.UserCode; eqpstp.MUSERName = AppConfig.UserName; eqpstp.MTIME = DateTime.Now; eqpstp.WorkPoint = AppConfig.WorkPointCode; eqpstp.EQPTypeCode = EQPTypeCode;//此处不在存设备类型,设备类型是6大维度决定
eqpstp.cClass = cClass; eqpstp.cHandles = cHandles; eqpstp.cAxis = cAxis; eqpstp.cToolMagazine = cToolMagazine; eqpstp.cMachinableProfiles = cMachinableProfiles; eqpstp.cAccuracy = cAccuracy; eqpstp.OPLVL = OPLVL; eqpstp.WTIME = WTIME; eqpstp.EATTRIBUTE1 = txtROUTECODE.Text; eqpstp.ToolingNo = txtROUTEMEMO.Text; eqpstp.CXBrand1 = cxpp1; eqpstp.CXBrand2 = cxpp2; eqpstp.CXBrand3 = cxpp3; eqpstp.CXJD = cxjd; eqpstp.CXType = cxtype;
////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;
first = false; if (flag == 0) { ICSBaseSimpleCode.AppshowMessageBox("增加成功"); txtItemCode.Properties.Buttons[0].Visible = false; txtItemCode.Enabled = false; txtROUTECODE.Properties.Buttons[0].Visible = false; txtROUTECODE.Enabled = false; eqpstpid = AppConfig.GetGuid(); txtROUTEMEMO.Text = ""; txtOPCODE.Text = ""; txtOPDESC.Text = ""; //cboEQPSetting.SelectedIndex = 0;
lookupClass.Text = lookupAxis.Text = lookupAccuracy.Text = lookupHandles.Text = lookupToolMagazine.Text = ""; txtJiagongTime.Text = txtJiazhuangTime.Text = "0"; if (cboEQPSetting.SelectedIndex == 1) { cboTiaojiPRT.SelectedIndex = cboTiaojiBaseTime.SelectedIndex = cboJianyanPRT.SelectedIndex = -1; txtJiagongTime.Text = txtJiazhuangTime.Text = txtJianyanTime.Text = txtTiaojiTime.Text = "0"; lookupMachinableProfiles.Text = ""; } lookupOPLVL.Text = ""; chkIsWW.Checked = false; cboIsRef.Checked = true;
} 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 = txtItemCode.Properties.GetRowByKeyValue(txtItemCode.EditValue); if (o is DataRowView) { DataRowView RowView = o as DataRowView; txtItemName.Text = RowView.Row["存货名称"].ToString();
#region 工艺
string sql = @"
SELECT DISTINCT A.ROUTECODE 工艺代码, B.ROUTEDESC 工艺名称, C.ISREF 默认 FROM dbo.ICSITEMROUTE2OP A LEFT JOIN dbo.ICSITEM2ROUTE C ON C.ITEMCODE=A.ITEMCODE AND C.ROUTECODE=A.ROUTECODE AND C.WorkPoint=A.WorkPoint LEFT JOIN dbo.ICSROUTE B ON B.ROUTECODE=A.ROUTECODE AND B.WorkPoint=A.WorkPoint WHERE A.ITEMCODE='{0}' AND A.WorkPoint='{1}' AND C.ISREF IS NOT NULL ";
sql = string.Format(sql, txtItemCode.Text, AppConfig.WorkPointCode); DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0]; DataRow[] drs = data.Select("默认=1 "); txtROUTECODE.Properties.ValueMember = "工艺代码"; txtROUTECODE.Properties.DisplayMember = "工艺代码"; txtROUTECODE.Properties.DataSource = data; txtROUTECODE.Properties.NullText = "";//空时的值
txtROUTECODE.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
txtROUTECODE.Properties.ValidateOnEnterKey = true;//回车确认
txtROUTECODE.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
txtROUTECODE.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
//自适应宽度
//txtROUTECODE.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
#endregion
if (drs.Length > 0) { txtROUTECODE.Text = drs[0]["工艺代码"].ToString(); } } }
#region 初始化查询条件
private void init() { #region 存货编码
//string sql = "SELECT DISTINCT INVCODE AS [存货编码],INVNAME AS [存货名称] FROM ICSINVENTORY WHERE WorkPoint='{0}' ORDER BY INVCODE";
string sql = @"
SELECT DISTINCT A.ITEMCODE AS 存货编码,B.INVNAME AS 存货名称 FROM dbo.ICSITEMROUTE2OP A LEFT JOIN ICSINVENTORY B ON A.ITEMCODE=B.INVCODE AND A.WorkPoint=B.WorkPoint WHERE A.WorkPoint='{0}' ORDER BY A.ITEMCODE ASC";
sql = string.Format(sql, AppConfig.WorkPointCode); DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0]; txtItemCode.Properties.ValueMember = "存货编码"; txtItemCode.Properties.DisplayMember = "存货编码"; txtItemCode.Properties.DataSource = dt; txtItemCode.Properties.NullText = "";//空时的值
txtItemCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
txtItemCode.Properties.ValidateOnEnterKey = true;//回车确认
txtItemCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
txtItemCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
//自适应宽度
txtItemCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup; #endregion
#region 调机基础值
DataTable dt1 = ICSOPBLL.SearchDataByEnumKey(AppConfig.AppConnectString, "20001"); if (dt1 == null || dt1.Rows.Count == 0) { throw new Exception("自定义档案20001调机工时基础值,未维护"); } foreach (DataRow item in dt1.Rows) { string val = item["EnumText"].ToString(); decimal d; try { d = Convert.ToDecimal(val); } catch (Exception) { throw new Exception("自定义档案20001调机工时计算比率,维护了错误的值'" + val + "'"); } if (d < 0) { throw new Exception("自定义档案20001调机工时基础值,维护了错误的值'" + val + "'"); } cboTiaojiBaseTime.Properties.Items.Add(d); } #endregion
#region 调机计算比例
DataTable dt2 = ICSOPBLL.SearchDataByEnumKey(AppConfig.AppConnectString, "20002"); if (dt2 == null || dt2.Rows.Count == 0) { throw new Exception("自定义档案20002调机工时计算比率,未维护"); } foreach (DataRow item in dt2.Rows) { string val = item["EnumText"].ToString(); decimal d; try { d = Convert.ToDecimal(val); } catch (Exception) { throw new Exception("自定义档案20002调机工时计算比率,维护了错误的值'" + val + "'"); } if (d < 0) { throw new Exception("自定义档案20002调机工时计算比率,维护了错误的值'" + val + "'"); } cboTiaojiPRT.Properties.Items.Add(d); } #endregion
#region 检验计算比例
DataTable dt3 = ICSOPBLL.SearchDataByEnumKey(AppConfig.AppConnectString, "20003"); if (dt3 == null || dt3.Rows.Count == 0) { throw new Exception("自定义档案20003检验工时计算比率,未维护"); } foreach (DataRow item in dt3.Rows) { string val = item["EnumText"].ToString(); decimal d; try { d = Convert.ToDecimal(val); } catch (Exception) { throw new Exception("自定义档案20003调机工时计算比率,维护了错误的值'" + val + "'"); } if (d < 0) { throw new Exception("自定义档案20003检验工时计算比率,维护了错误的值'" + val + "'"); } cboJianyanPRT.Properties.Items.Add(d); } #endregion
#region 设备类型代码
////string sql1 = "select distinct EnumValue as [类型编码],EnumText as [设备类型] from dbo.Sys_EnumValues with(nolock) WHERE EnumKey='001' and 1=1";
//string sql4 = "SELECT TypeCODE as [设备类型编码],TypeDESC as [设备类型] FROM ICSEquipmentType WHERE WorkPoint = '" + AppConfig.WorkPointCode + "' and 1=1 ";
//DataTable dt4 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql4).Tables[0];
////txtEQPTypeCode.Properties.ValueMember = "类型编码";
////txtEQPTypeCode.Properties.DisplayMember = "类型编码";
//txtEQPTypeCode.Properties.ValueMember = "设备类型编码";
//txtEQPTypeCode.Properties.DisplayMember = "设备类型编码";
//txtEQPTypeCode.Properties.DataSource = dt4;
//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
#region 六大维度
string sql3 = @"SELECT LTRIM(RTRIM(EnumText)) as 类型 FROM Sys_EnumValues WHERE EnumKey='30001' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue"; DataTable dt30001 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0]; lookupClass.Properties.ValueMember = "类型"; lookupClass.Properties.DisplayMember = "类型"; lookupClass.Properties.DataSource = dt30001; lookupClass.Properties.NullText = ""; lookupClass.Properties.ImmediatePopup = true; lookupClass.Properties.ValidateOnEnterKey = true;
sql3 = @"SELECT LTRIM(RTRIM(EnumText)) as 刀柄 FROM Sys_EnumValues WHERE EnumKey='30002' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue"; DataTable dt30002 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0]; lookupHandles.Properties.ValueMember = "刀柄"; lookupHandles.Properties.DisplayMember = "刀柄"; lookupHandles.Properties.DataSource = dt30002; lookupHandles.Properties.NullText = ""; lookupHandles.Properties.ImmediatePopup = true; lookupHandles.Properties.ValidateOnEnterKey = true;
sql3 = @"SELECT LTRIM(RTRIM(EnumText)) as 轴数 FROM Sys_EnumValues WHERE EnumKey='30003' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue"; DataTable dt30003 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0]; lookupAxis.Properties.ValueMember = "轴数"; lookupAxis.Properties.DisplayMember = "轴数"; lookupAxis.Properties.DataSource = dt30003; lookupAxis.Properties.NullText = ""; lookupAxis.Properties.ImmediatePopup = true; lookupAxis.Properties.ValidateOnEnterKey = true;
//sql3 = @"SELECT LTRIM(RTRIM(EnumText)) as 刀库数量 FROM Sys_EnumValues WHERE EnumKey='30004' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue";
//DataTable dt30004 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0];
//lookupToolMagazine.Properties.ValueMember = "刀库数量";
//lookupToolMagazine.Properties.DisplayMember = "刀库数量";
//lookupToolMagazine.Properties.DataSource = dt30004;
//lookupToolMagazine.Properties.NullText = "";
//lookupToolMagazine.Properties.ImmediatePopup = true;
//lookupToolMagazine.Properties.ValidateOnEnterKey = true;
//sql3 = @"SELECT LTRIM(RTRIM(EnumText)) as 可加工外形 FROM Sys_EnumValues WHERE EnumKey='30005' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue";
//DataTable dt30005 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0];
//lookupMachinableProfiles.Properties.ValueMember = "可加工外形";
//lookupMachinableProfiles.Properties.DisplayMember = "可加工外形";
//lookupMachinableProfiles.Properties.DataSource = dt30005;
//lookupMachinableProfiles.Properties.NullText = "";
//lookupMachinableProfiles.Properties.ImmediatePopup = true;
//lookupMachinableProfiles.Properties.ValidateOnEnterKey = true;
sql3 = @"SELECT LTRIM(RTRIM(EnumText)) as 精度 FROM Sys_EnumValues WHERE EnumKey='30006' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue"; DataTable dt30006 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0]; lookupAccuracy.Properties.ValueMember = "精度"; lookupAccuracy.Properties.DisplayMember = "精度"; lookupAccuracy.Properties.DataSource = dt30006; lookupAccuracy.Properties.NullText = ""; lookupAccuracy.Properties.ImmediatePopup = true; lookupAccuracy.Properties.ValidateOnEnterKey = true; #endregion
#region 工序等级(原产品等级)
string sql00019 = @"SELECT LTRIM(RTRIM(EnumValue)) as 类型,EnumText 说明 FROM Sys_EnumValues WHERE EnumKey='00019' AND LTRIM(RTRIM(EnumText))<>'' AND WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue"; DataTable dt00019 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql00019).Tables[0]; lookupOPLVL.Properties.ValueMember = "类型"; lookupOPLVL.Properties.DisplayMember = "类型"; lookupOPLVL.Properties.DataSource = dt00019; lookupOPLVL.Properties.NullText = ""; lookupOPLVL.Properties.ImmediatePopup = true; lookupOPLVL.Properties.ValidateOnEnterKey = true; #endregion
#region 设备
string sqlEqp = @"SELECT EQPCODE AS 设备代码,EQPNAME AS 设备名称 FROM [dbo].[ICSEquipment] WHERE WorkPoint='" + AppConfig.WorkPointCode + "' ORDER BY EQPCode"; DataTable dtEqp = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sqlEqp).Tables[0]; txtEQPCODE.Properties.ValueMember = "设备代码"; txtEQPCODE.Properties.DisplayMember = "设备代码"; txtEQPCODE.Properties.DataSource = dtEqp; txtEQPCODE.Properties.NullText = ""; txtEQPCODE.Properties.ImmediatePopup = true; txtEQPCODE.Properties.ValidateOnEnterKey = true; txtItemCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard; //txtItemCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True;
#endregion
#region 品牌
sql = @"select EnumValue as 品牌代码,EnumText as 品牌名称 from Sys_EnumValues where EnumKey='30007' and WorkPointCode='" + AppConfig.WorkPointCode + "' "; dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0]; txtpp1.Properties.ValueMember = "品牌代码"; txtpp1.Properties.DisplayMember = "品牌代码"; txtpp1.Properties.DataSource = dt; txtpp1.Properties.NullText = "";//空时的值
txtpp1.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
txtpp1.Properties.ValidateOnEnterKey = true;//回车确认
txtpp1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
txtpp1.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容 //自适应宽度
txtpp1.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
txtpp2.Properties.ValueMember = "品牌代码"; txtpp2.Properties.DisplayMember = "品牌代码"; txtpp2.Properties.DataSource = dt; txtpp2.Properties.NullText = "";//空时的值
txtpp2.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
txtpp2.Properties.ValidateOnEnterKey = true;//回车确认
txtpp2.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
txtpp2.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容 //自适应宽度
txtpp2.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
txtpp3.Properties.ValueMember = "品牌代码"; txtpp3.Properties.DisplayMember = "品牌代码"; txtpp3.Properties.DataSource = dt; txtpp3.Properties.NullText = "";//空时的值
txtpp3.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
txtpp3.Properties.ValidateOnEnterKey = true;//回车确认
txtpp3.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
txtpp3.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容 //自适应宽度
txtpp3.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
#endregion
#region 车削类型
sql = @"select EnumText as 车削类型 from Sys_EnumValues where enumkey='300010' and WorkPointcode='" + AppConfig.WorkPointCode + "' "; dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0]; txtcxtype.Properties.ValueMember = "车削类型"; txtcxtype.Properties.DisplayMember = "车削类型"; txtcxtype.Properties.DataSource = dt; txtcxtype.Properties.NullText = ""; txtcxtype.Properties.ImmediatePopup = true; txtcxtype.Properties.ValidateOnEnterKey = true; #endregion
#region 车削精度
sql = @"select EnumText as 车削精度 from Sys_EnumValues where enumkey='300011' and WorkPointcode='" + AppConfig.WorkPointCode + "' order by EnumText"; dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0]; txtcxjd.Properties.ValueMember = "车削精度"; txtcxjd.Properties.DisplayMember = "车削精度"; txtcxjd.Properties.DataSource = dt; txtcxjd.Properties.NullText = ""; txtcxjd.Properties.ImmediatePopup = true; txtcxjd.Properties.ValidateOnEnterKey = true; #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 WorkPointCode='" + AppConfig.WorkPointCode + "' ORDER BY EnumValue"; //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 + "' AND WorkPoint='" + AppConfig.WorkPointCode + "'";
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; txtEQPNAME.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();
// string calcType = RowView.Row["工序属性"].ToString();
// calcType = string.IsNullOrEmpty(calcType) ? "A" : calcType;
// DataTable dt = ICSOPBLL.SearchDataByEnumValue(AppConfig.AppConnectString, "00023", calcType);
// if (dt != null && dt.Rows.Count > 0)
// {
// txtCalc.Text = dt.Rows[0]["EnumText"].ToString();
// decimal D;
// if (Decimal.TryParse(txtCalc.Text, out D))
// {
// throw new Exception("工序:" + txtOPCODE.Text + "对应的工序属性'" + calcType + "'维护了错误的值'" + txtCalc.Text + "'");
// }
// }
// else
// {
// throw new Exception("工序:" + txtOPCODE.Text + "对应的工序属性'" + calcType + "'未维护");
// }
// }
//}
private void cboTiaojiBaseTime_SelectedIndexChanged(object sender, EventArgs e) { ComboBoxEdit cbo = sender as ComboBoxEdit; if (cbo.SelectedIndex == -1) { return; } try { decimal baseTime = Convert.ToDecimal(cbo.SelectedItem.ToString()); decimal rate = 0; decimal stime = Convert.ToDecimal(txtJiagongTime.Text); if (cboTiaojiPRT.SelectedIndex == -1) { rate = 0; } else { rate = Convert.ToDecimal(cboTiaojiPRT.SelectedItem.ToString()); } decimal res = baseTime + stime * rate; txtTiaojiTime.Text = res.ToString();
} catch (Exception ex) { ICSBaseSimpleCode.AppshowMessageBox(ex.Message); } }
private void cboTiaojiPRT_SelectedIndexChanged(object sender, EventArgs e) { ComboBoxEdit cbo = sender as ComboBoxEdit; if (cbo.SelectedIndex == -1) { return; } try { decimal baseTime = 0; if (cboTiaojiBaseTime.SelectedIndex == -1) { baseTime = 0; } else { baseTime = Convert.ToDecimal(cboTiaojiBaseTime.SelectedItem.ToString()); } decimal rate = rate = Convert.ToDecimal(cbo.SelectedItem.ToString()); decimal stime = Convert.ToDecimal(txtJiagongTime.Text);
decimal res = baseTime + stime * rate; txtTiaojiTime.Text = res.ToString(); } catch (Exception ex) { ICSBaseSimpleCode.AppshowMessageBox(ex.Message); } }
private void cboJianyanPRT_SelectedIndexChanged(object sender, EventArgs e) { ComboBoxEdit cbo = sender as ComboBoxEdit; if (cbo.SelectedIndex == -1) { return; } try { decimal rate = Convert.ToDecimal(cbo.SelectedItem.ToString()); decimal stime = Convert.ToDecimal(txtJiagongTime.Text); decimal res = stime * rate; txtJianyanTime.Text = res.ToString(); } catch (Exception ex) { ICSBaseSimpleCode.AppshowMessageBox(ex.Message); } }
private void txtTIME_EditValueChanged(object sender, EventArgs e) { TextEdit te = sender as TextEdit; try { decimal d = Convert.ToDecimal(te.Text); if (d < 0) { throw new Exception("值不可小于 0"); } cboTiaojiBaseTime_SelectedIndexChanged(cboTiaojiBaseTime, null); cboTiaojiPRT_SelectedIndexChanged(cboTiaojiPRT, null); cboJianyanPRT_SelectedIndexChanged(cboJianyanPRT, null); } catch (Exception ex) { te.Text = "0"; ICSBaseSimpleCode.AppshowMessageBox(ex.Message); } }
private void txtOPCODE_EditValueChanged(object sender, EventArgs e) { var o = txtOPCODE.Properties.GetRowByKeyValue(txtOPCODE.EditValue); if (o is DataRowView) { DataRowView RowView = o as DataRowView; txtOPDESC.Text = RowView.Row["工序"].ToString(); chkIsWW.Checked = RowView.Row["工序属性"].ToString() == "委外"; } }
private void lookupOPLVL_EditValueChanged(object sender, EventArgs e) { var o = lookupOPLVL.Properties.GetRowByKeyValue(lookupOPLVL.EditValue); if (o is DataRowView) { DataRowView RowView = o as DataRowView; txtOPLVLDesc.Text = RowView.Row["说明"].ToString(); } }
private void cboEQPSetting_SelectedIndexChanged(object sender, EventArgs e) { tabControl1.SelectedIndex = cboEQPSetting.SelectedIndex; if (first) { return; } txtROUTEMEMO.Text = ""; txtOPCODE.Text = ""; txtOPDESC.Text = ""; lookupClass.Text = lookupAxis.Text = lookupAccuracy.Text = lookupHandles.Text = lookupToolMagazine.Text = ""; txtJiagongTime.Text = txtJiazhuangTime.Text = "0"; if (cboEQPSetting.SelectedIndex == 1) { cboTiaojiPRT.SelectedIndex = cboTiaojiBaseTime.SelectedIndex = cboJianyanPRT.SelectedIndex = -1; txtJiagongTime.Text = txtJiazhuangTime.Text = txtJianyanTime.Text = txtTiaojiTime.Text = "0"; lookupMachinableProfiles.Text = ""; } lookupOPLVL.Text = ""; chkIsWW.Checked = false; cboIsRef.Checked = true;
}
private void txtEQPCODE_EditValueChanged_1(object sender, EventArgs e) { if (txtEQPCODE.EditValue == null) { return; } var o = txtEQPCODE.Properties.GetRowByKeyValue(txtEQPCODE.EditValue); if (o is DataRowView) { DataRowView RowView = o as DataRowView; txtEQPNAME.Text = RowView.Row["设备名称"].ToString(); } }
private void txtROUTECODE_EditValueChanged(object sender, EventArgs e) { var o = txtROUTECODE.Properties.GetRowByKeyValue(txtROUTECODE.EditValue); if (o is DataRowView) { DataRowView RowView = o as DataRowView; txtRouteName.Text = RowView.Row["工艺名称"].ToString();
#region 工序代码
string sql = @"
SELECT DISTINCT [工序代码],[工序],次序,[工序属性] FROM ( select distinct a.OPCODE as [工序代码], b.OPDESC as [工序] , a.OPSEQ AS 次序, A.OPAttr AS [工序属性]--CASE WHEN b.EATTRIBUTE1='1' THEN '委外' ELSE '自制' END [工序属性] from dbo.ICSITEMROUTE2OPLot a left join ICSOP b on a.OPCODE=b.OPCODE AND a.WorkPoint=b.WorkPoint WHERE a.ITEMCODE='{0}' and a.ROUTECODE='{1}' AND a.WorkPoint='{2}' UNION ALL select distinct a.OPCODE as [工序代码], b.OPDESC as [工序] , a.OPSEQ AS 次序, A.OPAttr AS [工序属性]--CASE WHEN b.EATTRIBUTE1='1' THEN '委外' ELSE '自制' END [工序属性] from ICSITEMROUTE2OP a left join ICSOP b on a.OPCODE=b.OPCODE AND a.WorkPoint=b.WorkPoint WHERE a.ITEMCODE='{0}' and a.ROUTECODE='{1}' AND a.WorkPoint='{2}' )T ORDER BY T.次序 ASC ";
sql = string.Format(sql, txtItemCode.Text, txtROUTECODE.Text, AppConfig.WorkPointCode); DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).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='" + txtItemCode.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
} }
private void chkIsWW_CheckedChanged(object sender, EventArgs e) { txtWWTIME.Visible = LBL_WWU.Visible = LBL_WWTIME.Visible = chkIsWW.Checked; }
private void txtpp1_Properties_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Index == 1) { txtpp1.Text = ""; } }
private void txtpp2_Properties_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Index == 1) { txtpp2.Text = ""; } }
private void txtpp3_Properties_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { if (e.Button.Index == 1) { txtpp3.Text = ""; } }
private void txtcxjd_EditValueChanged(object sender, EventArgs e) {
}
//private void txtSTIME_EditValueChanged(object sender, EventArgs e)
//{
// decimal calcJY = 0;
// string x = txtCalc.Text.TrimEnd('%');
// try
// {
// calcJY = Decimal.Parse(x);
// }
// catch (Exception)
// {
// throw new Exception("工序:" + txtOPCODE.Text + "对应的工序属性维护了错误的值'" + txtCalc.Text + "'");
// }
// txtJianyanTime.Text = (Convert.ToDecimal(txtSTIME.Text) * calcJY * 0.01m).ToString();
//}
} }
|