forked from FarmMaps/FarmMapsApiClient
update Blight
This commit is contained in:
@@ -74,8 +74,8 @@ namespace FarmMapsBlight
|
||||
cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
|
||||
}
|
||||
|
||||
DateTime adviceDate = DateTime.Now.Date;
|
||||
DateTime plantingDate = new DateTime(2020, 3, 20);
|
||||
DateTime adviceDate = new DateTime(2020, 7, 7);// DateTime.Now.Date;
|
||||
DateTime plantingDate = new DateTime(2020, 4, 20);
|
||||
DateTime emergeDate = new DateTime(2020, 5, 20);
|
||||
|
||||
var blightItem = await _blightService.CreateAdvice(cropfieldItem, adviceDate, plantingDate, emergeDate);
|
||||
|
@@ -32,12 +32,12 @@ namespace FarmMapsBlight
|
||||
TaskType = "vnd.farmmaps.task.blight"
|
||||
};
|
||||
|
||||
taskRequest.attributes["d"] = DateTime.Now.Date.ToString("o");
|
||||
taskRequest.attributes["d"] = adviceDate.ToUniversalTime().ToString("o");
|
||||
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 });
|
||||
sprays.Add(new Spray() { fungicideCode = "FLEX", SprayTime = new DateTime(2020, 7, 1), dose = 0.6, isVRA = false });
|
||||
taskRequest.attributes["sprays"] = JsonConvert.SerializeObject(sprays);
|
||||
|
||||
List<Irrigation> irrigations = new List<Irrigation>();
|
||||
@@ -47,8 +47,8 @@ namespace FarmMapsBlight
|
||||
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskRequest);
|
||||
await PollTask(TimeSpan.FromSeconds(3), async (tokenSource) =>
|
||||
{
|
||||
_logger.LogInformation("Checking blight task status");
|
||||
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, taskCode);
|
||||
_logger.LogInformation($"Checking blight task status: { itemTaskStatus.State}");
|
||||
if (itemTaskStatus.IsFinished)
|
||||
tokenSource.Cancel();
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
<CopyToOutputDirectory>always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
Reference in New Issue
Block a user