데이터 통계 진행 중(추후 코드 15인치 프로그램 따라갈 예정)

master
DESKTOP-999R8N3\CJY 2023-08-30 10:41:13 +09:00
parent d41c5775ad
commit 11be29edca
11 changed files with 941 additions and 638 deletions

View File

@ -38,8 +38,8 @@ namespace INT69DB_2A
FormUserGroupEditor,
FormOption,
// 하단 세 항목은 위치를 맨 뒤로 고정할 것
FormDataBackup,
FormDataStatistics,
FormDataBackup,
FormDataViewer,
};

View File

@ -30,12 +30,10 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DialogFormDataStatistics));
this.smartForm1 = new SmartX.SmartForm();
this.treeView1 = new System.Windows.Forms.TreeView();
this.treeView = new System.Windows.Forms.TreeView();
this.buttonRead = new SmartX.SmartButton();
this.labelFileName = new SmartX.SmartLabel();
this.smartGroupBox1 = new SmartX.SmartGroupBox();
this.smartLabel5 = new SmartX.SmartLabel();
this.labelId = new SmartX.SmartLabel();
this.smartLabel3 = new SmartX.SmartLabel();
this.labelProductNo = new SmartX.SmartLabel();
this.smartLabel2 = new SmartX.SmartLabel();
@ -61,13 +59,13 @@
this.smartForm1.SpecialFunctionClickPointSize = 100;
this.smartForm1.SuspendLayoutInterval = 0;
//
// treeView1
// treeView
//
this.treeView1.Location = new System.Drawing.Point(12, 12);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(219, 445);
this.treeView1.TabIndex = 4;
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
this.treeView.Location = new System.Drawing.Point(12, 12);
this.treeView.Name = "treeView";
this.treeView.Size = new System.Drawing.Size(219, 445);
this.treeView.TabIndex = 4;
this.treeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView_AfterSelect);
//
// buttonRead
//
@ -127,8 +125,6 @@
//
this.smartGroupBox1.BackPictureBox = this.smartForm1;
this.smartGroupBox1.BackPictureBox1 = null;
this.smartGroupBox1.Controls.Add(this.smartLabel5);
this.smartGroupBox1.Controls.Add(this.labelId);
this.smartGroupBox1.Controls.Add(this.smartLabel3);
this.smartGroupBox1.Controls.Add(this.labelProductNo);
this.smartGroupBox1.Controls.Add(this.smartLabel2);
@ -137,7 +133,7 @@
this.smartGroupBox1.Controls.Add(this.buttonClose);
this.smartGroupBox1.Controls.Add(this.labelFileName);
this.smartGroupBox1.Controls.Add(this.buttonRead);
this.smartGroupBox1.Controls.Add(this.treeView1);
this.smartGroupBox1.Controls.Add(this.treeView);
this.smartGroupBox1.FrameLineColor1 = System.Drawing.Color.Black;
this.smartGroupBox1.FrameLineColor2 = System.Drawing.Color.Black;
this.smartGroupBox1.FrameLineThickness = 1;
@ -152,48 +148,6 @@
this.smartGroupBox1.Text = "smartGroupBox1";
this.smartGroupBox1.TextColor = System.Drawing.Color.Black;
//
// smartLabel5
//
this.smartLabel5.BackColor = System.Drawing.Color.DimGray;
this.smartLabel5.BackPictureBox = null;
this.smartLabel5.BackPictureBox1 = null;
this.smartLabel5.BackPictureBox2 = null;
this.smartLabel5.BorderColor = System.Drawing.Color.DimGray;
this.smartLabel5.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.smartLabel5.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold);
this.smartLabel5.ForeColor = System.Drawing.Color.White;
this.smartLabel5.InitVisible = true;
this.smartLabel5.LineSpacing = 0F;
this.smartLabel5.Location = new System.Drawing.Point(237, 180);
this.smartLabel5.Name = "smartLabel5";
this.smartLabel5.Size = new System.Drawing.Size(100, 20);
this.smartLabel5.TabIndex = 20;
this.smartLabel5.Text = "ID";
this.smartLabel5.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle;
this.smartLabel5.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
this.smartLabel5.Wordwrap = false;
//
// labelId
//
this.labelId.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.labelId.BackPictureBox = null;
this.labelId.BackPictureBox1 = null;
this.labelId.BackPictureBox2 = null;
this.labelId.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
this.labelId.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.labelId.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold);
this.labelId.ForeColor = System.Drawing.Color.White;
this.labelId.InitVisible = true;
this.labelId.LineSpacing = 0F;
this.labelId.Location = new System.Drawing.Point(237, 202);
this.labelId.Name = "labelId";
this.labelId.Size = new System.Drawing.Size(100, 20);
this.labelId.TabIndex = 19;
this.labelId.Text = "1";
this.labelId.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle;
this.labelId.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
this.labelId.Wordwrap = false;
//
// smartLabel3
//
this.smartLabel3.BackColor = System.Drawing.Color.DimGray;
@ -352,14 +306,12 @@
#endregion
private SmartX.SmartForm smartForm1;
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.TreeView treeView;
private SmartX.SmartButton buttonRead;
private SmartX.SmartLabel labelFileName;
private SmartX.SmartGroupBox smartGroupBox1;
private SmartX.SmartButton buttonClose;
private SmartX.SmartLabel labelNodeIndex;
private SmartX.SmartLabel smartLabel5;
private SmartX.SmartLabel labelId;
private SmartX.SmartLabel smartLabel3;
private SmartX.SmartLabel labelProductNo;
private SmartX.SmartLabel smartLabel2;

View File

