Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public async Task <string> ConstructPreciseWorkItem(Precise4GView view, DateTime begin, DateTime end, string userName)
        {
            var existedItem = await _repository.GetPreciseExistedAsync(view.CellId, view.SectorId);

            if (existedItem != null)
            {
                return(null);
            }
            var serialNumber = "SELF-FS-Precise-" + view.CellId + "-" + view.SectorId + "-" + begin.ToString("yyyyMMdd") +
                               "-" + end.ToString("yyyyMMdd");

            existedItem = await _repository.FirstOrDefaultAsync(x => x.SerialNumber == serialNumber);

            if (existedItem != null)
            {
                return(null);
            }
            var item = new WorkItem
            {
                BeginTime    = end,
                Cause        = WorkItemCause.WeakCoverage,
                SerialNumber = serialNumber,
                ENodebId     = view.CellId,
                SectorId     = view.SectorId,
                Deadline     = end.AddMonths(1),
                StaffName    = userName,
                Type         = WorkItemType.SelfConstruction,
                Subtype      = WorkItemSubtype.PreciseRate,
                State        = WorkItemState.ToBeSigned,
                Comments     =
                    "[" + DateTime.Now + "]" + userName + ": 创建工单" + serialNumber + ";精确覆盖率=" + view.SecondRate +
                    ";MR总数=" + view.TotalMrs + ";TOP天数=" + view.TopDates
            };
            var result = await _repository.InsertAsync(item);

            return(result?.SerialNumber);
        }