forked from FarmMaps/FarmMapsApiClient
Added ability to query for herbicide agents.
This commit is contained in:
parent
65debd6f5f
commit
56193b1b39
@ -30,25 +30,6 @@ namespace FarmmapsHerbicide
|
||||
_farmmapsApiService = farmmapsApiService;
|
||||
_generalService = generalService;
|
||||
_herbicideService = herbicideService;
|
||||
|
||||
_liberatorTarweAgent = new HerbicideAgent()
|
||||
{
|
||||
Name = "Liberator",
|
||||
SoilType = "Klei",
|
||||
ExtraInputType = "OrganicMatter",
|
||||
ActiveSubstanceContent = "diflu100+flufenacet400",
|
||||
MinDosis = 0.33f,
|
||||
MaxDosis = 0.6f,
|
||||
A = 0.007f,
|
||||
B = 0.25f,
|
||||
C = 1.05f,
|
||||
D = 97f,
|
||||
E = 3f,
|
||||
P = 1f,
|
||||
Crop = "Tarwe",
|
||||
Description = "Org. stof arme grond",
|
||||
TankMix = string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
public async Task RunAsync()
|
||||
@ -60,6 +41,9 @@ namespace FarmmapsHerbicide
|
||||
await _farmmapsApiService.GetCurrentUserCodeAsync();
|
||||
var roots = await _farmmapsApiService.GetCurrentUserRootsAsync();
|
||||
|
||||
var agents = await _herbicideService.GetHerbicideAgents();
|
||||
_liberatorTarweAgent = agents.SingleOrDefault(a => a.Name.Equals("Liberator"));
|
||||
|
||||
await SingleLutumTiffFlow(roots);
|
||||
await MultiVanDenBorneShapeFlow(roots);
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FarmmapsApi.Models;
|
||||
using FarmmapsApi.Services;
|
||||
@ -24,6 +26,18 @@ namespace FarmmapsHerbicide
|
||||
_generalService = generalService;
|
||||
}
|
||||
|
||||
public async Task<List<HerbicideAgent>> GetHerbicideAgents()
|
||||
{
|
||||
var itemType = "vnd.farmmaps.package.vra.herbicide";
|
||||
var vraHerbicideDataItems = await _farmmapsApiService.GetItemsAsync(string.Empty, itemType);
|
||||
|
||||
var item = vraHerbicideDataItems.FirstOrDefault();
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
return item.Data.ContainsKey("agents") ? item.Data["agents"].ToObject<List<HerbicideAgent>>() : null;
|
||||
}
|
||||
|
||||
public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, HerbicideAgent agent, params Item[] inputItem)
|
||||
{
|
||||
if (inputItem.Length == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user