public async Task <bool> DumpOne() { var info = WorkItemInfos.Pop(); if (info == null) { return(false); } var item = _repository.FirstOrDefault(x => x.SerialNumber == info.SerialNumber); if (item != null) { if (item.State == WorkItemState.Finished) { item.FinishTime = info.FinishTime; item.State = info.StateDescription.GetEnumType <WorkItemState>(); item.Cause = info.CauseDescription.GetEnumType <WorkItemCause>(); item.ENodebId = info.ENodebId; item.SectorId = info.SectorId; item.Comments = info.Comments; await _repository.UpdateAsync(item); } } else { await _repository.InsertAsync(Mapper.Map <WorkItemExcel, WorkItem>(info)); } _repository.SaveChanges(); return(true); }
public string ImportExcelFiles(string path) { var factory = new ExcelQueryFactory { FileName = path }; const string sheetName = "工单查询结果"; var infos = (from c in factory.Worksheet <WorkItemExcel>(sheetName) select c).ToList(); WorkItemInfos.Clear(); foreach (var info in infos) { WorkItemInfos.Push(info); } return("完成工单读取:" + WorkItemInfos.Count + "条"); }
public void ClearDumpItems() { WorkItemInfos.Clear(); }