|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using RPT.Common.Utils;
using System.Data.OracleClient;
using RPT.Common.Services;
using RPT.Common.Controls;
using Infragistics.Win.UltraWinGrid;
using RPT.Common;
using Infragistics.Win;
using Infragistics.Win.UltraWinListView;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Excel;
using System.IO;
using Infragistics.Win.Misc;
using log4net;
using RPT.Common.Models;
using AccuraSoft.WaferMap;
using System.Threading.Tasks;
//using Excel = Microsoft.Office.Interop.Excel;
//btnComposite_Click 요청으로 고쳐놨다.테스트 후 패치하면됨.
namespace YMS.UI
{
public partial class Y_WaferMap : Form
{
private static readonly ILog log = LogManager.GetLogger(Type.GetType("YMS.UI.Y_WaferMap"));
private Timer _timerLegend = new Timer(); // Legend 체크박스 클릭시 사용
private bool isGroupLot = false;
private string sGroupKeyOption = string.Empty;
private string sGroupKeyArea = string.Empty;
/// <summary>
/// Composition 된 Wafer정보를 따로 관리함
/// </summary>
/// <remarks>Legend의 체크박스로 색상변경시 다시 Composition 하기위해 사용</remarks>
private List<Dictionary<string, string>> _listComposition = new List<Dictionary<string, string>>();
private DataTable DTOutputData = null;
AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap WaferMap_S;
public Y_WaferMap()
{
InitializeComponent();
AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap WaferMap_S = new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap();
UIHelper.SetNLSData(this.Controls);
loadform();
this.ultraToolTipManager1.SetUltraToolTip(this.btToLeft, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("90도 회전(좌)", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.ultraToolTipManager1.SetUltraToolTip(this.btToRight, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("90도 회전(우)", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.ultraToolTipManager1.SetUltraToolTip(this.btToGallery, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("Gallery", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.ultraToolTipManager1.SetUltraToolTip(this.btnComposite, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("Composite", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.ultraToolTipManager1.SetUltraToolTip(this.btToExcel, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("Excel 저장", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.ultraToolTipManager1.SetUltraToolTip(this.btnCompositePartID, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("제품별 Composite", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.ultraToolTipManager1.SetUltraToolTip(this.btnCompositeLotID, new Infragistics.Win.UltraWinToolTip.UltraToolTipInfo("LOT별 Composite", ToolTipImage.None, string.Empty, DefaultableBoolean.True));
this.pnGallery.SizeChanged += new EventHandler(pnGallery_SizeChanged);
this._timerLegend.Tick += new EventHandler(_timerLegend_Tick);
this._timerLegend.Interval = 50;
this.ctlLotID.LotGroupClicked += new EventHandler(ctlLotID_LotGroupClicked);
DTOutputDataSchema();
}
private void DTOutputDataSchema()
{
DTOutputData = new DataTable();
DTOutputData.Columns.Add("PARTID", typeof(string));
DTOutputData.Columns.Add("WAFERID", typeof(string));
DTOutputData.Columns.Add("X", typeof(string));
DTOutputData.Columns.Add("Y", typeof(string));
DTOutputData.Columns.Add("ITEMID", typeof(string));
DTOutputData.Columns.Add("VALUE", typeof(string));
}
private void Y_WaferMap_Load(object sender, EventArgs e)
{
//datetime_dateFrom.Value = DateTime.Now.AddMonths(-1);
//datetime_dateTo.Value = DateTime.Now;
this.cbDB1.ValueChanged -= new System.EventHandler(this.cbDB1_ValueChanged);
cbDB1.Value = "DB";
this.cbDB1.ValueChanged += new System.EventHandler(this.cbDB1_ValueChanged);
cbDB1.Tag = LoadXml();
this.cbDrawMode.SelectedIndex = 0;
this.grdLegend.DisplayLayout.Override.HeaderCheckBoxVisibility = HeaderCheckBoxVisibility.WhenUsingCheckEditor;
}
private DataSet LoadXml()
{
string fileName = @"c:\YMS\ColorConfig.xml";
DataSet ds = new DataSet("ColorConfig");
System.IO.TextReader reader = null;
try
{
reader = new System.IO.StreamReader(fileName);
}
catch (DirectoryNotFoundException dirEx)
{
DirectoryInfo dir = new DirectoryInfo(@"c:\YMS");
if (!dir.Exists) dir.Create();
System.IO.TextWriter writer = new System.IO.StreamWriter(fileName, false);
ds.WriteXml(writer);
writer.Close();
MessageBox.Show(dirEx.Message + "\n\n- Directory Created", this.Text);
}
catch (FileNotFoundException fileEx)
{
System.IO.TextWriter writer = new System.IO.StreamWriter(fileName, false);
ds.WriteXml(writer);
writer.Close();
MessageBox.Show(fileEx.Message + "\n\n- File Created", this.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Text);
}
if (reader != null) ds.ReadXml(reader);
return ds;
}
private void loadform()
{
//최초 LineID 콤보에 데이터를 채움.
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "RPT_COMMON_GET_LINE";
oraParam.CommandType = CommandType.StoredProcedure;
this.cblineID.DataSource = DBHelper.FillDataTable(oraParam);
if (this.cblineID.Items.Count > 0) this.cblineID.SelectedIndex = 0;
grdLegend.DisplayLayout.GroupByBox.Hidden = true;
grdAnal.DisplayLayout.GroupByBox.Hidden = true;
grdCircle.DisplayLayout.GroupByBox.Hidden = true;
grdOutput.DisplayLayout.GroupByBox.Hidden = true;
ContextMenu menu = new ContextMenu();
MenuItem item = new MenuItem("엑셀저장");
item.Click += new EventHandler(itemGrdOutPut_Click);
menu.MenuItems.Add(item);
grdOutput.ContextMenu = menu;
cbX.Value = 3;
cbY.Value = 3;
cbCircle.Value = 4;
#region Event Handler |
this.ctlProductGroup.CheckBoxChecked += new USearchCondition.UCheckBoxChecked(CheckBoxChecked);
this.ctlProductGroup.CheckBoxUnChecked += new USearchCondition.UCheckBoxUnChecked(CheckBoxUnChecked);
this.ctlProductGroup.btSearch.Click += new EventHandler(ctlProductGroup_btSearch_Click);
this.ctlProcessID.CheckBoxChecked += new USearchCondition.UCheckBoxChecked(CheckBoxChecked);
this.ctlProcessID.CheckBoxUnChecked += new USearchCondition.UCheckBoxUnChecked(CheckBoxUnChecked);
this.ctlProcessID.btSearch.Click += new EventHandler(ctlProcessID_btSearch_Click);
this.ctlDeviceID.CheckBoxChecked += new USearchCondition.UCheckBoxChecked(CheckBoxChecked);
this.ctlDeviceID.CheckBoxUnChecked += new USearchCondition.UCheckBoxUnChecked(CheckBoxUnChecked);
this.ctlDeviceID.btSearch.Click += new EventHandler(ctlDeviceID_btSearch_Click);
this.ctlLotID.CheckBoxChecked += new USearchCondition.UCheckBoxChecked(CheckBoxChecked);
this.ctlLotID.CheckBoxUnChecked += new USearchCondition.UCheckBoxUnChecked(CheckBoxUnChecked);
this.ctlLotID.btSearch.Click += new EventHandler(ctlLotID_btSearch_Click);
this.ctlLotID.listView.ItemCheckStateChanged += new ItemCheckStateChangedEventHandler(listView_ItemCheckStateChanged);
this.ctlWaferID.CheckBoxChecked += new USearchCondition.UCheckBoxChecked(CheckBoxChecked);
this.ctlWaferID.CheckBoxUnChecked += new USearchCondition.UCheckBoxUnChecked(CheckBoxUnChecked);
this.ctlWaferID.btSearch.Click += new EventHandler(ctlWaferID_btSearch_Click);
#endregion
}
void itemGrdOutPut_Click(object sender, EventArgs e)
{
try
{
CreateExcel(FindSavePath());
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
this.Cursor = Cursors.Default;
}
}
private void CreateExcel(String myFilepath)
{
try
{
if (myFilepath != null)
{
this.ultraGridExcelExporter1.Export(this.grdOutput, myFilepath);
MessageBox.Show("Details 데이터가 성공적으로 " + myFilepath + " 에 다운로드 되었습니다.");
}
}
catch (Exception ex)
{
throw ex;
}
}
private String GrdFindSavePath()
{
Stream myStream;
string myFilepath = null;
try
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "excel files (*.xls)|*.xls";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
myFilepath = saveFileDialog1.FileName;
myStream.Close();
}
}
}
catch (Exception ex)
{
throw ex;
}
return myFilepath;
}
private void FillGroupCombo()
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
// Group 콤보에 데이터를 채움.
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_YMS_MAP.GET_ItemGroup";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add("VINITEMGROUP", string.Empty, OracleType.VarChar);
this.cbGroup.DataSource = DBHelper.FillDataTable(oraParam);
if (this.cbGroup.Items.Count == 1)
this.cbGroup.SelectedIndex = 0;
else if (this.cbGroup.Items.Count > 1)
this.cbGroup.SelectedIndex = 1;
else
{
this.lvItem.Items.Clear();
}
}
// Tray 체크상태에서는 단일체크만 가능하게
void listView_ItemCheckStateChanged(object sender, ItemCheckStateChangedEventArgs e)
{
if (this.cbPArea.Text.Equals(EnumHelper.Parea.EPI.ToString()))
{
if (this.uchkTray.Checked)
{
if (this.ctlLotID.listView.CheckedItems.Count > 1)
{
e.Item.CheckState = CheckState.Unchecked;
log.Info("Tray 체크상태에서 다중체크 발생하여 체크 무시함");
}
if (this.ctlLotID.listView.CheckedItems.Count == 1)
{
this.ctlWaferID_btSearch_Click(null, EventArgs.Empty);
foreach (UltraListViewItem item in this.ctlWaferID.listView.Items)
{
item.CheckState = CheckState.Checked;
}
}
}
}
}
#region Search
void ctlProductGroup_btSearch_Click(object sender, EventArgs e)
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
this.ClearListView(ctlProductGroup.listView, ctlProcessID.listView, ctlDeviceID.listView, ctlLotID.listView, ctlWaferID.listView);
try
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "YMS_COMMON_GET_PRCGROUP";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
this.ctlProductGroup.Refresh(oraParam, this.ctlDeviceID.APPEND);
}
catch (Exception ex)
{
log.Error("ctlProductGroup_btSearch_Click", ex);
}
}
void ctlProcessID_btSearch_Click(object sender, EventArgs e)
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
this.ClearListView(ctlProcessID.listView, ctlDeviceID.listView, ctlLotID.listView, ctlWaferID.listView);
try
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "YMS_COMMON_GET_PROCESSID";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(productGroup), OracleType.VarChar);
this.ctlProcessID.Refresh(oraParam, this.ctlProcessID.APPEND);
}
catch (Exception ex)
{
log.Error("ctlProcessID_btSearch_Click", ex);
}
}
void ctlDeviceID_btSearch_Click(object sender, EventArgs e)
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
string processID = QueryHelper.converter(this.ctlProcessID.listView.CheckedItems);
this.ClearListView(ctlDeviceID.listView, ctlLotID.listView, ctlWaferID.listView);
try
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "YMS_COMMON_GET_PART";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(productGroup), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPROCESSID, QueryHelper.ConvertToInSTR(processID), OracleType.VarChar);
this.ctlDeviceID.Refresh(oraParam, this.ctlDeviceID.APPEND);
}
catch (Exception ex)
{
log.Error("ctlDeviceID_btSearch_Click", ex);
}
}
void ctlLotID_btSearch_Click(object sender, EventArgs e)
{
Splasher.Show();
this.Cursor = Cursors.WaitCursor;
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
//string fromDate = string.Format("{0:yyyyMMdd}", this.datetime_dateFrom.Value);
//string toDate = string.Format("{0:yyyyMMdd}", this.datetime_dateTo.Value);
string fromDate = this.uteDateFrom.Text;
string toDate = this.uteDateTo.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
string processID = QueryHelper.converter(this.ctlProcessID.listView.CheckedItems);
string deviceID = QueryHelper.converter(this.ctlDeviceID.listView.CheckedItems);
this.ClearListView(ctlLotID.listView, ctlWaferID.listView);
try
{
OracleDataParameter oraParam = new OracleDataParameter();
//oraParam.QueryName = "MDW_YMS_MAP.GET_LOTID";
oraParam.QueryName = "MDW_YMS_MAP.GET_LOTID_v1";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINFDATE, fromDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINTDATE, toDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMGROUP, this.cbGroup.Text.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINTRAY, this.uchkTray.Checked ? "Y" : "N", OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(productGroup), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPROCESSID, QueryHelper.ConvertToInSTR(processID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPARTID, QueryHelper.ConvertToInSTR(deviceID), OracleType.VarChar);
oraParam.Add(EnumHelper.VARINDEBUG, 0, OracleType.VarChar);
if (this._isEPI && this.uchkTray.Checked) // EPI 이고 tray 체크박스일때
{
oraParam.Add(EnumHelper.VINLOTID, this.ctlLotID.teSearchCondition.Text, OracleType.VarChar);
DataTable dt = DBHelper.FillDataTable(oraParam);
this.ctlLotID.listView.SubItemColumns.Clear();
UltraListViewSubItemColumn subItemColumn = new UltraListViewSubItemColumn();
subItemColumn.Key = "pcnt";
subItemColumn.VisibleInDetailsView = DefaultableBoolean.False;
this.ctlLotID.listView.SubItemColumns.Add(subItemColumn);
this.ctlLotID.listView.Items.Clear();
foreach (DataRow row in dt.Rows)
{
if (this.ctlLotID.listView.Items.Exists(row["slotid"].ToString()))
continue;
UltraListViewSubItem subItem = new UltraListViewSubItem(row["pcnt"], null);
subItem.Appearance.ForeColor = Color.White;
UltraListViewSubItem[] subs = new UltraListViewSubItem[1];
subs[0] = subItem;
UltraListViewItem item = new UltraListViewItem(row["slotid"].ToString(), subs);
item.Key = row["slotid"].ToString();
this.ctlLotID.listView.Items.Add(item);
}
}
else
{
this.ctlLotID.Refresh(oraParam, this.ctlLotID.APPEND);
}
}
catch (Exception ex)
{
log.Error("ctlLotID_btSearch_Click", ex);
}
finally
{
this.Cursor = Cursors.Default;
System.Threading.Thread.Sleep(200);
Splasher.Close();
}
}
void ctlWaferID_btSearch_Click(object sender, EventArgs e)
{
Splasher.Show();
this.Cursor = Cursors.WaitCursor;
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
//string fromDate = string.Format("{0:yyyyMMdd}", this.datetime_dateFrom.Value);
//string toDate = string.Format("{0:yyyyMMdd}", this.datetime_dateTo.Value);
string fromDate = this.uteDateFrom.Text;
string toDate = this.uteDateTo.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
string processID = QueryHelper.converter(this.ctlProcessID.listView.CheckedItems);
string deviceID = QueryHelper.converter(this.ctlDeviceID.listView.CheckedItems);
string lotID = QueryHelper.converter(this.ctlLotID.listView.CheckedItems);
//string yield = this.cbYield.SelectedRow.Cells["ENUMVALUE"].Text;
string yield = CommonService.GetStringForInQuery(this.cbYield);
string fromYield = "";
string toYield = "";
int iCount = 0;
for (int i = 1; i < this.cbYield.Items.Count; i++)
{
if (this.cbYield.Items[i].CheckState.Equals(CheckState.Checked))
{
iCount++;
if (iCount.Equals(1))
{
fromYield = this.cbYield.Items[i].DataValue.ToString();
}
toYield = this.cbYield.Items[i].DataValue.ToString();
//MessageBox.Show("같구나!" + this.cbYield.Items[i].DataValue);
}
/*
else
{
MessageBox.Show("다르구나!" + this.cbYield.Items[i].DataValue);
}
*/
}
this.ClearListView(ctlWaferID.listView);
/* ***************************************
* 요청서ID : Y-12-0110
* 요청일 : 2012-07-18
* 요청내용 : MAP 분석 기간을 “0” 으로 조회하면 금일 Wafer 만 보이게 적용
* 처리일 : 2012-09-03
* 처리내용 : MDW_YMS_MAP.GET_WAFERID_v3 -> MDW_YMS_MAP.GET_WAFERID_v4
* ***************************************/
/* ***************************************
* 요청서ID : Y-12-0109
* 요청일 : 2012-07-18
* 요청내용 : 품질분석-MAP 분석, 조회조건 수율 추가
* 처리일 : 2012-08-14
* 처리내용 : MDW_YMS_MAP.GET_WAFERID_v2 -> MDW_YMS_MAP.GET_WAFERID_v3
* ***************************************/
try
{
OracleDataParameter oraParam = new OracleDataParameter();
//oraParam.QueryName = "MDW_YMS_MAP.GET_WAFERID_v2";
//oraParam.QueryName = "MDW_YMS_MAP.GET_WAFERID_v3"; // 2012-08-14
oraParam.QueryName = "MDW_YMS_MAP.GET_WAFERID_v4"; // 2012-09-03
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINFDATE, fromDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINTDATE, toDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMGROUP, this.cbGroup.Text.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINLOTID, QueryHelper.ConvertToInSTR(lotID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFROMYIELD, fromYield, OracleType.VarChar);
oraParam.Add(EnumHelper.VINTOYIELD, toYield, OracleType.VarChar);
oraParam.Add(EnumHelper.VARINDEBUG, 0, OracleType.VarChar);
this.ctlWaferID.Refresh(oraParam, this.ctlWaferID.APPEND, 1, 0);
}
catch (Exception ex)
{
log.Error("ctlWaferID_btSearch_Click", ex);
}
finally
{
this.Cursor = Cursors.Default;
Splasher.Close();
}
}
private void CheckBoxChecked(USearchCondition ucon)
{
if (ucon.Name.Equals("ctlProductGroup"))
{
this.ctlProductGroup_CheckStateChanged();
}
if (ucon.Name.Equals("ctlProcessID"))
{
this.ctlProcessID_CheckStateChanged();
}
if (ucon.Name.Equals("ctlDeviceID"))
{
this.ctlDeviceID_CheckStateChanged();
}
if (ucon.Name.Equals("ctlLotID"))
{
this.ctlLotID_CheckStateChanged();
}
if (ucon.Name.Equals("ctlWaferID"))
{
this.ctlWaferID_CheckStateChanged();
}
}
private void CheckBoxUnChecked(USearchCondition ucon)
{
if (ucon.Name.Equals("ctlProductGroup"))
{
ClearListView(this.ctlProcessID.listView, this.ctlDeviceID.listView, this.ctlLotID.listView, this.ctlWaferID.listView);
UIHelper.ClearListViewCounter(this.ctlProcessID, this.ctlDeviceID, this.ctlLotID, this.ctlWaferID);
}
if (ucon.Name.Equals("ctlProcessID"))
{
ClearListView(this.ctlDeviceID.listView, this.ctlLotID.listView, this.ctlWaferID.listView);
UIHelper.ClearListViewCounter(this.ctlDeviceID, this.ctlLotID, this.ctlWaferID);
}
if (ucon.Name.Equals("ctlDeviceID"))
{
ClearListView(this.ctlLotID.listView, this.ctlWaferID.listView, this.lvItem);
UIHelper.ClearListViewCounter(this.ctlLotID, this.ctlWaferID);
}
if (ucon.Name.Equals("ctlLotID"))
{
ClearListView(this.ctlWaferID.listView, this.lvItem);
UIHelper.ClearListViewCounter(this.ctlWaferID);
}
if (ucon.Name.Equals("ctlWaferID"))
{
}
}
private void cblineID_ValueChanged(object sender, EventArgs e)
{
string lineID = this.cblineID.Text;
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "RPT_COMMON_GET_PAREA";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, QueryHelper.ConvertToCondition(lineID), OracleType.VarChar);
this.cbPArea.DataSource = DBHelper.FillDataTable(oraParam);
this.cbPArea.Text = "FAB";
this.getYieldList();
string pArea = this.cbPArea.Text;
string fromDate = this.uteDateFrom.Text;
string toDate = this.uteDateTo.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
string processID = QueryHelper.converter(this.ctlProcessID.listView.CheckedItems);
string deviceID = QueryHelper.converter(this.ctlDeviceID.listView.CheckedItems);
string lotID = QueryHelper.converter(this.ctlLotID.listView.CheckedItems);
this.lvItem.Items.Clear();
string itemGroup = this.cbGroup.Text.ToUpper();
oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_YMS_MAP.GET_ITEMID";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINFDATE, fromDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINTDATE, toDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(productGroup), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPROCESSID, QueryHelper.ConvertToInSTR(processID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPARTID, QueryHelper.ConvertToInSTR(deviceID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINLOTID, QueryHelper.ConvertToInSTR(lotID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMGROUP, this.cbGroup.Text.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, string.Empty, OracleType.VarChar);
CommonService.RefreshControls(0, 0, 0, this.lvItem, oraParam, null, "", true);
}
private bool _isEPI = false;
private void cbParea_ValueChanged(object sender, EventArgs e)
{
OracleDataParameter oraParam = new OracleDataParameter();
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
this.ClearListView(ctlProductGroup.listView, ctlProcessID.listView, ctlDeviceID.listView, ctlLotID.listView, ctlWaferID.listView);
this.cbWaferID.Text = string.Empty;
this.cbItemID.Text = string.Empty;
this.cbLotID.Text = string.Empty;
this.cbWaferID.Items.Clear();
this.cbItemID.Items.Clear();
this.cbLotID.Items.Clear();
this.pnGallery.Controls.Clear();
this.chkAllItem.CheckState = CheckState.Unchecked;
DataTable dt = new DataTable();
this.grdLegend.DataSource = dt;
Revert();
if (pArea.Equals(EnumHelper.Parea.PSS.ToString()))
{
this._isEPI = false;
this.ctlProductGroup.Enabled = false;
this.ctlProcessID.Enabled = false;
this.ctlDeviceID.Enabled = false;
this.ctlLotID.Enabled = false;
this.ctlWaferID.Enabled = false;
this.ClearListView(ctlLotID.listView);
// Tray
this.uchkTray.Checked = false;
this.uchkTray.Enabled = false;
this.btToGallery.Visible = true;
this.btnComposite.Visible = true;
this.cbColumnCount.Enabled = true;
this.ultraDockManager1.ControlPanes[2].Pinned = true;
}
else if (pArea.Equals(EnumHelper.Parea.EPI.ToString()))
{
this._isEPI = true;
//2011.07.05. somi
//this.ctlProductGroup.Enabled = false;
//this.ctlProcessID.Enabled = false;
//this.ctlDeviceID.Enabled = false;
oraParam.QueryName = "YMS_COMMON_GET_PRCGROUP";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
this.ctlProductGroup.Refresh(oraParam, this.ctlDeviceID.APPEND);
//
this.ctlProductGroup.Enabled = true;
this.ctlProcessID.Enabled = true;
this.ctlDeviceID.Enabled = true;
this.ctlLotID.Enabled = true;
this.ctlWaferID.Enabled = !this.uchkTray.Checked;
//this.ClearListView(ctlLotID.listView);
//
// Tray
this.uchkTray.Checked = true;
this.uchkTray.Enabled = false;
//2011.07.05. somi
//this.FillGroupCombo();
//this.ctlLotID.btSearch.PerformClick();
//
this.btToGallery.Visible = false;
this.btnComposite.Visible = false;
this.cbColumnCount.Enabled = false;
this.ultraDockManager1.ControlPanes[2].Pinned = false;
}
else
{
this._isEPI = false;
oraParam.QueryName = "YMS_COMMON_GET_PRCGROUP";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
this.ctlProductGroup.Refresh(oraParam, this.ctlDeviceID.APPEND);
this.ctlProductGroup.Enabled = true;
this.ctlProcessID.Enabled = true;
this.ctlDeviceID.Enabled = true;
this.ctlLotID.Enabled = true;
this.ctlWaferID.Enabled = true;
// Tray
this.uchkTray.Checked = false;
this.uchkTray.Enabled = false;
this.btToGallery.Visible = true;
this.btnComposite.Visible = true;
this.cbColumnCount.Enabled = true;
this.ultraDockManager1.ControlPanes[2].Pinned = true;
}
this.FillGroupCombo();
}
private void datetime_dateFrom_ValueChanged(object sender, EventArgs e)
{
}
private void datetime_dateTo_ValueChanged(object sender, EventArgs e)
{
}
#region Group 콤보박스 변경
private void cbGroup_ValueChanged(object sender, EventArgs e)
{
SetItems();
}
private void SetItems()
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
string fromDate = this.uteDateFrom.Text;
string toDate = this.uteDateTo.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
string processID = QueryHelper.converter(this.ctlProcessID.listView.CheckedItems);
string deviceID = QueryHelper.converter(this.ctlDeviceID.listView.CheckedItems);
string lotID = QueryHelper.converter(this.ctlLotID.listView.CheckedItems);
this.lvItem.Items.Clear();
string itemGroup = this.cbGroup.Text.ToUpper();
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_YMS_MAP.GET_ITEMID";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINFDATE, fromDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINTDATE, toDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(productGroup), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPROCESSID, QueryHelper.ConvertToInSTR(processID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPARTID, QueryHelper.ConvertToInSTR(deviceID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINLOTID, QueryHelper.ConvertToInSTR(lotID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMGROUP, this.cbGroup.Text.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, string.Empty, OracleType.VarChar);
CommonService.RefreshControls(0, 0, 0, this.lvItem, oraParam, null, "", true);
}
#endregion
private void ctlProductGroup_CheckStateChanged()
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
this.ClearListView(ctlProcessID.listView, ctlDeviceID.listView, ctlLotID.listView, ctlWaferID.listView);
try
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "YMS_COMMON_GET_PROCESSID";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(this.ctlProductGroup.listView.CheckedItems), OracleType.VarChar);
this.ctlProcessID.Refresh(oraParam, this.ctlProcessID.APPEND);
}
catch (Exception ex)
{
log.Error("ctlProductGroup_CheckStateChanged", ex);
}
}
private void ctlProcessID_CheckStateChanged()
{
string lineID = this.cblineID.Text;
string pArea = this.cbPArea.Text;
string productGroup = QueryHelper.converter(this.ctlProductGroup.listView.CheckedItems);
string processID = QueryHelper.converter(this.ctlProcessID.listView.CheckedItems);
this.ClearListView(ctlDeviceID.listView, ctlLotID.listView, ctlWaferID.listView);
try
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "YMS_COMMON_GET_PART";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPAREA, pArea, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPRODGROUP, QueryHelper.ConvertToInSTR(productGroup), OracleType.VarChar);
oraParam.Add(EnumHelper.VINPROCESSID, QueryHelper.ConvertToInSTR(processID), OracleType.VarChar);
this.ctlDeviceID.Refresh(oraParam, this.ctlDeviceID.APPEND);
}
catch (Exception ex)
{
log.Error("ctlProcessID_CheckStateChanged", ex);
}
}
private void ctlDeviceID_CheckStateChanged()
{
SetItems();
}
private void ctlLotID_CheckStateChanged()
{
this.cbWaferID.Text = string.Empty;
this.cbItemID.Text = string.Empty;
this.cbLotID.Text = string.Empty;
this.cbWaferID.Items.Clear();
this.cbItemID.Items.Clear();
this.cbLotID.Items.Clear();
this.pnGallery.Controls.Clear();
SetItems();
Splasher.Close();
}
private void ctlWaferID_CheckStateChanged()
{
// Wafer 개수 제한?
SetItems();
//
}
private void btResult_Click(object sender, EventArgs e)
{
_SingleWaferImgs = null;
string startTime = DateTime.Now.ToString("yyyyMMddHHmmss");
try
{
if ((this._isEPI && this.ctlLotID.listView.CheckedItems.Count <= 0))
{
MessageBox.Show("LOT ID가 선택되지 않았습니다.");
return;
}
if ((!this._isEPI && this.ctlWaferID.listView.CheckedItems.Count <= 0))
{
MessageBox.Show("Wafer ID가 선택되지 않았습니다.");
return;
}
if (this.lvItem.CheckedItems.Count <= 0)
{
MessageBox.Show("Item이 선택되지 않았습니다.");
return;
}
// Added by KIM 2014.08.28 조회 기간 Validation 추가 (1년)
if (UIHelper.CheckPeriodFromString(this.uteDateFrom.Text, this.uteDateTo.Text, CommonService.GetPeriod()))
{
return;
}
//if (this.shiftPanel.ClientArea.Controls[0] == (Control)this.panelOCX)
if (this._bWaferStat)
{
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.Hide();
DrawGallery();
this.shiftPanel.Show();
}
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.ClientArea.Controls.Add(this.pnGallery);
this.cbWaferID.Enabled = false;
_CompositeYN = "N";
_PicType = "GalleryMode";
if (this._isEPI)
{
this.cbItemID.Enabled = true;
this.cbLotID.Enabled = true;
this.cbWaferID.Items.Clear();
this.cbItemID.Items.Clear();
this.cbLotID.Items.Clear();
string stepseq = this.cbGroup.Text;
this.cbWaferID.DataSource = CommonService.ObtainDataTableFromIEnumerable(this.ctlWaferID.listView.CheckedItems.AsEnumerable()
, new string[] { "Key", "Text" });
this.cbWaferID.ValueMember = "KEY";
this.cbWaferID.DisplayMember = "TEXT";
this.cbItemID.DataSource = CommonService.ObtainDataTableFromIEnumerable(this.lvItem.CheckedItems.AsEnumerable()
, new string[] { "Text" });
this.cbItemID.Tag = stepseq;
this.cbLotID.DataSource = CommonService.ObtainDataTableFromIEnumerable(this.ctlLotID.listView.CheckedItems.AsEnumerable()
, new string[] { "Key", "Text" });
this.cbItemID.SelectedIndex = 0;
this.cbLotID.SelectedIndex = 0;
}
else
{
this.cbItemID.Enabled = false;
this.cbLotID.Enabled = false;
DrawGallery();
}
DataTable dt = this.grdLegend.DataSource as DataTable;
if (dt == null)
return;
else
dt.Clear();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
// Add Log
string lineID = this.cblineID.Text;
string endTime = DateTime.Now.ToString("yyyyMMddHHmmss");
CommonService.AddSystemUseLog(lineID, UserInfo.UserID, startTime, endTime, "YMS.UI." + this.Name, this.Text);
}
}
private void btAdd_Click(object sender, EventArgs e)
{
log.Info("플러스 버튼 눌렀음");
if (this._isEPI && this.uchkTray.Checked)// tray 체크박스일때
return;
if ((this._isEPI && this.ctlLotID.listView.CheckedItems.Count <= 0))
{
MessageBox.Show("LOT ID가 선택되지 않았습니다.");
return;
}
if ((!this._isEPI && this.ctlWaferID.listView.CheckedItems.Count <= 0))
{
MessageBox.Show("Wafer ID가 선택되지 않았습니다.");
return;
}
if (this.lvItem.CheckedItems.Count <= 0)
{
MessageBox.Show("Item이 선택되지 않았습니다.");
return;
}
// Added by KIM 2014.08.28 조회 기간 Validation 추가 (1년)
if (UIHelper.CheckPeriodFromString(this.uteDateFrom.Text, this.uteDateTo.Text, CommonService.GetPeriod()))
{
return;
}
DrawGalleryPlus();
this.cbWaferID.Enabled = false;
this.cbItemID.Enabled = false;
DataTable dt = this.grdLegend.DataSource as DataTable;
if (dt != null) dt.Clear();
}
private void DrawGalleryPlus()
{
if (this.uchkTray.Checked)
{
MessageBox.Show("Tray 체크를 해제하십시오");
return;
}
if (waferInfo.Count == 0)
{
MessageBox.Show("먼저 View 버튼으로 조회를 하십시오");
return;
}
try
{
Splasher.Show();
this.Cursor = Cursors.WaitCursor;
string lineID = this.cblineID.Text;
string stepseq = this.cbGroup.Text;
AddWaferInfo(lineID
, QueryHelper.ConvertToInSTR(this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.TEXT).ToString()
, stepseq
, QueryHelper.ConvertToInSTR(this.lvItem.CheckedItems, EnumHelper.ReturnType.TEXT).ToString()
, QueryHelper.ConvertToInSTR(this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.KEY).ToString());
log.Info("Wafer 하나 추가됨");
if (waferInfo.Count == 0)
{
this.Cursor = Cursors.Default;
Splasher.Close();
MessageBox.Show("조회 결과가 존재하지 않습니다.", this.Text);
return;
}
string pos = string.Empty;
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
bool dup = false;
foreach (TableLayoutPanel tlp in this.pnGallery.Controls)
{
// 중복된 아이템은 추가하지 않는다
if ((string)tlp.GetControlFromPosition(0, 2).Tag == value.Key)
{
dup = true;
break; ;
}
}
if (dup)
continue;
Dictionary<string, string> v = value.Value;
RefreshLegend(v[FACTORY], v[WAFERID], v[FMKEY], v[ITEMGROUP], v[ITEMID], v[DEVICEID]);
// clob, spec
string spec = v[MIN_X] + "," + v[MAX_X] + "," + v[MIN_Y] + "," + v[MAX_Y];
string partid = v["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("S");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,135,-70,45";
}
*/
#endregion
DrawMap(v[WAFERID], v[ITEMID], v[DVALUE], spec, v[DPOS], false);
//UIntPtr var = new UIntPtr(this.axWaferMap1.MakeBitmapHandle());
IntPtr intPtr = IntPtr.Zero;// (IntPtr)(int)(uint)var;
//// WaferID와 ItemID 표시
Infragistics.Win.UltraWinEditors.UltraCheckEditor chkWafer = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
Infragistics.Win.Misc.UltraLabel lblItem = new Infragistics.Win.Misc.UltraLabel();
Infragistics.Win.Misc.UltraLabel lblFabLot = new Infragistics.Win.Misc.UltraLabel();
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
appearance1.TextVAlignAsString = "Middle";
appearance1.ForeColorDisabled = Color.Black;
chkWafer.Appearance = appearance1;
chkWafer.Dock = System.Windows.Forms.DockStyle.Fill;
chkWafer.Text = v[WAFERID];
if (v[ITEMID].Equals("RANK")) chkWafer.Enabled = false;
appearance3.TextVAlignAsString = "Middle";
lblFabLot.Appearance = appearance3;
lblFabLot.Dock = System.Windows.Forms.DockStyle.Fill;
lblFabLot.Margin = new System.Windows.Forms.Padding(19, 0, 3, 0);
lblFabLot.Text = v[LOTID];
lblFabLot.Click += new EventHandler(lblItem_Click);
appearance2.TextVAlignAsString = "Middle";
lblItem.Appearance = appearance2;
lblItem.Dock = System.Windows.Forms.DockStyle.Fill;
lblItem.Margin = new System.Windows.Forms.Padding(19, 0, 3, 0);
lblItem.Text = v[ITEMID];
//TEST 소스
Bitmap bitmap = waferMap1.ToBitmap();
//TEST 소스
PictureBox picWaferGallery = new PictureBox();
picWaferGallery.Image = bitmap; //Image.FromHbitmap(intPtr);
picWaferGallery.MinimumSize = new Size(0, 0);
picWaferGallery.SizeMode = PictureBoxSizeMode.StretchImage;
picWaferGallery.Margin = new System.Windows.Forms.Padding(0);
picWaferGallery.Dock = System.Windows.Forms.DockStyle.Fill;
picWaferGallery.DoubleClick += new System.EventHandler(this.picWaferGallery_DoubleClick);
picWaferGallery.Click += new System.EventHandler(this.picWaferGallery_Click);
picWaferGallery.MouseClick += new MouseEventHandler(picWaferGallery_MouseClick);
picWaferGallery.Tag = value.Key;
TableLayoutPanel tbWaferGallery = new TableLayoutPanel();
tbWaferGallery.ColumnCount = 1;
int size = Convert.ToInt32((shiftPanel.Size.Width - 100) / (this.cbColumnCount.SelectedIndex + 1));
tbWaferGallery.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset;
tbWaferGallery.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
// Map Chart LotID 추가
tbWaferGallery.Controls.Add(chkWafer, 0, 0);
tbWaferGallery.Controls.Add(lblFabLot, 0, 1);
tbWaferGallery.Controls.Add(lblItem, 0, 2);
tbWaferGallery.Controls.Add(picWaferGallery, 0, 3);
/* 기존소스 주석처리
tbWaferGallery.Controls.Add(chkWafer, 0, 0);
tbWaferGallery.Controls.Add(lblItem, 0, 1);
tbWaferGallery.Controls.Add(picWaferGallery, 0, 2);
*/
// Map Chart LotID 추가
tbWaferGallery.RowCount = 4;
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
/* 기존소스 주석처리
tbWaferGallery.RowCount = 3;
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
*/
tbWaferGallery.Size = new System.Drawing.Size(size, size + 42);
this.pnGallery.Controls.Add(tbWaferGallery);
}
this._bWaferStat = false;
this.grdLegend.DisplayLayout.Override.HeaderCheckBoxVisibility = HeaderCheckBoxVisibility.Never;
if (this.grdLegend.DisplayLayout.Bands[0].Columns.Exists("CHK"))
this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
log.Error("Wafer 하나 추가하다가 에러발생", ex);
}
finally
{
this.Cursor = Cursors.Default;
Splasher.Close();
}
}
#endregion
#region const
const string WAFERID = "WAFERID";
const string TARGET = "TARGET";
const string PRODGROUP = "PRODUCTSPECGROUP";
const string MIN_Y = "MIN_Y";
const string MIN_X = "MIN_X";
const string MAX_Y = "MAX_Y";
const string MAX_X = "MAX_X";
const string LSL = "LSL";
const string USL = "USL";
const string ITEMID = "ITEMID";
const string ITEMGROUP = "STEPSEQ";
const string GOOD_RATIO = "GOOD_RATIO";
const string FMKEY = "FMKEY";
const string FACTORY = "FACTORYNAME";
const string DVALUE = "DVALUE";
const string DPOS = "DPOS";
const string DSTD = "DSTD";
const string DMEDIAN = "DMEDIAN";
const string DEVICEID = "PARTID";
const string DAVG_E = "DAVG_E";
const string DAVG = "DAVG";
const string PAREA = "PAREA";
//2011.06.29. somi
const string MOCVDZONE = "MOCVDZONE";
const string MOCVDPOCKETNO = "MOCVDPOCKETNO";
//
const string LOTID = "LOTID";
#endregion
Dictionary<string, Dictionary<string, string>> waferInfo = new Dictionary<string, Dictionary<string, string>>();
Dictionary<string, Dictionary<string, string>> waferInfo2 = new Dictionary<string, Dictionary<string, string>>();
private void RefreshWaferInfo(string lineID, string waferID, string stepseq, string itemID, string fmkey)
{
this.RefreshWaferInfo(lineID, waferID, stepseq, itemID, fmkey, /*기본적으로 wafer누적 안시킴*/ true);
}
/// <param name="waferClear">wafer를 누적시키려면 false</param>
private void RefreshWaferInfo(string lineID, string waferID, string stepseq, string itemID, string fmkey, bool waferClear)
{
if (waferClear)
this.waferInfo.Clear();
string[] wafers = waferID.ToString().Split(' ');
string[] fmkeys = fmkey.ToString().Split(' ');
string[] items = itemID.ToString().Split(' ');
DataTable result = new DataTable();
for (int i = 0; i < wafers.Length; i++)
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.QueryName = "MDW_YMS_MAP.GET_MAPDATA";
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINWAFERID, wafers[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkeys[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, "Coordinate", OracleType.VarChar);
result.Merge(DBHelper.FillDataTable(oraParam));
for (int j = 0; j < items.Length; j++)
{
oraParam = new OracleDataParameter();
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.QueryName = "MDW_YMS_MAP.GET_MAPDATA";
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINWAFERID, wafers[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkeys[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, items[j], OracleType.VarChar);
result.Merge(DBHelper.FillDataTable(oraParam));
}
}
string pos = string.Empty;
WaferViewModel[] models = makeWaferViewModelsArrayFromDb(result.Rows);
foreach (DataRow row in result.Rows)
{
if (row[ITEMID].Equals("Coordinate"))
{
pos = row[DVALUE].ToString();
continue;
}
Dictionary<string, string> info = new Dictionary<string, string>();
info.Add(WAFERID, row[WAFERID].ToString());
info.Add(TARGET, row[TARGET].ToString());
info.Add(PRODGROUP, row[PRODGROUP].ToString());
info.Add(MIN_Y, row[MIN_Y].ToString());
info.Add(MIN_X, row[MIN_X].ToString());
info.Add(MAX_Y, row[MAX_Y].ToString());
info.Add(MAX_X, row[MAX_X].ToString());
info.Add(LSL, row[LSL].ToString());
info.Add(USL, row[USL].ToString());
info.Add(ITEMID, row[ITEMID].ToString());
info.Add(ITEMGROUP, row[ITEMGROUP].ToString());
info.Add(GOOD_RATIO, row[GOOD_RATIO].ToString());
info.Add(FMKEY, row[FMKEY].ToString());
info.Add(FACTORY, row[FACTORY].ToString());
info.Add(DVALUE, row[DVALUE].ToString());
info.Add(DPOS, pos);
info.Add(DSTD, row[DSTD].ToString());
info.Add(DMEDIAN, row[DMEDIAN].ToString());
info.Add(DEVICEID, row[DEVICEID].ToString());
info.Add(DAVG_E, row[DAVG_E].ToString());
info.Add(DAVG, row[DAVG].ToString());
info.Add(PAREA, row[PAREA].ToString());
info.Add("LOTID", row["LOTID"].ToString());
info.Add("EQPID", row["EQPID"].ToString());
info.Add("TESTDIE", row["TESTDIE"].ToString());
//2011.06.29. somi
info.Add(MOCVDZONE, row[MOCVDZONE].ToString());
info.Add(MOCVDPOCKETNO, row[MOCVDPOCKETNO].ToString());
//
waferInfo.Add(row[FMKEY].ToString() + row[WAFERID].ToString() + row[ITEMID].ToString(), info);
}
modelArray = models;
AccuraSoft.WaferMap.WinForm.WaferMap.MultiMap multiMap1 = new AccuraSoft.WaferMap.WinForm.WaferMap.MultiMap();
multiMap1.WaferModels = models;
}
WaferViewModel[] modelArray;
//Wafer Size 규정
struct WaferSizeInches
{
public const float _200mm = 200000000f;
public const float _300mm = 300000000f;
public const float _2inch = 50800000f; //50.8mm
public const float _4inch = 101600000f;
public const float _6inch = 152400000f;
public const float _12inch = 303800000f; //300mm
}
//Wafer Size
//Test 소스
private void RefreshWaferInfo2(string lineID, string waferID, string stepseq, string itemID, string fmkey, bool waferClear)
{
if (waferClear)
this.waferInfo2.Clear();
string[] wafers = waferID.ToString().Split(' ');
string[] fmkeys = fmkey.ToString().Split(' ');
string[] items = itemID.ToString().Split(' ');
DataTable result = new DataTable();
for (int i = 0; i < wafers.Length; i++)
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.QueryName = "MDW_YMS_MAP.GET_MAPDATA";
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINWAFERID, wafers[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkeys[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, "Coordinate", OracleType.VarChar);
result.Merge(DBHelper.FillDataTable(oraParam));
for (int j = 0; j < items.Length; j++)
{
oraParam = new OracleDataParameter();
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.QueryName = "MDW_YMS_MAP.GET_MAPDATA";
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINWAFERID, wafers[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkeys[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, items[j], OracleType.VarChar);
result.Merge(DBHelper.FillDataTable(oraParam));
}
}
string pos = string.Empty;
foreach (DataRow row in result.Rows)
{
if (row[ITEMID].Equals("Coordinate"))
{
pos = row[DVALUE].ToString();
continue;
}
Dictionary<string, string> info = new Dictionary<string, string>();
info.Add(WAFERID, row[WAFERID].ToString());
info.Add(TARGET, row[TARGET].ToString());
info.Add(PRODGROUP, row[PRODGROUP].ToString());
info.Add(MIN_Y, row[MIN_Y].ToString());
info.Add(MIN_X, row[MIN_X].ToString());
info.Add(MAX_Y, row[MAX_Y].ToString());
info.Add(MAX_X, row[MAX_X].ToString());
info.Add(LSL, row[LSL].ToString());
info.Add(USL, row[USL].ToString());
info.Add(ITEMID, row[ITEMID].ToString());
info.Add(ITEMGROUP, row[ITEMGROUP].ToString());
info.Add(GOOD_RATIO, row[GOOD_RATIO].ToString());
info.Add(FMKEY, row[FMKEY].ToString());
info.Add(FACTORY, row[FACTORY].ToString());
info.Add(DVALUE, row[DVALUE].ToString());
info.Add(DPOS, pos);
info.Add(DSTD, row[DSTD].ToString());
info.Add(DMEDIAN, row[DMEDIAN].ToString());
info.Add(DEVICEID, row[DEVICEID].ToString());
info.Add(DAVG_E, row[DAVG_E].ToString());
info.Add(DAVG, row[DAVG].ToString());
info.Add(PAREA, row[PAREA].ToString());
// 2011.06.29. somi
info.Add(MOCVDZONE, row[MOCVDZONE].ToString());
info.Add(MOCVDPOCKETNO, row[MOCVDPOCKETNO].ToString());
//
waferInfo2.Add(row[FMKEY].ToString() + row[WAFERID].ToString() + row[ITEMID].ToString(), info);
}
}
private void AddWaferInfo(string lineID, string waferID, string stepseq, string itemID, string fmkey)
{
string[] wafers = waferID.ToString().Split(' ');
string[] fmkeys = fmkey.ToString().Split(' ');
string[] items = itemID.ToString().Split(' ');
DataTable result = new DataTable();
for (int i = 0; i < wafers.Length; i++)
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.QueryName = "MDW_YMS_MAP.GET_MAPDATA";
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINWAFERID, wafers[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkeys[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, "Coordinate", OracleType.VarChar);
result.Merge(DBHelper.FillDataTable(oraParam));
for (int j = 0; j < items.Length; j++)
{
if (waferInfo.ContainsKey(fmkeys[i] + wafers[i] + items[j]))
{
continue;
}
oraParam = new OracleDataParameter();
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.QueryName = "MDW_YMS_MAP.GET_MAPDATA";
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINWAFERID, wafers[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq.ToUpper(), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkeys[i], OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, items[j], OracleType.VarChar);
result.Merge(DBHelper.FillDataTable(oraParam));
}
}
string pos = string.Empty;
foreach (DataRow row in result.Rows)
{
if (row[ITEMID].Equals("Coordinate"))
{
pos = row[DVALUE].ToString();
continue;
}
Dictionary<string, string> info = new Dictionary<string, string>();
info.Add(WAFERID, row[WAFERID].ToString());
info.Add(TARGET, row[TARGET].ToString());
info.Add(PRODGROUP, row[PRODGROUP].ToString());
info.Add(MIN_Y, row[MIN_Y].ToString());
info.Add(MIN_X, row[MIN_X].ToString());
info.Add(MAX_Y, row[MAX_Y].ToString());
info.Add(MAX_X, row[MAX_X].ToString());
info.Add(LSL, row[LSL].ToString());
info.Add(USL, row[USL].ToString());
info.Add(ITEMID, row[ITEMID].ToString());
info.Add(ITEMGROUP, row[ITEMGROUP].ToString());
info.Add(GOOD_RATIO, row[GOOD_RATIO].ToString());
info.Add(FMKEY, row[FMKEY].ToString());
info.Add(FACTORY, row[FACTORY].ToString());
info.Add(DVALUE, row[DVALUE].ToString());
info.Add(DPOS, pos);
info.Add(DSTD, row[DSTD].ToString());
info.Add(DMEDIAN, row[DMEDIAN].ToString());
info.Add(DEVICEID, row[DEVICEID].ToString());
info.Add(DAVG_E, row[DAVG_E].ToString());
info.Add(DAVG, row[DAVG].ToString());
info.Add(PAREA, row[PAREA].ToString());
waferInfo.Add(row[FMKEY].ToString() + row[WAFERID].ToString() + row[ITEMID].ToString(), info);
}
}
private void DrawGallery()
{
try
{
Splasher.Show();
this.Cursor = Cursors.WaitCursor;
this.cbDrawMode.Enabled = false;
string lineID = this.cblineID.Text;
string stepseq = this.cbGroup.Text;
this.cbWaferID.Clear();
this.cbItemID.Clear();
this.cbWaferID.DataSource = CommonService.ObtainDataTableFromIEnumerable(this.ctlWaferID.listView.CheckedItems.AsEnumerable()
, new string[] { "Key", "Text" });
this.cbWaferID.ValueMember = "KEY";
this.cbWaferID.DisplayMember = "TEXT";
this.cbItemID.DataSource = CommonService.ObtainDataTableFromIEnumerable(this.lvItem.CheckedItems.AsEnumerable()
, new string[] { "Text" });
this.cbItemID.Tag = stepseq;
this.cbLotID.DataSource = CommonService.ObtainDataTableFromIEnumerable(this.ctlLotID.listView.CheckedItems.AsEnumerable()
, new string[] { "Key", "Text" });
// 변경후 V2 --------------------------------------
// PL
string strWaferKey = QueryHelper.ConvertToInSTR(this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.KEY).ToString();
string strWaferTxt = QueryHelper.ConvertToInSTR(this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.TEXT).ToString();
string strItem = QueryHelper.ConvertToInSTR(this.lvItem.CheckedItems, EnumHelper.ReturnType.TEXT).ToString();
RefreshWaferInfo(lineID, strWaferTxt, stepseq, strItem, strWaferKey, true); // 현재는 다시 누적안씀
if (waferInfo.Count == 0)
{
this.Cursor = Cursors.Default;
Splasher.Close();
MessageBox.Show("조회 결과가 존재하지 않습니다.", this.Text);
this.pnGallery.Controls.Clear();
this.txtDescription.Clear();
DrawLegend(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
return;
}
this.cbColumnCount.Value = this.cbColumnCount.Items[1].DataValue;
this.cbColumnCount.Enabled = true;
this.pnGallery.Hide();
this.pnGallery.Controls.Clear();
//string pos = string.Empty;
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
Dictionary<string, string> v = value.Value;
RefreshLegend(v[FACTORY], v[WAFERID], v[FMKEY], v[ITEMGROUP], v[ITEMID], v[DEVICEID]);
// clob, spec
string spec = v[MIN_X] + "," + v[MAX_X] + "," + v[MIN_Y] + "," + v[MAX_Y];
string partid = v["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("S");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
//if (partid == "PBS8130-I7C-ME-4I" || partid == "PBS8130-I7C-ME-OLD-4I" || partid == "PBS8130-I7C-ME-C4-OLD-4I")
//{
// spec = "-135,135,-70,45";
//}
if (partid.Length != 0)
{
if (partid.Length > 7)
{
if (partid.Substring(0, 7) == "PBS8130" || (partid.Substring(0, 7) == "PBS7830") || partid.Substring(0, 5) == "S1232")
{
spec = "-135,135,-70,45";
}
}
}
#endregion
DrawMap(v[WAFERID], v[ITEMID], v[DVALUE], spec, v[DPOS], false);
//UIntPtr var = new UIntPtr(this.axWaferMap1.MakeBitmapHandle());
IntPtr intPtr = IntPtr.Zero;//(IntPtr)(int)(uint)var;
//// WaferID와 ItemID 표시
Infragistics.Win.UltraWinEditors.UltraCheckEditor chkWafer = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
Infragistics.Win.Misc.UltraLabel lblItem = new Infragistics.Win.Misc.UltraLabel();
Infragistics.Win.Misc.UltraLabel lblFabLot = new Infragistics.Win.Misc.UltraLabel();
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
appearance1.TextVAlignAsString = "Middle";
appearance1.ForeColorDisabled = Color.Black;
chkWafer.Appearance = appearance1;
chkWafer.Dock = System.Windows.Forms.DockStyle.Fill;
chkWafer.Text = v[WAFERID];
chkWafer.Click += new EventHandler(chkWafer_Click);
if (v[ITEMID].Equals("RANK")) chkWafer.Enabled = false;
appearance3.TextVAlignAsString = "Middle";
lblFabLot.Appearance = appearance3;
lblFabLot.Dock = System.Windows.Forms.DockStyle.Fill;
lblFabLot.Margin = new System.Windows.Forms.Padding(19, 0, 3, 0);
lblFabLot.Text = v[LOTID];
lblFabLot.Click += new EventHandler(lblItem_Click);
appearance2.TextVAlignAsString = "Middle";
lblItem.Appearance = appearance2;
lblItem.Dock = System.Windows.Forms.DockStyle.Fill;
lblItem.Margin = new System.Windows.Forms.Padding(19, 0, 3, 0);
lblItem.Text = v[ITEMID];
lblItem.Click += new EventHandler(lblItem_Click);
ContextMenu menu = new ContextMenu();
MenuItem item = new MenuItem("복사");
item.Click += new EventHandler(item_Click);
menu.MenuItems.Add(item);
//Test 소스 추가
//WaferMap에 그린 Wafer를 bitmap으로 만들어서 Gallery에 붙여준다.
//waferMap1.ViewModel = findWafer(v[WAFERID], v[ITEMID]);
Bitmap bitmap = waferMap1.ToBitmap();
//Test소스 추가
PictureBox picWaferGallery = new PictureBox();
picWaferGallery.Image = bitmap;//Image.FromHbitmap(intPtr);
picWaferGallery.MinimumSize = new Size(0, 0);
picWaferGallery.SizeMode = PictureBoxSizeMode.StretchImage;
picWaferGallery.Margin = new System.Windows.Forms.Padding(0);
picWaferGallery.Dock = System.Windows.Forms.DockStyle.Fill;
picWaferGallery.DoubleClick += new System.EventHandler(this.picWaferGallery_DoubleClick);
picWaferGallery.Click += new System.EventHandler(this.picWaferGallery_Click);
picWaferGallery.MouseClick += new MouseEventHandler(picWaferGallery_MouseClick);
picWaferGallery.Tag = value.Key;
menu.Tag = bitmap; //Image.FromHbitmap(intPtr);
picWaferGallery.ContextMenu = menu;
TableLayoutPanel tbWaferGallery = new TableLayoutPanel();
tbWaferGallery.ColumnCount = 1;
int size = Convert.ToInt32((shiftPanel.Size.Width - 100) / (this.cbColumnCount.SelectedIndex + 1));
tbWaferGallery.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset;
tbWaferGallery.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
// Map Chart LotID 추가
tbWaferGallery.Controls.Add(chkWafer, 0, 0);
tbWaferGallery.Controls.Add(lblFabLot, 0, 1);
tbWaferGallery.Controls.Add(lblItem, 0, 2);
tbWaferGallery.Controls.Add(picWaferGallery, 0, 3);
/* 기존소스 주석처리
tbWaferGallery.Controls.Add(chkWafer, 0, 0);
tbWaferGallery.Controls.Add(lblItem, 0, 1);
tbWaferGallery.Controls.Add(picWaferGallery, 0, 2);
*/
// Map Chart LotID 추가
tbWaferGallery.RowCount = 4;
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
/* 기존소스 주석처리
tbWaferGallery.RowCount = 3;
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F));
tbWaferGallery.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
*/
tbWaferGallery.Size = new System.Drawing.Size(size, size + 42);
this.pnGallery.Controls.Add(tbWaferGallery);
}
this.Cursor = Cursors.Default;
this.pnGallery.Show();
this._bWaferStat = false;
this.grdLegend.DisplayLayout.Override.HeaderCheckBoxVisibility = HeaderCheckBoxVisibility.Never;
if (this.grdLegend.DisplayLayout.Bands[0].Columns.Exists("CHK"))
this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
}
catch (Exception ex)
{
Splasher.Close();
MessageBox.Show(ex.Message);
log.Error("DrawGallery 함수", ex);
}
finally
{
Splasher.Close();
}
}
void item_Click(object sender, EventArgs e)
{
Image oImage = (Image)((MenuItem)sender).Parent.Tag;
System.Windows.Forms.Clipboard.SetDataObject(oImage, true);
}
Image[] _SingleWaferImgs = null;
private void DrawGalleryEPI()
{
try
{
Splasher.Show();
this.Cursor = Cursors.WaitCursor;
string lineID = this.cblineID.Text;
string stepseq = this.cbGroup.Text;
// 변경후 V2 --------------------------------------
// PL
string strWaferKey = QueryHelper.ConvertToInSTR(this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.KEY).ToString();
string strWaferTxt = QueryHelper.ConvertToInSTR(this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.TEXT).ToString();
string strItem = this.cbItemID.SelectedItem.DisplayText;
RefreshWaferInfo(lineID, strWaferTxt, stepseq, strItem, strWaferKey, true); // 현재는 다시 누적안씀
if (waferInfo.Count == 0)
{
this.Cursor = Cursors.Default;
Splasher.Close();
MessageBox.Show("조회 결과가 존재하지 않습니다.", this.Text);
this.pnGallery.Controls.Clear();
this.txtDescription.Clear();
DrawLegend(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
return;
}
this.cbColumnCount.Value = this.cbColumnCount.Items[2].DataValue;
this.cbColumnCount.Enabled = false;
this.pnGallery.Hide();
this.pnGallery.Controls.Clear();
log.Info("EPI 이고 Tray 체크일때 DrawGallery 시작");
object o = this.ctlLotID.listView.CheckedItems[0].SubItems["pcnt"].Value;
int waferCnt = Int32.Parse(o.ToString()); // <-- Lot리스트에서 wafer count 를 가져와야함
CarrierType carrType = CarrierData.GetCarrTypeByCarrCnt(waferCnt);
Image[] WaferImgs = new Image[waferCnt];
_SingleWaferImgs = new Image[waferCnt];
CarrierInfo.WaferDetailData[] wdds = new CarrierInfo.WaferDetailData[waferCnt];
int idx = 0;
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
if (idx >= waferCnt) break;
Dictionary<string, string> v = value.Value;
RefreshLegend(v[FACTORY], v[WAFERID], v[FMKEY], v[ITEMGROUP], v[ITEMID], v[DEVICEID]);
// clob, spec
string spec = v[MIN_X] + "," + v[MAX_X] + "," + v[MIN_Y] + "," + v[MAX_Y];
string partid = v["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("S");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,135,-70,45";
}
*/
#endregion
DrawMap(v[WAFERID], v[ITEMID], v[DVALUE], spec, v[DPOS], false);
//UIntPtr var = new UIntPtr(this.axWaferMap1.MakeBitmapHandle());
IntPtr intPtr = IntPtr.Zero;//(IntPtr)(int)(uint)var;
int iRealPosition = int.Parse(v[WAFERID].Substring(v[WAFERID].Length - 2, 2));
int iMapPosition = iRealPosition - 1;
//TEST 소스 삽입
Bitmap bitmap = waferMap1.ToBitmap();
//TEST 소스
WaferImgs[iMapPosition] = bitmap; // Image.FromHbitmap(intPtr);
_SingleWaferImgs[iMapPosition] = WaferImgs[iMapPosition];
wdds[iMapPosition] = new CarrierInfo.WaferDetailData()
{
WAFER_ID = v[WAFERID],
ITEM_ID = v[ITEMID],
FM_KEY = v[FMKEY],
Position = iMapPosition,
PAREA = v["PAREA"],
STEPSEQ = v["STEPSEQ"],
PARTID = v["PARTID"],
LOTID = v["LOTID"],
EQPID = v["EQPID"],
GOOD_RATIO = v["GOOD_RATIO"],
TESTDIE = v["TESTDIE"],
//2011.06.29. somi
DAVG_E = v["DAVG_E"],
MOCVDZONE = v["MOCVDZONE"],
MOCVDPOCKETNO = v["MOCVDPOCKETNO"]
//
};
idx++;
}
CarrierInfo carrier = new CarrierInfo(WaferImgs, wdds, carrType); // ①
ContextMenu menu = new ContextMenu();
MenuItem item2 = new MenuItem("복사");
item2.Click += new EventHandler(item2_Click);
menu.MenuItems.Add(item2);
PictureBox picCarrier = new PictureBox();
picCarrier.Size = new Size(615, 615); // 615 : carrier 가로,세로 -> 고정임
picCarrier.Image = carrier.DrawWaferToCarrier(); // ②
picCarrier.Margin = new System.Windows.Forms.Padding(0);
menu.Tag = carrier.DrawWaferToCarrier();
picCarrier.ContextMenu = menu;
picCarrier.MouseClick += new MouseEventHandler(picCarrier_MouseClick_Tray);
picCarrier.MouseDoubleClick += new MouseEventHandler(picCarrier_MouseDoubleClick_Tray);
picCarrier.MouseMove += new MouseEventHandler(picCarrier_MouseMove_Tray);
picCarrier.MouseLeave += new EventHandler(picCarrier_MouseLeave_Tray);
picCarrier.Tag = carrier; // carrier 픽쳐박스의 Tag에 Carrier 인스턴스를 붙인다
this.pnGallery.Controls.Add(picCarrier);
log.Info("EPI 이고 Tray 체크일때 DrawGallery 종료");
this.Cursor = Cursors.Default;
this.pnGallery.Show();
this._bWaferStat = false;
this.grdLegend.DisplayLayout.Override.HeaderCheckBoxVisibility = HeaderCheckBoxVisibility.Never;
if (this.grdLegend.DisplayLayout.Bands[0].Columns.Exists("CHK"))
this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
}
catch (Exception ex)
{
Splasher.Close();
MessageBox.Show(ex.Message);
log.Error("DrawGallery 함수", ex);
}
finally
{
Splasher.Close();
}
}
void picCarrier_MouseClick_Tray(object sender, MouseEventArgs e)
{
string wafer_id;
string item_id;
string fm_key;
int position;
string PArea;
string StepSeq;
string PartID;
string LotID;
string EQPID;
string Good_Ratio;
string TestDie;
//2011.06.29. somi
string AvgE;
string MocvdZone;
string MocvdPocketno;
//
CarrierInfo carrier = (CarrierInfo)((PictureBox)sender).Tag;
if (carrier.GetWaferDetailInfo(e.X, e.Y, out wafer_id, out item_id, out fm_key, out position,
out PArea, out StepSeq, out PartID, out LotID, out EQPID, out Good_Ratio, out TestDie
//2011.06.29. somi
, out AvgE, out MocvdZone, out MocvdPocketno
//
))
{
this.ultraDockManager1.ControlPanes[2].Pinned = true;
this.txtDescription.Text =
"P-Area : " + PArea
+ Environment.NewLine + "Step : " + StepSeq
+ Environment.NewLine + "PartID : " + PartID
+ Environment.NewLine + "LotID : " + LotID
+ Environment.NewLine + "WaferID : " + wafer_id
+ Environment.NewLine + "EqpID : " + EQPID
+ Environment.NewLine + "Item : " + item_id
+ Environment.NewLine + "Yield : " + Good_Ratio
+ Environment.NewLine + "TestDie : " + TestDie
//2011.06.29. somi
+ Environment.NewLine + "Avg(E) : " + AvgE
+ Environment.NewLine + "MocvdZone : " + MocvdZone
+ Environment.NewLine + "MocvdPocketno : " + MocvdPocketno;
//
//this.txtDescription.Text =
// "P-Area : " + PArea
//+ Environment.NewLine + "STEP : " + StepSeq
//+ Environment.NewLine + "PartID : " + PartID
//+ Environment.NewLine + "LotID : " + LotID
//+ Environment.NewLine + "WaferID : " + wafer_id
//+ Environment.NewLine + "EQPID : " + EQPID
//+ Environment.NewLine + "ITEM : " + item_id
//+ Environment.NewLine + "YIELD : " + Good_Ratio
//+ Environment.NewLine + "TestDIE : " + TestDie
// //2011.06.29. somi
//+ Environment.NewLine + "AVG(E) : " + AvgE
//+ Environment.NewLine + "MOCVDZONE : " + MocvdZone
//+ Environment.NewLine + "MOCVDPOCKETNO : " + MocvdPocketno;
////
}
}
void item2_Click(object sender, EventArgs e)
{
Image oImage = (Image)((MenuItem)sender).Parent.Tag;
System.Windows.Forms.Clipboard.SetDataObject(oImage, true);
}
#region Gellery thumbnail의 checkbox나 label을 선택해도 picturebox를 선택한 것과 같게
void chkWafer_Click(object sender, EventArgs e)
{
foreach (Control c in ((Control)sender).Parent.Controls)
{
if (c.GetType().ToString() == "System.Windows.Forms.PictureBox")
{
this.picWaferGallery_Click(c, EventArgs.Empty); // picturebox 강제클릭
// picturebox 강제클릭으로 이벤트 먹은것 다시 실행기능
if (((UltraCheckEditor)sender).CheckState == CheckState.Unchecked)
((UltraCheckEditor)sender).Checked = true;
else
((UltraCheckEditor)sender).Checked = false;
}
}
}
void lblItem_Click(object sender, EventArgs e)
{
foreach (Control c in ((Control)sender).Parent.Controls)
{
if (c.GetType().ToString() == "System.Windows.Forms.PictureBox")
{
this.picWaferGallery_Click(c, EventArgs.Empty);
this.picWaferGallery_MouseClick(c, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
}
}
#endregion
void picCarrier_MouseLeave_Tray(object sender, EventArgs e)
{
this.Cursor = Cursors.Arrow;
}
void picCarrier_MouseMove_Tray(object sender, MouseEventArgs e)
{
this.Cursor = Cursors.Hand;
}
// Tray시에 Wafer 클릭
void picCarrier_MouseDoubleClick_Tray(object sender, MouseEventArgs e)
{
this.ultraDockManager1.ControlPanes[2].Pinned = false;
int position;
string wafer_id;
string item_id;
string fm_key;
string PArea;
string StepSeq;
string PartID;
string LotID;
string EQPID;
string Good_Ratio;
string TestDie;
//2011.06.29. somi
string AvgE;
string MocvdZone;
string MocvdPocketno;
//
string lineID = this.cblineID.Text;
string stepSeq = this.cbGroup.Text;
CarrierInfo carrier = (CarrierInfo)((PictureBox)sender).Tag;
if (carrier.GetWaferDetailInfo(e.X, e.Y, out wafer_id, out item_id, out fm_key, out position,
out PArea, out StepSeq, out PartID, out LotID, out EQPID, out Good_Ratio, out TestDie
//2011.06.30. somi
, out AvgE, out MocvdZone, out MocvdPocketno
//
))
{
_CompositeYN = "N";
_PicType = "SingleMode";
_selectedPicBox.Image = _SingleWaferImgs[position - 1];
//MessageBox.Show(string.Format("wafer_id : {0}\r\nitem_id : {1}\r\nfm_key : {2}", wafer_id, item_id, fm_key));
if (fm_key == null || wafer_id == null || item_id == null) return;
this.shiftPanel.ClientArea.Controls.Clear();
this.Cursor = Cursors.WaitCursor;
string key = fm_key + wafer_id + item_id;
_selected = waferInfo[key];
string spec = _selected[MIN_X] + "," + _selected[MAX_X] + "," + _selected[MIN_Y] + "," + _selected[MAX_Y];
string partid = _selected["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
*/
#endregion
//this.axWaferMap1.DeleteAllWaferData();
this.cbWaferID.Enabled = true;
this.cbItemID.Enabled = true;
this.cbColumnCount.Enabled = false;
this.btnComposite.Enabled = false;
//combo에 wafer와 item 이름을 채울 때 이벤트가 발생해서 문제가 생김. 이벤트 뺌
this.cbWaferID.ValueChanged -= new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbItemID.ValueChanged -= new System.EventHandler(this.cbItemID_ValueChanged);
this.cbWaferID.Text = _selected[WAFERID];
this.cbItemID.Text = _selected[ITEMID];
//combo에 wafer와 item 이름을 채울 때 이벤트가 발생해서 문제가 생김. 이벤트 더함
this.cbWaferID.ValueChanged += new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbItemID.ValueChanged += new System.EventHandler(this.cbItemID_ValueChanged);
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false);
this.shiftPanel.ClientArea.Controls.Add(this.panelOCX);
//this.axWaferMap1.SetDrawItemName(_selected[ITEMID]);
this.Cursor = Cursors.Default;
}
}
private int? _idxFirst = null;
/// <summary>
/// Control Key 누른상태에서 Wafer 클릭시 체크박스 토글
/// Shift Key 누른상태에서 Wafer 클릭시 체크박스 다중선택
/// </summary>
void picWaferGallery_MouseClick(object sender, MouseEventArgs e)
{
try
{
if (Control.ModifierKeys == Keys.Control)
{
TableLayoutPanel tlp = (TableLayoutPanel)((PictureBox)sender).Parent;
UltraCheckEditor uce = (UltraCheckEditor)tlp.GetControlFromPosition(0, 0);
// RANK 제외
if (!uce.Enabled)
return;
bool bChk = uce.Checked;
((UltraCheckEditor)tlp.GetControlFromPosition(0, 0)).Checked = !bChk;
}
else if (Control.ModifierKeys == Keys.Shift)
{
if (this._idxFirst.HasValue)
{
int idxLast = this.pnGallery.Controls.IndexOf(((PictureBox)sender).Parent);
int first = 0;
int last = 0;
if (this._idxFirst.Value > idxLast)
{
first = idxLast;
last = this._idxFirst.Value;
}
else
{
first = this._idxFirst.Value;
last = idxLast;
}
for (int i = 0; i < this.pnGallery.Controls.Count; i++)
{
if (first > i) continue;
if (last < i) break;
UltraCheckEditor uce = (UltraCheckEditor)((TableLayoutPanel)this.pnGallery.Controls[i]).GetControlFromPosition(0, 0);
// RANK 제외
if (!uce.Enabled)
continue;
uce.Checked = true;
}
}
}
this._idxFirst = this.pnGallery.Controls.IndexOf(((PictureBox)sender).Parent);
}
catch (Exception ex)
{
log.Error("Control Key 누른상태에서 Wafer 클릭 또는 Shift Key 누른상태에서 Wafer 클릭시 에러", ex);
}
}
private ArrayList legendArray = new ArrayList();
private DataTable _dtLegend = null;
/* ****************************************************************************
* 요청 ID : Y-12-0034
* 요 청 일 : 2012-05-18
* 요청내용 : * IMS(VI) 외관 불량룰 산출 모수변경요청
* - NetDie → TestDie로 변경 요청
* 처 리 일 : 2012-08-17
* 처리사항 : MDW_YMS_MAP.GET_LEGEND -> MDW_YMS_MAP.GET_LEGEND_v2
* ****************************************************************************/
private void RefreshLegend(string lineID, string waferID, string fmkey, string stepseq, string itemID, string deviceID)
{
OracleDataParameter oraParam = new OracleDataParameter();
//oraParam.QueryName = "MDW_YMS_MAP.GET_LEGEND";
oraParam.QueryName = "MDW_YMS_MAP.GET_LEGEND_v2";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINPARTID, deviceID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINSTEPSEQ, stepseq, OracleType.VarChar);
oraParam.Add(EnumHelper.VINITEMID, itemID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINFMKEY, fmkey, OracleType.VarChar);
_dtLegend = DBHelper.FillDataTable(oraParam);
legendArray.Clear();
foreach (DataRow legend_row in _dtLegend.Rows)
{
string legendTag = string.Empty;
if (itemID.Equals("RANK"))
{
legendTag = string.Format("{0},{1},{2},{3}"
, "BIN" + legend_row["RANKID"].ToString()
, legend_row["COLOR"].ToString() == string.Empty ? "0,0,0" : legend_row["COLOR"].ToString()
, legend_row["RANKID"].ToString()
, (Convert.ToInt32(legend_row["RANKID"]) + 1));
}
else
{
legendTag = string.Format("{0},{1},{2},{3}"
, legend_row["ITEMID"].ToString()
, legend_row["COLOR"].ToString() == string.Empty ? "0,0,0" : legend_row["COLOR"].ToString()
, legend_row["LSL"].ToString()
, legend_row["USL"].ToString());
}
legendArray.Add(legendTag);
}
}
//CheckBoxOnHeader_CreationFilter aCheckBoxOnHeader_CreationFilter = new CheckBoxOnHeader_CreationFilter();
//범례의 각 레이블에 표시될 내용
public void DrawLegend(string lineID, string waferID, string fmkey, string stepseq, string itemID, string deviceID)
{
RefreshLegend(lineID, waferID, fmkey, stepseq, itemID, deviceID);
string tableName = stepseq + "|" + deviceID + "|" + itemID;
if (cbDB1.SelectedItem.DataValue.Equals("DB"))
{
if (_dtLegend == null || _dtLegend.Rows.Count <= 0)
{
if (itemID.Equals("RANK"))
{
_dtLegend = new DataTable(tableName);
_dtLegend.Columns.Add("CHK", Type.GetType("System.Boolean"));
_dtLegend.Columns.Add("COLOR");
_dtLegend.Columns.Add("RANKID");
_dtLegend.Columns.Add("PER");
_dtLegend.Columns.Add("QTY");
_dtLegend.Rows.Add();
//ds.Tables.Add(dt);
}
else
{
_dtLegend = new DataTable(tableName);
_dtLegend.Columns.Add("CHK", Type.GetType("System.Boolean"));
_dtLegend.Columns.Add("COLOR");
_dtLegend.Columns.Add("LSL");
_dtLegend.Columns.Add("USL");
_dtLegend.Rows.Add();
}
}
else
{
grdLegend.DataSource = _dtLegend;
}
}
//DDD
else
{
DataSet ds = (DataSet)cbDB1.Tag;
DataTable dt = ds.Tables[tableName];
if (dt == null)
{
dt = new DataTable(tableName);
dt.Columns.Add("CHK", Type.GetType("System.Boolean"));
dt.Columns.Add("COLOR");
dt.Columns.Add("ORDEROPT");
dt.Columns.Add("LSL");
dt.Columns.Add("USL");
dt.Rows.Add();
ds.Tables.Add(dt);
}
grdLegend.DataSource = dt.Copy();
}
InitLegendGrid(grdLegend, itemID);
foreach (UltraGridRow row in grdLegend.Rows)
{
row.Cells["CHK"].Value = true;
}
if (this.grdLegend.DisplayLayout.Bands[0].Columns.Exists("CHK"))
this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
}
private void InitLegendGrid(UltraGrid grd, string gubun)
{
GridHeaders heads = new GridHeaders();
// 컬럼의 헤더를 클릭하면 sorting 되지 않게 함.
this.grdLegend.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Select;
heads.AddGridColumn("CHK", "", 20, HAlign.Center, true, Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox);
if (gubun.Equals("RANK"))
{
//heads.AddGridColumn("ORDEROPT", "No", 40, HAlign.Center, true);
heads.AddGridColumn("COLOR", "", 30, HAlign.Center, true, Infragistics.Win.UltraWinGrid.ColumnStyle.Button);
heads.AddGridColumn("RANKID", "BIN", 60, HAlign.Left, true);
heads.AddGridColumn("GRADE", "GRADE", 60, HAlign.Left, true);
heads.AddGridColumn("PER", "Per", 60, HAlign.Left, true);
heads.AddGridColumn("QTY", "Count", 60, HAlign.Right, true);
}
else
{
//heads.AddGridColumn("ORDEROPT", "No", 40, HAlign.Center, true);
heads.AddGridColumn("COLOR", "", 30, HAlign.Center, true, Infragistics.Win.UltraWinGrid.ColumnStyle.Button);
heads.AddGridColumn("LSL", "Min", 80, HAlign.Center, true, Infragistics.Win.UltraWinGrid.ColumnStyle.Double);
heads.AddGridColumn("USL", "Max", 80, HAlign.Center, true, Infragistics.Win.UltraWinGrid.ColumnStyle.Double);
}
heads.SetColumns(grd);
UltraGridBand band = grd.DisplayLayout.Bands[0];
foreach (UltraGridRow row in grd.Rows)
{
//row.Cells["CHK"].Value = false;
string[] rgb = row.Cells["COLOR"].Text.Split(',');
Color rgbColor = Color.Black;
//try
//{
// if (!string.IsNullOrEmpty(row.Cells["COLOR"].Text)) rgbColor = Color.FromArgb(Convert.ToInt16(rgb[0]), Convert.ToInt16(rgb[1]), Convert.ToInt16(rgb[2]));
// else rgbColor = Color.FromArgb(0, 0, 0);
//}
//catch (Exception ex)
//{
// log.Error("InitLegendGrid", ex);
//}
if (!string.IsNullOrEmpty(row.Cells["COLOR"].Text)) rgbColor = Color.FromArgb(Convert.ToInt16(rgb[0]), Convert.ToInt16(rgb[1]), Convert.ToInt16(rgb[2]));
else rgbColor = Color.FromArgb(0, 0, 0);
row.Cells["COLOR"].ButtonAppearance.BackColor = rgbColor;
row.Cells["COLOR"].ButtonAppearance.BackColor2 = rgbColor;
// 갑자기 글씨가 보임. 글씨가 안보이도록 하기위해 추가함.
row.Cells["COLOR"].ButtonAppearance.ForeColor = rgbColor;
}
band.Columns["COLOR"].ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
grd.DisplayLayout.AutoFitStyle = AutoFitStyle.None;
}
private void DrawMap(string waferID, string itemID, string clob, string spec, string pos, bool isComposite)
{
// 한번돈다.
this.DrawMap(waferID, itemID, clob, spec, pos, isComposite, true);
}
private void DrawMap(WaferViewModel model, ArrayList legendArray) {
waferMap1 = new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap();
waferMap1.ViewModel = getColoredmodelFromLegend(model, legendArray) ;
waferMap1.SelectixxxxxxonChanged += new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap.SelectionEventHandler(waferMap1_OnEventSelectedCell);
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.ClientArea.Controls.Add(waferMap1);
waferMap1.Dock = DockStyle.Fill;
}
private void DrawMap(string waferID, string itemID, string clob, string spec, string pos, bool isComposite, bool bAllColrChk)
{
try
{
// Clear
panelOCX.Enabled = true;
//this.axWaferMap1.DeleteAllWaferData();
string bstrData = legendArray.Count.ToString() + ",1," + itemID;
if (bAllColrChk)
{
foreach (string legendTag in legendArray)
{
string[] ss = legendTag.Split(',');
bstrData += "," + string.Format("{0},{1},{2},{3},{4},{5},{6}", ss[0], ss[1], ss[2], ss[3], 1, ss[4], ss[5]);
//bstrData += "," + legendTag;
}
}
else
{
for (int i = 0; i < grdLegend.Rows.Count; i++)
{
string[] ss = ((string)legendArray[i]).Split(',');
if (grdLegend.Rows[i].Cells["CHK"].Value != null && grdLegend.Rows[i].Cells["CHK"].Value.ToString() == "True")
{
bstrData += "," + string.Format("{0},{1},{2},{3},{4},{5},{6}", ss[0], ss[1], ss[2], ss[3], 1, ss[4], ss[5]);
legendArray.RemoveAt(i);
}
else
{
bstrData += "," + string.Format("{0},{1},{2},{3},{4},{5},{6}", ss[0], ss[1], ss[2], ss[3], 0, ss[4], ss[5]);
}
}
}
string bstrSpec = spec + "," + "1";
int nCompositeMode = 1;
string bstrHeader = waferID + "," + itemID;
if (cbDB1.SelectedItem.DataValue.Equals("DB"))
{
//this.axWaferMap1.SetColorConfigInfo(bstrData); //Item과 BIN의 범위와 그에 따른 색깔 정보.
waferMap1 = new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap();
waferMap1.ViewModel = getModelFromInfos(waferID, itemID, legendArray);
}
else
{
string itemGroup = this.cbGroup.Text;
DataSet ds = (DataSet)cbDB1.Tag;
DataTable dt = ds.Tables[itemGroup.ToUpper() + "|" + itemID];
if (dt == null)
bstrData = "0,1," + itemID;
else
{
bstrData = dt.Rows.Count.ToString() + ",1," + itemID;
if (bAllColrChk)
{
foreach (DataRow row in dt.Rows)
{
bstrData += string.Format(",{0},{1},{2},{3},{4}", itemID, row["COLOR"], 1, row["LSL"], row["USL"]);
}
}
else
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if (grdLegend.Rows[i].Cells["CHK"].Value != null && grdLegend.Rows[i].Cells["CHK"].Value.ToString() == "True")
{
bstrData += string.Format(",{0},{1},{2},{3},{4}", itemID, dt.Rows[i]["COLOR"], 1, dt.Rows[i]["LSL"], dt.Rows[i]["USL"]);
}
else
{
bstrData += string.Format(",{0},{1},{2},{3},{4}", itemID, dt.Rows[i]["COLOR"], 0, dt.Rows[i]["LSL"], dt.Rows[i]["USL"]);
}
}
}
}
//this.axWaferMap1.SetColorConfigInfo(bstrData); //Item과 BIN의 범위와 그에 따른 색깔 정보.
}
//this.axWaferMap1.SetWaferSpec(bstrSpec); //x축, Y축의 min, max값 입력
// this.axWaferMap1.SetCompositeMode(nCompositeMode); //composite모드 선택 0:색 1:값 2:색&값
//this.axWaferMap1.SetWaferCoordinate(waferID, pos.TrimEnd(',')); // 추가:
//this.axWaferMap1.SetWaferData(bstrHeader, clob); //bstrHeader는 "waferid, itemid"이고, clobdata는 "x,y,값"
//this.axWaferMap1.SetDrawMode(int.Parse(this.cbDrawMode.SelectedItem.DataValue.ToString())); //draw모드, 3은 박스와 글자 모두 표시
//this.axWaferMap1.SetShowHideWaferOutLine(true);
//if (!isComposite)
// this.axWaferMap1.SetDrawItemName(itemID); //itemid입력
//this.axWaferMap1.SetShowHideGuideLine(!this._isEPI);
//2017-01-10 TEST 소스
if (!bAllColrChk)
{
}
else
{
//wafer를 그려서 Gallery에 넣어줘야함
/*
for (int i = 0; i < 2; i++)
{
if (models[i].WaferID == waferID)
{
waferMap1.ViewModel = models[i];
}
}*/
}
//2017-01-10
this._bWaferStat = true;
this.grdLegend.DisplayLayout.Override.HeaderCheckBoxVisibility = HeaderCheckBoxVisibility.WhenUsingCheckEditor;
if (this.grdLegend.DisplayLayout.Bands[0].Columns.Exists("CHK"))
this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].Hidden = false;
}
catch (Exception ex)
{
log.Error("DrawMap 함수에서 에러", ex);
}
}
private void DrawMapAdd(string waferID, string itemID, string clob, string spec, string pos)
{
// Clear
string bstrData = legendArray.Count.ToString() + ",1," + itemID;
foreach (string legendTag in legendArray)
{
bstrData += "," + legendTag;
}
string bstrSpec = spec + "," + "1";
string bstrHeader = waferID + "," + itemID;
//this.axWaferMap1.SetColorConfigInfo(bstrData); //Item과 BIN의 범위와 그에 따른 색깔 정보.
//this.axWaferMap1.SetWaferSpec(bstrSpec); //x축, Y축의 min, max값 입력
//this.axWaferMap1.SetCompositeMode(0); //composite모드 선택 0:색 1:값 2:색&값
//this.axWaferMap1.SetWaferCoordinate(waferID, pos.TrimEnd(',')); // 추가:
//this.axWaferMap1.SetWaferData(bstrHeader, clob); //bstrHeader는 "waferid, itemid"이고, clobdata는 "x,y,값"
//this.axWaferMap1.SetDrawMode(1); //draw모드, 3은 박스와 글자 모두 표시
//this.axWaferMap1.SetDrawItemName(itemID); //itemid입력
}
private void cbWaferID_ValueChanged(object sender, EventArgs e)
{
try
{
if (string.IsNullOrEmpty(this.cbWaferID.Text)
|| string.IsNullOrEmpty(this.cbItemID.Text))
return;
string key = this.cbWaferID.SelectedItem.DataValue.ToString() + this.cbWaferID.Text + this.cbItemID.Text;
_selected = waferInfo[key];
string spec = _selected[MIN_X] + "," + _selected[MAX_X] + "," + _selected[MIN_Y] + "," + _selected[MAX_Y];
string partid = _selected["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
*/
#endregion
this.grdOutput.Refresh();
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void cbItemID_ValueChanged(object sender, EventArgs e)
{
if (this._isEPI)
{
if (this.cbItemID.Text == string.Empty) return;
DrawGalleryEPI();
}
else
{
if (string.IsNullOrEmpty(this.cbWaferID.Text)
|| string.IsNullOrEmpty(this.cbItemID.Text))
return;
string key = this.cbWaferID.SelectedItem.DataValue.ToString() + this.cbWaferID.Text + this.cbItemID.Text;
if (!waferInfo.ContainsKey(key))
{
//this.axWaferMap1.DeleteAllWaferData();
grdLegend.DataSource = null;
return;
}
_selected = waferInfo[key];
string spec = _selected[MIN_X] + "," + _selected[MAX_X] + "," + _selected[MIN_Y] + "," + _selected[MAX_Y];
string partid = _selected["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
*/
#endregion
this.grdOutput.Refresh();
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false);
}
}
#region wafer gallery의 wafer를 더블클릭하면 큰 wafer map으로 화면을 변경하는 이벤트
private bool _bWaferStat = false; // true:맵보기상태
// wafer gallery의 wafer를 더블클릭하면 큰 wafer map으로 화면을 변경하는 이벤트
private void picWaferGallery_DoubleClick(object sender, EventArgs e)
{
_CompositeYN = "N";
_PicType = "SingleMode";
this.cbDrawMode.Enabled = true;
this.cbDrawMode.SelectedIndex = 0;
this.shiftPanel.ClientArea.Controls.Clear();
this.Cursor = Cursors.WaitCursor;
PictureBox picWaferGAllery = (PictureBox)sender;
_selected = waferInfo[picWaferGAllery.Tag.ToString()];
string spec = _selected[MIN_X] + "," + _selected[MAX_X] + "," + _selected[MIN_Y] + "," + _selected[MAX_Y];
string partid = _selected["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
*/
//if (partid.Length < 0)
//{
// if (partid.Substring(0, 7) == "PBS8130")
// {
// spec = "-135,135,-70,45";
// }
//}
if (partid.Length != 0)
{
if (partid.Length > 7)
{
if (partid.Substring(0, 7) == "PBS8130" || (partid.Substring(0, 7) == "PBS7830"))
{
spec = "-135,135,-70,45";
}
}
}
#endregion
//this.axWaferMap1.DeleteAllWaferData();
this.cbWaferID.Enabled = true;
this.cbItemID.Enabled = true;
this.cbColumnCount.Enabled = false;
this.btnComposite.Enabled = false;
//combo에 wafer와 item 이름을 채울 때 이벤트가 발생해서 문제가 생김. 이벤트 뺌
this.cbWaferID.ValueChanged -= new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbItemID.ValueChanged -= new System.EventHandler(this.cbItemID_ValueChanged);
this.cbWaferID.Text = _selected[WAFERID];
this.cbItemID.Text = _selected[ITEMID];
//combo에 wafer와 item 이름을 채울 때 이벤트가 발생해서 문제가 생김. 이벤트 더함
this.cbWaferID.ValueChanged += new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbItemID.ValueChanged += new System.EventHandler(this.cbItemID_ValueChanged);
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false);
/*
if (WaferMap_S == null) {
WaferMap_S = new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap();
}*/
//WaferMap_S.ViewModel = findWafer(_selected[WAFERID], _selected[ITEMID]);
waferMap1.SelectixxxxxxonChanged += new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap.SelectionEventHandler(waferMap1_OnEventSelectedCell);
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.ClientArea.Controls.Add(waferMap1);
waferMap1.Dock = DockStyle.Fill;
//WaferMap_S.SelectixxxxxxonChanged += new AccuraSoft.WaferMap.WinForm.WaferMap.WaferMap.SelectionEventHandler(waferMap1_OnEventSelectedCell);
//this.shiftPanel.ClientArea.Controls.Add(WaferMap_S);
//WaferMap_S.Dock = DockStyle.Fill;
this.shiftPanel.ClientArea.Controls.Add(this.panelOCX);
//this.axWaferMap1.SetDrawItemName(_selected[ITEMID]);
this.Cursor = Cursors.Default;
}
#endregion
string _PicType = string.Empty;
PictureBox _selectedPicBox = new PictureBox();
Dictionary<string, string> _selected = new Dictionary<string, string>();
// wafer gallery의 wafer를 원클릭하면 해당 wafer에 대한 legend를 표시
private void picWaferGallery_Click(object sender, EventArgs e)
{
PictureBox picWaferGAllery = (PictureBox)sender;
_selected = waferInfo[picWaferGAllery.Tag.ToString()];
// Rank 일때 Disable 인데 ForeColor 변경이 안됨...
foreach (Control c in pnGallery.Controls)
{
c.BackColor = Color.Transparent;
c.ForeColor = Color.Black;
}
picWaferGAllery.Parent.BackColor = Color.Blue;
picWaferGAllery.Parent.ForeColor = Color.White;
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
//this.cbWaferID.Text = _selected[WAFERID];
//this.cbItemID.Text = _selected[ITEMID];
this.pnGallery.Focus();
FillDescriptionTxt();
_selectedPicBox = picWaferGAllery;
}
public DataTable GetDistinctRows(DataTable dt, params string[] column)
{
return dt.DefaultView.ToTable(true, column).AsEnumerable().OrderBy(d => d.Field<String>(column[0])).CopyToDataTable();
}
public object ConvertToSelectedInSTR(string WaferID, UltraListViewCheckedItemsCollection ckdItemCollection, EnumHelper.ReturnType key)
{
if (ckdItemCollection == null || ckdItemCollection.Count <= 0) return DBNull.Value;
string result_string = string.Empty;
for (int i = 0; i < ckdItemCollection.Count; i++)
{
if (ckdItemCollection[i].Text.Equals(WaferID))
{
if (i != 0) result_string += " "; //공백으로 구분.
switch (key)
{
case EnumHelper.ReturnType.KEY:
result_string += ckdItemCollection[i].Key;
break;
case EnumHelper.ReturnType.TEXT:
result_string += ckdItemCollection[i].Text;
break;
case EnumHelper.ReturnType.TAG:
result_string += ckdItemCollection[i].Tag;
break;
}
}
}
return result_string;
}
//Wafer Map OCX의 chip을 선택하면 chip정보가 패널에 표시
private void axWaferMap1_OnEventSelectedCell(object sender, AxWaferMapLib._DWaferMapEvents_OnEventSelectedCellEvent e)
{
DataTable distinctItemid = new DataTable();
try
{
if (this.cbPArea.Text.Equals("EPI"))
{
waferInfo2.Clear();
string lineID = this.cblineID.Text;
string stepseq = this.cbGroup.Text;
string strWaferKey = ConvertToSelectedInSTR(cbWaferID.Text, this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.KEY).ToString();
string strWaferTxt = ConvertToSelectedInSTR(cbWaferID.Text, this.ctlWaferID.listView.CheckedItems, EnumHelper.ReturnType.TEXT).ToString();
string strItem = QueryHelper.ConvertToInSTR(this.lvItem.CheckedItems, EnumHelper.ReturnType.TEXT).ToString();
RefreshWaferInfo2(lineID, strWaferTxt, stepseq, strItem, strWaferKey, true);
//해당 Item의 모든 WaferID에 대한 X,Y Position 및 Value값 데이터 자료구조
DTOutputData.Clear();
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo2)
{
Dictionary<string, string> v = value.Value;
if (v[WAFERID].Equals(cbWaferID.Text))
{
DataRow dr = null;
string[] asdPos = v[DPOS].Split(new char[] { '|' });
string[] asdPosXY = null;
string[] asdValue = v[DVALUE].Split(new char[] { ',' });
int index = 0;
foreach (string sPos in asdPos)
{
asdPosXY = sPos.Split(new char[] { ',' });
if (asdPosXY.Length.Equals(2))
{
dr = DTOutputData.NewRow();
dr["PARTID"] = v[DEVICEID];
dr["WAFERID"] = v[WAFERID];
dr["X"] = asdPosXY[0];
dr["Y"] = asdPosXY[1];
dr["ITEMID"] = v[ITEMID];
dr["VALUE"] = asdValue[index];
DTOutputData.Rows.Add(dr);
}
index++;
}
}
}
}
else
{
//해당 Item의 모든 WaferID에 대한 X,Y Position 및 Value값 데이터 자료구조
DTOutputData.Clear();
switch (this._CompositeYN)
{
case "Y":
string[] arrWafer = this._CompositeWF.Split(' ');
for (int i = 0; i < arrWafer.Length; i++)
{
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
Dictionary<string, string> v = value.Value;
if (v[WAFERID].Equals(arrWafer[i]))
{
DataRow dr = null;
string[] asdPos = v[DPOS].Split(new char[] { '|' });
string[] asdPosXY = null;
string[] asdValue = v[DVALUE].Split(new char[] { ',' });
int index = 0;
foreach (string sPos in asdPos)
{
asdPosXY = sPos.Split(new char[] { ',' });
if (asdPosXY.Length.Equals(2))
{
dr = DTOutputData.NewRow();
dr["PARTID"] = v[DEVICEID];
dr["WAFERID"] = v[WAFERID];
dr["X"] = asdPosXY[0];
dr["Y"] = asdPosXY[1];
dr["ITEMID"] = v[ITEMID];
dr["VALUE"] = asdValue[index];
DTOutputData.Rows.Add(dr);
}
index++;
}
}
}
}
break;
case "N":
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
Dictionary<string, string> v = value.Value;
if (v[WAFERID].Equals(cbWaferID.Text))
{
DataRow dr = null;
string[] asdPos = v[DPOS].Split(new char[] { '|' });
string[] asdPosXY = null;
string[] asdValue = v[DVALUE].Split(new char[] { ',' });
int index = 0;
foreach (string sPos in asdPos)
{
asdPosXY = sPos.Split(new char[] { ',' });
if (asdPosXY.Length.Equals(2))
{
dr = DTOutputData.NewRow();
dr["PARTID"] = v[DEVICEID];
dr["WAFERID"] = v[WAFERID];
dr["X"] = asdPosXY[0];
dr["Y"] = asdPosXY[1];
dr["ITEMID"] = v[ITEMID];
dr["VALUE"] = asdValue[index];
DTOutputData.Rows.Add(dr);
}
index++;
}
}
}
//distinct waferid 가져오기
distinctItemid = GetDistinctRows(DTOutputData, "ITEMID");
break;
}
}
//this.axWaferMap1.Focus();
this.txtDescription.Clear();
string resultstr = e.bstrData;
//콤마로 구분된 resultstr을 콤마 단위로 쪼갬. strArray에 순서대로 넣음.
string[] strArray = resultstr.Split(',');
string waferID = strArray[0].ToString();
//20101203 - new OCX파일 release. 등록 후 주석풀면 동작함. 동작내용은 원(wafer) 밖을 클릭하면 chipInfo그리드의 내용이 남아있었는데, 삭제하도록 수정됨.
if (strArray[1].ToString() != "0") return; // 동작모드가 0이 아니면 무시. (동작모드란 = 0 이면 선택, 1 이면 합산, 2 이면 삭제)
int itemnum = Int32.Parse(strArray[2].ToString());
int chipnum = Int32.Parse(strArray[3].ToString());
// 웨이퍼의 개요 그리드 gr1에 출력
DataTable simple_table = new DataTable();
simple_table.Columns.Add(new DataColumn("List", typeof(string)));
simple_table.Columns.Add(new DataColumn("Value", typeof(string)));
DataRow dr1 = simple_table.NewRow();
dr1["List"] = "waferID";
dr1["Value"] = waferID;
simple_table.Rows.Add(dr1);
DataRow dr2 = simple_table.NewRow();
dr2["List"] = "item개수";
dr2["Value"] = itemnum;
simple_table.Rows.Add(dr2);
DataRow dr3 = simple_table.NewRow();
dr3["List"] = "chip개수";
dr3["Value"] = chipnum;
simple_table.Rows.Add(dr3);
GridHeaders head = new GridHeaders();
head.AddGridColumn("List", "List", 60, HAlign.Center, true);
head.AddGridColumn("Value", "Value", 60, HAlign.Center, true);
//// 웨이퍼 ocx의 세부정보 출력.
//DataTable detail_table = new DataTable();
//detail_table.Columns.Add(new DataColumn("X", typeof(string)));
//detail_table.Columns.Add(new DataColumn("Y", typeof(string)));
////for (int i = 1; i <= itemnum; i++)
////{
////detail_table.Columns.Add(new DataColumn("Item" + i, typeof(string)));
//detail_table.Columns.Add(new DataColumn("Item", typeof(string)));
////}
//for (int i = 1; i <= chipnum; i++)
//{
// DataRow dr = detail_table.NewRow();
// //for(int j=1;j<=itemnum;j++)
// //{
// dr["X"] = strArray[i * 3 + 1].ToString();
// dr["Y"] = strArray[i * 3 + 2].ToString();
// //dr["Item" + j] = strArray[i * 3 + 3].ToString();
// dr["Item"] = strArray[i * 3 + 3].ToString();
// //}
// detail_table.Rows.Add(dr);
//}
//this.grdOutput.DataSource = detail_table;
//GridHeaders head1 = new GridHeaders();
//head1.AddGridColumn("X", "X", 60, HAlign.Center, true);
//head1.AddGridColumn("Y", "Y", 60, HAlign.Center, true);
////for (int i = 0; i <= itemnum; i++)
////{
//head1.AddGridColumn("Item", "Item", 60, HAlign.Center, true);
////}
//head1.SetColumns(this.grdOutput);
DataTable detail_table = new DataTable();
detail_table.Columns.Add(new DataColumn("X", typeof(string)));
detail_table.Columns.Add(new DataColumn("Y", typeof(string)));
DataTable table = null;
switch (_CompositeYN)
{
case "Y":
string[] arrWafer = this._CompositeWF.Split(' ');
for (int i = 0; i < arrWafer.Length; i++)
{
detail_table.Columns.Add(new DataColumn(arrWafer[i], typeof(string)));
}
for (int i = 1; i <= chipnum; i++)
{
DataRow dr = detail_table.NewRow();
dr["X"] = strArray[i * 3 + 1].ToString();
dr["Y"] = strArray[i * 3 + 2].ToString();
for (int j = 0; j < arrWafer.Length; j++)
{
int iRowCnt = (from m in DTOutputData.AsEnumerable()
where m.Field<string>("X") == strArray[i * 3 + 1].ToString() &&
m.Field<string>("Y") == strArray[i * 3 + 2].ToString() &&
m.Field<string>("ITEMID") == this._CompositeIT &&
m.Field<string>("WAFERID") == arrWafer[j]
select m).Count();
if (iRowCnt > 0)
{
table = (from m in DTOutputData.AsEnumerable()
where m.Field<string>("X") == strArray[i * 3 + 1].ToString() &&
m.Field<string>("Y") == strArray[i * 3 + 2].ToString() &&
m.Field<string>("ITEMID") == this._CompositeIT &&
m.Field<string>("WAFERID") == arrWafer[j]
select m).ToList().CopyToDataTable();
if (table != null && table.Rows.Count > 0)
{
dr[arrWafer[j]] = table.Rows[0]["VALUE"].ToString();
}
}
}
detail_table.Rows.Add(dr);
}
break;
case "N":
for (int i = 0; i < distinctItemid.Rows.Count; i++)
{
detail_table.Columns.Add(new DataColumn(distinctItemid.Rows[i][0].ToString(), typeof(string)));
}
for (int i = 1; i <= chipnum; i++)
{
DataRow dr = detail_table.NewRow();
dr["X"] = strArray[i * 3 + 1].ToString();
dr["Y"] = strArray[i * 3 + 2].ToString();
for (int j = 0; j < distinctItemid.Rows.Count; j++)
{
table = (from m in DTOutputData.AsEnumerable()
where m.Field<string>("X") == strArray[i * 3 + 1].ToString() &&
m.Field<string>("Y") == strArray[i * 3 + 2].ToString() &&
m.Field<string>("ITEMID") == distinctItemid.Rows[j][0].ToString() &&
m.Field<string>("WAFERID") == cbWaferID.Text
select m).ToList().CopyToDataTable();
if (table != null && table.Rows.Count > 0)
{
dr[distinctItemid.Rows[j][0].ToString()] = table.Rows[0]["VALUE"].ToString();
}
}
detail_table.Rows.Add(dr);
}
break;
}
this.grdOutput.DataSource = detail_table;
GridHeaders head1 = new GridHeaders();
head1.AddGridColumn("X", "X", 60, HAlign.Center, true);
head1.AddGridColumn("Y", "Y", 60, HAlign.Center, true);
switch (_CompositeYN)
{
case "Y":
string[] arrWafer = this._CompositeWF.Split(' ');
for (int i = 0; i < arrWafer.Length; i++)
{
head1.AddGridColumn(arrWafer[i], arrWafer[i], 120, HAlign.Center, true);
}
break;
case "N":
for (int i = 0; i < distinctItemid.Rows.Count; i++)
{
head1.AddGridColumn(distinctItemid.Rows[i][0].ToString(), distinctItemid.Rows[i][0].ToString(), 100, HAlign.Center, true);
}
break;
}
head1.SetColumns(this.grdOutput);
//Description 텍스트박스 채움
FillDescriptionTxt();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void waferMap1_OnEventSelectedCell() {
var model = waferMap1.ViewModel;
DataTable dtOutput = new DataTable();
dtOutput.Columns.Add("PARTID", typeof(string));
dtOutput.Columns.Add("WAFERID", typeof(string));
dtOutput.Columns.Add("X", typeof(string));
dtOutput.Columns.Add("Y", typeof(string));
dtOutput.Columns.Add("ITEMID", typeof(string));
dtOutput.Columns.Add("VALUE", typeof(string));
DataRow dr = null;
foreach(var die in model.Dies.SelectedDies){
dr = dtOutput.NewRow();
dr["PARTID"] = model.Tag.ToString();
dr["WAFERID"] = model.WaferID;
dr["X"] = die.Index.X;
dr["Y"] = die.Index.Y;
dr["ITEMID"] = model.itemName;
dr["VALUE"] = die.fValue;
dtOutput.Rows.Add(dr);
}
this.grdOutput.DataSource = dtOutput;
//this.grdOutput.DataSource = WaferMap_S.ViewModel.Dies.SelectedDies;
}
void axWaferMap1_DblClick(object sender, System.EventArgs e)
{
Revert();
}
/// <summary>
/// 원복 (대->소)
/// </summary>
private void Revert()
{
_CompositeYN = "N";
_PicType = "GalleryMode";
this.cbDrawMode.Enabled = false;
this.cbDrawMode.SelectedIndex = 0;
if (this.shiftPanel.ClientArea.Controls.Count == 0) return;
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.ClientArea.Controls.Add(this.pnGallery);
this.cbWaferID.Enabled = false;
if (this._isEPI)
{
this.cbItemID.Enabled = true;
DataTable dt = new DataTable();
this.grdLegend.DataSource = dt;
}
else
{
this.cbItemID.Enabled = false;
}
this.cbColumnCount.Enabled = true;
this.btnComposite.Enabled = true;
this._bWaferStat = false;
this.grdLegend.DisplayLayout.Override.HeaderCheckBoxVisibility = HeaderCheckBoxVisibility.Never;
if (this.grdLegend.DisplayLayout.Bands[0].Columns.Exists("CHK"))
this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].Hidden = true;
}
//Description 텍스트박스 채움
private void FillDescriptionTxt()
{
//this.txtDescription.Text =
// "WaferID : " + _selected[WAFERID]
// + Environment.NewLine + "DeviceID : " + _selected[DEVICEID]
// + Environment.NewLine + "Lotid : "// + _selected[]
// + Environment.NewLine + "LotType : " + _selected[ITEMGROUP]
// + Environment.NewLine + "MOCVDEQPID : "// + mocvdEqupID
// + Environment.NewLine + "Pocketno : "// + pocketNo
// + Environment.NewLine + "EventTime : "// + eventTime
// + Environment.NewLine + "AVG : " + _selected[DAVG]
// + Environment.NewLine + "STD : " + _selected[DSTD]
// + Environment.NewLine + "MEDIAN : " + _selected[DMEDIAN]
// + Environment.NewLine + "Yield : " + _selected[GOOD_RATIO];
//this.txtDescription.Text =
// "ItemID : " + _selected[ITEMID]
// + Environment.NewLine + "FactoryName : " + _selected[FACTORY]
// + Environment.NewLine + "ProductSpecGroup : " + _selected[PRODGROUP]
// + Environment.NewLine + "EQPID : " + _selected["EQPID"]
// + Environment.NewLine + "LotID : " + _selected["LOTID"]
// + Environment.NewLine + "WaferID : " + _selected[WAFERID]
// + Environment.NewLine + "DeviceID : " + _selected[DEVICEID] //PARTID
// + Environment.NewLine + "LotType : " + _selected[ITEMGROUP] //STEPSEQ
// + Environment.NewLine + "LSL : " + _selected[LSL]
// + Environment.NewLine + "USL : " + _selected[USL]
// + Environment.NewLine + "AVG(E) : " + _selected[DAVG_E]
// + Environment.NewLine + "AVG : " + _selected[DAVG]
// + Environment.NewLine + "STD : " + _selected[DSTD]
// + Environment.NewLine + "MEDIAN : " + _selected[DMEDIAN]
// + Environment.NewLine + "Yield : " + _selected[GOOD_RATIO];
this.txtDescription.Text =
"P-Area : " + _selected["PAREA"]
+ Environment.NewLine + "Step : " + _selected[ITEMGROUP] //STEPSEQ
+ Environment.NewLine + "PartID : " + _selected[DEVICEID] //PARTID
+ Environment.NewLine + "LotID : " + _selected["LOTID"]
+ Environment.NewLine + "WaferID : " + _selected[WAFERID]
+ Environment.NewLine + "EqpID : " + _selected["EQPID"]
+ Environment.NewLine + "Item : " + _selected[ITEMID]
+ Environment.NewLine + "Yield : " + _selected[GOOD_RATIO]
+ Environment.NewLine + "TestDie : " + _selected["TESTDIE"]
//2011.06.29. somi
+ Environment.NewLine + "Avg(E) : " + _selected[DAVG_E]
+ Environment.NewLine + "MocvdZone : " + _selected[MOCVDZONE]
+ Environment.NewLine + "MocvdPocketno : " + _selected[MOCVDPOCKETNO];
//
//this.txtDescription.Text =
// "P-Area : " + _selected["PAREA"]
// + Environment.NewLine + "Step : " + _selected[ITEMGROUP] //STEPSEQ
// + Environment.NewLine + "PartID : " + _selected[DEVICEID] //PARTID
// + Environment.NewLine + "LotID : " + _selected["LOTID"]
// + Environment.NewLine + "WaferID : " + _selected[WAFERID]
// + Environment.NewLine + "EqpID : " + _selected["EQPID"]
// + Environment.NewLine + "Item : " + _selected[ITEMID]
// + Environment.NewLine + "Yield : " + _selected[GOOD_RATIO]
// + Environment.NewLine + "TestDie : " + _selected["TESTDIE"]
// //2011.06.29.
// + Environment.NewLine + "Avg(E) : " + _selected[DAVG_E]
// + Environment.NewLine + "MocvdZone : " + _selected[MOCVDZONE]
// + Environment.NewLine + "MocvdPocketno : " + _selected[MOCVDPOCKETNO];
////
}
// 웨이퍼를 좌로 90도 돌리기 //2017-01-10 진행사항
private void ultraButton3_Click(object sender, EventArgs e)
{
//this.axWaferMap1.RotateViewer(-1);
}
// 웨이퍼를 우로 90도 돌리기
private void ultraButton4_Click(object sender, EventArgs e)
{
//this.axWaferMap1.RotateViewer(1);
}
private void btGallery_Click(object sender, EventArgs e)
{
this._CompositeYN = "N";
if (this.shiftPanel.ClientArea.Controls.Count == 0) return;
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.ClientArea.Controls.Add(this.pnGallery);
if (this._isEPI)
{
this.cbItemID.Enabled = true;
}
else
{
this.cbItemID.Enabled = false;
}
this.cbWaferID.Enabled = false;
this.cbColumnCount.Enabled = true;
this.btnComposite.Enabled = true;
}
private void cbColumnCount_ValueChanged(object sender, EventArgs e)
{
if (this.shiftPanel.Controls.Count == 0) return;
this.shiftPanel.Hide();
foreach (Control pn in pnGallery.Controls)
{
int size = Convert.ToInt32((shiftPanel.Width - 100) / (this.cbColumnCount.SelectedIndex + 1));
pn.Width = size;
pn.Height = size + 42;
}
this.shiftPanel.Show();
}
private void pnGallery_SizeChanged(object sender, EventArgs e)
{
if (this._isEPI && this.uchkTray.Checked)// tray 체크박스일때
return;
if (this.shiftPanel.Controls.Count == 0) return;
this.shiftPanel.Hide();
foreach (Control pn in pnGallery.Controls)
{
int size = (int)(Math.Truncate((double)(pnGallery.Width - 100) / (this.cbColumnCount.SelectedIndex + 1)));
pn.Width = size;
pn.Height = size + 42;
}
this.shiftPanel.Show();
}
private void btToExcel_Click(object sender, EventArgs e)
{
if (this.pnGallery.Controls.Count == 0) return;
try
{
//Saving to Excel file. This launches the Save dialog for the user to select the Save Path
//CreateExcel(FindSavePath());
DataSetToExcel(FindSavePath());
}
catch (Exception ex)
{
//Handle Exception
MessageBox.Show(ex.Message);
log.Error("btToExcel_Click", ex);
}
finally
{
//Any cleanup code
this.Cursor = Cursors.Default;
}
}
private void DataSetToExcel(String myFilepath)
{
if (myFilepath == null) return;
Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets.Add("WaferMap");
int iRow = 0;
int iCol = 0;
try
{
switch (_PicType)
{
case "TieMode":
{
Bitmap bmp1 = new Bitmap(this.chtSquare.Width, this.chtSquare.Height);
Bitmap bmp2 = new Bitmap(this.chtPie.Width, this.chtPie.Height);
this.chtSquare.DrawToBitmap(bmp1, new Rectangle(0, 0, bmp1.Width, bmp1.Height));
this.chtPie.DrawToBitmap(bmp2, new Rectangle(0, 0, bmp2.Width, bmp2.Height));
//Clipboard.SetImage(bmp1);
WorksheetImage imageShape1 = new Infragistics.Excel.WorksheetImage(bmp1);
WorksheetImage imageShape2 = new Infragistics.Excel.WorksheetImage(bmp2);
WorksheetCell cellPos1 = ws.Rows[1].Cells[1];
WorksheetCell cellPos2 = ws.Rows[1].Cells[10];
imageShape1.TopLeftCornerCell = cellPos1;
imageShape2.TopLeftCornerCell = cellPos2;
imageShape1.BottomRightCornerCell = cellPos1;
imageShape2.BottomRightCornerCell = cellPos2;
Rectangle rect1 = cellPos1.GetBoundsInTwips();
Rectangle rect2 = cellPos2.GetBoundsInTwips();
rect1.Width = rect1.Width * 3;
rect1.Height = rect1.Width;
rect2.Width = rect2.Width * 3;
rect2.Height = rect2.Width;
imageShape1.SetBoundsInTwips(ws, rect1);
imageShape2.SetBoundsInTwips(ws, rect2);
imageShape1.PositioningMode = ShapePositioningMode.MoveAndSizeWithCells;
imageShape2.PositioningMode = ShapePositioningMode.MoveAndSizeWithCells;
ws.Shapes.Add(imageShape1);
ws.Shapes.Add(imageShape2);
// 그리드1
if (this.grdAnal.Rows.Count > 0)
{
// Header
ws.Rows[0].Cells[5].Value = this.grdAnal.Rows.Band.Columns[0].Header.Caption;
ws.Rows[0].Cells[6].Value = this.grdAnal.Rows.Band.Columns[1].Header.Caption;
ws.Rows[0].Cells[7].Value = this.grdAnal.Rows.Band.Columns[2].Header.Caption;
ws.Rows[0].Cells[8].Value = this.grdAnal.Rows.Band.Columns[3].Header.Caption;
ws.Rows[0].Cells[5].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[6].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[7].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[8].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[5].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[6].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[7].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[8].CellFormat.Alignment = HorizontalCellAlignment.Center;
// List
for (int i = 0; i < this.grdAnal.Rows.Count; i++)
{
for (int j = 0; j < this.grdAnal.Rows[i].Cells.Count - 4; j++)
{
ws.Rows[i + 1].Cells[j + 5].Value = this.grdAnal.Rows[i].Cells[j].Value.ToString();
ws.Rows[i + 1].Cells[j + 5].CellFormat.Alignment = HorizontalCellAlignment.Right;
}
}
}
// 그리드2
if (this.grdCircle.Rows.Count > 0)
{
// Header
ws.Rows[0].Cells[14].Value = this.grdCircle.Rows.Band.Columns[0].Header.Caption;
ws.Rows[0].Cells[15].Value = this.grdCircle.Rows.Band.Columns[1].Header.Caption;
ws.Rows[0].Cells[16].Value = this.grdCircle.Rows.Band.Columns[2].Header.Caption;
ws.Rows[0].Cells[17].Value = this.grdCircle.Rows.Band.Columns[3].Header.Caption;
ws.Rows[0].Cells[14].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[15].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[16].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[17].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[14].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[15].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[16].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[17].CellFormat.Alignment = HorizontalCellAlignment.Center;
// List
for (int i = 0; i < this.grdCircle.Rows.Count; i++)
{
for (int j = 0; j < this.grdCircle.Rows[i].Cells.Count - 2; j++)
{
ws.Rows[i + 1].Cells[j + 14].Value = this.grdCircle.Rows[i].Cells[j].Value.ToString();
ws.Rows[i + 1].Cells[j + 14].CellFormat.Alignment = HorizontalCellAlignment.Right;
}
}
}
wb.Save(myFilepath);
}
break;
case "SingleMode":
//if (this.cbPArea.Text.Equals(EnumHelper.Parea.EPI.ToString()))
{
WorksheetImage imageShape = new Infragistics.Excel.WorksheetImage(_selectedPicBox.Image);
WorksheetCell cellPos = ws.Rows[1].Cells[1];
imageShape.TopLeftCornerCell = cellPos;
imageShape.BottomRightCornerCell = cellPos;
Rectangle rect = cellPos.GetBoundsInTwips();
rect.Width = rect.Width * 8;
rect.Height = rect.Width;
imageShape.SetBoundsInTwips(ws, rect);
imageShape.PositioningMode = ShapePositioningMode.MoveAndSizeWithCells;
ws.Shapes.Add(imageShape);
if (this.grdLegend.Rows.Count > 0)
{
// Header
ws.Rows[0].Cells[11].Value = this.grdLegend.Rows.Band.Columns[2].Header.Caption;
ws.Rows[0].Cells[12].Value = this.grdLegend.Rows.Band.Columns[3].Header.Caption;
ws.Rows[0].Cells[10].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[11].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[12].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[11].CellFormat.Alignment = HorizontalCellAlignment.Center;
ws.Rows[0].Cells[12].CellFormat.Alignment = HorizontalCellAlignment.Center;
if (this.grdLegend.Rows.Band.Columns[2].Header.Caption == "BIN")
{
ws.Rows[0].Cells[13].Value = this.grdLegend.Rows.Band.Columns[4].Header.Caption;
ws.Rows[0].Cells[13].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(247, 243, 239);
ws.Rows[0].Cells[13].CellFormat.Alignment = HorizontalCellAlignment.Center;
}
// List
for (int i = 0; i < this.grdLegend.Rows.Count; i++)
{
for (int j = 1; j < this.grdLegend.Rows[i].Cells.Count - 1; j++)
{
string strValue = this.grdLegend.Rows[i].Cells[j].Value.ToString();
if (strValue != string.Empty)
{
if (j == 1)
{
string[] arrRGB = strValue.Split(',');
ws.Rows[i + 1].Cells[j + 9].CellFormat.FillPatternBackgroundColor = System.Drawing.Color.FromArgb(int.Parse(arrRGB[0]), int.Parse(arrRGB[1]), int.Parse(arrRGB[2]));
}
else
{
ws.Rows[i + 1].Cells[j + 9].Value = strValue;
}
ws.Rows[i + 1].Cells[j + 9].CellFormat.Alignment = HorizontalCellAlignment.Right;
}
}
}
}
ws.Columns[0].Width = 4000;
ws.Columns[1].Width = 4000;
ws.Rows[0].Cells[0].Value = this.cbWaferID.Text;
ws.Rows[0].Cells[1].Value = this.cbItemID.Text;
wb.Save(myFilepath);
MessageBox.Show("Wafer Carrier image successfully downloaded to " + myFilepath);
}
break;
case "GalleryMode":
if (this.cbPArea.Text.Equals(EnumHelper.Parea.EPI.ToString()))
{
if (myFilepath == null) return;
ws.DefaultColumnWidth = 21600 / 30;
foreach (Control layoutCtrl in pnGallery.Controls)
{
WorksheetImage imageShape = new Infragistics.Excel.WorksheetImage(((PictureBox)layoutCtrl).Image);
ws.Rows[1].Height = (int)UIHelper.ToHalfAdjust((double)((PictureBox)layoutCtrl).Height * 20 / 1.5, 0);
ws.Columns[1].Width = (int)Math.Round((double)((PictureBox)layoutCtrl).Width * 256.0 / 5.4 / 1.5, MidpointRounding.AwayFromZero);
WorksheetCell cellPos = ws.Rows[1].Cells[1];
imageShape.TopLeftCornerCell = cellPos;
imageShape.BottomRightCornerCell = cellPos;
Rectangle rect = cellPos.GetBoundsInTwips();
rect.Height = rect.Width;
imageShape.SetBoundsInTwips(ws, rect);
imageShape.PositioningMode = ShapePositioningMode.MoveAndSizeWithCells;
ws.Shapes.Add(imageShape);
wb.Save(myFilepath);
MessageBox.Show("Wafer Carrier image successfully downloaded to " + myFilepath);
}
}
else
{
if (myFilepath == null) return;
//You need to Create the ExcelExporter component in the design view
ws.DefaultColumnWidth = 21600 / 30;
foreach (Control layoutCtrl in pnGallery.Controls)
{
if (layoutCtrl.GetType() == typeof(TableLayoutPanel))
{
Control[] ctrl = {((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 0)
, ((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 1)
, ((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 2)
, ((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 3)};
UltraCheckEditor chk = (UltraCheckEditor)ctrl[0];
Infragistics.Win.Misc.UltraLabel lbl = (Infragistics.Win.Misc.UltraLabel)ctrl[1];
Infragistics.Win.Misc.UltraLabel lb2 = (Infragistics.Win.Misc.UltraLabel)ctrl[2];
if (((TableLayoutPanel)layoutCtrl).Left < 10)
{
iCol = 1;
iRow += 3;
ws.Rows[iRow].Height = 300;
ws.Rows[iRow + 1].Height = (int)UIHelper.ToHalfAdjust((double)((PictureBox)ctrl[3]).Height * 20 / 1.5, 0);
}
ws.Columns[iCol].Width = (int)Math.Round((double)((PictureBox)ctrl[3]).Width * 256.0 / 5.4 / 1.5, MidpointRounding.AwayFromZero);
ws.Rows[iRow].Cells[iCol].Value = chk.Text + " " + lbl.Text;
ws.Rows[iRow].Cells[iCol].CellFormat.LeftBorderStyle = CellBorderLineStyle.Thin;
ws.Rows[iRow].Cells[iCol].CellFormat.RightBorderStyle = CellBorderLineStyle.Thin;
ws.Rows[iRow].Cells[iCol].CellFormat.TopBorderStyle = CellBorderLineStyle.Thin;
ws.Rows[iRow].Cells[iCol].CellFormat.BottomBorderStyle = CellBorderLineStyle.Thin;
ws.Rows[iRow].Cells[iCol].CellFormat.Alignment = HorizontalCellAlignment.Left;
//ws.Columns[iCol].Width = 6000;
ws.Columns[iCol].CellFormat.VerticalAlignment = VerticalCellAlignment.Center;
ws.Columns[iCol].CellFormat.Alignment = HorizontalCellAlignment.Left;
ws.Columns[iCol].CellFormat.Font.Name = "맑은고딕";
WorksheetImage imageShape = new Infragistics.Excel.WorksheetImage(((PictureBox)ctrl[3]).Image);
WorksheetCell cellPos = ws.Rows[iRow + 1].Cells[iCol];
imageShape.TopLeftCornerCell = cellPos;
//imageShape.TopLeftCornerPosition = new Point(0, 0);
imageShape.BottomRightCornerCell = cellPos;
//imageShape.BottomRightCornerPosition = new Point(100, 100);
Rectangle rect = cellPos.GetBoundsInTwips();
rect.Height = rect.Width;
imageShape.SetBoundsInTwips(ws, rect);
imageShape.PositioningMode = ShapePositioningMode.MoveAndSizeWithCells;
ws.Shapes.Add(imageShape);
iCol++;
}
}
wb.Save(myFilepath);
MessageBox.Show("Wafer image successfully downloaded to " + myFilepath);
}
break;
}
}
catch (Exception ex)
{
log.Error("DataSetToExcel", ex);
throw ex;
}
}
/// <summary>
/// Finding path for saving excel sheet.
/// </summary>
/// <returns>full path</returns>
private String FindSavePath()
{
Stream myStream;
string myFilepath = null;
try
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "excel files (*.xls)|*.xls";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
myFilepath = saveFileDialog1.FileName;
myStream.Close();
}
}
}
catch (Exception ex)
{
log.Error("Finding path for saving excel sheet.", ex);
throw ex;
}
return myFilepath;
}
private void pnGallery_Click(object sender, EventArgs e)
{
this.pnGallery.Focus();
}
private void grdLegend_ClickCellButton(object sender, CellEventArgs e)
{
string waferid = this.cbWaferID.Text;
string itemid = this.cbItemID.Text;
Popup.Y_ChipProperty chipproperty = new YMS.UI.Popup.Y_ChipProperty();
if (e.Cell.Column.Key == "COLOR")
{
Popup.Y_ChipProperty popupproperty = new YMS.UI.Popup.Y_ChipProperty();
if (popupproperty.ShowDialog(_selected, this, this.cbDB1.Text) == DialogResult.OK)
{
cbDB1.Tag = LoadXml();
// color를 변경할 때의 맵 패널이 gallery가 아니라, ocx라면.
//if (this.shiftPanel.ClientArea.Controls[0] == (Control)this.panelOCX)
if (_bWaferStat)
{
// 원래의 ocx가 나오도록.
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.Hide();
DrawGallery();
this.shiftPanel.ClientArea.Controls.Clear();
this.cbWaferID.ValueChanged -= new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbWaferID.Text = waferid;
this.cbWaferID.ValueChanged += new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbItemID.Text = itemid;
this.shiftPanel.ClientArea.Controls.Add(this.panelOCX);
this.shiftPanel.Show();
}
else
{
// 변경된 color로 gallery를 다시 그림.
DrawGallery();
}
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
MessageBox.Show("변경된 사항이 저장되었습니다.");
}
}
}
private void btnExecute_Click(object sender, EventArgs e)
{
try
{
this.Cursor = Cursors.WaitCursor;
InitAnalysis();
DataTable dt = grdAnal.DataSource as DataTable;
int cntX = int.Parse(cbX.Text);
int cntY = int.Parse(cbY.Text);
if (_selected.Count <= 0) return;
DataTable dtSpec = CheckData(_selected[DPOS].TrimEnd(','), _selected[DVALUE].TrimEnd(','));
if (dtSpec == null) return;
double dLSL = Convert.ToDouble(_selected[LSL]);
double dUSL = Convert.ToDouble(_selected[USL]);
double dMIN_X = Convert.ToDouble(_selected[MIN_X]);
double dMAX_X = Convert.ToDouble(_selected[MAX_X]);
double dMIN_Y = Convert.ToDouble(_selected[MIN_Y]);
double dMAX_Y = Convert.ToDouble(_selected[MAX_Y]);
double tot_X = dMAX_X - dMIN_X + 1;
double tot_Y = dMAX_Y - dMIN_Y + 1;
double devide_X = UIHelper.ToHalfAdjust(tot_X / cntX, 0);
double devide_Y = UIHelper.ToHalfAdjust(tot_Y / cntY, 0);
int minX = 0;
int maxX = 0;
int minY = 0;
int maxY = 0;
int seq = 0;
for (int y = cntY; y > 0; y--)
{
minY = Convert.ToInt32(dMAX_Y - (devide_Y * (cntY - y + 1)) + 1);
maxY = Convert.ToInt32(dMAX_Y - (devide_Y * (cntY - y)));
for (int x = 1; x <= cntX; x++)
{
seq++;
minX = Convert.ToInt32(dMIN_X + (devide_X * (x - 1)));
maxX = Convert.ToInt32(dMIN_X + (devide_X * (x))) - 1;
DataRow row = dt.NewRow();
row["GUBUN"] = seq.ToString();
row["MIN_X"] = minX;
row["MAX_X"] = maxX;
row["MIN_Y"] = minY;
row["MAX_Y"] = maxY;
row["YIELD"] = 0;
row["GCOUNT"] = 0;
row["NGCOUNT"] = 0;
dt.Rows.Add(row);
}
if (y == 1 && minY > Convert.ToInt32(dMIN_Y))
{
dt.Rows[seq - 1]["MIN_Y"] = Convert.ToInt32(dMIN_Y);
}
if (maxX < Convert.ToInt32(dMAX_X))
{
dt.Rows[seq - 1]["MAX_X"] = Convert.ToInt32(dMAX_X);
}
}
foreach (DataRow row in dtSpec.Rows)
{
foreach (DataRow sumRow in dt.Rows)
{
if (Convert.ToInt32(row["X"]) >= Convert.ToInt32(sumRow["MIN_X"])
&& Convert.ToInt32(row["X"]) <= Convert.ToInt32(sumRow["MAX_X"])
&& Convert.ToInt32(row["Y"]) >= Convert.ToInt32(sumRow["MIN_Y"])
&& Convert.ToInt32(row["Y"]) <= Convert.ToInt32(sumRow["MAX_Y"]))
{
sumRow["YIELD"] = Convert.ToInt32(sumRow["YIELD"]) + 1;
if (Convert.ToDouble(row["Value"]) >= dLSL && Convert.ToDouble(row["Value"]) <= dUSL)
{
sumRow["GCOUNT"] = Convert.ToInt32(sumRow["GCOUNT"]) + 1;
}
else
{
sumRow["NGCOUNT"] = Convert.ToInt32(sumRow["NGCOUNT"]) + 1;
}
}
}
}
DrawSquare(ref dt);
}
catch (Exception ex)
{
this.Cursor = Cursors.Default;
MessageBox.Show(ex.Message, "Square");
log.Error("btnExecute_Click", ex);
}
finally
{
this.Cursor = Cursors.Default;
}
}
private void DrawSquare(ref DataTable dt)
{
chtSquare.Clear();
chtSquare._X = int.Parse(cbX.Text);
chtSquare._Y = int.Parse(cbY.Text);
DataTable dtChart = new DataTable();
dtChart.Columns.Add("Value", typeof(double));
foreach (DataRow dtRow in dt.Rows)
{
dtRow["YIELD"] = (Convert.ToDouble(dtRow["GCOUNT"]) / Convert.ToDouble(dtRow["YIELD"]) * 100).ToString("N2");
DataRow row = dtChart.NewRow();
row["Value"] = dtRow["YIELD"];
dtChart.Rows.Add(row);
}
chtSquare._DataTable = dtChart;
chtSquare.Refresh();
}
private DataTable CheckData(string pos, string data)
{
DataTable dt = new DataTable();
string[] aPos = pos.Split('|');
string[] aData = data.Split(',');
if (aPos.Length != aData.Length || aPos.Length == 0) return null;
dt.Columns.Add("X", typeof(int));
dt.Columns.Add("Y", typeof(int));
dt.Columns.Add("Value", typeof(double));
dt.PrimaryKey = new DataColumn[] { dt.Columns["X"], dt.Columns["Y"] };
for (int i = 0; i < aData.Length; i++)
{
DataRow row = dt.NewRow();
string[] aPoint = aPos[i].Split(',');
row["X"] = Convert.ToInt32(aPoint[0]);
row["Y"] = Convert.ToInt32(aPoint[1]);
row["Value"] = Convert.ToDouble(aData[i]);
try { dt.Rows.Add(row); }
catch (Exception ex)
{
MessageBox.Show(ex.Message, this.Name + ".Analyze");
log.Error("CheckData", ex);
break;
}
}
return dt;
}
private void InitAnalysis()
{
GridHeaders heads = new GridHeaders();
heads.AddGridColumn("GUBUN", "No", 40, HAlign.Center, true);
heads.AddGridColumn("YIELD", "Yield", 50, HAlign.Right, true);
heads.AddGridColumn("GCOUNT", "Good", 60, HAlign.Right, true);
heads.AddGridColumn("NGCOUNT", "NG", 60, HAlign.Right, true);
heads.AddGridColumn("MIN_X", string.Empty, 0);
heads.AddGridColumn("MAX_X", string.Empty, 0);
heads.AddGridColumn("MIN_Y", string.Empty, 0);
heads.AddGridColumn("MAX_Y", string.Empty, 0);
heads.SetColumns(grdAnal);
grdAnal.DisplayLayout.AutoFitStyle = AutoFitStyle.None;
UltraGridBand band = grdAnal.DisplayLayout.Bands[0];
foreach (UltraGridColumn col in band.Columns)
{
col.Hidden = (col.Header.Caption == string.Empty);
}
SetDefault(grdAnal);
}
private void InitCircle()
{
GridHeaders heads = new GridHeaders();
heads.AddGridColumn("GUBUN", "No", 40, HAlign.Center, true);
heads.AddGridColumn("YIELD", "Yield", 50, HAlign.Right, true);
heads.AddGridColumn("GCOUNT", "Good", 60, HAlign.Right, true);
heads.AddGridColumn("NGCOUNT", "NG", 60, HAlign.Right, true);
heads.AddGridColumn("MIN_R", string.Empty, 0);
heads.AddGridColumn("MAX_R", string.Empty, 0);
heads.SetColumns(grdCircle);
grdCircle.DisplayLayout.AutoFitStyle = AutoFitStyle.None;
UltraGridBand band = grdCircle.DisplayLayout.Bands[0];
foreach (UltraGridColumn col in band.Columns)
{
col.Hidden = (col.Header.Caption == string.Empty);
}
SetDefault(grdCircle);
}
private void SetDefault(UltraGrid grd)
{
DataTable dt = new DataTable();
foreach (UltraGridColumn col in grd.DisplayLayout.Bands[0].Columns)
{
dt.Columns.Add(col.Key);
}
grd.DataSource = dt;
}
private void btnCircle_Click(object sender, EventArgs e)
{
try
{
this.Cursor = Cursors.WaitCursor;
InitCircle();
DataTable dt = grdCircle.DataSource as DataTable;
int cntR = int.Parse(cbCircle.Text);
if (_selected.Count <= 0) return;
DataTable dtSpec = CheckData(_selected[DPOS].TrimEnd(','), _selected[DVALUE].TrimEnd(','));
if (dtSpec == null) return;
double dLSL = Convert.ToDouble(_selected[LSL]);
double dUSL = Convert.ToDouble(_selected[USL]);
double dMIN_X = Convert.ToDouble(_selected[MIN_X]);
double dMAX_X = Convert.ToDouble(_selected[MAX_X]);
double dMIN_Y = Convert.ToDouble(_selected[MIN_Y]);
double dMAX_Y = Convert.ToDouble(_selected[MAX_Y]);
double tot_X = dMAX_X - dMIN_X + 1;
double tot_Y = dMAX_Y - dMIN_Y + 1;
double wieght = tot_X / tot_Y;
int Center_X = Convert.ToInt32((dMAX_X + dMIN_X) / 2.0);
int Center_Y = Convert.ToInt32((dMAX_Y + dMIN_Y) / 2.0);
double devide_R = UIHelper.ToHalfAdjust(tot_X / 2.0 / cntR, 0);
int minR = 0;
int maxR = 0;
int seq = 0;
for (int r = 1; r <= cntR; r++)
{
seq++;
minR = Convert.ToInt32(devide_R * (r - 1));
maxR = Convert.ToInt32(devide_R * (r)) - 1;
DataRow row = dt.NewRow();
row["GUBUN"] = seq.ToString();
row["MIN_R"] = minR;
row["MAX_R"] = maxR;
row["YIELD"] = 0;
row["GCOUNT"] = 0;
row["NGCOUNT"] = 0;
dt.Rows.Add(row);
}
if (maxR < Convert.ToInt32(Math.Ceiling(tot_X / 2.0)))
{
dt.Rows[seq - 1]["MAX_R"] = Convert.ToInt32(Math.Ceiling(tot_X / 2.0));
}
foreach (DataRow row in dtSpec.Rows)
{
int distance = this.distance(new Point(Center_X, Center_Y), new Point(Convert.ToInt32(row["X"]), Convert.ToInt32(row["Y"])), wieght);
foreach (DataRow sumRow in dt.Rows)
{
if (sumRow["GUBUN"].Equals(cntR.ToString()))
{
if (distance >= Convert.ToInt32(sumRow["MIN_R"]))
{
sumRow["YIELD"] = Convert.ToInt32(sumRow["YIELD"]) + 1;
if (Convert.ToDouble(row["Value"]) >= dLSL && Convert.ToDouble(row["Value"]) <= dUSL)
{
sumRow["GCOUNT"] = Convert.ToInt32(sumRow["GCOUNT"]) + 1;
}
else
{
sumRow["NGCOUNT"] = Convert.ToInt32(sumRow["NGCOUNT"]) + 1;
}
}
}
else
{
if (distance >= Convert.ToInt32(sumRow["MIN_R"])
&& distance <= Convert.ToInt32(sumRow["MAX_R"]))
{
sumRow["YIELD"] = Convert.ToInt32(sumRow["YIELD"]) + 1;
if (Convert.ToDouble(row["Value"]) >= dLSL && Convert.ToDouble(row["Value"]) <= dUSL)
{
sumRow["GCOUNT"] = Convert.ToInt32(sumRow["GCOUNT"]) + 1;
}
else
{
sumRow["NGCOUNT"] = Convert.ToInt32(sumRow["NGCOUNT"]) + 1;
}
}
}
}
}
DrawPie(ref dt);
}
catch (Exception ex)
{
this.Cursor = Cursors.Default;
MessageBox.Show(ex.Message, "Circle");
log.Error("btnCircle_Click", ex);
}
finally
{
this.Cursor = Cursors.Default;
}
}
private void DrawPie(ref DataTable dt)
{
chtPie.Clear();
chtPie._Marjin = 10;
DataTable dtChart = new DataTable();
dtChart.Columns.Add("Value1", typeof(int));
dtChart.Columns.Add("Value2", typeof(int));
for (int i = dt.Rows.Count; i > 0; i--)
{
dt.Rows[i - 1]["YIELD"] = (Convert.ToDouble(dt.Rows[i - 1]["GCOUNT"]) / Convert.ToDouble(dt.Rows[i - 1]["YIELD"]) * 100).ToString("N2");
DataRow row = dtChart.NewRow();
row["Value2"] = Convert.ToInt32(dt.Rows[i - 1]["GCOUNT"]);
row["Value1"] = Convert.ToInt32(dt.Rows[i - 1]["NGCOUNT"]);
dtChart.Rows.Add(row);
}
chtPie._DataTable = dtChart;
chtPie.Refresh();
}
private int distance(Point p1, Point p2, double wieght)
{
int i = 0;
try
{
double p = UIHelper.ToHalfAdjust(Math.Sqrt(Math.Pow(p2.X - p1.X, 2) + Math.Pow((p2.Y - p1.Y) * wieght, 2)), 0);
i = Convert.ToInt32(p);
}
catch
{
log.Error("distance");
}
return i;
}
private void ClearListView(params UltraListView[] listView)
{
foreach (UltraListView list in listView)
{
list.Items.Clear();
}
}
private string _CompositeYN = "N";
private string _CompositeWF = string.Empty;
private string _CompositeIT = string.Empty;
//여기 주석풀고 테스트해보기 = 요청자
private void btnComposite_Click(object sender, EventArgs e)
{
/* Composite 기능 */
try
{
/*
int cnt = 0;
string itemID = string.Empty;
string waferID = string.Empty;
string fmkey = string.Empty;
string deviceID = string.Empty;
int iRow = 0;
string duplication = string.Empty;
this._listComposition.Clear();
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
iRow++;
}
string[] sKey = new string[iRow];
iRow = 0;
foreach (KeyValuePair<string, Dictionary<string, string>> value in waferInfo)
{
sKey[iRow] = value.Key;
iRow++;
}
iRow = 0;
foreach (Control layoutCtrl in pnGallery.Controls)
{
if (layoutCtrl.GetType() == typeof(TableLayoutPanel))
{
bool chk = false;
Control[] ctrl = {((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 0)
, ((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 1)
, ((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0, 2)};
if (ctrl[0].GetType() == typeof(UltraCheckEditor))
{
chk = ((UltraCheckEditor)ctrl[0]).Checked;
if (chk)
{
Dictionary<string, string> ht = waferInfo[sKey[iRow]];
this._listComposition.Add(ht); // composition 대상 추가
// 같은 아이템만 composite 가능하게
if (duplication != ht[ITEMID] && duplication != string.Empty)
{
MessageBox.Show("같은 아이템으로만 composition이 가능합니다");
return;
}
else
duplication = ht[ITEMID];
itemID = ht[ITEMID];
waferID += ht[WAFERID] + " ";
string spec = ht[MIN_X] + "," + ht[MAX_X] + "," + ht[MIN_Y] + "," + ht[MAX_Y];
string partid = ht["PARTID"];*/
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
/*
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
*/
#endregion
/*
cnt++;
if (cnt == 1)
{
DrawLegend(ht[FACTORY], ht[WAFERID], ht[FMKEY], ht[ITEMGROUP], ht[ITEMID], ht[DEVICEID]);
DrawMap(ht[WAFERID], ht[ITEMID], ht[DVALUE], spec, ht[DPOS], true);
// multiMap1.makeBinMap();
// this.shiftPanel.ClientArea.Controls.Add(multiMap1);
}
else
{
DrawMapAdd(ht[WAFERID], ht[ITEMID], ht[DVALUE], spec, ht[DPOS]);
}
}
}
}
iRow++;
}*/
//기존코드 끝
//2017-01-13
List<string[]> checkedWafers = new List<string[]>(); // 체크된 WaferID와 ItemID저장
foreach (Control layoutCtrl in pnGallery.Controls)
{
if (layoutCtrl.GetType() == typeof(TableLayoutPanel))
{
bool chk = false;
Control[] ctrl = {
((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0,0), //Checkbox, WaferID
((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0,1), //Lot ID
((TableLayoutPanel)layoutCtrl).GetControlFromPosition(0,2) //Item ID
};
if (ctrl[0].GetType() == typeof(UltraCheckEditor))
{
chk = ((UltraCheckEditor)ctrl[0]).Checked;
checkedWafers.Add(new string[] { ctrl[0].Text, ctrl[2].Text });
}
}
}
if (checkedWafers.Count == 0)
MessageBox.Show("Composition 아이템을 선택하세요.");
else
{
//Wafer itemID가 다를 경우를 check
string commonItemid = string.Empty;
bool bCompositable = true;
foreach (string[] str in checkedWafers)
{
//str[0] == WaferID
//str[1] == ItemID
if (commonItemid.Equals(string.Empty))
{
commonItemid = str[1];
}
else
{
if (!commonItemid.Equals(str[1]))
{ //Empty가 아닌 tmpItemid와 불러온 두번째부터의 itemId가 같지않을때
bCompositable = false;
break;
}
}
}
Dictionary<string, string> cModelInfo = new Dictionary<string, string>();
Dictionary<Point, float> cModelDieDict = new Dictionary<Point, float>();
List<WaferViewModel> lstModel = new List<WaferViewModel>();
if (bCompositable)
{
cModelInfo["WAFERID"] = "CompositedWafer";
cModelInfo["ITEMID"] = commonItemid;
cModelInfo["FMKEY"] = "CompositedWafer";
int wafersCount = 0;
foreach (string[] str in checkedWafers)
{
WaferViewModel m = findWafer(str[0], str[1]);
lstModel.Add(m);
//Parallel.ForEach(m.Dies, (die) =>
foreach(var die in m.Dies){
if(cModelDieDict.ContainsKey(die.Index)){
cModelDieDict[die.Index] += die.fValue;
}
else{
cModelDieDict.Add(die.Index, die.fValue);
}
}
wafersCount += 1;
}
Parallel.For(0, cModelDieDict.Count, i => {
Point key = cModelDieDict.Keys.ToList()[i];
cModelDieDict[key] /= wafersCount;
});
int CompositedModel_MAX_X = int.MinValue;
int CompositedModel_MAX_Y = int.MinValue;
int CompositedModel_MIN_X = int.MaxValue;
int CompositedModel_MIN_Y = int.MaxValue;
foreach (WaferViewModel model in lstModel)
{
if (CompositedModel_MAX_X <= model.max_x)
CompositedModel_MAX_X = model.max_x;
if (CompositedModel_MAX_Y <= model.max_y)
CompositedModel_MAX_Y = model.max_y;
if (CompositedModel_MIN_X >= model.min_x)
CompositedModel_MIN_X = model.min_x;
if (CompositedModel_MIN_Y >= model.min_y)
CompositedModel_MIN_Y = model.min_y;
}
cModelInfo["MAX_X"] = CompositedModel_MAX_X.ToString();
cModelInfo["MIN_X"] = CompositedModel_MIN_X.ToString();
cModelInfo["MAX_Y"] = CompositedModel_MAX_Y.ToString();
cModelInfo["MIN_Y"] = CompositedModel_MIN_Y.ToString();
cModelInfo["PARTID"] = "CompositedWafer";
}
WaferViewModel CompositedModel = makeWaferViewModelFromDb(cModelInfo, cModelDieDict);
DrawMap(CompositedModel, legendArray);
}//else문 끝
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void Y_WaferMap_FormClosing(object sender, FormClosingEventArgs e)
{
this.shiftPanel.ClientArea.Controls.Clear();
}
private void cbColumnCount_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back)))
{
e.Handled = true;
}
}
#region SearchByLot 버튼 클릭
private void ubtnSearchByLot_Click(object sender, EventArgs e)
{
try
{
// 새롭게 바뀐 간단 Search By Lot
YMS.UI.Popup.Y_SearchByLotPop pop = new YMS.UI.Popup.Y_SearchByLotPop();
if (pop.ShowDialog() == DialogResult.OK)
{
this.ClearListView(ctlLotID.listView, ctlWaferID.listView);
foreach (string lotID in pop.LotIDs)
{
UltraListViewItem item = new UltraListViewItem();
item.Key = lotID;
item.Value = lotID;
if (!this.ctlLotID.listView.Items.Exists(item.Key))
{
this.ctlLotID.listView.Items.Add(item);
item.CheckState = CheckState.Checked;
}
}
this.ctlWaferID.btSearch.PerformClick();
}
#if false
// 거꾸로 찾기의 Search by Lot
if (this.ctlLotID.listView.CheckedItems.Count < 1)
{
MessageBox.Show("Lot ID를 선택하십시오");
return;
}
try
{
this.ctlProductGroup.listView.Items.Clear();
this.ctlProcessID.listView.Items.Clear();
this.ctlDeviceID.listView.Items.Clear();
string fromDate = string.Format("{0:yyyyMMdd}", this.datetime_dateFrom.Value);
string toDate = string.Format("{0:yyyyMMdd}", this.datetime_dateTo.Value);
string lineID = this.cblineID.Text;
string LotID = QueryHelper.converter(this.ctlLotID.listView.CheckedItems);
this.ClearListView(ctlProductGroup.listView, ctlProcessID.listView, ctlDeviceID.listView, ctlWaferID.listView);
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_YMS_MAP.Get_PPPByLotID";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINFACTORY, lineID, OracleType.VarChar);
oraParam.Add(EnumHelper.VINLOTID, QueryHelper.ConvertToInSTR(LotID), OracleType.VarChar);
oraParam.Add(EnumHelper.VINFDATE, fromDate, OracleType.VarChar);
oraParam.Add(EnumHelper.VINTDATE, toDate, OracleType.VarChar);
DataTable dt = DBHelper.FillDataTable(oraParam);
foreach (DataRow dr in dt.Rows)
{
UltraListViewItem item1 = new UltraListViewItem();
item1.Key = (string)dr["PRODUCTSPECGROUP"];
item1.Value = (string)dr["PRODUCTSPECGROUP"];
//item1.CheckState = CheckState.Checked;
UltraListViewItem item2 = new UltraListViewItem();
item2.Key = (string)dr["PROCESSFLOWNAME"];
item2.Value = (string)dr["PROCESSFLOWNAME"];
//item2.CheckState = CheckState.Checked;
UltraListViewItem item3 = new UltraListViewItem();
item3.Key = (string)dr["PRODUCTSPECNAME"];
item3.Value = (string)dr["PRODUCTSPECNAME"];
//item3.CheckState = CheckState.Checked;
if (!this.ctlProductGroup.listView.Items.Exists(item1.Key))
this.ctlProductGroup.listView.Items.Add(item1);
if (!this.ctlProcessID.listView.Items.Exists(item2.Key))
this.ctlProcessID.listView.Items.Add(item2);
if (!this.ctlDeviceID.listView.Items.Exists(item3.Key))
this.ctlDeviceID.listView.Items.Add(item3);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
#endif
}
catch (Exception ex)
{
log.Error("SearchByLot 버튼 클릭", ex);
MessageBox.Show(ex.Message);
}
}
#endregion
#region Tray 체크박스
private void uchkTray_CheckedChanged(object sender, EventArgs e)
{
if ((string)this.cbPArea.Value == "EPI")
{
if (((UltraCheckEditor)sender).Checked)
{
this.ctlWaferID.Enabled = false;
}
else
{
this.ctlWaferID.Enabled = true;
}
}
this.ctlLotID.btSearch.PerformClick();
}
#endregion
private void cbDB1_ValueChanged(object sender, EventArgs e)
{
// COLOR정보를 DB에서 읽어올 지, PC에서 읽어올 지 선택. 값이 변경되면 GALLERY에 적용.
//if (this.shiftPanel.ClientArea.Controls[0] == (Control)this.panelOCX)
if (this._bWaferStat)
{
string waferid = _selected[WAFERID];
string itemid = _selected[ITEMID];
// 원래의 ocx가 나오도록.
this.shiftPanel.ClientArea.Controls.Clear();
this.shiftPanel.Hide();
DrawGallery();
this.shiftPanel.ClientArea.Controls.Clear();
this.cbWaferID.ValueChanged -= new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbWaferID.Text = waferid;
this.cbWaferID.ValueChanged += new System.EventHandler(this.cbWaferID_ValueChanged);
this.cbItemID.Text = itemid;
this.shiftPanel.ClientArea.Controls.Add(this.panelOCX);
this.shiftPanel.Show();
DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
}
else
{
// 변경된 color로 gallery를 다시 그림.
if (this._isEPI)
{
DrawGalleryEPI();
}
else
{
DrawGallery();
}
DataTable dt = this.grdLegend.DataSource as DataTable;
if (dt == null) return;
else dt.Clear();
}
}
#region Legend 헤더체크
private void grdLegend_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
{
if (e.Column.GetHeaderCheckedState(this.grdLegend.Rows) == CheckState.Checked)
{
e.Column.SetHeaderCheckedState(this.grdLegend.Rows, true);
}
else if (e.Column.GetHeaderCheckedState(this.grdLegend.Rows) == CheckState.Indeterminate)
{
//e.Column.SetHeaderCheckedState(this.grdLegend.Rows, true);
//int cnt = 0;
//foreach (UltraGridRow row in this.grdLegend.Rows)
//{
// if (row.Cells["CHK"].Value != null && row.Cells["CHK"].Value.ToString() == "True")
// {
// cnt++;
// }
//}
//this.grdLegend.AfterHeaderCheckStateChanged -= new Infragistics.Win.UltraWinGrid.AfterHeaderCheckStateChangedEventHandler(this.grdLegend_AfterHeaderCheckStateChanged);
//if (cnt == 0)
//{
// e.Column.SetHeaderCheckedState(this.grdLegend.Rows, false);
//}
//else if (cnt == this.grdLegend.Rows.Count)
//{
// e.Column.SetHeaderCheckedState(this.grdLegend.Rows, true);
//}
//this.grdLegend.AfterHeaderCheckStateChanged += new Infragistics.Win.UltraWinGrid.AfterHeaderCheckStateChangedEventHandler(this.grdLegend_AfterHeaderCheckStateChanged);
}
else
{
e.Column.SetHeaderCheckedState(this.grdLegend.Rows, false);
}
this.DrawMapByLegend();
}
#endregion
#region Legend 체크박스 클릭
private void grdLegend_ClickCell(object sender, ClickCellEventArgs e)
{
if (e.Cell.Column.Style == Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox)
{
// Legend 체크박스 클릭시 체크상태가 바로바뀌지 않음
// DrawMap 함수 호출시 현재 체크된 값을 이용하여 wafer를 그리기 때문에 DrawMap 호출을 지연시켜야함
this._timerLegend.Start();
}
}
void _timerLegend_Tick(object sender, EventArgs e)
{
this.DrawMapByLegend();
#region //
//int cnt = 0;
//foreach (UltraGridRow row in this.grdLegend.Rows)
//{
// if (row.Cells["CHK"].Value != null && row.Cells["CHK"].Value.ToString() == "True")
// {
// cnt++;
// }
//}
//this.grdLegend.AfterHeaderCheckStateChanged -= new Infragistics.Win.UltraWinGrid.AfterHeaderCheckStateChangedEventHandler(this.grdLegend_AfterHeaderCheckStateChanged);
//if (cnt == 0)
//{
// this.grdLegend_AfterHeaderCheckStateChanged(this.grdLegend, new AfterHeaderCheckStateChangedEventArgs(this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"], this.grdLegend.Rows));
//this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].SetHeaderCheckedState(this.grdLegend.Rows, false);
//e.Cell.Column.SetHeaderCheckedState(this.grdLegend.Rows, false);
//}
//else if (cnt == this.grdLegend.Rows.Count)
//{
// this.grdLegend_AfterHeaderCheckStateChanged(this.grdLegend, new AfterHeaderCheckStateChangedEventArgs(this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"], this.grdLegend.Rows));
//this.grdLegend.DisplayLayout.Bands[0].Columns["CHK"].SetHeaderCheckedState(this.grdLegend.Rows, true);
//e.Cell.Column.SetHeaderCheckedState(this.grdLegend.Rows, true);
//}
//this.grdLegend.AfterHeaderCheckStateChanged += new Infragistics.Win.UltraWinGrid.AfterHeaderCheckStateChangedEventHandler(this.grdLegend_AfterHeaderCheckStateChanged);
#endregion
this._timerLegend.Stop();
}
#endregion
#region Legend 체크박스 클릭시 맵그리기
private void DrawMapByLegend()
{
// Wafer가 큰화면으로 나올때만 이벤트 처리해야함
if (!this._bWaferStat)
return;
//MessageBox.Show(string.Format("Row index:{0}\r\nValue:{1}", e.Cell.Row.Index, e.Cell.Value.ToString()));
this.shiftPanel.ClientArea.Controls.Clear();
this.Cursor = Cursors.WaitCursor;
string spec = _selected[MIN_X] + "," + _selected[MAX_X] + "," + _selected[MIN_Y] + "," + _selected[MAX_Y];
string partid = _selected["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
*/
#endregion
//this.axWaferMap1.DeleteAllWaferData();
//DrawLegend(_selected[FACTORY], _selected[WAFERID], _selected[FMKEY], _selected[ITEMGROUP], _selected[ITEMID], _selected[DEVICEID]);
if (this.btnComposite.Enabled)
{
for (int i = 0; i < this._listComposition.Count; i++)
{
if (i == 0) // 처음엔 DrawMap
{
DrawMap(this._listComposition[i][WAFERID],
this._listComposition[i][ITEMID],
this._listComposition[i][DVALUE],
spec,
this._listComposition[i][DPOS],
true,
false);
continue;
}
// 두번째 부터 DrawMapAdd
this.DrawMapAdd(this._listComposition[i][WAFERID],
this._listComposition[i][ITEMID],
this._listComposition[i][DVALUE],
spec,
this._listComposition[i][DPOS]);
}
}
else
{
//DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false, false);
DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false, true);
}
this.shiftPanel.ClientArea.Controls.Add(this.panelOCX);
//this.axWaferMap1.SetDrawItemName(_selected[ITEMID]);
this.Cursor = Cursors.Default;
}
#endregion
#region Output에서 Control + C 로 클립보드에 복사
private void grdOutput_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == (Keys.Control | Keys.C))
{
Clipboard.Clear();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("X\tY\tItem\r\n");
foreach (UltraGridRow row in this.grdOutput.Rows)
{
//if (row.Selected)
sb.AppendFormat("{0}\t{1}\t{2}\r\n", row.Cells[0].Value.ToString(), row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString());
}
Clipboard.SetText(sb.ToString());
}
}
#endregion
#region Item 리스트 변경
private void lvItem_ItemCheckStateChanged(object sender, ItemCheckStateChangedEventArgs e)
{
// total count
int iChkCnt = 0;
int iTotalRowCnt = this.lvItem.Items.Count;
foreach (UltraListViewItem item in this.lvItem.Items)
{
if (item.CheckState == CheckState.Checked)
{
iChkCnt++;
}
}
this.gbItem.Text = "Item" + " [" + iChkCnt + "/" + iTotalRowCnt + "]";
}
private void lvItem_ItemSelectixxxxxxonChanged(object sender, ItemSelectixxxxxxonChangedEventArgs e)
{
this.cbWaferID.Text = string.Empty;
this.cbItemID.Text = string.Empty;
this.cbLotID.Text = string.Empty;
this.cbWaferID.Items.Clear();
this.cbItemID.Items.Clear();
this.cbLotID.Items.Clear();
this.pnGallery.Controls.Clear();
e.SelectedItems.SetCheckState(CheckState.Checked);
// total count
int iChkCnt = 0;
int iTotalRowCnt = this.lvItem.Items.Count;
foreach (UltraListViewItem item in this.lvItem.Items)
{
if (item.CheckState == CheckState.Checked)
{
iChkCnt++;
}
}
this.gbItem.Text = "Item" + " [" + iChkCnt + "/" + iTotalRowCnt + "]";
}
private void lvItem_ItemSelectionChanging(object sender, ItemSelectionChangingEventArgs e)
{
foreach (UltraListViewItem item in this.lvItem.SelectedItems)
{
if (!e.SelectedItems.Contains(item)) item.CheckState = CheckState.Unchecked;
}
}
#endregion
private void chkAllItem_CheckedChanged(object sender, EventArgs e)
{
switch (this.chkAllItem.CheckState)
{
case CheckState.Checked:
foreach (UltraListViewItem item in this.lvItem.Items)
{
item.CheckState = CheckState.Checked;
}
break;
case CheckState.Unchecked:
foreach (UltraListViewItem item in this.lvItem.Items)
{
item.CheckState = CheckState.Unchecked;
}
break;
}
}
// Map 연계분석 Excel 저장
private void btnTieExcel_Click(object sender, EventArgs e)
{
string strType = _PicType;
_PicType = "TieMode";
string strFilePath = FindSavePath();
if (strFilePath != null)
{
DataSetToExcel(strFilePath);
}
_PicType = strType;
}
private void cbDrawMode_ValueChanged(object sender, EventArgs e)
{
if (_selected.Count > 0)
{
string spec = _selected[MIN_X] + "," + _selected[MAX_X] + "," + _selected[MIN_Y] + "," + _selected[MAX_Y];
string partid = _selected["PARTID"];
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
DataTable dt = get_MapSpec("L");
for (int i = 0; i < dt.Rows.Count; i++)
{
if (partid == dt.Rows[i][1].ToString())
{
spec = dt.Rows[i][2].ToString();
}
}
/*
if (partid == "PBS7830-S3B-G-4I" || partid == "PBS7830-S3B-E-4I" || partid == "PBS7830-S3B-ES-4I")
{
spec = "-135,100,-70,45";
}
` */
#endregion
DrawMap(_selected[WAFERID], _selected[ITEMID], _selected[DVALUE], spec, _selected[DPOS], false);
}
}
/// <summary>
/// Help Popup
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnHelp_Click(object sender, EventArgs e)
{
YMS.UI.Popup.Y_HelpPop pop = new YMS.UI.Popup.Y_HelpPop(this.GetType().ToString(), UserInfo.UserID);
if (pop.ShowDialog() == DialogResult.OK)
{
}
}
private void btnCompositePartID_Click(object sender, EventArgs e)
{
if (waferInfo.Count == 0)
{
MessageBox.Show("조회 결과가 존재하지 않습니다.");
return;
}
}
private void btnCompositeLotID_Click(object sender, EventArgs e)
{
if (waferInfo.Count == 0)
{
MessageBox.Show("조회 결과가 존재하지 않습니다.");
return;
}
}
private void getYieldList()
{
/*
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_COMMON.GET_YIELDLIST";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add(EnumHelper.VINENUMNAME, QueryHelper.GetQueryStr("YieldList"), OracleType.VarChar);
//oraParam.Add(EnumHelper.VINENUMVALUE, QueryHelper.GetQueryStr(this.cbYield.Text), OracleType.VarChar);
//this.cbYield.DataSource = DBHelper.FillDataTable(oraParam);
this.cbYield.DataSource = DBHelper.FillDataTable(oraParam);
*/
CommonService.InitYieldListCheckBox(this.cbYield, new string[] { "ALL" }, "YieldList", false);
/* ComboBoxList Header 지우기 */
/*
foreach (UltraGridBand band in cbYield.DisplayLayout.Bands)
{
band.ColHeadersVisible = false;
band.GroupHeadersVisible = false;
}
foreach (UltraGridColumn c in cbYield.DisplayLayout.Bands[0].Columns)
{
c.Hidden = true;
}
UltraGridColumn col = cbYield.DisplayLayout.Bands[0].Columns["DESCRIPTION"];
col.Width = cbYield.Width;
col.Hidden = false;
col.Header.VisiblePosition = 0;
//this.DisplayLayout.Bands[0].GroupHeadersVisible = false;
*/
cbYield.DisplayMember = "DESCRIPTION";
//this.cbYield.Text = "ALL";
this.cbYield.Text = "ALL";
//this.cbYield.DisplayMember = "DESCRIPTION";
//this.ultraCombo1.DisplayMember = "DESCRIPTION";
}
#region 4inch 신규 Device의 특성 Map Display 요청
/****************************************
* 요 청 일 : 2013-03-04
* 요청문서 : Y-13-0068
* 요청내용 : 4inch 신규 Device의 특성 Map Display 요청
* 처 리 일 : 2013-03-06
* 처리내용 : yms_mapspec 값 저장 map 표현
****************************************/
private DataTable get_MapSpec(string maptype)
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_COMMON.GET_MAPSPEC";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add("vInMAPTYPE", maptype, OracleType.VarChar);
DataTable dt = DBHelper.FillDataTable(oraParam);
return dt;
//oraParam.Add(EnumHelper.VINENUMVALUE, QueryHelper.GetQueryStr(this.cbYield.Text), OracleType.VarChar);
}
#endregion
#region Map Chart 전체 선택 CheckBox
private void chkAll_CheckedChanged(object sender, EventArgs e)
{
if (this.pnGallery.Controls.Count == 0) return;
try
{
switch (_PicType)
{
case "GalleryMode":
if (this.cbPArea.Text.Equals(EnumHelper.Parea.EPI.ToString()))
{
return;
}
else
{
foreach (Control layoutCtrl in pnGallery.Controls) // Map Chart 순서대로
{
foreach (Control c in layoutCtrl.Controls) // Map Chart 별 Controls
{
try
{
if (chkAll.Checked)
{
((UltraCheckEditor)c).Checked = true;
}
else
{
((UltraCheckEditor)c).Checked = false;
}
}
catch // CheckBox 가 아닌경우 Continue 처리
{
continue;
}
}
}
}
break;
}
}
catch (Exception ex)
{
log.Error("DataSetToExcel", ex);
throw ex;
}
}
#endregion
#region LotGroup 기능 추가
/* ***************************************
* 요청서ID : Y-13-0033
* 요청일 : 2012-05-21
* 요청내용 : 품질분석- MAP 분석, LotGroup 기능 추가
* 처리일 : 2013-06-18
* 처리내용 : ctlLotID_LotGroupClicked(object sender, EventArgs e) 추가
* ***************************************/
void ctlLotID_LotGroupClicked(object sender, EventArgs e)
{
MyLotGrpDlg dlg = new MyLotGrpDlg(this.cblineID.Text, this.cbPArea.Text);
dlg.StartPosition = FormStartPosition.CenterParent;
dlg.PAreaEnabled(true);
string sGroupKeys = string.Empty;
this.ClearListView(this.ctlLotID.listView, this.ctlProductGroup.listView,
this.ctlProcessID.listView, this.ctlDeviceID.listView);
if (dlg.ShowDialog() == DialogResult.OK)
{
sGroupKeyOption = dlg.RET_Kind;
sGroupKeys = dlg.RET_GrpCd;
sGroupKeyArea = dlg.RET_PArea;
DataTable LotWaferGroupM = null;
string[] gk = sGroupKeys.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
if (gk.Length > 0)
{
OracleDataParameter oraParam = new OracleDataParameter();
oraParam.QueryName = "MDW_YMS_LOTGROUP.Get_GroupDetail_MAP";
oraParam.CommandType = CommandType.StoredProcedure;
oraParam.Add("vInGroupkey", sGroupKeys, OracleType.VarChar);
oraParam.Add("numInDebug", 0, OracleType.Number);
LotWaferGroupM = DBHelper.FillDataTable(oraParam);
this.ctlLotID.Refresh(oraParam, this.ctlLotID.APPEND, LotWaferGroupM);
}
}
}
#endregion
private void waferMap1_Load(object sender, EventArgs e)
{
}
//2017-01-10
public WaferViewModel makeWaferViewModelFromDb(Dictionary<string, string> info, Dictionary<Point, float> dieDict)
{
WaferViewModel result = new WaferViewModel(info["WAFERID"]);
result.itemName = info["ITEMID"];
result.fmKeys = info["FMKEY"];
result.max_x = Int32.Parse(info["MAX_X"]);
result.min_x = Int32.Parse(info["MIN_X"]);
result.max_y = Int32.Parse(info["MAX_Y"]);
result.min_y = Int32.Parse(info["MIN_Y"]);
result.Tag = info["PARTID"];
int xLength = result.max_x - result.min_x;
int yLength = result.max_y - result.min_y;
///////
result.WaferSize = WaferSizeInches._2inch;
///////임의로 정한것임 문제시 수정해야할수도 있음
SizeF dieSize = new SizeF((result.WaferSize / xLength), (result.WaferSize / yLength));
Parallel.ForEach(dieDict, (d) =>
{
AccuraSoft.WaferMap.Model.IDieModel die = result.Dies.Create(
d.Key,
new PointF(d.Key.X * dieSize.Width, d.Key.Y * dieSize.Height),
new SizeF(dieSize.Width, dieSize.Height)
);
die.fValue = d.Value;
});
result.WaferColor = Color.FromArgb(240, 240, 240);
result.BorderColor = Color.FromArgb(240, 240, 240);
return result;
}
public Color getColorFromItemAndValue(string itemName, float value) {
Color result = Color.Empty;
switch (itemName) {
case "RANK":
if (value > 20 && value <= 30)
result = Color.Red;
break;
case "CHK":
break;
default:
break;
}
return result;
}
public List<Dictionary<string, string>> makeInfos(DataRowCollection rows)
{
#region const
const string WAFERID = "WAFERID";
const string TARGET = "TARGET";
const string PRODGROUP = "PRODUCTSPECGROUP";
const string MIN_Y = "MIN_Y";
const string MIN_X = "MIN_X";
const string MAX_Y = "MAX_Y";
const string MAX_X = "MAX_X";
const string LSL = "LSL";
const string USL = "USL";
const string ITEMID = "ITEMID";
const string ITEMGROUP = "STEPSEQ";
const string GOOD_RATIO = "GOOD_RATIO";
const string FMKEY = "FMKEY";
const string FACTORY = "FACTORYNAME";
const string DVALUE = "DVALUE";
const string DPOS = "DPOS";
const string DSTD = "DSTD";
const string DMEDIAN = "DMEDIAN";
const string DEVICEID = "PARTID";
const string DAVG_E = "DAVG_E";
const string DAVG = "DAVG";
const string PAREA = "PAREA";
//2011.06.29. somi
const string MOCVDZONE = "MOCVDZONE";
const string MOCVDPOCKETNO = "MOCVDPOCKETNO";
//
const string LOTID = "LOTID";
#endregion
List<Dictionary<string, string>> result = new List<Dictionary<string, string>>();
string pos = string.Empty;
foreach (DataRow row in rows)
{
if (row[ITEMID].Equals("Coordinate"))
{
pos = row[DVALUE].ToString();
continue;
}
Dictionary<string, string> info = new Dictionary<string, string>();
info.Add(WAFERID, row[WAFERID].ToString());
info.Add(TARGET, row[TARGET].ToString());
info.Add(PRODGROUP, row[PRODGROUP].ToString());
info.Add(MIN_Y, row[MIN_Y].ToString());
info.Add(MIN_X, row[MIN_X].ToString());
info.Add(MAX_Y, row[MAX_Y].ToString());
info.Add(MAX_X, row[MAX_X].ToString());
info.Add(LSL, row[LSL].ToString());
info.Add(USL, row[USL].ToString());
info.Add(ITEMID, row[ITEMID].ToString());
info.Add(ITEMGROUP, row[ITEMGROUP].ToString());
info.Add(GOOD_RATIO, row[GOOD_RATIO].ToString());
info.Add(FMKEY, row[FMKEY].ToString());
info.Add(FACTORY, row[FACTORY].ToString());
info.Add(DVALUE, row[DVALUE].ToString());
info.Add(DPOS, pos);
info.Add(DSTD, row[DSTD].ToString());
info.Add(DMEDIAN, row[DMEDIAN].ToString());
info.Add(DEVICEID, row[DEVICEID].ToString());
info.Add(DAVG_E, row[DAVG_E].ToString());
info.Add(DAVG, row[DAVG].ToString());
info.Add(PAREA, row[PAREA].ToString());
info.Add("LOTID", row["LOTID"].ToString());
info.Add("EQPID", row["EQPID"].ToString());
info.Add("TESTDIE", row["TESTDIE"].ToString());
//2011.06.29. somi
info.Add(MOCVDZONE, row[MOCVDZONE].ToString());
info.Add(MOCVDPOCKETNO, row[MOCVDPOCKETNO].ToString());
//
result.Add(info);
}
return result;
}
public WaferViewModel[] makeWaferViewModelsArrayFromDb(DataRowCollection rows)
{
#region const
const string WAFERID = "WAFERID";
const string TARGET = "TARGET";
const string PRODGROUP = "PRODUCTSPECGROUP";
const string MIN_Y = "MIN_Y";
const string MIN_X = "MIN_X";
const string MAX_Y = "MAX_Y";
const string MAX_X = "MAX_X";
const string LSL = "LSL";
const string USL = "USL";
const string ITEMID = "ITEMID";
const string ITEMGROUP = "STEPSEQ";
const string GOOD_RATIO = "GOOD_RATIO";
const string FMKEY = "FMKEY";
const string FACTORY = "FACTORYNAME";
const string DVALUE = "DVALUE";
const string DPOS = "DPOS";
const string DSTD = "DSTD";
const string DMEDIAN = "DMEDIAN";
const string DEVICEID = "PARTID";
const string DAVG_E = "DAVG_E";
const string DAVG = "DAVG";
const string PAREA = "PAREA";
//2011.06.29. somi
const string MOCVDZONE = "MOCVDZONE";
const string MOCVDPOCKETNO = "MOCVDPOCKETNO";
//
const string LOTID = "LOTID";
#endregion
List<WaferViewModel> models = new List<WaferViewModel>();
WaferViewModel model = new WaferViewModel("");
//////////////////
List<Dictionary<string, string>> infos = makeInfos(rows);
foreach(var info in infos)
{
model = makeWaferViewModelFromDb(info, makeDieList(parsePosIntoIndex(info[DPOS]), parseDValueIntoFValue(info[DVALUE])));
models.Add(model);
}
//////////////////
WaferViewModel[] result = models.ToArray();
return result;
}
public List<Point> parsePosIntoIndex(string pos)
{
List<Point> result = new List<Point>();
foreach (string smallPos in pos.Split('|'))
{
result.Add(new Point(Int32.Parse(smallPos.Split(',')[0]), Int32.Parse(smallPos.Split(',')[1])));
}
return result;
}
public List<float> parseDValueIntoFValue(string dvalues)
{
List<float> result = new List<float>();
foreach (string dvalue in dvalues.Split(','))
{
result.Add(float.Parse(dvalue));
}
return result;
}
public Dictionary<Point, float> makeDieList(List<Point> points, List<float> dvalues)
{
Dictionary<Point, float> result = new Dictionary<Point, float>();
if (points.Count != dvalues.Count)
{
Console.WriteLine("point count and dvalue count do not fit");
return null;
}
else
{
for (int i = 0; i < points.Count; i++)
{
result.Add(points[i], dvalues[i]);
}
}
return result;
}
public WaferViewModel findWafer(string waferID, string itemID){
WaferViewModel result = new WaferViewModel("");
foreach(WaferViewModel model in modelArray){
if (model.WaferID == waferID && model.itemName == itemID) {
result = model;
}
}
return result;
}
//2017-01-12
public WaferViewModel coloringWaferViewModel(WaferViewModel target, Color color, float smallValue, float bigValue) {
WaferViewModel result = target;
//새로운 색으로 다시 칠함
Parallel.ForEach(result.Dies, (die) => {
if (die.fValue >= smallValue && die.fValue < bigValue) {
die.CustomDieColor = color;
}
});
return result;
}
public WaferViewModel getColoredmodelFromLegend(WaferViewModel model, ArrayList LegendArray) {
WaferViewModel result = new WaferViewModel("");
result = model;
Parallel.ForEach(result.Dies, (die) =>
{
die.CustomDieColor = Color.Black;
});
foreach (string r in legendArray)
{
string[] row = r.Split(',');
Color c = Color.FromArgb(Int32.Parse(row[1]), Int32.Parse(row[2]), Int32.Parse(row[3]));
float smallValue = row[4].Equals("") ? 0f : float.Parse(row[4]);
float bigValue = float.Parse(row[5]);
result = coloringWaferViewModel(result, c, smallValue, bigValue);
}
return result;
}
public WaferViewModel getModelFromInfos(string waferID, string itemID, ArrayList LegendArray) {
WaferViewModel result = new WaferViewModel("");
result = findWafer(waferID, itemID);
//전부 다 색을 빼버림
Parallel.ForEach(result.Dies, (die) =>
{
die.CustomDieColor = Color.Black;
});
foreach (string r in legendArray)
{
string[] row = r.Split(',');
Color c = Color.FromArgb(Int32.Parse(row[1]), Int32.Parse(row[2]), Int32.Parse(row[3]));
float smallValue = row[4].Equals("")? 0f : float.Parse(row[4]);
float bigValue = float.Parse(row[5]);
result = coloringWaferViewModel(result, c, smallValue, bigValue);
}
return result;
}
}
}