Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // create database
            mysqlconnection.excute_sql("CREATE table data_table(data_name nvarchar(50) PRIMARY KEY,data_type nvarchar(50),data_address nvarchar(50),machine_num nvarchar(60))"); //建立数据词典表
            mysqlconnection.excute_sql("CREATE table start_time(machine_num nvarchar(50) PRIMARY KEY,start_time datetime)");                                                     // 建立开始时间表
            mysqlconnection.excute_sql("CREATE table history(machine_num nvarchar(50),value nvarchar(50),save_time datetime,machine_num_and_save_time nvarchar(50) PRIMARY KEY)");
            mysqlconnection.excute_sql("CREATE table liaogang(machine_num nvarchar(50), value nvarchar(50),save_time datetime,machine_num_and_save_time nvarchar(50) PRIMARY KEY)");
            mysqlconnection.excute_sql("CREATE table craftcode(craft_name nvarchar(50)  PRIMARY KEY, craft_code nvarchar(50))");  //建立工艺与工艺代码对照表
            mysqlconnection.excute_sql("CREATE table craft_machine_num(machine_num int PRIMARY KEY, craft_name nvarchar(50))");   //建立染机号与工艺名称的对照表

            // 工艺命名
            mysqlconnection.excute_sql("CREATE table craft_name(craft_num int PRIMARY KEY,craft_name nvarchar(50))");

            // 建立班组数据库
            mysqlconnection.excute_sql("CREATE table banzu_time(banzu_name nvarchar(50) PRIMARY KEY,starttime datetime,endtime datetime)");

            // 建立流量统计数据库
            mysqlconnection.excute_sql("CREATE table liuliang_history(timemachine_num nvarchar(50) PRIMARY KEY,machine_num int,time datetime,banzu nvarchar(50),value float)");

            // 建立液位统计数据库
            mysqlconnection.excute_sql("CREATE table yewei_history(timemachine_num nvarchar(50) PRIMARY KEY,machine_num int,time datetime,value float)");


            // 建立信息查询数据库
            mysqlconnection.excute_sql("CREATE table info_save(timemachine_num nvarchar(50) PRIMARY KEY,machine_num int,start_time datetime,craft_name nvarchar(MAX),gongdanhao nvarchar(50))");

            /*
             * for (int i = 1; i <= 60; i++)
             * {
             *  mysqlconnection.excute_sql("drop table craft_machine"+i.ToString());
             *  // 建立组合工艺数据库
             *
             * }
             *
             * for (int i = 1; i <= 500; i++)
             * {
             *  mysqlconnection.excute_sql("drop table craft"+i.ToString());
             * }
             */

            // 对60个染机分别建立工艺数据库
            for (int i = 1; i <= 60; i++)
            {
                mysqlconnection.excute_sql("CREATE table craft_machine" + i.ToString() + "(xuhao int PRIMARY KEY identity(1,1),wendu_shuiwei int,speed float,time int,craft nvarchar(50),nvarcharcode int,rate int,fengji_rate int,tibu_rate int,craft_code nvarchar(50))");
                // 建立组合工艺数据库
                mysqlconnection.excute_sql("Create table craft_zuhe" + i.ToString() + "(xuhao int PRIMARY KEY,craft_num int)");
                // 往每个组合数据库中插入九条数据
                for (int j = 1; j <= 9; j++)
                {
                    mysqlconnection.excute_sql("Insert into craft_zuhe" + i.ToString() + " values('" + j.ToString() + "','0')");
                }
            }



            // 对500个定义好的工艺建立数据库
            for (int i = 1; i <= 500; i++)
            {
                mysqlconnection.excute_sql("CREATE table craft" + i.ToString() + "(xuhao int PRIMARY KEY identity(1,1) ,wendu_shuiwei int,speed float,time int,craft nvarchar(50),nvarcharcode int,rate int,fengji_rate int,tibu_rate int,craft_code nvarchar(50))");
            }
            this.Top    = 0;
            this.Left   = 0;
            this.Width  = rect.Width;
            this.Height = rect.Height;
            //初使化各个界面

            info_view           = new Info(this);
            info_view.MdiParent = this;
            Show_Form(info_view);

            baobiao_view           = new Baobiao(this);
            baobiao_view.MdiParent = this;
            Show_Form(baobiao_view);

            banzuset_view           = new BanzuSet(this);
            banzuset_view.MdiParent = this;
            Show_Form(banzuset_view);

            mydataconfig           = new data_config(this);
            mydataconfig.MdiParent = this;

            Show_Form(mydataconfig);

            detail           = new Detail(this, 1);
            detail.MdiParent = this;
            Show_Form(detail);

            myportconfig           = new Port_config(this);
            myportconfig.MdiParent = this;
            Show_Form(myportconfig);

            History           = new history(this);
            History.MdiParent = this;
            Show_Form(History);

            craft_edit_view           = new Craft_Edit_View(this);
            craft_edit_view.MdiParent = this;
            Show_Form(craft_edit_view);

            general           = new General(this);
            general.MdiParent = this;
            Show_Form(general);
        }
Exemple #2
0
 public int Machine_num; //所要处理的
 public Data_add(data_config parent_view)
 {
     mydata_view = parent_view;
     InitializeComponent();
     myini = mydata_view.mv.myini;
 }