forked from FarmMaps/FarmMapsApiClient
DataCropfieldCharacteristics as an array containing cropyield and possibly strawyield. If no strawyield is filled in then straw remains in field.
This commit is contained in:
@@ -88,7 +88,7 @@ namespace FarmmapsKPI
|
||||
TimeSpan tsTotalEstimated;
|
||||
|
||||
for (int i = 0; i < fieldsInputs.Count; i++)
|
||||
//for (int i = 3; i < 4; i++)
|
||||
//for (int i = 10; i < 12; i++)
|
||||
{
|
||||
watch.Restart();
|
||||
input = fieldsInputs[i];
|
||||
@@ -182,21 +182,27 @@ namespace FarmmapsKPI
|
||||
SaveSettings(settingsfile);
|
||||
}
|
||||
|
||||
// The cropfieldCharacteristicItem is used to enter crop yields
|
||||
// The cropfieldCharacteristicItem is used to enter crop yields and/or straw yields
|
||||
Item cropfieldCharacteristicItem;
|
||||
string dataCropfieldCharacteristic;
|
||||
//1 useExistingCropfieldWithChildren = false -> create new
|
||||
//2 useExistingCropfieldWithChildren = true && input.CropfieldCharacteristicItemCode = "" or absent -> read from settings json
|
||||
//3 useExistingCropfieldWithChildren = true && input.CropfieldCharacteristicItemCode like "deb48a74c5b54299bb852f17288010e9" in KPIinput -> use this one
|
||||
if (useExistingCropfieldWithChildren == false)
|
||||
{
|
||||
_logger.LogInformation("CreateCropfieldCharacteristicItemAsync ...");
|
||||
cropfieldCharacteristicItem = await _generalService.CreateCropfieldCharacteristicItemAsync(cropfieldItem.Code, cropYear, fieldGeom, input.DataCropfieldCharacteristic.ToString(Formatting.None));
|
||||
_settings.CropfieldCharacteristicItemCode = cropfieldCharacteristicItem.Code;
|
||||
SaveSettings(settingsfile);
|
||||
for (int i = 0; i < input.DataCropfieldCharacteristics.Length; i++)
|
||||
{
|
||||
dataCropfieldCharacteristic = input.DataCropfieldCharacteristics[i].ToString(Formatting.None);
|
||||
dynamic data = JObject.Parse(dataCropfieldCharacteristic);
|
||||
_logger.LogInformation($"CreateCropfieldCharacteristicItemAsync ... for cropfieldCharacteristic {i}: '{data.label}', value '{data.value}'");
|
||||
cropfieldCharacteristicItem = await _generalService.CreateCropfieldCharacteristicItemAsync(cropfieldItem.Code, cropYear, fieldGeom, dataCropfieldCharacteristic);
|
||||
_settings.CropfieldCharacteristicItemCode = cropfieldCharacteristicItem.Code;
|
||||
SaveSettings(settingsfile);
|
||||
}
|
||||
}
|
||||
else if (string.IsNullOrEmpty(input.CropfieldItemCode))
|
||||
{
|
||||
_logger.LogInformation("reading OperationItemCode from settings file");
|
||||
_logger.LogInformation("reading CropfieldCharacteristicItemCode from settings file");
|
||||
cropfieldCharacteristicItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldCharacteristicItemCode);
|
||||
}
|
||||
else
|
||||
@@ -362,7 +368,7 @@ namespace FarmmapsKPI
|
||||
//additional criterion for while loop: check if it really contains the E1 mbp elements.
|
||||
//while (trycnt == 0 || ((KPIItems.Count < targetKPIitemsCount || boolAquaticLife == false) & trycnt < maxtries))
|
||||
//normal while loop
|
||||
targetKPIitemsCount = 7; //if we know we should be getting 7 KPI items (A1,B1,B2,C1,D1,F1,F2) //8 if also E1
|
||||
targetKPIitemsCount = 8; //if we know we should be getting 8 KPI items (A1,B1,B2,C1,D1,E1,F1,F2)
|
||||
while (trycnt == 0 || (KPIItems.Count < targetKPIitemsCount & trycnt < maxtries))
|
||||
{
|
||||
_logger.LogInformation($"Call nr {trycnt + 1}");
|
||||
|
||||
Reference in New Issue
Block a user