Beispiel #1
0
        private void Frm_Input_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists("C:\\SFIS"))
            {
                Directory.CreateDirectory("C:\\SFIS");
            }
            string _StrErr = string.Empty;

            chkver = new WebServices.Check_Version.Check_Version();
            if (!chkver.CheckPrgVsersion("TEST_INPUT", this.ProductVersion, null, null, null, out _StrErr))
            {
                if (_StrErr == "OK")
                {
                    SendPrgMsg(Color.Red, "该程序为版本不是最新版\r\n请更新后运行");
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", "ISCM.exe");
                }
                else
                {
                    SendPrgMsg(Color.Red, "检查版本失败:" + _StrErr);
                }
                this.Enabled = false;
            }

            Initialization = new InitializationPrg(InitializationInfo);
            Initialization.BeginInvoke(null, null);
        }
Beispiel #2
0
        private void SFIS_DCT_INPUT_Load(object sender, EventArgs e)
        {
            string C_RES = string.Empty;

            try
            {
                if (!Directory.Exists("C:\\SFIS"))
                {
                    Directory.CreateDirectory("C:\\SFIS");
                }
                C_RES  = "检查程序版本方法连接失败";
                chkver = new WebServices.Check_Version.Check_Version();
                if (!chkver.CheckPrgVsersion("SFIS_DCT_INPUT", this.ProductVersion, null, null, null))
                {
                    SendPrgMsg(mLogMsgType.Error, "该程序为版本不是最新版\r\n请更新后运行");
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", "ISCM.exe");
                    this.Enabled = false;
                }
                lbl = new ApplicationClass();
                SendPrgMsg(mLogMsgType.Incoming, "初始化CodeSoft成功");
                Initialization = new InitializationPrg(InitializationInfo);
                Initialization.BeginInvoke(null, null);
                txt_userid.Enabled = false;
                txt_sn.Enabled     = false;
                txt_kpsn.Enabled   = false;
            }
            catch
            {
                SendPrgMsg(mLogMsgType.Error, C_RES);
            }
        }
Beispiel #3
0
        private void Frm_Rework_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists("C:\\SFIS"))
            {
                Directory.CreateDirectory("C:\\SFIS");
            }

            string FilePatch = System.Environment.CurrentDirectory + "\\SFIS_ISCM.ini";

            LoadDefaultData();
            string _StrErr = string.Empty;

            if (!chkver.CheckPrgVsersion("ReworkInput", this.ProductVersion, null, null, null, out _StrErr))
            {
                if (_StrErr == "OK")
                {
                    SendPrgMsg(mLogMsgType.Error, "该程序为版本不是最新版\r\n请更新后运行");
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", "ISCM.exe");
                }
                else
                {
                    SendPrgMsg(mLogMsgType.Error, "检查版本失败:" + _StrErr);
                }

                this.Enabled = false;
            }

            LabLine.Text = string.Empty;
            LabLine.Text = Encoder.Encoder.DecryptString(Encoder.ReadIniFile.IniReadValue("ReworkInput", "LINE", IniFilePath));
        }
Beispiel #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (!Directory.Exists("C:\\SFIS"))
            {
                Directory.CreateDirectory("C:\\SFIS");
            }

            FileVersionInfo myFileVersion = FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath);

            this.Text = string.Format("SMT_STOCKIN Version:{0} (Build Date:{1})", myFileVersion.FileVersion, System.IO.File.GetLastWriteTime(Application.ExecutablePath).ToShortDateString());

            if (!chkver.CheckPrgVsersion("SMT_STOCKIN", System.Windows.Forms.Application.ProductVersion, null, null, null))
            {
                RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", appfilename);
                MessageBox.Show("该程序为版本不是最新版\r\n请更新后运行");
                string    FileName = System.IO.Path.GetFileName(System.Windows.Forms.Application.ExecutablePath);
                Process[] prc      = Process.GetProcessesByName(FileName.Substring(0, FileName.LastIndexOf('.')));
                if (prc.Length > 0)
                {
                    foreach (Process pc in prc)
                    {
                        pc.Kill();
                    }
                }
                return;
            }

            // LabLine.Text = Encoder.Encoder.DecryptString(Encoder.ReadIniFile.IniReadValue("SMT_STOCKIN", "LINE", IniFilePath));
            LabLine.Text = OperateINI.IniReadValue("SMT_STOCKIN", "LINE", IniFilePath);
            // oDB.ConnDB();
            UserLogin ul = new UserLogin(this);

            if (ul.ShowDialog() == DialogResult.OK)
            {
                LabUser.Text = userId;
                //cb_line.Items.Clear();
                //List<string> LsLine = oDB.Get_Line_Info();
                //foreach (string item in LsLine)
                //{
                //    cb_line.Items.Add(item);
                //}
                //cb_line.SelectedIndex = 0;
                Check_woId_Data();
            }
            else
            {
                this.Close();
            }
        }
