PDA开发数据由DB下载至PDA本地

Posted claireyuancy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PDA开发数据由DB下载至PDA本地相关的知识,希望对你有一定的参考价值。

public string DownFile = "\\下载.txt";//下载路径
        public string LoadFile = "\\上传.txt";//上传路径
        public List<string> _readtxt = new List<string>();
        public MainForm()
        {
            InitializeComponent();
            tbDelivery.Focus();
        }
        private void btnDownLoad_Click(object sender, EventArgs e)
        {
            try
            {
                if (tbDelivery.Text.Trim().Length == 0)
                {
                    MES.PDA.Core.Service.MessageServices.ShowWarm("请先扫描供货号!");
                    tbDelivery.Focus();
                    return;
                }
                else
                {
                    if (!CheckDelivery())
                    {
                        return;
                    }
                    if (System.IO.File.Exists(DownFile))
                    {
                        StreamReader objReader = new StreamReader(DownFile);
                        string sLine = "";
                        sLine = objReader.ReadLine();
                        if (sLine != string.Empty)
                        {
                            string[] ss = sLine.Split(‘,‘);
                            if (ss.Length > 0)
                            {
                                if (ss[0] != tbDelivery.Text.Trim())
                                {
                                    MES.PDA.Core.Service.MessageServices.ShowWarm("本机已下载供货号:" + ss[0] + ",请扫描该供货号并上传后。再下载其它供货号!

"); objReader.Close(); return; } else { MES.PDA.Core.Service.MessageServices.ShowWarm("该供货号已下载,请进行扫描并上传!

"); objReader.Close(); return; } } } objReader.Close(); } else { FileStream fs = System.IO.File.Create(DownFile); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.GetEncoding("UTF-8")); string sql = Sql.getDelivery(tbDelivery.Text.Trim()); Daisy.Common.McsClient.McsDataReader reader = (Daisy.Common.McsClient.McsDataReader)MES.PDA.Core.Service.DatabaseAccessService.execute(sql, MES.PDA.Core.Service.ReturnType.RESULTSET); if (reader.rowNumber == 0) { MES.PDA.Core.Service.MessageServices.ShowWarm("获取供货号信息失败!"); sw.Close(); return; } else { string sLine = string.Empty; while (reader.Read()) { //MES.PDA.Core.Service.MessageServices.ShowWarm(reader.getString(2)); sLine = reader.getString(0) + "," + reader.getString(1) + "," + reader.getString(2) + "," + reader.getString(3) + "," + reader.getString(4) + "," + reader.getString(5); //sw.WriteLine(sLine); sw.WriteLine(sLine); } sw.Flush(); sw.Close(); } var sqlload = "{?=call apps.cux_pda_load_scan_utl.init_data_download(‘" + tbDelivery.Text.Trim() + "‘)}"; //MES.PDA.Core.Service.MessageServices.ShowWarm(sql); //return; string ret = (string)MES.PDA.Core.Service.DatabaseAccessService.execute(sqlload, ReturnType.STRING); if (!ret.StartsWith("[email protected]")) { MES.PDA.Core.Service.MessageServices.ShowWarm(ret); return; } else { MES.PDA.Core.Service.MessageServices.ShowWarm("下载成功!

"); btnScan.Focus(); } } } } catch (Exception ex) { MES.PDA.Core.Service.MessageServices.ShowWarm(ex.ToString()); } }



以上是关于PDA开发数据由DB下载至PDA本地的主要内容,如果未能解决你的问题,请参考以下文章

PDA扫描设置

PDA开发相关技术

Winform 拷贝文件到PDA,提示:正由另一进程使时用,因此该进程无法访问该文件。

PDA是啥

pda扫描怎么设置自动确认

请问在PDA上能直接访问SAP系统吗?