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..0e94641 100644 --- a/FarmMapsBlight/appsettings.json +++ b/FarmMapsBlight/appsettings.json @@ -2,11 +2,11 @@ "Authority": "https://accounts.farmmaps.awtest.nl/", //"Endpoint": "http://farmmaps.awtest.nl", //"Endpoint": "http://localhost:8095", - "Endpoint": "http://localhost:8083", + "Endpoint": "http://localhost:8083", // vs "BasePath": "api/v1", "DiscoveryEndpointUrl": "https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration", "RedirectUri": "http://example.nl/api", - "ClientId": "", - "ClientSecret": "", + "ClientId": "wurtest1", + "ClientSecret": "7