using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DBFactory;
namespace SystemConfig
{
    public partial class FrmSystemConfig : Form
    {
        DBOperator dbo = CStaticClass.dbo;
        private static FrmSystemConfig _formInstance;

        public static FrmSystemConfig FormInstance
        {
            get 
            {
                if (_formInstance == null)
                {
                    _formInstance = new FrmSystemConfig();
                }
                return FrmSystemConfig._formInstance;
            }
            set { FrmSystemConfig._formInstance = value; }
        }
        public FrmSystemConfig()
        {
            InitializeComponent();
            _formInstance = this;
        }

        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            
            FrmDeviceKindEdit.FormInstance.MdiParent = this;
            FrmDeviceKindEdit.FormInstance.Show();
        }

        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {
            
            FrmDeviceEdit.FormInstance.MdiParent = this;
            FrmDeviceEdit.FormInstance.Show();
        }

        private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            
            FrmDeviceCommand.FormInstance.MdiParent = this;
            FrmDeviceCommand.FormInstance.Show();
        }

        private void toolStripMenuItem6_Click(object sender, EventArgs e)
        {
            
            FrmLaneGateEdit.FormInstance.MdiParent = this;
            FrmLaneGateEdit.FormInstance.Show();
        }

        private void toolStripMenuItem5_Click(object sender, EventArgs e)
        {

            FrmStackInfoEdit.FormInstance.MdiParent = this;
            FrmStackInfoEdit.FormInstance.Show();
        }

        private void toolStripMenuItem8_Click(object sender, EventArgs e)
        {
            
            FrmRouteEdit.FormInstance.MdiParent = this;
            FrmRouteEdit.FormInstance.Show();
        }

        private void toolStripMenuItem9_Click(object sender, EventArgs e)
        {
            FrmRouteDeviceEdit.FormInstance.MdiParent = this;
            FrmRouteDeviceEdit.FormInstance.Show();
        }

        private void toolStripMenuItem12_Click(object sender, EventArgs e)
        {
            
            FrmAGVGateEdit.FormInstance.MdiParent = this;
            FrmAGVGateEdit.FormInstance.Show();
        }

        private void toolStripMenuItem13_Click(object sender, EventArgs e)
        {
            
            FrmLaneFlashInfo.FormInstance.MdiParent = this;
            FrmLaneFlashInfo.FormInstance.Show();
        }

        private void toolStripMenuItem11_Click(object sender, EventArgs e)
        {
            FrmItemTaskTypeEdit.FormInstance.MdiParent = this;
            FrmItemTaskTypeEdit.FormInstance.Show();
        }

        private void toolStripMenuItem14_Click(object sender, EventArgs e)
        {
            FrmStackRobotPosition.FormInstance.MdiParent = this;
            FrmStackRobotPosition.FormInstance.Show();
        }

        private void FrmSystemConfig_Load(object sender, EventArgs e)
        {
            if (dbo.Open() == false)
            {
                
                FrmConnectDB.FormInstance.ConnectType = "Monitor";
                FrmConnectDB.FormInstance.ShowDialog();
            }
        }

        private void toolStripMenuItem15_Click(object sender, EventArgs e)
        {
            FrmRGVGateEdit.FormInstance.MdiParent = this;
            FrmRGVGateEdit.FormInstance.Show();
        }

        private void toolStripMenuItem16_Click(object sender, EventArgs e)
        {
            FrmWareHouseEdit.FormInstance.MdiParent = this;
            FrmWareHouseEdit.FormInstance.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
        //    int fid = 0;
        //    string sql = "";
        //    string cell = "";
        //    string cname = "";
            
        //    for (int a = 1; a <= 3; a++)
        //    {
        //        for (int i = 1; i <= 36; i++)
        //        {
        //            for (int j = 1; j <= 8; j++)
        //            {
        //                fid++;
        //                cell ="0"+ a.ToString() + "-" + i.ToString() + "-" + j.ToString();
        //                cname = a.ToString() + "排" + i.ToString() + "列" + j.ToString()+"层";
        //                sql = "INSERT INTO ST_CELL (FID, FWAREHOUSE, FLaneWay, FCELLCODE, F_Z, F_X, F_Y, FCELLNAME)VALUES"+
        //                    " ("+fid+",'WZK',18002,'"+cell+"',"+a+","+i+","+j+",'"+cname+"')";
        //                dbo.ExceSQL(sql);
        //            }
        //        }
        //    }
        }






    }
}