Exemplo n.º 1
0
        private void EnqueueUploadData(UploadBoxInfo data)
        {
            SqliteUploadDataInfo ud = new SqliteUploadDataInfo();

            ud.Guid       = Guid.NewGuid().ToString();
            ud.Data       = data;
            ud.IsUpload   = 0;
            ud.CreateTime = DateTime.Now;
            PackingBoxSqliteService.InsertUploadData(ud);
            UploadServer.GetInstance().CurrentUploadQueue.Push(ud);
        }
Exemplo n.º 2
0
        public static void InsertUploadData(SqliteUploadDataInfo ud)
        {
            string sql = string.Format(@"INSERT INTO UploadData(Guid,Data,IsUpload,CreateTime) VALUES('{0}','{1}',0,'{2}')",
                                       ud.Guid, JsonConvert.SerializeObject(ud.Data), ud.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
            int result = SqliteDBHelp.ExecuteSql(sql);

            if (result <= 0)
            {
                LogHelper.WriteLine(JsonConvert.SerializeObject(ud.Data));
            }
        }
Exemplo n.º 3
0
        private void uploadAgainButton_Click(object sender, EventArgs e)
        {
            List <PBBoxInfo> rowBoxList = new List <PBBoxInfo>();

            List <DataGridViewRow> rows = GetCheckedRows();

            if (rows != null && rows.Count > 0)
            {
                foreach (DataGridViewRow row in rows)
                {
                    PBBoxInfo box = row.Tag as PBBoxInfo;
                    if (box != null)
                    {
                        if (!rowBoxList.Exists(r => r.HU == box.HU))
                        {
                            rowBoxList.Add(box);
                        }
                    }
                }
            }

            foreach (PBBoxInfo data in rowBoxList)
            {
                UploadBoxInfo box = new UploadBoxInfo();
                box.EQUIP_HLA = SysConfig.DeviceInfo.EQUIP_HLA;
                box.LGNUM     = SysConfig.LGNUM;
                box.LOUCENG   = SysConfig.DeviceInfo.LOUCENG;
                box.SUBUSER   = SysConfig.CurrentLoginUser.UserId;
                box.Box       = data;

                SqliteUploadDataInfo ud = new SqliteUploadDataInfo();
                ud.Guid       = Guid.NewGuid().ToString();
                ud.Data       = box;
                ud.IsUpload   = 0;
                ud.CreateTime = DateTime.Now;
                PackingBoxSqliteService.InsertUploadData(ud);
                UploadServer.GetInstance().CurrentUploadQueue.Push(ud);
            }

            if (rowBoxList.Count > 0)
            {
                MetroMessageBox.Show(this, "成功加入上传列表", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
        }
Exemplo n.º 4
0
        public static List <SqliteUploadDataInfo> GetUnUploadDataList()
        {
            string    sql = string.Format("DELETE FROM UploadData WHERE IsUpload=1;SELECT Guid,Data,IsUpload,CreateTime FROM UploadData WHERE IsUpload = 0");
            DataTable dt  = SqliteDBHelp.GetTable(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                List <SqliteUploadDataInfo> result = new List <SqliteUploadDataInfo>();
                foreach (DataRow row in dt.Rows)
                {
                    SqliteUploadDataInfo ud = new SqliteUploadDataInfo();
                    ud.Guid       = row["Guid"].ToString();
                    ud.Data       = JsonConvert.DeserializeObject <UploadBoxInfo>(row["Data"].ToString());
                    ud.IsUpload   = uint.Parse(row["IsUpload"].ToString());
                    ud.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
                    result.Add(ud);
                }
                return(result);
            }
            return(null);
        }
Exemplo n.º 5
0
        void uploadSap(YKBoxInfo box)
        {
            try
            {
                SqliteUploadDataInfo ud = new SqliteUploadDataInfo();
                ud.Guid       = Guid.NewGuid().ToString();
                ud.Data       = box;
                ud.IsUpload   = 0;
                ud.CreateTime = DateTime.Now;
                YKBoxSqliteService.InsertUploadData(ud);

                SapResult result = SAPDataService.UploadYKBoxInfo(SysConfig.LGNUM, box);
                box.SapRemark = result.MSG;
                box.SapStatus = result.STATUS;
                bool xdSaveResult = YKBoxService.SaveBox(box);
                YKBoxSqliteService.SetUploaded(ud.Guid);
            }
            catch (Exception e)
            {
                Log4netHelper.LogError(e);
            }
        }
Exemplo n.º 6
0
        private void uploadAgainButton_Click(object sender, EventArgs e)
        {
            List <YKBoxInfo> rowBoxList = new List <YKBoxInfo>();

            List <DataGridViewRow> rows = GetCheckedRows();

            if (rows != null && rows.Count > 0)
            {
                foreach (DataGridViewRow row in rows)
                {
                    YKBoxInfo box = row.Tag as YKBoxInfo;
                    if (box != null)
                    {
                        if (!rowBoxList.Exists(r => r.Hu == box.Hu))
                        {
                            rowBoxList.Add(box);
                        }
                    }
                }
            }

            foreach (YKBoxInfo data in rowBoxList)
            {
                SqliteUploadDataInfo ud = new SqliteUploadDataInfo();
                ud.Guid       = Guid.NewGuid().ToString();
                ud.Data       = data;
                ud.IsUpload   = 0;
                ud.CreateTime = DateTime.Now;
                YKBoxSqliteService.InsertUploadData(ud);
                UploadServer.GetInstance().CurrentUploadQueue.Push(ud);
            }

            if (rowBoxList.Count > 0)
            {
                MetroMessageBox.Show(this, "成功加入上传列表", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
        }