Beispiel #5
0
        private void Frm_BoxPrint_Load(object sender, EventArgs e)
        {
            if (!ChkSoftInstall("CODESOFT 7"))
            {
                MessageBoxEx.Show("本机没有安装Codesoft 7 不能使用");
                this.Enabled = false;
                return;
            }

            if (!Directory.Exists("C:\\SFIS"))
            {
                Directory.CreateDirectory("C:\\SFIS");
            }

            FileVersionInfo myFileVersion = FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath);

            this.groupBox1.Text += string.Format("(Version: {0})", myFileVersion.FileVersion);
            string _StrErr = string.Empty;

            chkver = new WebServices.Check_Version.Check_Version();
            if (!chkver.CheckPrgVsersion("BOX_PRINT", this.ProductVersion, null, null, null, out _StrErr))
            {
                if (_StrErr == "OK")
                {
                    SendMsg(mLogMsgType.Error, "该程序为版本不是最新版\r\n请更新后运行");
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", "ISCM.exe");
                }
                else
                {
                    SendMsg(mLogMsgType.Error, "检查版本失败:" + _StrErr);
                }
                this.Enabled = false;
            }

            IniPrg = new IntPrgConfig(IniPrgConfigInfo);
            IniPrg.BeginInvoke(null, null);

            tb_Input.Enabled = false;
            tb_wo.Focus();
            string filePath = System.Environment.CurrentDirectory + "\\SFIS_ISCM.ini";

            LabDir     = ReadIniFile.IniReadValue("BoxPrint", "Patch", filePath);
            NumX.Value = Convert.ToInt16(ReadIniFile.IniReadValue("BoxPrint", "X", filePath));
            NumY.Value = Convert.ToInt16(ReadIniFile.IniReadValue("BoxPrint", "Y", filePath));

            LabLine.Text = string.Empty;
            LabLine.Text = Encoder.Encoder.DecryptString(Encoder.ReadIniFile.IniReadValue("BOX_PRINT", "LINE", IniFilePath));
        }
Beispiel #6
0
        private void Frm_TEST_INPUT_Load(object sender, EventArgs e)
        {
            chkver = new WebServices.Check_Version.Check_Version();
            string _StrErr = string.Empty;

            if (!chkver.CheckPrgVsersion("TEST_INPUT", this.ProductVersion, null, null, null, out _StrErr))
            {
                if (_StrErr == "OK")
                {
                    MessageBox.Show("该程序为版本不是最新版\r\n请更新后运行");
                    this.Enabled = false;
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", appfilename);
                }
                else
                {
                    MessageBox.Show("检查版本发生异常:" + _StrErr, "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                string    FileName = System.IO.Path.GetFileName(System.Windows.Forms.Application.ExecutablePath);
                Process[] prc      = Process.GetProcessesByName(FileName.Substring(0, FileName.LastIndexOf('.')));
                if (prc.Length > 0)
                {
                    foreach (Process pc in prc)
                    {
                        pc.Kill();
                    }
                }
                return;
            }


            this.Text = "PHICOMM TEST_INPUT " + this.ProductVersion;
            //System.DateTime d1 = System.DateTime.Parse("2015/07/30");
            //System.DateTime d2 = System.DateTime.Now;
            //System.TimeSpan ts = d1 - d2;
            //if (ts.Days <= 0)
            //{
            //    MessageBox.Show("试用时间超出,请联系系统开发人员");
            //    this.Close();
            //    return;
            //}

            Initialization = new InitializationPrg(InitializationInfo);
            Initialization.BeginInvoke(null, null);
            tb_Input.Focus();
        }
Beispiel #7
0
        private void SFIS_DCT_V2_Load(object sender, EventArgs e)
        {
            chkver = new WebServices.Check_Version.Check_Version();
            string _StrErr = string.Empty;

            if (!chkver.CheckPrgVsersion("SFIS_DCT_V3", Application.ProductVersion, null, null, null, out _StrErr))
            {
                if (_StrErr == "OK")
                {
                    MessageBox.Show("该程序为版本不是最新版\r\n请更新后运行");
                    RunFile(System.Windows.Forms.Application.StartupPath + @"\", "AutoUpdate.exe", appfilename);
                }
                else
                {
                    MessageBox.Show("检查程序版本异常\r\n " + _StrErr);
                }
                string    FileName = System.IO.Path.GetFileName(Application.ExecutablePath);
                Process[] prc      = Process.GetProcessesByName(FileName.Substring(0, FileName.LastIndexOf('.')));
                if (prc.Length > 0)
                {
                    foreach (Process pc in prc)
                    {
                        pc.Kill();
                    }
                }

                return;
            }

            this.Text              = "SFIS_DCT_V3  Version: " + Application.ProductVersion;
            tbMessage.Text         = "正在初始......";
            this.PalConfig.Enabled = true;
            this.PalData.Enabled   = true;
            Initialization         = new InitializationPrg(InitializationInfo);
            Initialization.BeginInvoke(null, null);

            AutoRun.Interval = 100;
            AutoRun.Enabled  = false;
            AutoRun.Tick    += new EventHandler(AutoRun_Tick);
            btsetup.Enabled  = false;


            string filePath        = System.Environment.CurrentDirectory + "\\SFIS_DCT.ini";
            string _Port           = ReadIniFile.IniReadValue("DATABASE", "myport", filePath);
            string _BaudRate       = ReadIniFile.IniReadValue("DATABASE", "BaudRate", filePath);
            string _DataBits       = ReadIniFile.IniReadValue("DATABASE", "DataBits", filePath);
            string _Parity         = ReadIniFile.IniReadValue("DATABASE", "Parity", filePath);
            string _StopBits       = ReadIniFile.IniReadValue("DATABASE", "StopBits", filePath);
            string _ReadBufferSize = ReadIniFile.IniReadValue("DATABASE", "ReadBufferSize", filePath);

            LabDir = ReadIniFile.IniReadValue("LABEL", "Patch", filePath);
            try
            {
                sPort                = new System.IO.Ports.SerialPort();
                sPort.PortName       = "COM" + _Port;
                sPort.BaudRate       = int.Parse(_BaudRate);                              //串口通信波特率19200
                sPort.ReadBufferSize = int.Parse(_ReadBufferSize);
                sPort.DataBits       = int.Parse(_DataBits);                              //数据位 8
                sPort.Parity         = (Parity)Enum.Parse(typeof(Parity), _Parity);       //奇偶校验0
                sPort.StopBits       = (StopBits)Enum.Parse(typeof(StopBits), _StopBits); //System.IO.Ports.StopBits.One;//停止位
                sPort.ReadTimeout    = 1000;                                              //读超时
                sPort.WriteTimeout   = 1000;
                sPort.DataReceived  += new System.IO.Ports.SerialDataReceivedEventHandler(sPort_DataReceived);
                sPort.Open();
                comstatus.Text = "COM OK";
                PortFlag       = true;
            }
            catch
            {
                comstatus.Text = "COM FAIL";
                PortFlag       = false;
            }
        }