Exemplo n.º 1
0
        private static async Task <WitsmlTrajectory> GetTrajectory(IWitsmlClient client, TrajectoryReference trajectoryReference)
        {
            var witsmlTrajectory = TrajectoryQueries.GetWitsmlTrajectoryById(trajectoryReference.WellUid, trajectoryReference.WellboreUid, trajectoryReference.TrajectoryUid);
            var result           = await client.GetFromStoreAsync(witsmlTrajectory, new OptionsIn(ReturnElements.All));

            return(!result.Trajectories.Any() ? null : result.Trajectories.First());
        }
        public override async Task <(WorkerResult, RefreshAction)> Execute(DeleteTrajectoryJob job)
        {
            var wellUid       = job.TrajectoryReference.WellUid;
            var wellboreUid   = job.TrajectoryReference.WellboreUid;
            var trajectoryUid = job.TrajectoryReference.TrajectoryUid;

            var witsmlTrajectory = TrajectoryQueries.GetWitsmlTrajectoryById(wellUid, wellboreUid, trajectoryUid);
            var result           = await witsmlClient.DeleteFromStoreAsync(witsmlTrajectory);

            if (result.IsSuccessful)
            {
                Log.Information("{JobType} - Job successful", GetType().Name);
                var refreshAction = new RefreshWellbore(witsmlClient.GetServerHostname(), wellUid, wellboreUid, RefreshType.Update);
                return(new WorkerResult(witsmlClient.GetServerHostname(), true, $"Deleted trajectory: ${trajectoryUid}"), refreshAction);
            }

            Log.Error("Failed to delete trajectory. WellUid: {WellUid}, WellboreUid: {WellboreUid}, Uid: {TrajectoryUid}",
                      wellUid,
                      wellboreUid,
                      trajectoryUid);

            witsmlTrajectory = TrajectoryQueries.GetWitsmlTrajectoryById(wellUid, wellboreUid, trajectoryUid);
            var queryResult = await witsmlClient.GetFromStoreAsync(witsmlTrajectory, new OptionsIn(ReturnElements.IdOnly));

            var trajectory = queryResult.Trajectories.First();
            EntityDescription description = null;

            if (trajectory != null)
            {
                description = new EntityDescription
                {
                    WellName     = trajectory.NameWell,
                    WellboreName = trajectory.NameWellbore,
                    ObjectName   = trajectory.Name
                };
            }
            return(new WorkerResult(witsmlClient.GetServerHostname(), false, "Failed to delete trajectory", result.Reason, description), null);
        }
Exemplo n.º 3
0
        public async Task <List <TrajectoryStation> > GetTrajectoryStations(string wellUid, string wellboreUid, string trajectoryUid)
        {
            var trajectoryToQuery = TrajectoryQueries.GetWitsmlTrajectoryById(wellUid, wellboreUid, trajectoryUid);
            var result            = await WitsmlClient.GetFromStoreAsync(trajectoryToQuery, new OptionsIn(ReturnElements.All));

            var witsmlTrajectory = result.Trajectories.FirstOrDefault();

            if (witsmlTrajectory == null)
            {
                return(null);
            }
            return(witsmlTrajectory.TrajectoryStations.Select(tStation => new TrajectoryStation
            {
                Uid = tStation.Uid,
                DTimStn = StringHelpers.ToDateTime(tStation.DTimStn),
                TypeTrajStation = tStation.TypeTrajStation,
                Md = StringHelpers.ToDecimal(tStation.Md?.Value),
                Tvd = StringHelpers.ToDecimal(tStation.Tvd?.Value),
                Incl = StringHelpers.ToDecimal(tStation.Incl?.Value),
                Azi = StringHelpers.ToDecimal(tStation.Azi?.Value)
            })
                   .OrderBy(tStation => tStation.Md)
                   .ToList());
        }