/// <summary> /// 服务商领取工单 /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <bool> SPReceiveMaintenance(SPReceiveMaintenanceRequest request) { //判断该工单状态是否领取工单 var maintenanceInfo = await this.GetById(request.Id.Value); if (maintenanceInfo == null) { throw new SinoException(ErrorCode.E30016, nameof(ErrorCode.E30016).GetCode()); } //在已指派的状态下才可以领取工单 if (maintenanceInfo.MaintenancStatus.Value != (int)EMaintenancStatus.Assigned) { var desc = maintenanceInfo.MaintenancStatus.Value.GetEnumDescription <EMaintenancStatus>(); throw new SinoException(string.Format(ErrorCode.E30019, desc), nameof(ErrorCode.E30019).GetCode()); } //进行取消操作 MaintenanceInfo maintenance = new MaintenanceInfo(); maintenance.MaintenancStatus = (int)EMaintenancStatus.Received; maintenance.Id = request.Id.Value; maintenance.LastModificationTime = DateTime.Now; List <string> updateCols = new List <string>(); updateCols.Add(nameof(MaintenanceInfo.MaintenancStatus)); updateCols.Add(nameof(MaintenanceInfo.LastModificationTime)); var result = await _MaintenanceInfoRep.UpdateAssignFieldsById(maintenance, updateCols); return(result > 0); }
public async Task SPReceiveMaintenance(SPReceiveMaintenanceRequest request) { _logger.Info(new LogInfo() { Method = nameof(SPReceiveMaintenance), Argument = new { request }, Description = "服务商领取工单" }); await _MaintenanceInfoService.SPReceiveMaintenance(request); }