diff --git a/INT69DB_2A/Controls/ControlUserSetting.cs b/INT69DB_2A/Controls/ControlUserSetting.cs index b0fb29d..1847926 100644 --- a/INT69DB_2A/Controls/ControlUserSetting.cs +++ b/INT69DB_2A/Controls/ControlUserSetting.cs @@ -103,8 +103,8 @@ namespace INT69DB_2A.Controls this.labelID.Text = item.ID; this.labelPassword.Text = item.Password; - this.labelExpireAccountDate.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateRegister, item.DateExpireRegister); - this.labelExpirePasswordDate.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateLogin, item.DateExpireLogin); + this.labelExpireAccountDate.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateIdLogin, item.DateIdExpire); + this.labelExpirePasswordDate.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DatePasswordRegister, item.DatePasswordExpire); this.labelStatusExpireAccount.Visible = item.IsLockAccount; this.labelStatusExpirePassword.Visible = item.IsLockPassword; } @@ -176,7 +176,7 @@ namespace INT69DB_2A.Controls private void labelPassword_Click(object sender, EventArgs e) { string value = ""; - DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelPassword.Text, this.labelTitlePassword.Text); + DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelPassword.Text); if (keyboard.ShowDialog() == DialogResult.OK) { diff --git a/INT69DB_2A/DataStore.cs b/INT69DB_2A/DataStore.cs index 1447492..3af3154 100644 --- a/INT69DB_2A/DataStore.cs +++ b/INT69DB_2A/DataStore.cs @@ -500,6 +500,7 @@ namespace INT69DB_2A Level1Name, Level2Name, Level3Name, + AutoLogout, } public enum TrackingAlarm { @@ -1145,6 +1146,7 @@ namespace INT69DB_2A private bool m_IsIndividualTransmission; private bool m_IsPingTimer; private bool m_IsOptDataStatistics; + private bool m_IsIntegratedTransmission; private int m_DecimalPlaces; private int m_EthernetPort; @@ -1178,13 +1180,13 @@ namespace INT69DB_2A private int m_ModbusTcpAddress2; private int m_ModbusTcpStartAddress; private string m_EthernetServerAddress; - + private bool m_IsPart11; private string m_User_Level1_Name; private string m_User_Level2_Name; private string m_User_Level3_Name; private int m_StoragePeriod; - private int m_UserAutomaticLogout; + private int m_AutomaticLogout; #endregion #region Constructor @@ -1281,6 +1283,11 @@ namespace INT69DB_2A get { return this.m_IsOptDataStatistics; } set { this.m_IsOptDataStatistics = value; } } + public bool IsIntegratedTransmission + { + get { return this.m_IsIntegratedTransmission; } + set { this.m_IsIntegratedTransmission = value; } + } public int DecimalPlaces { @@ -1456,10 +1463,10 @@ namespace INT69DB_2A get { return this.m_StoragePeriod; } set { this.m_StoragePeriod = value; } } - public int UserAutomaticLogout + public int AutomaticLogout { - get { return this.m_UserAutomaticLogout; } - set { this.m_UserAutomaticLogout = value; } + get { return this.m_AutomaticLogout; } + set { this.m_AutomaticLogout = value; } } #endregion @@ -1481,6 +1488,7 @@ namespace INT69DB_2A this.IsPrintPerProductEnable = false; this.IsPingTimer = false; this.IsOptDataStatistics = false; + this.IsIntegratedTransmission = false; this.DecimalPlaces = 1; this.EthernetPort = 5000; @@ -1521,7 +1529,7 @@ namespace INT69DB_2A this.User_Level2_Name = "Level 2"; this.User_Level3_Name = "Level 3"; this.StoragePeriod = 12; - this.UserAutomaticLogout = 90; + this.AutomaticLogout = 90; } #endregion } @@ -1563,7 +1571,7 @@ namespace INT69DB_2A public DataStore.LanguageID Language; public bool DummyBool1; - public bool DummyBool2; + public bool IsIntegratedTransmission; public bool IsLogin; public bool IsFeedingConveyorRunPass; @@ -1626,7 +1634,7 @@ namespace INT69DB_2A public int EthernetMode; public int EthernetServerPort; public int DummyInt10; - public int UserAutomaticLogout; + public int AutomaticLogout; public int StoragePeriod; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] @@ -1828,6 +1836,8 @@ namespace INT69DB_2A private int PreviousTimeTickCount; private bool m_IsStart; + private bool m_IsUpdate; + private string m_WeightString; private ushort m_UpdateCount; #endregion @@ -1967,7 +1977,6 @@ namespace INT69DB_2A } } } - public DataStore.WeightStatus Status { get { return this.m_Status; } @@ -1985,6 +1994,15 @@ namespace INT69DB_2A set { this.m_IsStart = value; } } + /// + /// 스틱2모드에서 데이터 갱신이 되었으면 true, 안되었으면 false + /// + public bool IsUpdate + { + get { return this.m_IsUpdate; } + set { this.m_IsUpdate = value; } + } + public string WeightString { get { return this.m_WeightString; } @@ -2015,6 +2033,7 @@ namespace INT69DB_2A this.ExNGCount = 0; this.Weight = 0.0; this.ADCValue = "12345"; + this.IsUpdate = false; this.JudgmentStatus = DataStore.JudgmentStatus.Empty; this.ProductionSpeed = 0; this.WeightString = "0"; diff --git a/INT69DB_2A/DialogForms/DialogFormDataStatistics.Designer.cs b/INT69DB_2A/DialogForms/DialogFormDataStatistics.Designer.cs index ed8b8a4..4078c06 100644 --- a/INT69DB_2A/DialogForms/DialogFormDataStatistics.Designer.cs +++ b/INT69DB_2A/DialogForms/DialogFormDataStatistics.Designer.cs @@ -30,7 +30,7 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DialogFormDataStatistics)); this.smartForm1 = new SmartX.SmartForm(); - this.treeView = new System.Windows.Forms.TreeView(); + this.treeView1 = new System.Windows.Forms.TreeView(); this.buttonRead = new SmartX.SmartButton(); this.labelFileName = new SmartX.SmartLabel(); this.smartGroupBox1 = new SmartX.SmartGroupBox(); @@ -59,13 +59,12 @@ this.smartForm1.SpecialFunctionClickPointSize = 100; this.smartForm1.SuspendLayoutInterval = 0; // - // treeView + // treeView1 // - 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); + 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; // // buttonRead // @@ -133,7 +132,7 @@ this.smartGroupBox1.Controls.Add(this.buttonClose); this.smartGroupBox1.Controls.Add(this.labelFileName); this.smartGroupBox1.Controls.Add(this.buttonRead); - this.smartGroupBox1.Controls.Add(this.treeView); + this.smartGroupBox1.Controls.Add(this.treeView1); this.smartGroupBox1.FrameLineColor1 = System.Drawing.Color.Black; this.smartGroupBox1.FrameLineColor2 = System.Drawing.Color.Black; this.smartGroupBox1.FrameLineThickness = 1; @@ -306,7 +305,7 @@ #endregion private SmartX.SmartForm smartForm1; - private System.Windows.Forms.TreeView treeView; + private System.Windows.Forms.TreeView treeView1; private SmartX.SmartButton buttonRead; private SmartX.SmartLabel labelFileName; private SmartX.SmartGroupBox smartGroupBox1; diff --git a/INT69DB_2A/DialogForms/DialogFormDataStatistics.cs b/INT69DB_2A/DialogForms/DialogFormDataStatistics.cs index 01a6de2..aeded29 100644 --- a/INT69DB_2A/DialogForms/DialogFormDataStatistics.cs +++ b/INT69DB_2A/DialogForms/DialogFormDataStatistics.cs @@ -17,8 +17,11 @@ namespace INT69DB_2A.DialogForms { #region Field private FormDataStatistics m_ParentForm; + + public List ListFiles; // 파일 리스트 - Part11 미사용 시 + public List ListInspectionFile; // 파일 리스트 - Part11 사용 시 #endregion - + #region Constructor public DialogFormDataStatistics(FormDataStatistics parent) { @@ -29,7 +32,7 @@ namespace INT69DB_2A.DialogForms this.InitializeDesign(); this.InitializeContnrol(); this.DefaultSetting(); - } + } #endregion #region Property @@ -42,7 +45,7 @@ namespace INT69DB_2A.DialogForms #region Method private void InitializeDesign() - { + { } private void InitializeContnrol() { @@ -57,8 +60,11 @@ namespace INT69DB_2A.DialogForms } private void DefaultSetting() { + this.ListFiles = new List(); + this.ListInspectionFile = new List(); + if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false) - this.DisplayTreeViewUpdate1(); + this.DisplayTreeViewUpdate11(); else this.DisplayTreeViewUpdate2(); @@ -68,255 +74,6 @@ namespace INT69DB_2A.DialogForms this.labelProductNo.Text = "-"; } - #region 기존코드 - //private Collection> FileClassification(List files) - //{ - // string date = "", date1 = ""; - // Collection> fileClassification = new Collection>(); - // List list = new List(); - - // 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 l = new List(); - - // foreach (string s in list) - // l.Add(s); - - // fileClassification.Add(l); - // list = new List(); - // list.Add(files[i]); - // } - // } - - // List ls = new List(); - // foreach (string s in list) - // ls.Add(s); - // fileClassification.Add(ls); - - // return fileClassification; - //} - //private List FileSort(FileInfo[] files) - //{ - // List listFiles = new List(); - // Dictionary fileNames = new Dictionary(); - // Dictionary fileNamesSort = new Dictionary(); - - // 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 FileSort(List lst) - //{ - // List listFiles = new List(); - // Dictionary fileNames = new Dictionary(); - // Dictionary fileNamesSort = new Dictionary(); - - // 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 fileNames = new List(); - - // // 폴더 체크 - // 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 list in this.ParentForm.CollectionFileClassification) - // { - // List myList = new List(); - - // // 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 listSelectedFile = new List(); - 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> FileClassification(List files) - { - string date = "", date1 = ""; - Collection> fileClassification = new Collection>(); - List list = new List(); - - for (int i = 0; i < files.Count; i++) - { - date = files[i].Substring(0, 8); - if (i == 0) - date1 = date; - - if (date == date1) - { - list.Add(files[i]); - } - else - { - date1 = date; - - List l = new List(); - - foreach (string s in list) - l.Add(s); - - fileClassification.Add(l); - list = new List(); - list.Add(files[i]); - } - } - - List ls = new List(); - foreach (string s in list) - ls.Add(s); - fileClassification.Add(ls); - - return fileClassification; - } - private List FileSort(FileInfo[] files) - { - List listFiles = new List(); - Dictionary fileNames = new Dictionary(); - Dictionary fileNamesSort = new Dictionary(); - - foreach (FileInfo file in files) - { - if (file.Name.StartsWith("20") == true) - fileNames.Add(file.Name, int.Parse(file.Name.Substring(9, 1))); - } - - var vrList = fileNames.OrderBy(x => x.Value); - foreach (var v in vrList) - listFiles.Add(v.Key); - - return listFiles; - } - private List FileSort(List lst) - { - List listFiles = new List(); - Dictionary fileNames = new Dictionary(); - Dictionary fileNamesSort = new Dictionary(); - - 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 List DirectorySort(DirectoryInfo[] directorys) { List listDirectory = new List(); @@ -334,12 +91,47 @@ namespace INT69DB_2A.DialogForms } private List DayInspectionDirectorySort(FileInfo[] files) { + string[] fileName; List listFile = new List(); Dictionary dirNames = new Dictionary(); #region File List 품번 순서데로 정렬 foreach (FileInfo file in files) - dirNames.Add(file.Name, int.Parse(file.Name.Substring(10, 1))); + { + fileName = file.Name.Split('_'); + dirNames.Add(file.Name, int.Parse(fileName[1].Substring(0, fileName[1].Length - 4))); + } + + var vrList = dirNames.OrderBy(x => x.Value); + foreach (var v in vrList) + listFile.Add(v.Key); + #endregion + + #region File List 날짜 순서데로 정렬 + dirNames = new Dictionary(); + foreach (string f in listFile) + dirNames.Add(f, int.Parse(f.Substring(0, 8))); + + listFile.Clear(); + vrList = dirNames.OrderBy(x => x.Value); + foreach (var v in vrList) + listFile.Add(v.Key); + #endregion + + return listFile; + } + private List DayInspectionDirectorySort2(FileInfo[] files) + { + string[] fileName; + List listFile = new List(); + Dictionary dirNames = new Dictionary(); + + #region File List 품번 순서데로 정렬 + foreach (FileInfo file in files) + { + fileName = file.Name.Split('_'); + dirNames.Add(file.Name, int.Parse(fileName[1].Substring(0, fileName[1].Length - 4))); + } var vrList = dirNames.OrderBy(x => x.Value); foreach (var v in vrList) @@ -360,10 +152,11 @@ namespace INT69DB_2A.DialogForms return listFile; } - private void DisplayTreeViewUpdate1() + /// + /// Part11 미사용 + /// + private void DisplayTreeViewUpdate11() { - int fileCount = 0; - DirectoryInfo dir = new DirectoryInfo(this.ParentForm.ParentForm.PathDataBackupFolder); List fileNames = new List(); @@ -373,43 +166,31 @@ namespace INT69DB_2A.DialogForms FileInfo[] files = dir.GetFiles(); - foreach (FileInfo file in files) + if (files.Length != 0) { - if (file.Name.StartsWith("20") == true) - fileCount++; - } + // 날짜, 품번 순으로 정렬 + fileNames = this.DayInspectionDirectorySort(files); + this.ListFiles = fileNames; - if (fileCount != 0) - { - // 파일 이름 순으로 정렬 - fileNames = this.FileSort(files); - // 파일 날짜 순으로 분류 - this.ParentForm.CollectionFileClassification = this.FileClassification(fileNames); - - foreach (List list in this.ParentForm.CollectionFileClassification) + foreach (string name in fileNames) { - TreeNode node = new TreeNode(list[0].Substring(0, 10)); - - for (int i = 0; i < list.Count; i++) - { - node.Nodes.Add(list[i]); - } - - this.treeView.Nodes.Add(node); + this.treeView1.Nodes.Add(name); } } } + /// + /// Part11 사용 + /// private void DisplayTreeViewUpdate2() { int fileCount = 0; //TreeNode node; - List listInspectionFile = new List(); List years = new List(); List months = new List(); List days = new List(); - this.treeView.Nodes.Clear(); - listInspectionFile.Clear(); + this.treeView1.Nodes.Clear(); + this.ListInspectionFile.Clear(); DirectoryInfo dir = new DirectoryInfo(this.ParentForm.ParentForm.PathDataInspectionFolder); List fileNames = new List(); @@ -443,7 +224,7 @@ namespace INT69DB_2A.DialogForms DirectoryInfo dayDir = new DirectoryInfo(string.Format("{0}{1}\\{2}", this.ParentForm.ParentForm.PathDataInspectionFolder, year, month)); FileInfo[] dayFiles = dayDir.GetFiles(); - days = this.DayInspectionDirectorySort(dayFiles); + days = this.DayInspectionDirectorySort2(dayFiles); DataBackupMonth m = new DataBackupMonth(month); m.Days = days; @@ -451,36 +232,42 @@ namespace INT69DB_2A.DialogForms y.Months.Add(m); } - listInspectionFile.Add(y); + this.ListInspectionFile.Add(y); } else { - listInspectionFile.Add(y); + this.ListInspectionFile.Add(y); } } // node 생성 - for (int i = 0; i < listInspectionFile.Count; i++) + for (int i = 0; i < this.ListInspectionFile.Count; i++) { - TreeNode node = new TreeNode(listInspectionFile[i].Year); - for (int j = 0; j < listInspectionFile[i].Months.Count; j++) + TreeNode node = new TreeNode(this.ListInspectionFile[i].Year); + for (int j = 0; j < this.ListInspectionFile[i].Months.Count; j++) { - TreeNode nodeMonth = new TreeNode(listInspectionFile[i].Months[j].Month); + TreeNode nodeMonth = new TreeNode(this.ListInspectionFile[i].Months[j].Month); - for (int k = 0; k < listInspectionFile[i].Months[j].Days.Count; k++) + for (int k = 0; k < this.ListInspectionFile[i].Months[j].Days.Count; k++) { - nodeMonth.Nodes.Add(listInspectionFile[i].Months[j].Days[k]); + nodeMonth.Nodes.Add(this.ListInspectionFile[i].Months[j].Days[k]); fileCount++; } node.Nodes.Add(nodeMonth); } - this.treeView.Nodes.Add(node); + this.treeView1.Nodes.Add(node); } } + + //this.labelInspectionFileCount.Text = fileCount.ToString(); } public void DisplayRefresh() { + if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false) + this.DisplayTreeViewUpdate11(); + else + this.DisplayTreeViewUpdate2(); } #endregion @@ -489,61 +276,27 @@ namespace INT69DB_2A.DialogForms { int ret = 0; - if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false) + if (this.ParentForm.SelectFilePath == "") + return; + + this.treeView1.Enabled = false; + this.buttonRead.Enabled = false; + this.buttonClose.Enabled = false; + + this.ParentForm.ClearData(); + ret = this.ParentForm.DataRead(); + + if (ret == 0) { - if (this.ParentForm.SelectNodeIndex == -1) - return; - - 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; + this.DialogResult = DialogResult.OK; + this.Close(); } else - { - string selectedFile = "", filePath = ""; - selectedFile = this.GetSeletedNodeList(this.treeView); + this.DialogResult = DialogResult.Cancel; - 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; - this.Close(); - } - else - this.DialogResult = DialogResult.Cancel; - - this.treeView.Enabled = true; - this.buttonRead.Enabled = true; - this.buttonClose.Enabled = true; - } + this.treeView1.Enabled = true; + this.buttonRead.Enabled = true; + this.buttonClose.Enabled = true; } private void buttonClose_Click(object sender, EventArgs e) { @@ -551,40 +304,36 @@ namespace INT69DB_2A.DialogForms this.Close(); } - private void treeView_AfterSelect(object sender, TreeViewEventArgs e) + private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { - string fileName = "", date = "-"; - string[] splitFileName = e.Node.Text.Split('-'); + string fileName = "", pathFileName = ""; + string[] name; if (this.ParentForm.ParentForm.SystemConfig.IsPart11 == false) { - 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); - } + fileName = e.Node.Text; - date = string.Format("{0}.{1}.{2}", fileName.Substring(0, 4), fileName.Substring(4, 2), fileName.Substring(6, 2)); + this.ParentForm.SelectFilePath = string.Format("{0}{1}", this.ParentForm.ParentForm.PathDataBackupFolder, fileName); + name = fileName.Split('_'); + this.labelFileName.Text = fileName; + this.labelDate.Text = string.Format("{0}.{1}.{2}", name[0].Substring(0, 4), name[0].Substring(4, 2), name[0].Substring(6, 2)); + this.labelProductNo.Text = name[1].Substring(0, name[1].Length - 4); } else { - if (e.Node.Text.Substring(0, 1) == "I") + if (e.Node.Text.Length > 10) { fileName = e.Node.Text; - date = string.Format("{0}.{1}.{2}", fileName.Substring(1, 4), fileName.Substring(5, 2), fileName.Substring(7, 2)); + pathFileName = string.Format("{0}{1}\\{2}\\{3}", + this.ParentForm.ParentForm.PathDataInspectionFolder, fileName.Substring(1, 4), int.Parse(fileName.Substring(5, 2)), fileName); + this.ParentForm.SelectFilePath = pathFileName; + + name = fileName.Split('_'); + this.labelFileName.Text = fileName; + this.labelDate.Text = string.Format("{0}.{1}.{2}", name[0].Substring(1, 4), name[0].Substring(5, 2), name[0].Substring(7, 2)); + this.labelProductNo.Text = name[1].Substring(0, name[1].Length - 4); } } - - this.labelFileName.Text = fileName; - this.labelProductNo.Text = splitFileName[1]; - this.labelDate.Text = date; } #endregion } diff --git a/INT69DB_2A/DialogForms/DialogFormLogOn.Designer.cs b/INT69DB_2A/DialogForms/DialogFormLogOn.Designer.cs index 6201932..bb57e4c 100644 --- a/INT69DB_2A/DialogForms/DialogFormLogOn.Designer.cs +++ b/INT69DB_2A/DialogForms/DialogFormLogOn.Designer.cs @@ -33,7 +33,7 @@ this.smartKeyboard = new SmartX.SmartKeyboard(); this.textBoxID = new System.Windows.Forms.TextBox(); this.textBoxPassword = new System.Windows.Forms.TextBox(); - this.buttonLogon = new SmartX.SmartButton(); + this.buttonLogOn = new SmartX.SmartButton(); this.buttonCancel = new SmartX.SmartButton(); this.smartButton1 = new SmartX.SmartButton(); this.smartButtonAdmin = new SmartX.SmartButton(); @@ -41,9 +41,9 @@ this.smartButtonUser22 = new SmartX.SmartButton(); this.smartButtonUser33 = new SmartX.SmartButton(); this.pictureBoxImage = new System.Windows.Forms.PictureBox(); - this.labelTitlePassword = new SmartX.SmartLabel(); - this.labelTitleID = new SmartX.SmartLabel(); - this.labelTitle = new SmartX.SmartLabel(); + this.labelTitle3 = new SmartX.SmartLabel(); + this.labelTitle2 = new SmartX.SmartLabel(); + this.labelTitle1 = new SmartX.SmartLabel(); ((System.ComponentModel.ISupportInitialize)(this.smartForm1)).BeginInit(); this.SuspendLayout(); // @@ -95,7 +95,6 @@ this.smartKeyboard.ThemeStyle = SmartX.SmartKeyboard.KEYBOARDTHEMESTYLE.CUSTOMIZED_LITE; this.smartKeyboard.TopMargin = 5; this.smartKeyboard.OnXKeyClick += new System.EventHandler(this.smartKeyboard_OnXKeyClick); - this.smartKeyboard.Click += new System.EventHandler(this.smartKeyboard_Click); // // textBoxID // @@ -120,36 +119,36 @@ this.textBoxPassword.Text = "ABCDEFGHJK"; this.textBoxPassword.GotFocus += new System.EventHandler(this.textBoxPassword_GotFocus); // - // buttonLogon + // buttonLogOn // - this.buttonLogon.BackPictureBox = null; - this.buttonLogon.BackPictureBox1 = null; - this.buttonLogon.BackPictureBox2 = null; - this.buttonLogon.ButtonColor = System.Drawing.Color.Gray; - this.buttonLogon.ButtonImageAutoSize = true; - this.buttonLogon.ColorKeySamplePosition = new System.Drawing.Point(0, 0); - this.buttonLogon.DisableImage = ((System.Drawing.Image)(resources.GetObject("buttonLogon.DisableImage"))); - this.buttonLogon.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonLogon.DownImage"))); - this.buttonLogon.GroupID = 0; - this.buttonLogon.InitVisible = true; - this.buttonLogon.Location = new System.Drawing.Point(512, 82); - this.buttonLogon.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; - this.buttonLogon.Name = "buttonLogon"; - this.buttonLogon.NestedClickEventPrevent = false; - this.buttonLogon.OutlinePixel = 1; - this.buttonLogon.RepeatInterval = 200; - this.buttonLogon.RepeatIntervalAccelerate = null; - this.buttonLogon.SafeInterval = 200; - this.buttonLogon.Size = new System.Drawing.Size(75, 75); - this.buttonLogon.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; - this.buttonLogon.TabIndex = 6; - this.buttonLogon.TextColor = System.Drawing.Color.Black; - this.buttonLogon.TextDownColor = System.Drawing.Color.White; - this.buttonLogon.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; - this.buttonLogon.TextLocation = new System.Drawing.Point(0, 0); - this.buttonLogon.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; - this.buttonLogon.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonLogon.UpImage"))); - this.buttonLogon.Click += new System.EventHandler(this.buttonLogOn_Click); + this.buttonLogOn.BackPictureBox = null; + this.buttonLogOn.BackPictureBox1 = null; + this.buttonLogOn.BackPictureBox2 = null; + this.buttonLogOn.ButtonColor = System.Drawing.Color.Gray; + this.buttonLogOn.ButtonImageAutoSize = true; + this.buttonLogOn.ColorKeySamplePosition = new System.Drawing.Point(0, 0); + this.buttonLogOn.DisableImage = ((System.Drawing.Image)(resources.GetObject("buttonLogOn.DisableImage"))); + this.buttonLogOn.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonLogOn.DownImage"))); + this.buttonLogOn.GroupID = 0; + this.buttonLogOn.InitVisible = true; + this.buttonLogOn.Location = new System.Drawing.Point(512, 82); + this.buttonLogOn.Mode = SmartX.SmartButton.BUTTONMODE.NORMAL; + this.buttonLogOn.Name = "buttonLogOn"; + this.buttonLogOn.NestedClickEventPrevent = false; + this.buttonLogOn.OutlinePixel = 1; + this.buttonLogOn.RepeatInterval = 200; + this.buttonLogOn.RepeatIntervalAccelerate = null; + this.buttonLogOn.SafeInterval = 200; + this.buttonLogOn.Size = new System.Drawing.Size(75, 75); + this.buttonLogOn.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; + this.buttonLogOn.TabIndex = 6; + this.buttonLogOn.TextColor = System.Drawing.Color.Black; + this.buttonLogOn.TextDownColor = System.Drawing.Color.White; + this.buttonLogOn.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; + this.buttonLogOn.TextLocation = new System.Drawing.Point(0, 0); + this.buttonLogOn.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; + this.buttonLogOn.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonLogOn.UpImage"))); + this.buttonLogOn.Click += new System.EventHandler(this.buttonLogOn_Click); // // buttonCancel // @@ -349,68 +348,68 @@ this.pictureBoxImage.Name = "pictureBoxImage"; this.pictureBoxImage.Size = new System.Drawing.Size(66, 72); // - // labelTitlePassword + // labelTitle3 // - this.labelTitlePassword.BackColor = System.Drawing.Color.White; - this.labelTitlePassword.BackPictureBox = null; - this.labelTitlePassword.BackPictureBox1 = null; - this.labelTitlePassword.BackPictureBox2 = null; - this.labelTitlePassword.BorderColor = System.Drawing.Color.Black; - this.labelTitlePassword.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitlePassword.Font = new System.Drawing.Font("새굴림", 12F, System.Drawing.FontStyle.Bold); - this.labelTitlePassword.ForeColor = System.Drawing.Color.Gray; - this.labelTitlePassword.InitVisible = true; - this.labelTitlePassword.LineSpacing = 0F; - this.labelTitlePassword.Location = new System.Drawing.Point(129, 126); - this.labelTitlePassword.Name = "labelTitlePassword"; - this.labelTitlePassword.Size = new System.Drawing.Size(120, 34); - this.labelTitlePassword.TabIndex = 184; - this.labelTitlePassword.Text = "비밀번호"; - this.labelTitlePassword.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; - this.labelTitlePassword.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; - this.labelTitlePassword.Wordwrap = false; + this.labelTitle3.BackColor = System.Drawing.Color.White; + this.labelTitle3.BackPictureBox = null; + this.labelTitle3.BackPictureBox1 = null; + this.labelTitle3.BackPictureBox2 = null; + this.labelTitle3.BorderColor = System.Drawing.Color.Black; + this.labelTitle3.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelTitle3.Font = new System.Drawing.Font("새굴림", 12F, System.Drawing.FontStyle.Bold); + this.labelTitle3.ForeColor = System.Drawing.Color.Gray; + this.labelTitle3.InitVisible = true; + this.labelTitle3.LineSpacing = 0F; + this.labelTitle3.Location = new System.Drawing.Point(129, 126); + this.labelTitle3.Name = "labelTitle3"; + this.labelTitle3.Size = new System.Drawing.Size(120, 34); + this.labelTitle3.TabIndex = 184; + this.labelTitle3.Text = "비밀번호"; + this.labelTitle3.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.labelTitle3.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelTitle3.Wordwrap = false; // - // labelTitleID + // labelTitle2 // - this.labelTitleID.BackColor = System.Drawing.Color.White; - this.labelTitleID.BackPictureBox = null; - this.labelTitleID.BackPictureBox1 = null; - this.labelTitleID.BackPictureBox2 = null; - this.labelTitleID.BorderColor = System.Drawing.Color.Black; - this.labelTitleID.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitleID.Font = new System.Drawing.Font("새굴림", 12F, System.Drawing.FontStyle.Bold); - this.labelTitleID.ForeColor = System.Drawing.Color.Gray; - this.labelTitleID.InitVisible = true; - this.labelTitleID.LineSpacing = 0F; - this.labelTitleID.Location = new System.Drawing.Point(129, 81); - this.labelTitleID.Name = "labelTitleID"; - this.labelTitleID.Size = new System.Drawing.Size(120, 34); - this.labelTitleID.TabIndex = 183; - this.labelTitleID.Text = "ID"; - this.labelTitleID.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; - this.labelTitleID.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; - this.labelTitleID.Wordwrap = false; + this.labelTitle2.BackColor = System.Drawing.Color.White; + this.labelTitle2.BackPictureBox = null; + this.labelTitle2.BackPictureBox1 = null; + this.labelTitle2.BackPictureBox2 = null; + this.labelTitle2.BorderColor = System.Drawing.Color.Black; + this.labelTitle2.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelTitle2.Font = new System.Drawing.Font("새굴림", 12F, System.Drawing.FontStyle.Bold); + this.labelTitle2.ForeColor = System.Drawing.Color.Gray; + this.labelTitle2.InitVisible = true; + this.labelTitle2.LineSpacing = 0F; + this.labelTitle2.Location = new System.Drawing.Point(129, 81); + this.labelTitle2.Name = "labelTitle2"; + this.labelTitle2.Size = new System.Drawing.Size(120, 34); + this.labelTitle2.TabIndex = 183; + this.labelTitle2.Text = "ID"; + this.labelTitle2.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.labelTitle2.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelTitle2.Wordwrap = false; // - // labelTitle + // labelTitle1 // - this.labelTitle.BackColor = System.Drawing.Color.White; - this.labelTitle.BackPictureBox = null; - this.labelTitle.BackPictureBox1 = null; - this.labelTitle.BackPictureBox2 = null; - this.labelTitle.BorderColor = System.Drawing.Color.Black; - this.labelTitle.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelTitle.Font = new System.Drawing.Font("새굴림", 20F, System.Drawing.FontStyle.Bold); - this.labelTitle.ForeColor = System.Drawing.Color.Gray; - this.labelTitle.InitVisible = true; - this.labelTitle.LineSpacing = 0F; - this.labelTitle.Location = new System.Drawing.Point(129, 25); - this.labelTitle.Name = "labelTitle"; - this.labelTitle.Size = new System.Drawing.Size(546, 50); - this.labelTitle.TabIndex = 182; - this.labelTitle.Text = "로그인"; - this.labelTitle.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; - this.labelTitle.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; - this.labelTitle.Wordwrap = false; + this.labelTitle1.BackColor = System.Drawing.Color.White; + this.labelTitle1.BackPictureBox = null; + this.labelTitle1.BackPictureBox1 = null; + this.labelTitle1.BackPictureBox2 = null; + this.labelTitle1.BorderColor = System.Drawing.Color.Black; + this.labelTitle1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelTitle1.Font = new System.Drawing.Font("새굴림", 20F, System.Drawing.FontStyle.Bold); + this.labelTitle1.ForeColor = System.Drawing.Color.Gray; + this.labelTitle1.InitVisible = true; + this.labelTitle1.LineSpacing = 0F; + this.labelTitle1.Location = new System.Drawing.Point(129, 25); + this.labelTitle1.Name = "labelTitle1"; + this.labelTitle1.Size = new System.Drawing.Size(546, 50); + this.labelTitle1.TabIndex = 182; + this.labelTitle1.Text = "로그인"; + this.labelTitle1.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.labelTitle1.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelTitle1.Wordwrap = false; // // DialogFormLogOn // @@ -419,19 +418,19 @@ this.ClientSize = new System.Drawing.Size(710, 470); this.ControlBox = false; this.Controls.Add(this.pictureBoxImage); - this.Controls.Add(this.labelTitlePassword); - this.Controls.Add(this.labelTitleID); + this.Controls.Add(this.labelTitle3); + this.Controls.Add(this.labelTitle2); this.Controls.Add(this.smartButtonUser33); this.Controls.Add(this.smartButtonUser22); this.Controls.Add(this.smartButtonIUser11); this.Controls.Add(this.smartButtonAdmin); this.Controls.Add(this.smartButton1); this.Controls.Add(this.buttonCancel); - this.Controls.Add(this.buttonLogon); + this.Controls.Add(this.buttonLogOn); this.Controls.Add(this.textBoxPassword); this.Controls.Add(this.textBoxID); this.Controls.Add(this.smartKeyboard); - this.Controls.Add(this.labelTitle); + this.Controls.Add(this.labelTitle1); this.Controls.Add(this.smartForm1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Name = "DialogFormLogOn"; @@ -447,7 +446,7 @@ private SmartX.SmartKeyboard smartKeyboard; private System.Windows.Forms.TextBox textBoxID; private System.Windows.Forms.TextBox textBoxPassword; - private SmartX.SmartButton buttonLogon; + private SmartX.SmartButton buttonLogOn; private SmartX.SmartButton buttonCancel; private SmartX.SmartButton smartButton1; private SmartX.SmartButton smartButtonAdmin; @@ -455,8 +454,8 @@ private SmartX.SmartButton smartButtonUser22; private SmartX.SmartButton smartButtonUser33; private System.Windows.Forms.PictureBox pictureBoxImage; - private SmartX.SmartLabel labelTitlePassword; - private SmartX.SmartLabel labelTitleID; - private SmartX.SmartLabel labelTitle; + private SmartX.SmartLabel labelTitle3; + private SmartX.SmartLabel labelTitle2; + private SmartX.SmartLabel labelTitle1; } } \ No newline at end of file diff --git a/INT69DB_2A/DialogForms/DialogFormLogOn.cs b/INT69DB_2A/DialogForms/DialogFormLogOn.cs index 2b28c6b..92e6e98 100644 --- a/INT69DB_2A/DialogForms/DialogFormLogOn.cs +++ b/INT69DB_2A/DialogForms/DialogFormLogOn.cs @@ -18,39 +18,23 @@ namespace INT69DB_2A.DialogForms public partial class DialogFormLogOn : Form { #region Field - // false : 패스워드 변경, true : 로그인 - private bool IsLogin; - private string ID; - private string Password; - - UserManager.UserMgr_user_info_t UserInfo = new UserManager.UserMgr_user_info_t(); - private FormMain m_ParentForm; + private bool IsLoginMode; + private bool IsChangePassword; #endregion #region Constructor - public DialogFormLogOn(FormMain parent) + public DialogFormLogOn(FormMain parent, bool login, bool changePass) { InitializeComponent(); this.ParentForm = parent; - this.IsLogin = true; + this.IsLoginMode = login; + this.IsChangePassword = changePass; + this.InitializeDesign(); this.InitializeControl(); - this.InitializeDesignLogOn(this.ParentForm.SystemConfig.Language); - this.DefaultSettingLogOn(); - } - public DialogFormLogOn(FormMain parent, string id) - { - InitializeComponent(); - - this.ParentForm = parent; - this.ID = id; - this.IsLogin = false; - - this.InitializeControl(); - this.InitializeDesignChangePassword(this.ParentForm.SystemConfig.Language); - this.DefaultSettingChangePassword(); + this.DefaultSetting(); } #endregion @@ -63,6 +47,53 @@ namespace INT69DB_2A.DialogForms #endregion #region Method + private void InitializeDesign() + { + ImageDll images = new ImageDll(); + + if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English) + { + this.buttonLogOn.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDisable)); + this.buttonLogOn.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDown)); + this.buttonLogOn.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginUp)); + this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDisable)); + this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDown)); + this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelUp)); + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) + { + this.smartForm1.Image = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnBackgroundUserLogin)); + + this.buttonLogOn.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginLoginDisable)); + this.buttonLogOn.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginLoginDown)); + this.buttonLogOn.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginLoginUp)); + this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelDisable)); + this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelDown)); + this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelUp)); + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech) + { + this.buttonLogOn.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDisable)); + this.buttonLogOn.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDown)); + this.buttonLogOn.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginUp)); + this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDisable)); + this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDown)); + this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelUp)); + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German) + { + this.buttonLogOn.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDisable)); + this.buttonLogOn.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDown)); + this.buttonLogOn.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginUp)); + this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDisable)); + this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDown)); + this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelUp)); + } + else + { + + } + } private void InitializeControl() { int x = 0, y = 0; @@ -71,313 +102,215 @@ namespace INT69DB_2A.DialogForms y = Screen.PrimaryScreen.Bounds.Height / 2 - this.Size.Height / 2; this.Location = new Point(x, y); + this.Size = new Size(710, 470); - this.Size = new Size(450, 165); - } - public void InitializeDesignLogOn(DataStore.LanguageID language) - { - ImageDll images = new ImageDll(); - - this.pictureBoxImage.Image = new Bitmap(images.GetImage(ImageDll.ButtonImages.LoginImage1)); - - if (language == DataStore.LanguageID.English) - { - this.labelTitle.Text = "User Login"; - this.labelTitleID.Text = "ID"; - this.labelTitlePassword.Text = "Password"; - - this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDisable)); - this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDown)); - this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelUp)); - this.buttonLogon.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDisable)); - this.buttonLogon.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginDown)); - this.buttonLogon.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginLoginUp)); - } - else if (language == DataStore.LanguageID.Chinese) - { - this.labelTitle.Text = "登錄"; - this.labelTitleID.Text = "用户名"; - this.labelTitlePassword.Text = "密码"; - - this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelDisable)); - this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelDown)); - this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelUp)); - this.buttonLogon.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginLoginDisable)); - this.buttonLogon.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginLoginDown)); - this.buttonLogon.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginLoginUp)); - } - else if (language == DataStore.LanguageID.Czech) + if (this.IsChangePassword == false) { + this.labelTitle1.Text = "User Loigin"; + this.labelTitle2.Text = "ID"; + this.labelTitle3.Text = "Password"; } else { - this.labelTitle.Text = "로그인"; - this.labelTitleID.Text = "ID"; - this.labelTitlePassword.Text = "비밀번호"; + this.labelTitle1.Text = "Change Password"; + this.labelTitle2.Text = "New PW"; + this.labelTitle3.Text = "Confirmation"; - this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginCancelDisable)); - this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginCancelDown)); - this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginCancelUp)); - this.buttonLogon.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginLoginDisable)); - this.buttonLogon.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginLoginDown)); - this.buttonLogon.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginLoginUp)); + this.textBoxID.PasswordChar = '*'; } - } - private void DefaultSettingLogOn() - { + this.textBoxID.Text = ""; this.textBoxPassword.Text = ""; + //this.smartKeyboard.HanYoungKeyToggle(); + this.smartKeyboard.HanYoungKeyDisable = true; this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL; this.smartKeyboard.Show(); } - private void Login() + private void DefaultSetting() { - // Check ID - if (this.textBoxID.Text.Length < 6) + + } + + private void LogOn() + { + UserManager.UserMgr_user_info_t userInfo = new UserManager.UserMgr_user_info_t(); + + if (this.textBoxID.Text == "") { - // ID : 6~20자 입력하세요 - DialogFormMessage msg = new DialogFormMessage(null, 3, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); + // ID : 6~20자 입력 하세요 + DialogFormMessage myMsg = new DialogFormMessage(null, 3, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); return; } - // Check Password - if (this.textBoxPassword.Text.Length < 6) + if (this.textBoxPassword.Text == "") { - // PASSWORD : 6~20자 입력하세요 - DialogFormMessage msg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); + // PASSWORD : 6~20자 입력 하세요 + DialogFormMessage myMsg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); return; } - UserManager.UserManager_UserLoginDirect(this.textBoxID.Text, this.textBoxPassword.Text, ref this.UserInfo); + UserManager.UserManager_UserLoginDirect(this.textBoxID.Text, this.textBoxPassword.Text, ref userInfo); - if (this.UserInfo.status == 0) + if (userInfo.status == 0) { + //MessageBox.Show("로그인 성공"); + #region 로그인 성공 - try - { - string sValue = ""; + if (userInfo.active_level == 1) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1; + else if (userInfo.active_level == 2) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2; + else if (userInfo.active_level == 3) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3; + else if (userInfo.active_level == 9) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin; + else if (userInfo.active_level == 10) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; - this.SuccessLogin(this.UserInfo); + this.ParentForm.SystemConfig.CurrentUser.ID = userInfo.user_id; + this.ParentForm.SystemConfig.CurrentUser.Password = userInfo.user_pw; - sValue = this.ParentForm.ChildFormMainDisplay.DisplayExpireOfPassword(this.ParentForm.SystemConfig.CurrentUser.Group); - if (sValue != "-") - { - int intExpireDate = int.Parse(sValue); - if (intExpireDate >= -10) - { - int extract = int.Parse(Regex.Replace(sValue, @"\D", "")); - DialogFormYesNo df = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 2, extract.ToString()); - df.BringToFront(); - if (df.ShowDialog() == DialogResult.Yes) - { - DialogFormLogOn changePW = new DialogFormLogOn(this.ParentForm, this.textBoxID.Text); - if (changePW.ShowDialog() == DialogResult.OK) - { - UserManager.UserManager_UserLockRelease(this.textBoxID.Text, false, true); - UserManager.UserManager_UserLoginDirect(this.textBoxID.Text, this.ParentForm.SystemConfig.CurrentUser.Password, ref this.UserInfo); + this.ParentForm.SystemConfig.CurrentUser.ExpireId = userInfo.id_expire_period; + this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = userInfo.password_expire_period; - this.SuccessLogin(this.UserInfo); - } - } - } - } - } - catch (Exception ex) - { - FormMain.Exception(ex); + DateTime time = DateTime.ParseExact(userInfo.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordRegister = time; + time = DateTime.ParseExact(userInfo.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdLogin = time; + time = DateTime.ParseExact(userInfo.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdExpire = time; + time = DateTime.ParseExact(userInfo.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire = time; - this.DialogResult = DialogResult.Cancel; - this.Close(); - - return; - } + this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = userInfo.id_flock_status == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level; + #endregion this.DialogResult = DialogResult.OK; this.Close(); - #endregion } else { - if (this.UserInfo.status == 15) // USER_MGR_STATUS_PW_PASSWORD_LOCK + DialogFormMessage myMsg = new DialogFormMessage(null, userInfo.status, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); + + // 비밀번호 만료 시 + if (userInfo.status == 15) { + this.ParentForm.ChildFormMainDisplay.ChangeID = this.textBoxID.Text; + this.DialogResult = DialogResult.Abort; this.Close(); - - DialogFormLogOn changePW = new DialogFormLogOn(this.ParentForm, this.textBoxID.Text); - if (changePW.ShowDialog() == DialogResult.OK) - { - UserManager.UserManager_UserLoginDirect(this.textBoxID.Text, this.ParentForm.SystemConfig.CurrentUser.Password, ref this.UserInfo); - // console - //Console.WriteLine(this.UserInfo.status.ToString()); - this.SuccessLogin(this.UserInfo); - - this.DialogResult = DialogResult.OK; - this.Close(); - } - } - else - { - DialogFormMessage myMsg = new DialogFormMessage(null, this.UserInfo.status, this.ParentForm.SystemConfig.Language); - myMsg.ShowDialog(); } } } - private void SuccessLogin(UserManager.UserMgr_user_info_t user) + private void ChangePassword() { - if (user.active_level == 1) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1; - else if (user.active_level == 2) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2; - else if (user.active_level == 3) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3; - else if (user.active_level == 9) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin; - else if (user.active_level == 10) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; - this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = user.active_level; + int ret = 0; + string id = "", pass = ""; + UserManager.UserMgr_user_info_t userInfo = new UserManager.UserMgr_user_info_t(); - this.ParentForm.SystemConfig.CurrentUser.ID = user.user_id; - this.ParentForm.SystemConfig.CurrentUser.Password = user.user_pw; - - this.ParentForm.SystemConfig.CurrentUser.ExpireAccount = user.expire_period_account; - this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = user.expire_period_password; - - // console - //Console.WriteLine(user.password_register_date.GetDateTime()); - DateTime time = DateTime.ParseExact(user.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateRegister = time; - // console - //Console.WriteLine(user.id_login_date.GetDateTime()); - time = DateTime.ParseExact(user.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateLogin = time; - - if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin - || this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer) + if (this.textBoxID.Text == "") { - this.ParentForm.SystemConfig.CurrentUser.DateExpireRegister = DateTime.Now; - this.ParentForm.SystemConfig.CurrentUser.DateExpireLogin = DateTime.Now; + // New Password : 6~20자 입력 하세요 + DialogFormMessage myMsg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); + + return; } - else + if (this.textBoxPassword.Text == "") { - // console - //Console.WriteLine(user.expire_id_date.GetDateTime()); - time = DateTime.ParseExact(user.expire_id_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateExpireLogin = time; - // console - //Console.WriteLine(user.expire_password_date.GetDateTime()); - time = DateTime.ParseExact(user.expire_password_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateExpireRegister = time; + // New Password Confirmation : 6~20자 입력 하세요 + DialogFormMessage myMsg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); + + return; } - - this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = user.flock_status_account == 0 ? false : true; - this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = user.flock_status_password == 0 ? false : true; - - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.SystemConfig.CurrentUser.IsAdmin = user.fadmin == 0 ? false : true; - else - this.ParentForm.SystemConfig.CurrentUser.IsAdmin = true; - } - - public void InitializeDesignChangePassword(DataStore.LanguageID language) - { - ImageDll images = new ImageDll(); - - this.pictureBoxImage.Image = new Bitmap(images.GetImage(ImageDll.ButtonImages.LoginImage2)); - - if (language == DataStore.LanguageID.English) + if (this.textBoxID.Text.Equals(this.textBoxPassword.Text) == false) { - this.labelTitle.Text = "Change Password"; - this.labelTitleID.Text = "New"; - this.labelTitlePassword.Text = "Verify"; - - this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDisable)); - this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelDown)); - this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginCancelUp)); - this.buttonLogon.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginChangeDisable)); - this.buttonLogon.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginChangeDown)); - this.buttonLogon.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.engMainLoginChangeUp)); - } - else if (language == DataStore.LanguageID.Chinese) - { - this.labelTitle.Text = "更改密码"; - this.labelTitleID.Text = "新的"; - this.labelTitlePassword.Text = "核实"; - - this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelDisable)); - this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelDown)); - this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginCancelUp)); - this.buttonLogon.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginChangeDisable)); - this.buttonLogon.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginChangeDown)); - this.buttonLogon.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.chnMainLoginChangeUp)); - } - else if (language == DataStore.LanguageID.Czech) - { - } - else - { - this.labelTitle.Text = "비밀번호 변경"; - this.labelTitleID.Text = "새 비밀번호"; - this.labelTitlePassword.Text = "비밀번호 확인"; - - this.buttonCancel.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginCancelDisable)); - this.buttonCancel.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginCancelDown)); - this.buttonCancel.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginCancelUp)); - this.buttonLogon.DisableImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginChangeDisable)); - this.buttonLogon.DownImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginChangeDown)); - this.buttonLogon.UpImage = new Bitmap(images.GetImage(ImageDll.ButtonImages.korMainLoginChangeUp)); - } - } - private void DefaultSettingChangePassword() - { - this.textBoxID.Text = ""; - this.textBoxPassword.Text = ""; - - this.textBoxID.PasswordChar = '*'; - this.textBoxPassword.PasswordChar = '*'; - - this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL; - this.smartKeyboard.Show(); - } - private void SaveChangePassword() - { - string detail = ""; - - // Check Password - if (this.textBoxPassword.Text.Length < 6) - { - // PASSWORD : 6~20자 입력하세요 - DialogFormMessage msg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); + // 비밀번호를 확인하세요 + DialogFormMessage myMsg = new DialogFormMessage(null, 14, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); return; } - try + if (this.IsLoginMode == true) { - if (this.textBoxID.Text != this.textBoxPassword.Text) + id = this.ParentForm.SystemConfig.CurrentUser.ID; + pass = this.textBoxID.Text; + + Console.WriteLine(string.Format("UserManager_UserModifyPW : {0}, {1}", id, pass)); + ret = UserManager.UserManager_UserModifyPWDirect(id, pass); + } + else + { + id = this.ParentForm.ChildFormMainDisplay.ChangeID; + pass = this.textBoxID.Text; + + Console.WriteLine(string.Format("UserManager_UserModifyPW : {0}, {1}", id, pass)); + ret = UserManager.UserManager_UserModifyPWDirect(id, pass); + } + + // 비밀번호 변경이 완료 되면 로그인 시도 + if (ret == 0) + { + UserManager.UserManager_UserLoginDirect(id, pass, ref userInfo); + + if (userInfo.status == 0) { - // 비밀번호가 동일하지 않습니다 - DialogFormMessage myMsg = new DialogFormMessage(null, 17, this.ParentForm.SystemConfig.Language); - myMsg.ShowDialog(); - } - else - { - UserManager.UserManager_UserModifyPW(this.ID, this.textBoxPassword.Text); - this.ParentForm.SystemConfig.CurrentUser.Password = this.textBoxPassword.Text; + //MessageBox.Show("로그인 성공"); + + #region 로그인 성공 + if (userInfo.active_level == 1) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1; + else if (userInfo.active_level == 2) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2; + else if (userInfo.active_level == 3) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3; + else if (userInfo.active_level == 9) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin; + else if (userInfo.active_level == 10) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; + + this.ParentForm.SystemConfig.CurrentUser.ID = userInfo.user_id; + this.ParentForm.SystemConfig.CurrentUser.Password = userInfo.user_pw; + + this.ParentForm.SystemConfig.CurrentUser.ExpireId = userInfo.id_expire_period; + this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = userInfo.password_expire_period; + + DateTime time = DateTime.ParseExact(userInfo.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordRegister = time; + time = DateTime.ParseExact(userInfo.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdLogin = time; + time = DateTime.ParseExact(userInfo.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdExpire = time; + time = DateTime.ParseExact(userInfo.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire = time; + + this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = userInfo.id_flock_status == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level; + #endregion this.DialogResult = DialogResult.OK; this.Close(); - this.Dispose(); + } + else + { + DialogFormMessage myMsg = new DialogFormMessage(null, ret, this.ParentForm.SystemConfig.Language); + myMsg.ShowDialog(); } } - catch + else { - this.DialogResult = DialogResult.Cancel; - this.Close(); - this.Dispose(); + // 비밀번호 변경 실패 시 메시지?? } } #endregion @@ -386,40 +319,27 @@ namespace INT69DB_2A.DialogForms private void buttonLogOn_Click(object sender, EventArgs e) { // Automatic Logout Reset - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.ChildFormMainDisplay.Part11AutomaticLogoutReset(); + this.ParentForm.ChildFormMainDisplay.Part11AutomaticLogoutReset(); - if (this.IsLogin == true) - this.Login(); + if (this.IsChangePassword == false) + this.LogOn(); else - this.SaveChangePassword(); + this.ChangePassword(); } private void buttonCancel_Click(object sender, EventArgs e) { - // Automatic Logout Reset - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.ChildFormMainDisplay.Part11AutomaticLogoutReset(); - this.DialogResult = DialogResult.Cancel; this.Close(); } private void textBoxID_GotFocus(object sender, EventArgs e) { - // Automatic Logout Reset - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.ChildFormMainDisplay.Part11AutomaticLogoutReset(); - this.smartKeyboard.TargetInputObject = this.textBoxID; this.textBoxID.Select(this.textBoxID.Text.Length, 0); } private void textBoxPassword_GotFocus(object sender, EventArgs e) { - // Automatic Logout Reset - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.ChildFormMainDisplay.Part11AutomaticLogoutReset(); - this.smartKeyboard.TargetInputObject = this.textBoxPassword; this.textBoxPassword.Select(this.textBoxPassword.Text.Length, 0); @@ -427,12 +347,8 @@ namespace INT69DB_2A.DialogForms private void smartKeyboard_OnXKeyClick(object sender, EventArgs e) { - //this.smartKeyboard.Show(); - } - private void smartKeyboard_Click(object sender, EventArgs e) - { - - } + this.smartKeyboard.Show(); + } #endregion private void smartButton1_Click(object sender, EventArgs e) diff --git a/INT69DB_2A/DialogForms/DialogFormLogOn.resx b/INT69DB_2A/DialogForms/DialogFormLogOn.resx index f98a973..96134b2 100644 --- a/INT69DB_2A/DialogForms/DialogFormLogOn.resx +++ b/INT69DB_2A/DialogForms/DialogFormLogOn.resx @@ -289,7 +289,7 @@ hjEAAGnFLfxDwxgAALIyjAEA4CDDGAAA7jul/F/eB9XIY8iEdQAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAYAAAA4TnrqAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp @@ -388,7 +388,7 @@ 5fwR+R+1E4HZ5iT/aAAAAABJRU5ErkJggg== - + iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAYAAAA4TnrqAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp @@ -503,7 +503,7 @@ WuM/U89GVOSfyP8BdoPWvU1dpd0AAAAASUVORK5CYII= - + iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAYAAAA4TnrqAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp diff --git a/INT69DB_2A/DialogForms/DialogFormUserEditorKeyboard.cs b/INT69DB_2A/DialogForms/DialogFormUserEditorKeyboard.cs index f5791b1..4b8d5da 100644 --- a/INT69DB_2A/DialogForms/DialogFormUserEditorKeyboard.cs +++ b/INT69DB_2A/DialogForms/DialogFormUserEditorKeyboard.cs @@ -16,11 +16,10 @@ namespace INT69DB_2A.DialogForms #endregion #region Constructor - public DialogFormUserEditorKeyboard(string value, string title) + public DialogFormUserEditorKeyboard(string value) { InitializeComponent(); - this.labelTitle.Text = title; this.textBox.Text = value; this.RetStringValue = value; @@ -39,7 +38,7 @@ namespace INT69DB_2A.DialogForms #region Method private void DefaultSetting() { - this.Location = new Point(45, 63); + this.Location = new Point(112, 210); this.smartKeyboard.TargetInputObject = this.textBox; this.smartKeyboard.KeyboardType = SmartX.SmartKeyboard.KEYBOARDTYPES.NORMAL; diff --git a/INT69DB_2A/Forms/FormCommunication.cs b/INT69DB_2A/Forms/FormCommunication.cs index 15155b3..bc20205 100644 --- a/INT69DB_2A/Forms/FormCommunication.cs +++ b/INT69DB_2A/Forms/FormCommunication.cs @@ -259,30 +259,30 @@ namespace INT69DB_2A.Forms if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f1_OPT1) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - data = this.ParentForm.OPT1(this.ParentForm.CollectionWeightData); + data = this.ParentForm.Protocol_OPT1(this.ParentForm.CollectionWeightData); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - data = this.ParentForm.OPT1(1, this.ParentForm.CollectionWeightData[0]); + data = this.ParentForm.Protocol_OPT1(1, this.ParentForm.CollectionWeightData[0]); } else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f2_OPT2) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - data = this.ParentForm.OPT2(this.ParentForm.CollectionWeightData); + data = this.ParentForm.Protocol_OPT2(this.ParentForm.CollectionWeightData); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - data = this.ParentForm.OPT2(1, this.ParentForm.CollectionWeightData[0]); + data = this.ParentForm.Protocol_OPT2(1, this.ParentForm.CollectionWeightData[0]); } else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f3_OPT3) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - data = this.ParentForm.OPT3(this.ParentForm.CollectionWeightData); + data = this.ParentForm.Protocol_OPT3(this.ParentForm.CollectionWeightData); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - data = this.ParentForm.OPT3(1, this.ParentForm.CollectionWeightData[0]); + data = this.ParentForm.Protocol_OPT3(1, this.ParentForm.CollectionWeightData[0]); } else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f5_OPT4) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - data = this.ParentForm.OPT4(this.ParentForm.CollectionWeightData); + data = this.ParentForm.Protocol_OPT4(this.ParentForm.CollectionWeightData); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - data = this.ParentForm.OPT4(1, this.ParentForm.CollectionWeightData[0]); + data = this.ParentForm.Protocol_OPT4(1, this.ParentForm.CollectionWeightData[0]); } switch (this.ParentForm.SystemConfig.EthernetOperationMode) @@ -317,30 +317,30 @@ namespace INT69DB_2A.Forms if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f1_OPT1) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT1(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT1(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT1(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT1(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f2_OPT2) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT2(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT2(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT2(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT2(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f3_OPT3) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT3(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT3(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT3(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT3(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f5_OPT4) { if (this.ParentForm.SystemConfig.EquipmentMode == 1) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT4(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT4(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT4(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT4(1, this.ParentForm.CollectionWeightData[0])); } switch (this.ParentForm.SystemConfig.EthernetOperationMode) @@ -1487,37 +1487,37 @@ namespace INT69DB_2A.Forms if (this.ParentForm.SystemConfig.Serial3Mode == (int)DataStore.SerialMode.f1_OPT1) { if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT1(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT1(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT1(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT1(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.Serial3Mode == (int)DataStore.SerialMode.f2_OPT2) { if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT2(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT2(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT2(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT2(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.Serial3Mode == (int)DataStore.SerialMode.f3_OPT3) { if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT3(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT3(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT3(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT3(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.Serial3Mode == (int)DataStore.SerialMode.f4_Printer) { if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) - this.ParentForm.SerialUart3Send(this.ParentForm.Printer(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_Printer(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.Printer(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_Printer(1, this.ParentForm.CollectionWeightData[0])); } else if (this.ParentForm.SystemConfig.Serial3Mode == (int)DataStore.SerialMode.f5_OPT4) { if (this.ParentForm.SystemConfig.EquipmentMode == 1 || this.ParentForm.SystemConfig.EquipmentMode == 3) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT4(this.ParentForm.CollectionWeightData)); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT4(this.ParentForm.CollectionWeightData)); else if (this.ParentForm.SystemConfig.EquipmentMode == 2) - this.ParentForm.SerialUart3Send(this.ParentForm.OPT4(1, this.ParentForm.CollectionWeightData[0])); + this.ParentForm.UartCom3Write(this.ParentForm.Protocol_OPT4(1, this.ParentForm.CollectionWeightData[0])); } } diff --git a/INT69DB_2A/Forms/FormDataStatistics.Designer.cs b/INT69DB_2A/Forms/FormDataStatistics.Designer.cs index 6c26947..24e98dc 100644 --- a/INT69DB_2A/Forms/FormDataStatistics.Designer.cs +++ b/INT69DB_2A/Forms/FormDataStatistics.Designer.cs @@ -5373,7 +5373,6 @@ this.buttonDisplay.TextLocation = new System.Drawing.Point(0, 0); this.buttonDisplay.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; this.buttonDisplay.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonDisplay.UpImage"))); - this.buttonDisplay.Click += new System.EventHandler(this.buttonDisplay_Click); // // FormDataStatistics // diff --git a/INT69DB_2A/Forms/FormDataStatistics.cs b/INT69DB_2A/Forms/FormDataStatistics.cs index d71fbea..4758f8a 100644 --- a/INT69DB_2A/Forms/FormDataStatistics.cs +++ b/INT69DB_2A/Forms/FormDataStatistics.cs @@ -23,11 +23,12 @@ namespace INT69DB_2A.Forms private int m_SelectNodeIndex; private int FileIndex; private bool FlagInforUp; + public string SelectFilePath; private FormMain m_ParentForm; public DataCommonList CurrentDataCommonList; - private Collection CollectionWeightData; //스틱1 파일에서 읽은 데이터 + private Collection CollectionWeightData; //파일에서 읽은 데이터 private Collection CollectionLaneData; //파일에서 읽은 데이터를 통계 계산 처리된 데이터 public Collection> CollectionFileClassification; // 스틱2 파일 리스트 private Collection> CollectionWeightDataStick2; // 스틱2 파일에서 읽은 데이터 @@ -141,11 +142,11 @@ namespace INT69DB_2A.Forms } else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech) { - + this.labelTitle.Text = "Data Statistics"; } else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German) { - + this.labelTitle.Text = "Data Statistics"; } else { @@ -183,20 +184,26 @@ namespace INT69DB_2A.Forms #endregion #region Label Location - //if (this.ParentForm.SystemConfig.EquipmentColumns == 2) + //if (this.ParentForm.SystemConfig.EquipmentColumns == 1) // locationX = 80; - //else if (this.ParentForm.SystemConfig.EquipmentColumns == 3) + //else if (this.ParentForm.SystemConfig.EquipmentColumns == 2) // locationX = 70; - //else if (this.ParentForm.SystemConfig.EquipmentColumns == 4) + //else if (this.ParentForm.SystemConfig.EquipmentColumns == 3) // locationX = 60; + //else if (this.ParentForm.SystemConfig.EquipmentColumns == 4) + // locationX = 40; //else if (this.ParentForm.SystemConfig.EquipmentColumns == 5) // locationX = 50; //else if (this.ParentForm.SystemConfig.EquipmentColumns == 6) // locationX = 40; //else if (this.ParentForm.SystemConfig.EquipmentColumns == 7) - // locationX = 30; - //else if (this.ParentForm.SystemConfig.EquipmentColumns == 8) - // locationX = 20; + // locationX = 16; + //else if (this.ParentForm.SystemConfig.EquipmentColumns == 7) + // locationX = 16; + //else if (this.ParentForm.SystemConfig.EquipmentColumns == 7) + // locationX = 16; + //else if (this.ParentForm.SystemConfig.EquipmentColumns == 7) + // locationX = 16; //for (int i = 1; i < this.ParentForm.SystemConfig.EquipmentColumns; i++) //{ @@ -225,6 +232,7 @@ namespace INT69DB_2A.Forms this.FileIndex = 0; this.SelectNodeIndex = -1; this.FlagInforUp = true; + this.SelectFilePath = ""; this.CurrentDataCommonList = new DataCommonList(); this.CollectionFileClassification = new Collection>(); @@ -292,10 +300,7 @@ namespace INT69DB_2A.Forms } for (int i = 0; i < this.ParentForm.SystemConfig.EquipmentColumns; i++) - { - this.CollectionWeightDataStick2.Add(new List()); this.CollectionLaneData.Add(new DataCollector()); - } this.InitializeLabels(); } @@ -386,77 +391,6 @@ namespace INT69DB_2A.Forms this.CurrentDataCommonList.TotalPassAverageWeight = passAverageWeight; this.CurrentDataCommonList.TotalPassVariance = passVariance; } - private void SetCommonData(Collection> datas, Collection 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, index = -1; - - for (int i = 0; i < datas.Count; i++) - { - if (datas[i].Count != 0) - { - index = i; - break; - } - } - - this.CurrentDataCommonList.ProductName = datas[index][datas[index].Count - 1][3]; - this.CurrentDataCommonList.Lot = datas[index][datas[index].Count - 1][4]; - this.CurrentDataCommonList.StartTime = string.Format("{0} {1}", datas[index][0][0], datas[index][0][1]); - this.CurrentDataCommonList.EndTime = string.Format("{0} {1}", datas[index][datas[index].Count - 1][0], datas[index][datas[index].Count - 1][1]); - - dValue1 = double.Parse(datas[index][datas[index].Count - 1][5]); - sValue = Helper.DoubleToString(dValue1, 1); - this.CurrentDataCommonList.UnderRange = sValue; - - dValue1 = double.Parse(datas[index][datas[index].Count - 1][6]); - sValue = Helper.DoubleToString(dValue1, 1); - this.CurrentDataCommonList.PassRange = sValue; - - dValue1 = double.Parse(datas[index][datas[index].Count - 1][7]); - sValue = Helper.DoubleToString(dValue1, 1); - this.CurrentDataCommonList.OverRange = sValue; - - dValue1 = double.Parse(datas[index][datas[index].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) @@ -548,7 +482,7 @@ namespace INT69DB_2A.Forms } private void DataAnalysis() { - #region Data SET + #region Set Data if (this.ParentForm.SystemConfig.EquipmentColumns == 7) { for (int i = 0; i < this.CollectionWeightData.Count; i++) @@ -619,85 +553,59 @@ namespace INT69DB_2A.Forms this.UpdateDisplay(this.CurrentDataCommonList, this.CollectionLaneData); } - public int DataRead1() + public int DataRead() { - string path = ""; - int ret = 0; + int ret = 0, flag = 0; + long count = 0; - SmartSplash splash = new SmartX.SmartSplash(); + if (this.SelectFilePath == "") + return ret = -1; + + SmartSplash splash = new 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(); - if (ret != 0) - { - // 이 파일은 지원이 되지 않습니다 - DialogFormMessage msg = new DialogFormMessage(13, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); - } - - return ret; - } - public int DataRead1(string filePath) - { - int ret = 0; - - SmartSplash splash = new SmartX.SmartSplash(); - splash.CenterPosition = true; - splash.AnimationInterval = 100; - splash.LoadingImagePathname = "SmartLoading4"; - splash.Start(); - - this.CollectionWeightData.Clear(); - ret = this.DataReadToAnalysis(filePath); - this.CollectionWeightData.Clear(); - splash.Finish(); - - 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; + this.ParentForm.smartFileIO.FilePathName = this.SelectFilePath; + this.ParentForm.smartFileIO.Open(2000000); + this.ParentForm.smartFileIO.ReadStringAllBuffer(); try { - sr = new StreamReader(path, Encoding.UTF8); - - while (sr.EndOfStream != true) + count = this.ParentForm.smartFileIO.GetCount(); + for (int i = 0; i < count; i++) { - this.CollectionWeightData.Add(sr.ReadLine().Split(',')); + if (flag == 100) + { + Thread.Sleep(5); + flag = 0; + } + this.CollectionWeightData.Add(this.ParentForm.smartFileIO.ReadStringBuffer(i).Split(',')); + flag++; } - sr.Close(); - + 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(); @@ -1107,27 +1015,6 @@ 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; @@ -1148,39 +1035,39 @@ namespace INT69DB_2A.Forms #region 통계 데이터 생성 // ScreenCapture - //this.CreateScreenCapture(this.ParentForm.PathDataStatisticsFolder, time); + 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); + try + { + filePath = "하드 디스크\\"; + DirectoryInfo dir = new DirectoryInfo(this.ParentForm.PathDataStatisticsFolder); - // directoryCheck = dir.Exists; - // // 폴더 체크 - // if (directoryCheck == false) - // dir.Create(); + directoryCheck = dir.Exists; + // 폴더 체크 + if (directoryCheck == false) + dir.Create(); - // FileInfo[] files = dir.GetFiles(); + 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; - //} + 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; @@ -1190,13 +1077,21 @@ namespace INT69DB_2A.Forms 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; } + 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); + } public void DisplayRefresh() { @@ -1225,16 +1120,16 @@ namespace INT69DB_2A.Forms } private void buttonFileSelect_Click(object sender, EventArgs e) { - this.SelectNodeIndex = -1; + this.SelectFilePath = ""; DialogFormDataStatistics form = new DialogFormDataStatistics(this); - if (form.ShowDialog() == DialogResult.OK) - this.buttonSave.Enabled = true; - else - this.buttonSave.Enabled = false; + form.ShowDialog(); } private void buttonSave_Click(object sender, EventArgs e) { + if (this.SelectFilePath == "") + return; + this.buttonSave.Enabled = false; if (this.ParentForm.SystemConfig.IsPart11 == false) diff --git a/INT69DB_2A/Forms/FormEquipmentSetting.Designer.cs b/INT69DB_2A/Forms/FormEquipmentSetting.Designer.cs index 696efbc..dd0c8eb 100644 --- a/INT69DB_2A/Forms/FormEquipmentSetting.Designer.cs +++ b/INT69DB_2A/Forms/FormEquipmentSetting.Designer.cs @@ -90,6 +90,9 @@ this.pictureBoxFormIcon = new System.Windows.Forms.PictureBox(); this.buttonSave = new SmartX.SmartButton(); this.buttonBack = new SmartX.SmartButton(); + this.buttonIntegratedTransmission = new SmartX.SmartButton(); + this.labelStaticIntegratedTransmission = new SmartX.SmartLabel(); + this.smartLabel2 = new SmartX.SmartLabel(); ((System.ComponentModel.ISupportInitialize)(this.smartForm1)).BeginInit(); this.panel1.SuspendLayout(); this.panel3.SuspendLayout(); @@ -126,9 +129,9 @@ this.labelStaticEquipmentID.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); this.labelStaticEquipmentID.InitVisible = true; this.labelStaticEquipmentID.LineSpacing = 0F; - this.labelStaticEquipmentID.Location = new System.Drawing.Point(12, 327); + this.labelStaticEquipmentID.Location = new System.Drawing.Point(318, 451); this.labelStaticEquipmentID.Name = "labelStaticEquipmentID"; - this.labelStaticEquipmentID.Size = new System.Drawing.Size(208, 25); + this.labelStaticEquipmentID.Size = new System.Drawing.Size(108, 25); this.labelStaticEquipmentID.TabIndex = 119; this.labelStaticEquipmentID.Text = "장비 ID"; this.labelStaticEquipmentID.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -145,9 +148,9 @@ this.labelStaticEquipmentLine.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); this.labelStaticEquipmentLine.InitVisible = true; this.labelStaticEquipmentLine.LineSpacing = 0F; - this.labelStaticEquipmentLine.Location = new System.Drawing.Point(12, 110); + this.labelStaticEquipmentLine.Location = new System.Drawing.Point(530, 79); this.labelStaticEquipmentLine.Name = "labelStaticEquipmentLine"; - this.labelStaticEquipmentLine.Size = new System.Drawing.Size(208, 25); + this.labelStaticEquipmentLine.Size = new System.Drawing.Size(86, 25); this.labelStaticEquipmentLine.TabIndex = 119; this.labelStaticEquipmentLine.Text = "장비 열"; this.labelStaticEquipmentLine.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -164,7 +167,7 @@ this.labelStaticWeightCheck.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); this.labelStaticWeightCheck.InitVisible = true; this.labelStaticWeightCheck.LineSpacing = 0F; - this.labelStaticWeightCheck.Location = new System.Drawing.Point(12, 141); + this.labelStaticWeightCheck.Location = new System.Drawing.Point(12, 110); this.labelStaticWeightCheck.Name = "labelStaticWeightCheck"; this.labelStaticWeightCheck.Size = new System.Drawing.Size(208, 25); this.labelStaticWeightCheck.TabIndex = 119; @@ -204,9 +207,9 @@ this.labelEquipmentID.Font = new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold); this.labelEquipmentID.InitVisible = true; this.labelEquipmentID.LineSpacing = 0F; - this.labelEquipmentID.Location = new System.Drawing.Point(226, 327); + this.labelEquipmentID.Location = new System.Drawing.Point(432, 451); this.labelEquipmentID.Name = "labelEquipmentID"; - this.labelEquipmentID.Size = new System.Drawing.Size(100, 25); + this.labelEquipmentID.Size = new System.Drawing.Size(72, 25); this.labelEquipmentID.TabIndex = 120; this.labelEquipmentID.Text = "100"; this.labelEquipmentID.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -367,9 +370,9 @@ // comboBoxEquipmentColumn // this.comboBoxEquipmentColumn.Font = new System.Drawing.Font("새굴림", 15F, System.Drawing.FontStyle.Bold); - this.comboBoxEquipmentColumn.Location = new System.Drawing.Point(226, 106); + this.comboBoxEquipmentColumn.Location = new System.Drawing.Point(622, 76); this.comboBoxEquipmentColumn.Name = "comboBoxEquipmentColumn"; - this.comboBoxEquipmentColumn.Size = new System.Drawing.Size(165, 29); + this.comboBoxEquipmentColumn.Size = new System.Drawing.Size(104, 29); this.comboBoxEquipmentColumn.TabIndex = 127; this.comboBoxEquipmentColumn.SelectedIndexChanged += new System.EventHandler(this.control_Click); // @@ -390,7 +393,7 @@ this.panel1.Controls.Add(this.radioButtonEquipmentModeStick1); this.panel1.Location = new System.Drawing.Point(226, 79); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(500, 25); + this.panel1.Size = new System.Drawing.Size(298, 25); // // radioButtonEquipmentModeStick3 // @@ -682,7 +685,7 @@ this.panel2.BackColor = System.Drawing.SystemColors.ControlLight; this.panel2.Controls.Add(this.radioButtonWeightViewReverse); this.panel2.Controls.Add(this.radioButtonWeightViewForward); - this.panel2.Location = new System.Drawing.Point(226, 141); + this.panel2.Location = new System.Drawing.Point(226, 110); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(500, 25); this.panel2.Visible = false; @@ -716,16 +719,16 @@ this.smartLabel12.BackPictureBox2 = null; this.smartLabel12.BorderColor = System.Drawing.Color.Black; this.smartLabel12.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.smartLabel12.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); + this.smartLabel12.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.smartLabel12.ForeColor = System.Drawing.Color.Red; this.smartLabel12.InitVisible = true; this.smartLabel12.LineSpacing = 0F; - this.smartLabel12.Location = new System.Drawing.Point(397, 173); + this.smartLabel12.Location = new System.Drawing.Point(428, 173); this.smartLabel12.Name = "smartLabel12"; this.smartLabel12.Size = new System.Drawing.Size(267, 23); this.smartLabel12.TabIndex = 145; this.smartLabel12.Text = "Active Only Stick I"; - this.smartLabel12.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.smartLabel12.TextHAlign = SmartX.SmartLabel.TextHorAlign.Left; this.smartLabel12.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; this.smartLabel12.Wordwrap = false; // @@ -737,16 +740,16 @@ this.smartLabel14.BackPictureBox2 = null; this.smartLabel14.BorderColor = System.Drawing.Color.Black; this.smartLabel14.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.smartLabel14.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); + this.smartLabel14.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); this.smartLabel14.ForeColor = System.Drawing.Color.Red; this.smartLabel14.InitVisible = true; this.smartLabel14.LineSpacing = 0F; - this.smartLabel14.Location = new System.Drawing.Point(397, 204); + this.smartLabel14.Location = new System.Drawing.Point(428, 204); this.smartLabel14.Name = "smartLabel14"; this.smartLabel14.Size = new System.Drawing.Size(267, 23); this.smartLabel14.TabIndex = 145; this.smartLabel14.Text = "Active Only Stick I"; - this.smartLabel14.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.smartLabel14.TextHAlign = SmartX.SmartLabel.TextHorAlign.Left; this.smartLabel14.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; this.smartLabel14.Wordwrap = false; // @@ -940,9 +943,9 @@ this.labelStaticPingTimer.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); this.labelStaticPingTimer.InitVisible = true; this.labelStaticPingTimer.LineSpacing = 0F; - this.labelStaticPingTimer.Location = new System.Drawing.Point(428, 482); + this.labelStaticPingTimer.Location = new System.Drawing.Point(532, 451); this.labelStaticPingTimer.Name = "labelStaticPingTimer"; - this.labelStaticPingTimer.Size = new System.Drawing.Size(208, 25); + this.labelStaticPingTimer.Size = new System.Drawing.Size(104, 25); this.labelStaticPingTimer.TabIndex = 199; this.labelStaticPingTimer.Text = "Ping Timer"; this.labelStaticPingTimer.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; @@ -961,7 +964,7 @@ this.buttonPingTimer.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonPingTimer.DownImage"))); this.buttonPingTimer.GroupID = 0; this.buttonPingTimer.InitVisible = true; - this.buttonPingTimer.Location = new System.Drawing.Point(642, 482); + this.buttonPingTimer.Location = new System.Drawing.Point(642, 451); this.buttonPingTimer.Mode = SmartX.SmartButton.BUTTONMODE.PUSH; this.buttonPingTimer.Name = "buttonPingTimer"; this.buttonPingTimer.NestedClickEventPrevent = false; @@ -984,6 +987,9 @@ // this.groupBoxSpecialMenu.BackPictureBox = this.smartForm1; this.groupBoxSpecialMenu.BackPictureBox1 = null; + this.groupBoxSpecialMenu.Controls.Add(this.smartLabel2); + this.groupBoxSpecialMenu.Controls.Add(this.buttonIntegratedTransmission); + this.groupBoxSpecialMenu.Controls.Add(this.labelStaticIntegratedTransmission); this.groupBoxSpecialMenu.Controls.Add(this.labelTitle); this.groupBoxSpecialMenu.Controls.Add(this.pictureBoxFormIcon); this.groupBoxSpecialMenu.Controls.Add(this.buttonSave); @@ -1128,6 +1134,77 @@ this.buttonBack.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonBack.UpImage"))); this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click); // + // buttonIntegratedTransmission + // + this.buttonIntegratedTransmission.BackPictureBox = null; + this.buttonIntegratedTransmission.BackPictureBox1 = null; + this.buttonIntegratedTransmission.BackPictureBox2 = null; + this.buttonIntegratedTransmission.ButtonColor = System.Drawing.Color.Gray; + this.buttonIntegratedTransmission.ButtonImageAutoSize = true; + this.buttonIntegratedTransmission.ColorKeySamplePosition = new System.Drawing.Point(0, 0); + this.buttonIntegratedTransmission.DisableImage = null; + this.buttonIntegratedTransmission.DownImage = ((System.Drawing.Image)(resources.GetObject("buttonIntegratedTransmission.DownImage"))); + this.buttonIntegratedTransmission.GroupID = 0; + this.buttonIntegratedTransmission.InitVisible = true; + this.buttonIntegratedTransmission.Location = new System.Drawing.Point(226, 141); + this.buttonIntegratedTransmission.Mode = SmartX.SmartButton.BUTTONMODE.PUSH; + this.buttonIntegratedTransmission.Name = "buttonIntegratedTransmission"; + this.buttonIntegratedTransmission.NestedClickEventPrevent = false; + this.buttonIntegratedTransmission.OutlinePixel = 1; + this.buttonIntegratedTransmission.RepeatInterval = 200; + this.buttonIntegratedTransmission.RepeatIntervalAccelerate = null; + this.buttonIntegratedTransmission.SafeInterval = 200; + this.buttonIntegratedTransmission.Size = new System.Drawing.Size(84, 25); + this.buttonIntegratedTransmission.SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE; + this.buttonIntegratedTransmission.TabIndex = 247; + this.buttonIntegratedTransmission.TextColor = System.Drawing.Color.Black; + this.buttonIntegratedTransmission.TextDownColor = System.Drawing.Color.White; + this.buttonIntegratedTransmission.TextHAlign = SmartX.SmartButton.TextHorAlign.Middle; + this.buttonIntegratedTransmission.TextLocation = new System.Drawing.Point(0, 0); + this.buttonIntegratedTransmission.TextVAlign = SmartX.SmartButton.TextVerAlign.Middle; + this.buttonIntegratedTransmission.UpImage = ((System.Drawing.Image)(resources.GetObject("buttonIntegratedTransmission.UpImage"))); + this.buttonIntegratedTransmission.Click += new System.EventHandler(this.control_Click); + // + // labelStaticIntegratedTransmission + // + this.labelStaticIntegratedTransmission.BackPictureBox = this.smartForm1; + this.labelStaticIntegratedTransmission.BackPictureBox1 = null; + this.labelStaticIntegratedTransmission.BackPictureBox2 = null; + this.labelStaticIntegratedTransmission.BorderColor = System.Drawing.Color.Black; + this.labelStaticIntegratedTransmission.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelStaticIntegratedTransmission.Font = new System.Drawing.Font("새굴림", 11F, System.Drawing.FontStyle.Bold); + this.labelStaticIntegratedTransmission.InitVisible = true; + this.labelStaticIntegratedTransmission.LineSpacing = 0F; + this.labelStaticIntegratedTransmission.Location = new System.Drawing.Point(12, 141); + this.labelStaticIntegratedTransmission.Name = "labelStaticIntegratedTransmission"; + this.labelStaticIntegratedTransmission.Size = new System.Drawing.Size(208, 25); + this.labelStaticIntegratedTransmission.TabIndex = 246; + this.labelStaticIntegratedTransmission.Text = "통합 전송"; + this.labelStaticIntegratedTransmission.TextHAlign = SmartX.SmartLabel.TextHorAlign.Right; + this.labelStaticIntegratedTransmission.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelStaticIntegratedTransmission.Wordwrap = false; + // + // smartLabel2 + // + this.smartLabel2.BackColor = System.Drawing.Color.Silver; + this.smartLabel2.BackPictureBox = this.smartForm1; + this.smartLabel2.BackPictureBox1 = null; + this.smartLabel2.BackPictureBox2 = null; + this.smartLabel2.BorderColor = System.Drawing.Color.Black; + this.smartLabel2.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.smartLabel2.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); + this.smartLabel2.ForeColor = System.Drawing.Color.Red; + this.smartLabel2.InitVisible = true; + this.smartLabel2.LineSpacing = 0F; + this.smartLabel2.Location = new System.Drawing.Point(428, 141); + this.smartLabel2.Name = "smartLabel2"; + this.smartLabel2.Size = new System.Drawing.Size(267, 25); + this.smartLabel2.TabIndex = 248; + this.smartLabel2.Text = "Active Only Stick II"; + this.smartLabel2.TextHAlign = SmartX.SmartLabel.TextHorAlign.Left; + this.smartLabel2.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.smartLabel2.Wordwrap = false; + // // FormEquipmentSetting // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -1214,5 +1291,8 @@ private SmartX.SmartButton buttonBack; private SmartX.SmartLabel labelTitle; private System.Windows.Forms.PictureBox pictureBoxFormIcon; + private SmartX.SmartLabel smartLabel2; + private SmartX.SmartButton buttonIntegratedTransmission; + private SmartX.SmartLabel labelStaticIntegratedTransmission; } } \ No newline at end of file diff --git a/INT69DB_2A/Forms/FormEquipmentSetting.cs b/INT69DB_2A/Forms/FormEquipmentSetting.cs index c7df634..baaf64d 100644 --- a/INT69DB_2A/Forms/FormEquipmentSetting.cs +++ b/INT69DB_2A/Forms/FormEquipmentSetting.cs @@ -166,6 +166,18 @@ namespace INT69DB_2A.Forms // 장비 열 this.comboBoxEquipmentColumn.SelectedItem = this.ParentForm.SystemConfig.EquipmentColumns; + // 중량표시 + if (this.ParentForm.SystemConfig.IsWeightViewForward == true) + this.radioButtonWeightViewForward.Checked = true; + else + this.radioButtonWeightViewReverse.Checked = true; + + // 통합 전송 + if (this.ParentForm.SystemConfig.IsIntegratedTransmission == true) + this.buttonIntegratedTransmission.ButtonDown(); + else + this.buttonIntegratedTransmission.ButtonUp(); + // 개별 NG if (this.ParentForm.SystemConfig.IsEachNG == true) this.buttonEachNG.ButtonDown(); @@ -328,6 +340,12 @@ namespace INT69DB_2A.Forms else this.ParentForm.SystemConfig.EquipmentColumns = 10; + // 통합 전송 + if (this.buttonIntegratedTransmission.ButtonStatus == SmartX.SmartButton.BUTSTATUS.DOWN) + this.ParentForm.SystemConfig.IsIntegratedTransmission = true; + else + this.ParentForm.SystemConfig.IsIntegratedTransmission = false; + // 중량표시 if (this.radioButtonWeightViewForward.Checked == true) this.ParentForm.SystemConfig.IsWeightViewForward = true; diff --git a/INT69DB_2A/Forms/FormEquipmentSetting.resx b/INT69DB_2A/Forms/FormEquipmentSetting.resx index a54daf9..2ca6e33 100644 --- a/INT69DB_2A/Forms/FormEquipmentSetting.resx +++ b/INT69DB_2A/Forms/FormEquipmentSetting.resx @@ -851,6 +851,134 @@ /s7OzleDoTt0d3czODMp0jUkCpPQjo6OkG2327e3t2nLfxkM0xEjc05OTnx8PN1EojAJjaO+ubnJ11hX VxffbX8ajM1mo4LSRBgi3NzcJAqT0Bi/GNqQnZeXRw//YjB0Snd3d2QrJAqT0GhdxcXFZINDKBF9IhKF SWh8deTn56t/1Hw+EoUp6PoPBG3lC8cKurQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAFQAAAAZCAIAAAAgz54kAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH + DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp + bGUAAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZE + sRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTs + AIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4 + JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR + 3xKxRoowlSviN+LYVA4zAwAUSWwXcFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQd + li7d1NqaQffkZKVwBALDACYrmcln013SUtOZvBwAFu/8WTLi2tJFRbY0tba0NDQzMv2qUP91829K3NtF + ehn4uWcQrf+L7a/80hoAYMyJarPziy2uCoDOLQDI3fti0zgAgKSobx3Xv7oPTTwviQJBuo2xcVZWlhGX + wzISF/QP/U+Hv6GvvmckPu6P8tBdOfFMYYqALq4bKy0lTcinZ6QzWRy64Z+H+B8H/nUeBkGceA6fwxNF + hImmjMtLELWbx+YKuGk8Opf3n5r4D8P+pMW5FonS+BFQY4yA1HUqQH7tBygKESDR+8Vd/6NvvvgwIH55 + 4SqTi3P/7zf9Z8Gl4iWDm/A5ziUohM4S8jMX98TPEqABAUgCKpAHykAd6ABDYAasgC1wBG7AG/iDEBAJ + VgMWSASpgA+yQB7YBApBMdgJ9oBqUAcaQTNoBcdBJzgFzoNL4Bq4AW6D+2AUTIBnYBa8BgsQBGEhMkSB + 5CEVSBPSh8wgBmQPuUG+UBAUCcVCCRAPEkJ50GaoGCqDqqF6qBn6HjoJnYeuQIPQXWgMmoZ+h97BCEyC + qbASrAUbwwzYCfaBQ+BVcAK8Bs6FC+AdcCXcAB+FO+Dz8DX4NjwKP4PnEIAQERqiihgiDMQF8UeikHiE + j6xHipAKpAFpRbqRPuQmMorMIG9RGBQFRUcZomxRnqhQFAu1BrUeVYKqRh1GdaB6UTdRY6hZ1Ec0Ga2I + 1kfboL3QEegEdBa6EF2BbkK3oy+ib6Mn0K8xGAwNo42xwnhiIjFJmLWYEsw+TBvmHGYQM46Zw2Kx8lh9 + rB3WH8vECrCF2CrsUexZ7BB2AvsGR8Sp4Mxw7rgoHA+Xj6vAHcGdwQ3hJnELeCm8Jt4G749n43PwpfhG + fDf+On4Cv0CQJmgT7AghhCTCJkIloZVwkfCA8JJIJKoRrYmBRC5xI7GSeIx4mThGfEuSIemRXEjRJCFp + B+kQ6RzpLuklmUzWIjuSo8gC8g5yM/kC+RH5jQRFwkjCS4ItsUGiRqJDYkjiuSReUlPSSXK1ZK5kheQJ + yeuSM1J4KS0pFymm1HqpGqmTUiNSc9IUaVNpf+lU6RLpI9JXpKdksDJaMm4ybJkCmYMyF2TGKQhFneJC + YVE2UxopFykTVAxVm+pFTaIWU7+jDlBnZWVkl8mGyWbL1sielh2lITQtmhcthVZKO04bpr1borTEaQln + yfYlrUuGlszLLZVzlOPIFcm1yd2WeydPl3eTT5bfJd8p/1ABpaCnEKiQpbBf4aLCzFLqUtulrKVFS48v + vacIK+opBimuVTyo2K84p6Ss5KGUrlSldEFpRpmm7KicpFyufEZ5WoWiYq/CVSlXOavylC5Ld6Kn0Cvp + vfRZVUVVT1Whar3qgOqCmrZaqFq+WpvaQ3WCOkM9Xr1cvUd9VkNFw08jT6NF454mXpOhmai5V7NPc15L + Wytca6tWp9aUtpy2l3audov2Ax2yjoPOGp0GnVu6GF2GbrLuPt0berCehV6iXo3edX1Y31Kfq79Pf9AA + bWBtwDNoMBgxJBk6GWYathiOGdGMfI3yjTqNnhtrGEcZ7zLuM/5oYmGSYtJoct9UxtTbNN+02/R3Mz0z + llmN2S1zsrm7+QbzLvMXy/SXcZbtX3bHgmLhZ7HVosfig6WVJd+y1XLaSsMq1qrWaoRBZQQwShiXrdHW + ztYbrE9Zv7WxtBHYHLf5zdbQNtn2iO3Ucu3lnOWNy8ft1OyYdvV2o/Z0+1j7A/ajDqoOTIcGh8eO6o5s + xybHSSddpySno07PnU2c+c7tzvMuNi7rXM65Iq4erkWuA24ybqFu1W6P3NXcE9xb3Gc9LDzWepzzRHv6 + eO7yHPFS8mJ5NXvNelt5r/Pu9SH5BPtU+zz21fPl+3b7wX7efrv9HqzQXMFb0ekP/L38d/s/DNAOWBPw + YyAmMCCwJvBJkGlQXlBfMCU4JvhI8OsQ55DSkPuhOqHC0J4wybDosOaw+XDX8LLw0QjjiHUR1yIVIrmR + XVHYqLCopqi5lW4r96yciLaILoweXqW9KnvVldUKq1NWn46RjGHGnIhFx4bHHol9z/RnNjDn4rziauNm + WS6svaxnbEd2OXuaY8cp40zG28WXxU8l2CXsTphOdEisSJzhunCruS+SPJPqkuaT/ZMPJX9KCU9pS8Wl + xqae5Mnwknm9acpp2WmD6frphemja2zW7Fkzy/fhN2VAGasyugRU0c9Uv1BHuEU4lmmfWZP5Jiss60S2 + dDYvuz9HL2d7zmSue+63a1FrWWt78lTzNuWNrXNaV78eWh+3vmeD+oaCDRMbPTYe3kTYlLzpp3yT/LL8 + V5vDN3cXKBVsLBjf4rGlpVCikF84stV2a9021DbutoHt5turtn8sYhddLTYprih+X8IqufqN6TeV33za + Eb9joNSydP9OzE7ezuFdDrsOl0mX5ZaN7/bb3VFOLy8qf7UnZs+VimUVdXsJe4V7Ryt9K7uqNKp2Vr2v + Tqy+XeNc01arWLu9dn4fe9/Qfsf9rXVKdcV17w5wD9yp96jvaNBqqDiIOZh58EljWGPft4xvm5sUmoqb + PhziHRo9HHS4t9mqufmI4pHSFrhF2DJ9NProje9cv+tqNWytb6O1FR8Dx4THnn4f+/3wcZ/jPScYJ1p/ + 0Pyhtp3SXtQBdeR0zHYmdo52RXYNnvQ+2dNt293+o9GPh06pnqo5LXu69AzhTMGZT2dzz86dSz83cz7h + /HhPTM/9CxEXbvUG9g5c9Ll4+ZL7pQt9Tn1nL9tdPnXF5srJq4yrndcsr3X0W/S3/2TxU/uA5UDHdavr + XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS + fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+ + tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/ + 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAAOwQAADsEBuJFr7QAAAvhJREFUWEfll3tIU1Ec + x/vfxzadj/kYG9ucW/gKZpopBGZZki0YoU0tgp5UJBpJhJWVWIlFf4SvMq0UdbraMpeZ4Eb+F0GZY9pW + zXw0HwlBBMH61oHD0D/6p+ttt8uHw+/+zvnjfM7z3jVD7D0DtgHDYpf5iwn0Lva0zz9om7/LKM2exmsz + V05Plhc5C9PHNGzKP7VZWudauhe6ehcNnQsdd+aa6z/fYpS6mdqKyVN6ZwHM45/I2ZTvt/XfmK1r8jS0 + zN1u9NSjZ9XTFxnlzGRFsasww75e9UwhuRnLpnyfta/y09nq6Us109VVU+fL3KVHPxxiFJhn2tNVQ3HS + BrGoPIJN+cdWMzp07OMRlPtcxfkT2zc7NjFK6tg61aBC2iiOqogU6kPYlDdbTXtdRSUufYFTlzeei32Y + OKpmlLUjSnm7NPZydMThMMFOvn/IbxvP6VroHPn6AiA48H4/rbo+Wws22tNoBo2R8W1D8T/5C1OVXq93 + 6ccStIH7uxuvSJJaxHiaPU20PbSRgT/NUPxMHlMKbQjTuUUw+u0N9DDDeP3t/ushr4A78nCACZ1nAtHD + KkCMAHsBo4PSt5YL8lCCybIkgC1AQOTJ1ihzn0SG+/I0T+QRYC+Q4fgf5akzd+QtS/0w8b3JCMuWPUni + FMDpSLYAF+ThAJM/HngkjwMf8mRRcEGeXnX0Jlt51VF5AGe054g8wBkOHzKlgLj5fuT4ymNoMFLckQeY + ZHzDEXkEdBUASK7cFEii9E0S/FL+b/FvyeMHW+8s0L3btcWRrXmbkvBKxSjq4ThZmySmKir8oFCQz2NT + 3mR9pJ3YkevIybJvSHytVj1XKE0yRpHfl4hroiOPh4fuFvCyg9iUfzhsxFJPeKmKtyhkrRLx1ZiYcyJG + EZVHCItD+Xm8oKzAQE0Am/I9wz1qm1LeIYW2qDRcuCdEoOUzCn9rcGBaALQJbMobhgyye5LoSlFYSSgv + O5j2adVgU944aMysy0g9oUnRJSdrk1YbbdJP8wLA5c8re3QAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAFQAAAAZCAIAAAAgz54kAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAACH + DwAAjA8AAP1SAACBQAAAfXkAAOmLAAA85QAAGcxzPIV3AAAKOWlDQ1BQaG90b3Nob3AgSUNDIHByb2Zp + bGUAAEjHnZZ3VFTXFofPvXd6oc0wAlKG3rvAANJ7k15FYZgZYCgDDjM0sSGiAhFFRJoiSFDEgNFQJFZE + sRAUVLAHJAgoMRhFVCxvRtaLrqy89/Ly++Osb+2z97n77L3PWhcAkqcvl5cGSwGQyhPwgzyc6RGRUXTs + AIABHmCAKQBMVka6X7B7CBDJy82FniFyAl8EAfB6WLwCcNPQM4BOB/+fpFnpfIHomAARm7M5GSwRF4g4 + JUuQLrbPipgalyxmGCVmvihBEcuJOWGRDT77LLKjmNmpPLaIxTmns1PZYu4V8bZMIUfEiK+ICzO5nCwR + 3xKxRoowlSviN+LYVA4zAwAUSWwXcFiJIjYRMYkfEuQi4uUA4EgJX3HcVyzgZAvEl3JJS8/hcxMSBXQd + li7d1NqaQffkZKVwBALDACYrmcln013SUtOZvBwAFu/8WTLi2tJFRbY0tba0NDQzMv2qUP91829K3NtF + ehn4uWcQrf+L7a/80hoAYMyJarPziy2uCoDOLQDI3fti0zgAgKSobx3Xv7oPTTwviQJBuo2xcVZWlhGX + wzISF/QP/U+Hv6GvvmckPu6P8tBdOfFMYYqALq4bKy0lTcinZ6QzWRy64Z+H+B8H/nUeBkGceA6fwxNF + hImmjMtLELWbx+YKuGk8Opf3n5r4D8P+pMW5FonS+BFQY4yA1HUqQH7tBygKESDR+8Vd/6NvvvgwIH55 + 4SqTi3P/7zf9Z8Gl4iWDm/A5ziUohM4S8jMX98TPEqABAUgCKpAHykAd6ABDYAasgC1wBG7AG/iDEBAJ + VgMWSASpgA+yQB7YBApBMdgJ9oBqUAcaQTNoBcdBJzgFzoNL4Bq4AW6D+2AUTIBnYBa8BgsQBGEhMkSB + 5CEVSBPSh8wgBmQPuUG+UBAUCcVCCRAPEkJ50GaoGCqDqqF6qBn6HjoJnYeuQIPQXWgMmoZ+h97BCEyC + qbASrAUbwwzYCfaBQ+BVcAK8Bs6FC+AdcCXcAB+FO+Dz8DX4NjwKP4PnEIAQERqiihgiDMQF8UeikHiE + j6xHipAKpAFpRbqRPuQmMorMIG9RGBQFRUcZomxRnqhQFAu1BrUeVYKqRh1GdaB6UTdRY6hZ1Ec0Ga2I + 1kfboL3QEegEdBa6EF2BbkK3oy+ib6Mn0K8xGAwNo42xwnhiIjFJmLWYEsw+TBvmHGYQM46Zw2Kx8lh9 + rB3WH8vECrCF2CrsUexZ7BB2AvsGR8Sp4Mxw7rgoHA+Xj6vAHcGdwQ3hJnELeCm8Jt4G749n43PwpfhG + fDf+On4Cv0CQJmgT7AghhCTCJkIloZVwkfCA8JJIJKoRrYmBRC5xI7GSeIx4mThGfEuSIemRXEjRJCFp + B+kQ6RzpLuklmUzWIjuSo8gC8g5yM/kC+RH5jQRFwkjCS4ItsUGiRqJDYkjiuSReUlPSSXK1ZK5kheQJ + yeuSM1J4KS0pFymm1HqpGqmTUiNSc9IUaVNpf+lU6RLpI9JXpKdksDJaMm4ybJkCmYMyF2TGKQhFneJC + YVE2UxopFykTVAxVm+pFTaIWU7+jDlBnZWVkl8mGyWbL1sielh2lITQtmhcthVZKO04bpr1borTEaQln + yfYlrUuGlszLLZVzlOPIFcm1yd2WeydPl3eTT5bfJd8p/1ABpaCnEKiQpbBf4aLCzFLqUtulrKVFS48v + vacIK+opBimuVTyo2K84p6Ss5KGUrlSldEFpRpmm7KicpFyufEZ5WoWiYq/CVSlXOavylC5Ld6Kn0Cvp + vfRZVUVVT1Whar3qgOqCmrZaqFq+WpvaQ3WCOkM9Xr1cvUd9VkNFw08jT6NF454mXpOhmai5V7NPc15L + Wytca6tWp9aUtpy2l3audov2Ax2yjoPOGp0GnVu6GF2GbrLuPt0berCehV6iXo3edX1Y31Kfq79Pf9AA + bWBtwDNoMBgxJBk6GWYathiOGdGMfI3yjTqNnhtrGEcZ7zLuM/5oYmGSYtJoct9UxtTbNN+02/R3Mz0z + llmN2S1zsrm7+QbzLvMXy/SXcZbtX3bHgmLhZ7HVosfig6WVJd+y1XLaSsMq1qrWaoRBZQQwShiXrdHW + ztYbrE9Zv7WxtBHYHLf5zdbQNtn2iO3Ucu3lnOWNy8ft1OyYdvV2o/Z0+1j7A/ajDqoOTIcGh8eO6o5s + xybHSSddpySno07PnU2c+c7tzvMuNi7rXM65Iq4erkWuA24ybqFu1W6P3NXcE9xb3Gc9LDzWepzzRHv6 + eO7yHPFS8mJ5NXvNelt5r/Pu9SH5BPtU+zz21fPl+3b7wX7efrv9HqzQXMFb0ekP/L38d/s/DNAOWBPw + YyAmMCCwJvBJkGlQXlBfMCU4JvhI8OsQ55DSkPuhOqHC0J4wybDosOaw+XDX8LLw0QjjiHUR1yIVIrmR + XVHYqLCopqi5lW4r96yciLaILoweXqW9KnvVldUKq1NWn46RjGHGnIhFx4bHHol9z/RnNjDn4rziauNm + WS6svaxnbEd2OXuaY8cp40zG28WXxU8l2CXsTphOdEisSJzhunCruS+SPJPqkuaT/ZMPJX9KCU9pS8Wl + xqae5Mnwknm9acpp2WmD6frphemja2zW7Fkzy/fhN2VAGasyugRU0c9Uv1BHuEU4lmmfWZP5Jiss60S2 + dDYvuz9HL2d7zmSue+63a1FrWWt78lTzNuWNrXNaV78eWh+3vmeD+oaCDRMbPTYe3kTYlLzpp3yT/LL8 + V5vDN3cXKBVsLBjf4rGlpVCikF84stV2a9021DbutoHt5turtn8sYhddLTYprih+X8IqufqN6TeV33za + Eb9joNSydP9OzE7ezuFdDrsOl0mX5ZaN7/bb3VFOLy8qf7UnZs+VimUVdXsJe4V7Ryt9K7uqNKp2Vr2v + Tqy+XeNc01arWLu9dn4fe9/Qfsf9rXVKdcV17w5wD9yp96jvaNBqqDiIOZh58EljWGPft4xvm5sUmoqb + PhziHRo9HHS4t9mqufmI4pHSFrhF2DJ9NProje9cv+tqNWytb6O1FR8Dx4THnn4f+/3wcZ/jPScYJ1p/ + 0Pyhtp3SXtQBdeR0zHYmdo52RXYNnvQ+2dNt293+o9GPh06pnqo5LXu69AzhTMGZT2dzz86dSz83cz7h + /HhPTM/9CxEXbvUG9g5c9Ll4+ZL7pQt9Tn1nL9tdPnXF5srJq4yrndcsr3X0W/S3/2TxU/uA5UDHdavr + XTesb3QPLh88M+QwdP6m681Lt7xuXbu94vbgcOjwnZHokdE77DtTd1PuvriXeW/h/sYH6AdFD6UeVjxS + fNTws+7PbaOWo6fHXMf6Hwc/vj/OGn/2S8Yv7ycKnpCfVEyqTDZPmU2dmnafvvF05dOJZ+nPFmYKf5X+ + tfa5zvMffnP8rX82YnbiBf/Fp99LXsq/PPRq2aueuYC5R69TXy/MF72Rf3P4LeNt37vwd5MLWe+x7ys/ + 6H7o/ujz8cGn1E+f/gUDmPP8usTo0wAAAAlwSFlzAAAOwQAADsEBuJFr7QAAA2dJREFUWEfdmNdLJVkQ + h/tPcsWMOY+iGBAfTIgi3gdBXcxZDBhezBFcVBRzABUZsVEva7wKgmlUWF3D/Bnz4akrMvdhXrbt7fke + 5FSd7kv9uk5XVau9vLx8f+P19fXp6elfg3l4eLi7u7u8vHQ4HLu7u7qpaI+Pj+iH5+dn1v8YzP39/bvy + yclJicIkNKIhG0o2628Gc3V1dXp6ure3NzMz09TUJFGYhHZ9fU1Mt7e3Nzc3FxcX5waDcrvdPj8/397e + brPZJAqT0CSo8/Ozs7PDw8O/DYbTTs47OjoKCgqSkpIkCpPQSAWcnJwcHBx8QgVaXV3t7++vqKjIzMyM + jo4Wr0n8WnxtbW1CQkJiYmJcXFx5efn6+rryz83NlZaWlpWV4VRwJee5oaHho7+yspITrm4By4hfW1sL + Dw8PCQlpa2ujMtfU1AQGBnJWlX40eHl5FRUVUbcUXDY1NZWSksI1PALlbG1tHRgYUD8IlhFPAiMiImZn + Z8XW9Z6enrCwsJKSEtZIiomJWVlZUVvvpKWldXZ2iuGCZcT7+vpWVVWJ4SQ9PT01NXVpaQnxPAiql2w4 + Ybe6uloMF6whnhD9/PxGR0fFdtLS0kIJYHdoaMjDw2NkZEQ2nCQnJ2dkZIjhgjXEk9igoKDBwUGxneCh + CvT29g4PD3t7e4eGhnp6ev7xRnBwMBcgnoW/v79y+vj4NDc3q3vBGuIRGRAQ8LFWKdRD6evrQzzlcGJi + grJPXQAWXMCxb2xspOwrJ4vl5WV1L1hD/Pj4OIl1LV2U8cjIyLGxMQ58VFTU4uKibDhBPBVeDBcsU/DI + fHZ2thhOaGO5ubl0OzL/2xY8qK+v52DzV2xdr6ur431WVZD34ncWD4WFhQwtlHeIjY3lnNPqt7a22CLz + CFhYWFBXvpOVlfVxpPsJK4kHZjtebyocCae9i1fXWePZ2NgQ2wnapqenxXDBYuL/W/534h0Ox/Hx8f7+ + /s7OzleDoTt0d3czODMp0jUkCpPQjo6OkG2327e3t2nLfxkM0xEjc05OTnx8PN1EojAJjaO+ubnJ11hX + VxffbX8ajM1mo4LSRBgi3NzcJAqT0Bi/GNqQnZeXRw//YjB0Snd3d2QrJAqT0GhdxcXFZINDKBF9IhKF + SWh8deTn56t/1Hw+EoUp6PoPBG3lC8cKurQAAAAASUVORK5CYII= diff --git a/INT69DB_2A/Forms/FormInitialization.cs b/INT69DB_2A/Forms/FormInitialization.cs index 887f72c..3bf29bb 100644 --- a/INT69DB_2A/Forms/FormInitialization.cs +++ b/INT69DB_2A/Forms/FormInitialization.cs @@ -125,7 +125,7 @@ namespace INT69DB_2A.Forms structItem.IsEachNG = this.ParentForm.SystemConfig.IsEachNG; structItem.IsDischargeConveyor = this.ParentForm.SystemConfig.IsDischargeConveyor; structItem.IsImpellerMotorDirectionCW = this.ParentForm.SystemConfig.IsImpellerMotorDirectionCW; - structItem.IsPart11 = false; + structItem.IsPart11 = this.ParentForm.SystemConfig.IsPart11; structItem.IsWeightViewForward = this.ParentForm.SystemConfig.IsWeightViewForward; structItem.DecimalPlaces = this.ParentForm.SystemConfig.DecimalPlaces; structItem.EthernetPort = this.ParentForm.SystemConfig.EthernetPort; @@ -145,7 +145,7 @@ namespace INT69DB_2A.Forms // Dummy bool structItem.DummyBool1 = false; - structItem.DummyBool2 = false; + structItem.IsIntegratedTransmission = this.ParentForm.SystemConfig.IsIntegratedTransmission; structItem.IsLogin = this.ParentForm.SystemConfig.IsLogin; structItem.IsFeedingConveyorRunPass = this.ParentForm.SystemConfig.IsFeedingConveyorRunPass; @@ -157,9 +157,9 @@ namespace INT69DB_2A.Forms structItem.Serial3Mode = this.ParentForm.SystemConfig.Serial3Mode; // Dummy string - structItem.User_Level1_Name = ""; - structItem.User_Level2_Name = ""; - structItem.User_Level3_Name = ""; + structItem.User_Level1_Name = this.ParentForm.SystemConfig.User_Level1_Name; + structItem.User_Level2_Name = this.ParentForm.SystemConfig.User_Level2_Name; + structItem.User_Level3_Name = this.ParentForm.SystemConfig.User_Level3_Name; structItem.DummyString4 = ""; structItem.DummyString5 = ""; diff --git a/INT69DB_2A/Forms/FormMain.Designer.cs b/INT69DB_2A/Forms/FormMain.Designer.cs index 52e9755..b1a7795 100644 --- a/INT69DB_2A/Forms/FormMain.Designer.cs +++ b/INT69DB_2A/Forms/FormMain.Designer.cs @@ -41,6 +41,8 @@ this.timerEthernetPing = new System.Windows.Forms.Timer(); this.timerWaitResponse = new System.Windows.Forms.Timer(); this.timerUserList = new System.Windows.Forms.Timer(); + this.timerTimeOutTransmission = new System.Windows.Forms.Timer(); + this.smartSerialPortCom3 = new SmartX.SmartSerialPort(); ((System.ComponentModel.ISupportInitialize)(this.smartForm)).BeginInit(); this.SuspendLayout(); // @@ -123,6 +125,31 @@ this.timerUserList.Interval = 1000; this.timerUserList.Tick += new System.EventHandler(this.timerUserList_Tick); // + // timerTimeOutTransmission + // + this.timerTimeOutTransmission.Interval = 300; + this.timerTimeOutTransmission.Tick += new System.EventHandler(this.timerTimeOutTransmission_Tick); + // + // smartSerialPortCom3 + // + this.smartSerialPortCom3.Baud_Rate = SmartX.SmartSerialPort.BAUDRATE._9600bps; + this.smartSerialPortCom3.ErrorCheckCodeType = SmartX.SmartSerialPort.ERRORCHECKCODETYPES.ASCIICODE; + this.smartSerialPortCom3.ErrorCheckMode = SmartX.SmartSerialPort.ERRORCHECK.NONE; + this.smartSerialPortCom3.ErrorCode_Location = SmartX.SmartSerialPort.ERRORCODELOCATION.HEADER; + this.smartSerialPortCom3.ETXCode = ((byte)(3)); + this.smartSerialPortCom3.ETXCodes = null; + this.smartSerialPortCom3.FrameBufferSize = ((uint)(1024u)); + this.smartSerialPortCom3.FrameSeparationType = SmartX.SmartSerialPort.FRAMESEPARATIONTYPES.STXANDETX; + this.smartSerialPortCom3.HeadErrorCodeOffset = 0; + this.smartSerialPortCom3.PortNo = SmartX.SmartSerialPort.COMPORTNO.COM3; + this.smartSerialPortCom3.ReadTimeout = -1; + this.smartSerialPortCom3.ReceiveDetect = SmartX.SmartSerialPort.RECEIVEDETECTTYPE.EVENT_QUEUE; + this.smartSerialPortCom3.ReceiveFrameDebugMode = false; + this.smartSerialPortCom3.RS485SoftwareDetection = false; + this.smartSerialPortCom3.STXCode = ((byte)(2)); + this.smartSerialPortCom3.STXCodes = null; + this.smartSerialPortCom3.TailErrorCodeOffset = 0; + // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -151,6 +178,8 @@ private System.Windows.Forms.Timer timerEthernetPing; private System.Windows.Forms.Timer timerWaitResponse; private System.Windows.Forms.Timer timerUserList; + public System.Windows.Forms.Timer timerTimeOutTransmission; + public SmartX.SmartSerialPort smartSerialPortCom3; } } \ No newline at end of file diff --git a/INT69DB_2A/Forms/FormMain.cs b/INT69DB_2A/Forms/FormMain.cs index 25597c3..4dc32f4 100644 --- a/INT69DB_2A/Forms/FormMain.cs +++ b/INT69DB_2A/Forms/FormMain.cs @@ -560,12 +560,12 @@ namespace INT69DB_2A.Forms UserManager.IntializeUserManager(this.PathSystemFileFolder2); - if (this.SystemConfig.UserAutomaticLogout == 1) + if (this.SystemConfig.AutomaticLogout == 1) this.FlagAutomaticLogoutWarningTime = 30; else this.FlagAutomaticLogoutWarningTime = 60; - UserManager.UserManager_AutoLogoutSetTimeout(this.SystemConfig.UserAutomaticLogout, this.FlagAutomaticLogoutWarningTime); + UserManager.UserManager_AutoLogoutSetTimeout(this.SystemConfig.AutomaticLogout, this.FlagAutomaticLogoutWarningTime); } private void InitializeAES() { @@ -696,535 +696,7 @@ namespace INT69DB_2A.Forms this.TransferDataStream(CommunicationCommand.Write, CommunicationID.MainBoard, CommunicationAddress._9016_ParameterProduct, sb.ToString()); } - - #region Serial CH3 - private void SerialUart3Open() - { - if (this.serialPort3.IsOpen == true) - this.serialPort3.Close(); - - if (this.SystemConfig.Serial3Mode != 0) - { - this.serialPort3.BaudRate = this.SystemConfig.Serial3BaudRate; - this.serialPort3.Open(); - } - } - private void TreatSerialCommunication(Collection datas) - { - if (this.SystemConfig.Serial3Mode == 0) - return; - - // CH3 - if (this.SystemConfig.Serial3Mode == 1) // OPT1 - this.SerialUart3Send(this.OPT1(this.CollectionWeightData)); - else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - this.SerialUart3Send(this.OPT2(this.CollectionWeightData)); - else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - this.SerialUart3Send(this.OPT3(this.CollectionWeightData)); - else if (this.SystemConfig.Serial3Mode == 4) // Printer - { - if (this.SystemConfig.IsPrintPerProductEnable == true) - this.SerialUart3Send(this.Printer(this.CollectionWeightData)); - } - else if (this.SystemConfig.Serial3Mode == 5) // OPT4 - this.SerialUart3Send(this.OPT4(this.CollectionWeightData)); - } - private void TreatSerialCommunication(int lane, WeightData data) - { - if (this.SystemConfig.Serial3Mode == 0) - return; - - // CH3 - if (this.SystemConfig.Serial3Mode == 1) // OPT1 - this.SerialUart3Send(this.OPT1(lane, data)); - else if (this.SystemConfig.Serial3Mode == 2) // OPT2 - this.SerialUart3Send(this.OPT2(lane, data)); - else if (this.SystemConfig.Serial3Mode == 3) // OPT3 - this.SerialUart3Send(this.OPT3(lane, data)); - else if (this.SystemConfig.Serial3Mode == 4) // Printer - { - if (this.SystemConfig.IsPrintPerProductEnable == true) - this.SerialUart3Send(this.Printer(lane, data)); - } - else if (this.SystemConfig.Serial3Mode == 5) // OPT4 - this.SerialUart3Send(this.OPT4(lane, data)); - } - public void SerialUart3Send(string data) - { - try - { - this.serialPort3.Write(data); - } - catch - { - } - } - #endregion - - #region Ethernet - private void TreatEthernetCommunication(Collection datas) - { - if (this.SystemConfig.IsEthernetEnable == false) - return; - - string sendData = ""; - - if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f1_OPT1) - { - sendData = this.OPT1(this.CollectionWeightData); - this.SendEthernetData(sendData); - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f2_OPT2) - { - sendData = this.OPT2(this.CollectionWeightData); - this.SendEthernetData(sendData); - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f3_OPT3) - { - sendData = this.OPT3(this.CollectionWeightData); - this.SendEthernetData(sendData); - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f4_Modbus) // Modbus - { - if (this.SystemConfig.EthernetOperationMode == 2) // Client - { - for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) - { - this.ClientSendDatabyteArray = this.Modbus.WriteMultipleRegisterTCP( - this.Protocol_Modbus_Client_Write_Lane_Data(i), this.SystemConfig.ModbusTcpStartAddress + ((i + 1) * 50) + 140); - this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray); - } - } - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f5_OPT4) - { - sendData = this.OPT4(this.CollectionWeightData); - this.SendEthernetData(sendData); - } - } - private void TreatEthernetCommunication(int lane, WeightData data) - { - if (this.SystemConfig.IsEthernetEnable == false) - return; - - string sendData = ""; - - if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f1_OPT1) - { - sendData = this.OPT1(lane, data); - this.SendEthernetData(sendData); - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f2_OPT2) - { - sendData = this.OPT2(lane, data); - this.SendEthernetData(sendData); - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f3_OPT3) - { - sendData = this.OPT3(lane, data); - this.SendEthernetData(sendData); - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f4_Modbus) // Modbus - { - if (this.SystemConfig.EthernetOperationMode == 2) // Client - { - this.ClientSendDatabyteArray = this.Modbus.WriteMultipleRegisterTCP( - this.Protocol_Modbus_Client_Write_Lane_Data(lane - 1), this.SystemConfig.ModbusTcpStartAddress + (lane * 50) + 140); - this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray); - } - } - else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f5_OPT4) - { - sendData = this.OPT4(lane, data); - this.SendEthernetData(sendData); - } - } - private void SendEthernetData(string etherData) - { - if (this.SystemConfig.EthernetOperationMode == 1) - { - if (this.smartTCPMultiServer.ClientInfoList != null) - { - foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList) - this.EthernetServerSendMessage(client, etherData); - } - } - else - this.EthernetWeightData(etherData); - } - - public void ThreadCloseClientIP(string address) - { - this.smartTCPMultiServer.CloseClientIP(address); - } - public void TimerPingEnabled(int interval, bool bValue) - { - if (this.SystemConfig.IsPingTimer == false) - return; - - if (bValue == true) - { - if (this.IsTimerPingEnableTrue == false) - { - this.timerEthernetPing.Enabled = false; - this.timerEthernetPing.Interval = interval; - this.timerEthernetPing.Enabled = true; - this.IsTimerPingEnableTrue = true; - } - } - else - { - this.timerEthernetPing.Enabled = false; - this.IsTimerPingEnableTrue = false; - } - } - public void TimerPingEnabled(bool bValue) - { - if (this.SystemConfig.IsPingTimer == false) - return; - - if (bValue == true) - { - if (this.IsTimerPingEnableTrue == false) - { - this.timerEthernetPing.Enabled = false; - this.timerEthernetPing.Enabled = true; - this.IsTimerPingEnableTrue = true; - } - } - else - { - this.timerEthernetPing.Enabled = false; - this.IsTimerPingEnableTrue = false; - } - } - public void TimerWaitResponseEnabled(bool bValue) - { - if (this.SystemConfig.IsPingTimer == false) - return; - - if (bValue == true) - { - if (this.IsTimerWaitResponseEnableTrue == false) - { - this.timerWaitResponse.Enabled = false; - this.timerWaitResponse.Enabled = true; - this.IsTimerWaitResponseEnableTrue = true; - } - } - else - { - this.timerWaitResponse.Enabled = false; - this.IsTimerWaitResponseEnableTrue = false; - } - } - - #region Server - public void EthernetServerStart() - { - if (this.smartTCPMultiServer.IsStart == false) - { - this.ChildFormCommunication.DisplayLabelLocalPort(false); - this.smartTCPMultiServer.Port = this.SystemConfig.EthernetLocalPort; - this.smartTCPMultiServer.Start(); - } - } - public void EthernetServerStop() - { - if (this.smartTCPMultiServer.IsStart == true) - { - this.ChildFormCommunication.DisplayLabelLocalPort(true); - this.smartTCPMultiServer.Stop(); - } - } - public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, string msg) - { - this.smartTCPMultiServer.SendStringASCIIID(client.strID, msg); - } - public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, byte[] bytes) - { - this.smartTCPMultiServer.SendByteByClientID(client.strID, bytes); - } - #endregion - - #region Client - Thread cpClientThread; - - public void EthernetClientConnect() - { - if (this.IsEthernetThreadStop == false) - return; // Online 경우 - if (this.SystemConfig.IsEthernetEnable == false) - { - this.TextStatusOut("Thread Error"); - } - } - public void EthernetClientDisconnect() - { - this.IsEthernetThreadStop = true; - this.IsModbusCommonDataSend = false; - this.DelegateUISeverStatus(false); - if (null != this.EthernetStmReader) - this.EthernetStmReader.Close(); - - if (null != this.EthernetStmWriter) - this.EthernetStmWriter.Close(); - - if (null != this.EthernetNetStream) - this.EthernetNetStream.Close(); - - if (null != this.EthernetTcpClient) - this.EthernetTcpClient.Close(); - - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Disconnect", DateTime.Now)); - } - - private void EthernetClientReceiveThread() - { - //this.cpClientThread.Abort(); - - int nConnectPort = Convert.ToInt32(this.SystemConfig.EthernetServerPort); - try - { - this.DelegateTextStatusOut(">Now Connecting.."); - this.EthernetTcpClient = new TcpClient(this.SystemConfig.EthernetServerAddress, nConnectPort); - - this.EthernetNetStream = EthernetTcpClient.GetStream(); - this.EthernetStmReader = new StreamReader(EthernetNetStream); - this.EthernetStmWriter = new StreamWriter(EthernetNetStream); - - this.DelegateUISeverStatus(true); - this.DelegateTextStatusOut(">Connected Server"); - - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Connect", DateTime.Now)); - - this.IsEthernetThreadStop = false; - - // 판정 데이터 전송 - if (this.IsEthernetTransferData == true) - { - this.IsEthernetTransferData = false; - Type type = this.EthernetTransferData.GetType(); - if (type == typeof(string)) - this.DelegateTransferData((string)this.EthernetTransferData); - else if (type == typeof(byte[])) - this.DelegateTransferData((byte[])this.EthernetTransferData); - else if (type == typeof(byte)) - this.DelegateTransferData((byte)this.EthernetTransferData); - } - - while (this.IsEthernetThreadStop == false) - { - string strRecvMsg = ""; - char[] datas = new char[12]; - int sum = 0; - - this.TimerWaitResponseEnabled(false); - this.TimerPingEnabled(false); - - if (this.ResponseFailCount > 0) - this.ResponseFailCount = 0; - - try - { - //strRecvMsg = this.EthernetStmReader.ReadLine(); - this.EthernetStmReader.Read(datas, 0, datas.Length); - for (int i = 0; i < datas.Length; i++) - sum += datas[i]; - if (sum == 0) - return; - - strRecvMsg = BitConverter.ToString(Encoding.UTF8.GetBytes(datas)); - - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strRecvMsg)); - - if (null == strRecvMsg) - { - this.DelegateTextStatusOut(">Server Out"); - this.IsEthernetThreadStop = true; - break; - } - - this.DelegateTextStatusOut(strRecvMsg); - } - catch - { - this.DelegateTextStatusOut(">Server Out"); - this.IsEthernetThreadStop = true; - } - } - } - catch - { - this.DelegateTextStatusOut(">Connect Fail !"); - } - finally - { - this.IsEthernetThreadStop = true; - this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut(">Disconnected Server"); - if (null != this.EthernetStmReader) - this.EthernetStmReader.Close(); - - if (null != this.EthernetStmWriter) - this.EthernetStmWriter.Close(); - - if (null != this.EthernetNetStream) - this.EthernetNetStream.Close(); - - if (null != this.EthernetTcpClient) - this.EthernetTcpClient.Close(); - - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Disconnect", DateTime.Now)); - } - - return; - } - - private void UIServerStatus(bool status) - { - if (this.ChildFormMainDisplay != null) - this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status); - } - private void DelegateUISeverStatus(bool status) - { - this.Invoke(new UIServerStatusCallback(this.UIServerStatus), status); - } - - private void TextStatusOut(string value) - { - if (this.ChildFormCommunication != null) - this.ChildFormCommunication.UpdateEthernetStatusDisplay(value); - } - private void DelegateTextStatusOut(string value) - { - this.Invoke(new TextStatusCallback(this.TextStatusOut), value); - } - - private void DelegateTransferData(string data) - { - this.Invoke(new TransferDataStringCallback(this.EthernetSendMessage), data); - } - private void DelegateTransferData(byte[] data) - { - this.Invoke(new TransferDataByteArrayCallback(this.EthernetSendMessage), data); - } - private void DelegateTransferData(byte data) - { - this.Invoke(new TransferDataStringCallback(this.EthernetSendMessage), data); - } - public void EthernetSendMessage(string msg) - { - try - { - this.EthernetStmWriter.Write(msg); - this.EthernetStmWriter.Flush(); - - // 로그 - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg)); - } - catch - { - this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut("> Disconnect"); - } - } - public void EthernetSendMessage(byte[] msg) - { - try - { - this.EthernetStmWriter.BaseStream.Write(msg, 0, msg.Length); - this.EthernetStmWriter.Flush(); - - // 로그 - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(msg))); - } - catch - { - this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut("> Disconnect"); - } - } - public void EthernetSendMessage(byte msg) - { - try - { - this.EthernetStmWriter.WriteLine(msg); - this.EthernetStmWriter.Flush(); - - // 로그 - if (this.IsCommunicationLogOpen == true) - this.smartFileCommunicationLog.WriteString(string.Format("Client Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg)); - } - catch - { - this.DelegateUISeverStatus(false); - this.DelegateTextStatusOut("> Disconnect"); - } - } - public void EthernetWeightData(string strTemp) - { - this.IsEthernetTransferData = true; - this.EthernetTransferData = strTemp; - - if (this.IsEthernetThreadStop == true) - this.EthernetClientConnect(); - else - this.EthernetSendMessage((string)this.EthernetTransferData); - } - public void EthernetWeightData(byte temp) - { - this.IsEthernetTransferData = true; - this.EthernetTransferData = temp; - - if (this.IsEthernetThreadStop == true) - this.EthernetClientConnect(); - else - this.EthernetSendMessage((byte)this.EthernetTransferData); - } - public void EthernetWeightDataForModbus(byte[] bytes) - { - this.IsEthernetTransferData = true; - this.EthernetTransferData = bytes; - - if (this.IsEthernetThreadStop == true) - this.EthernetClientConnect(); - else - { - this.EthernetSendMessage(bytes); - this.TimerWaitResponseEnabled(true); - } - } - #endregion - - #endregion - + #region Communication Protocol public void PrintingHeadLine() { @@ -1234,7 +706,7 @@ namespace INT69DB_2A.Forms this.serialPort3.Write("\n"); } - public string OPT1(Collection datas) + public string Protocol_OPT1(Collection datas) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1243,28 +715,50 @@ namespace INT69DB_2A.Forms sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); - for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + if (this.SystemConfig.IsWeightViewForward == true) { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { - if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) - sb.Append("U"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) - sb.Append("P"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) - sb.Append("O"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) - sb.Append("D"); - else - sb.Append("E"); + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); - value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); - sb.Append(value.PadLeft(6, ' ')); + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } } sb.Append((char)0x03); return sb.ToString(); } - public string OPT1(int lane, WeightData data) + public string Protocol_OPT1(int lane, WeightData data) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1291,7 +785,83 @@ namespace INT69DB_2A.Forms return sb.ToString(); } - public string OPT2(Collection datas) + public string Protocol_OPT1_NotStxEtx(Collection datas) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + if (this.SystemConfig.IsWeightViewForward == true) + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + + return sb.ToString(); + } + public string Protocol_OPT1_NotStxEtx(int lane, WeightData data) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + sb.Append(string.Format("{0:D2}", lane)); + + if (data.JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(data.Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + + return sb.ToString(); + } + + public string Protocol_OPT2(Collection datas) { int value = 0, passWeight = 0, weight = 0; string value2 = ""; @@ -1303,27 +873,49 @@ namespace INT69DB_2A.Forms sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); - for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + if (this.SystemConfig.IsWeightViewForward == true) { - weight = int.Parse(datas[i].WeightString.Trim()); - value = weight - passWeight; + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + weight = int.Parse(datas[i].WeightString.Trim()); + value = weight - passWeight; - // SIGN - if (value < 0) - sb.Append("-"); - else - sb.Append("+"); + // SIGN + if (value < 0) + sb.Append("-"); + else + sb.Append("+"); - // WEIGHT - value = Math.Abs(value); - value2 = Helper.StringToDecimalPlaces(value.ToString(), this.SystemConfig.DecimalPlaces); - sb.Append(value2.PadLeft(6, ' ')); + // WEIGHT + value = Math.Abs(value); + value2 = Helper.StringToDecimalPlaces(value.ToString(), this.SystemConfig.DecimalPlaces); + sb.Append(value2.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + weight = int.Parse(datas[datas.Count - i].WeightString.Trim()); + value = weight - passWeight; + + // SIGN + if (value < 0) + sb.Append("-"); + else + sb.Append("+"); + + // WEIGHT + value = Math.Abs(value); + value2 = Helper.StringToDecimalPlaces(value.ToString(), this.SystemConfig.DecimalPlaces); + sb.Append(value2.PadLeft(6, ' ')); + } } sb.Append((char)0x03); return sb.ToString(); } - public string OPT2(int lane, WeightData data) + public string Protocol_OPT2(int lane, WeightData data) { int value = 0, passWeight = 0, weight = 0; string value2 = ""; @@ -1353,7 +945,87 @@ namespace INT69DB_2A.Forms return sb.ToString(); } - public string OPT3(Collection datas) + public string Protocol_OPT2_NotStxEtx(Collection datas) + { + int value = 0, passWeight = 0, weight = 0; + string value2 = ""; + passWeight = int.Parse(this.CurrentProductItem.PassRange.Trim()); + + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + if (this.SystemConfig.IsWeightViewForward == true) + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + weight = int.Parse(datas[i].WeightString.Trim()); + value = weight - passWeight; + + // SIGN + if (value < 0) + sb.Append("-"); + else + sb.Append("+"); + + // WEIGHT + value = Math.Abs(value); + value2 = Helper.StringToDecimalPlaces(value.ToString(), this.SystemConfig.DecimalPlaces); + sb.Append(value2.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + weight = int.Parse(datas[datas.Count - i].WeightString.Trim()); + value = weight - passWeight; + + // SIGN + if (value < 0) + sb.Append("-"); + else + sb.Append("+"); + + // WEIGHT + value = Math.Abs(value); + value2 = Helper.StringToDecimalPlaces(value.ToString(), this.SystemConfig.DecimalPlaces); + sb.Append(value2.PadLeft(6, ' ')); + } + } + + return sb.ToString(); + } + public string Protocol_OPT2_NotStxEtx(int lane, WeightData data) + { + int value = 0, passWeight = 0, weight = 0; + string value2 = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + sb.Append(string.Format("{0:D2}", lane)); + + passWeight = int.Parse(this.CurrentProductItem.PassRange.Trim()); + weight = int.Parse(data.WeightString.Trim()); + value = weight - passWeight; + + // SIGN + if (value < 0) + sb.Append("-"); + else + sb.Append("+"); + + // WEIGHT + value = Math.Abs(value); + value2 = Helper.StringToDecimalPlaces(value.ToString(), this.SystemConfig.DecimalPlaces); + sb.Append(value2.PadLeft(6, ' ')); + + return sb.ToString(); + } + + public string Protocol_OPT3(Collection datas) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1365,27 +1037,49 @@ namespace INT69DB_2A.Forms value = Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces); sb.Append(value.PadLeft(6, ' ')); - for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + if (this.SystemConfig.IsWeightViewForward == true) { - if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) - sb.Append("U"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) - sb.Append("P"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) - sb.Append("O"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) - sb.Append("D"); - else - sb.Append("E"); + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); - value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); - sb.Append(value.PadLeft(6, ' ')); + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } } sb.Append((char)0x03); return sb.ToString(); } - public string OPT3(int lane, WeightData data) + public string Protocol_OPT3(int lane, WeightData data) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1415,36 +1109,145 @@ namespace INT69DB_2A.Forms return sb.ToString(); } - public string Printer(Collection datas) + public string Protocol_OPT3_NotStxEtx(Collection datas) { string value = ""; StringBuilder sb = new StringBuilder(); - for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + + if (this.SystemConfig.IsWeightViewForward == true) { - sb.Append(string.Format("{0, 4}", this.SystemConfig.ProductNumber)); - sb.Append(string.Format("{0, 3}", i + 1)); + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); - if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) - sb.Append(" U"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) - sb.Append(" P"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) - sb.Append(" O"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) - sb.Append(" D"); - else - sb.Append(" E"); + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); - value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); - sb.Append(value.PadLeft(9, ' ')); - value = datas[i].TotalCount.ToString(); - sb.Append(value.PadLeft(11, ' ')); - sb.Append("\n"); + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + + return sb.ToString(); + } + public string Protocol_OPT3_NotStxEtx(int lane, WeightData data) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + sb.Append(string.Format("{0:D2}", lane)); + + if (data.JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(data.Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + + return sb.ToString(); + } + + public string Protocol_Printer(Collection datas) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("{0, 4}", this.SystemConfig.ProductNumber)); + + if (this.SystemConfig.IsWeightViewForward == true) + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + sb.Append(string.Format("{0, 3}", i + 1)); + + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append(" U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append(" P"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append(" O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append(" D"); + else + sb.Append(" E"); + + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(9, ' ')); + value = datas[i].TotalCount.ToString(); + sb.Append(value.PadLeft(11, ' ')); + sb.Append("\n"); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + sb.Append(string.Format("{0, 3}", datas.Count - i + 1)); + + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append(" U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append(" P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append(" O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append(" D"); + else + sb.Append(" E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(9, ' ')); + value = datas[datas.Count - i].TotalCount.ToString(); + sb.Append(value.PadLeft(11, ' ')); + sb.Append("\n"); + } } return sb.ToString(); } - public string Printer(int lane, WeightData data) + public string Protocol_Printer(int lane, WeightData data) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1470,7 +1273,8 @@ namespace INT69DB_2A.Forms return sb.ToString(); } - public string OPT4(Collection datas) + + public string Protocol_OPT4(Collection datas) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1488,27 +1292,49 @@ namespace INT69DB_2A.Forms value = Helper.StringToDecimalPlaces(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces); sb.Append(value.PadLeft(6, ' ')); - for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + if (this.SystemConfig.IsWeightViewForward == true) { - if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) - sb.Append("U"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) - sb.Append("O"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) - sb.Append("D"); - else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) - sb.Append("P"); - else - sb.Append("E"); + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); - value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); - sb.Append(value.PadLeft(6, ' ')); + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } } sb.Append((char)0x03); return sb.ToString(); } - public string OPT4(int lane, WeightData data) + public string Protocol_OPT4(int lane, WeightData data) { string value = ""; StringBuilder sb = new StringBuilder(); @@ -1544,6 +1370,98 @@ namespace INT69DB_2A.Forms return sb.ToString(); } + public string Protocol_OPT4_NotStxEtx(Collection datas) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + + if (this.SystemConfig.IsWeightViewForward == true) + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + else + { + for (int i = 1; i <= this.SystemConfig.EquipmentColumns; i++) + { + if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (datas[datas.Count - i].JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else + sb.Append("E"); + + value = Helper.DoubleToString(datas[datas.Count - i].Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + } + } + + return sb.ToString(); + } + public string Protocol_OPT4_NotStxEtx(int lane, WeightData data) + { + string value = ""; + StringBuilder sb = new StringBuilder(); + + sb.Append(string.Format("IN{0:D3}", this.SystemConfig.EquipmentID)); + sb.Append(string.Format("{0:D4}", this.SystemConfig.ProductNumber)); + + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.UnderRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.PassRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.OverRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + value = Helper.StringToDecimalPlaces(this.CurrentProductItem.TareRange, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + sb.Append(string.Format("{0:D2}", lane)); + + if (data.JudgmentStatus == DataStore.JudgmentStatus.Under) + sb.Append("U"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Over) + sb.Append("O"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Double) + sb.Append("D"); + else if (data.JudgmentStatus == DataStore.JudgmentStatus.Pass) + sb.Append("P"); + else + sb.Append("E"); + + value = Helper.DoubleToString(data.Weight, this.SystemConfig.DecimalPlaces); + sb.Append(value.PadLeft(6, ' ')); + + return sb.ToString(); + } public byte[] Protocol_Modbus_Client_Write_Common_Data() { @@ -2992,6 +2910,650 @@ namespace INT69DB_2A.Forms return madeData; } + #endregion + #region Integrated Transmission + public void IntegratedTransmission(Collection datas) + { + #region COM3 + switch (this.SystemConfig.Serial3Mode) + { + case 1: + this.UartCom3Write(this.Protocol_OPT1_NotStxEtx(datas)); + break; + case 2: + this.UartCom3Write(this.Protocol_OPT2_NotStxEtx(datas)); + break; + case 3: + this.UartCom3Write(this.Protocol_OPT3_NotStxEtx(datas)); + break; + case 4: + this.UartCom3Write(this.Protocol_Printer(datas)); + break; + case 5: + this.UartCom3Write(this.Protocol_OPT4_NotStxEtx(datas)); + break; + default: + break; + } + #endregion + + #region Ethernet + switch (this.SystemConfig.EthernetMode) + { + case 1: + this.SendEthernetData(this.Protocol_OPT1_NotStxEtx(datas)); + break; + case 2: + this.SendEthernetData(this.Protocol_OPT2_NotStxEtx(datas)); + break; + case 3: + this.SendEthernetData(this.Protocol_OPT3_NotStxEtx(datas)); + break; + case 5: + this.SendEthernetData(this.Protocol_OPT4_NotStxEtx(datas)); + break; + default: + break; + } + #endregion + + // DataBackup + this.TrackingInspectionData(this.CollectionWeightData); + } + public void IntegratedTransmissionCheck(Collection datas) + { + int value = 0; + + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + if (datas[i].IsUpdate == true) + value++; + } + + if (value == this.SystemConfig.EquipmentColumns) + { + this.timerTimeOutTransmission.Enabled = false; + this.IntegratedTransmission(datas); + + foreach (WeightData data in this.CollectionWeightData) + data.IsUpdate = false; + } + } + #endregion + #region Serial CH3 + public void UartCom3Open() + { + string fullPath = ""; + + this.smartSerialPortCom3.ErrorCheckMode = SmartSerialPort.ERRORCHECK.NONE; + + if (this.SystemConfig.Serial3Mode != 0) + { + try + { + switch (this.SystemConfig.Serial3BaudRate) + { + case 0: + this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._9600bps; + break; + case 1: + this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._19200bps; + break; + case 2: + this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._38400bps; + break; + case 3: + this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._115200bps; + break; + default: + this.smartSerialPortCom3.Baud_Rate = SmartSerialPort.BAUDRATE._9600bps; + break; + } + if (this.smartSerialPortCom3.IsOpen == false) + this.smartSerialPortCom3.Open(); + } + catch + { + } + } + + #region Test 용 통신 로그 + //fullPath = this.PathDataBackupFolder + "COM3log.txt"; + //this.smartFileCom3Log.FilePathName = fullPath; + //this.IsCom3LogOpen = true; + //this.smartFileCom3Log.Open(); + #endregion + } + + public void UartCom3Write(string data) + { + this.smartSerialPortCom3.WriteFrame(data, SmartSerialPort.CODETYPES.ASCIICODE); + } + private int UartCom3Write(string command, string id, string address, string data) + { + int ret = 0; + string chkSum = "cc"; + StringBuilder sb = new StringBuilder(); + + sb.Append(command); + sb.Append(id); + sb.Append(Helper.StringZeroFillDigits4(data.Length.ToString())); + sb.Append(address); + sb.Append(data); + + chkSum = Helper.Checksumcalculator(sb.ToString()); + + sb.Append(chkSum); + + if (this.smartSerialPortCom3.IsReadStart == true) + this.smartSerialPortCom3.WriteFrame(sb.ToString(), SmartSerialPort.CODETYPES.ASCIICODE); + + return ret; + } + + private void TreatSerialCommunication(Collection datas) + { + if (this.SystemConfig.Serial3Mode == 0) + return; + + // CH3 + if (this.SystemConfig.Serial3Mode == 1) // OPT1 + this.UartCom3Write(this.Protocol_OPT1(this.CollectionWeightData)); + else if (this.SystemConfig.Serial3Mode == 2) // OPT2 + this.UartCom3Write(this.Protocol_OPT2(this.CollectionWeightData)); + else if (this.SystemConfig.Serial3Mode == 3) // OPT3 + this.UartCom3Write(this.Protocol_OPT3(this.CollectionWeightData)); + else if (this.SystemConfig.Serial3Mode == 4) // Printer + { + if (this.SystemConfig.IsPrintPerProductEnable == true) + this.UartCom3Write(this.Protocol_Printer(this.CollectionWeightData)); + } + else if (this.SystemConfig.Serial3Mode == 5) // OPT4 + this.UartCom3Write(this.Protocol_OPT4(this.CollectionWeightData)); + } + private void TreatSerialCommunication(int lane, WeightData data) + { + if (this.SystemConfig.Serial3Mode == 0) + return; + + // CH3 + if (this.SystemConfig.Serial3Mode == 1) // OPT1 + this.UartCom3Write(this.Protocol_OPT1(lane, data)); + else if (this.SystemConfig.Serial3Mode == 2) // OPT2 + this.UartCom3Write(this.Protocol_OPT2(lane, data)); + else if (this.SystemConfig.Serial3Mode == 3) // OPT3 + this.UartCom3Write(this.Protocol_OPT3(lane, data)); + else if (this.SystemConfig.Serial3Mode == 4) // Printer + { + if (this.SystemConfig.IsPrintPerProductEnable == true) + this.UartCom3Write(this.Protocol_Printer(lane, data)); + } + else if (this.SystemConfig.Serial3Mode == 5) // OPT4 + this.UartCom3Write(this.Protocol_OPT4(lane, data)); + } + #endregion + #region Ethernet + private void TreatEthernetCommunication(Collection datas) + { + if (this.SystemConfig.IsEthernetEnable == false) + return; + + string sendData = ""; + + if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f1_OPT1) + { + sendData = this.Protocol_OPT1(this.CollectionWeightData); + this.SendEthernetData(sendData); + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f2_OPT2) + { + sendData = this.Protocol_OPT2(this.CollectionWeightData); + this.SendEthernetData(sendData); + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f3_OPT3) + { + sendData = this.Protocol_OPT3(this.CollectionWeightData); + this.SendEthernetData(sendData); + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f4_Modbus) // Modbus + { + if (this.SystemConfig.EthernetOperationMode == 2) // Client + { + for (int i = 0; i < this.SystemConfig.EquipmentColumns; i++) + { + this.ClientSendDatabyteArray = this.Modbus.WriteMultipleRegisterTCP( + this.Protocol_Modbus_Client_Write_Lane_Data(i), this.SystemConfig.ModbusTcpStartAddress + ((i + 1) * 50) + 140); + this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray); + } + } + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f5_OPT4) + { + sendData = this.Protocol_OPT4(this.CollectionWeightData); + this.SendEthernetData(sendData); + } + } + private void TreatEthernetCommunication(int lane, WeightData data) + { + if (this.SystemConfig.IsEthernetEnable == false) + return; + + string sendData = ""; + + if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f1_OPT1) + { + sendData = this.Protocol_OPT1(lane, data); + this.SendEthernetData(sendData); + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f2_OPT2) + { + sendData = this.Protocol_OPT2(lane, data); + this.SendEthernetData(sendData); + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f3_OPT3) + { + sendData = this.Protocol_OPT3(lane, data); + this.SendEthernetData(sendData); + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f4_Modbus) // Modbus + { + if (this.SystemConfig.EthernetOperationMode == 2) // Client + { + this.ClientSendDatabyteArray = this.Modbus.WriteMultipleRegisterTCP( + this.Protocol_Modbus_Client_Write_Lane_Data(lane - 1), this.SystemConfig.ModbusTcpStartAddress + (lane * 50) + 140); + this.EthernetWeightDataForModbus(this.ClientSendDatabyteArray); + } + } + else if (this.SystemConfig.EthernetMode == (int)DataStore.EthernetMode.f5_OPT4) + { + sendData = this.Protocol_OPT4(lane, data); + this.SendEthernetData(sendData); + } + } + private void SendEthernetData(string etherData) + { + if (this.SystemConfig.EthernetOperationMode == 1) + { + if (this.smartTCPMultiServer.ClientInfoList != null) + { + foreach (SmartTCPMultiServer.CLIENTSINFOS client in this.smartTCPMultiServer.ClientInfoList) + this.EthernetServerSendMessage(client, etherData); + } + } + else + this.EthernetWeightData(etherData); + } + + public void ThreadCloseClientIP(string address) + { + this.smartTCPMultiServer.CloseClientIP(address); + } + public void TimerPingEnabled(int interval, bool bValue) + { + if (this.SystemConfig.IsPingTimer == false) + return; + + if (bValue == true) + { + if (this.IsTimerPingEnableTrue == false) + { + this.timerEthernetPing.Enabled = false; + this.timerEthernetPing.Interval = interval; + this.timerEthernetPing.Enabled = true; + this.IsTimerPingEnableTrue = true; + } + } + else + { + this.timerEthernetPing.Enabled = false; + this.IsTimerPingEnableTrue = false; + } + } + public void TimerPingEnabled(bool bValue) + { + if (this.SystemConfig.IsPingTimer == false) + return; + + if (bValue == true) + { + if (this.IsTimerPingEnableTrue == false) + { + this.timerEthernetPing.Enabled = false; + this.timerEthernetPing.Enabled = true; + this.IsTimerPingEnableTrue = true; + } + } + else + { + this.timerEthernetPing.Enabled = false; + this.IsTimerPingEnableTrue = false; + } + } + public void TimerWaitResponseEnabled(bool bValue) + { + if (this.SystemConfig.IsPingTimer == false) + return; + + if (bValue == true) + { + if (this.IsTimerWaitResponseEnableTrue == false) + { + this.timerWaitResponse.Enabled = false; + this.timerWaitResponse.Enabled = true; + this.IsTimerWaitResponseEnableTrue = true; + } + } + else + { + this.timerWaitResponse.Enabled = false; + this.IsTimerWaitResponseEnableTrue = false; + } + } + + #region Server + public void EthernetServerStart() + { + if (this.smartTCPMultiServer.IsStart == false) + { + this.ChildFormCommunication.DisplayLabelLocalPort(false); + this.smartTCPMultiServer.Port = this.SystemConfig.EthernetLocalPort; + this.smartTCPMultiServer.Start(); + } + } + public void EthernetServerStop() + { + if (this.smartTCPMultiServer.IsStart == true) + { + this.ChildFormCommunication.DisplayLabelLocalPort(true); + this.smartTCPMultiServer.Stop(); + } + } + public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, string msg) + { + this.smartTCPMultiServer.SendStringASCIIID(client.strID, msg); + } + public void EthernetServerSendMessage(SmartTCPMultiServer.CLIENTSINFOS client, byte[] bytes) + { + this.smartTCPMultiServer.SendByteByClientID(client.strID, bytes); + } + #endregion + + #region Client + Thread cpClientThread; + + public void EthernetClientConnect() + { + if (this.IsEthernetThreadStop == false) + return; // Online 경우 + if (this.SystemConfig.IsEthernetEnable == false) + { + this.TextStatusOut("Thread Error"); + } + } + public void EthernetClientDisconnect() + { + this.IsEthernetThreadStop = true; + this.IsModbusCommonDataSend = false; + this.DelegateUISeverStatus(false); + if (null != this.EthernetStmReader) + this.EthernetStmReader.Close(); + + if (null != this.EthernetStmWriter) + this.EthernetStmWriter.Close(); + + if (null != this.EthernetNetStream) + this.EthernetNetStream.Close(); + + if (null != this.EthernetTcpClient) + this.EthernetTcpClient.Close(); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Disconnect", DateTime.Now)); + } + + private void EthernetClientReceiveThread() + { + //this.cpClientThread.Abort(); + + int nConnectPort = Convert.ToInt32(this.SystemConfig.EthernetServerPort); + try + { + this.DelegateTextStatusOut(">Now Connecting.."); + this.EthernetTcpClient = new TcpClient(this.SystemConfig.EthernetServerAddress, nConnectPort); + + this.EthernetNetStream = EthernetTcpClient.GetStream(); + this.EthernetStmReader = new StreamReader(EthernetNetStream); + this.EthernetStmWriter = new StreamWriter(EthernetNetStream); + + this.DelegateUISeverStatus(true); + this.DelegateTextStatusOut(">Connected Server"); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Connect", DateTime.Now)); + + this.IsEthernetThreadStop = false; + + // 판정 데이터 전송 + if (this.IsEthernetTransferData == true) + { + this.IsEthernetTransferData = false; + Type type = this.EthernetTransferData.GetType(); + if (type == typeof(string)) + this.DelegateTransferData((string)this.EthernetTransferData); + else if (type == typeof(byte[])) + this.DelegateTransferData((byte[])this.EthernetTransferData); + else if (type == typeof(byte)) + this.DelegateTransferData((byte)this.EthernetTransferData); + } + + while (this.IsEthernetThreadStop == false) + { + string strRecvMsg = ""; + char[] datas = new char[12]; + int sum = 0; + + this.TimerWaitResponseEnabled(false); + this.TimerPingEnabled(false); + + if (this.ResponseFailCount > 0) + this.ResponseFailCount = 0; + + try + { + //strRecvMsg = this.EthernetStmReader.ReadLine(); + this.EthernetStmReader.Read(datas, 0, datas.Length); + for (int i = 0; i < datas.Length; i++) + sum += datas[i]; + if (sum == 0) + return; + + strRecvMsg = BitConverter.ToString(Encoding.UTF8.GetBytes(datas)); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client Receive ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, strRecvMsg)); + + if (null == strRecvMsg) + { + this.DelegateTextStatusOut(">Server Out"); + this.IsEthernetThreadStop = true; + break; + } + + this.DelegateTextStatusOut(strRecvMsg); + } + catch + { + this.DelegateTextStatusOut(">Server Out"); + this.IsEthernetThreadStop = true; + } + } + } + catch + { + this.DelegateTextStatusOut(">Connect Fail !"); + } + finally + { + this.IsEthernetThreadStop = true; + this.DelegateUISeverStatus(false); + this.DelegateTextStatusOut(">Disconnected Server"); + if (null != this.EthernetStmReader) + this.EthernetStmReader.Close(); + + if (null != this.EthernetStmWriter) + this.EthernetStmWriter.Close(); + + if (null != this.EthernetNetStream) + this.EthernetNetStream.Close(); + + if (null != this.EthernetTcpClient) + this.EthernetTcpClient.Close(); + + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client ({0:yyyy-MM-dd HH:mm:ss}): Disconnect", DateTime.Now)); + } + + return; + } + + private void UIServerStatus(bool status) + { + if (this.ChildFormMainDisplay != null) + this.ChildFormMainDisplay.UpdateEthernetStatusDisplay(status); + } + private void DelegateUISeverStatus(bool status) + { + this.Invoke(new UIServerStatusCallback(this.UIServerStatus), status); + } + + private void TextStatusOut(string value) + { + if (this.ChildFormCommunication != null) + this.ChildFormCommunication.UpdateEthernetStatusDisplay(value); + } + private void DelegateTextStatusOut(string value) + { + this.Invoke(new TextStatusCallback(this.TextStatusOut), value); + } + + private void DelegateTransferData(string data) + { + this.Invoke(new TransferDataStringCallback(this.EthernetSendMessage), data); + } + private void DelegateTransferData(byte[] data) + { + this.Invoke(new TransferDataByteArrayCallback(this.EthernetSendMessage), data); + } + private void DelegateTransferData(byte data) + { + this.Invoke(new TransferDataStringCallback(this.EthernetSendMessage), data); + } + public void EthernetSendMessage(string msg) + { + try + { + this.EthernetStmWriter.Write(msg); + this.EthernetStmWriter.Flush(); + + // 로그 + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg)); + } + catch + { + this.DelegateUISeverStatus(false); + this.DelegateTextStatusOut("> Disconnect"); + } + } + public void EthernetSendMessage(byte[] msg) + { + try + { + this.EthernetStmWriter.BaseStream.Write(msg, 0, msg.Length); + this.EthernetStmWriter.Flush(); + + // 로그 + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, BitConverter.ToString(msg))); + } + catch + { + this.DelegateUISeverStatus(false); + this.DelegateTextStatusOut("> Disconnect"); + } + } + public void EthernetSendMessage(byte msg) + { + try + { + this.EthernetStmWriter.WriteLine(msg); + this.EthernetStmWriter.Flush(); + + // 로그 + if (this.IsCommunicationLogOpen == true) + this.smartFileCommunicationLog.WriteString(string.Format("Client Send ({0:yyyy-MM-dd HH:mm:ss}): {1}", DateTime.Now, msg)); + } + catch + { + this.DelegateUISeverStatus(false); + this.DelegateTextStatusOut("> Disconnect"); + } + } + public void EthernetWeightData(string strTemp) + { + this.IsEthernetTransferData = true; + this.EthernetTransferData = strTemp; + + if (this.IsEthernetThreadStop == true) + this.EthernetClientConnect(); + else + this.EthernetSendMessage((string)this.EthernetTransferData); + } + public void EthernetWeightData(byte temp) + { + this.IsEthernetTransferData = true; + this.EthernetTransferData = temp; + + if (this.IsEthernetThreadStop == true) + this.EthernetClientConnect(); + else + this.EthernetSendMessage((byte)this.EthernetTransferData); + } + public void EthernetWeightDataForModbus(byte[] bytes) + { + this.IsEthernetTransferData = true; + this.EthernetTransferData = bytes; + + if (this.IsEthernetThreadStop == true) + this.EthernetClientConnect(); + else + { + this.EthernetSendMessage(bytes); + this.TimerWaitResponseEnabled(true); + } + } + #endregion + #endregion #region Uart Communication @@ -3170,6 +3732,50 @@ namespace INT69DB_2A.Forms for (int i = 0; i < byteData.Length; i++) collection.Add(byteData[i]); } + private void UpdateWeightData(int index, string receiveData) + { + int index2 = 0; + + if (this.SystemConfig.IsWeightViewForward == true) + { + this.CollectionWeightData[index].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); + this.CollectionWeightData[index].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); + this.CollectionWeightData[index].WeightString = receiveData.Substring(2, 5); + this.CollectionWeightData[index].ADCValue = receiveData.Substring(7, 5); + + this.Update30000ModbusData(index); + } + else + { + index2 = this.CollectionWeightData.Count - (index + 1); + + this.CollectionWeightData[index2].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); + this.CollectionWeightData[index2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); + this.CollectionWeightData[index2].WeightString = receiveData.Substring(2, 5); + this.CollectionWeightData[index2].ADCValue = receiveData.Substring(7, 5); + + this.Update30000ModbusData(index2); + } + } + private void UpdateWeightDataTest(int index, string receiveData) + { + int index2 = 0; + + if (this.SystemConfig.IsWeightViewForward == true) + { + this.CollectionWeightDataTest[index].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); + this.CollectionWeightDataTest[index].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); + this.CollectionWeightDataTest[index].ADCValue = receiveData.Substring(7, 5); + } + else + { + index2 = this.CollectionWeightDataTest.Count - (index + 1); + + this.CollectionWeightDataTest[index2].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); + this.CollectionWeightDataTest[index2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); + this.CollectionWeightDataTest[index2].ADCValue = receiveData.Substring(7, 5); + } + } public int TransferData(string command, string id) { @@ -3945,304 +4551,275 @@ namespace INT69DB_2A.Forms switch (lane) { case "A": + #region 1열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[0].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[0].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[0].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[0].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(0, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[0].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[0].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[0].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(0, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[0], 1); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightData[0]); this.Update30000ModbusData(0); this.TreatSerialCommunication(1, this.CollectionWeightData[0]); this.TreatEthernetCommunication(1, this.CollectionWeightData[0]); + + if (this.SystemConfig.IsIntegratedTransmission == true) + { + #region 통합 전송 + if (this.timerTimeOutTransmission.Enabled == false) + this.timerTimeOutTransmission.Enabled = true; + + // EquipmentColumns 수 만큼 중량이 들어왔는지 체크 후 데이터 전송하는 함수(EquipmentColumns 갯수가 다 들어아야 데이터 전송함) + this.IntegratedTransmissionCheck(this.CollectionWeightData); + #endregion + } + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay1(this.EquipmentStatus, this.CollectionWeightDataTest[0]); } + #endregion break; case "B": + #region 2열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[1].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[1].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[1].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[1].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(1, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[1].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[1].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[1].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(1, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[1], 2); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightData[1]); this.Update30000ModbusData(1); this.TreatSerialCommunication(2, this.CollectionWeightData[1]); this.TreatEthernetCommunication(2, this.CollectionWeightData[1]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay2(this.EquipmentStatus, this.CollectionWeightDataTest[1]); } + #endregion break; case "C": + #region 3열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[2].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[2].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[2].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(2, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[2].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[2].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[2].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(2, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[2], 3); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightData[2]); this.Update30000ModbusData(2); this.TreatSerialCommunication(3, this.CollectionWeightData[2]); this.TreatEthernetCommunication(3, this.CollectionWeightData[2]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay3(this.EquipmentStatus, this.CollectionWeightDataTest[2]); } + #endregion break; case "D": + #region 4열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[3].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[3].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[3].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[3].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(3, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[3].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[3].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[3].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(3, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[3], 4); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightData[3]); this.Update30000ModbusData(3); this.TreatSerialCommunication(4, this.CollectionWeightData[3]); this.TreatEthernetCommunication(4, this.CollectionWeightData[3]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay4(this.EquipmentStatus, this.CollectionWeightDataTest[3]); } + #endregion break; case "E": + #region 5열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[4].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[4].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[4].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[4].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(4, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[4].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[4].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[4].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(4, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[4], 5); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightData[4]); this.Update30000ModbusData(4); this.TreatSerialCommunication(5, this.CollectionWeightData[4]); this.TreatEthernetCommunication(5, this.CollectionWeightData[4]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay5(this.EquipmentStatus, this.CollectionWeightDataTest[4]); } + #endregion break; case "F": + #region 6열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[5].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[5].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[5].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[5].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(5, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[5].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[5].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[5].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(5, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[5], 6); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightData[5]); this.Update30000ModbusData(5); this.TreatSerialCommunication(6, this.CollectionWeightData[5]); this.TreatEthernetCommunication(6, this.CollectionWeightData[5]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay6(this.EquipmentStatus, this.CollectionWeightDataTest[5]); } + #endregion break; case "G": + #region 7열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[6].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[6].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[6].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[6].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(6, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[6].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[6].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[6].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(6, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[6], 7); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightData[6]); this.Update30000ModbusData(6); this.TreatSerialCommunication(7, this.CollectionWeightData[6]); this.TreatEthernetCommunication(7, this.CollectionWeightData[6]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay7(this.EquipmentStatus, this.CollectionWeightDataTest[6]); } + #endregion break; case "H": + #region 8열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[7].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[7].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[7].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[7].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(7, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[7].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[7].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[7].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(7, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[7], 8); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightData[7]); this.Update30000ModbusData(7); this.TreatSerialCommunication(8, this.CollectionWeightData[7]); this.TreatEthernetCommunication(8, this.CollectionWeightData[7]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay8(this.EquipmentStatus, this.CollectionWeightDataTest[7]); } + #endregion break; case "I": + #region 9열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[8].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[8].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[8].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[8].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(8, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[8].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[8].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[8].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(8, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[8], 9); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightData[8]); this.Update30000ModbusData(8); this.TreatSerialCommunication(9, this.CollectionWeightData[8]); this.TreatEthernetCommunication(9, this.CollectionWeightData[8]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay9(this.EquipmentStatus, this.CollectionWeightDataTest[8]); } + #endregion break; case "J": + #region 10열 #region Value Assign if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - { - this.CollectionWeightData[9].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightData[9].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightData[9].WeightString = receiveData.Substring(2, 5); - this.CollectionWeightData[9].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightData(9, receiveData); else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) - { - this.CollectionWeightDataTest[9].JudgmentStatus = Helper.StringToJudgmentStatus(receiveData.Substring(0, 2)); - this.CollectionWeightDataTest[9].Weight = Helper.StringToWeight(receiveData.Substring(2, 5), this.SystemConfig.DecimalPlaces); - this.CollectionWeightDataTest[9].ADCValue = receiveData.Substring(7, 5); - } + this.UpdateWeightDataTest(9, receiveData); #endregion + if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) { + #region FormMainDisplay this.TrackingInspectionData(this.CollectionWeightData[9], 10); this.ChildFormMainDisplay.UpdateUpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightData[9]); this.Update30000ModbusData(9); this.TreatSerialCommunication(10, this.CollectionWeightData[9]); this.TreatEthernetCommunication(10, this.CollectionWeightData[9]); + #endregion } else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormEquipmentTest) { this.ChildFormEquipmentTest.UpdateUpdateStartWeightDisplay10(this.EquipmentStatus, this.CollectionWeightDataTest[9]); } + #endregion break; case "Z": #region Value Assign @@ -5028,7 +5605,7 @@ namespace INT69DB_2A.Forms structItem.Serial3Mode = this.SystemConfig.Serial3Mode; structItem.DummyBool1 = false; - structItem.DummyBool2 = false; + structItem.IsIntegratedTransmission = this.SystemConfig.IsIntegratedTransmission; structItem.IsLogin = this.SystemConfig.IsLogin; structItem.IsFeedingConveyorRunPass = this.SystemConfig.IsFeedingConveyorRunPass; structItem.StepMotorType = this.SystemConfig.StepMotorType; @@ -5082,7 +5659,7 @@ namespace INT69DB_2A.Forms structItem2.EthernetMode = this.SystemConfig.EthernetMode; structItem2.EthernetServerPort = this.SystemConfig.EthernetServerPort; structItem2.DummyInt10 = 0; - structItem2.UserAutomaticLogout = this.SystemConfig.UserAutomaticLogout; + structItem2.AutomaticLogout = this.SystemConfig.AutomaticLogout; structItem2.StoragePeriod = this.SystemConfig.StoragePeriod; structItem2.DummyString1 = ""; @@ -5150,7 +5727,7 @@ namespace INT69DB_2A.Forms structItem1.Serial3Mode = item.Serial3Mode; structItem1.DummyBool1 = false; - structItem1.DummyBool2 = false; + structItem1.IsIntegratedTransmission = item.IsIntegratedTransmission; structItem1.IsLogin = item.IsLogin; structItem1.IsFeedingConveyorRunPass = item.IsFeedingConveyorRunPass; structItem1.StepMotorType = item.StepMotorType; @@ -5205,7 +5782,7 @@ namespace INT69DB_2A.Forms structItem2.EthernetMode = item.EthernetMode; structItem2.EthernetServerPort = item.EthernetServerPort; structItem2.DummyInt10 = 0; - structItem2.UserAutomaticLogout = item.UserAutomaticLogout; + structItem2.AutomaticLogout = item.AutomaticLogout; structItem2.StoragePeriod = item.StoragePeriod; structItem2.DummyString1 = ""; @@ -5259,6 +5836,9 @@ namespace INT69DB_2A.Forms this.SystemConfig.IsWeightViewForward = structItem1.IsWeightViewForward; this.SystemConfig.IsFeedingConveyorRunPass = structItem1.IsFeedingConveyorRunPass; this.SystemConfig.IsPingTimer = structItem1.IsPingTimer; + this.SystemConfig.IsLogin = structItem1.IsLogin; + this.SystemConfig.IsIntegratedTransmission = structItem1.IsIntegratedTransmission; + this.SystemConfig.DecimalPlaces = structItem1.DecimalPlaces; this.SystemConfig.EthernetPort = structItem1.EthernetPort; this.SystemConfig.EquipmentColumns = structItem1.EquipmentColumns; @@ -5274,7 +5854,6 @@ namespace INT69DB_2A.Forms this.SystemConfig.Serial3BaudRate = structItem1.Serial3BaudRate; this.SystemConfig.Serial3Mode = structItem1.Serial3Mode; this.SystemConfig.InputSensorSelect = structItem1.InputSensorSelect; - this.SystemConfig.IsLogin = structItem1.IsLogin; this.SystemConfig.ImpellerMotorAngleNG = structItem1.ImpellerMotorAngleNG; this.SystemConfig.StepMotorType = structItem1.StepMotorType; this.SystemConfig.DischargeConveyorDirectionCW = (DataStore.DischargeConveyorDirection)structItem1.DischargeConveyorDirectionCW; @@ -5317,7 +5896,7 @@ namespace INT69DB_2A.Forms this.SystemConfig.ModbusTcpAddress1 = structItem2.ModbusTcpAddress1; this.SystemConfig.ModbusTcpAddress2 = structItem2.ModbusTcpAddress2; this.SystemConfig.StoragePeriod = structItem2.StoragePeriod; - this.SystemConfig.UserAutomaticLogout = structItem2.UserAutomaticLogout; + this.SystemConfig.AutomaticLogout = structItem2.AutomaticLogout; } catch { @@ -6783,8 +7362,9 @@ namespace INT69DB_2A.Forms // 통신 OPEN this.OpenSmartUartLink(); - // Serial3 Open - this.SerialUart3Open(); + // Serial3 통신 Open + //this.SerialUart3Open(); + this.UartCom3Open(); // 변수 초기 셋팅 this.DefaultSetting2(); @@ -7107,6 +7687,59 @@ namespace INT69DB_2A.Forms this.timerUserList.Enabled = false; UserManager.UserManager_GetUserListName(); } + private void timerTimeOutTransmission_Tick(object sender, EventArgs e) + { + this.timerTimeOutTransmission.Enabled = false; + + #region COM3 + switch (this.SystemConfig.Serial3Mode) + { + case 1: + this.UartCom3Write(this.Protocol_OPT1_NotStxEtx(this.CollectionWeightData)); + break; + case 2: + this.UartCom3Write(this.Protocol_OPT2_NotStxEtx(this.CollectionWeightData)); + break; + case 3: + this.UartCom3Write(this.Protocol_OPT3_NotStxEtx(this.CollectionWeightData)); + break; + case 4: + this.UartCom3Write(this.Protocol_Printer(this.CollectionWeightData)); + break; + case 5: + this.UartCom3Write(this.Protocol_OPT4_NotStxEtx(this.CollectionWeightData)); + break; + default: + break; + } + #endregion + + #region Ethernet + switch (this.SystemConfig.EthernetMode) + { + case 1: + this.SendEthernetData(this.Protocol_OPT1_NotStxEtx(this.CollectionWeightData)); + break; + case 2: + this.SendEthernetData(this.Protocol_OPT2_NotStxEtx(this.CollectionWeightData)); + break; + case 3: + this.SendEthernetData(this.Protocol_OPT3_NotStxEtx(this.CollectionWeightData)); + break; + case 5: + this.SendEthernetData(this.Protocol_OPT4_NotStxEtx(this.CollectionWeightData)); + break; + default: + break; + } + #endregion + + // DataBackup + this.TrackingInspectionData(this.CollectionWeightData); + + foreach (WeightData data in this.CollectionWeightData) + data.IsUpdate = false; + } #region UserManagerEvent private void UserManager_UserListLogoutDataEvent(int status) @@ -7237,8 +7870,8 @@ namespace INT69DB_2A.Forms if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormUserEditor) this.ChildFormUserEditor.CallBackUserListModifyInfoDataEvent(user); - else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) - this.ChildFormMainDisplay.CallBackUserListModifyInfoDataEvent(user); + //else if (this.SystemConfig.CurrentForm == DataStore.FormStore.FormMainDisplay) + // this.ChildFormMainDisplay.CallBackUserListModifyInfoDataEvent(user); } catch { diff --git a/INT69DB_2A/Forms/FormMain.resx b/INT69DB_2A/Forms/FormMain.resx index 4edb31b..5221b95 100644 --- a/INT69DB_2A/Forms/FormMain.resx +++ b/INT69DB_2A/Forms/FormMain.resx @@ -118,37 +118,43 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 17, 17 + 12, 8 - 888, 17 + 883, 8 - 533, 17 + 528, 8 - 300, 17 + 295, 8 - 744, 17 + 739, 8 - 410, 17 + 405, 8 - 142, 17 + 137, 8 - 1003, 17 + 998, 8 - 1171, 17 + 301, 49 - 17, 56 + 12, 47 - 177, 56 + 172, 47 + + + 442, 49 + + + 643, 49 WEBPAD @@ -157,6 +163,6 @@ False - 85 + 108 \ No newline at end of file diff --git a/INT69DB_2A/Forms/FormMainDisplay.cs b/INT69DB_2A/Forms/FormMainDisplay.cs index 7d8d45d..c96ac13 100644 --- a/INT69DB_2A/Forms/FormMainDisplay.cs +++ b/INT69DB_2A/Forms/FormMainDisplay.cs @@ -22,6 +22,7 @@ namespace INT69DB_2A.Forms { #region Field UserManager.UserMgr_user_info_t UserInfo = new UserManager.UserMgr_user_info_t(); + public string ChangeID; private FormMain m_ParentForm; @@ -391,6 +392,7 @@ namespace INT69DB_2A.Forms private void DefaultSetting() { this.RescaleControl(); + this.ChangeID = ""; this.ColorButtonAccessTrue = Color.Black; this.ColorButtonAccessFalse = Color.DimGray; @@ -451,112 +453,115 @@ namespace INT69DB_2A.Forms } } - private void SuccessLogin(UserManager.UserMgr_user_info_t user) + private void PasswordExpirationCheck(UserItem user) { - if (user.active_level == 1) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1; - else if (user.active_level == 2) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2; - else if (user.active_level == 3) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3; - else if (user.active_level == 9) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin; - else if (user.active_level == 10) - this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; - this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = user.active_level; + int expiryDay = 0; - this.ParentForm.SystemConfig.CurrentUser.ID = user.user_id; - this.ParentForm.SystemConfig.CurrentUser.Password = user.user_pw; - - this.ParentForm.SystemConfig.CurrentUser.ExpireAccount = user.expire_period_account; - this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = user.expire_period_password; - - DateTime time = DateTime.ParseExact(user.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateRegister = time; - time = DateTime.ParseExact(user.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateLogin = time; - - if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin - || this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer) + // 만료일 -10 일때 메시지 띄우기 + expiryDay = user.GetPasswordExpiryDday(); + if (expiryDay >= -10) { - this.ParentForm.SystemConfig.CurrentUser.DateExpireRegister = DateTime.Now; - this.ParentForm.SystemConfig.CurrentUser.DateExpireLogin = DateTime.Now; + Console.WriteLine("password : " + expiryDay.ToString()); + DialogFormYesNo myDlg = new DialogFormYesNo(this.ParentForm.SystemConfig.Language, 2, expiryDay.ToString()); + if (myDlg.ShowDialog() == DialogResult.Yes) + { + // 비밀 번호 변경 띄우기 + DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, true, true); + if (logOn.ShowDialog() == DialogResult.OK) + { + + } + } } - else + } + private void DirectLogin(string id, string pass) + { + UserManager.UserMgr_user_info_t userInfo = new UserManager.UserMgr_user_info_t(); + + UserManager.UserManager_UserLoginDirect(id, pass, ref userInfo); + Console.WriteLine(string.Format("status : {0}", userInfo.status)); + Console.WriteLine("ID : " + id); + Console.WriteLine("pass : " + pass); + + if (userInfo.status == 0) { - time = DateTime.ParseExact(user.expire_id_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateExpireLogin = time; - time = DateTime.ParseExact(user.expire_password_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.ParentForm.SystemConfig.CurrentUser.DateExpireRegister = time; + #region 로그인 성공 + if (userInfo.active_level == 1) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1; + else if (userInfo.active_level == 2) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2; + else if (userInfo.active_level == 3) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3; + else if (userInfo.active_level == 9) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin; + else if (userInfo.active_level == 10) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; + + this.ParentForm.SystemConfig.CurrentUser.ID = userInfo.user_id; + this.ParentForm.SystemConfig.CurrentUser.Password = userInfo.user_pw; + + this.ParentForm.SystemConfig.CurrentUser.ExpireId = userInfo.id_expire_period; + this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = userInfo.password_expire_period; + + DateTime time = DateTime.ParseExact(userInfo.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordRegister = time; + time = DateTime.ParseExact(userInfo.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdLogin = time; + time = DateTime.ParseExact(userInfo.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire = time; + time = DateTime.ParseExact(userInfo.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdExpire = time; + + this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = userInfo.id_flock_status == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true; + + this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; + + this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level; + #endregion + + this.UI_Invoke(delegate + { + this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); + }); } - - this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = user.flock_status_account == 0 ? false : true; - this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = user.flock_status_password == 0 ? false : true; - - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.SystemConfig.CurrentUser.IsAdmin = user.fadmin == 0 ? false : true; - else - this.ParentForm.SystemConfig.CurrentUser.IsAdmin = true; } private void Login() { - // Part 11 - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Login, ""); + DialogResult result; - UserManager.UserMgr_user_info_t userInfo = new UserManager.UserMgr_user_info_t(); - DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm); - if (logOn.ShowDialog() == DialogResult.OK) + DialogFormLogOn logOn = new DialogFormLogOn(this.ParentForm, false, false); + result = logOn.ShowDialog(); + + if (result == DialogResult.OK) { - this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - //this.DisplayRefresh(); + if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level1 || + this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level2 || + this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3) + { + // 비밀번호 만료일 10일 미만 체크 후 비밀번호 변경 + this.PasswordExpirationCheck(this.ParentForm.SystemConfig.CurrentUser); + } + this.buttonUser.ButtonDown(); - //this.ParentForm.TimerAutomaticLogout(true, this.ParentForm.SystemConfig.AutomaticLogout); + this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); // Part 11 if (this.ParentForm.SystemConfig.IsPart11 == true) this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.Login, ""); + } + else if (result == DialogResult.Abort) + { - //try - //{ - // //userInfo = logOn.UserInfo; - // if (userInfo.status == 0) - // { - // this.SuccessLogin(userInfo); - // this.DisplayRefresh(); - // this.buttonUser.ButtonDown(); - // } - // else if (userInfo.status == 15) - // { - // DialogFormLogOn changePW = new DialogFormLogOn(this.ParentForm, userInfo.user_id); - // if (changePW.ShowDialog() == DialogResult.OK) - // { - // if (this.UserInfo.status == 0) - // { - // UserManager.UserManager_UserLoginDirect(this.ParentForm.SystemConfig.CurrentUser.ID, this.ParentForm.SystemConfig.CurrentUser.Password, ref this.UserInfo); - - // this.SuccessLogin(this.UserInfo); - // } - // else - // { - // DialogFormMessage myMsg = new DialogFormMessage(null, this.UserInfo.status, this.ParentForm.SystemConfig.Language); - // myMsg.ShowDialog(); - // } - // } - // } - // else - // { - // this.buttonUser.ButtonUp(); - - // DialogFormMessage myMsg = new DialogFormMessage(null, userInfo.status, this.ParentForm.SystemConfig.Language); - // myMsg.ShowDialog(); - // } - //} - //catch - //{ - // DialogFormMessage myMsg = new DialogFormMessage(null, 99, this.ParentForm.SystemConfig.Language); - // myMsg.ShowDialog(); - //} + // 비밀 번호 변경 띄우기 + DialogFormLogOn logOn1 = new DialogFormLogOn(this.ParentForm, false, true); + if (logOn1.ShowDialog() == DialogResult.OK) + { + this.buttonUser.ButtonDown(); + this.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); + } + else + this.buttonUser.ButtonUp(); } else { @@ -568,6 +573,7 @@ namespace INT69DB_2A.Forms this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.LogOut; this.buttonUser.ButtonUp(); this.DisplayRefresh(); + this.ChangeID = ""; // Part 11 if (this.ParentForm.SystemConfig.IsPart11 == true) @@ -586,7 +592,7 @@ namespace INT69DB_2A.Forms else { //TimeSpan resultTime = DateTime.Now - this.ParentForm.CurrentSystemStatus.CurrentUser.DateExpireRegister; - TimeSpan dayDiff = DateTime.Now.Date - this.ParentForm.SystemConfig.CurrentUser.DateExpireRegister.Date; + TimeSpan dayDiff = DateTime.Now.Date - this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire.Date; ret = dayDiff.Days.ToString(); } @@ -1090,7 +1096,79 @@ namespace INT69DB_2A.Forms if (this.labelUserID.Text != id) this.labelUserID.Text = id; } - + + public void Clear() + { + switch (this.ParentForm.SystemConfig.EquipmentColumns) + { + case 2: + if (this.MainDisplayEachBarGraph2 != null) + this.MainDisplayEachBarGraph2.Clear(); + if (this.MainDisplayDotGraph2 != null) + this.MainDisplayDotGraph2.Clear(); + if (this.MainDisplayTable2 != null) + this.MainDisplayTable2.Clear(); + break; + case 3: + if (this.MainDisplayEachBarGraph3 != null) + this.MainDisplayEachBarGraph3.Clear(); + if (this.MainDisplayDotGraph3 != null) + this.MainDisplayDotGraph3.Clear(); + if (this.MainDisplayTable3 != null) + this.MainDisplayTable3.Clear(); + break; + case 4: + if (this.MainDisplayEachBarGraph4 != null) + this.MainDisplayEachBarGraph4.Clear(); + if (this.MainDisplayDotGraph4 != null) + this.MainDisplayDotGraph4.Clear(); + if (this.MainDisplayTable4 != null) + this.MainDisplayTable4.Clear(); + break; + case 5: + if (this.MainDisplayEachBarGraph5 != null) + this.MainDisplayEachBarGraph5.Clear(); + if (this.MainDisplayDotGraph5 != null) + this.MainDisplayDotGraph5.Clear(); + if (this.MainDisplayTable5 != null) + this.MainDisplayTable5.Clear(); + break; + case 6: + if (this.MainDisplayEachBarGraph6 != null) + this.MainDisplayEachBarGraph6.Clear(); + if (this.MainDisplayDotGraph6 != null) + this.MainDisplayDotGraph6.Clear(); + if (this.MainDisplayTable6 != null) + this.MainDisplayTable6.Clear(); + break; + case 7: + if (this.MainDisplayEachBarGraph7 != null) + this.MainDisplayEachBarGraph7.Clear(); + if (this.MainDisplayDotGraph7 != null) + this.MainDisplayDotGraph7.Clear(); + if (this.MainDisplayTable7 != null) + this.MainDisplayTable7.Clear(); + break; + case 8: + if (this.MainDisplayEachBarGraph8 != null) + this.MainDisplayEachBarGraph8.Clear(); + if (this.MainDisplayDotGraph8 != null) + this.MainDisplayDotGraph8.Clear(); + if (this.MainDisplayTable8 != null) + this.MainDisplayTable8.Clear(); + break; + case 10: + if (this.MainDisplayEachBarGraph10 != null) + this.MainDisplayEachBarGraph10.Clear(); + if (this.MainDisplayDotGraph10 != null) + this.MainDisplayDotGraph10.Clear(); + if (this.MainDisplayTable10 != null) + this.MainDisplayTable10.Clear(); + break; + default: + break; + } + } public void RescaleControl() { switch (this.ParentForm.SystemConfig.EquipmentColumns) @@ -1164,78 +1242,6 @@ namespace INT69DB_2A.Forms this.ParentForm.TransferProductParameter(productNumber); } - public void Clear() - { - switch (this.ParentForm.SystemConfig.EquipmentColumns) - { - case 2: - if (this.MainDisplayEachBarGraph2 != null) - this.MainDisplayEachBarGraph2.Clear(); - if (this.MainDisplayDotGraph2 != null) - this.MainDisplayDotGraph2.Clear(); - if (this.MainDisplayTable2 != null) - this.MainDisplayTable2.Clear(); - break; - case 3: - if (this.MainDisplayEachBarGraph3 != null) - this.MainDisplayEachBarGraph3.Clear(); - if (this.MainDisplayDotGraph3 != null) - this.MainDisplayDotGraph3.Clear(); - if (this.MainDisplayTable3 != null) - this.MainDisplayTable3.Clear(); - break; - case 4: - if (this.MainDisplayEachBarGraph4 != null) - this.MainDisplayEachBarGraph4.Clear(); - if (this.MainDisplayDotGraph4 != null) - this.MainDisplayDotGraph4.Clear(); - if (this.MainDisplayTable4 != null) - this.MainDisplayTable4.Clear(); - break; - case 5: - if (this.MainDisplayEachBarGraph5 != null) - this.MainDisplayEachBarGraph5.Clear(); - if (this.MainDisplayDotGraph5 != null) - this.MainDisplayDotGraph5.Clear(); - if (this.MainDisplayTable5 != null) - this.MainDisplayTable5.Clear(); - break; - case 6: - if (this.MainDisplayEachBarGraph6 != null) - this.MainDisplayEachBarGraph6.Clear(); - if (this.MainDisplayDotGraph6 != null) - this.MainDisplayDotGraph6.Clear(); - if (this.MainDisplayTable6 != null) - this.MainDisplayTable6.Clear(); - break; - case 7: - if (this.MainDisplayEachBarGraph7 != null) - this.MainDisplayEachBarGraph7.Clear(); - if (this.MainDisplayDotGraph7 != null) - this.MainDisplayDotGraph7.Clear(); - if (this.MainDisplayTable7 != null) - this.MainDisplayTable7.Clear(); - break; - case 8: - if (this.MainDisplayEachBarGraph8 != null) - this.MainDisplayEachBarGraph8.Clear(); - if (this.MainDisplayDotGraph8 != null) - this.MainDisplayDotGraph8.Clear(); - if (this.MainDisplayTable8 != null) - this.MainDisplayTable8.Clear(); - break; - case 10: - if (this.MainDisplayEachBarGraph10 != null) - this.MainDisplayEachBarGraph10.Clear(); - if (this.MainDisplayDotGraph10 != null) - this.MainDisplayDotGraph10.Clear(); - if (this.MainDisplayTable10 != null) - this.MainDisplayTable10.Clear(); - break; - default: - break; - } - } public void IconEthernetVisible(bool enable) { this.pictureBoxEthernetConnection.Visible = enable; @@ -1376,6 +1382,56 @@ namespace INT69DB_2A.Forms }); } } + public void CallBackUserListModifyInfoDataEvent(UserManager.UserMgr_user_info_t userInfo) + { + Console.WriteLine("status : " + userInfo.status.ToString()); + Console.WriteLine("ID : " + userInfo.user_id); + Console.WriteLine("pass : " + userInfo.user_pw); + if (userInfo.status == 0) + { + Console.WriteLine("Group : " + this.ParentForm.SystemConfig.CurrentUser.Group.ToString()); + if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.LogOut) + { + Console.WriteLine("DirectLogin"); + this.DirectLogin(userInfo.user_id, userInfo.user_pw); + } + else + { + if (userInfo.active_level == 1) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level1; + else if (userInfo.active_level == 2) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level2; + else if (userInfo.active_level == 3) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Level3; + else if (userInfo.active_level == 9) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Admin; + else if (userInfo.active_level == 10) + this.ParentForm.SystemConfig.CurrentUser.Group = DataStore.UserGroup.Developer; + + this.ParentForm.SystemConfig.CurrentUser.ID = userInfo.user_id; + this.ParentForm.SystemConfig.CurrentUser.Password = userInfo.user_pw; + + this.ParentForm.SystemConfig.CurrentUser.ExpireId = userInfo.id_expire_period; + this.ParentForm.SystemConfig.CurrentUser.ExpirePassword = userInfo.password_expire_period; + + DateTime time = DateTime.ParseExact(userInfo.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordRegister = time; + time = DateTime.ParseExact(userInfo.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdLogin = time; + time = DateTime.ParseExact(userInfo.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DateIdExpire = time; + time = DateTime.ParseExact(userInfo.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.ParentForm.SystemConfig.CurrentUser.DatePasswordExpire = time; + + this.ParentForm.SystemConfig.CurrentUser.IsLockAccount = userInfo.id_flock_status == 0 ? false : true; + this.ParentForm.SystemConfig.CurrentUser.IsLockPassword = userInfo.password_flock_status == 0 ? false : true; + + this.ParentForm.SystemConfig.CurrentUser.IsAdmin = userInfo.fadmin == 0 ? false : true; + + this.ParentForm.SystemConfig.CurrentUser.ActiveLevel = userInfo.active_level; + } + } + } public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem, JudgmentSetItem jItem,Collection weightDatas) { @@ -3087,11 +3143,6 @@ namespace INT69DB_2A.Forms } } } - - public void CallBackUserListModifyInfoDataEvent(UserManager.UserMgr_user_info_t user) - { - this.UserInfo = user; - } #endregion } } \ No newline at end of file diff --git a/INT69DB_2A/Forms/FormUserEditor.Designer.cs b/INT69DB_2A/Forms/FormUserEditor.Designer.cs index 8950efd..bacba20 100644 --- a/INT69DB_2A/Forms/FormUserEditor.Designer.cs +++ b/INT69DB_2A/Forms/FormUserEditor.Designer.cs @@ -43,8 +43,8 @@ this.labelTitleDayPassword = new SmartX.SmartLabel(); this.labelTitleDayAccount = new SmartX.SmartLabel(); this.labelTitleMin = new SmartX.SmartLabel(); - this.labelStatusExpirePassword = new SmartX.SmartLabel(); - this.labelStatusExpireAccount = new SmartX.SmartLabel(); + this.labelStatusExpiryPassword = new SmartX.SmartLabel(); + this.labelStatusExpiryAccount = new SmartX.SmartLabel(); this.labelAutomaticLogoutTime = new SmartX.SmartLabel(); this.labelTitleAutomaticLogoutTime = new SmartX.SmartLabel(); this.labelExpiryDateOfPassword2 = new SmartX.SmartLabel(); @@ -172,8 +172,8 @@ this.smartGroupBox1.Controls.Add(this.labelTitleDayPassword); this.smartGroupBox1.Controls.Add(this.labelTitleDayAccount); this.smartGroupBox1.Controls.Add(this.labelTitleMin); - this.smartGroupBox1.Controls.Add(this.labelStatusExpirePassword); - this.smartGroupBox1.Controls.Add(this.labelStatusExpireAccount); + this.smartGroupBox1.Controls.Add(this.labelStatusExpiryPassword); + this.smartGroupBox1.Controls.Add(this.labelStatusExpiryAccount); this.smartGroupBox1.Controls.Add(this.labelAutomaticLogoutTime); this.smartGroupBox1.Controls.Add(this.labelTitleAutomaticLogoutTime); this.smartGroupBox1.Controls.Add(this.labelExpiryDateOfPassword2); @@ -381,47 +381,47 @@ this.labelTitleMin.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; this.labelTitleMin.Wordwrap = false; // - // labelStatusExpirePassword + // labelStatusExpiryPassword // - this.labelStatusExpirePassword.BackPictureBox = this.smartForm1; - this.labelStatusExpirePassword.BackPictureBox1 = null; - this.labelStatusExpirePassword.BackPictureBox2 = null; - this.labelStatusExpirePassword.BorderColor = System.Drawing.Color.Black; - this.labelStatusExpirePassword.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelStatusExpirePassword.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); - this.labelStatusExpirePassword.ForeColor = System.Drawing.Color.DarkRed; - this.labelStatusExpirePassword.InitVisible = true; - this.labelStatusExpirePassword.LineSpacing = 0F; - this.labelStatusExpirePassword.Location = new System.Drawing.Point(485, 332); - this.labelStatusExpirePassword.Name = "labelStatusExpirePassword"; - this.labelStatusExpirePassword.Size = new System.Drawing.Size(60, 26); - this.labelStatusExpirePassword.TabIndex = 230; - this.labelStatusExpirePassword.Text = "Expiry"; - this.labelStatusExpirePassword.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; - this.labelStatusExpirePassword.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; - this.labelStatusExpirePassword.Wordwrap = false; - this.labelStatusExpirePassword.Click += new System.EventHandler(this.labelStatusExpirePassword_Click); + this.labelStatusExpiryPassword.BackPictureBox = this.smartForm1; + this.labelStatusExpiryPassword.BackPictureBox1 = null; + this.labelStatusExpiryPassword.BackPictureBox2 = null; + this.labelStatusExpiryPassword.BorderColor = System.Drawing.Color.Black; + this.labelStatusExpiryPassword.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelStatusExpiryPassword.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); + this.labelStatusExpiryPassword.ForeColor = System.Drawing.Color.DarkRed; + this.labelStatusExpiryPassword.InitVisible = true; + this.labelStatusExpiryPassword.LineSpacing = 0F; + this.labelStatusExpiryPassword.Location = new System.Drawing.Point(485, 332); + this.labelStatusExpiryPassword.Name = "labelStatusExpiryPassword"; + this.labelStatusExpiryPassword.Size = new System.Drawing.Size(60, 26); + this.labelStatusExpiryPassword.TabIndex = 230; + this.labelStatusExpiryPassword.Text = "Expiry"; + this.labelStatusExpiryPassword.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.labelStatusExpiryPassword.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelStatusExpiryPassword.Wordwrap = false; + this.labelStatusExpiryPassword.Click += new System.EventHandler(this.labelStatusExpirePassword_Click); // - // labelStatusExpireAccount + // labelStatusExpiryAccount // - this.labelStatusExpireAccount.BackPictureBox = this.smartForm1; - this.labelStatusExpireAccount.BackPictureBox1 = null; - this.labelStatusExpireAccount.BackPictureBox2 = null; - this.labelStatusExpireAccount.BorderColor = System.Drawing.Color.Black; - this.labelStatusExpireAccount.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.labelStatusExpireAccount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); - this.labelStatusExpireAccount.ForeColor = System.Drawing.Color.DarkRed; - this.labelStatusExpireAccount.InitVisible = true; - this.labelStatusExpireAccount.LineSpacing = 0F; - this.labelStatusExpireAccount.Location = new System.Drawing.Point(485, 301); - this.labelStatusExpireAccount.Name = "labelStatusExpireAccount"; - this.labelStatusExpireAccount.Size = new System.Drawing.Size(60, 26); - this.labelStatusExpireAccount.TabIndex = 229; - this.labelStatusExpireAccount.Text = "만료"; - this.labelStatusExpireAccount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; - this.labelStatusExpireAccount.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; - this.labelStatusExpireAccount.Wordwrap = false; - this.labelStatusExpireAccount.Click += new System.EventHandler(this.labelStatusExpireAccount_Click); + this.labelStatusExpiryAccount.BackPictureBox = this.smartForm1; + this.labelStatusExpiryAccount.BackPictureBox1 = null; + this.labelStatusExpiryAccount.BackPictureBox2 = null; + this.labelStatusExpiryAccount.BorderColor = System.Drawing.Color.Black; + this.labelStatusExpiryAccount.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.labelStatusExpiryAccount.Font = new System.Drawing.Font("새굴림", 10F, System.Drawing.FontStyle.Bold); + this.labelStatusExpiryAccount.ForeColor = System.Drawing.Color.DarkRed; + this.labelStatusExpiryAccount.InitVisible = true; + this.labelStatusExpiryAccount.LineSpacing = 0F; + this.labelStatusExpiryAccount.Location = new System.Drawing.Point(485, 301); + this.labelStatusExpiryAccount.Name = "labelStatusExpiryAccount"; + this.labelStatusExpiryAccount.Size = new System.Drawing.Size(60, 26); + this.labelStatusExpiryAccount.TabIndex = 229; + this.labelStatusExpiryAccount.Text = "만료"; + this.labelStatusExpiryAccount.TextHAlign = SmartX.SmartLabel.TextHorAlign.Middle; + this.labelStatusExpiryAccount.TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle; + this.labelStatusExpiryAccount.Wordwrap = false; + this.labelStatusExpiryAccount.Click += new System.EventHandler(this.labelStatusExpireAccount_Click); // // labelAutomaticLogoutTime // @@ -1283,8 +1283,8 @@ private SmartX.SmartLabel labelTitleDayPassword; private SmartX.SmartLabel labelTitleDayAccount; private SmartX.SmartLabel labelTitleMin; - private SmartX.SmartLabel labelStatusExpirePassword; - private SmartX.SmartLabel labelStatusExpireAccount; + private SmartX.SmartLabel labelStatusExpiryPassword; + private SmartX.SmartLabel labelStatusExpiryAccount; private SmartX.SmartLabel labelAutomaticLogoutTime; private SmartX.SmartLabel labelTitleAutomaticLogoutTime; private SmartX.SmartLabel labelExpiryDateOfPassword2; diff --git a/INT69DB_2A/Forms/FormUserEditor.cs b/INT69DB_2A/Forms/FormUserEditor.cs index 22f3ff2..38ef241 100644 --- a/INT69DB_2A/Forms/FormUserEditor.cs +++ b/INT69DB_2A/Forms/FormUserEditor.cs @@ -55,40 +55,29 @@ namespace INT69DB_2A.Forms { ImageDll images = new ImageDll(); - switch (this.ParentForm.SystemConfig.Language) + if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Korean) { - case DataStore.LanguageID.Korean: - this.labelTitle.Text = "유저설정"; - this.labelStatusExpireAccount.Text = "만료"; - this.labelStatusExpirePassword.Text = "만료"; - break; - case DataStore.LanguageID.English: - this.labelTitle.Text = "User"; - this.labelStatusExpireAccount.Text = "Expiration"; - this.labelStatusExpirePassword.Text = "Expiration"; - break; - case DataStore.LanguageID.Chinese: - this.labelTitle.Text = "用户设置"; - this.labelStatusExpireAccount.Text = "过期"; - this.labelStatusExpirePassword.Text = "过期"; - break; - case DataStore.LanguageID.Czech: - this.labelTitle.Text = "Uživatelské nastavení"; - this.labelStatusExpireAccount.Text = "Vypršení"; - this.labelStatusExpirePassword.Text = "Vypršení"; - break; - case DataStore.LanguageID.Russian: - this.labelTitle.Text = "Пользователь"; - this.labelStatusExpireAccount.Text = "Истечение срока"; - this.labelStatusExpirePassword.Text = "Истечение срока"; - break; - case DataStore.LanguageID.German: - this.labelTitle.Text = "Benutzereinstellungen"; - this.labelStatusExpireAccount.Text = "Ablauf"; - this.labelStatusExpirePassword.Text = "Ablauf"; - break; - default: - break; + + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.English) + { + this.labelTitle.Text = "User settings"; + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Chinese) + { + this.labelTitle.Text = "用户设置"; + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.Czech) + { + this.labelTitle.Text = "uživatelské nastavení"; + } + else if (this.ParentForm.SystemConfig.Language == DataStore.LanguageID.German) + { + this.labelTitle.Text = "Benutzereinstellungen"; + } + else + { + } } private void DefaultSetting() @@ -97,17 +86,40 @@ namespace INT69DB_2A.Forms this.PasswordChar = false; this.BeforeID = ""; this.BeforePassword = ""; - this.DisplayOnlyPart11Item(this.ParentForm.SystemConfig.IsPart11); - this.UpdateAccessRightComboBox(); + this.UpdateAccessRightComboBoxDisplay(); this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.comboBoxAccessRight.SelectedIndex = 0; this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.ChildControlUserSet = new ControlUserSetting(this); this.Controls.Add(this.ChildControlUserSet); - this.ChildControlUserSet.Location = new Point(0, 69); + this.ChildControlUserSet.Location = new Point(0, 73); this.ChildControlUserSet.Visible = false; + + if (this.ParentForm.SystemConfig.IsPart11 == false) + { + // Expiry date(Account) + this.labelTitleExpiryDateOfAccount.Visible = false; + this.labelTitleDayAccount.Visible = false; + this.labelExpiryDateOfAccount.Visible = false; + this.labelExpiryDateOfAccount2.Visible = false; + this.labelStatusExpiryAccount.Visible = false; + // Expiry date(Password) + this.labelTitleExpiryDateOfPassword.Visible = false; + this.labelTitleDayPassword.Visible = false; + this.labelExpiryDateOfPassword.Visible = false; + this.labelExpiryDateOfPassword2.Visible = false; + this.labelStatusExpiryPassword.Visible = false; + // Auto logout time + this.labelTitleAutomaticLogoutTime.Visible = false; + this.labelAutomaticLogoutTime.Visible = false; + this.labelTitleMin.Visible = false; + this.labelAutoLogoutWarning.Visible = false; + + this.smartSeparatorLine1.Visible = false; + this.smartSeparatorLine2.Visible = false; + } } private void SetEnableID(bool value) @@ -128,30 +140,36 @@ namespace INT69DB_2A.Forms else this.labelPassword.BackColor = Color.Silver; } - private void SetEnableOnlyPart11Value(bool value) + private void SetEnableExpireAccount(bool value) { this.labelExpiryDateOfAccount.Enabled = value; + + if (value == true) + this.labelExpiryDateOfAccount.BackColor = Color.White; + else + this.labelExpiryDateOfAccount.BackColor = Color.Silver; + } + private void SetEnableExpirePassword(bool value) + { this.labelExpiryDateOfPassword.Enabled = value; if (value == true) - { - this.labelExpiryDateOfAccount.BackColor = Color.White; this.labelExpiryDateOfPassword.BackColor = Color.White; - } else - { - this.labelExpiryDateOfAccount.BackColor = Color.Silver; this.labelExpiryDateOfPassword.BackColor = Color.Silver; - } } private void SaveUserDll() { - string code = "", message1 = "", message2 = ""; - string detail = ""; + string code = "", message1 = "", message2 = "", detail = ""; + bool isNewReg = false; - #region listbox 미선택 시 신규 유저 등록, 선택 시 기존 유저 정보 수정 - if (this.IsNew == true) + if (this.listBoxUserList.SelectItemIndex == -1) + isNewReg = true; + else + isNewReg = false; + + if (isNewReg == true) { switch (this.ParentForm.SystemConfig.Language) { @@ -217,7 +235,6 @@ namespace INT69DB_2A.Forms break; } } - #endregion DialogFormYesNo dlg = new DialogFormYesNo(DataStore.MessageBoxIcon.Question, code, message1, message2); if (dlg.ShowDialog() == DialogResult.Yes) @@ -228,7 +245,7 @@ namespace INT69DB_2A.Forms #region ID, Password 검사 // Chck ID - if (this.IsNew == true) + if (isNewReg == true) { if (this.labelID.Text.Length < 6) { @@ -241,34 +258,18 @@ namespace INT69DB_2A.Forms } // Check Password - if (this.labelPassword.Text.Length < 6) + if (this.labelPassword.Text.Length < 5) { // PASSWORD : 6~20자 입력하세요 DialogFormMessage msg = new DialogFormMessage(null, 9, this.ParentForm.SystemConfig.Language); msg.ShowDialog(); return; } - - if (this.labelExpiryDateOfAccount.Text == "000") - { - DialogFormMessage msg = new DialogFormMessage(null, 16, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); - - return; - } - - if (this.labelExpiryDateOfPassword.Text == "00") - { - DialogFormMessage msg = new DialogFormMessage(null, 16, this.ParentForm.SystemConfig.Language); - msg.ShowDialog(); - - return; - } #endregion item.ID = this.labelID.Text; - item.SetPassword(this.labelPassword.Text); - item.ExpireAccount = int.Parse(this.labelExpiryDateOfAccount.Text); + item.Password = this.labelPassword.Text; + item.ExpireId = int.Parse(this.labelExpiryDateOfAccount.Text); item.ExpirePassword = int.Parse(this.labelExpiryDateOfPassword.Text); //item.IsAdmin = this.cbAdministrator.Checked; @@ -287,40 +288,16 @@ namespace INT69DB_2A.Forms for (int i = 0; i < UserManager.USER_MENU_ID_MAX; i++) menuId.fMenu[i] = false; - if (this.IsNew == true) + if (isNewReg == true) { #region 신규 등록 - if (this.ParentForm.SystemConfig.IsPart11 == true) - { - if (item.ActiveLevel == 1 || item.ActiveLevel == 2 || item.ActiveLevel == 3) - UserManager.UserManager_UserNew(item.ID, item.Password, 0, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); - else - UserManager.UserManager_UserNew(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); - } - else // Part11 미사용, Login 사용 시, 항상 관리자로 지정 - UserManager.UserManager_UserNew(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); - - // Part 11 - detail = string.Format("Add : {0}", item.ID); - this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.UserEditor, detail); + UserManager.UserManager_UserNew(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireId, item.ActiveLevel, menuId); #endregion } else { #region 유저 수정 - if (this.ParentForm.SystemConfig.IsPart11 == true) - { - if (item.ActiveLevel == 1 || item.ActiveLevel == 2 || item.ActiveLevel == 3) - UserManager.UserManager_UserModify(item.ID, item.Password, 0, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); - else - UserManager.UserManager_UserModify(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); - } - else // Part11 미사용, Login 사용 시, 항상 관리자로 지정 - UserManager.UserManager_UserModify(item.ID, item.Password, 1, item.ExpirePassword, item.ExpireAccount, item.ActiveLevel, menuId); - - // Part 11 - detail = string.Format("Modify : {0}", item.ID); - this.ParentForm.SetTrackingHistoryData(DataStore.TrackingOperation.UserEditor, detail); + UserManager.UserManager_UserModify(item.ID, item.Password, item.IsAdmin == false ? 0 : 1, item.ExpirePassword, item.ExpireId, item.ActiveLevel, menuId); #endregion } @@ -338,14 +315,24 @@ namespace INT69DB_2A.Forms } private void UserNew() { + this.listBoxUserList.SelectedIndexChanged -= new EventHandler(this.listBoxUserList_SelectedIndexChanged); + this.listBoxUserList.SelectItemIndex = -1; + this.listBoxUserList.SelectedIndexChanged += new EventHandler(this.listBoxUserList_SelectedIndexChanged); + this.UpdateInitializeUserDisplay(this.ParentForm.SystemConfig); + + this.buttonDelete.Visible = false; + this.buttonSave.Visible = false; + this.comboBoxAccessRight.Enabled = true; + this.SetEnableID(true); + this.SetEnablePassword(true); } private Color ReturnColor(bool bValue) { if (bValue == true) - return Color.Black; + return Color.DarkGreen; else - return Color.DarkGray; + return Color.Silver; } private void CheckBoxCheckedAsLevel(DataStore.UserGroup level) { @@ -436,13 +423,42 @@ namespace INT69DB_2A.Forms break; } } + private bool UI_Invoke(ThreadStart invoker) + { + try + { + if (this.InvokeRequired) + { + if (this.IsDisposed) + return true; + + this.Invoke(invoker); + } + else + { + invoker(); + } + + return true; + + } + catch (Exception e) + { + return false; + } + } + private void UpdateAccessRightComboBoxDisplay() + { + this.comboBoxAccessRight.Items.Clear(); + this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level1_Name); + this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level2_Name); + this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level3_Name); + } private void UpdateInitializeUserDisplay(SystemConfigurationItem system) { this.SelectedUserItem = new UserItem(); - this.IsNew = true; - this.labelID.Text = ""; this.labelPassword.Text = ""; this.labelExpiryDateOfAccount.Text = "180"; @@ -452,22 +468,22 @@ namespace INT69DB_2A.Forms this.comboBoxAccessRight.Visible = true; this.comboBoxAccessRight.BringToFront(); - this.UpdateAccessRightComboBox(); + this.UpdateAccessRightComboBoxDisplay(); this.comboBoxAccessRight.SelectedIndexChanged -= new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); this.comboBoxAccessRight.SelectedIndex = 0; this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); - this.UpdateDefaultSetAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1); - - this.SetEnableID(true); - this.SetEnablePassword(true); - this.SetEnableOnlyPart11Value(true); + this.UpdateAccessRightDisplay(this.comboBoxAccessRight.SelectedIndex + 1); this.buttonDelete.Visible = false; this.buttonSave.Visible = false; - this.labelStatusExpireAccount.Visible = false; - this.labelStatusExpirePassword.Visible = false; + this.labelStatusExpiryAccount.Visible = false; + this.labelStatusExpiryPassword.Visible = false; + this.SetEnablePassword(true); + this.SetEnableID(true); + this.SetEnableExpireAccount(true); + this.SetEnableExpirePassword(true); - this.labelAutomaticLogoutTime.Text = system.UserAutomaticLogout.ToString(); + this.labelAutomaticLogoutTime.Text = system.AutomaticLogout.ToString(); this.listBoxUserList.SelectedIndexChanged -= new EventHandler(this.listBoxUserList_SelectedIndexChanged); this.listBoxUserList.SelectItemIndex = -1; @@ -479,35 +495,10 @@ namespace INT69DB_2A.Forms this.SelectedUserItem.ID = item.user_id; this.SelectedUserItem.Password = item.user_pw; - this.SelectedUserItem.ExpireAccount = item.expire_period_account; - this.SelectedUserItem.ExpirePassword = item.expire_period_pw; + this.SelectedUserItem.ExpireId = item.id_expire_period; + this.SelectedUserItem.ExpirePassword = item.password_expire_period; - if (this.SelectedUserItem.Group == DataStore.UserGroup.Admin - || this.SelectedUserItem.Group == DataStore.UserGroup.Developer) - { - this.SelectedUserItem.DateRegister = DateTime.Now; - this.SelectedUserItem.DateLogin = DateTime.Now; - this.SelectedUserItem.DateExpireRegister = DateTime.Now; - this.SelectedUserItem.DateExpireLogin = DateTime.Now; - } - else - { - DateTime time = DateTime.ParseExact(item.register_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateRegister = time; - time = DateTime.ParseExact(item.login_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateLogin = time; - time = DateTime.ParseExact(item.expire_account_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateExpireRegister = time; - time = DateTime.ParseExact(item.expire_register_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateExpireLogin = time; - } - - this.SelectedUserItem.IsLockAccount = item.flock_status_account == 0 ? false : true; - this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; - - this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; this.SelectedUserItem.ActiveLevel = item.active_level; - if (this.SelectedUserItem.ActiveLevel == 1) this.SelectedUserItem.Group = DataStore.UserGroup.Level1; else if (this.SelectedUserItem.ActiveLevel == 2) @@ -520,6 +511,27 @@ namespace INT69DB_2A.Forms this.SelectedUserItem.Group = DataStore.UserGroup.Developer; else this.SelectedUserItem.Group = DataStore.UserGroup.None; + + Console.WriteLine(item.password_register_date.GetDateTime()); + Console.WriteLine(item.id_login_date.GetDateTime()); + Console.WriteLine(item.id_expire_date.GetDateTime()); + Console.WriteLine(item.password_expire_date.GetDateTime()); + + DateTime time = DateTime.ParseExact(item.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DatePasswordRegister = time; + time = DateTime.ParseExact(item.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DateIdLogin = time; + time = DateTime.ParseExact(item.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DateIdExpire = time; + time = DateTime.ParseExact(item.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DatePasswordExpire = time; + + this.SelectedUserItem.IsLockAccount = item.id_flock_status == 0 ? false : true; + this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; + + this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; + + this.SelectedUserItem.IsFirstPassword = item.fFirstPW; } private void UpdateCurrentUserItem(UserManager.UserMgr_user_info_t item) { @@ -527,36 +539,10 @@ namespace INT69DB_2A.Forms this.SelectedUserItem.ID = item.user_id; this.SelectedUserItem.Password = item.user_pw; - this.SelectedUserItem.ExpireAccount = item.expire_period_account; - this.SelectedUserItem.ExpirePassword = item.expire_period_password; + this.SelectedUserItem.ExpireId = item.id_expire_period; + this.SelectedUserItem.ExpirePassword = item.password_expire_period; - DateTime time = DateTime.ParseExact(item.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateRegister = time; - time = DateTime.ParseExact(item.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateLogin = time; - - if (this.SelectedUserItem.Group == DataStore.UserGroup.Admin - || this.SelectedUserItem.Group == DataStore.UserGroup.Developer) - { - this.SelectedUserItem.DateRegister = DateTime.Now; - this.SelectedUserItem.DateLogin = DateTime.Now; - this.SelectedUserItem.DateExpireRegister = DateTime.Now; - this.SelectedUserItem.DateExpireLogin = DateTime.Now; - } - else - { - time = DateTime.ParseExact(item.expire_id_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateExpireRegister = time; - time = DateTime.ParseExact(item.expire_password_date.GetDateTime(), "yyyyMMddHHmmss", null); - this.SelectedUserItem.DateExpireLogin = time; - } - - this.SelectedUserItem.IsLockAccount = item.flock_status_account == 0 ? false : true; - this.SelectedUserItem.IsLockPassword = item.flock_status_password == 0 ? false : true; - - this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; this.SelectedUserItem.ActiveLevel = item.active_level; - if (item.active_level == 1) this.SelectedUserItem.Group = DataStore.UserGroup.Level1; else if (item.active_level == 2) @@ -567,17 +553,38 @@ namespace INT69DB_2A.Forms this.SelectedUserItem.Group = DataStore.UserGroup.Admin; else if (item.active_level == 10) this.SelectedUserItem.Group = DataStore.UserGroup.Developer; + + Console.WriteLine(item.password_register_date.GetDateTime()); + Console.WriteLine(item.id_login_date.GetDateTime()); + Console.WriteLine(item.id_expire_date.GetDateTime()); + Console.WriteLine(item.password_expire_date.GetDateTime()); + + DateTime time = DateTime.ParseExact(item.password_register_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DatePasswordRegister = time; + time = DateTime.ParseExact(item.id_login_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DateIdLogin = time; + time = DateTime.ParseExact(item.id_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DateIdExpire = time; + time = DateTime.ParseExact(item.password_expire_date.GetDateTime(), "yyyyMMddHHmmss", null); + this.SelectedUserItem.DatePasswordExpire = time; + + this.SelectedUserItem.IsLockAccount = item.id_flock_status == 0 ? false : true; + this.SelectedUserItem.IsLockPassword = item.password_flock_status == 0 ? false : true; + + this.SelectedUserItem.IsAdmin = item.fadmin == 0 ? false : true; + + this.SelectedUserItem.IsFirstPassword = item.fFirstPW; } private void UpdateSelectUserDisplay(UserItem item) { this.SetEnableID(false); - this.SetEnablePassword(true); - this.buttonSave.Visible = false; this.labelID.Text = item.ID; this.labelPassword.Text = item.Password; + this.UpdateAccessRightDisplay(item.ActiveLevel); + this.buttonSave.Visible = false; - if (this.listBoxUserList.SelectItemIndex == 0) + if (item.Group == DataStore.UserGroup.Admin) { this.labelExpiryDateOfAccount.Text = "0"; this.labelExpiryDateOfPassword.Text = "0"; @@ -586,7 +593,10 @@ namespace INT69DB_2A.Forms this.buttonDelete.Visible = false; this.comboBoxAccessRight.Visible = false; - this.SetEnableOnlyPart11Value(false); + this.labelStatusExpiryAccount.Visible = false; + this.labelStatusExpiryPassword.Visible = false; + this.SetEnableExpireAccount(false); + this.SetEnableExpirePassword(false); if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin || this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer) @@ -596,13 +606,21 @@ namespace INT69DB_2A.Forms } else { - this.labelExpiryDateOfAccount.Text = item.ExpireAccount.ToString(); + this.labelExpiryDateOfAccount.Text = item.ExpireId.ToString(); this.labelExpiryDateOfPassword.Text = item.ExpirePassword.ToString(); - this.labelExpiryDateOfAccount2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateLogin, item.DateExpireLogin); - this.labelExpiryDateOfPassword2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateRegister, item.DateExpireRegister); - this.labelStatusExpireAccount.Visible = item.IsLockAccount; - this.labelStatusExpirePassword.Visible = item.IsLockPassword; + if (item.ExpireId != 0) + this.labelExpiryDateOfAccount2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DateIdLogin, item.DateIdExpire); + else + this.labelExpiryDateOfAccount2.Text = "-"; + + if (item.ExpirePassword != 0) + this.labelExpiryDateOfPassword2.Text = string.Format("{0:yyyy/MM/dd} ~ {1:yyyy/MM/dd}", item.DatePasswordRegister, item.DatePasswordExpire); + else + this.labelExpiryDateOfPassword2.Text = "-"; + + this.labelStatusExpiryAccount.Visible = item.IsLockAccount; + this.labelStatusExpiryPassword.Visible = item.IsLockPassword; this.comboBoxAccessRight.Visible = true; this.comboBoxAccessRight.BringToFront(); @@ -610,25 +628,28 @@ namespace INT69DB_2A.Forms this.comboBoxAccessRight.SelectedIndex = item.ActiveLevel - 1; this.comboBoxAccessRight.SelectedIndexChanged += new EventHandler(this.comboBoxAccessRight_SelectedIndexChanged); + this.SetEnableExpireAccount(true); + this.SetEnableExpirePassword(true); + if (this.ParentForm.SystemConfig.CurrentUser.ActiveLevel < item.ActiveLevel) { - this.SetEnablePassword(false); this.buttonDelete.Visible = false; - - this.SetEnableOnlyPart11Value(false); + this.SetEnablePassword(false); + this.comboBoxAccessRight.Enabled = false; + } + else if (this.ParentForm.SystemConfig.CurrentUser.ActiveLevel == item.ActiveLevel) + { + this.buttonDelete.Visible = false; + this.SetEnablePassword(true); this.comboBoxAccessRight.Enabled = false; } else { - this.SetEnableOnlyPart11Value(true); + this.buttonDelete.Visible = true; + this.SetEnablePassword(true); this.comboBoxAccessRight.Enabled = true; } } - - //this.CheckBoxCheckedAsLevel(item.Group); - - //this.cbAdministrator.Visible = true; - //this.cbAdministrator.Checked = item.IsAdmin; } private void UpdateUserListBoxDisplay(List items) { @@ -636,8 +657,26 @@ namespace INT69DB_2A.Forms for (int i = 1; i < items.Count; i++) this.listBoxUserList.AddItem(items[i]); } - private void UpdateDefaultSetAccessRightDisplay(UserGroupItem item) + private void UpdateAccessRightDisplay(int level) { + UserGroupItem item; + switch (level) + { + case 1: + item = this.ParentForm.CurrentUserGroup.Level1; + break; + case 2: + item = this.ParentForm.CurrentUserGroup.Level2; + break; + case 3: + case 9: + item = this.ParentForm.CurrentUserGroup.Level3; + break; + default: + item = this.ParentForm.CurrentUserGroup.Level1; + break; + } + this.labelProductNo.ForeColor = this.ReturnColor(item.IsMainDisplayProductNo); this.labelWeightSetting.ForeColor = this.ReturnColor(item.IsMainDisplayWeightSetting); this.labelClear.ForeColor = this.ReturnColor(item.IsMainDisplayClear); @@ -717,11 +756,9 @@ namespace INT69DB_2A.Forms this.UpdateUserListBoxDisplay(this.ParentForm.ListDllUserName); this.listBoxUserList.SelectItemIndex = this.listBoxUserList.ItemCount - 1; + this.buttonDelete.Visible = true; this.buttonSave.Visible = false; - - this.buttonDelete.Enabled = true; - this.labelID.Enabled = false; - this.labelID.BackColor = Color.LightGray; + this.SetEnableID(false); DialogFormMessage dlg = new DialogFormMessage(DataStore.MessageBoxIcon.Asterisk, code, message1, message2, 0); dlg.ShowDialog(); @@ -877,105 +914,23 @@ namespace INT69DB_2A.Forms //} } - private bool UI_Invoke(ThreadStart invoker) - { - try - { - if (this.InvokeRequired) - { - if (this.IsDisposed) - return true; - - this.Invoke(invoker); - } - else - { - invoker(); - } - - return true; - - } - catch (Exception e) - { - return false; - } - } - - public void DisplayOnlyPart11Item(bool bValue) - { - if (bValue == true) - { - this.labelTitleExpiryDateOfAccount.Visible = true; - this.labelExpiryDateOfAccount.Visible = true; - this.labelExpiryDateOfAccount2.Visible = true; - this.labelTitleDayAccount.Visible = true; - - this.labelTitleExpiryDateOfPassword.Visible = true; - this.labelExpiryDateOfPassword.Visible = true; - this.labelExpiryDateOfPassword2.Visible = true; - this.labelTitleDayPassword.Visible = true; - - this.labelTitleAutomaticLogoutTime.Visible = true; - this.labelAutomaticLogoutTime.Visible = true; - this.labelTitleMin.Visible = true; - this.labelAutoLogoutWarning.Visible = true; - - this.smartSeparatorLine1.Visible = true; - this.smartSeparatorLine2.Visible = true; - } - else - { - this.labelTitleExpiryDateOfAccount.Visible = false; - this.labelExpiryDateOfAccount.Visible = false; - this.labelExpiryDateOfAccount2.Visible = false; - this.labelTitleDayAccount.Visible = false; - - this.labelTitleExpiryDateOfPassword.Visible = false; - this.labelExpiryDateOfPassword.Visible = false; - this.labelExpiryDateOfPassword2.Visible = false; - this.labelTitleDayPassword.Visible = false; - - this.labelTitleAutomaticLogoutTime.Visible = false; - this.labelAutomaticLogoutTime.Visible = false; - this.labelTitleMin.Visible = false; - this.labelAutoLogoutWarning.Visible = false; - - this.smartSeparatorLine1.Visible = false; - this.smartSeparatorLine2.Visible = false; - } - } - public void UpdateAccessRightComboBox() - { - this.comboBoxAccessRight.Items.Clear(); - this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level1_Name); - this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level2_Name); - this.comboBoxAccessRight.Items.Add(this.ParentForm.SystemConfig.User_Level3_Name); - } - public void DisplayRefresh() { this.ParentForm.SystemConfig.CurrentForm = DataStore.FormStore.FormUserEditor; - if (this.ParentForm.SystemConfig.CurrentUser.IsAdmin == true || this.ParentForm.SystemConfig.CurrentUser.ActiveLevel == 3) + if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Level3 + || this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Admin + || this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer) { this.buttonGroupEditor.Visible = true; this.ChildControlUserSet.Visible = false; - this.buttonNew.Visible = true; - this.listBoxUserList.Enabled = true; this.UpdateInitializeUserDisplay(this.ParentForm.SystemConfig); this.UpdateUserListBoxDisplay(this.ParentForm.ListDllUserName); - this.listBoxUserList.SelectedIndexChanged -= new EventHandler(this.listBoxUserList_SelectedIndexChanged); - this.listBoxUserList.SelectItemIndex = -1; - this.listBoxUserList.SelectedIndexChanged += new EventHandler(this.listBoxUserList_SelectedIndexChanged); } else { this.buttonGroupEditor.Visible = false; - this.buttonNew.Visible = false; - this.buttonDelete.Visible = false; - this.ChildControlUserSet.Visible = true; this.ChildControlUserSet.BringToFront(); this.ChildControlUserSet.DisplayRefresh(); @@ -988,14 +943,6 @@ namespace INT69DB_2A.Forms { this.ParentForm.ChildFormMenu.DisplayRefresh(); ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormMenu); - } - private void buttonExpireAccount_Click(object sender, EventArgs e) - { - - } - private void buttonExpirePassword_Click(object sender, EventArgs e) - { - } private void buttonNew_Click(object sender, EventArgs e) { @@ -1028,14 +975,12 @@ namespace INT69DB_2A.Forms { this.ParentForm.ChildFormUserGroupEditor.DisplayRefresh(); ((FormMain)(Owner)).smartForm.Show((int)DataStore.FormStore.FormUserGroupEditor); - - //this.DisplayRefresh(); } private void labelID_Click(object sender, EventArgs e) { string value = ""; - DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelID.Text, this.labelTitleID.Text); + DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelID.Text); if (keyboard.ShowDialog() == DialogResult.OK) { @@ -1050,7 +995,7 @@ namespace INT69DB_2A.Forms private void labelPassword_Click(object sender, EventArgs e) { string value = ""; - DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelPassword.Text, this.labelTitlePassword.Text); + DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelPassword.Text); if (keyboard.ShowDialog() == DialogResult.OK) { @@ -1061,9 +1006,6 @@ namespace INT69DB_2A.Forms if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; } - - if (this.IsNew == true) - this.SetEnableID(true); } private void labelExpireAccount_Click(object sender, EventArgs e) { @@ -1071,24 +1013,17 @@ namespace INT69DB_2A.Forms if (myKeyPad.ShowDialog() == DialogResult.OK) { - if (myKeyPad.IntValue <= 0) + if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 180) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } - else if (myKeyPad.IntValue > 180) - { - this.labelExpiryDateOfAccount.Text = "180"; - - if (this.buttonSave.Visible == false) - this.buttonSave.Visible = true; - } else { this.labelExpiryDateOfAccount.Text = myKeyPad.StringValue; - if (this.buttonSave.Visible == false) + if (this.buttonSave.Visible != true) this.buttonSave.Visible = true; } } @@ -1099,59 +1034,55 @@ namespace INT69DB_2A.Forms if (myKeyPad.ShowDialog() == DialogResult.OK) { - if (myKeyPad.IntValue <= 0) + if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 90) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } - else if (myKeyPad.IntValue > 90) - { - this.labelExpiryDateOfPassword.Text = "90"; - - if (this.buttonSave.Visible == false) - this.buttonSave.Visible = true; - } else { this.labelExpiryDateOfPassword.Text = myKeyPad.StringValue; - if (this.buttonSave.Visible == false) + if (this.buttonSave.Visible != true) this.buttonSave.Visible = true; } } } private void labelAutomaticLogout_Click(object sender, EventArgs e) { + string before = "", after = ""; + + before = this.labelAutomaticLogoutTime.Text; + DialogFormNumKeyPad myKeyPad = new DialogFormNumKeyPad(this.labelAutomaticLogoutTime.Text, 2, 0, false, this.ParentForm.SystemConfig.Language); if (myKeyPad.ShowDialog() == DialogResult.OK) { - if (myKeyPad.IntValue < 0) + if (myKeyPad.doubleValue < 0 || myKeyPad.doubleValue > 90) { // 입력범위를 확인하세요 DialogFormMessage myMsg = new DialogFormMessage(1, this.ParentForm.SystemConfig.Language); myMsg.ShowDialog(); } - else if (myKeyPad.IntValue > 90) - { - this.labelAutomaticLogoutTime.Text = "90"; - } else { this.labelAutomaticLogoutTime.Text = myKeyPad.StringValue; + this.ParentForm.SystemConfig.AutomaticLogout = myKeyPad.IntValue; + this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); + after = this.labelAutomaticLogoutTime.Text; + + if (this.ParentForm.SystemConfig.AutomaticLogout == 1) + this.ParentForm.FlagAutomaticLogoutWarningTime = 30; + else + this.ParentForm.FlagAutomaticLogoutWarningTime = 60; + + UserManager.UserManager_AutoLogoutSetTimeout(this.ParentForm.SystemConfig.AutomaticLogout, this.ParentForm.FlagAutomaticLogoutWarningTime); + + // Part11 + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.AutoLogout, "", before, after); } - - this.ParentForm.SystemConfig.UserAutomaticLogout = myKeyPad.IntValue; - - if (this.ParentForm.SystemConfig.UserAutomaticLogout == 1) - this.ParentForm.FlagAutomaticLogoutWarningTime = 30; - else - this.ParentForm.FlagAutomaticLogoutWarningTime = 60; - - this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); - - UserManager.UserManager_AutoLogoutSetTimeout(this.ParentForm.SystemConfig.UserAutomaticLogout, this.ParentForm.FlagAutomaticLogoutWarningTime); } } private void labelStatusExpireAccount_Click(object sender, EventArgs e) @@ -1235,21 +1166,22 @@ namespace INT69DB_2A.Forms private void comboBoxAccessRight_SelectedIndexChanged(object sender, EventArgs e) { - switch (this.comboBoxAccessRight.SelectedIndex) - { - case 0: - this.UpdateDefaultSetAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1); - break; - case 1: - this.UpdateDefaultSetAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level2); - break; - case 2: - this.UpdateDefaultSetAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level3); - break; - default: - this.UpdateDefaultSetAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1); - break; - } + //switch (this.comboBoxAccessRight.SelectedIndex) + //{ + // case 0: + // this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1); + // break; + // case 1: + // this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level2); + // break; + // case 2: + // this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level3); + // break; + // default: + // this.UpdateAccessRightDisplay(this.ParentForm.CurrentUserGroup.Level1); + // break; + //} + this.UpdateAccessRightDisplay(this.comboBoxAccessRight.SelectedIndex + 1); if (this.buttonSave.Visible == false) this.buttonSave.Visible = true; @@ -1258,27 +1190,14 @@ namespace INT69DB_2A.Forms private void listBoxUserList_SelectedIndexChanged(object sender, EventArgs e) { int index = this.listBoxUserList.SelectItemIndex; - this.IsNew = false; - this.SetEnablePassword(true); - - if (index == 0) - { - UserManager.UserManager_GetUserListID(this.listBoxUserList.Items[index]); - } - else if (index < 0) - { - this.UpdateInitializeUserDisplay(this.ParentForm.SystemConfig); - } - else if (index > 0) + if (index != -1) { if (this.ParentForm.SystemConfig.CurrentUser.ID == this.listBoxUserList.Items[index]) this.buttonDelete.Visible = false; else this.buttonDelete.Visible = true; - this.SetEnableID(false); - UserManager.UserManager_GetUserListID(this.listBoxUserList.Items[index]); } } diff --git a/INT69DB_2A/Forms/FormUserGroupEditor.cs b/INT69DB_2A/Forms/FormUserGroupEditor.cs index 06267e8..f77263c 100644 --- a/INT69DB_2A/Forms/FormUserGroupEditor.cs +++ b/INT69DB_2A/Forms/FormUserGroupEditor.cs @@ -19,10 +19,14 @@ namespace INT69DB_2A.Forms #region Field private FormMain m_ParentForm; + private Collection CollectionLevel1Location; + private Collection CollectionLevel2Location; + private Collection CollectionLevel3Location; + private Collection CollectionLevel1Control; private Collection CollectionLevel2Control; private Collection CollectionLevel3Control; - private Collection CollectionNotLoginControl; + private Collection CollectionLevel4Control; private string BeforeTextBox1; private string BeforeTextBox2; @@ -66,25 +70,91 @@ namespace INT69DB_2A.Forms this.BeforeTextBox2 = ""; this.BeforeTextBox3 = ""; + this.CollectionLevel1Location = new Collection(); + this.CollectionLevel1Location.Add(this.labelTitle1.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MainProductNo.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MainWeightSet.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MainClear.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MainSubMenu.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuTime.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuInformation.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuDataBackup.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuCommunication.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuConfiguration.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuCalibration.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuSystem.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuMotor.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuIOTest.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuUpdate.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuInitialization.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuUser.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuEquipment.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuStatistics.Location); + this.CollectionLevel1Location.Add(this.checkBoxL1MenuViewer.Location); + + this.CollectionLevel2Location = new Collection(); + this.CollectionLevel2Location.Add(this.labelTitle2.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MainProductNo.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MainWeightSet.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MainClear.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MainSubMenu.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuTime.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuInformation.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuDataBackup.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuCommunication.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuConfiguration.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuCalibration.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuSystem.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuMotor.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuIOTest.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuUpdate.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuInitialization.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuUser.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuEquipment.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuStatistics.Location); + this.CollectionLevel2Location.Add(this.checkBoxL2MenuViewer.Location); + + this.CollectionLevel3Location = new Collection(); + this.CollectionLevel3Location.Add(this.labelTitle3.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MainProductNo.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MainWeightSet.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MainClear.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MainSubMenu.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuTime.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuInformation.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuDataBackup.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuConfiguration.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuCommunication.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuCalibration.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuSystem.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuMotor.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuIOTest.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuUpdate.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuInitialization.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuUser.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuEquipment.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuStatistics.Location); + this.CollectionLevel3Location.Add(this.checkBoxL3MenuViewer.Location); + this.CollectionLevel1Control = new Collection(); this.CollectionLevel1Control.Add(this.labelTitle1); this.CollectionLevel1Control.Add(this.checkBoxL1MainProductNo); this.CollectionLevel1Control.Add(this.checkBoxL1MainWeightSet); this.CollectionLevel1Control.Add(this.checkBoxL1MainClear); this.CollectionLevel1Control.Add(this.checkBoxL1MainSubMenu); + this.CollectionLevel1Control.Add(this.checkBoxL1MenuTime); this.CollectionLevel1Control.Add(this.checkBoxL1MenuInformation); + this.CollectionLevel1Control.Add(this.checkBoxL1MenuDataBackup); this.CollectionLevel1Control.Add(this.checkBoxL1MenuConfiguration); this.CollectionLevel1Control.Add(this.checkBoxL1MenuCommunication); this.CollectionLevel1Control.Add(this.checkBoxL1MenuCalibration); this.CollectionLevel1Control.Add(this.checkBoxL1MenuSystem); this.CollectionLevel1Control.Add(this.checkBoxL1MenuMotor); this.CollectionLevel1Control.Add(this.checkBoxL1MenuIOTest); - this.CollectionLevel1Control.Add(this.checkBoxL1MenuEquipment); this.CollectionLevel1Control.Add(this.checkBoxL1MenuUpdate); this.CollectionLevel1Control.Add(this.checkBoxL1MenuInitialization); - this.CollectionLevel1Control.Add(this.checkBoxL1MenuTime); this.CollectionLevel1Control.Add(this.checkBoxL1MenuUser); - this.CollectionLevel1Control.Add(this.checkBoxL1MenuDataBackup); + this.CollectionLevel1Control.Add(this.checkBoxL1MenuEquipment); this.CollectionLevel1Control.Add(this.checkBoxL1MenuStatistics); this.CollectionLevel1Control.Add(this.checkBoxL1MenuViewer); @@ -94,19 +164,19 @@ namespace INT69DB_2A.Forms this.CollectionLevel2Control.Add(this.checkBoxL2MainWeightSet); this.CollectionLevel2Control.Add(this.checkBoxL2MainClear); this.CollectionLevel2Control.Add(this.checkBoxL2MainSubMenu); + this.CollectionLevel2Control.Add(this.checkBoxL2MenuTime); this.CollectionLevel2Control.Add(this.checkBoxL2MenuInformation); + this.CollectionLevel2Control.Add(this.checkBoxL2MenuDataBackup); this.CollectionLevel2Control.Add(this.checkBoxL2MenuConfiguration); this.CollectionLevel2Control.Add(this.checkBoxL2MenuCommunication); this.CollectionLevel2Control.Add(this.checkBoxL2MenuCalibration); this.CollectionLevel2Control.Add(this.checkBoxL2MenuSystem); this.CollectionLevel2Control.Add(this.checkBoxL2MenuMotor); this.CollectionLevel2Control.Add(this.checkBoxL2MenuIOTest); - this.CollectionLevel2Control.Add(this.checkBoxL2MenuEquipment); this.CollectionLevel2Control.Add(this.checkBoxL2MenuUpdate); this.CollectionLevel2Control.Add(this.checkBoxL2MenuInitialization); - this.CollectionLevel2Control.Add(this.checkBoxL2MenuTime); this.CollectionLevel2Control.Add(this.checkBoxL2MenuUser); - this.CollectionLevel2Control.Add(this.checkBoxL2MenuDataBackup); + this.CollectionLevel2Control.Add(this.checkBoxL2MenuEquipment); this.CollectionLevel2Control.Add(this.checkBoxL2MenuStatistics); this.CollectionLevel2Control.Add(this.checkBoxL2MenuViewer); @@ -116,46 +186,45 @@ namespace INT69DB_2A.Forms this.CollectionLevel3Control.Add(this.checkBoxL3MainWeightSet); this.CollectionLevel3Control.Add(this.checkBoxL3MainClear); this.CollectionLevel3Control.Add(this.checkBoxL3MainSubMenu); + this.CollectionLevel3Control.Add(this.checkBoxL3MenuTime); this.CollectionLevel3Control.Add(this.checkBoxL3MenuInformation); + this.CollectionLevel3Control.Add(this.checkBoxL3MenuDataBackup); this.CollectionLevel3Control.Add(this.checkBoxL3MenuConfiguration); this.CollectionLevel3Control.Add(this.checkBoxL3MenuCommunication); this.CollectionLevel3Control.Add(this.checkBoxL3MenuCalibration); this.CollectionLevel3Control.Add(this.checkBoxL3MenuSystem); this.CollectionLevel3Control.Add(this.checkBoxL3MenuMotor); this.CollectionLevel3Control.Add(this.checkBoxL3MenuIOTest); - this.CollectionLevel3Control.Add(this.checkBoxL3MenuEquipment); this.CollectionLevel3Control.Add(this.checkBoxL3MenuUpdate); this.CollectionLevel3Control.Add(this.checkBoxL3MenuInitialization); - this.CollectionLevel3Control.Add(this.checkBoxL3MenuTime); this.CollectionLevel3Control.Add(this.checkBoxL3MenuUser); - this.CollectionLevel3Control.Add(this.checkBoxL3MenuDataBackup); + this.CollectionLevel3Control.Add(this.checkBoxL3MenuEquipment); this.CollectionLevel3Control.Add(this.checkBoxL3MenuStatistics); this.CollectionLevel3Control.Add(this.checkBoxL3MenuViewer); - this.CollectionNotLoginControl = new Collection(); - this.CollectionNotLoginControl.Add(this.labelTitleNotLogin1); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMainProductNo); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMainWeightSet); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMainClear); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMainSubMenu); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuInformation); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuConfiguration); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuCommunication); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuCalibration); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuSystem); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuMotor); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuIOTest); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuEquipment); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuUpdate); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuInitialization); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuTime); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuUser); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuDataBackup); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuStatistics); - this.CollectionNotLoginControl.Add(this.checkBoxNotLoginMenuViewer); + this.CollectionLevel4Control = new Collection(); + this.CollectionLevel4Control.Add(this.labelTitleNotLogin1); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainProductNo); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainWeightSet); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainClear); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMainSubMenu); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuTime); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuInformation); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuDataBackup); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuConfiguration); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuCommunication); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuCalibration); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuSystem); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuMotor); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuIOTest); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuUpdate); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuInitialization); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuUser); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuEquipment); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuStatistics); + this.CollectionLevel4Control.Add(this.checkBoxNotLoginMenuViewer); this.UpdateDisplay(this.ParentForm.CurrentUserGroup, this.ParentForm.SystemConfig); - this.UpdatePart11Visible(); } private void UpdateDisplay(UserGroup group, SystemConfigurationItem system) @@ -288,16 +357,10 @@ namespace INT69DB_2A.Forms } } - public void UpdateLevelNameDisplay(SystemConfigurationItem system) - { - this.labelLevel1Name.Text = system.User_Level1_Name; - this.labelLevel2Name.Text = system.User_Level2_Name; - this.labelLevel3Name.Text = system.User_Level3_Name; - } - public void DisplayRefresh() { this.UpdateDisplay(this.ParentForm.CurrentUserGroup, this.ParentForm.SystemConfig); + this.UpdatePart11Visible(); this.buttonSave.Visible = false; if (this.ParentForm.SystemConfig.CurrentUser.Group != DataStore.UserGroup.Developer) @@ -306,7 +369,14 @@ namespace INT69DB_2A.Forms this.labelTitleNotLogin2.Visible = false; for (int i = 0; i < this.CollectionLevel1Control.Count; i++) - this.CollectionNotLoginControl[i].Visible = false; + { + + //this.CollectionLevel1Control[i].Location = new Point(this.CollectionLevel2Location[i].X, this.CollectionLevel2Location[i].Y); + //this.CollectionLevel2Control[i].Location = new Point(this.CollectionLevel3Location[i].X, this.CollectionLevel3Location[i].Y); + + //this.CollectionLevel3Control[i].Visible = false; + this.CollectionLevel4Control[i].Visible = false; + } } else { @@ -314,7 +384,13 @@ namespace INT69DB_2A.Forms this.labelTitleNotLogin2.Visible = true; for (int i = 0; i < this.CollectionLevel1Control.Count; i++) - this.CollectionNotLoginControl[i].Visible = true; + { + //this.CollectionLevel1Control[i].Location = new Point(this.CollectionLevel1Location[i].X, this.CollectionLevel1Location[i].Y); + //this.CollectionLevel2Control[i].Location = new Point(this.CollectionLevel2Location[i].X, this.CollectionLevel2Location[i].Y); + + //this.CollectionLevel3Control[i].Visible = true; + this.CollectionLevel4Control[i].Visible = true; + } } } #endregion @@ -414,7 +490,7 @@ namespace INT69DB_2A.Forms this.ParentForm.CurrentUserGroup.NotLogin.IsMenuSystem = this.checkBoxNotLoginMenuSystem.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuMotor = this.checkBoxNotLoginMenuMotor.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuIOTest = this.checkBoxNotLoginMenuIOTest.Checked; - this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment = false; + this.ParentForm.CurrentUserGroup.NotLogin.IsMenuEquipment = this.checkBoxNotLoginMenuEquipment.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuUpdate = this.checkBoxNotLoginMenuUpdate.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuInitialization = this.checkBoxNotLoginMenuInitialization.Checked; this.ParentForm.CurrentUserGroup.NotLogin.IsMenuTime = this.checkBoxNotLoginMenuTime.Checked; @@ -433,82 +509,6 @@ namespace INT69DB_2A.Forms this.buttonSave.Visible = false; } - private void labelLevel1Name_Click(object sender, EventArgs e) - { - string before = "", after = ""; - - before = this.labelLevel1Name.Text; - - DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelLevel1Name.Text, "Level 1"); - - if (keyboard.ShowDialog() == DialogResult.OK) - { - this.labelLevel1Name.Text = keyboard.RetStringValue; - after = this.labelLevel1Name.Text; - - this.ParentForm.SystemConfig.User_Level1_Name = this.labelLevel1Name.Text; - this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); - - this.ParentForm.ChildFormUserEditor.UpdateAccessRightComboBox(); - this.ParentForm.ChildFormMainDisplay.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - this.ParentForm.ChildFormMenu.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - - // Part11 - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Level1Name, "", before, after); - } - } - private void labelLevel2Name_Click(object sender, EventArgs e) - { - string before = "", after = ""; - - before = this.labelLevel2Name.Text; - - DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelLevel2Name.Text, "Level 2"); - - if (keyboard.ShowDialog() == DialogResult.OK) - { - this.labelLevel2Name.Text = keyboard.RetStringValue; - after = this.labelLevel2Name.Text; - - this.ParentForm.SystemConfig.User_Level2_Name = this.labelLevel2Name.Text; - this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); - - this.ParentForm.ChildFormUserEditor.UpdateAccessRightComboBox(); - this.ParentForm.ChildFormMainDisplay.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - this.ParentForm.ChildFormMenu.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - - // Part11 - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Level2Name, "", before, after); - } - } - private void labelLevel3Name_Click(object sender, EventArgs e) - { - string before = "", after = ""; - - before = this.labelLevel3Name.Text; - - DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelLevel3Name.Text, "Level 3"); - - if (keyboard.ShowDialog() == DialogResult.OK) - { - this.labelLevel3Name.Text = keyboard.RetStringValue; - after = this.labelLevel3Name.Text; - - this.ParentForm.SystemConfig.User_Level3_Name = this.labelLevel3Name.Text; - this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); - - this.ParentForm.ChildFormUserEditor.UpdateAccessRightComboBox(); - this.ParentForm.ChildFormMainDisplay.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - this.ParentForm.ChildFormMenu.UpdateDisplayUser(this.ParentForm.SystemConfig.CurrentUser); - - // Part11 - if (this.ParentForm.SystemConfig.IsPart11 == true) - this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Level3Name, "", before, after); - } - } - private void labelTitle1_Click(object sender, EventArgs e) { if (this.ParentForm.SystemConfig.CurrentUser.Group == DataStore.UserGroup.Developer) @@ -621,6 +621,70 @@ namespace INT69DB_2A.Forms } } + private void labelLevel1Name_Click(object sender, EventArgs e) + { + string before = "", after = ""; + + before = this.labelLevel1Name.Text; + + DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelLevel1Name.Text); + + if (keyboard.ShowDialog() == DialogResult.OK) + { + this.labelLevel1Name.Text = keyboard.RetStringValue; + after = this.labelLevel1Name.Text; + + this.ParentForm.SystemConfig.User_Level1_Name = this.labelLevel1Name.Text; + this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); + + // Part11 + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Level1Name, "", before, after); + } + } + private void labelLevel2Name_Click(object sender, EventArgs e) + { + string before = "", after = ""; + + before = this.labelLevel2Name.Text; + + DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelLevel2Name.Text); + + if (keyboard.ShowDialog() == DialogResult.OK) + { + this.labelLevel2Name.Text = keyboard.RetStringValue; + after = this.labelLevel2Name.Text; + + this.ParentForm.SystemConfig.User_Level2_Name = this.labelLevel2Name.Text; + this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); + + // Part11 + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Level2Name, "", before, after); + } + } + private void labelLevel3Name_Click(object sender, EventArgs e) + { + string before = "", after = ""; + + before = this.labelLevel3Name.Text; + + DialogFormUserEditorKeyboard keyboard = new DialogFormUserEditorKeyboard(this.labelLevel3Name.Text); + + if (keyboard.ShowDialog() == DialogResult.OK) + { + this.labelLevel3Name.Text = keyboard.RetStringValue; + after = this.labelLevel3Name.Text; + + this.ParentForm.SystemConfig.User_Level3_Name = this.labelLevel3Name.Text; + this.ParentForm.SaveSystemConfigurationFile(this.ParentForm.SystemConfig); + + // Part11 + if (this.ParentForm.SystemConfig.IsPart11 == true) + this.ParentForm.SetTrackingHistoryData(DataStore.TrackingParameter.Level3Name, "", before, after); + } + } + private void checkBox_Click(object sender, EventArgs e) { if (this.buttonSave.Visible == false) diff --git a/INT69DB_2A/Helper.cs b/INT69DB_2A/Helper.cs index 6b5bb39..72fbd89 100644 --- a/INT69DB_2A/Helper.cs +++ b/INT69DB_2A/Helper.cs @@ -175,6 +175,45 @@ namespace INT69DB_2A return sValue; } + /// + /// Check Sum 8 + /// + /// + /// + public static string Checksumcalculator(string strTemp) + { + string chkSum = ""; + byte[] temp; + int value = 0, first = 0, second = 0; + char char1, char2; + + if (strTemp == null || strTemp.Length == 0) + chkSum = "cc"; + else + { + temp = new UTF8Encoding().GetBytes(strTemp); + + for (int i = 0; i < temp.Length; i++) + value += temp[i]; + + first = (value & 0x00f0) >> 4; + if (first > 9) + char1 = (char)(first + 0x37); + else + char1 = (char)(first + 0x30); + + second = value & 0x000f; + if (second > 9) + char2 = (char)(second + 0x37); + else + char2 = (char)(second + 0x30); + + chkSum = char1.ToString() + char2.ToString(); + } + + return chkSum; + } + public static DataStore.JudgmentStatus StringToJudgmentStatusStatistics(string value) { if (value == "Under") diff --git a/INT69DB_2A/Part11_UserManager/UserItem.cs b/INT69DB_2A/Part11_UserManager/UserItem.cs index dee5d75..f75e06e 100644 --- a/INT69DB_2A/Part11_UserManager/UserItem.cs +++ b/INT69DB_2A/Part11_UserManager/UserItem.cs @@ -10,30 +10,27 @@ namespace INT69DB_2A.Part11_UserManager public class UserItem { #region Field - private bool m_IsUpdate; - private string m_ID; private string m_Password; - private string m_PreviousPassword1; - private string m_PreviousPassword2; - private string m_PreviousPassword3; - private int m_ExpireAccount; + private int m_ExpireId; private int m_ExpirePassword; private bool m_IsLockAccount; private bool m_IsLockPassword; - private DateTime m_DateRegister; - private DateTime m_DateLogin; - private DateTime m_DateExpireRegister; - private DateTime m_DateExpireLogin; + private DateTime m_DatePasswordRegister; + private DateTime m_DateIdLogin; + private DateTime m_DatePasswordExpire; + private DateTime m_DateIdExpire; private DataStore.UserGroup m_Group; private bool m_IsAdmin; private int m_ActiveLevel; + + private int m_IsFirstPassword; #endregion #region Constructor @@ -44,12 +41,6 @@ namespace INT69DB_2A.Part11_UserManager #endregion #region Property - public bool IsUpdate - { - get { return this.m_IsUpdate; } - set { this.m_IsUpdate = value; } - } - public string ID { get { return this.m_ID; } @@ -60,26 +51,11 @@ namespace INT69DB_2A.Part11_UserManager get { return this.m_Password; } set { this.m_Password = value; } } - public string PreviousPassword1 - { - get { return this.m_PreviousPassword1; } - set { this.m_PreviousPassword1 = value; } - } - public string PreviousPassword2 - { - get { return this.m_PreviousPassword2; } - set { this.m_PreviousPassword2 = value; } - } - public string PreviousPassword3 - { - get { return this.m_PreviousPassword3; } - set { this.m_PreviousPassword3 = value; } - } - public int ExpireAccount + public int ExpireId { - get { return this.m_ExpireAccount; } - set { this.m_ExpireAccount = value; } + get { return this.m_ExpireId; } + set { this.m_ExpireId = value; } } public int ExpirePassword { @@ -98,25 +74,25 @@ namespace INT69DB_2A.Part11_UserManager set { this.m_IsLockPassword = value; } } - public DateTime DateRegister + public DateTime DatePasswordRegister { - get { return this.m_DateRegister; } - set { this.m_DateRegister = value; } + get { return this.m_DatePasswordRegister; } + set { this.m_DatePasswordRegister = value; } } - public DateTime DateLogin + public DateTime DateIdLogin { - get { return this.m_DateLogin; } - set { this.m_DateLogin = value; } + get { return this.m_DateIdLogin; } + set { this.m_DateIdLogin = value; } } - public DateTime DateExpireRegister + public DateTime DatePasswordExpire { - get { return this.m_DateExpireRegister; } - set { this.m_DateExpireRegister = value; } + get { return this.m_DatePasswordExpire; } + set { this.m_DatePasswordExpire = value; } } - public DateTime DateExpireLogin + public DateTime DateIdExpire { - get { return this.m_DateExpireLogin; } - set { this.m_DateExpireLogin = value; } + get { return this.m_DateIdExpire; } + set { this.m_DateIdExpire = value; } } public DataStore.UserGroup Group @@ -136,41 +112,52 @@ namespace INT69DB_2A.Part11_UserManager get { return this.m_ActiveLevel; } set { this.m_ActiveLevel = value; } } + + public int IsFirstPassword + { + get { return this.m_IsFirstPassword; } + set { this.m_IsFirstPassword = value; } + } #endregion #region Method private void Initialize() { - this.IsUpdate = false; - this.ID = "-"; this.Password = "-"; - this.PreviousPassword1 = "-"; - this.PreviousPassword2 = "-"; - this.PreviousPassword3 = "-"; - - this.ExpireAccount = 0; + this.ExpireId = 0; this.ExpirePassword = 0; - this.DateRegister = DateTime.Now; - this.DateLogin = DateTime.Now; - this.DateExpireRegister = DateTime.Now; - this.DateExpireLogin = DateTime.Now; + this.DatePasswordRegister = DateTime.Now; + this.DateIdLogin = DateTime.Now; + this.DatePasswordExpire = DateTime.Now; + this.DateIdExpire = DateTime.Now; this.Group = DataStore.UserGroup.None; this.IsAdmin = false; this.ActiveLevel = 1; + + this.IsFirstPassword = 1; //[1] 최초 비밀번호(비밀번호 변경창 띄우기), [0] 비밀번호 변경완료됨 } - public void SetPassword(string pass) + public int GetPasswordExpiryDday() { - this.PreviousPassword3 = this.PreviousPassword2; - this.PreviousPassword2 = this.PreviousPassword1; - this.PreviousPassword1 = pass; - this.Password = pass; + int ret = 0; + DateTime timeNow = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); + TimeSpan dayDiff; + + if (this.Group == DataStore.UserGroup.Admin || this.Group == DataStore.UserGroup.Developer) + ret = 9999; + else + { + dayDiff = timeNow.Date - this.DateIdExpire.Date; + ret = dayDiff.Days; + } + + return ret; } #endregion } diff --git a/INT69DB_2A/Part11_UserManager/UserManager.Define.cs b/INT69DB_2A/Part11_UserManager/UserManager.Define.cs index 91afebe..6c4e456 100644 --- a/INT69DB_2A/Part11_UserManager/UserManager.Define.cs +++ b/INT69DB_2A/Part11_UserManager/UserManager.Define.cs @@ -125,6 +125,9 @@ namespace INT69DB_2A.Part11_UserManager [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserModifyPW(IntPtr user_id, IntPtr user_pw); + [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] + private static extern int DLL_UserMgr_UserModifyPWDirect(IntPtr user_id, IntPtr user_pw); + [DllImport(PathDll, CallingConvention = CallingConvention.Winapi)] private static extern int DLL_UserMgr_UserModifyID(IntPtr user_org_id, IntPtr user_new_id); diff --git a/INT69DB_2A/Part11_UserManager/UserManager.Structure.cs b/INT69DB_2A/Part11_UserManager/UserManager.Structure.cs index 998e818..f633a7f 100644 --- a/INT69DB_2A/Part11_UserManager/UserManager.Structure.cs +++ b/INT69DB_2A/Part11_UserManager/UserManager.Structure.cs @@ -69,29 +69,29 @@ namespace INT69DB_2A.Part11_UserManager USER_MGR_STATUS_OK = 0x00, // error status - USER_MGR_STATUS_ID_NOT_FOUND, // not found the user id - USER_MGR_STATUS_ID_DUPLICATE, // duplicate on id - USER_MGR_STATUS_ID_LENGTH_UNDER, // under the minimum length of id - USER_MGR_STATUS_ID_LENGTH_OVER, // over the maximum length of id - USER_MGR_STATUS_ID_CONT_LETTER, // continue characters or duplicate characters of id - USER_MGR_STATUS_ID_INVALID_CHAR, // include the invalid character on id - USER_MGR_STATUS_ID_ACCOUNT_LOCK, + USER_MGR_STATUS_ID_NOT_FOUND, // 1 - not found the user id + USER_MGR_STATUS_ID_DUPLICATE, // 2 - duplicate on id + USER_MGR_STATUS_ID_LENGTH_UNDER, // 3 - under the minimum length of id + USER_MGR_STATUS_ID_LENGTH_OVER, // 4 - over the maximum length of id + USER_MGR_STATUS_ID_CONT_LETTER, // 5 - continue characters or duplicate characters of id + USER_MGR_STATUS_ID_INVALID_CHAR, // 6 - include the invalid character on id + USER_MGR_STATUS_ID_ACCOUNT_LOCK, // 7 - Account Lock - USER_MGR_STATUS_PW_DUPLICATE_HISTORY, // duplicate on password history - USER_MGR_STATUS_PW_LENGTH_UNDER, // under the minimum length of password - USER_MGR_STATUS_PW_LENGTH_OVER, // over the maximum length of password - USER_MGR_STATUS_PW_CONT_LETTER, // continue characters or duplicate characters of password - USER_MGR_STATUS_PW_INVALID_CHAR, // include the invalid character on password - USER_MGR_STATUS_PW_EACH_MIN_CHAR, // not include minimum characters on password - USER_MGR_STATUS_PW_NOT_SAME, // password error - USER_MGR_STATUS_PW_PASSWORD_LOCK, + USER_MGR_STATUS_PW_DUPLICATE_HISTORY, // 8 - duplicate on password history + USER_MGR_STATUS_PW_LENGTH_UNDER, // 9 - under the minimum length of password + USER_MGR_STATUS_PW_LENGTH_OVER, // 10 - over the maximum length of password + USER_MGR_STATUS_PW_CONT_LETTER, // 11 - continue characters or duplicate characters of password + USER_MGR_STATUS_PW_INVALID_CHAR, // 12 - include the invalid character on password + USER_MGR_STATUS_PW_EACH_MIN_CHAR, // 13 - not include minimum characters on password + USER_MGR_STATUS_PW_NOT_SAME, // 14 - password error + USER_MGR_STATUS_PW_PASSWORD_LOCK, // 15 - Password Lock - USER_MGR_STATUS_OTHER_OVER_PASSWORD_PERIOD, // over maximum password expire period (days) - USER_MGR_STATUS_OTHER_OVER_ACCOUNT_PERIOD, // over maximum account expire period (days) - USER_MGR_STATUS_OTHER_OVER_LOGIN_TIMEOUT, // over maximum auto logout time (minute) + USER_MGR_STATUS_OTHER_OVER_PASSWORD_PERIOD, // 16 - over maximum password expire period (days) + USER_MGR_STATUS_OTHER_OVER_ACCOUNT_PERIOD, // 17 - over maximum account expire period (days) + USER_MGR_STATUS_OTHER_OVER_LOGIN_TIMEOUT, // 18 - over maximum auto logout time (minute) USER_MGR_STATUS_MAX, - }; + }; #endregion #region Enum E_user_mgr_menu_id @@ -192,7 +192,7 @@ namespace INT69DB_2A.Part11_UserManager return dateTime; } - } + } #endregion #region Struct UserMgr_user_info_t @@ -212,16 +212,16 @@ namespace INT69DB_2A.Part11_UserManager public Int32 fadmin; [MarshalAs(UnmanagedType.I4)] - public Int32 expire_period_password; // password lock + public Int32 password_expire_period; // password lock date [MarshalAs(UnmanagedType.I4)] - public Int32 expire_period_account; // account lock + public Int32 id_expire_period; // id lock date [MarshalAs(UnmanagedType.I4)] - public Int32 flock_status_account; // user ID (account) lock + public Int32 id_flock_status; // user ID (account) lock status [MarshalAs(UnmanagedType.I4)] - public Int32 flock_status_password; // password lock (need to change password) + public Int32 password_flock_status; // password lock status (need to change password) [MarshalAs(UnmanagedType.Struct)] public DateTime_t password_register_date; // date/time when the user password was registered or changed @@ -230,17 +230,20 @@ namespace INT69DB_2A.Part11_UserManager public DateTime_t id_login_date; // date/time when the user was login [MarshalAs(UnmanagedType.Struct)] - public DateTime_t expire_password_date; + public DateTime_t password_expire_date; // Password Expiration Date [MarshalAs(UnmanagedType.Struct)] - public DateTime_t expire_id_date; + public DateTime_t id_expire_date; // Account Expiration Date [MarshalAs(UnmanagedType.Struct)] - public MenuID_t menuID; + public MenuID_t menuID; // flag of Menu IDs [MarshalAs(UnmanagedType.I4)] - public Int32 active_level; - } + public Int32 active_level; // menu active level : max : MAX_ACTIVE_LEVEL + + [MarshalAs(UnmanagedType.I4)] + public Int32 fFirstPW; // [1] First (request to modify), [0] Next (not request) + } #endregion #region Struct UserMgr_user_modify_t @@ -262,7 +265,7 @@ namespace INT69DB_2A.Part11_UserManager [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_USER_ID_LENGTH)] public string user_id; - } + } #endregion #region Struct UserMgr_login_timeout_t @@ -273,7 +276,7 @@ namespace INT69DB_2A.Part11_UserManager [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_USER_ID_LENGTH)] public string user_id; - } + } #endregion #region Struct UserMgr_user_add_t @@ -286,7 +289,7 @@ namespace INT69DB_2A.Part11_UserManager [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_USER_ID_LENGTH)] public string user_id; - } + } #endregion #region Struct UserMgr_user_lock_t @@ -298,7 +301,7 @@ namespace INT69DB_2A.Part11_UserManager [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_USER_ID_LENGTH)] public string user_id; - } + } #endregion #region Struct UserMgr_user_list_t @@ -324,35 +327,38 @@ namespace INT69DB_2A.Part11_UserManager public Int32 fadmin; [MarshalAs(UnmanagedType.I4)] - public Int32 expire_period_pw; // password lock + public Int32 password_expire_period; // password lock [MarshalAs(UnmanagedType.I4)] - public Int32 expire_period_account; // account lock + public Int32 id_expire_period; // account lock [MarshalAs(UnmanagedType.I4)] - public Int32 flock_status_account; // user ID (account) lock + public Int32 id_flock_status; // user ID (account) lock [MarshalAs(UnmanagedType.I4)] public Int32 flock_status_password; // password lock (need to change password) [MarshalAs(UnmanagedType.Struct)] - public DateTime_t register_date; // date/time when the user password was registered or changed + public DateTime_t password_register_date; // date/time when the user password was registered or changed [MarshalAs(UnmanagedType.Struct)] - public DateTime_t login_date; // date/time when the user was login + public DateTime_t id_login_date; // date/time when the user was login [MarshalAs(UnmanagedType.Struct)] - public DateTime_t expire_register_date; + public DateTime_t password_expire_date; // Password Expiration Date [MarshalAs(UnmanagedType.Struct)] - public DateTime_t expire_account_date; + public DateTime_t id_expire_date; // Account Expiration Date [MarshalAs(UnmanagedType.I4)] - public Int32 active_level; + public Int32 active_level; // menu active level : max : MAX_ACTIVE_LEVEL [MarshalAs(UnmanagedType.Struct)] - public MenuID_t menuID; - } + public MenuID_t menuID; // flag of Menu IDs + + [MarshalAs(UnmanagedType.I4)] + public Int32 fFirstPW; // flag first password + } #endregion #region Struct UserMgr_user_list_name_t diff --git a/INT69DB_2A/Part11_UserManager/UserManager.cs b/INT69DB_2A/Part11_UserManager/UserManager.cs index f3fafec..63900e9 100644 --- a/INT69DB_2A/Part11_UserManager/UserManager.cs +++ b/INT69DB_2A/Part11_UserManager/UserManager.cs @@ -136,6 +136,18 @@ namespace INT69DB_2A.Part11_UserManager DLL_UserMgr_UserModifyPW(pID, pPW); } + public static int UserManager_UserModifyPWDirect(String sID, String sNewPW) + { + int ret = 0; + + IntPtr pID = Marshal.StringToBSTR(sID.ToString()); + IntPtr pPW = Marshal.StringToBSTR(sNewPW.ToString()); + + ret = DLL_UserMgr_UserModifyPWDirect(pID, pPW); + + return ret; + } + public static void UserManager_UserModifyID(String sID, String sNewID) { IntPtr pID = Marshal.StringToBSTR(sID.ToString()); @@ -231,7 +243,7 @@ namespace INT69DB_2A.Part11_UserManager } catch { - } + } } private static void UserManager_GetListCallBack(ref UserMgr_user_list_t user_list) { @@ -263,7 +275,7 @@ namespace INT69DB_2A.Part11_UserManager UserListLogoutDataEvent(status); } - catch + catch { } } @@ -285,7 +297,7 @@ namespace INT69DB_2A.Part11_UserManager if (UserListLockDataEvent != null) UserListLockDataEvent(user_lock); } - catch + catch { } } @@ -296,7 +308,7 @@ namespace INT69DB_2A.Part11_UserManager if (UserListDefautSettingDataEvent != null) UserListDefautSettingDataEvent(status); } - catch + catch { } } @@ -340,7 +352,7 @@ namespace INT69DB_2A.Part11_UserManager if (UserListAddDataEvent != null) UserListAddDataEvent(user_add); } - catch + catch { } } @@ -365,21 +377,21 @@ namespace INT69DB_2A.Part11_UserManager try { } - catch + catch { } } private static void UserManager_VersionCallback(StringBuilder version) { - try - { + try + { if (UserListGetVersionDataEvent != null) UserListGetVersionDataEvent(version); - } - catch - { - - } + } + catch + { + + } } #endregion } diff --git a/INT69DB_2A/bin/Release/DllAes128.dll b/INT69DB_2A/bin/Release/DllAes128.dll index 85db518..9099ed2 100644 Binary files a/INT69DB_2A/bin/Release/DllAes128.dll and b/INT69DB_2A/bin/Release/DllAes128.dll differ diff --git a/INT69DB_2A/bin/Release/DllUserMgr.dll b/INT69DB_2A/bin/Release/DllUserMgr.dll index 7926cbf..dd5398f 100644 Binary files a/INT69DB_2A/bin/Release/DllUserMgr.dll and b/INT69DB_2A/bin/Release/DllUserMgr.dll differ diff --git a/INT69DB_2A/obj/Release/INT69DB_2A.DialogForms.DialogFormLogOn.resources b/INT69DB_2A/obj/Release/INT69DB_2A.DialogForms.DialogFormLogOn.resources index 3b0c107..20f2fb9 100644 Binary files a/INT69DB_2A/obj/Release/INT69DB_2A.DialogForms.DialogFormLogOn.resources and b/INT69DB_2A/obj/Release/INT69DB_2A.DialogForms.DialogFormLogOn.resources differ diff --git a/INT69DB_2A/obj/Release/INT69DB_2A.Forms.FormEquipmentSetting.resources b/INT69DB_2A/obj/Release/INT69DB_2A.Forms.FormEquipmentSetting.resources index 071dfed..d520d84 100644 Binary files a/INT69DB_2A/obj/Release/INT69DB_2A.Forms.FormEquipmentSetting.resources and b/INT69DB_2A/obj/Release/INT69DB_2A.Forms.FormEquipmentSetting.resources differ