Beispiel #1
0
 public void Test_WorkItemView()
 {
     var info = new WorkItem
     {
         BeginTime = new DateTime(2016, 3, 4),
         Cause = WorkItemCause.Antenna,
         Comments = "abc",
         Deadline = new DateTime(2016, 4, 4),
         ENodebId = 12345,
         FeedbackTime = new DateTime(2016, 4, 4),
         FeedbackContents = "defg123",
         FinishTime = new DateTime(2016, 3, 6),
         RejectTimes = 34,
         SectorId = 3,
         SerialNumber = "123",
         StaffName = "ere",
         State = WorkItemState.Finished,
         Subtype = WorkItemSubtype.CallSetup,
         Type = WorkItemType.DailyTask,
         RepeatTimes = 19
     };
     var view = info.MapTo<WorkItemView>();
     view.BeginTime.ShouldBe(new DateTime(2016,3,4));
     view.WorkItemCause.ShouldBe(WorkItemCause.Antenna.GetEnumDescription());
     view.Comments.ShouldBe("abc");
     view.Deadline.ShouldBe(new DateTime(2016, 4, 4));
     view.ENodebId.ShouldBe(12345);
     view.FeedbackTime.ShouldBe(new DateTime(2016, 4, 4));
     view.FeedbackContents.ShouldBe("defg123");
     view.FinishTime.ShouldBe(new DateTime(2016, 3, 6));
     view.RejectTimes.ShouldBe((short)34);
     view.SectorId.ShouldBe((byte)3);
     view.SerialNumber.ShouldBe("123");
     view.StaffName.ShouldBe("ere");
     view.WorkItemState.ShouldBe(WorkItemState.Finished.GetEnumDescription());
     view.WorkItemSubType.ShouldBe(WorkItemSubtype.CallSetup.GetEnumDescription());
     view.WorkItemType.ShouldBe(WorkItemType.DailyTask.GetEnumDescription());
     view.RepeatTimes.ShouldBe((short)19);
 }
Beispiel #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);
     _repository.SaveChanges();
     return result?.SerialNumber;
 }