This commit is contained in:
chi
2021-03-31 17:55:06 +09:00
parent d7a6cb25c5
commit 33ef66b173
11 changed files with 418 additions and 979 deletions

View File

@@ -17,48 +17,56 @@ namespace FEQ0000
public enum eTabletype
{
ALL,
MOLD,
FOL,
BUMP,
ING,
OTHER
//MOLD,
//FOL,
//BUMP,
//ING,
//OTHER
}
string tableName = string.Empty;
eTabletype dataType = eTabletype.FOL;
eTabletype dataType = eTabletype.ALL;
public fEquipment(eTabletype type_)
{
InitializeComponent();
dataType = type_;
if (dataType == eTabletype.MOLD)
{
tableName = "EquipmentME";
this.dsEQ.EquipmentME.TableNewRow += Equipment_TableNewRow;
dvc_param.Visible = false;
}
else if (dataType == eTabletype.FOL)
{
this.tbSearch.KeyDown += (s1, e1) => {
if(e1.KeyCode == Keys.Enter)
{
btRefresh.PerformClick();
}
};
//if (dataType == eTabletype.MOLD)
//{
tableName = "EquipmentF";
this.dsEQ.EquipmentF.TableNewRow += Equipment_TableNewRow;
dvc_param.Visible = false;
}
else if (dataType == eTabletype.ING)
{
// tableName = "EquipmentME";
// this.dsEQ.EquipmentME.TableNewRow += Equipment_TableNewRow;
// dvc_param.Visible = false;
//}
//else if (dataType == eTabletype.FOL)
//{
tableName = "EETGW_EquipmentIng";
this.dsEQ.EETGW_EquipmentIng.TableNewRow += Equipment_TableNewRow;
dvc_param.Visible = false;
}
else if (dataType == eTabletype.OTHER)
{
// tableName = "EquipmentF";
// this.dsEQ.EquipmentF.TableNewRow += Equipment_TableNewRow;
// dvc_param.Visible = false;
//}
//else if (dataType == eTabletype.ING)
//{
tableName = "EETGW_EquipmentOther";
this.dsEQ.EETGW_EquipmentOther.TableNewRow += Equipment_TableNewRow;
dvc_param.Visible = false;
}
else if (dataType == eTabletype.ALL)
// tableName = "EETGW_EquipmentIng";
// this.dsEQ.EETGW_EquipmentIng.TableNewRow += Equipment_TableNewRow;
// dvc_param.Visible = false;
//}
//else if (dataType == eTabletype.OTHER)
//{
// tableName = "EETGW_EquipmentOther";
// this.dsEQ.EETGW_EquipmentOther.TableNewRow += Equipment_TableNewRow;
// dvc_param.Visible = false;
//}
//else
if (dataType == eTabletype.ALL)
{
tableName = "EETGW_Equipment";
@@ -74,7 +82,7 @@ namespace FEQ0000
dvc_param.Visible = true;
}
this.FormClosed += fEquipment_FormClosed;
}
void fEquipment_FormClosed(object sender, FormClosedEventArgs e)
@@ -89,11 +97,7 @@ namespace FEQ0000
var taDateList = new dsEQTableAdapters.EqDateListTableAdapter();
DataTable dtList = null;
if (dataType == eTabletype.BUMP) dtList = taDateList.GetDateListB();
else if (dataType == eTabletype.FOL) dtList = taDateList.GetDateListF();
else if (dataType == eTabletype.ING) dtList = taDateList.GetDateListIng();
else if (dataType == eTabletype.OTHER) dtList = taDateList.GetDateListOther();
else if (dataType == eTabletype.ALL) dtList = taDateList.GetDateListAll();
if (dataType == eTabletype.ALL) dtList = taDateList.GetDateListAll();
else dtList = taDateList.GetDateListME();
this.cmbDate.Items.Clear();
@@ -118,33 +122,33 @@ namespace FEQ0000
RefreshDate();
//목록을 가져온다.
var grpList = DatabaseManager.getEQGroupLiist("grp", this.tableName);
var tlList = DatabaseManager.getEQGroupLiist("linet +'-' + linep ", this.tableName);
var lcList = DatabaseManager.getEQGroupLiist("linecode", this.tableName);
var manuList = DatabaseManager.getEQGroupLiist("manu", this.tableName);
var typeList = DatabaseManager.getEQGroupLiist("type", this.tableName);
var plantList = DatabaseManager.getEQGroupLiist("plant", this.tableName);
var grp2List = DatabaseManager.getEQGroupLiist("grp2", this.tableName);
//var grp2List = DatabaseManager.getEQGroupLiist("grp2", this.tableName);
cmbGrp.Items.Add("-- All --");
cbTeamPart.Items.Add("-- All --");
cmbLine.Items.Add("-- All --");
cmbManu.Items.Add("-- All --");
cmbType.Items.Add("-- All --");
cmbPlant.Items.Add("-- All --");
cmbCate.Items.Add("-- All --");
// cmbCate.Items.Add("-- All --");
foreach (var item in grpList) this.cmbGrp.Items.Add(item);
foreach (var item in tlList) this.cbTeamPart.Items.Add(item);
foreach (var item in lcList) this.cmbLine.Items.Add(item);
foreach (var item in manuList) this.cmbManu.Items.Add(item);
foreach (var item in typeList) this.cmbType.Items.Add(item);
foreach (var item in plantList) this.cmbPlant.Items.Add(item);
foreach (var item in grp2List) this.cmbCate.Items.Add(item);
// foreach (var item in grp2List) this.cmbCate.Items.Add(item);
if (this.cmbGrp.Items.Count > 0) cmbGrp.SelectedIndex = 0;
if (this.cbTeamPart.Items.Count > 0) cbTeamPart.SelectedIndex = 0;
if (this.cmbLine.Items.Count > 0) cmbLine.SelectedIndex = 0;
if (this.cmbManu.Items.Count > 0) cmbManu.SelectedIndex = 0;
if (this.cmbType.Items.Count > 0) cmbType.SelectedIndex = 0;
if (this.cmbPlant.Items.Count > 0) cmbPlant.SelectedIndex = 0;
if (this.cmbCate.Items.Count > 0) cmbCate.SelectedIndex = 0;
//if (this.cmbCate.Items.Count > 0) cmbCate.SelectedIndex = 0;
//if (this.dataType == eTabletype.ING)
// dvc_param.HeaderText = "RCS Flag";
@@ -164,31 +168,7 @@ namespace FEQ0000
try
{
if (dataType == eTabletype.BUMP)
{
this.taB.Update(this.dsEQ.EquipmentB);
}
else if (dataType == eTabletype.MOLD)
{
this.taME.Update(this.dsEQ.EquipmentME);
}
else if (dataType == eTabletype.ING)
{
this.taIng.Update(this.dsEQ.EETGW_EquipmentIng);
}
else if (dataType == eTabletype.OTHER)
{
this.taOther.Update(this.dsEQ.EETGW_EquipmentOther);
}
else if (dataType == eTabletype.ALL)
{
taAll.Update(this.dsEQ.EETGW_Equipment);
}
else
{
this.taF.Update(this.dsEQ.EquipmentF);
}
taAll.Update(this.dsEQ.EETGW_Equipment);
this.dsEQ.AcceptChanges();
}
catch (Exception ex)
@@ -212,12 +192,7 @@ namespace FEQ0000
try
{
DataRow[] dRows = null;
if (dataType == eTabletype.BUMP) dRows = this.dsEQ.EquipmentB.Select(filter);
else if (dataType == eTabletype.MOLD) dRows = this.dsEQ.EquipmentME.Select(filter);
else if (dataType == eTabletype.ING) dRows = this.dsEQ.EETGW_EquipmentIng.Select(filter);
else if (dataType == eTabletype.OTHER) dRows = this.dsEQ.EETGW_EquipmentOther.Select(filter);
else if (dataType == eTabletype.ALL) dRows = this.dsEQ.EETGW_Equipment.Select(filter);
else dRows = this.dsEQ.EquipmentF.Select(filter);
dRows = this.dsEQ.EETGW_Equipment.Select(filter);
int cnt = 0;
foreach (DataRow dr in dRows)
@@ -256,12 +231,7 @@ namespace FEQ0000
}
try
{
if (dataType == eTabletype.MOLD) this.bsME.Filter = filter;
else if (dataType == eTabletype.BUMP) this.bsB.Filter = filter;
else if (dataType == eTabletype.ING) this.bsIng.Filter = filter;
else if (dataType == eTabletype.OTHER) this.bsOther.Filter = filter;
else if (dataType == eTabletype.ALL) this.bsAll.Filter = filter;
else this.bsF.Filter = filter;
this.bsAll.Filter = filter;
if (key.isEmpty()) this.tbFilter.BackColor = Color.White;
else this.tbFilter.BackColor = Color.Lime;
@@ -284,22 +254,14 @@ namespace FEQ0000
private void toolStripButton4_Click(object sender, EventArgs e)
{
if(this.dataType == eTabletype.ALL)
if (this.dsEQ.EETGW_Equipment.Count < 1)
{
if(this.dsEQ.EETGW_Equipment.Count < 1)
{
FCOMMON.Util.MsgE("자료가 없습니다. 자료를 조회하고 시도하세요");
return;
}
var f = new rpt_equipmentAll(this.dsEQ.EETGW_Equipment,this.grp2name);
f.Show();
FCOMMON.Util.MsgE("자료가 없습니다. 자료를 조회하고 시도하세요");
return;
}
else
{
var f = new rpt_equipmentB(dataType, this.cmbDate.Text);
f.Show();
}
var f = new rpt_equipmentAll(this.dsEQ.EETGW_Equipment, "Equipment");
f.Show();
}
private void toolStripButton2_Click(object sender, EventArgs e)
@@ -314,7 +276,7 @@ namespace FEQ0000
RefreshDate();
}
string grp2name = string.Empty;
//string grp2name = string.Empty;
private void toolStripButton6_Click(object sender, EventArgs e)
{
if (cmbDate.SelectedIndex < 0)
@@ -324,16 +286,16 @@ namespace FEQ0000
}
this.grp2name = this.cmbCate.Text;
// this.grp2name = this.cmbCate.Text;
//select query
string newSQL = "select * from {0}";
string newWhere = "pdate = '{1}'";
if (cmbGrp.SelectedIndex != 0 && !cmbGrp.Text.isEmpty())
if (cbTeamPart.SelectedIndex != 0 && !cbTeamPart.Text.isEmpty())
{
if (!newWhere.isEmpty()) newWhere += " and ";
newWhere += "grp='" + cmbGrp.Text + "'";
newWhere += "linet +'-' + linep ='" + cbTeamPart.Text + "'";
}
if (this.cmbManu.SelectedIndex != 0 && !cmbManu.Text.isEmpty())
{
@@ -353,18 +315,14 @@ namespace FEQ0000
if (!this.tbSearch.Text.isEmpty())
{
if (!newWhere.isEmpty()) newWhere += " and ";
newWhere += string.Format("(asset like '%{0}%' or model like '%{0}%' or serial like '%{0}%')", tbSearch.Text);
newWhere += string.Format("(asset like '%{0}%' or type like '%{0}%' or manu like '%{0}%' or model like '%{0}%' or linet like '%{0}%' or linep like '%{0}%' or linecode like '%{0}%' or serial like '%{0}%')", tbSearch.Text);
}
if (this.cmbPlant.SelectedIndex > 0 && !this.cmbPlant.Text.isEmpty())
if (this.cmbPlant.SelectedIndex > 0 && !this.cmbPlant.Text.isEmpty())
{
if (!newWhere.isEmpty()) newWhere += " and ";
newWhere += "[plant]='" + cmbPlant.Text + "'";
}
if (this.cmbCate.SelectedIndex > 0 && !this.cmbCate.Text.isEmpty())
{
if (!newWhere.isEmpty()) newWhere += " and ";
newWhere += "[grp2]='" + cmbCate.Text + "'";
}
if (radexpn.Checked)
{
if (!newWhere.isEmpty()) newWhere += " and ";
@@ -389,86 +347,25 @@ namespace FEQ0000
string CommandText = newSQL;
if (!newWhere.isEmpty()) CommandText += " where " + newWhere;
switch (dataType)
{
case eTabletype.MOLD:
//select command
if (this.taME.Adapter.SelectCommand == null)
this.taME.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
this.taME.Adapter.SelectCommand.CommandText = string.Format(CommandText, "equipmentME", this.cmbDate.Text);
this.dsEQ.EquipmentME.Clear();
taME.Fill(this.dsEQ.EquipmentME, this.cmbDate.Text);
this.dsEQ.EquipmentME.AcceptChanges();
dv.DataSource = bsME;
bn.BindingSource = bsME;
break;
case eTabletype.BUMP:
//select command
if (this.taB.Adapter.SelectCommand == null)
this.taB.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
this.taB.Adapter.SelectCommand.CommandText = string.Format(CommandText, "equipmentB", this.cmbDate.Text);
this.dsEQ.EquipmentB.Clear();
taB.Fill(this.dsEQ.EquipmentB, this.cmbDate.Text);
this.dsEQ.EquipmentB.AcceptChanges();
dv.DataSource = bsB;
bn.BindingSource = bsB;
break;
case eTabletype.FOL:
//select command
if (this.taF.Adapter.SelectCommand == null)
this.taF.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
this.taF.Adapter.SelectCommand.CommandText = string.Format(CommandText, "equipmentF",this.cmbDate.Text);
this.dsEQ.EquipmentF.Clear();
taF.Fill(this.dsEQ.EquipmentF, this.cmbDate.Text);
this.dsEQ.EquipmentF.AcceptChanges();
dv.DataSource = bsF;
bn.BindingSource = bsF;
break;
case eTabletype.ING:
//select command
if (this.taIng.Adapter.SelectCommand == null)
this.taIng.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
this.taIng.Adapter.SelectCommand.CommandText = string.Format(CommandText, "EETGW_EquipmentIng", this.cmbDate.Text);
this.dsEQ.EETGW_EquipmentIng.Clear();
taIng.Fill(this.dsEQ.EETGW_EquipmentIng, this.cmbDate.Text);
this.dsEQ.EETGW_EquipmentIng.AcceptChanges();
dv.DataSource = bsIng;
bn.BindingSource = bsIng;
break;
case eTabletype.ALL:
CommandText = string.Format(CommandText, "EETGW_Equipment", this.cmbDate.Text);
var cmd = new System.Data.SqlClient.SqlCommand(CommandText, this.taAll.Connection);
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
dsEQ.EETGW_Equipment.Clear();
da.Fill(this.dsEQ.EETGW_Equipment);
dsEQ.EETGW_Equipment.AcceptChanges();
////select command
//if (this.taAll.Adapter.SelectCommand == null)
// this.taAll.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
//this.taAll.Adapter.SelectCommand.CommandText = string.Format(CommandText, "EETGW_Equipment");
//this.dsEQ.EETGW_Equipment.Clear();
//taAll.Fill(this.dsEQ.EETGW_Equipment, this.cmbDate.Text);
//this.dsEQ.EETGW_Equipment.AcceptChanges();
dv.DataSource = bsAll;
bn.BindingSource = bsAll;
break;
case eTabletype.OTHER:
//select command
if (this.taOther.Adapter.SelectCommand == null)
this.taOther.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
this.taOther.Adapter.SelectCommand.CommandText = string.Format(CommandText, "EETGW_Equipment");
this.dsEQ.EETGW_EquipmentOther.Clear();
taOther.Fill(this.dsEQ.EETGW_EquipmentOther, this.cmbDate.Text);
this.dsEQ.EETGW_EquipmentOther.AcceptChanges();
dv.DataSource = bsOther;
bn.BindingSource = bsOther;
break;
}
CommandText = string.Format(CommandText, "EETGW_Equipment", this.cmbDate.Text);
var cmd = new System.Data.SqlClient.SqlCommand(CommandText, this.taAll.Connection);
var da = new System.Data.SqlClient.SqlDataAdapter(cmd);
dsEQ.EETGW_Equipment.Clear();
da.Fill(this.dsEQ.EETGW_Equipment);
dsEQ.EETGW_Equipment.AcceptChanges();
////select command
//if (this.taAll.Adapter.SelectCommand == null)
// this.taAll.Adapter.SelectCommand = new System.Data.SqlClient.SqlCommand();
//this.taAll.Adapter.SelectCommand.CommandText = string.Format(CommandText, "EETGW_Equipment");
//this.dsEQ.EETGW_Equipment.Clear();
//taAll.Fill(this.dsEQ.EETGW_Equipment, this.cmbDate.Text);
//this.dsEQ.EETGW_Equipment.AcceptChanges();
dv.DataSource = bsAll;
bn.BindingSource = bsAll;
}
@@ -484,7 +381,7 @@ namespace FEQ0000
private void applyToolStripMenuItem_Click(object sender, EventArgs e)
{
var f = new EQFilterApply(this.dataType == eTabletype.ING ? "I" : "E");
var f = new EQFilterApply("E");
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var dlg = FCOMMON.Util.MsgQ("매크로를 적용 하시겠습니까?");
@@ -506,8 +403,8 @@ namespace FEQ0000
private void toolStripButton7_Click(object sender, EventArgs e)
{
var eqdiv = this.dataType == eTabletype.ING ? "I" : "E";
var f = new EQfilterManager(eqdiv);
//var eqdiv = this.dataType == eTabletype.ING ? "I" : "E";
var f = new EQfilterManager("E");
if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var filter = f.filter;
@@ -581,142 +478,37 @@ namespace FEQ0000
var ucnt = 0;
var taLIne = new dsEQTableAdapters.LineCodeTableAdapter();
var dtLineCode = taLIne.GetData();
if (dataType == eTabletype.MOLD)
this.prb1.Maximum = this.dsEQ.EETGW_Equipment.Count;
foreach (dsEQ.EETGW_EquipmentRow dr in this.dsEQ.EETGW_Equipment)
{
this.prb1.Maximum = this.dsEQ.EquipmentME.Count;
foreach (dsEQ.EquipmentMERow dr in this.dsEQ.EquipmentME)
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
{
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
}
}
}
else if (dataType == eTabletype.FOL)
{
this.prb1.Maximum = this.dsEQ.EquipmentF.Count;
foreach (dsEQ.EquipmentFRow dr in this.dsEQ.EquipmentF)
{
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
{
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
}
}
}
else if (dataType == eTabletype.ING)
{
this.prb1.Maximum = this.dsEQ.EETGW_EquipmentIng.Count;
foreach (dsEQ.EETGW_EquipmentIngRow dr in this.dsEQ.EETGW_EquipmentIng)
{
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
{
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
}
}
}
else if (dataType == eTabletype.OTHER)
{
this.prb1.Maximum = this.dsEQ.EETGW_EquipmentOther.Count;
foreach (dsEQ.EETGW_EquipmentOtherRow dr in this.dsEQ.EETGW_EquipmentOther)
{
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
{
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
}
}
}
else if (dataType == eTabletype.ALL)
{
this.prb1.Maximum = this.dsEQ.EETGW_Equipment.Count;
foreach (dsEQ.EETGW_EquipmentRow dr in this.dsEQ.EETGW_Equipment)
{
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
{
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
}
}
}
else
{
this.prb1.Maximum = this.dsEQ.EquipmentB.Count;
foreach (dsEQ.EquipmentBRow dr in this.dsEQ.EquipmentB)
{
if (this.prb1.Value < this.prb1.Maximum) this.prb1.Value += 1;
if (dr.RowState == DataRowState.Deleted || dr.RowState == DataRowState.Detached) continue;
var linedata = dtLineCode.Where(t => t.code == dr.linecode).FirstOrDefault();
if (linedata != null)
{
if (dr.grp2 != linedata.grp2 || dr.lineP != linedata.part || dr.lineT != linedata.team || dr.plant != linedata.plant)
{
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
dr.lineP = linedata.part;
dr.lineT = linedata.team;
dr.plant = linedata.plant;
dr.grp2 = linedata.grp2;
dr.EndEdit();
ucnt += 1;
}
}
}
FCOMMON.Util.MsgI($"{ucnt} 건의 자료가 변경 되었습니다. 적용하려면 '저장' 버튼을 누르세요");
}
private void groupBox2_Enter(object sender, EventArgs e)
{
}
}
}