private void initData() { lvData.Items.Clear(); List <UploadData> list = SqliteDataService.GetUnUploadDataList(); if (list != null && list.Count > 0) { btnUpload.Enabled = true; foreach (UploadData item in list) { ResultDataInfo data = item.Data as ResultDataInfo; ListViewItem lvi = new ListViewItem(data.Doc != null && data.Doc.DOCNO != null ? data.Doc.DOCNO : "异常单号"); lvi.SubItems.Add(data.BoxNO != null ? data.BoxNO : "异常箱码"); lvi.SubItems.Add(data.ErrorMsg != null ? data.ErrorMsg : "异常"); lvi.SubItems.Add(data.CurrentNum.ToString()); string sapRe = ReceiveService.GetSaveDataSapResult(item.Guid); if (string.IsNullOrEmpty(sapRe)) { lvi.SubItems.Add(item.IsUpload == 0 ? "未上传" : "已上传"); } else { lvi.SubItems.Add("SAP:" + sapRe); } lvi.Tag = item; lvData.Items.Add(lvi); } } else { btnUpload.Enabled = false; MessageBox.Show("没有未上传的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }