Ejemplo n.º 1
0
        private void UpdateLED()
        {
            int value = DiValue;
            int tmp   = DiValue / getPCL730in(int.Parse(Public.GetXmlValue("PCLInterface")));//取整

            value = int.Parse(tmp.ToString());

            int LedStatus = value % 2;//取余

            if (LedStatus == 1)
            {
                SetLampStatus(false, lampUp);
            }
            else
            {
                SetLampStatus(true, lampUp);
            }
            tmp   = DiValue / getPCL730in(int.Parse(Public.GetXmlValue("PCLInterfaceX")));
            value = int.Parse(tmp.ToString());
            int LedStatuss = value % 2;

            if (LedStatuss == 1)
            {
                SetLampStatus(false, lampDown);
            }
            else
            {
                SetLampStatus(true, lampDown);
            }
        }
Ejemplo n.º 2
0
 private void GetCKCS()
 {
     star         = int.Parse(Public.GetXmlValue("DataStar").ToString());
     end          = int.Parse(Public.GetXmlValue("DataEnd").ToString());
     dataLength   = int.Parse(Public.GetXmlValue("DataLen")); //取数总长度
     strStartChar = Public.GetXmlValue("DataStarChar");       //字符串开始长度
     qsjg         = int.Parse(Public.GetXmlValue("QSJG"));    //从串口取数时间间隔
 }
Ejemplo n.º 3
0
        private void s_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            try
            {
                if (s.BytesToRead <= 0)
                {
                    return;
                }
                //txtError.Text += s.ReadExisting();
                int    star       = int.Parse(Public.GetXmlValue("DataStar"));
                int    end        = int.Parse(Public.GetXmlValue("DataEnd"));
                string startChar  = Public.GetXmlValue("DataStarChar");
                int    dataLength = int.Parse(Public.GetXmlValue("DataLen"));

                System.Threading.Thread.Sleep(int.Parse(nudqsjg.Value.ToString()));
                Control.CheckForIllegalCrossThreadCalls = false;
                string ss = s.ReadExisting();
                if (checkBox1.Checked)
                {
                    int startInt = ss.IndexOf(startChar);
                    // SetTwoShow(ss);
                    SetTextView("STARTCHAR:" + startChar + " LENGTH:" + dataLength.ToString() + " From:" + star.ToString() + " ALL:" + ss);
                }
                if (checkBox2.Checked)
                {
                    int    startInt = ss.IndexOf(startChar);
                    string jqStar   = ss.Substring(startInt, dataLength);
                    SetTextView(" StartJQ:" + startInt.ToString() + " FirstSplit:" + jqStar);
                    //ss = ss.Substring(startInt, end - star);
                    ss = jqStar.Substring(star, end - star);
                    SetTextView("SPLIT:" + ss.ToString());
                    ss = int.Parse(ss).ToString();
                    if (ss != ssold)
                    {
                        SetLampStatus(false, lampZero);
                        zerocs = 0;
                    }
                    else
                    {
                        zerocs = zerocs + 1;
                        if (zerocs >= nujh.Value)
                        {
                            SetLampStatus(true, lampZero);
                        }
                        else
                        {
                            SetLampStatus(false, lampZero);
                        }
                    }
                    ssold             = int.Parse(ss).ToString();
                    txtTestvalue.Text = ss;
                }
            }
            catch (Exception ex)
            {
                //txtError.Text += ex.Message + Environment.NewLine;
            }
        }
Ejemplo n.º 4
0
        private void frmPCLSet_Load(object sender, EventArgs e)
        {
            lampUp.DisabledGradient.Top      = Color.White;
            lampUp.DisabledGradient.Bottom   = Color.White;
            lampDown.DisabledGradient.Top    = Color.White;
            lampDown.DisabledGradient.Bottom = Color.White;
            string port   = Public.GetXmlValue("PCLPort");
            string rdport = "rdport" + port;

            Control[]   rds = groupBox1.Controls.Find(rdport, false);
            RadioButton rd  = (RadioButton)rds[0];

            rd.Checked = true;

            string rdupv   = Public.GetXmlValue("PCLInterface");
            string rdupstr = "rd" + rdupv;

            Control[]   rdups = groupBox2.Controls.Find(rdupstr, false);
            RadioButton rdup  = (RadioButton)rdups[0];

            rdup.Checked = true;

            string rddownv   = Public.GetXmlValue("PCLInterfaceX");
            string rddownstr = "rdx" + rddownv;

            Control[]   rddowns = groupBox3.Controls.Find(rddownstr, false);
            RadioButton rddown  = (RadioButton)rddowns[0];

            rddown.Checked = true;

            timeup.Interval = 300;

            string xType = Public.GetXmlValue("type");

            for (int i = 0; i < this.comType.Items.Count; i++)
            {
                if (this.comType.Items[i].ToString() == xType)
                {
                    this.comType.SelectedIndex = i;
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        private void listmodule()
        {
            dgvm.Rows.Clear();
            dgv.Rows.Clear();
            string PrintModule = Public.GetXmlValue("PrintModuleName");

            if (PrintModule == "")
            {
                PrintModule = "标准模板";
            }
            string[] tl = null;
            tl = ListDirs(Application.StartupPath + "\\report");
            foreach (string s in tl)
            {
                string isck = "false";
                if (PrintModule == s)
                {
                    isck = "true";
                }
                string[] r = { s, isck };
                dgvm.Rows.Add(r);
            }
            dgvm.Rows[0].Selected = true;
        }
Ejemplo n.º 6
0
        private void printpq(string ph, string gg, string pch, string jz, string rq, string bb, string gh, string bz, string xlh, string tm, string sx, string pcxx, bool ckflg, string itype, string wlh, string heatid, string liaohao)
        {
            string  scriptstr = "";
            DataSet ds        = null;
            string  sqlstr    = "";
            Boolean nocheck   = false;
            string  printmodual;
            string  stpath;
            string  bzstr;
            string  tct;
            string  SX = cmbsx.Text;

            //if (SX == "") return;
            printmodual = Public.GetXmlValue("PrintModuleName");
            if (printmodual == "")
            {
                printmodual = "标准模板";
            }
            stpath = Application.StartupPath + "\\report\\" + printmodual + "\\";
            if (!Directory.Exists(stpath))
            {
                MessageBox.Show("标签模板不存在!", "系统提示");
                return;
            }
            if ((SX == "B2") || (SX == "C2"))
            {
                nocheck = false;
            }
            else
            {
                nocheck = true;
            }
            scriptstr = "begin" + "\r\n";
            if (SX == "CK")
            {
                Report.LoadReportFromFile(stpath + "ckcz.fr3");
                scriptstr += "memspec.Text:='" + pcxx + "';";
                if (PrintPCInfoCheckBox.Checked)
                {
                    scriptstr += "memspec.visible:=true;";
                }
                else
                {
                    scriptstr += "memspec.visible:=false;";
                }
            }
            else
            {
                switch (itype)
                {
                case "1":
                    Report.LoadReportFromFile(stpath + "ptcz1.fr3");
                    break;

                case "2":
                    Report.LoadReportFromFile(stpath + "ptcz2.fr3");
                    scriptstr += "memosx.text:='" + sx.Substring(0, 3) + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memosx.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memosx.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;

                case "3":
                    Report.LoadReportFromFile(stpath + "ptcz3.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                    }
                    break;

                case "4":
                    Report.LoadReportFromFile(stpath + "ptcz4.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;
                }
            }
            scriptstr += "Barcode1.text:='" + tm + "';";
            scriptstr += "memoph.text:='" + ph + "';";
            scriptstr += "memogg.text:='" + gg + "';";
            scriptstr += "memopch.text:='" + pch + "';";
            //scriptstr += "memojhzt.text:='" + getjhzt(wlh) + "';";
            double fjz = Math.Round(float.Parse(jz) * 1000, 1);

            scriptstr += "memojz.text:='" + fjz.ToString() + " kg';";
            scriptstr += "memorq.text:='" + rq + "';";
            scriptstr += "memogh.text:='" + gh + "';";
            //string bbtemp = "";
            //if (bb == "甲班") bbtemp = "A";
            //if (bb == "乙班") bbtemp = "B";
            //if (bb == "丙班") bbtemp = "C";
            //if (bb == "丁班") bbtemp = "D";
            //scriptstr += "memobb.text:='" + bbtemp + "';";

            if (liaohao != "")
            {
                string sql = " SELECT invinfo.WGDH FROM WMS_Bms_Inv_Info AS invinfo LEFT OUTER JOIN WMS_Bms_Rec_WGD AS wgd ON invinfo.PCH = wgd.PCH WHERE (invinfo.WLH = wgd.YWLH) AND (invinfo.vfree1 = wgd.vfree1) AND ";

                sql += "  (wgd.yvfree1 = wgd.vfree1) AND (invinfo.vfree2 = wgd.vfree2) AND  (wgd.yvfree2 = wgd.vfree2) AND (invinfo.vfree3 = wgd.vfree3) AND (wgd.yvfree3 = wgd.vfree3) AND (invinfo.SX IN ('AAA', 'AA', 'A', 'CK')) AND ";
                sql += " invinfo.barcode='" + lbbarcode.Text.Trim() + "'";
                DataSet dstable = DbEntry.Context.ExecuteDataset(sql);
                if ((dstable == null) || (dstable.Tables.Count == 0) || dstable.Tables[0].Rows.Count == 0)
                {
                    liaohao = "";
                }
            }

            if (liaohao != "")
            {
                scriptstr += "Memliao.text:='" + liaohao + "';";
                scriptstr += "Memliao.visible:=true;";
                scriptstr += "memliao1.visible:=true;";
                scriptstr += "Lineliao.visible:=true;";
            }

            //修改添加 炉次 删除班别
            scriptstr += "memobb.text:='" + heatid + "';";


            if (SX != "CK")
            {
                string bzstrf = "";
                bzstrf     = bz.Substring(bz.IndexOf('~') + 1);
                scriptstr += "memobz.text:='" + bzstrf + "';";
            }
            else
            {
                scriptstr += "memoxlh.text:='" + xlh + "';";
            }
            scriptstr        += "memowlh.text:='" + wlh.Substring(0, 3) + "';";
            scriptstr        += "end.";
            Report.ScriptText = scriptstr;

            Report.PrepareReport(true);



            int con = 2;

            Report.PrintOptions.ShowDialog = false;
            Report.PrintOptions.Copies     = con;

            try
            {
                Report.PrintReport();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("打印错误:" + ex.Message + ".请补打!");
            }
        }
Ejemplo n.º 7
0
        private void printpq(string barcode, string strJz)
        {
            string scriptstr = "";
            string ph, gg, pch, jz, rq, bb, gh, bz, xlh, tm, ckcxh, sx, pcxx, bzstr, bbtemp, printmodual, stpath, tct, wlh;
            bool   ckflg, nocheck;
            int    iType;

            if (chkTSXX.Checked)
            {
                if (chkCPDJ.Checked)
                {
                    iType = 4;
                }
                else
                {
                    iType = 3;
                }
            }
            else
            {
                if (chkCPDJ.Checked)
                {
                    iType = 2;
                }
                else
                {
                    iType = 1;
                }
            }
            printmodual = Public.GetXmlValue("PrintModuleName");
            if (printmodual == "")
            {
                printmodual = "标准模板";
            }
            stpath = Application.StartupPath + "\\report\\" + printmodual + "\\";
            if (!Directory.Exists(stpath))
            {
                MessageBox.Show("标签模板不存在!", "系统提示");
                return;
            }



            string  strSql = "select * from " + tablename + " where barcode='" + barcode.Trim() + "'";
            DataSet ds     = DbEntry.Context.ExecuteDataset(strSql);

            ph   = ds.Tables[0].Rows[0]["PH"].ToString();
            gg   = ds.Tables[0].Rows[0]["GG"].ToString();
            pch  = ds.Tables[0].Rows[0]["PCH"].ToString();
            jz   = strJz;
            rq   = ds.Tables[0].Rows[0]["ProduceData"].ToString();
            bb   = ds.Tables[0].Rows[0]["bb"].ToString();
            pcxx = ds.Tables[0].Rows[0]["pcinfo"].ToString();
            gh   = Convert.ToInt32(ds.Tables[0].Rows[0]["gh"]).ToString().PadLeft(2, '0');
            sx   = ds.Tables[0].Rows[0]["SX"].ToString();
            if (sx.ToUpper() == "CK")
            {
                bz = ds.Tables[0].Rows[0]["GH"].ToString().PadLeft(2, '0');
            }
            else
            {
                bz = ds.Tables[0].Rows[0]["bz"].ToString();
            }
            xlh   = this.txtLSH.Text;
            tm    = barcode;
            wlh   = ds.Tables[0].Rows[0]["wlh"].ToString();
            ckcxh = ds.Tables[0].Rows[0]["ckcxh"].ToString();

            if ((sx == "B2") || (sx == "C2"))
            {
                nocheck = false;
            }
            else
            {
                nocheck = true;
            }

            TfrxReportClass Report = new TfrxReportClass();

            scriptstr = "begin" + "\r\n";
            if (sx == "CK")
            {
                Report.LoadReportFromFile(stpath + "ckcz.fr3");
                scriptstr += "memspec.Text:='" + pcxx + "';";
                if (this.chkTSXX.Checked)
                {
                    scriptstr += "memspec.visible:=true;";
                }
                else
                {
                    scriptstr += "memspec.visible:=false;";
                }
            }
            else
            {
                switch (iType)
                {
                case 1:
                    Report.LoadReportFromFile(stpath + "ptcz1.fr3");
                    break;

                case 2:
                    Report.LoadReportFromFile(stpath + "ptcz2.fr3");
                    scriptstr += "memosx.text:='" + sx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memosx.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memosx.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;

                case 3:
                    Report.LoadReportFromFile(stpath + "ptcz3.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                    }
                    break;

                case 4:
                    Report.LoadReportFromFile(stpath + "ptcz4.fr3");
                    scriptstr += "memopcinfo.text:='" + pcxx + "';";
                    if (!nocheck)
                    {
                        scriptstr += "memopcinfo.visible:=false;";
                        scriptstr += "Shape1.visible:=false;";
                    }
                    else
                    {
                        scriptstr += "memopcinfo.visible:=true;";
                        scriptstr += "Shape1.visible:=true;";
                    }
                    break;
                }
            }

            scriptstr += "Barcode1.text:='" + tm + "';";
            scriptstr += "memoph.text:='" + ph + "';";
            scriptstr += "memogg.text:='" + gg + "';";
            scriptstr += "memopch.text:='" + pch + "';";
            double fjz = Convert.ToDouble(jz);;

            scriptstr += "memojz.text:='" + fjz.ToString() + " kg';";
            scriptstr += "memorq.text:='" + rq + "';";
            scriptstr += "memogh.text:='" + gh + "';";
            //bbtemp = "";
            //if (bb == "甲班") bbtemp = "A";
            //if (bb == "乙班") bbtemp = "B";
            //if (bb == "丙班") bbtemp = "C";
            //if (bb == "丁班") bbtemp = "D";
            //scriptstr += "memobb.text:='" + bbtemp + "';";

            //如果炉号为空,则再次查询nc
            if (txtheatid.Text.Trim() == "")
            {
                string loadSql = "";
                loadSql += "select mm_wr_b.pch,getbilletbatchcode(mm_wr_b.pch) billet_heat_number,";
                loadSql += " mm_po.xsddh customer_material_number";
                loadSql += " from mm_wr_b mm_wr_b, mm_mo mm_mo, mm_mosource mm_mosource, mm_po mm_po";
                loadSql += "  where mm_wr_b.scddid = mm_mo.pk_moid and mm_mo.pk_moid = mm_mosource.scddid";
                loadSql += "  and mm_mosource.lyid = mm_po.pk_poid  and mm_po.pk_corp = '1001'";
                loadSql += " and mm_po.dr = 0  and mm_mosource.pk_corp = '1001' and mm_mosource.dr = 0 ";
                loadSql += "  and mm_mo.pk_corp = '1001' and mm_mo.dr = 0 and mm_wr_b.pk_corp = '1001'";
                loadSql += "  and mm_wr_b.dr = 0  and mm_wr_b.pch = '" + pch + "'";
                //OracleConnection conn = new OracleConnection("Data Source=192.168.2.221/orcl;User ID=nctest;Password=nctest;");

                //OracleConnection conn = new OracleConnection("Data Source=nctest;User ID=nctest;Password=nctest;");
                OracleConnection conn = new OracleConnection("Data Source=ncv5;User ID=xgerp50;Password=xgerp204212350;");
                conn.Open();
                OracleCommand selectCmd = conn.CreateCommand();
                selectCmd.CommandText = loadSql;
                // selectCmd.BindByName = true;

                OracleDataAdapter oradap = new OracleDataAdapter(selectCmd);
                DataSet           ds1    = new DataSet();
                oradap.Fill(ds1);
                conn.Close();
                if (ds1 == null || ds1.Tables.Count == 0 || ds1.Tables[0].Rows.Count == 0)
                {
                }
                else
                {
                    txtheatid.Text   = ds1.Tables[0].Rows[0]["billet_heat_number"].ToString();
                    txtGgHeatid.Text = ds1.Tables[0].Rows[0]["billet_heat_number"].ToString();
                    txtliaohao.Text  = ds1.Tables[0].Rows[0]["customer_material_number"].ToString();
                }
            }


            //库内补打 料号判断  异常情况料号置空
            if ((txtliaohao.Text.ToString().Trim() != "") && (tablename == "WMS_Bms_Inv_Info"))
            {
                string sql = " SELECT invinfo.WGDH FROM WMS_Bms_Inv_Info AS invinfo LEFT OUTER JOIN WMS_Bms_Rec_WGD AS wgd ON invinfo.PCH = wgd.PCH WHERE (invinfo.WLH = wgd.YWLH) AND (invinfo.vfree1 = wgd.vfree1) AND ";

                sql += "  (wgd.yvfree1 = wgd.vfree1) AND (invinfo.vfree2 = wgd.vfree2) AND  (wgd.yvfree2 = wgd.vfree2) AND (invinfo.vfree3 = wgd.vfree3) AND (wgd.yvfree3 = wgd.vfree3) AND (invinfo.SX IN ('AAA', 'AA', 'A', 'CK')) AND ";
                sql += " invinfo.barcode='" + barcode.Trim() + "'";
                DataSet dstable = DbEntry.Context.ExecuteDataset(sql);
                if ((dstable == null) || (dstable.Tables.Count == 0) || dstable.Tables[0].Rows.Count == 0)
                {
                    txtliaohao.Text = "";
                }
            }

            if (txtliaohao.Text.ToString().Trim() != "")
            {
                scriptstr += "Memliao.text:='" + txtliaohao.Text.ToString().Trim() + "';";
                scriptstr += "Memliao.visible:=true;";
                scriptstr += "memliao1.visible:=true;";
                scriptstr += "Lineliao.visible:=true;";
            }

            //修改添加 炉次 删除班别
            scriptstr += "memobb.text:='" + txtheatid.Text.ToString().Trim() + "';";


            if (sx != "CK")
            {
                string bzstrf = "";
                bzstrf     = bz.Substring(bz.IndexOf('~') + 1);
                scriptstr += "memobz.text:='" + bzstrf + "';";
            }
            else
            {
                scriptstr += "memoxlh.text:='" + xlh + "';";
            }
            scriptstr        += "memowlh.text:='" + wlh.Substring(0, 3) + "';";
            scriptstr        += "end.";
            Report.ScriptText = scriptstr;
            Report.PrepareReport(true);
            int con = 2;

            if (this.numTxt.Value > 0)
            {
                con = int.Parse(numTxt.Value.ToString());
            }
            Report.PrintOptions.ShowDialog = false;
            Report.PrintOptions.Copies     = con;
            try
            {
                if (this.chkBowse.Checked)
                {
                    Report.ShowReport();
                }
                else
                {
                    Report.PrintReport();
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("打印错误:" + ex.Message + ".请补打!");
            }
        }
Ejemplo n.º 8
0
        private void frmComSet_Load(object sender, EventArgs e)
        {
            cmbCom.SelectedIndex      = cmbCom.Items.IndexOf(Public.GetXmlValue("port"));
            cmbStopBits.SelectedIndex = cmbStopBits.Items.IndexOf(Public.GetXmlValue("StopBits"));
            cmbparity.SelectedIndex   = cmbparity.Items.IndexOf(Public.GetXmlValue("Parity"));
            txtDataBits.Text          = Public.GetXmlValue("ByteSize");
            txtbaudRate.Text          = Public.GetXmlValue("baudrate");

            cmbHandShake.SelectedIndex = cmbHandShake.Items.IndexOf(Public.GetXmlValue("HandShake"));
            cmbRtsEnable.SelectedIndex = cmbRtsEnable.Items.IndexOf(Public.GetXmlValue("RtsEnable"));
            cmbDtrEnable.SelectedIndex = cmbDtrEnable.Items.IndexOf(Public.GetXmlValue("DtrEnable"));
            if (Public.GetXmlNodeAttr("HandShake", "isuse") == "Y")
            {
                ckHandShake.Checked = true;
            }
            else
            {
                ckHandShake.Checked = false;
            }
            if (Public.GetXmlNodeAttr("RtsEnable", "isuse") == "Y")
            {
                ckRtsEnable.Checked = true;
            }
            else
            {
                ckRtsEnable.Checked = false;
            }
            if (Public.GetXmlNodeAttr("DtrEnable", "isuse") == "Y")
            {
                ckDtrEnable.Checked = true;
            }
            else
            {
                ckDtrEnable.Checked = false;
            }
            txtdatas.Text = Public.GetXmlValue("DataStar");
            if (Public.GetXmlNodeAttr("DataStar", "isuse") == "Y")
            {
                ckdatas.Checked = true;
            }
            else
            {
                ckdatas.Checked = false;
            }
            txtdatae.Text = Public.GetXmlValue("DataEnd");
            if (Public.GetXmlNodeAttr("DataEnd", "isuse") == "Y")
            {
                ckdatae.Checked = true;
            }
            else
            {
                ckdatae.Checked = false;
            }
            txtdataChars.Text = Public.GetXmlValue("DataStarChar");
            if (Public.GetXmlNodeAttr("DataEnd", "isuse") == "Y")
            {
                ckdataChars.Checked = true;
            }
            else
            {
                ckdataChars.Checked = false;
            }
            txtdataChare.Text = Public.GetXmlValue("DataEndChar");
            if (Public.GetXmlNodeAttr("DataEndChar", "isuse") == "Y")
            {
                ckdataChare.Checked = true;
            }
            else
            {
                ckdataChare.Checked = false;
            }
            txtpoint.Text = Public.GetXmlValue("Pointwz");
            if (Public.GetXmlNodeAttr("DataEndChar", "isuse") == "Y")
            {
                ckpoint.Checked = true;
            }
            else
            {
                ckpoint.Checked = false;
            }
            txtdatalen.Text = Public.GetXmlValue("DataLen");
            if (Public.GetXmlNodeAttr("DataEndChar", "isuse") == "Y")
            {
                ckdatalen.Checked = true;
            }
            else
            {
                ckdatalen.Checked = false;
            }

            pointwz       = int.Parse(Public.GetXmlValue("Pointwz"));
            nujh.Value    = int.Parse(Public.GetXmlValue("JHCS"));
            nudqsjg.Value = int.Parse(Public.GetXmlValue("QSJG"));
            jhcs          = int.Parse(Public.GetXmlValue("JHCS"));
        }
Ejemplo n.º 9
0
        private void timeupEx()
        {
            if (bOpen)
            {
                int errcode = Advantech.Digital_ReadByteFromPort(DeviceHandle, short.Parse(Public.GetXmlValue("PCLPort")), out DiValue);

                UpdateLED();
            }
        }
Ejemplo n.º 10
0
        private bool getPCLA()
        {
            bool   ret        = false;
            short  MaxEntries = 9;
            int    i;
            int    ii;
            string tempStr;
            int    tempNum;

            try
            {
                int errcode = Advantech.GetDeviceList(out devlistarray, ref outEntries);
                if (errcode != 0)
                {
                    MessageBox.Show("获取设备列表失败,错误代码:" + errcode.ToString());
                }
                else
                {
                    errcode = Advantech.DRV_DeviceGetNumOfList(ref MaxEntries);
                    if (errcode != 0)
                    {
                        MessageBox.Show("获取设备数,错误代码:" + errcode.ToString());
                    }
                    else
                    {
                        for (i = 0; i < MaxEntries; i++)
                        {
                            tempStr = "";
                            tempStr = devlistarray.Devices[i].szDeviceName;
                            MessageBox.Show(tempStr);
                            string pzDevice = Public.GetXmlValue("type");//获取设备类型
                            tempNum = tempStr.IndexOf(pzDevice);
                            if (tempNum != -1)
                            {
                                gnNumOfSubdevices = devlistarray.Devices[i].nNumOfSubdevices;
                                if (gnNumOfSubdevices > MaxDev)
                                {
                                    gnNumOfSubdevices = MaxDev;
                                }
                                if (gnNumOfSubdevices == 0)
                                {
                                    dwDeviceNum = devlistarray.Devices[i].dwDeviceNum;
                                    errcode     = Advantech.DRV_DeviceOpen(dwDeviceNum, ref DeviceHandle);
                                    if (errcode != 0)
                                    {
                                        MessageBox.Show("打开设备失败,错误代码:" + errcode.ToString());
                                    }
                                    else
                                    {
                                        ret   = true;
                                        bOpen = true;
                                    }
                                    //PCLDevice.ptDevGetFeatures.buffer = &lpDevFeatures;
                                }
                            }
                            else
                            {
                                MessageBox.Show("没有安装PCL-730");
                                ret = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(ret);
        }