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 ICSSoft.Frame.User.BLL;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using ICSSoft.Base.UserControl.MessageControl;
|
|
using System.Data.SqlClient;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
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.Frame.Data.DAL;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Frame.APP.Entity;
|
|
|
|
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSNCTPAdd : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
FormICSEQPSTPUIModel EQPSTPUIModel;
|
|
int flag;
|
|
string nctpid;
|
|
public FormICSNCTPAdd()
|
|
{
|
|
InitializeComponent();
|
|
init();
|
|
chargeFormState("Add");
|
|
flag = 0;
|
|
nctpid = AppConfig.GetGuid();
|
|
}
|
|
public FormICSNCTPAdd(string id)
|
|
{
|
|
InitializeComponent();
|
|
init();
|
|
chargeFormState("Edit");
|
|
SearchTypeInfo(id);
|
|
flag = 1;
|
|
nctpid = 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 = ICSNCTPBLL.searchInfoByID(id, AppConfig.AppConnectString);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
nctpid = dt.Rows[0]["guid"].ToString();
|
|
txtProductDate.Text = dt.Rows[0]["ProductDate"].ToString();
|
|
txtProductMO.Text = dt.Rows[0]["ProductMO"].ToString();
|
|
gluItemCode.Text = dt.Rows[0]["ITEMCODE"].ToString();
|
|
txtItemName.Text = dt.Rows[0]["ItemName"].ToString();
|
|
txtProjectCode.Text = dt.Rows[0]["ProjectCode"].ToString();
|
|
|
|
txtOPCODE.Text = dt.Rows[0]["OPCode"].ToString();
|
|
txtOPDESC.Text = dt.Rows[0]["OPDESC"].ToString();
|
|
txtProductNum.Text = dt.Rows[0]["ProductNum"].ToString();
|
|
txtEQPCODE.Text = dt.Rows[0]["EQPCODE"].ToString();
|
|
|
|
//txtNCTPType.Text = dt.Rows[0]["NCTPType"].ToString();
|
|
txtEQPDESC.Text = dt.Rows[0]["EQPName"].ToString();
|
|
txtProductUser.Text = dt.Rows[0]["ProductUser"].ToString();
|
|
txtUnitTP.Text = dt.Rows[0]["UnitTP"].ToString();
|
|
|
|
txtMUSERName.Text = AppConfig.UserName;
|
|
txtMTIME.Text = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").ToString();
|
|
//txtEQPTypeCode.Text = dt.Rows[0]["EQPTypeCode"].ToString();
|
|
txtDESC.Text = dt.Rows[0]["EATTRIBUTE1"].ToString();
|
|
//txtEQPTypeName.Text = dt.Rows[0]["EQPTypeName"].ToString();
|
|
|
|
|
|
}
|
|
|
|
}
|
|
private string check()
|
|
{
|
|
string msg = "";
|
|
Decimal decValue = 0m;
|
|
if (txtProductDate.Text.Trim() == "")
|
|
{
|
|
msg += "生产日期不能为空!\n";
|
|
}
|
|
else
|
|
{
|
|
string sql = @" SELECT b.*
|
|
FROM [Sys_EnumKey] a left join [Sys_EnumValues] b on a.[EnumKey] = b.[EnumKey]
|
|
where a.[EnumKey] = '036'";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text,sql).Tables[0];
|
|
bool userflag = false;
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
if (dr["EnumValue"].ToString() == AppConfig.UserCode)
|
|
{
|
|
userflag = true;
|
|
}
|
|
}
|
|
if (!userflag)
|
|
{
|
|
DateTime dateNow = AppConfig.GetSeverDateTime("yyyy-MM-dd");
|
|
TimeSpan ts = new TimeSpan();
|
|
ts = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss").Subtract(DateTime.Parse(txtProductDate.Text.Trim()));
|
|
if (ts.TotalHours >= 48 || ts.TotalHours < 0)
|
|
{
|
|
msg += "日期只能只能输入当天和前一天!\n";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
if (txtOPCODE.Text.Trim() == "")
|
|
msg += "工序代码不能为空!\n";
|
|
if (txtProductNum.Text.Trim() == "")
|
|
msg += "加工数量不能为空!\n";
|
|
if (txtEQPCODE.Text.Trim() == "")
|
|
msg += "设备编号不能为空!\n";
|
|
if (txtUnitTP.Text.Trim() == "")
|
|
msg += "单位工时不能为空!\n";
|
|
if (txtProductUser.Text.Trim() == "")
|
|
msg += "加工人员不能为空!\n";
|
|
|
|
else
|
|
{
|
|
if (!Decimal.TryParse(txtUnitTP.Text.Trim(), out decValue))
|
|
{
|
|
msg += "标准工时格式不正确!\n";
|
|
}
|
|
}
|
|
|
|
|
|
return msg;
|
|
}
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string msg = check();
|
|
if (!string.IsNullOrEmpty(msg))
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(msg);
|
|
return;
|
|
}
|
|
//if (CheckMOWip(this.txtProductMO.Text.Trim(),this.txtOPCODE.Text.Trim()))
|
|
//{
|
|
// ICSBaseSimpleCode.AppshowMessageBox("工单:"+ this.txtProductMO.Text.Trim() + ",工序:" + this.txtOPCODE.Text.Trim() +" 已有扫码加工记录!" );
|
|
// return;
|
|
//}
|
|
|
|
|
|
ICSNCTP nctp = new ICSNCTP();
|
|
nctp.guid = nctpid;
|
|
//nctp.NCTPType = txtNCTPType.Text;
|
|
nctp.ProductDate = DateTime.Parse(txtProductDate.Text);
|
|
nctp.ProductMO = txtProductMO.Text;
|
|
nctp.ItemCode = gluItemCode.Text;
|
|
nctp.ItemName = txtItemName.Text;
|
|
nctp.ProjectCode = txtProjectCode.Text;
|
|
nctp.OPCode = txtOPCODE.Text;
|
|
|
|
nctp.ProductNum = decimal.Parse(txtProductNum.Text);
|
|
nctp.EQPCode = txtEQPCODE.Text;
|
|
nctp.EQPName = txtEQPDESC.Text;
|
|
nctp.UnitTP = Convert.ToDecimal(txtUnitTP.Text.Equals("") ? "0" : txtUnitTP.Text);
|
|
nctp.TotalTP = nctp.UnitTP * nctp.ProductNum;
|
|
nctp.ProductUser = txtProductUser.Text;
|
|
nctp.Status = "新增";
|
|
|
|
nctp.MUSER = AppConfig.UserCode;
|
|
nctp.MUSERName = AppConfig.UserName;
|
|
nctp.MTIME = DateTime.Now;
|
|
nctp.WorkPoint = AppConfig.WorkPointCode;
|
|
nctp.EATTRIBUTE1 = this.txtDESC.Text.Trim();
|
|
//eqpstp.EQPTypeCode = txtEQPTypeCode.Text;
|
|
ICSNCTPBLL.Add(nctp, AppConfig.AppConnectString);
|
|
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";
|
|
//where a.ITEMCODE='" + txtItemCode.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 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";
|
|
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 a.MOCODE AS [生产订单号],a.ITEMCODE as [存货编码],b.INVNAME AS [存货名称],
|
|
a.MOUSER as[项目号] FROM ICSMO a left join ICSINVENTORY b on a.ITEMCODE=b.INVCODE where 1=1 ORDER BY a.ITEMCODE";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
txtProductMO.Properties.ValueMember = "生产订单号";
|
|
txtProductMO.Properties.DisplayMember = "生产订单号";
|
|
txtProductMO.Properties.DataSource = dt;
|
|
txtProductMO.Properties.NullText = "";//空时的值
|
|
txtProductMO.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtProductMO.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtProductMO.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtProductMO.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtProductMO.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
|
|
#region 人员代码
|
|
string sql3 = "select distinct UserCode as [人员代码],UserName as [人员名称] from dbo.Sys_User with(nolock) WHERE 1=1";
|
|
DataTable dt3 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql3).Tables[0];
|
|
txtProductUser.Properties.ValueMember = "人员代码";
|
|
txtProductUser.Properties.DisplayMember = "人员代码";
|
|
txtProductUser.Properties.DataSource = dt3;
|
|
txtProductUser.Properties.NullText = "";//空时的值
|
|
txtProductUser.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtProductUser.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtProductUser.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtProductUser.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtProductUser.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
|
|
#region 设备编号
|
|
string sql1 = "select distinct EQPCode as [设备编号],EQPName as [设备名称] from dbo.ICSEquipment with(nolock) WHERE 1=1";
|
|
DataTable dt1 = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql1).Tables[0];
|
|
txtEQPCODE.Properties.ValueMember = "设备编号";
|
|
txtEQPCODE.Properties.DisplayMember = "设备编号";
|
|
txtEQPCODE.Properties.DataSource = dt1;
|
|
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
|
|
|
|
#region 工序代码
|
|
string sql2 = @"select distinct c.OPCODE as [工序代码],d.OPDESC as [工序] from ICSMO a inner join dbo.ICSMO2ROUTE b on a.ID=b.MOID
|
|
inner join dbo.ICSITEMROUTE2OP c on b.ROUTEID=c.ROUTEID AND a.ITEMCODE=c.ITEMCODE inner join dbo.ICSOP d on d.ID=c.OPID ";
|
|
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 申请单类型
|
|
DataTable dttype = new DataTable();
|
|
dttype.Columns.Add("单据类型");
|
|
|
|
DataRow dr = dttype.NewRow();
|
|
dr["单据类型"] = "普通";
|
|
dttype.Rows.Add(dr);
|
|
dr = dttype.NewRow();
|
|
dr["单据类型"] = "研发支援";
|
|
dttype.Rows.Add(dr);
|
|
|
|
txtNCTPType.Properties.ValueMember = "单据类型";
|
|
txtNCTPType.Properties.DisplayMember = "单据类型";
|
|
txtNCTPType.Properties.DataSource = dttype;
|
|
txtNCTPType.Properties.NullText = "";//空时的值
|
|
txtNCTPType.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtNCTPType.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtNCTPType.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtNCTPType.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtNCTPType.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
|
|
}
|
|
#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;
|
|
txtOPDESC.Text = RowView.Row["工序"].ToString();
|
|
}
|
|
}
|
|
|
|
private void label7_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
#region 生产订单号改变时
|
|
private void txtProductMO_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
var o = txtProductMO.Properties.GetRowByKeyValue(txtProductMO.EditValue);
|
|
if (o is DataRowView)
|
|
{
|
|
DataRowView RowView = o as DataRowView;
|
|
gluItemCode.Text = RowView.Row["存货编码"].ToString();
|
|
txtItemName.Text = RowView.Row["存货名称"].ToString();
|
|
txtProjectCode.Text = RowView.Row["项目号"].ToString();
|
|
}
|
|
//init2();
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
private bool CheckMOWip(string MoCode,string OpCode)
|
|
{
|
|
string sql = @"select Count(*) as num From [dbo].[ICSLOTONWIP] wip where wip.MoCode = '" + MoCode + "' And wip.OpCode = '" + OpCode + "'";
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
if ( int.Parse( dt.Rows[0]["num"].ToString()) > 0)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private void panelControl1_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|