INT63DC_2C/INT63DC_2C/Forms/FormDataStatistics.cs

1028 lines
57 KiB
C#

using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Imaging;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using SmartX;
using INT63DC_ImageDll;
using INT63DC_2C.DialogForms;
using INT63DC_2C.Controls;
namespace INT63DC_2C.Forms
{
public partial class FormDataStatistics : Form
{
#region Field
private int m_SelectNodeIndex;
private int FileIndex;
private FormMain m_ParentForm;
public DataCommonList CurrentDataCommonList;
private Collection<string[]> CollectionWeightData; //스틱1 파일에서 읽은 데이터
private Collection<DataCollector> CollectionLaneData; //파일에서 읽은 데이터를 통계 계산 처리된 데이터
public Collection<List<string>> CollectionFileClassification; // 스틱2 파일 리스트
private Collection<List<string[]>> CollectionWeightDataStick2; // 스틱2 파일에서 읽은 데이터
private Collection<SmartLabel> CollectionCommonLabel;
private Collection<SmartLabel> CollectionLane;
private Collection<SmartLabel> CollectionPassCount;
private Collection<SmartLabel> CollectionPassAverage;
private Collection<SmartLabel> CollectionPassPercentage;
private Collection<SmartLabel> CollectionPassSD;
private Collection<SmartLabel> CollectionPassMinWeight;
private Collection<SmartLabel> CollectionPassMaxWeight;
private Collection<SmartLabel> CollectionOverCount;
private Collection<SmartLabel> CollectionOverSumWeight;
private Collection<SmartLabel> CollectionOverPercentage;
private Collection<SmartLabel> CollectionUnderCount;
private Collection<SmartLabel> CollectionUnderSumWeight;
private Collection<SmartLabel> CollectionUnderPercentage;
private Collection<SmartLabel> CollectionExNgCount;
private Collection<SmartLabel> CollectionExNgPercentage;
private Collection<SmartLabel> CollectionTotalCount;
private Collection<SmartLabel> CollectionTotalNGCount;
#endregion
#region Constructor
public FormDataStatistics(FormMain parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
this.InitializeControl();
}
#endregion
#region Property
public int SelectNodeIndex
{
get { return this.m_SelectNodeIndex; }
set { this.m_SelectNodeIndex = value; }
}
private int EquipmentColumns { get { return this.ParentForm.SystemConfig.EquipmentColumns; } }
public FormMain ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
private void InitializeDesign()
{
ImageDll images = new ImageDll();
switch (this.ParentForm.SystemConfig.Language)
{
case DataStore.LanguageID.Korean:
break;
case DataStore.LanguageID.English:
#region jpnlish
this.labelTitle.Text = "Data Statistics";
this.buttonBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackupDisable));
this.buttonBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackupDown));
this.buttonBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackupUp));
this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackDisable));
this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackDown));
this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engBackUp));
#endregion
break;
case DataStore.LanguageID.Chinese:
#region Chinese
this.labelTitle.Text = "数据统计";
this.buttonBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackupDisable));
this.buttonBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackupDown));
this.buttonBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackupUp));
this.buttonFileSelect.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFileSelectDisable));
this.buttonFileSelect.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFileSelectDown));
this.buttonFileSelect.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnFileSelectUp));
this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackDisable));
this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackDown));
this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackUp));
#endregion
break;
case DataStore.LanguageID.Czech:
#region Czech
this.labelTitle.Text = "Data Statistics";
this.buttonBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackupDisable));
this.buttonBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackupDown));
this.buttonBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackupUp));
this.buttonFileSelect.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFileSelectDisable));
this.buttonFileSelect.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFileSelectDown));
this.buttonFileSelect.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeFileSelectUp));
this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackDisable));
this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackDown));
this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.czeBackUp));
#endregion
break;
case DataStore.LanguageID.German:
#region German
this.labelTitle.Text = "Data Statistics";
this.buttonBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackupDisable));
this.buttonBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackupDown));
this.buttonBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackupUp));
this.buttonFileSelect.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFileSelectDisable));
this.buttonFileSelect.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFileSelectDown));
this.buttonFileSelect.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerFileSelectUp));
this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackDisable));
this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackDown));
this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.gerBackUp));
#endregion
break;
case DataStore.LanguageID.Japanese:
#region Japanese
this.labelTitle.Text = "デㅡタ統計";
this.buttonBackup.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackupDisable));
this.buttonBackup.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackupDown));
this.buttonBackup.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackupUp));
this.buttonFileSelect.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFileSelectDisable));
this.buttonFileSelect.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFileSelectDown));
this.buttonFileSelect.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnFileSelectUp));
this.buttonBack.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackDisable));
this.buttonBack.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackDown));
this.buttonBack.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.jpnBackUp));
#endregion
break;
default:
break;
}
}
private void InitializeControl()
{
int locationX = 0;
#region Label Visible
for (int i = this.ParentForm.SystemConfig.EquipmentColumns; i < 16; i++)
{
this.CollectionLane[i].Visible = false;
this.CollectionPassCount[i].Visible = false;
this.CollectionPassAverage[i].Visible = false;
this.CollectionPassPercentage[i].Visible = false;
this.CollectionPassSD[i].Visible = false;
this.CollectionPassMinWeight[i].Visible = false;
this.CollectionPassMaxWeight[i].Visible = false;
this.CollectionOverCount[i].Visible = false;
this.CollectionOverSumWeight[i].Visible = false;
this.CollectionOverPercentage[i].Visible = false;
this.CollectionUnderCount[i].Visible = false;
this.CollectionUnderSumWeight[i].Visible = false;
this.CollectionUnderPercentage[i].Visible = false;
this.CollectionExNgCount[i].Visible = false;
this.CollectionExNgPercentage[i].Visible = false;
this.CollectionTotalCount[i].Visible = false;
this.CollectionTotalNGCount[i].Visible = false;
}
#endregion
#region Label Location
if (this.ParentForm.SystemConfig.EquipmentColumns == 16)
locationX = 0;
else if (this.ParentForm.SystemConfig.EquipmentColumns == 12)
locationX = 16;
else if (this.ParentForm.SystemConfig.EquipmentColumns == 10)
locationX = 40;
else if (this.ParentForm.SystemConfig.EquipmentColumns == 8)
locationX = 50;
else
locationX = 60;
for (int i = 1; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
{
this.CollectionLane[i].Location = new Point(this.CollectionLane[i].Location.X + locationX * i, this.CollectionLane[i].Location.Y);
this.CollectionPassCount[i].Location = new Point(this.CollectionPassCount[i].Location.X + locationX * i, this.CollectionPassCount[i].Location.Y);
this.CollectionPassAverage[i].Location = new Point(this.CollectionPassAverage[i].Location.X + locationX * i, this.CollectionPassAverage[i].Location.Y);
this.CollectionPassPercentage[i].Location = new Point(this.CollectionPassPercentage[i].Location.X + locationX * i, this.CollectionPassPercentage[i].Location.Y);
this.CollectionPassSD[i].Location = new Point(this.CollectionPassSD[i].Location.X + locationX * i, this.CollectionPassSD[i].Location.Y);
this.CollectionPassMinWeight[i].Location = new Point(this.CollectionPassMinWeight[i].Location.X + locationX * i, this.CollectionPassMinWeight[i].Location.Y);
this.CollectionPassMaxWeight[i].Location = new Point(this.CollectionPassMaxWeight[i].Location.X + locationX * i, this.CollectionPassMaxWeight[i].Location.Y);
this.CollectionOverCount[i].Location = new Point(this.CollectionOverCount[i].Location.X + locationX * i, this.CollectionOverCount[i].Location.Y);
this.CollectionOverSumWeight[i].Location = new Point(this.CollectionOverSumWeight[i].Location.X + locationX * i, this.CollectionOverSumWeight[i].Location.Y);
this.CollectionOverPercentage[i].Location = new Point(this.CollectionOverPercentage[i].Location.X + locationX * i, this.CollectionOverPercentage[i].Location.Y);
this.CollectionUnderCount[i].Location = new Point(this.CollectionUnderCount[i].Location.X + locationX * i, this.CollectionUnderCount[i].Location.Y);
this.CollectionUnderSumWeight[i].Location = new Point(this.CollectionUnderSumWeight[i].Location.X + locationX * i, this.CollectionUnderSumWeight[i].Location.Y);
this.CollectionUnderPercentage[i].Location = new Point(this.CollectionUnderPercentage[i].Location.X + locationX * i, this.CollectionUnderPercentage[i].Location.Y);
this.CollectionExNgCount[i].Location = new Point(this.CollectionExNgCount[i].Location.X + locationX * i, this.CollectionExNgCount[i].Location.Y);
this.CollectionExNgPercentage[i].Location = new Point(this.CollectionExNgPercentage[i].Location.X + locationX * i, this.CollectionExNgPercentage[i].Location.Y);
this.CollectionTotalCount[i].Location = new Point(this.CollectionTotalCount[i].Location.X + locationX * i, this.CollectionTotalCount[i].Location.Y);
this.CollectionTotalNGCount[i].Location = new Point(this.CollectionTotalNGCount[i].Location.X + locationX * i, this.CollectionTotalNGCount[i].Location.Y);
}
#endregion
}
private void DefaultSetting()
{
this.FileIndex = 0;
this.SelectNodeIndex = -1;
this.CurrentDataCommonList = new DataCommonList();
this.CollectionFileClassification = new Collection<List<string>>();
this.CollectionWeightDataStick2 = new Collection<List<string[]>>();
this.CollectionWeightData = new Collection<string[]>();
this.CollectionLaneData = new Collection<DataCollector>();
this.CollectionCommonLabel = new Collection<SmartLabel>();
this.CollectionLane = new Collection<SmartLabel>();
this.CollectionPassCount = new Collection<SmartLabel>();
this.CollectionPassAverage = new Collection<SmartLabel>();
this.CollectionPassPercentage = new Collection<SmartLabel>();
this.CollectionPassSD = new Collection<SmartLabel>();
this.CollectionPassMinWeight = new Collection<SmartLabel>();
this.CollectionPassMaxWeight = new Collection<SmartLabel>();
this.CollectionOverCount = new Collection<SmartLabel>();
this.CollectionOverSumWeight = new Collection<SmartLabel>();
this.CollectionOverPercentage = new Collection<SmartLabel>();
this.CollectionUnderCount = new Collection<SmartLabel>();
this.CollectionUnderSumWeight = new Collection<SmartLabel>();
this.CollectionUnderPercentage = new Collection<SmartLabel>();
this.CollectionExNgCount = new Collection<SmartLabel>();
this.CollectionExNgPercentage = new Collection<SmartLabel>();
this.CollectionTotalCount = new Collection<SmartLabel>();
this.CollectionTotalNGCount = new Collection<SmartLabel>();
this.CollectionCommonLabel.Add(this.labelProductName);
this.CollectionCommonLabel.Add(this.labelLot);
this.CollectionCommonLabel.Add(this.labelStartTime);
this.CollectionCommonLabel.Add(this.labelEndTime);
this.CollectionCommonLabel.Add(this.labelOverRange);
this.CollectionCommonLabel.Add(this.labelPassRange);
this.CollectionCommonLabel.Add(this.labelUnderRange);
this.CollectionCommonLabel.Add(this.labelTareRange);
this.CollectionCommonLabel.Add(this.labelTotalCount);
this.CollectionCommonLabel.Add(this.labelTotalNGCount);
this.CollectionCommonLabel.Add(this.labelTotalPassCount);
this.CollectionCommonLabel.Add(this.labelTotalOverCount);
this.CollectionCommonLabel.Add(this.labelTotalUnderCount);
this.CollectionCommonLabel.Add(this.labelTotalExNgCount);
this.CollectionCommonLabel.Add(this.labelTotalPassAverage);
this.CollectionCommonLabel.Add(this.labelTotalPassStandardDeviation);
this.CollectionCommonLabel.Add(this.labelTotalOverSumWeight);
this.CollectionCommonLabel.Add(this.labelTotalUnderSumWeight);
for (int i = 1; i <= 16; i++)
{
this.CollectionLane.Add(FindByNameUtil.SmartLabel("labelLane" + i, this));
this.CollectionPassCount.Add(FindByNameUtil.SmartLabel("labelPassCount" + i, this));
this.CollectionPassAverage.Add(FindByNameUtil.SmartLabel("labelPassAverage" + i, this));
this.CollectionPassPercentage.Add(FindByNameUtil.SmartLabel("labelPassPercentage" + i, this));
this.CollectionPassSD.Add(FindByNameUtil.SmartLabel("labelPassStandardDeviation" + i, this));
this.CollectionPassMinWeight.Add(FindByNameUtil.SmartLabel("labelPassMinWeight" + i, this));
this.CollectionPassMaxWeight.Add(FindByNameUtil.SmartLabel("labelPassMaxWeight" + i, this));
this.CollectionOverCount.Add(FindByNameUtil.SmartLabel("labelOverCount" + i, this));
this.CollectionOverSumWeight.Add(FindByNameUtil.SmartLabel("labelOverSumWeight" + i, this));
this.CollectionOverPercentage.Add(FindByNameUtil.SmartLabel("labelOverPercentage" + i, this));
this.CollectionUnderCount.Add(FindByNameUtil.SmartLabel("labelUnderCount" + i, this));
this.CollectionUnderSumWeight.Add(FindByNameUtil.SmartLabel("labelUnderSumWeight" + i, this));
this.CollectionUnderPercentage.Add(FindByNameUtil.SmartLabel("labelUnderPercentage" + i, this));
this.CollectionExNgCount.Add(FindByNameUtil.SmartLabel("labelExNgCount" + i, this));
this.CollectionExNgPercentage.Add(FindByNameUtil.SmartLabel("labelExNgPercentage" + i, this));
this.CollectionTotalCount.Add(FindByNameUtil.SmartLabel("labelTotalCount" + i, this));
this.CollectionTotalNGCount.Add(FindByNameUtil.SmartLabel("labelTotalNGCount" + i, this));
}
for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
{
this.CollectionWeightDataStick2.Add(new List<string[]>());
this.CollectionLaneData.Add(new DataCollector());
}
this.InitializeLabels();
}
private void InitializeLabels()
{
foreach (SmartLabel label in this.CollectionCommonLabel)
label.Text = "-";
for (int i = 0; i < this.EquipmentColumns; i++)
{
this.CollectionPassCount[i].Text = "0";
this.CollectionPassAverage[i].Text = "0";
this.CollectionPassPercentage[i].Text = "0";
this.CollectionPassSD[i].Text = "0";
this.CollectionPassMinWeight[i].Text = "0";
this.CollectionPassMaxWeight[i].Text = "0";
this.CollectionOverCount[i].Text = "0";
this.CollectionOverSumWeight[i].Text = "0";
this.CollectionOverPercentage[i].Text = "0";
this.CollectionUnderCount[i].Text = "0";
this.CollectionUnderSumWeight[i].Text = "0";
this.CollectionUnderPercentage[i].Text = "0";
this.CollectionExNgCount[i].Text = "0";
this.CollectionExNgPercentage[i].Text = "0";
this.CollectionTotalCount[i].Text = "0";
this.CollectionTotalNGCount[i].Text = "0";
}
}
private void SetCommonData(Collection<string[]> datas, Collection<DataCollector> laneDatas)
{
double dValue1 = 0.0, dValue2 = 0.0, passSumWeight = 0.0, overSumWeight = 0.0, underSumWeight = 0.0, passAverageWeight = 0.0, passVariance = 0.0;
string sValue = "";
int underCount = 0, passCount = 0, overCount = 0, exNGCount = 0;
this.CurrentDataCommonList.ProductName = datas[datas.Count - 1][3];
this.CurrentDataCommonList.Lot = datas[datas.Count - 1][4];
this.CurrentDataCommonList.StartTime = string.Format("{0} {1}", datas[0][0], datas[0][1]);
this.CurrentDataCommonList.EndTime = string.Format("{0} {1}", datas[datas.Count - 1][0], datas[datas.Count - 1][1]);
dValue1 = double.Parse(datas[datas.Count - 1][5]);
sValue = Helper.DoubleToString(dValue1, 1);
this.CurrentDataCommonList.UnderRange = sValue;
dValue1 = double.Parse(datas[datas.Count - 1][6]);
sValue = Helper.DoubleToString(dValue1, 1);
this.CurrentDataCommonList.PassRange = sValue;
dValue1 = double.Parse(datas[datas.Count - 1][7]);
sValue = Helper.DoubleToString(dValue1, 1);
this.CurrentDataCommonList.OverRange = sValue;
dValue1 = double.Parse(datas[datas.Count - 1][8]);
sValue = Helper.DoubleToString(dValue1, 1);
this.CurrentDataCommonList.TareRange = sValue;
for (int i = 0; i < laneDatas.Count; i++)
{
underCount += laneDatas[i].UnderTotalCount;
passCount += laneDatas[i].PassTotalCount;
overCount += laneDatas[i].OverTotalCount;
exNGCount += laneDatas[i].ExNgTotalCount;
passSumWeight += laneDatas[i].PassSumWeight;
overSumWeight += laneDatas[i].OverSumWeight;
underSumWeight += laneDatas[i].UnderSumWeight;
}
// 전체 정량 평균
passAverageWeight = passSumWeight / passCount;
// 전체 정량 분산
for (int i = 0; i < laneDatas.Count; i++)
{
for (int j = 0; j < laneDatas[i].PassWeightData.Count; j++)
{
dValue1 = passAverageWeight - laneDatas[i].PassWeightData[j];
dValue2 += dValue1 * dValue1;
}
}
passVariance = dValue2 / passCount;
this.CurrentDataCommonList.TotalUnderCount = underCount;
this.CurrentDataCommonList.TotalPassCount = passCount;
this.CurrentDataCommonList.TotalOverCount = overCount;
this.CurrentDataCommonList.TotalExNgCount = exNGCount;
this.CurrentDataCommonList.TotalPassSumWeight = passSumWeight;
this.CurrentDataCommonList.TotalOverSumWeight = overSumWeight;
this.CurrentDataCommonList.TotalUnderSumWeight = underSumWeight;
this.CurrentDataCommonList.TotalPassAverageWeight = passAverageWeight;
this.CurrentDataCommonList.TotalPassVariance = passVariance;
}
private void SetData(DataCollector data, string weight, DataStore.JudgmentStatus grade)
{
if (grade == DataStore.JudgmentStatus.Pass)
data.AddPassWeight(double.Parse(weight));
else if (grade == DataStore.JudgmentStatus.Over)
data.AddOverWeight(double.Parse(weight));
else if (grade == DataStore.JudgmentStatus.Under)
data.AddUnderWeight(double.Parse(weight));
else if (grade == DataStore.JudgmentStatus.ExNG || grade == DataStore.JudgmentStatus.Double || grade == DataStore.JudgmentStatus.SensorError)
data.AddExNgWeight(double.Parse(weight));
}
private void UpdateDisplay(DataCommonList commonList, Collection<DataCollector> datas)
{
this.SetLabelText(this.labelProductName, commonList.ProductName);
this.SetLabelText(this.labelLot, commonList.Lot);
this.SetLabelText(this.labelStartTime, commonList.StartTime);
this.SetLabelText(this.labelEndTime, commonList.EndTime);
this.SetLabelText(this.labelUnderRange, commonList.UnderRange);
this.SetLabelText(this.labelPassRange, commonList.PassRange);
this.SetLabelText(this.labelOverRange, commonList.OverRange);
this.SetLabelText(this.labelTareRange, commonList.TareRange);
this.SetLabelText(this.labelTotalCount, string.Format("{0}", commonList.TotalCount.ToString()));
this.SetLabelText(this.labelTotalUnderCount, string.Format("{0} / {1}", commonList.TotalUnderCount, commonList.TotalUnderPercentage));
this.SetLabelText(this.labelTotalPassCount, string.Format("{0} / {1}", commonList.TotalPassCount, commonList.TotalPassPercentage));
this.SetLabelText(this.labelTotalOverCount, string.Format("{0} / {1}", commonList.TotalOverCount, commonList.TotalOverPercentage));
this.SetLabelText(this.labelTotalExNgCount, string.Format("{0} / {1}", commonList.TotalExNgCount, commonList.TotalExNgPercentage));
this.SetLabelText(this.labelTotalNGCount, string.Format("{0}", commonList.TotalNGCount.ToString()));
this.SetLabelText(this.labelTotalPassAverage, string.Format("{0:0.000}", commonList.TotalPassAverageWeight));
this.SetLabelText(this.labelTotalPassStandardDeviation, string.Format("{0:0.00}", commonList.TotalPassStandardDeviation));
this.SetLabelText(this.labelTotalOverSumWeight, string.Format("{0}", Helper.DoubleToString(commonList.TotalOverSumWeight / 1000, 3)));
this.SetLabelText(this.labelTotalUnderSumWeight, string.Format("{0}", Helper.DoubleToString(commonList.TotalUnderSumWeight / 1000, 3)));
for (int i = 0; i < datas.Count; i++)
{
this.SetLabelText(this.CollectionPassCount[i], datas[i].PassTotalCount.ToString());
this.SetLabelText(this.CollectionPassAverage[i], string.Format("{0:0.000}", datas[i].PassAverage));
this.SetLabelText(this.CollectionPassPercentage[i], datas[i].PassPercentage.ToString());
this.SetLabelText(this.CollectionPassSD[i], string.Format("{0:0.00}", datas[i].PassStandardDeviation));
this.SetLabelText(this.CollectionPassMinWeight[i], Helper.DoubleToString(datas[i].PassMinWeight, 1));
this.SetLabelText(this.CollectionPassMaxWeight[i], Helper.DoubleToString(datas[i].PassMaxWeight, 1));
this.SetLabelText(this.CollectionOverCount[i], datas[i].OverTotalCount.ToString());
this.SetLabelText(this.CollectionOverSumWeight[i], Helper.DoubleToString(datas[i].OverSumWeight / 1000, 3));
this.SetLabelText(this.CollectionOverPercentage[i], datas[i].OverPercentage.ToString());
this.SetLabelText(this.CollectionUnderCount[i], datas[i].UnderTotalCount.ToString());
this.SetLabelText(this.CollectionUnderSumWeight[i], Helper.DoubleToString(datas[i].UnderSumWeight / 1000, 3));
this.SetLabelText(this.CollectionUnderPercentage[i], datas[i].UnderPercentage.ToString());
this.SetLabelText(this.CollectionExNgCount[i], datas[i].ExNgTotalCount.ToString());
this.SetLabelText(this.CollectionExNgPercentage[i], datas[i].ExNgPercentage.ToString());
this.SetLabelText(this.CollectionTotalCount[i], datas[i].TotalCount.ToString());
this.SetLabelText(this.CollectionTotalNGCount[i], datas[i].TotalNGCount.ToString());
}
}
private void SetLabelText(SmartLabel label, string value)
{
if (label.Text != value)
label.Text = value;
}
private void LoadDataBackupFile(ref Collection<List<string[]>> datas, string path, int index)
{
int flag = 0;
long count = 0;
this.ParentForm.smartFileIO.FilePathName = path;
this.ParentForm.smartFileIO.Open(2000000);
this.ParentForm.smartFileIO.ReadStringAllBuffer();
count = this.ParentForm.smartFileIO.GetCount();
for (int i = 0; i < count; i++)
{
if (flag == 100)
{
Thread.Sleep(5);
flag = 0;
}
datas[index].Add(this.ParentForm.smartFileIO.ReadStringBuffer(i).Split(','));
flag++;
}
this.ParentForm.smartFileIO.Close();
datas[index].RemoveAt(0);
}
private void DataAnalysis()
{
switch (this.ParentForm.SystemConfig.EquipmentColumns)
{
case 2:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
}
break;
case 3:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
}
break;
case 4:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
}
break;
case 5:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
}
break;
case 6:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
this.SetData(this.CollectionLaneData[5], this.CollectionWeightData[i][19], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][20]));
}
break;
case 7:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
this.SetData(this.CollectionLaneData[5], this.CollectionWeightData[i][19], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][20]));
this.SetData(this.CollectionLaneData[6], this.CollectionWeightData[i][21], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][22]));
}
break;
case 8:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
this.SetData(this.CollectionLaneData[5], this.CollectionWeightData[i][19], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][20]));
this.SetData(this.CollectionLaneData[6], this.CollectionWeightData[i][21], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][22]));
this.SetData(this.CollectionLaneData[7], this.CollectionWeightData[i][23], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][24]));
}
break;
case 10:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
this.SetData(this.CollectionLaneData[5], this.CollectionWeightData[i][19], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][20]));
this.SetData(this.CollectionLaneData[6], this.CollectionWeightData[i][21], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][22]));
this.SetData(this.CollectionLaneData[7], this.CollectionWeightData[i][23], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][24]));
this.SetData(this.CollectionLaneData[8], this.CollectionWeightData[i][25], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][26]));
this.SetData(this.CollectionLaneData[9], this.CollectionWeightData[i][27], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][28]));
}
break;
case 12:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
this.SetData(this.CollectionLaneData[5], this.CollectionWeightData[i][19], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][20]));
this.SetData(this.CollectionLaneData[6], this.CollectionWeightData[i][21], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][22]));
this.SetData(this.CollectionLaneData[7], this.CollectionWeightData[i][23], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][24]));
this.SetData(this.CollectionLaneData[8], this.CollectionWeightData[i][25], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][26]));
this.SetData(this.CollectionLaneData[9], this.CollectionWeightData[i][27], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][28]));
this.SetData(this.CollectionLaneData[10], this.CollectionWeightData[i][29], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][30]));
this.SetData(this.CollectionLaneData[11], this.CollectionWeightData[i][31], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][32]));
}
break;
case 16:
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
this.SetData(this.CollectionLaneData[0], this.CollectionWeightData[i][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][10]));
this.SetData(this.CollectionLaneData[1], this.CollectionWeightData[i][11], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][12]));
this.SetData(this.CollectionLaneData[2], this.CollectionWeightData[i][13], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][14]));
this.SetData(this.CollectionLaneData[3], this.CollectionWeightData[i][15], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][16]));
this.SetData(this.CollectionLaneData[4], this.CollectionWeightData[i][17], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][18]));
this.SetData(this.CollectionLaneData[5], this.CollectionWeightData[i][19], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][20]));
this.SetData(this.CollectionLaneData[6], this.CollectionWeightData[i][21], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][22]));
this.SetData(this.CollectionLaneData[7], this.CollectionWeightData[i][23], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][24]));
this.SetData(this.CollectionLaneData[8], this.CollectionWeightData[i][25], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][26]));
this.SetData(this.CollectionLaneData[9], this.CollectionWeightData[i][27], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][28]));
this.SetData(this.CollectionLaneData[10], this.CollectionWeightData[i][29], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][30]));
this.SetData(this.CollectionLaneData[11], this.CollectionWeightData[i][31], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][32]));
this.SetData(this.CollectionLaneData[12], this.CollectionWeightData[i][33], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][34]));
this.SetData(this.CollectionLaneData[13], this.CollectionWeightData[i][35], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][36]));
this.SetData(this.CollectionLaneData[14], this.CollectionWeightData[i][37], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][38]));
this.SetData(this.CollectionLaneData[15], this.CollectionWeightData[i][39], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightData[i][40]));
}
break;
default:
break;
}
for (int i = 0; i < this.CollectionLaneData.Count; i++)
this.CollectionLaneData[i].StatisticalAnalysis();
this.SetCommonData(this.CollectionWeightData, this.CollectionLaneData);
this.UpdateDisplay(this.CurrentDataCommonList, this.CollectionLaneData);
}
public int DataRead1()
{
string path = "";
int ret = 0, flag = 0;
long count = 0;
SmartX.SmartSplash splash;
splash = new SmartX.SmartSplash();
splash.CenterPosition = true;
splash.AnimationInterval = 100;
splash.LoadingImagePathname = "SmartLoading4";
splash.Start();
this.CollectionWeightData.Clear();
path = string.Format("{0}{1}", this.ParentForm.PathDataBackupFolder, this.CollectionFileClassification[this.SelectNodeIndex][0]);
this.ParentForm.smartFileIO.FilePathName = path;
this.ParentForm.smartFileIO.Open(2000000);
this.ParentForm.smartFileIO.ReadStringAllBuffer();
try
{
count = this.ParentForm.smartFileIO.GetCount();
for (int i = 0; i < count; i++)
{
if (flag == 100)
{
Thread.Sleep(5);
flag = 0;
}
this.CollectionWeightData.Add(this.ParentForm.smartFileIO.ReadStringBuffer(i).Split(','));
flag++;
}
this.ParentForm.smartFileIO.Close();
this.CollectionWeightData.RemoveAt(0);
this.DataAnalysis();
ret = 0;
splash.Finish();
}
catch
{
ret = -1;
splash.Finish();
DialogFormMessage msg = new DialogFormMessage(13, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
this.ParentForm.smartFileIO.Close();
}
return ret;
}
public void ClearData()
{
this.InitializeLabels();
for (int i = 0; i < this.CollectionLaneData.Count; i++)
this.CollectionLaneData[i].ClearDatas();
}
private void FileBackup(DataCommonList commonList, Collection<DataCollector> datas)
{
bool fileCheck = false;
string fullFilePath = "";
StreamWriter sw;
fullFilePath = string.Format("{0}{1:yyyyMMdd-HHmmss}_{2}_CheckList.csv",
this.ParentForm.PathDataStatisticsFolder, DateTime.Now, this.ParentForm.SystemConfig.UsbID);
this.ParentForm.smartFileIO.FilePathName = fullFilePath;
sw = new StreamWriter(fullFilePath, true, Encoding.Default);
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
if (fileCheck == true)
{
this.ParentForm.smartFileIO.Open(this.ParentForm.BufferSmartUart);
for (int i = 0; i < 40; i++)
{
this.ParentForm.smartFileIO.WriteString("");
}
this.ParentForm.smartFileIO.Close();
}
sw.WriteLine(string.Format("Product Name,{0}", commonList.ProductName));
sw.WriteLine(string.Format("Lot,{0}", commonList.Lot));
sw.WriteLine(string.Format("Start Time,{0}", commonList.StartTime));
sw.WriteLine(string.Format("End Time,{0}", commonList.EndTime));
sw.WriteLine(string.Format("Under Range[g],{0}", commonList.UnderRange));
sw.WriteLine(string.Format("Pass Range[g],{0}", commonList.PassRange));
sw.WriteLine(string.Format("Over Range[g],{0}", commonList.OverRange));
sw.WriteLine(string.Format("Tare Range[g],{0}", commonList.TareRange));
sw.WriteLine(string.Format("Total Count[ea],{0}", commonList.TotalCount));
sw.WriteLine(string.Format("Total NG Count[ea],{0}", commonList.TotalNGCount));
sw.WriteLine(string.Format("Total Pass Count[ea],{0}", commonList.TotalPassCount));
sw.WriteLine(string.Format("Total Pass Percentage[%],{0}", commonList.TotalPassPercentage));
sw.WriteLine(string.Format("Total Pass Average[g],{0:0.000}", commonList.TotalPassAverageWeight));
sw.WriteLine(string.Format("Total Pass Standard Deviation[g],{0}", commonList.TotalPassStandardDeviation));
sw.WriteLine(string.Format("Total Under Count[ea],{0}", commonList.TotalUnderCount));
sw.WriteLine(string.Format("Total Under Percentage[%],{0}", commonList.TotalUnderPercentage));
sw.WriteLine(string.Format("Total Under Sum Weight[kg],{0:0.000}", commonList.TotalUnderSumWeight / 1000));
sw.WriteLine(string.Format("Total Over Count[ea],{0}", commonList.TotalOverCount));
sw.WriteLine(string.Format("Total Over Percentage[%],{0}", commonList.TotalOverPercentage));
sw.WriteLine(string.Format("Total Over Sum Weight[kg],{0:0.000}", commonList.TotalOverSumWeight / 1000));
sw.WriteLine(string.Format("Total ExNG count[ea],{0}", commonList.TotalExNgCount));
sw.WriteLine(string.Format("Total ExNG Percentage[%],{0}", commonList.TotalExNgPercentage));
sw.Write("");
sw.Write(",");
for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
{
sw.Write(string.Format("#{0}", i + 1));
sw.Write(",");
}
sw.WriteLine();
#region Pass
sw.Write("Pass Count[ea]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].PassTotalCount);
}
sw.WriteLine();
sw.Write("Pass Average[g]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(string.Format("{0:0.000}", datas[i].PassAverage));
}
sw.WriteLine();
sw.Write("Pass Percentage[%]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].PassPercentage);
}
sw.WriteLine();
sw.Write("Pass Standard Deviation[g]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(string.Format("{0:0.00}", datas[i].PassStandardDeviation));
}
sw.WriteLine();
sw.Write("Pass Min Weight[g]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(datas[i].PassMinWeight, 1));
}
sw.WriteLine();
sw.Write("Pass Max Weight[g]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(datas[i].PassMaxWeight, 1));
}
sw.WriteLine();
#endregion
#region Over
sw.Write("Over Count[ea]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].OverTotalCount);
}
sw.WriteLine();
sw.Write("Over Sum Weight[kg]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(datas[i].OverSumWeight / 1000, 3));
}
sw.WriteLine();
sw.Write("Over Percentage[%]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].OverPercentage);
}
sw.WriteLine();
#endregion
#region Under
sw.Write("Under Count[ea]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].UnderTotalCount);
}
sw.WriteLine();
sw.Write("Under Sum Weight[kg]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(datas[i].UnderSumWeight / 1000, 3));
}
sw.WriteLine();
sw.Write("Under Percentage[%]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].UnderPercentage);
}
sw.WriteLine();
#endregion
#region Ex
sw.Write("ExNG Count[ea]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].ExNgTotalCount);
}
sw.WriteLine();
sw.Write("ExNG Percentage[%]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].ExNgPercentage);
}
sw.WriteLine();
#endregion
#region Total
sw.Write("Total Count[ea]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].TotalCount);
}
sw.WriteLine();
sw.Write("Total NG Count[ea]");
for (int i = 0; i < datas.Count; i++)
{
sw.Write(",");
sw.Write(datas[i].TotalNGCount);
}
sw.WriteLine();
#endregion
sw.Close();
}
private bool CheckUSBMemory()
{
bool ret = false;
try
{
DirectoryInfo dinfo = new DirectoryInfo("하드 디스크\\");
dinfo.GetDirectories();
ret = true;
}
catch
{
ret = false;
}
return ret;
}
private void FileCopy(FileInfo file, string fileName)
{
try
{
if (this.FileIndex == 0)
{
file.CopyTo(fileName);
this.FileIndex = 0;
}
else
{
file.CopyTo(fileName.Insert(fileName.Length - 4, "_" + this.FileIndex.ToString()));
this.FileIndex = 0;
}
}
catch
{
this.FileIndex++;
this.FileCopy(file, fileName);
}
}
public void DisplayRefresh()
{
this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormConfiguration;
this.ClearData();
this.buttonBackup.Enabled = false;
}
#endregion
#region Override Member
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
#endregion
#region Event Handler
private void buttonBack_Click(object sender, EventArgs e)
{
this.ParentForm.ChildFormMenu.DisplayRefresh();
((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu);
}
private void buttonFileSelect_Click(object sender, EventArgs e)
{
this.SelectNodeIndex = -1;
DialogFormDataStatistics form = new DialogFormDataStatistics(this);
if (form.ShowDialog() == DialogResult.OK)
this.buttonBackup.Enabled = true;
else
this.buttonBackup.Enabled = false;
}
private void buttonBackup_Click(object sender, EventArgs e)
{
this.buttonBackup.Enabled = false;
string filePath = "";
bool directoryCheck = false;
Bitmap bitMap = new Bitmap(1024, 768);
// 메모리 장착 체크
if (this.CheckUSBMemory() == false)
{
DialogFormMessage msg = new DialogFormMessage(5, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
this.buttonBackup.Enabled = true;
return;
}
#region 통계 데이터 생성
bitMap = IntechGraphics.CopyFromScreen();
filePath = string.Format("{0}{1:yyyyMMdd-HHmmss}_{2}_Capture.jpg",
this.ParentForm.PathDataStatisticsFolder, DateTime.Now, this.ParentForm.SystemConfig.UsbID);
bitMap.Save(filePath, ImageFormat.Jpeg);
this.FileBackup(this.CurrentDataCommonList, this.CollectionLaneData);
#endregion
#region 메모리로 파일 복사
try
{
filePath = "하드 디스크\\";
DirectoryInfo dir = new DirectoryInfo(this.ParentForm.PathDataStatisticsFolder);
directoryCheck = dir.Exists;
// 폴더 체크
if (directoryCheck == false)
dir.Create();
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
this.FileCopy(file, filePath + file.Name);
file.Delete();
}
DialogFormMessage msg = new DialogFormMessage("2", this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
}
catch
{
DialogFormMessage msg = new DialogFormMessage(6, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
return;
}
#endregion
this.buttonBackup.Enabled = true;
}
#endregion
}
}