@ -57,13 +57,186 @@ namespace INT69DB_2A.DialogForms
}
private void DefaultSetting()
{
this.DisplayTreeViewUpdate();
if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false)
this.DisplayTreeViewUpdate1();
else
this.DisplayTreeViewUpdate2();
this.labelNodeIndex.Text = "-";
this.labelFileName.Text = "-";
this.labelDate.Text = "-";
this.labelProductNo.Text = "-";
this.labelId.Text = "-";
}
#region 기존코드
//private Collection<List<string>> FileClassification(List<string> files)
//{
// string date = "", date1 = "";
// Collection<List<string>> fileClassification = new Collection<List<string>>();
// List<string> list = new List<string>();
// for (int i = 0; i < files.Count; i++)
// {
// date = files[i].Substring(0, 12);
// if (i == 0)
// date1 = date;
// if (date == date1)
// {
// list.Add(files[i]);
// }
// else
// {
// date1 = date;
// List<string> l = new List<string>();
// foreach (string s in list)
// l.Add(s);
// fileClassification.Add(l);
// list = new List<string>();
// list.Add(files[i]);
// }
// }
// List<string> ls = new List<string>();
// foreach (string s in list)
// ls.Add(s);
// fileClassification.Add(ls);
// return fileClassification;
//}
//private List<string> FileSort(FileInfo[] files)
//{
// List<string> listFiles = new List<string>();
// Dictionary<string, int> fileNames = new Dictionary<string, int>();
// Dictionary<string, int> fileNamesSort = new Dictionary<string, int>();
// foreach (FileInfo file in files)
// {
// if (file.Name.StartsWith("20") == true)
// fileNames.Add(file.Name, int.Parse(file.Name.Substring(11, 1)));
// }
// var vrList = fileNames.Keys.ToList();
// vrList.Sort();
// foreach (var v in vrList)
// fileNamesSort.Add(v, fileNames[v]);
// foreach (var v in fileNamesSort)
// listFiles.Add(v.Key);
// return listFiles;
//}
//private List<string> FileSort(List<string> lst)
//{
// List<string> listFiles = new List<string>();
// Dictionary<string, int> fileNames = new Dictionary<string, int>();
// Dictionary<string, int> fileNamesSort = new Dictionary<string, int>();
// foreach (string list in lst)
// {
// if (list.Length == 22)
// fileNames.Add(list, int.Parse(list.Substring(13, 1)));
// else
// fileNames.Add(list, int.Parse(list.Substring(13, 2)));
// }
// // Lane 순서데로 오름차순 정렬
// var vrList = fileNames.OrderBy(x => x.Value);
// foreach (var v in vrList)
// listFiles.Add(v.Key);
// return listFiles;
//}
//private void DisplayTreeViewUpdate()
//{
// int fileCount = 0;
// DirectoryInfo dir = new DirectoryInfo(this.ParentForm.ParentForm.PathDataBackupFolder);
// List<string> fileNames = new List<string>();
// // 폴더 체크
// if (dir.Exists == false)
// dir.Create();
// FileInfo[] files = dir.GetFiles();
// foreach (FileInfo file in files)
// {
// if (file.Name.StartsWith("20") == true)
// fileCount++;
// }
// if (fileCount != 0)
// {
// // 파일 이름 순으로 정렬
// fileNames = this.FileSort(files);
// // 파일 날짜 순으로 분류
// this.ParentForm.CollectionFileClassification = this.FileClassification(fileNames);
// foreach (List<string> list in this.ParentForm.CollectionFileClassification)
// {
// List<string> myList = new List<string>();
// // Lane 순서데로 오름 차순 정렬
// if (list.Count > 1 && list[0].Length > 18)
// myList = this.FileSort(list);
// else
// myList = list;
// TreeNode node = new TreeNode(myList[0].Substring(0, 12));
// for (int i = 0; i < myList.Count; i++)
// {
// node.Nodes.Add(myList[i]);
// }
// this.treeView1.Nodes.Add(node);
// }
// }
//}
#endregion
private string GetSeletedNodeList(TreeView tree)
{
int yearCNT, monthCNT, dayCNT;
List<string> listSelectedFile = new List<string>();
string selectedFile = "";
yearCNT = tree.Nodes.Count;
if (yearCNT != 0)
{
for (int i = 0; i < yearCNT; i++)
{
monthCNT = tree.Nodes[i].Nodes.Count;
if (monthCNT != 0)
{
for (int j = 0; j < monthCNT; j++)
{
dayCNT = tree.Nodes[i].Nodes[j].Nodes.Count;
if (dayCNT != 0)
{
for (int k = 0; k < dayCNT; k++)
{
if (tree.Nodes[i].Nodes[j].Nodes[k].IsSelected == true)
{
//listSelectedFile.Add(tree.Nodes[i].Nodes[j].Nodes[k].Text);
//listSelectedFile.Add(string.Format("{0}\\{1}\\{2}", tree.Nodes[i].Text, tree.Nodes[i].Nodes[j].Text, tree.Nodes[i].Nodes[j].Nodes[k].Text));
selectedFile = string.Format("{0}\\{1}\\{2}", tree.Nodes[i].Text, tree.Nodes[i].Nodes[j].Text, tree.Nodes[i].Nodes[j].Nodes[k].Text);
}
}
}
}
}
}
}
return selectedFile;
}
private Collection<List<string>> FileClassification(List<string> files)
@ -74,7 +247,7 @@ namespace INT69DB_2A.DialogForms
for (int i = 0; i < files.Count; i++)
{
date = files[i].Substring(0, 12);
date = files[i].Substring(0, 8);
if (i == 0)
date1 = date;
@ -113,16 +286,11 @@ namespace INT69DB_2A.DialogForms
foreach (FileInfo file in files)
{
if (file.Name.StartsWith("20") == true)
fileNames.Add(file.Name, int.Parse(file.Name.Substring(11, 1)));
fileNames.Add(file.Name, int.Parse(file.Name.Substring(9, 1)));
}
var vrList = fileNames.Keys.ToList();
vrList.Sort();
var vrList = fileNames.OrderBy(x => x.Value);
foreach (var v in vrList)
fileNamesSort.Add(v, fileNames[v]);
foreach (var v in fileNamesSort)
listFiles.Add(v.Key);
return listFiles;
@ -149,8 +317,50 @@ namespace INT69DB_2A.DialogForms
return listFiles;
}
private List<string> DirectorySort(DirectoryInfo[] directorys)
{
List<string> listDirectory = new List<string>();
Dictionary<string, int> dirNames = new Dictionary<string, int>();
private void DisplayTreeViewUpdate()
foreach (DirectoryInfo dir in directorys)
dirNames.Add(dir.Name, int.Parse(dir.Name));
// 순서데로 오름차순 정렬
var vrList = dirNames.OrderBy(x => x.Value);
foreach (var v in vrList)
listDirectory.Add(v.Key);
return listDirectory;
}
private List<string> DayInspectionDirectorySort(FileInfo[] files)
{
List<string> listFile = new List<string>();
Dictionary<string, int> dirNames = new Dictionary<string, int>();
#region File List 품번 순서데로 정렬
foreach (FileInfo file in files)
dirNames.Add(file.Name, int.Parse(file.Name.Substring(10, 1)));
var vrList = dirNames.OrderBy(x => x.Value);
foreach (var v in vrList)
listFile.Add(v.Key);
#endregion
#region File List 날짜 순서데로 정렬
dirNames = new Dictionary<string, int>();
foreach (string f in listFile)
dirNames.Add(f, int.Parse(f.Substring(1, 8)));
listFile.Clear();
vrList = dirNames.OrderBy(x => x.Value);
foreach (var v in vrList)
listFile.Add(v.Key);
#endregion
return listFile;
}
private void DisplayTreeViewUpdate1()
{
int fileCount = 0;
@ -178,29 +388,99 @@ namespace INT69DB_2A.DialogForms
foreach (List<string> list in this.ParentForm.CollectionFileClassification)
{
List<string> myList = new List<string>();
TreeNode node = new TreeNode(list[0].Substring(0, 10));
// Lane 순서데로 오름 차순 정렬
if (list.Count > 1 && list[0].Length > 18)
myList = this.FileSort(list);
else
myList = list;
TreeNode node = new TreeNode(myList[0].Substring(0, 12));
for (int i = 0; i < myList.Count; i++)
for (int i = 0; i < list.Count; i++)
{
node.Nodes.Add(myList[i]);
node.Nodes.Add(list[i]);
}
this.treeView1.Nodes.Add(node);
this.treeView.Nodes.Add(node);
}
}
}
private void DisplayTreeViewUpdate2()
{
int fileCount = 0;
//TreeNode node;
List<DataBackupYear> listInspectionFile = new List<DataBackupYear>();
List<string> years = new List<string>();
List<string> months = new List<string>();
List<string> days = new List<string>();
this.treeView.Nodes.Clear();
listInspectionFile.Clear();
DirectoryInfo dir = new DirectoryInfo(this.ParentForm.ParentForm.PathDataInspectionFolder);
List<string> fileNames = new List<string>();
// 폴더 체크
if (dir.Exists == false)
dir.Create();
// year 폴더 가져오기
DirectoryInfo[] yearDirectorys = dir.GetDirectories();
// year 폴더 정렬
years = this.DirectorySort(yearDirectorys);
// Inspection File 리스트 생성
if (years.Count != 0)
{
// Year
foreach (string year in years)
{
DataBackupYear y = new DataBackupYear(year);
DirectoryInfo monthDir = new DirectoryInfo(string.Format("{0}{1}", this.ParentForm.ParentForm.PathDataInspectionFolder, year));
DirectoryInfo[] monthDirectorys = monthDir.GetDirectories();
months = this.DirectorySort(monthDirectorys);
if (months.Count != 0)
{
// Month
foreach (string month in months)
{
DirectoryInfo dayDir = new DirectoryInfo(string.Format("{0}{1}\\{2}", this.ParentForm.ParentForm.PathDataInspectionFolder, year, month));
FileInfo[] dayFiles = dayDir.GetFiles();
days = this.DayInspectionDirectorySort(dayFiles);
DataBackupMonth m = new DataBackupMonth(month);
m.Days = days;
y.Months.Add(m);
}
listInspectionFile.Add(y);
}
else
{
listInspectionFile.Add(y);
}
}
// node 생성
for (int i = 0; i < listInspectionFile.Count; i++)
{
TreeNode node = new TreeNode(listInspectionFile[i].Year);
for (int j = 0; j < listInspectionFile[i].Months.Count; j++)
{
TreeNode nodeMonth = new TreeNode(listInspectionFile[i].Months[j].Month);
for (int k = 0; k < listInspectionFile[i].Months[j].Days.Count; k++)
{
nodeMonth.Nodes.Add(listInspectionFile[i].Months[j].Days[k]);
fileCount++;
}
node.Nodes.Add(nodeMonth);
}
this.treeView.Nodes.Add(node);
}
}
}
public void DisplayRefresh()
{
this.DisplayTreeViewUpdate();
}
#endregion
@ -209,22 +489,49 @@ namespace INT69DB_2A.DialogForms
{
int ret = 0;
if (this.ParentForm.SelectNodeIndex == -1)
return;
this.treeView1.Enabled = false;
this.buttonRead.Enabled = false;
this.buttonClose.Enabled = false;
if (this.treeView1.Nodes.Count != 0)
if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false)
{
this.ParentForm.ClearData();
if (this.ParentForm.SelectNodeIndex == -1)
return;
if (this.ParentForm.ParentForm.SystemConfig.EquipmentMode == 2)
ret = this.ParentForm.DataRead2();
else
this.treeView.Enabled = false;
this.buttonRead.Enabled = false;
this.buttonClose.Enabled = false;
if (this.treeView.Nodes.Count != 0)
{
this.ParentForm.ClearData();
ret = this.ParentForm.DataRead1();
if (ret == 0)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
else
this.DialogResult = DialogResult.Cancel;
}
this.treeView.Enabled = true;
this.buttonRead.Enabled = true;
this.buttonClose.Enabled = true;
}
else
{
string selectedFile = "", filePath = "";
selectedFile = this.GetSeletedNodeList(this.treeView);
if (selectedFile == "")
return;
this.treeView.Enabled = false;
this.buttonRead.Enabled = false;
this.buttonClose.Enabled = false;
this.ParentForm.ClearData();
filePath = string.Format("{0}{1}", this.ParentForm.ParentForm.PathDataInspectionFolder, selectedFile);
ret = this.ParentForm.DataRead1(filePath);
if (ret == 0)
{
this.DialogResult = DialogResult.OK;
@ -232,11 +539,11 @@ namespace INT69DB_2A.DialogForms
}
else
this.DialogResult = DialogResult.Cancel;
}
this.treeView1.Enabled = true;
this.buttonRead.Enabled = true;
this.buttonClose.Enabled = true;
this.treeView.Enabled = true;
this.buttonRead.Enabled = true;
this.buttonClose.Enabled = true;
}
}
private void buttonClose_Click(object sender, EventArgs e)
{
@ -244,27 +551,40 @@ namespace INT69DB_2A.DialogForms
this.Close();
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
{
string fileName = "";
string fileName = "", date = "-";
string[] splitFileName = e.Node.Text.Split('-');
if (e.Node.Parent == null)
if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false)
{
fileName = e.Node.Text;
this.ParentForm.SelectNodeIndex = e.Node.Index;
//this.labelNodeIndex.Text = string.Format("{0}", this.ParentForm.SelectNodeIndex + 1);
if (e.Node.Parent == null)
{
fileName = e.Node.Text;
this.ParentForm.SelectNodeIndex = e.Node.Index;
//this.labelNodeIndex.Text = string.Format("{0}", this.ParentForm.SelectNodeIndex + 1);
}
else
{
fileName = e.Node.Parent.Text;
this.ParentForm.SelectNodeIndex = e.Node.Parent.Index;
//this.labelNodeIndex.Text = string.Format("{0}", this.ParentForm.SelectNodeIndex + 1);
}
date = string.Format("{0}.{1}.{2}", fileName.Substring(0, 4), fileName.Substring(4, 2), fileName.Substring(6, 2));
}
else
{
fileName = e.Node.Parent.Text;
this.ParentForm.SelectNodeIndex = e.Node.Parent.Index;
//this.labelNodeIndex.Text = string.Format("{0}", this.ParentForm.SelectNodeIndex + 1);
if (e.Node.Text.Substring(0, 1) == "I")
{
fileName = e.Node.Text;
date = string.Format("{0}.{1}.{2}", fileName.Substring(1, 4), fileName.Substring(5, 2), fileName.Substring(7, 2));
}
}
this.labelFileName.Text = fileName;
this.labelDate.Text = string.Format("{0}.{1}.{2}", fileName.Substring(0, 4), fileName.Substring(4, 2), fileName.Substring(6, 2));
this.labelProductNo.Text = fileName.Substring(9, 1);
this.labelId.Text = fileName.Substring(11, 1);
this.labelProductNo.Text = splitFileName[1];
this.labelDate.Text = date;
}
#endregion
}

