zoukankan      html  css  js  c++  java
  • 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("0@"))
                                {
                                    mes += ret + ",数据为delivery_id:" + ss[0].ToString() + ",item_id:" + ss[0].ToString() + ",lot_num:" + ss[2].ToString();
                                    mes += "
    ";
                                }
                                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("0@"))
                    {
                        mes += "修改交货单下载状态失败!" + ret1;
                    }
                    mes = "数据上传成功:" + successCount.ToString() + "条。
    " + mes; 
                    MES.PDA.Core.Service.MessageServices.ShowWarm(mes);
                    System.IO.File.Delete(LoadFile);
                    System.IO.File.Delete(DownFile);
                }
            }

  • 相关阅读:
    Operator开发实例
    Go构建HTTP服务
    Go依赖包的管理
    Go并发编程机制
    Go语言的基础数据类型
    k8s的APIServer流程介绍
    promise、resolve、reject、拦截响应
    AngularJS中service,factory,provider的区别
    scope
    sass入门
  • 原文地址:https://www.cnblogs.com/wanghang/p/6299127.html
Copyright © 2011-2022 走看看