public void Execute(IJobExecutionContext context)
        {
            var    entity    = new FangpuDatacenterModelEntities();
            string nextmonth = DateTime.Today.AddMonths(1).ToString("yyyyMM");
            int    days      = DateTime.DaysInMonth(Convert.ToInt16(nextmonth.Substring(0, 4)), Convert.ToInt16(nextmonth.Substring(4, 2)));

            for (int i = 1; i <= days; i++)
            {
                string tablename = "historydata_" + nextmonth + i.ToString().PadLeft(2, '0');
                string sqlstr    = "CREATE TABLE IF NOT EXISTS " + tablename + " LIKE historydata";
                int    x         = entity.Database.ExecuteSqlCommand(sqlstr);
            }
            Trace.WriteLine("作业执行!" + DateTime.Now.ToString());
        }
Esempio n. 2
0
        private void accept_Click(object sender, EventArgs e)
        {
            try
            {
                FangpuTerminal.HideInputPanel();
                var mysql      = new FangpuDatacenterModelEntities();
                var workerlist = new bandchecklist();
                workerlist.deviceid       = Properties.TerminalParameters.Default.terminal_name;
                workerlist.sn             = biaodanbianhao.Text;
                workerlist.date           = dateTimePicker1.Value;
                workerlist.position       = luwei.Text;
                workerlist.name           = xingmingbianhao.Text;
                workerlist.producesn      = shengchandanhao.Text;
                workerlist.cardnumber     = liuzhuankahao.Text;
                workerlist.weight         = zhongliang.Text;
                workerlist.singleweight   = danzhong.Text;
                workerlist.materialnumber = liaopihao.Text;
                workerlist.waste          = feipin.Text;
                workerlist.producttype    = chanpinguige.Text;
                workerlist.remark         = beizhu.Text;
                if (xiaoji.Text.Trim() == String.Empty)
                {
                    workerlist.subtotal = null;
                }
                else
                {
                    workerlist.subtotal = Convert.ToDouble(xiaoji.Text);
                }
                if (zhongliang.Text.Trim() == String.Empty)
                {
                    workerlist.total = null;
                }
                else
                {
                    workerlist.total = Convert.ToDouble(zhongliang.Text);
                }
                mysql.bandchecklist.Add(workerlist);
                mysql.SaveChanges();
                MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("上传失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 3
0
        public void HaltReasonUpload()
        {
            bool firsttry = true;

            while (true)
            {
                try
                {
                    var mysql    = new FangpuDatacenterModelEntities();
                    var haltinfo = new haltinfo();
                    haltinfo.device_name = Properties.TerminalParameters.Default.terminal_name;
                    haltinfo.time_start  = start;
                    haltinfo.time_end    = end;
                    haltinfo.halt_reason = reason;
                    haltinfo.storetime   = DateTime.Now;
                    mysql.haltinfo.Add(haltinfo);
                    mysql.SaveChanges();
                    FangpuTerminal.HaltUI S1 = new FangpuTerminal.HaltUI(updateui);
                    FangpuTerminal.BeginInvoke(S1);
                    try
                    {
                        TextCommand.DeleteFile("haltinfo.txt");
                    }
                    catch
                    {
                    }
                    break;
                }
                catch
                {
                    if (firsttry == true)
                    {
                        MessageBox.Show("停机信息上传失败!\n与数据中心连接出错!请稍后重试", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    firsttry = false;
                    FangpuTerminal.log.Error("停机原因存储出错");
                }
            }
        }
        private void accept_Click(object sender, EventArgs e)
        {
            try
            {
            FangpuTerminal.HideInputPanel();
            var mysql = new FangpuDatacenterModelEntities();
            var workerlist = new dailychecklist();
            workerlist.deviceid = Properties.TerminalParameters.Default.terminal_name;
            workerlist.airleak_check = true;
            try
            {
                workerlist.airpressure_check = checkedListBox1.GetItemChecked(0);
                workerlist.gaspressure_check = checkedListBox1.GetItemChecked(1);
                workerlist.airleak_check = checkedListBox1.GetItemChecked(2);
                workerlist.gasleak_check = checkedListBox1.GetItemChecked(3);
                workerlist.belt_check = checkedListBox1.GetItemChecked(4);
                workerlist.furnacecylinder_check = checkedListBox1.GetItemChecked(5);
                workerlist.surfacesensor_check = checkedListBox1.GetItemChecked(6);
                workerlist.demouldcylinder_check = checkedListBox1.GetItemChecked(7);
                workerlist.airtap_check = checkedListBox1.GetItemChecked(8);
                workerlist.ventilator_check = checkedListBox1.GetItemChecked(9);
                workerlist.screen_check = checkedListBox1.GetItemChecked(10);
                workerlist.groundclean_check = checkedListBox1.GetItemChecked(11);
                workerlist.tableclean_check = checkedListBox1.GetItemChecked(12);
                if (zhengchang.Text.Trim() == String.Empty)
                { 
                    workerlist.normal = null;
                }
                else
                { 
                    workerlist.normal = (float)Convert.ToDouble(zhengchang.Text) / 1.0f;
                }
                if (tiaoji.Text.Trim() == String.Empty)
                { 
                    workerlist.debug = null;
                }
                else
                { 
                    workerlist.debug = (float)Convert.ToDouble(tiaoji.Text) / 1.0f;
                }
                if (shengwen.Text.Trim() == String.Empty)
                { 
                    workerlist.tempup = null;
                }
                else
                { 
                    workerlist.tempup = (float)Convert.ToDouble(shengwen.Text) / 1.0f;
                }
                if (ximuju.Text.Trim() == String.Empty)
                { 
                    workerlist.cleanmould = null;
                }
                else
                { 
                    workerlist.cleanmould = (float)Convert.ToDouble(ximuju.Text) / 1.0f;
                }
                if (huanliao.Text.Trim() == String.Empty)
                { 
                    workerlist.changematerial = null;
                }
                else
                { 
                    workerlist.changematerial = (float)Convert.ToDouble(huanliao.Text) / 1.0f;
                }
                if (shebeiguzhang.Text.Trim() == String.Empty)
                { 
                    workerlist.device_error = null;
                }
                else
                { 
                    workerlist.device_error = (float)Convert.ToDouble(shebeiguzhang.Text) / 1.0f;
                }
                if (dailiao.Text.Trim() == String.Empty)
                { 
                    workerlist.wait = null;
                }
                else
                {
                    workerlist.wait = (float)Convert.ToDouble(dailiao.Text) / 1.0f;
                }
                if (qita.Text.Trim() == String.Empty)
                {
                    workerlist.@else = null;
                }
                else
                {
                    workerlist.@else = (float)Convert.ToDouble(qita.Text) / 1.0f;
                }
                if (huanmuju.Text.Trim() == String.Empty)
                {
                    workerlist.changemoud = null;
                }
                else
                {
                    workerlist.changemoud = (float)Convert.ToDouble(huanmuju.Text) / 1.0f;
                }

                workerlist.shift = comboBox1.Text;
                workerlist.checkdate = dateTimePicker1.Value;
                workerlist.name = textBox1.Text;
                workerlist.tablename = textBox2.Text;
                workerlist.procedure = gongyimingcheng.Text;
            }
            catch(Exception ex)
            {
                MessageBox.Show("填写错误!请确认填写时间");
            }
                mysql.dailychecklist.Add(workerlist);
                mysql.SaveChanges();
                MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                
                this.Close();
            }
                 catch(Exception ex)
                 {
                     Trace.WriteLine(ex);
                     MessageBox.Show("上传失败!");
                  }
            this.Close();
        }
        private void accept_Click(object sender, EventArgs e)
        {
            try
            {
                FangpuTerminal.HideInputPanel();
                var mysql      = new FangpuDatacenterModelEntities();
                var workerlist = new fieldchecklist();
                workerlist.deviceid = Properties.TerminalParameters.Default.terminal_name;
                workerlist.sn       = biaodanbianhao.Text;
                workerlist.producer = shengchanzhe.Text;
                workerlist.type     = guige.Text;
                workerlist.datetime = shijian.Text;
                workerlist.material = cailiao.Text;
                if (danzhong.Text.Trim() == String.Empty)
                {
                    workerlist.singleweight = null;
                }
                else
                {
                    workerlist.singleweight = Convert.ToDouble(danzhong.Text);
                }
                if (changdubiaozhun.Text.Trim() == String.Empty)
                {
                    workerlist.standardlength = null;
                }
                else
                {
                    workerlist.standardlength = Convert.ToDouble(changdubiaozhun.Text);
                }
                if (changdushice.Text.Trim() == String.Empty)
                {
                    workerlist.actuallength = null;
                }
                else
                {
                    workerlist.actuallength = Convert.ToDouble(changdushice.Text);
                }
                if (houdubiaozhun.Text.Trim() == String.Empty)
                {
                    workerlist.standardthickness = null;
                }
                else
                {
                    workerlist.standardthickness = Convert.ToDouble(houdubiaozhun.Text);
                }
                if (houdushice.Text.Trim() == String.Empty)
                {
                    workerlist.actualthickness = null;
                }
                else
                {
                    workerlist.actualthickness = Convert.ToDouble(houdushice.Text);
                }
                workerlist.burn         = shaojiao.Checked;
                workerlist.bubble       = qipao.Checked;
                workerlist.irregular    = aotu.Checked;
                workerlist.impurity     = zazhi.Checked;
                workerlist.deformation  = bianxing.Checked;
                workerlist.injure       = tuoshang.Checked;
                workerlist.raw          = bushu.Checked;
                workerlist.band         = hengwen.Checked;
                workerlist.spot         = madian.Checked;
                workerlist.internalfail = neibiaomianhua.Checked;
                workerlist.@double      = shuangceng.Checked;
                workerlist.judge        = shengchanpanduan.Checked;
                workerlist.handle       = chulifangshi.Text;
                workerlist.monitorcheck = banzhangqueren.Text;
                workerlist.name         = jianyan.Text;
                workerlist.datetime2    = dateTimePicker1.Value;
                workerlist.confirm      = queren.Text;

                mysql.fieldchecklist.Add(workerlist);
                mysql.SaveChanges();
                MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            catch
            {
                MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }