PDA开发数据由本地上传至DB
Posted jzssuanfa
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PDA开发数据由本地上传至DB相关的知识,希望对你有一定的参考价值。
private void btnUpLoad_Click(object sender, EventArgs e) { if (!System.IO.File.Exists(LoadFile)) { MES.PDA.Core.Service.MessageServices.ShowWarm("请先扫描数据并保存!"); tbDelivery.Focus(); return; } else { string mes = string.Empty; int successCount = 0; using (StreamReader sr = new StreamReader(LoadFile)) { String line; while ((line = sr.ReadLine()) != null) { string[] ss = line.Split(‘,‘); if (ss.Length > 0) { List<string> ls = new List<string>(); ls.Add(ss[0]); ls.Add(ss[1]); ls.Add(ss[2]); string sql = "{?=call apps.cux_pda_load_scan_utl.data_load(" + StrUtil.BuildPara(ls) + ")}"; //MES.PDA.Core.Service.MessageServices.ShowWarm(sql); //return; string ret = (string)MES.PDA.Core.Service.DatabaseAccessService.execute(sql, ReturnType.STRING); if (!ret.StartsWith("[email protected]")) { mes += ret + ",数据为delivery_id:" + ss[0].ToString() + ",item_id:" + ss[0].ToString() + "。lot_num:" + ss[2].ToString(); mes += "\r\n"; } else { successCount = successCount + 1; } } } } string sql1 = "{?=call apps.cux_pda_load_scan_utl.end_data_load(‘" + tbDelivery.Text.Trim() + "‘)}"; //MES.PDA.Core.Service.MessageServices.ShowWarm(sql); //return; string ret1 = (string)MES.PDA.Core.Service.DatabaseAccessService.execute(sql1, ReturnType.STRING); if (!ret1.StartsWith("[email protected]")) { mes += "改动交货单下载状态失败!" + ret1; } mes = "数据上传成功:" + successCount.ToString() + "条。
\r\n" + mes; MES.PDA.Core.Service.MessageServices.ShowWarm(mes); System.IO.File.Delete(LoadFile); System.IO.File.Delete(DownFile); } }
以上是关于PDA开发数据由本地上传至DB的主要内容,如果未能解决你的问题,请参考以下文章