From 2acd4930b1176b9b3634d2a7132ab06bfd642453 Mon Sep 17 00:00:00 2001 From: Wilco Krikke Date: Sat, 6 Feb 2021 14:06:49 +0100 Subject: [PATCH] Spray must now contain all fungicide properties --- FarmMapsBlight/BlightService.cs | 7 +++- FarmMapsBlight/FarmMapsBlight.csproj | 2 +- FarmMapsBlight/Models/Fungicide.cs | 48 ++++++++++++++++++++++++++++ FarmMapsBlight/Models/Spray.cs | 4 +-- 4 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 FarmMapsBlight/Models/Fungicide.cs diff --git a/FarmMapsBlight/BlightService.cs b/FarmMapsBlight/BlightService.cs index fb050fb..1418ae6 100644 --- a/FarmMapsBlight/BlightService.cs +++ b/FarmMapsBlight/BlightService.cs @@ -36,8 +36,13 @@ namespace FarmMapsBlight taskRequest.attributes["plantingDate"] = plantingDate.ToUniversalTime().ToString("o"); taskRequest.attributes["emergeDate"] = emergeDate.ToUniversalTime().ToString("o"); + var fungicide1 = "{\"ai1\": \"propamocarb\", \"ai2\": \"fluopicolide\", \"ai3\": \"cymoxanil\", \"code\": \"infinito12curz\", \"name\": \"infinito 1,2 l + curzate partner 0,2 kg\", \"maxdose\": \"1\", \"mindose\": \"1\", \"safedays\": \"14\", \"emergence\": true, \"newgrowth\": \"1\", \"contentai1\": \"525.2\", \"contentai2\": \"62.5\", \"contentai3\": \"600\", \"fastgrowth\": true, \"contentunit\": \"l/ha + kg/ha\", \"rainfastness\": \"2.5\", \"tuberfilling\": true, \"aidescription\": \"(propamocarb + fluopicolide) 1.2 l/ha + cymoxanil 0.2 kg/ha\", \"curativescore\": \"2\", \"dryingtimemax\": \"2\", \"dryingtimemin\": \"2\", \"vracompatible\": false, \"maxapplications\": \"4\", \"preventivescore\": \"3\", \"recommendeddose\": \"1\", \"tuberprotection\": \"3.3\", \"eradicativescore\": \"2\", \"earlytubersetting\": true, \"protectioncategory\": \"2\", \"applicationrateunit\": null, \"ctgbregistrationnumber\": \"12927 n + 12755 n\"}"; + var fungicide2 = "{\"ai1\": \"fluazinam\", \"ai2\": \"cymoxanil\", \"ai3\": null, \"code\": \"kunshi\", \"name\": \"kunshi\", \"maxdose\": \"0.5\", \"mindose\": \"0.4\", \"safedays\": \"1\", \"emergence\": false, \"newgrowth\": \"1\", \"contentai1\": \"375\", \"contentai2\": \"250\", \"contentai3\": \"0\", \"fastgrowth\": true, \"contentunit\": \"g/kg\", \"rainfastness\": \"2.5\", \"tuberfilling\": false, \"aidescription\": \"(fluazinam + cymoxanil) 0.5 kg/ha\", \"curativescore\": \"2\", \"dryingtimemax\": \"2\", \"dryingtimemin\": \"1\", \"vracompatible\": true, \"maxapplications\": \"5\", \"preventivescore\": \"2.9\", \"recommendeddose\": \"0.5\", \"tuberprotection\": \"3.3\", \"eradicativescore\": \"1\", \"earlytubersetting\": false, \"protectioncategory\": \"1\", \"applicationrateunit\": \"kg/ha\", \"ctgbregistrationnumber\": \"14371 n\"}"; + List sprays = new List(); - sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 9, 1), dose = 0.6, isVRA = false }); + sprays.Add(new Spray() { fungicide = JsonConvert.DeserializeObject(fungicide1), sprayTime = new DateTime(2020, 9, 1), dose = 0.6, isVRA = false }); + sprays.Add(new Spray() { fungicide = JsonConvert.DeserializeObject(fungicide2), sprayTime = new DateTime(2020, 9, 1), dose = 0.6, isVRA = false }); + taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays); List irrigations = new List(); diff --git a/FarmMapsBlight/FarmMapsBlight.csproj b/FarmMapsBlight/FarmMapsBlight.csproj index 052b891..dc870a8 100644 --- a/FarmMapsBlight/FarmMapsBlight.csproj +++ b/FarmMapsBlight/FarmMapsBlight.csproj @@ -11,7 +11,7 @@ - Never + PreserveNewest diff --git a/FarmMapsBlight/Models/Fungicide.cs b/FarmMapsBlight/Models/Fungicide.cs new file mode 100644 index 0000000..a8076c1 --- /dev/null +++ b/FarmMapsBlight/Models/Fungicide.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace FarmMapsBlight.Models +{ + public class Fungicide + { + public string code { get; set; } + public string name { get; set; } + public string ctgbregistrationnumber { get; set; } + public string ai1 { get; set; } + public string ai2 { get; set; } + public string ai3 { get; set; } + public double contentai1 { get; set; } + public double contentai2 { get; set; } + public double contentai3 { get; set; } + public string contentunit { get; set; } + public string aidescription { get; set; } + public int protectioncategory { get; set; } + public double preventivescore { get; set; } + public double curativescore { get; set; } + public string applicationrateunit { get; set; } + public double recommendeddose { get; set; } + public double newgrowth { get; set; } + public double tuberprotection { get; set; } + public double dryingtimemin { get; set; } + public double dryingtimemax { get; set; } + public double rainfastness { get; set; } + public double mindose { get; set; } + public double maxdose { get; set; } + public int? maxapplications { get; set; } + public bool vracompatible { get; set; } + public double eradicativescore { get; set; } + public bool emergence { get; set; } + public bool fastgrowth { get; set; } + public bool earlytubersetting { get; set; } + public bool tuberfilling { get; set; } + public int? safedays { get; set; } + public double takeback + { + get + { + return curativescore * 6; + } + } + } +} diff --git a/FarmMapsBlight/Models/Spray.cs b/FarmMapsBlight/Models/Spray.cs index f0d2f29..2bccac9 100644 --- a/FarmMapsBlight/Models/Spray.cs +++ b/FarmMapsBlight/Models/Spray.cs @@ -4,8 +4,8 @@ namespace FarmMapsBlight.Models { public class Spray { - public DateTime SprayTime { get; set; } - public string fungicideCode { get; set; } + public DateTime sprayTime { get; set; } + public Fungicide fungicide { get; set; } public double dose { get; set; } public bool isVRA { get; set; } }