Ejemplo n.º 1
0
        private void SetLayout()
        {
            IniFile ini = new IniFile();

            ini.Load(IniData.SettingIniFile);
            IniSection resSect     = ini["Resources"];
            IniSection equipSect   = ini["Equipment"];
            string     bgResPath   = System.IO.Directory.GetCurrentDirectory() + $@"{resSect["ResourceFolder"]}{resSect["BGFolder"]}";
            string     textResPath = System.IO.Directory.GetCurrentDirectory() + $@"{resSect["ResourceFolder"]}{resSect["TextFolder"]}";

            this.Location = new Point(this.Left, 0);
            this.Size     = new Size(int.Parse(equipSect["Width"].ToString()), int.Parse(equipSect["Height"].ToString()));
            ControlLayout ctrlLayout = new ControlLayout();

            this.Padding = new Padding(ctrlLayout.GetXPosByRatio(this.Size, LeftPadding), ctrlLayout.GetYPosByRatio(this.Size, TopPadding), 0, 0);

            Pnl_Drag.BackgroundImage = Image.FromFile(bgResPath + @"\bg_box2_NoBorder.png");
            ctrlLayout.Control_Sizing(Pnl_Drag, this.Size, 1, 0.15f);

            ctrlLayout.Control_Sizing(Btn_Process, this.Size, 0.075f, 0.05f);
            ctrlLayout.Control_Positioning(Btn_Process, this.Size, 0.05f, 0.2f);
            Btn_Process.BackgroundImage = Image.FromFile(textResPath + @"\btn_s작업지시_nomal.png");
            Btn_Process.Text            = "";

            ctrlLayout.Control_Sizing(Btn_Logout, this.Size, 0.075f, 0.05f);
            ctrlLayout.Control_Positioning(Btn_Logout, this.Size, 0.9f, 0.1f);
            Btn_Logout.BackgroundImage = Image.FromFile(textResPath + @"\Logout.png");
            Btn_Logout.Text            = "";

            ctrlLayout.Control_Sizing(Btn_Exit, this.Size, 0.05f, 0.05f);
            ctrlLayout.Control_Positioning(Btn_Exit, this.Size, 1, 0.1f, ControlLayout.HorizontalSiding.Right);
            Btn_Exit.BackgroundImage = Image.FromFile(textResPath + @"\Exit.png");
            Btn_Exit.Text            = "";
        }
        private void SetLayout()
        {
            IniFile ini = new IniFile();

            ini.Load(IniData.SettingIniFile);
            IniSection resSect     = ini["Resources"];
            string     bgResPath   = System.IO.Directory.GetCurrentDirectory() + $@"{resSect["ResourceFolder"]}{resSect["BGFolder"]}";
            string     textResPath = System.IO.Directory.GetCurrentDirectory() + $@"{resSect["ResourceFolder"]}{resSect["TextFolder"]}";

            ControlLayout ctrlLayout = new ControlLayout();

            ctrlLayout.MakeCurvedBorder(this, 18, 18);
            this.BackgroundImage = Image.FromFile(bgResPath + @"\bg_tabpage.png");

            ctrlLayout.Control_Sizing(Pnl_Drag, this.Size, 1, 0.2f);

            ctrlLayout.Control_Sizing(Pic_Title, this.Size, 0.05f, 0.1f);
            ctrlLayout.Control_Positioning(Pic_Title, this.Size, 0.1f, 0.2f);
            Pic_Title.Load(textResPath + @"\In.png");

            ctrlLayout.Control_Sizing(Lbl_Title, this.Size, 0.15f, 0.1f);
            ctrlLayout.Control_Positioning(Lbl_Title, this.Size, 0.2f, 0.2f);

            ctrlLayout.Control_Sizing(Pic_ID, this.Size, 0.1f, 0.15f);
            ctrlLayout.Control_Positioning(Pic_ID, this.Size, 0.12f, 0.4f);
            Pic_ID.Load(textResPath + @"\Key.png");
            ctrlLayout.Control_Sizing(Txt_ID, this.Size, 0.5f, 0.1f);
            ctrlLayout.Control_Positioning(Txt_ID, this.Size, 0.2f, 0.4f, ControlLayout.HorizontalSiding.Left);


            ctrlLayout.Control_Sizing(Pic_PW, this.Size, 0.1f, 0.15f);
            ctrlLayout.Control_Positioning(Pic_PW, this.Size, 0.12f, 0.6f);
            Pic_PW.Load(textResPath + @"\Lock.png");
            ctrlLayout.Control_Sizing(Txt_PW, this.Size, 0.5f, 0.1f);
            ctrlLayout.Control_Positioning(Txt_PW, this.Size, 0.2f, 0.6f, ControlLayout.HorizontalSiding.Left);


            ctrlLayout.Control_Sizing(Btn_LogIn, this.Size, 0.2f, 0.15f);
            ctrlLayout.Control_Positioning(Btn_LogIn, this.Size, 0.5f, 0.85f);
            Btn_LogIn.Text            = "";
            Btn_LogIn.BackgroundImage = Image.FromFile(textResPath + @"\Login.png");
            ctrlLayout.MakeCurvedBorder(Btn_LogIn, 18, 18);

            ctrlLayout.Control_Sizing(Btn_Exit, this.Size, 0.15f, 0.15f);
            ctrlLayout.Control_Positioning(Btn_Exit, this.Size, 0.9f, 0.1f);
            Btn_Exit.BackgroundImage = Image.FromFile(textResPath + @"\Exit.png");
            ctrlLayout.MakeCurvedBorder(Btn_Exit, 18, 18);
        }
        private void SetLayout()
        {
            IniFile ini = new IniFile();

            ini.Load(IniData.SettingIniFile);
            IniSection resSect     = ini["Resources"];
            string     bgResPath   = System.IO.Directory.GetCurrentDirectory() + $@"{resSect["ResourceFolder"]}{resSect["BGFolder"]}";
            string     textResPath = System.IO.Directory.GetCurrentDirectory() + $@"{resSect["ResourceFolder"]}{resSect["TextFolder"]}";

            // 부모 폼의 Mdi Container에 크기를 맞춘다
            this.Location = new Point(0, 0);
            this.Size     = new Size(this.MdiParent.ClientSize.Width - this.MdiParent.Padding.Left - this.MdiParent.Padding.Right,
                                     this.MdiParent.ClientSize.Height - this.MdiParent.Padding.Top - this.MdiParent.Padding.Bottom);
            this.BackgroundImage = Image.FromFile(bgResPath + @"\bg_USER_SEL_Simple.png");

            ControlLayout ctrlLayout = new ControlLayout();

            ctrlLayout.Control_Positioning(Lbl_CurrentTime, this.Size, 0.86f, 0.03f);
            ctrlLayout.Control_Sizing(Txt_CurrentTime, this.Size, 0.1f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_CurrentTime, this.Size, 0.89f, 0.03f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_Order, this.Size, 0.07f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_Order, this.Size, 0.07f, 0.2f);
            Pic_Order.Load(textResPath + @"\작업지시.png");
            ctrlLayout.Control_Sizing(Cmb_Order, this.Size, 0.2f, 0.05f);
            ctrlLayout.Control_Positioning(Cmb_Order, this.Size, 0.12f, 0.2f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_ItemCode, this.Size, 0.07f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_ItemCode, this.Size, 0.07f, 0.25f);
            Pic_ItemCode.Load(textResPath + @"\품번.png");
            ctrlLayout.Control_Sizing(Txt_ItemCode, this.Size, 0.2f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_ItemCode, this.Size, 0.12f, 0.25f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_ItemName, this.Size, 0.07f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_ItemName, this.Size, 0.07f, 0.3f);
            Pic_ItemName.Load(textResPath + @"\품명.png");
            ctrlLayout.Control_Sizing(Txt_ItemName, this.Size, 0.2f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_ItemName, this.Size, 0.12f, 0.3f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_Proc, this.Size, 0.08f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_Proc, this.Size, 0.07f, 0.35f);
            Pic_Proc.Load(textResPath + @"\공정 및 기기.png");
            ctrlLayout.Control_Sizing(Txt_ProcName, this.Size, 0.1f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_ProcName, this.Size, 0.12f, 0.35f, ControlLayout.HorizontalSiding.Left);
            ctrlLayout.Control_Sizing(Cmb_Machine, this.Size, 0.1f, 0.05f);
            ctrlLayout.Control_Positioning(Cmb_Machine, this.Size, 0.22f, 0.35f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_TargetAmount, this.Size, 0.08f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_TargetAmount, this.Size, 0.18f, 0.4f, ControlLayout.HorizontalSiding.Right);
            Pic_TargetAmount.Load(textResPath + @"\목표생산량.png");
            ctrlLayout.Control_Sizing(Txt_TargetAmount, this.Size, 0.1f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_TargetAmount, this.Size, 0.2f, 0.4f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_TotalAmount, this.Size, 0.08f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_TotalAmount, this.Size, 0.2f, 0.44f, ControlLayout.HorizontalSiding.Right);
            Pic_TotalAmount.Load(textResPath + @"\총생산량.png");
            ctrlLayout.Control_Sizing(Txt_TotalAmount, this.Size, 0.08f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_TotalAmount, this.Size, 0.22f, 0.44f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_NormalAmount, this.Size, 0.08f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_NormalAmount, this.Size, 0.2f, 0.48f, ControlLayout.HorizontalSiding.Right);
            Pic_NormalAmount.Load(textResPath + @"\양품수.png");
            ctrlLayout.Control_Sizing(Txt_NormalAmount, this.Size, 0.08f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_NormalAmount, this.Size, 0.22f, 0.48f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Pic_DefectAmount, this.Size, 0.08f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_DefectAmount, this.Size, 0.2f, 0.52f, ControlLayout.HorizontalSiding.Right);
            Pic_DefectAmount.Load(textResPath + @"\불량품 수.png");
            ctrlLayout.Control_Sizing(Txt_DefectAmount, this.Size, 0.08f, 0.05f);
            ctrlLayout.Control_Positioning(Txt_DefectAmount, this.Size, 0.22f, 0.52f, ControlLayout.HorizontalSiding.Left);

            ctrlLayout.Control_Sizing(Btn_OrderStart, this.Size, 0.1f, 0.08f);
            ctrlLayout.Control_Positioning(Btn_OrderStart, this.Size, 0.4f, 0.3f);
            Btn_OrderStart.BackgroundImage = Image.FromFile(textResPath + @"\btn_작업시작_nomal.png");
            Btn_OrderStart.Text            = "";

            ctrlLayout.Control_Sizing(Pic_DieLbl, this.Size, 0.08f, 0.04f);
            ctrlLayout.Control_Positioning(Pic_DieLbl, this.Size, 0.5f, 0.15f, ControlLayout.HorizontalSiding.Center, ControlLayout.VerticalSiding.Top);
            Pic_DieLbl.Load(textResPath + @"\금형.png");
            ctrlLayout.Control_Sizing(Pic_Dies, this.Size, 0.3f, 0.3f);
            ctrlLayout.Control_Positioning(Pic_Dies, this.Size, 0.55f, 0.15f, ControlLayout.HorizontalSiding.Left, ControlLayout.VerticalSiding.Top);

            ctrlLayout.Control_Sizing(Tab_Data, this.Size, 0.5f, 0.35f);
            ctrlLayout.Control_Positioning(Tab_Data, this.Size, 0.3f, 0.8f);
        }
        private void InitializeChart()
        {
            chtType = ChtRefreshType.RefreshAll;

            IniFile iniFile = new IniFile();

            iniFile.Load(IniData.SettingIniFile);
            IniSection dbSection = iniFile[DBConnect.IniSectionName];

            DBConnect  connect = new DBConnect();
            SqlCommand command = new SqlCommand();

            command.CommandText = $@"Select {dbSection["QMasTB_Code"]}, {dbSection["QMasTB_Name"]}, {dbSection["QMasTB_Min"]}, {dbSection["QMasTB_Max"]}
                                       from {dbSection["QMasTB"]}";

            DataSet       datas;
            bool          result     = connect.Search(command, out datas);
            ControlLayout ctrlLayout = new ControlLayout();

            if (!result)
            {
                Tim_Per3Sec.Enabled = false;
                return;
            }

            foreach (DataRow row in datas.Tables[0].Rows)
            {
                Tab_Data.TabPages.Add(row[0].ToString(), row[1].ToString());

                Chart cht = new Chart();
                cht.ChartAreas.Add($"{row[0].ToString()}Area");
                cht.Legends.Add(row[0].ToString());
                cht.Series.Add(row[0].ToString());
                cht.Series[row[0].ToString()].ChartType   = SeriesChartType.Line;
                cht.Series[row[0].ToString()].BorderWidth = 4;
                cht.Series[row[0].ToString()].ChartArea   = $"{row[0].ToString()}Area";
                cht.Series[row[0].ToString()].Legend      = row[0].ToString();
                cht.Series[row[0].ToString()].LegendText  = row[0].ToString();
                cht.Series[row[0].ToString()].XValueType  = ChartValueType.DateTime;
                cht.ChartAreas[$"{row[0].ToString()}Area"].AxisX.LabelStyle.Format = "HH시 mm분";

                // 품질 경계를 표시하기 위한 코드
                double min       = double.Parse(row[2].ToString());
                double max       = double.Parse(row[3].ToString());
                double minborder = (min * 1.5) - (max * 0.5);
                double maxborder = (max * 1.5) - (min * 0.5);
                cht.ChartAreas[$"{row[0].ToString()}Area"].AxisY.Minimum  = minborder;
                cht.ChartAreas[$"{row[0].ToString()}Area"].AxisY.Maximum  = maxborder;
                cht.ChartAreas[$"{row[0].ToString()}Area"].AxisY.Interval = (max - min) * 0.5;
                StripLine line = new StripLine();
                line.Interval       = 0;
                line.StripWidth     = (max - min) * 0.5;
                line.BackColor      = Color.Salmon;
                line.IntervalOffset = minborder;
                StripLine line2 = new StripLine();
                line2.Interval       = 0;
                line2.StripWidth     = (max - min) * 0.5;
                line2.BackColor      = Color.Salmon;
                line2.IntervalOffset = max;
                cht.ChartAreas[$"{row[0].ToString()}Area"].AxisY.StripLines.Add(line);
                cht.ChartAreas[$"{row[0].ToString()}Area"].AxisY.StripLines.Add(line2);

                //cht.ChartAreas[$"{row[0].ToString()}Area"].AxisX.IntervalType = DateTimeIntervalType.Seconds;
                //cht.ChartAreas[$"{row[0].ToString()}Area"].AxisX.Interval = 3;
                ctrlLayout.Control_Sizing(cht, this.Size, 0.5f, 0.3f);
                Tab_Data.TabPages[row[0].ToString()].Controls.Add(cht);
            }
        }