Example #1
0
        public static List <HuInfo> GetAllHuInfo()
        {
            List <HuInfo> result = null;
            string        sql    = "select HU,QTY,Result,Timestamp from HuList";
            DataTable     dt     = SqliteDBHelp.GetTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                result = new List <HuInfo>();
                foreach (DataRow row in dt.Rows)
                {
                    HuInfo hu = new HuInfo()
                    {
                        HU        = row["HU"].ToString(),
                        QTY       = (int)row["QTY"],
                        Result    = row["Result"].ToString(),
                        Timestamp = DateTime.Parse(row["Timestamp"].ToString())
                    };
                    if (!result.Exists(i => i.HU == hu.HU))
                    {
                        result.Add(hu);
                    }
                }
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// 获取本地sqlite未上传sap发运箱信息列表
        /// </summary>
        /// <returns></returns>
        public static List <UploadPKBoxInfo> GetUnUploadPKBox()
        {
            string    sql = string.Format("SELECT Guid,Data,IsUpload,CreateTime FROM UploadData");
            DataTable dt  = SqliteDBHelp.GetTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                List <UploadPKBoxInfo> result = new List <UploadPKBoxInfo>();
                foreach (DataRow row in dt.Rows)
                {
                    result.Add((JsonConvert.DeserializeObject <UploadPKBoxInfo>(row["Data"].ToString())));
                }
                return(result);
            }
            return(null);
        }
Example #3
0
        public static List <UploadData> GetUnUploadDataList()
        {
            //string sql = string.Format("DELETE FROM UploadData WHERE IsUpload=1;SELECT Guid,Data,IsUpload,CreateTime FROM UploadData WHERE IsUpload = 0");
            string    sql = string.Format("SELECT Guid,Data,IsUpload,CreateTime FROM UploadData");
            DataTable dt  = SqliteDBHelp.GetTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                List <UploadData> result = new List <UploadData>();
                foreach (DataRow row in dt.Rows)
                {
                    UploadData ud = new UploadData();
                    ud.Guid       = row["Guid"].ToString();
                    ud.Data       = JsonConvert.DeserializeObject <ResultDataInfo>(row["Data"].ToString());
                    ud.IsUpload   = uint.Parse(row["IsUpload"].ToString());
                    ud.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
                    result.Add(ud);
                }
                return(result);
            }
            return(null);
        }
Example #4
0
        public static List <CUploadData> GetAllUploadFromSqlite <T>()
        {
            List <CUploadData> result = new List <CUploadData>();

            string    sql = string.Format("SELECT Guid,Data,IsUpload,CreateTime,MSG FROM UploadData order by CreateTime");
            DataTable dt  = SqliteDBHelp.GetTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    CUploadData ud = new CUploadData();
                    ud.Guid       = row["Guid"].ToString();
                    ud.Data       = JsonConvert.DeserializeObject <T>(row["Data"].ToString());
                    ud.IsUpload   = uint.Parse(row["IsUpload"].ToString());
                    ud.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
                    ud.MSG        = row["MSG"].ToString();
                    result.Add(ud);
                }
                return(result);
            }
            return(result);
        }