Added sprays & irrigations

This commit is contained in:
Wilco Krikke 2020-09-26 20:11:22 +02:00
parent 67af431140
commit 35db76a39f
4 changed files with 37 additions and 3 deletions

View File

@ -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<Spray> sprays = new List<Spray>();
sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 9, 1), dose = 0.6, isVRA = false });
taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays);
List<Irrigation> irrigations = new List<Irrigation>();
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) =>
{

View File

@ -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; }
}
}

View File

@ -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; }
}
}

View File

@ -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<Wy[y,?Lfr66}G`",
"Scopes": [ "api" ]
}