View File

@ -107,10 +107,11 @@ namespace INT69DB_2A.Forms
dataFolderPath = this.ParentForm.PathDataHistoryFolder;
break;
case DataStore.E_DataType.Inspection:
if(this.ParentForm.SystemConfig.EquipmentMode == 2)
dataFolderPath = this.ParentForm.PathDataInspectionStick2Folder;
else
dataFolderPath = this.ParentForm.PathDataInspectionStick1Folder;
dataFolderPath = this.ParentForm.PathDataInspectionFolder;
//if (this.ParentForm.SystemConfig.EquipmentMode == 2)
// dataFolderPath = this.ParentForm.PathDataInspectionStick2Folder;
//else
// dataFolderPath = this.ParentForm.PathDataInspectionStick1Folder;
break;
case DataStore.E_DataType.Others:
dataFolderPath = this.ParentForm.PathDataOthersFolder;

View File

@ -548,234 +548,156 @@ namespace INT69DB_2A.Forms
}
private void DataAnalysis()
{
if (this.ParentForm.SystemConfig.EquipmentMode == 2)
#region Data SET
if (this.ParentForm.SystemConfig.EquipmentColumns == 7)
{
#region Stick 2
for (int i = 0; i < this.CollectionWeightDataStick2.Count; i++)
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
for (int j = 0; j < this.CollectionWeightDataStick2[i].Count; j++)
{
this.SetData(this.CollectionLaneData[i], this.CollectionWeightDataStick2[i][j][9], Helper.StringToJudgmentStatusStatistics(this.CollectionWeightDataStick2[i][j][10]));
}
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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
#endregion
}
else
{
#region Stick 1,3
if (this.ParentForm.SystemConfig.EquipmentColumns == 2)
for (int i = 0; i < this.CollectionWeightData.Count; i++)
{
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[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]));
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else if (this.ParentForm.SystemConfig.EquipmentColumns == 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]));
}
}
else
{
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]));
}
}
#endregion
}
#endregion
for (int i = 0; i < this.CollectionLaneData.Count; i++)
this.CollectionLaneData[i].StatisticalAnalysis();
if (this.ParentForm.SystemConfig.EquipmentMode == 2)
this.SetCommonData(this.CollectionWeightDataStick2, this.CollectionLaneData);
else
this.SetCommonData(this.CollectionWeightData, this.CollectionLaneData);
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;
int ret = 0;
SmartX.SmartSplash splash;
splash = new SmartX.SmartSplash();
SmartSplash 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]);
ret = this.DataReadToAnalysis(path);
this.CollectionWeightData.Clear();
splash.Finish();
this.ParentForm.smartFileIO.FilePathName = path;
this.ParentForm.smartFileIO.Open(2000000);
this.ParentForm.smartFileIO.ReadStringAllBuffer();
try
if (ret != 0)
{
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 int DataRead2()
public int DataRead1(string filePath)
{
string path = "", lane = "";
int ret = 0, index = 0;
List<string[]> lt;
int ret = 0;
SmartX.SmartSplash splash;
splash = new SmartX.SmartSplash();
SmartSplash splash = new SmartX.SmartSplash();
splash.CenterPosition = true;
splash.AnimationInterval = 100;
splash.LoadingImagePathname = "SmartLoading4";
splash.Start();
lt = new List<string[]>();
this.CollectionWeightData.Clear();
ret = this.DataReadToAnalysis(filePath);
this.CollectionWeightData.Clear();
splash.Finish();
// 열별로 삭제
for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
this.CollectionWeightDataStick2[i].Clear();
if (ret != 0)
{
// 이 파일은 지원이 되지 않습니다
DialogFormMessage msg = new DialogFormMessage(13, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
}
return ret;
}
private int DataReadToAnalysis(string path)
{
int ret = 0;
StreamReader sr;
try
{
for (int i = 0; i < this.CollectionFileClassification[this.SelectNodeIndex].Count; i++)
{
lt.Clear();
if (this.CollectionFileClassification[this.SelectNodeIndex][i].Length == 22)
lane = this.CollectionFileClassification[this.SelectNodeIndex][i].Substring(13, 1);
else
lane = this.CollectionFileClassification[this.SelectNodeIndex][i].Substring(13, 2);
index = int.Parse(lane);
sr = new StreamReader(path, Encoding.UTF8);
path = string.Format("{0}{1}", this.ParentForm.PathDataBackupFolder, this.CollectionFileClassification[this.SelectNodeIndex][i]);
this.LoadDataBackupFile(ref this.CollectionWeightDataStick2, path, index - 1);
while (sr.EndOfStream != true)
{
this.CollectionWeightData.Add(sr.ReadLine().Split(','));
}
sr.Close();
this.CollectionWeightData.RemoveAt(0);
this.DataAnalysis();
splash.Finish();
ret = 0;
}
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();
@ -783,16 +705,15 @@ namespace INT69DB_2A.Forms
for (int i = 0; i < this.CollectionLaneData.Count; i++)
this.CollectionLaneData[i].ClearDatas();
}
private void FileBackup(DataCommonList commonList, Collection<DataCollector> datas)
private void FileBackup1(string path, DateTime time, 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);
fullFilePath = string.Format("{0}S{1:yyyyMMdd-HHmmss}.csv", path, time);
this.ParentForm.smartFileIO.FilePathName = fullFilePath;
sw = new StreamWriter(fullFilePath, true, Encoding.Default);
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
@ -986,6 +907,167 @@ namespace INT69DB_2A.Forms
sw.Close();
}
private void FileBackup2(string path, DateTime time, DataCommonList commonList, Collection<DataCollector> datas)
{
bool fileCheck = false;
string fullFilePath = "";
StreamWriter sw;
fullFilePath = string.Format("{0}S{1:yyyyMMdd-HHmmss}.csv", path, time);
this.ParentForm.smartFileIO.FilePathName = fullFilePath;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
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();
}
for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++)
{
// Lane Number
sw.Write("{0}", i + 1);
sw.Write(",");
// ProductName
sw.Write(commonList.ProductName);
sw.Write(",");
// Lot
sw.Write(commonList.Lot);
sw.Write(",");
// StartTime
sw.Write(commonList.StartTime);
sw.Write(",");
// EndTime
sw.Write(commonList.EndTime);
sw.Write(",");
// UnderRange
sw.Write(commonList.UnderRange);
sw.Write(",");
// PassRange
sw.Write(commonList.PassRange);
sw.Write(",");
// OverRange
sw.Write(commonList.OverRange);
sw.Write(",");
// TareRange
sw.Write(commonList.TareRange);
sw.Write(",");
// TotalCount
sw.Write(commonList.TotalCount);
sw.Write(",");
// TotalNGCount
sw.Write(commonList.TotalNGCount);
sw.Write(",");
// TotalPassCount
sw.Write(commonList.TotalPassCount);
sw.Write(",");
// TotalPassPercentage
sw.Write(commonList.TotalPassPercentage);
sw.Write(",");
// TotalPassAverage
sw.Write(string.Format("{0:0.000}", commonList.TotalPassAverageWeight));
sw.Write(",");
// TotalPassSD
sw.Write(string.Format("{0:0.00}", commonList.TotalPassStandardDeviation));
sw.Write(",");
// TotalUnderCount
sw.Write(commonList.TotalUnderCount);
sw.Write(",");
// TotalUnderPercentage
sw.Write(commonList.TotalUnderPercentage);
sw.Write(",");
// TotalUnderSumWeight
sw.Write(string.Format("{0:0.0000}", commonList.TotalUnderSumWeight / 1000));
sw.Write(",");
// TotalOverCount
sw.Write(commonList.TotalOverCount);
sw.Write(",");
// TotalOverPercentage
sw.Write(commonList.TotalOverPercentage);
sw.Write(",");
// TotalOverSumWeight
sw.Write(string.Format("{0:0.0000}", commonList.TotalOverSumWeight / 1000));
sw.Write(",");
// TotalExNgCount
sw.Write(commonList.TotalExNgCount);
sw.Write(",");
// TotalExNgPercentage
sw.Write(commonList.TotalExNgPercentage);
sw.Write(",");
// Lane PassCount
sw.Write(datas[i].PassTotalCount);
sw.Write(",");
// Lane PassAverage
sw.Write(string.Format("{0:0.000}", datas[i].PassAverage));
sw.Write(",");
// Lane PassPercentage
sw.Write(datas[i].PassPercentage);
sw.Write(",");
// Lane PassSD
sw.Write(string.Format("{0:0.00}", datas[i].PassStandardDeviation));
sw.Write(",");
// Lane PassMinWeight
sw.Write(Helper.DoubleToString(datas[i].PassMinWeight, 1));
sw.Write(",");
// Lane PassMaxWeight
sw.Write(Helper.DoubleToString(datas[i].PassMaxWeight, 1));
sw.Write(",");
// Lane OverCount
sw.Write(datas[i].OverTotalCount);
sw.Write(",");
// Lane OverSumWeight
sw.Write(Helper.DoubleToString(datas[i].OverSumWeight / 1000, 3));
sw.Write(",");
// Lane OverPercentage
sw.Write(datas[i].OverPercentage);
sw.Write(",");
// Lane UnderCount
sw.Write(datas[i].UnderTotalCount);
sw.Write(",");
// Lane UnderSumWeight
sw.Write(Helper.DoubleToString(datas[i].UnderSumWeight / 1000, 3));
sw.Write(",");
// Lane UnderPercentage
sw.Write(datas[i].UnderPercentage);
sw.Write(",");
// Lane ExNgCount
sw.Write(datas[i].ExNgTotalCount);
sw.Write(",");
// Lane ExNgPercentage
sw.Write(datas[i].ExNgPercentage);
sw.Write(",");
// Lane TotalCount
sw.Write(datas[i].TotalCount);
sw.Write(",");
// Lane TotalNgCount
sw.Write(datas[i].TotalNGCount);
sw.WriteLine();
}
sw.Close();
}
private bool CheckUSBMemory()
{
bool ret = false;
@ -1025,6 +1107,96 @@ namespace INT69DB_2A.Forms
this.FileCopy(file, fileName);
}
}
//private void CreateScreenCapture(string path, DateTime time)
//{
// string filePath = "";
// Bitmap bitMap = new Bitmap(1024, 768);
// bitMap = IntechGraphics.CopyFromScreen();
// filePath = string.Format("{0}S{1:yyyyMMdd-HHmmss}.jpg", path, time);
// bitMap.Save(filePath, ImageFormat.Jpeg);
//}
private void Backup()
{
this.SelectNodeIndex = -1;
DialogFormDataStatistics form = new DialogFormDataStatistics(this);
if (form.ShowDialog() == DialogResult.OK)
this.buttonSave.Enabled = true;
else
this.buttonSave.Enabled = false;
}
private int Backup1()
{
int ret = 0;
string filePath = "";
bool directoryCheck = false;
DateTime time = DateTime.Now;
// 메모리 장착 체크
if (this.CheckUSBMemory() == false)
{
DialogFormMessage msg = new DialogFormMessage(5, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
this.buttonSave.Enabled = true;
ret = -1;
return ret;
}
#region 통계 데이터 생성
// ScreenCapture
//this.CreateScreenCapture(this.ParentForm.PathDataStatisticsFolder, time);
// csv File
this.FileBackup1(this.ParentForm.PathDataStatisticsFolder, time, 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();
// ret = -1;
// return ret;
//}
#endregion
return ret;
}
private int Backup2()
{
int ret = 0;
DateTime time = DateTime.Now;
// ScreenCapture
//this.CreateScreenCapture(this.ParentForm.PathDataBackupFolder, time);
// csv File
this.FileBackup2(this.ParentForm.PathDataBackupFolder, time, this.CurrentDataCommonList, this.CollectionLaneData);
return ret;
}
public void DisplayRefresh()
{
@ -1065,51 +1237,10 @@ namespace INT69DB_2A.Forms
{
this.buttonSave.Enabled = false;
string filePath = "";
bool directoryCheck = false;
// 메모리 장착 체크
if (this.CheckUSBMemory() == false)
{
DialogFormMessage msg = new DialogFormMessage(5, this.ParentForm.SystemConfig.Language);
msg.ShowDialog();
this.buttonSave.Enabled = true;
return;
}
#region 통계 데이터 생성
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
if (this.ParentForm.SystemConfig.IsPart11 == false)
this.Backup1();
else
this.Backup2();
this.buttonSave.Enabled = true;
}

View File

@ -314,8 +314,8 @@ namespace INT69DB_2A.Forms
this.ChildFormDataBackup = new FormDataBackup(this);
else
{
this.ChildFormDataBackup_Part11 = new FormDataBackup_Part11(this);
this.ChildFormDataStatistics = new FormDataStatistics(this);
this.ChildFormDataBackup_Part11 = new FormDataBackup_Part11(this);
this.ChildFormDataViewer = new FormDataViewer(this);
}
@ -343,8 +343,8 @@ namespace INT69DB_2A.Forms
this.smartForm.AddChildForm(this.ChildFormDataBackup);
else
{
this.smartForm.AddChildForm(this.ChildFormDataBackup_Part11);
this.smartForm.AddChildForm(this.ChildFormDataStatistics);
this.smartForm.AddChildForm(this.ChildFormDataBackup_Part11);
this.smartForm.AddChildForm(this.ChildFormDataViewer);
}
}
@ -501,13 +501,13 @@ namespace INT69DB_2A.Forms
if (Directory.Exists(this.PathDataInspectionFolder) == false)
Directory.CreateDirectory(this.PathDataInspectionFolder);
// Inspection\\Stick1 폴더 생성
if (Directory.Exists(this.PathDataInspectionStick1Folder) == false)
Directory.CreateDirectory(this.PathDataInspectionStick1Folder);
//// Inspection\\Stick1 폴더 생성
//if (Directory.Exists(this.PathDataInspectionStick1Folder) == false)
// Directory.CreateDirectory(this.PathDataInspectionStick1Folder);
// Inspection\\Stick2 폴더 생성
if (Directory.Exists(this.PathDataInspectionStick2Folder) == false)
Directory.CreateDirectory(this.PathDataInspectionStick2Folder);
//// Inspection\\Stick2 폴더 생성
//if (Directory.Exists(this.PathDataInspectionStick2Folder) == false)
// Directory.CreateDirectory(this.PathDataInspectionStick2Folder);
// Encryption 폴더 생성
if (Directory.Exists(this.PathEncryptionFolder) == false)
@ -3962,10 +3962,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if(this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[0], 1);
else
this.DataBackup(this.CollectionWeightData[0], 1);
this.TrackingInspectionData(this.CollectionWeightData[0], 1);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]);
this.Update30000ModbusData(0);
@ -3995,10 +3992,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[1], 2);
else
this.DataBackup(this.CollectionWeightData[1], 2);
this.TrackingInspectionData(this.CollectionWeightData[1], 2);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]);
this.Update30000ModbusData(1);
@ -4028,10 +4022,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[2], 3);
else
this.DataBackup(this.CollectionWeightData[2], 3);
this.TrackingInspectionData(this.CollectionWeightData[2], 3);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]);
this.Update30000ModbusData(2);
@ -4061,10 +4052,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[3], 4);
else
this.DataBackup(this.CollectionWeightData[3], 4);
this.TrackingInspectionData(this.CollectionWeightData[3], 4);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]);
this.Update30000ModbusData(3);
@ -4094,10 +4082,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[4], 5);
else
this.DataBackup(this.CollectionWeightData[4], 5);
this.TrackingInspectionData(this.CollectionWeightData[4], 5);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]);
this.Update30000ModbusData(4);
@ -4127,10 +4112,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[5], 6);
else
this.DataBackup(this.CollectionWeightData[5], 6);
this.TrackingInspectionData(this.CollectionWeightData[5], 6);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]);
this.Update30000ModbusData(5);
@ -4160,10 +4142,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[6], 7);
else
this.DataBackup(this.CollectionWeightData[6], 7);
this.TrackingInspectionData(this.CollectionWeightData[6], 7);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]);
this.Update30000ModbusData(6);
@ -4193,10 +4172,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[7], 8);
else
this.DataBackup(this.CollectionWeightData[7], 8);
this.TrackingInspectionData(this.CollectionWeightData[7], 8);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightData[7]);
this.Update30000ModbusData(7);
@ -4226,10 +4202,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[8], 9);
else
this.DataBackup(this.CollectionWeightData[8], 9);
this.TrackingInspectionData(this.CollectionWeightData[8], 9);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightData[8]);
this.Update30000ModbusData(8);
@ -4259,10 +4232,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData[9], 10);
else
this.DataBackup(this.CollectionWeightData[9], 10);
this.TrackingInspectionData(this.CollectionWeightData[9], 10);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightData[9]);
this.Update30000ModbusData(9);
@ -4298,10 +4268,7 @@ namespace INT69DB_2A.Forms
#endregion
if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay)
{
if (this.SystemConfig.IsPart11 == true)
this.TrackingInspectionData(this.CollectionWeightData);
else
this.DataBackup(this.CollectionWeightData);
this.TrackingInspectionData(this.CollectionWeightData);
this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay(this.EquipmentStatus, this.CollectionWeightData);
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
@ -6311,166 +6278,6 @@ namespace INT69DB_2A.Forms
}
#endregion
#region Data Backup
private void DataBackup(Collection<WeightData> items)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "";
StreamWriter sw;
this.RemoveUsbBackupFile();
if (this.SystemConfig.IsDataBackup == true)
{
fullFilePath = string.Format("{0}{1:yyyyMMdd}_{2}.csv", this.PathDataBackupFolder, DateTime.Now, this.SystemConfig.UsbID);
DirectoryInfo di = new DirectoryInfo(this.PathDataBackupFolder);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
{
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("P_No");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sw.Write(",");
sw.Write(string.Format("#{0}_Weight", i + 1));
sw.Write(",");
sw.Write("Grade");
}
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write(this.CurrentProductItem.Number);
sw.Write(",");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write(this.CurrentProductItem.LotNo);
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(items[i].Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(items[i].JudgmentStatus);
}
sw.WriteLine();
sw.Close();
}
}
private void DataBackup(WeightData item, int line)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "";
StreamWriter sw;
this.RemoveUsbBackupFile();
if (this.SystemConfig.IsDataBackup == true)
{
fullFilePath = string.Format("{0}{1:yyyyMMdd}_{2}_{3}Line.csv", this.PathDataBackupFolder, DateTime.Now, this.SystemConfig.UsbID, line);
DirectoryInfo di = new DirectoryInfo(this.PathDataBackupFolder);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
{
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("P_No");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
sw.Write(",");
sw.Write("Weight");
sw.Write(",");
sw.Write("Grade");
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write(this.CurrentProductItem.Number);
sw.Write(",");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write(this.CurrentProductItem.LotNo);
sw.Write(",");
sw.Write(Helper.DoubleToString(item.Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(item.JudgmentStatus);
sw.WriteLine();
sw.Close();
}
}
private void RemoveUsbBackupFile()
{
bool directoryCheck = false;
try
{
string dday = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-180)) + ".csv";
DirectoryInfo dir = new DirectoryInfo(this.PathDataBackupFolder);
directoryCheck = dir.Exists;
// 폴더 체크
if (directoryCheck == false)
dir.Create();
FileInfo[] files = dir.GetFiles();
foreach (FileInfo subfile in files)
{
if (subfile.Name.StartsWith("20")) // 날짜 비교하여 180일 지난화일은 삭제함
{
if (subfile.Name.CompareTo(dday) < 0)
{
subfile.Delete();
}
}
}
}
catch
{
}
}
#endregion
#region Backup
public List<string> GetSeletedNodeList(TreeView tree)
{
@ -6548,142 +6355,234 @@ namespace INT69DB_2A.Forms
{
DateTime time = DateTime.Now;
folder = string.Format("{0}{1}\\{2}\\", this.PathDataInspectionFolder, time.Year, time.Month);
if (Directory.Exists(folder) == false)
Directory.CreateDirectory(folder);
fileName = string.Format("I{0:yyyyMMdd}-{1}.csv", time, this.CurrentProductItem.Number);
if (this.SystemConfig.IsPart11 == false)
{
folder = this.PathDataBackupFolder;
fileName = string.Format("{0:yyyyMMdd}-{1}", time, this.SystemConfig.ProductNumber);
}
else
{
folder = string.Format("{0}{1}\\{2}\\", this.PathDataInspectionFolder, time.Year, time.Month);
fileName = string.Format("I{0:yyyyMMdd}-{1}.csv", time, this.SystemConfig.ProductNumber);
}
}
private void GetTrackingInspectionFolderPath(ref string folder, ref string fileName, int lane)
{
string ret = "";
DateTime time = DateTime.Now;
if (this.SystemConfig.IsPart11 == false)
{
ret = string.Format("{0}{1:yyyyMMdd}-{2}_{3}Lane.csv", this.PathDataBackupFolder, DateTime.Now, this.SystemConfig.ProductNumber, lane);
folder = this.PathDataBackupFolder;
fileName = string.Format("{0:yyyyMMdd}-{1}_{2}Lane.csv", time, this.SystemConfig.ProductNumber, lane);
}
else
{
folder = string.Format("{0}{1}\\{2}\\", this.PathDataInspectionFolder, time.Year, time.Month);
fileName = string.Format("I{0:yyyyMMdd}-{1}_{2}Lane.csv", time, this.SystemConfig.ProductNumber, lane);
}
}
/// <summary>
/// 스틱1
/// </summary>
/// <param name="item"></param>
public void TrackingInspectionData(Collection<WeightData> items)
private void TrackingInspectionData(Collection<WeightData> items)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
string filePathExtension = "";
StreamWriter sw;
DateTime time = DateTime.Now;
filePathExtension = ".csv";
this.GetTrackingInspectionFolderPath(ref folderPath, ref fileName);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
if (this.SystemConfig.IsDataBackup == true)
{
this.RemoveInspectionDataFile();
this.GetTrackingInspectionFolderPath(ref folderPath, ref fileName);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
sw.Write("Date");
DirectoryInfo di = new DirectoryInfo(folderPath);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
{
this.RemoveInspectionDataFile();
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("P_No");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
sw.Write(",");
sw.Write("UnderRange");
sw.Write(",");
sw.Write("PassRange");
sw.Write(",");
sw.Write("OverRange");
sw.Write(",");
sw.Write("TareRange");
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sw.Write(",");
sw.Write(string.Format("#{0}_Weight", i + 1));
sw.Write(",");
sw.Write(string.Format("#{0}_Grade", i + 1));
}
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write("Time");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write("P_No");
sw.Write(this.CurrentProductItem.Number);
sw.Write(",");
sw.Write("Name");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write("Lot");
sw.Write(this.CurrentProductItem.LotNo);
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces));
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sw.Write(",");
sw.Write(string.Format("#{0}_Weight", i + 1));
sw.Write(Helper.DoubleToString(items[i].Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(string.Format("#{0}_Grade", i + 1));
sw.Write(items[i].JudgmentStatus);
}
sw.WriteLine();
sw.Close();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", time));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", time));
sw.Write(",");
sw.Write(this.CurrentProductItem.Number);
sw.Write(",");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write(this.CurrentProductItem.LotNo);
for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++)
{
sw.Write(",");
sw.Write(Helper.DoubleToString(items[i].Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(items[i].JudgmentStatus);
}
sw.WriteLine();
sw.Close();
}
/// <summary>
/// 스틱2
/// </summary>
/// <param name="item"></param>
public void TrackingInspectionData(WeightData item, int line)
private void TrackingInspectionData(WeightData item, int lane)
{
bool fileCheck = false, directoryCheck = false;
string fullFilePath = "", folderPath = "", fileName = "";
string filePathExtension = "";
StreamWriter sw;
DateTime time = DateTime.Now;
filePathExtension = ".csv";
this.GetTrackingInspectionFolderPath(ref folderPath, ref fileName);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
if (this.SystemConfig.IsDataBackup == true)
{
this.RemoveInspectionDataFile();
this.GetTrackingInspectionFolderPath(ref folderPath, ref fileName);
fullFilePath = string.Format("{0}{1}", folderPath, fileName);
sw.Write("Date");
DirectoryInfo di = new DirectoryInfo(folderPath);
directoryCheck = di.Exists;
// 폴더 체크
if (directoryCheck == false)
di.Create();
FileInfo fileInfo = new FileInfo(fullFilePath);
fileCheck = fileInfo.Exists;
sw = new StreamWriter(fullFilePath, true, Encoding.UTF8);
if (fileCheck == false)
{
this.RemoveInspectionDataFile();
sw.Write("Date");
sw.Write(",");
sw.Write("Time");
sw.Write(",");
sw.Write("P_No");
sw.Write(",");
sw.Write("Name");
sw.Write(",");
sw.Write("Lot");
sw.Write(",");
sw.Write("UnderRange");
sw.Write(",");
sw.Write("PassRange");
sw.Write(",");
sw.Write("OverRange");
sw.Write(",");
sw.Write("TareRange");
sw.Write(",");
sw.Write("Weight");
sw.Write(",");
sw.Write("Grade");
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", DateTime.Now));
sw.Write(",");
sw.Write("Time");
sw.Write(string.Format("{0:HH:mm:ss}", DateTime.Now));
sw.Write(",");
sw.Write("P_No");
sw.Write(this.CurrentProductItem.Number);
sw.Write(",");
sw.Write("Name");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write("Lot");
sw.Write(this.CurrentProductItem.LotNo);
sw.Write(",");
sw.Write("Weight");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write("Grade");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.StringToDecimalPlaces(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(Helper.DoubleToString(item.Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(item.JudgmentStatus);
sw.WriteLine();
}
sw.Write(string.Format("{0:yyyy-MM-dd}", time));
sw.Write(",");
sw.Write(string.Format("{0:HH:mm:ss}", time));
sw.Write(",");
sw.Write(this.CurrentProductItem.Number);
sw.Write(",");
sw.Write(this.CurrentProductItem.Name);
sw.Write(",");
sw.Write(this.CurrentProductItem.LotNo);
sw.Write(",");
sw.Write(Helper.DoubleToString(item.Weight, this.SystemConfig.DecimalPlaces));
sw.Write(",");
sw.Write(item.JudgmentStatus);
sw.WriteLine();
sw.Close();
sw.Close();
}
}
private void RemoveInspectionDataFile()
{
try
{
this.DeleteLogFile(this.PathDataInspectionFolder, DataStore.E_DataType.Inspection);
if (this.SystemConfig.IsPart11 == true)
this.DeleteLogFile(this.PathDataInspectionFolder, DataStore.E_DataType.Inspection);
else
{
bool directoryCheck = false;
string dday = string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(-180)) + ".csv";
DirectoryInfo dir = new DirectoryInfo(this.PathDataInspectionFolder);
directoryCheck = dir.Exists;
// 폴더 체크
if (directoryCheck == false)
dir.Create();
FileInfo[] files = dir.GetFiles();
foreach (FileInfo subfile in files)
{
if (subfile.Name.StartsWith("20")) // 날짜 비교하여 10일 지난화일은 삭제함
{
if (subfile.Name.CompareTo(dday) < 0)
{
subfile.Delete();
}
}
}
}
}
catch
{

View File

@ -2151,19 +2151,19 @@ namespace INT69DB_2A.Forms
{
case (int)DataStore.StepMotorType.MDrive:
if (this.ParentForm.SystemConfig.IsImpellerMotorDirectionCW == true)
value = this.DeviceName + "MR -" + this.CurrentAngle + "00";
value = "MR -" + this.CurrentAngle + "00";
else
value = this.DeviceName + "MR " + this.CurrentAngle + "00";
value = "MR " + this.CurrentAngle + "00";
this.TransferDirectSTXETX0x0ACOM1(this.DeviceName + value);
break;
case (int)DataStore.StepMotorType.Moons:
if (this.ParentForm.SystemConfig.IsImpellerMotorDirectionCW == true)
value = this.SelectImpellerTag + "FL-" + this.CurrentAngle + "00";
value = "FL-" + this.CurrentAngle + "00";
else
value = this.SelectImpellerTag + "FL" + this.CurrentAngle + "00";
value = "FL" + this.CurrentAngle + "00";
this.TransferDirectETX0x0DCOM1(value);
this.TransferDirectETX0x0DCOM1(this.SelectImpellerTag + value);
break;
default:
break;
@ -2192,7 +2192,7 @@ namespace INT69DB_2A.Forms
else
value = "FL-" + this.CurrentAngle + "00";
this.TransferDirectETX0x0D(value);
this.TransferDirectETX0x0D(this.SelectImpellerTag + value);
break;
default:
break;

View File

@ -107,13 +107,11 @@ namespace INT69DB_2A.Forms
if (this.buttonPart11.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN)
{
this.ParentForm.SystemConfig.IsPart11 = true;
this.ParentForm.SystemConfig.IsDataBackup = true;
this.ParentForm.SystemConfig.IsLogin = true;
}
else
{
this.ParentForm.SystemConfig.IsPart11 = false;
this.ParentForm.SystemConfig.IsLogin = false;
}
// 데이터 통계 기능 사용 유무
if (this.buttonStatistics.ButtonStatus == SmartButton.BUTSTATUS.DOWN)

View File

@ -19,6 +19,8 @@
- Ver 4.5.0 Modify
- Framework : SmartX Framework V3.1.1(update: 2019.03.21)
- (V4.5.1) 영문화면 영문 변경 안되는 버그 수정
- 모터설정 - 모터 테스트(COM1, RS485)
'정회전' 동작 안하는 버그 수정
- Part 11 적용
INT69DC_7C V11.0.0 참조

Binary file not shown.