From 67ff626e87d56cf49052352db12cca80b2b1fdd8 Mon Sep 17 00:00:00 2001 From: Wilco Krikke Date: Sat, 26 Sep 2020 20:11:22 +0200 Subject: [PATCH] Added sprays & irrigations --- FarmMapsBlight/BlightService.cs | 11 +++++++++++ FarmMapsBlight/Models/Irrigation.cs | 11 +++++++++++ FarmMapsBlight/Models/Spray.cs | 12 ++++++++++++ FarmMapsBlight/appsettings.json | 4 +--- FarmmapsHaulmkilling/appsettings.json | 2 +- FarmmapsNbs/appsettings.json | 16 ++++++++-------- FarmmapsPoten/appsettings.json | 16 ++++++++-------- 7 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 FarmMapsBlight/Models/Irrigation.cs create mode 100644 FarmMapsBlight/Models/Spray.cs diff --git a/FarmMapsBlight/BlightService.cs b/FarmMapsBlight/BlightService.cs index 7dc4c93..a7b95c8 100644 --- a/FarmMapsBlight/BlightService.cs +++ b/FarmMapsBlight/BlightService.cs @@ -1,7 +1,10 @@ using FarmmapsApi.Models; using FarmmapsApi.Services; +using FarmMapsBlight.Models; using Microsoft.Extensions.Logging; +using Newtonsoft.Json; using System; +using System.Collections.Generic; using System.Threading.Tasks; using static FarmmapsApi.Extensions; using static FarmmapsApiSamples.Constants; @@ -32,6 +35,14 @@ namespace FarmMapsBlight taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o"); taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o"); + List sprays = new List(); + sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 9, 1), dose = 0.6, isVRA = false }); + taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays); + + List irrigations = new List(); + irrigations.Add(new Irrigation() { startTime = new DateTime(2020, 7, 1, 2, 0, 0), endTime = new DateTime(2020, 7, 1, 14, 0, 0) }); + taskRequest.attributes["irrigations"] = JsonConvert.SerializeObject(irrigations); + var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest); await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) => { diff --git a/FarmMapsBlight/Models/Irrigation.cs b/FarmMapsBlight/Models/Irrigation.cs new file mode 100644 index 0000000..e8a1375 --- /dev/null +++ b/FarmMapsBlight/Models/Irrigation.cs @@ -0,0 +1,11 @@ +using System; + +namespace FarmMapsBlight.Models +{ + public class Irrigation + { + public DateTime startTime { get; set; } + public DateTime endTime { get; set; } + public double mm { get; set; } + } +} \ No newline at end of file diff --git a/FarmMapsBlight/Models/Spray.cs b/FarmMapsBlight/Models/Spray.cs new file mode 100644 index 0000000..f0d2f29 --- /dev/null +++ b/FarmMapsBlight/Models/Spray.cs @@ -0,0 +1,12 @@ +using System; + +namespace FarmMapsBlight.Models +{ + public class Spray + { + public DateTime SprayTime { get; set; } + public string fungicideCode { get; set; } + public double dose { get; set; } + public bool isVRA { get; set; } + } +} diff --git a/FarmMapsBlight/appsettings.json b/FarmMapsBlight/appsettings.json index c81c149..c0d37c2 100644 --- a/FarmMapsBlight/appsettings.json +++ b/FarmMapsBlight/appsettings.json @@ -1,8 +1,6 @@ { "Authority": "https://accounts.farmmaps.awtest.nl/", - //"Endpoint": "http://farmmaps.awtest.nl", - //"Endpoint": "http://localhost:8095", - "Endpoint": "http://localhost:8083", + "Endpoint": "https://farmmaps.awtest.nl/", "BasePath": "api/v1", "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", "RedirectUri": "http://example.nl/api", diff --git a/FarmmapsHaulmkilling/appsettings.json b/FarmmapsHaulmkilling/appsettings.json index 3896303..5d2d09e 100644 --- a/FarmmapsHaulmkilling/appsettings.json +++ b/FarmmapsHaulmkilling/appsettings.json @@ -1,6 +1,6 @@ { "Authority": "https://accounts.farmmaps.awtest.nl/", - "Endpoint": "http://farmmaps.awtest.nl", + "Endpoint": "http://farmmaps.awtest.nl/", "BasePath": "api/v1", "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", "RedirectUri": "http://example.nl/api", diff --git a/FarmmapsNbs/appsettings.json b/FarmmapsNbs/appsettings.json index 6d97d71..b641dd4 100644 --- a/FarmmapsNbs/appsettings.json +++ b/FarmmapsNbs/appsettings.json @@ -1,10 +1,10 @@ { - "Authority": "https://accounts.farmmaps.awtest.nl/", - "Endpoint": "http://localhost:8095/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": ["api"] + "Authority": "https://accounts.farmmaps.awtest.nl/", + "Endpoint": "https://farmmaps.awtest.nl/", + "BasePath": "api/v1", + "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", + "RedirectUri": "http://example.nl/api", + "ClientId": "", + "ClientSecret": "", + "Scopes": [ "api" ] } \ No newline at end of file diff --git a/FarmmapsPoten/appsettings.json b/FarmmapsPoten/appsettings.json index 6d97d71..b641dd4 100644 --- a/FarmmapsPoten/appsettings.json +++ b/FarmmapsPoten/appsettings.json @@ -1,10 +1,10 @@ { - "Authority": "https://accounts.farmmaps.awtest.nl/", - "Endpoint": "http://localhost:8095/", - "BasePath": "api/v1", - "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", - "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", - "Scopes": ["api"] + "Authority": "https://accounts.farmmaps.awtest.nl/", + "Endpoint": "https://farmmaps.awtest.nl/", + "BasePath": "api/v1", + "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", + "RedirectUri": "http://example.nl/api", + "ClientId": "", + "ClientSecret": "", + "Scopes": [ "api" ] } \ No newline at end of file