/// <summary>
 /// Shutdown the terminal
 /// </summary>
 /// <param name="terminal"></param>
 public static void SystemShutdown(FangpuTerminal terminal)
 {
     terminal.AbortAllThread();
     var startinfo = new ProcessStartInfo("shutdown.exe",
         "-s -t 00");
     TerminalLogWriter.WriteInfoLog(typeof(TerminalCommon), "Terminal is about to shutdown...");
     Process.Start(startinfo);
 }
 /// <summary>
 /// Restart the app
 /// </summary>
 /// <param name="terminal"></param>
 public static void AppRestart(FangpuTerminal terminal)
 {
     terminal.AbortAllThread();
     terminal.restartbutton = true;
     TerminalLogWriter.WriteInfoLog(typeof(TerminalCommon), "Application is about to restart...");
     Application.ExitThread();
     Application.Restart();
 }
Ejemplo n.º 3
0
        public void HaltReasonUpload()
        {
            bool firsttry = true;

            while (true)
            {
                try
                {
                    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;
                    using (var mysql = FluentNhibernateHelper.GetSession())
                    {
                        mysql.Save(haltinfo);
                        mysql.Flush();
                    }
                    FangpuTerminal.HaltUI updateUI = new FangpuTerminal.HaltUI(updateui);
                    FangpuTerminal.BeginInvoke(updateUI);
                    try
                    {
                        TextCommand.DeleteFile("haltinfo.txt");
                    }
                    catch (Exception ex)
                    {
                        TerminalLogWriter.WriteErroLog(typeof(stoptable), "上传失败");
                    }
                    break;
                }
                catch
                {
                    if (firsttry == true)
                    {
                        MessageBox.Show("停机信息上传失败!\n与数据中心连接出错!请稍后重试", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    firsttry = false;
                    FangpuTerminal.log.Error("停机原因存储出错");
                }
            }
        }
Ejemplo n.º 4
0
        private void accept_Click(object sender, EventArgs e)
        {
            try
            {
                FangpuTerminal.HideInputPanel();
                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("填写错误!请确认填写时间");
                }
                using (var mysql = FluentNhibernateHelper.GetSession())
                {
                    mysql.Save(workerlist);
                    mysql.Flush();
                    MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                TerminalLogWriter.WriteErroLog(typeof(Dailycheck), "日常点检表上传失败", ex);
                MessageBox.Show("上传失败!");
            }
            this.Close();
        }
Ejemplo n.º 5
0
 private void accept_Click(object sender, EventArgs e)
 {
     try
     {
         FangpuTerminal.HideInputPanel();
         using (var mysql = FluentNhibernateHelper.GetSession())
         {
             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.Save(workerlist);
             mysql.Flush();
             MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
     }
     catch (Exception ex)
     {
         TerminalLogWriter.WriteErroLog(typeof(Fieldcheck), "现场点检表上传失败", ex);
         MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }