Esempio n. 1
0
 private void Form1_Shown(object sender, EventArgs e)
 {
     try
     {
         OPC = new OPCCreate();
     }
     catch
     {
         MessageBox.Show("OPC初始化失败!请检查OPC配置文件或网络是否连通!");
     }
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
 }
Esempio n. 2
0
 public opcService()
 {
     try
     {
         OPC = new OPCCreate();
         OPC.EventDataChanged += new EventDataChanged(OnEventDataChanged);
         OPC.Run();
     }
     catch (Exception ex)
     {
         //Log.ErrLog.Error("OPC Server连接失败:" + ex.Message);
         //MessageBoxEx.Show("OPC Server连接失败,请检查PLC是否正常通讯。");
     }
 }
Esempio n. 3
0
 private void DataConfig_Load(object sender, EventArgs e)
 {
     try
     {
         OPC = new OPCCreate();
         productionType.Text = BussinessFacde.GetConfigXml("ProductionType");
         materialType.Text   = BussinessFacde.GetConfigXml("materialType");
         //写入来料方式
         materialWay.Text = BussinessFacde.GetConfigXml("materialWay");
         //写入物料PN
         materialPn.Text = BussinessFacde.GetConfigXml("materialPn");
         number.Text     = BussinessFacde.GetConfigXml("TodayPlan");
         speed.Text      = BussinessFacde.GetConfigXml("Speed");
     }
     catch
     {
         //关闭窗口
         this.Dispose();
         this.Close();
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 监听OPC,开启业务处理方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pictureBox6_Click(object sender, EventArgs e)
        {
            if (dataGridView3.Rows.Count == 0)
            {
                MessageBox.Show("该产品没有配置流程,请配置流程!");
            }
            else
            {
                #region OPC连接初始化
                try
                {
                    production_No = Convert.ToInt32(CB_ProductionType.SelectedValue.ToString());
                    rework_No = Convert.ToInt32(CB_ReworkCategory.SelectedValue.ToString());
                    tabControl1.SelectTab(0); //切换到第一个页面
                    OPC = new OPCCreate();
                    OPC.EventDataChanged += new EventDataChanged(OnEventDataChanged);
                    OPC.Run();
                    timer1.Enabled = true;
                    recordMessage("OPC Server连接成功!");
                    OPC.WriteItem(8, clsCommon.userName);  //OPC写入登陆员工号
                }
                catch (Exception)
                {
                    MessageBox.Show("OPC Server连接失败,请检查PLC是否正常通讯。");
                    recordMessage("OPC Server连接失败,请检查PLC是否正常通讯。");
                }

                #endregion
            }
        }
Esempio n. 5
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            try
            {
                OPC = new OPCCreate();

            }
            catch
            {
                MessageBox.Show("OPC初始化失败!请检查OPC配置文件或网络是否连通!");
            }
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
        }