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.
205 lines
7.8 KiB
205 lines
7.8 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.Base.Config.AppConfig;
|
|
using System.Data.Linq;
|
|
using System.Linq;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using System.Reflection;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.ReferForm;
|
|
using ICSSoft.Base.Report;
|
|
using ICSSoft.Base.ReferForm.AppReferForm;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSOPAdd : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
int flag;
|
|
|
|
public FormICSOPAdd()
|
|
{
|
|
InitializeComponent();
|
|
chargeFormState("Add");
|
|
flag = 0;
|
|
Init();
|
|
}
|
|
|
|
public FormICSOPAdd(string opcode)
|
|
{
|
|
InitializeComponent();
|
|
chargeFormState("Edit");
|
|
Init();
|
|
SearchOPInfo(opcode);
|
|
flag = 1;
|
|
}
|
|
private void chargeFormState(string state)
|
|
{
|
|
switch (state)
|
|
{
|
|
case "Add":
|
|
txtOPCODE.Properties.ReadOnly = false;
|
|
break;
|
|
case "Edit":
|
|
txtOPCODE.Properties.ReadOnly = true;
|
|
break;
|
|
}
|
|
}
|
|
public void SearchOPInfo(string opcode)
|
|
{
|
|
|
|
FormICSOPUIModel tbInfo = ICSOPBLL.SearchOPInfo(opcode, AppConfig.AppConnectString);
|
|
txtOPCODE.Text = tbInfo.OPCODE;
|
|
txtOPDESC.Text = tbInfo.OPDESC;
|
|
txtOPCOLLECTION.Text = tbInfo.OPCOLLECTION;
|
|
cbBCostCenter.Text = tbInfo.CostCenter;
|
|
string OPControl = tbInfo.OPCONTROL;
|
|
char[] c = OPControl.ToCharArray();
|
|
try
|
|
{
|
|
#region
|
|
//for (int i = 0; i < c.Length; i++)
|
|
//{
|
|
// if (c[i].Equals('1'))
|
|
// checkedListBoxOPControl.SetItemChecked(i, true);
|
|
// else
|
|
// checkedListBoxOPControl.SetItemChecked(i, false);
|
|
//}
|
|
#endregion
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
if (c[i].Equals('1'))
|
|
checkedListBoxOPControl.SetItemChecked(i, true);
|
|
else
|
|
checkedListBoxOPControl.SetItemChecked(i, false);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
|
|
private void can_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
|
|
private void save_Click(object sender, EventArgs e)
|
|
{
|
|
char[] c = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0' };
|
|
try
|
|
{
|
|
if (txtOPCODE.Text.Trim() == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("工序代码不能为空");
|
|
return;
|
|
}
|
|
if (txtOPCOLLECTION.Text.Trim() == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("数据收集方式不能为空");
|
|
return;
|
|
}
|
|
if (flag == 0)
|
|
{
|
|
bool b = ICSOPBLL.IsIncluding(txtOPCODE.Text.Trim(), AppConfig.AppConnectString);
|
|
if (!b)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("工序代码已经存在");
|
|
return;
|
|
}
|
|
}
|
|
FormICSOPUIModel tbInfo = new FormICSOPUIModel();
|
|
tbInfo.OPCODE = txtOPCODE.Text;
|
|
tbInfo.OPDESC = txtOPDESC.Text;
|
|
tbInfo.OPCOLLECTION = txtOPCOLLECTION.Text;
|
|
for (int i = 0; i < checkedListBoxOPControl.Items.Count; i++)
|
|
{
|
|
if (checkedListBoxOPControl.GetItemChecked(i))
|
|
c[i] = '1';
|
|
else
|
|
c[i] = '0';
|
|
}
|
|
string OPControl = new string(c);
|
|
tbInfo.OPCONTROL = OPControl;
|
|
tbInfo.CostCenter = cbBCostCenter.Text;
|
|
tbInfo.OpFrom = txtfrom.Text;
|
|
ICSOPBLL.Add(tbInfo, AppConfig.AppConnectString);
|
|
if (flag == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("新增成功!");
|
|
}
|
|
else if (flag == 1)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("修改成功!");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
this.Close();
|
|
this.DialogResult = DialogResult.Yes;
|
|
}
|
|
|
|
public void Init()
|
|
{
|
|
#region
|
|
//checkedListBoxOPControl.Items.Add("OP_componentloading", "1.上料工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_testing", "2.测试工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_packing", "3.包装工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_ts", "4.维修工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_idtranslate", "3.序号转换工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_oqc", "5.OQC工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_spc", "7.SPC工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_deduct", "8.扣料工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_midistoutput", "9.中间产量工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_midistinput", "10.中间投入工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_ComponentDown", "11.下料工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_BurnIn", "12.Burn In工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_BurnOut", "13.Burn Out工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_Offline", "14.下线工序");
|
|
#endregion
|
|
checkedListBoxOPControl.Items.Add("OP_componentloading", "1.上料工序");
|
|
checkedListBoxOPControl.Items.Add("OP_testing", "2.测试工序");
|
|
checkedListBoxOPControl.Items.Add("OP_packing", "3.包装工序");
|
|
checkedListBoxOPControl.Items.Add("OP_ts", "4.维修工序");
|
|
#region
|
|
//checkedListBoxOPControl.Items.Add("OP_idtranslate", "5.序号转换工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_oqc", "6.OQC工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_spc", "7.SPC工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_deduct", "8.扣料工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_midistoutput", "9.中间产量工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_midistinput", "10.中间投入工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_ComponentDown", "11.下料工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_BurnIn", "12.Burn In工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_BurnOut", "13.Burn Out工序");
|
|
//checkedListBoxOPControl.Items.Add("OP_Offline", "14.下线工序");
|
|
#endregion
|
|
|
|
DataTable dt = ICSOPBLL.SearchData(AppConfig.AppConnectString);
|
|
if (dt.Rows.Count > 0 && dt != null)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
cbBCostCenter.Items.Add(dr["EnumText"].ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|