- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
var vals =
tagsTypes.Zip(times,
(tagType, time) =>
{
if (error != null)
return new { time = time, val = (object)ServiceValue.DataSourceNotAvailable };
if (!timedVals.ContainsKey(tagType.tag))
return new { time = time, val = (object)ServiceValue.NoValue };
if (timedVals[tagType.tag].Count == 0)
return new { time = time, val = (object)ServiceValue.NoValue };
var value = timedVals[tagType.tag].Find(x => x.TimestampUTC == time.ToUniversalTime() && x.Value!=null);
if (value != null && value.IsGood())
{
if (value.Value == null)
return new { time = time, val = (object)ServiceValue.Error };
else
{
if (!string.IsNullOrEmpty(value.DigitalSetValue))
return new { time = time, val = (object)value.DigitalSetValue };
return new { time = time, val = value.Value };
}
}
else
{
var val = _connection.GetTagByName(tagType.tag).Data.ArcValue(time, RetrievalTypeConstants.rtAuto);
if (!string.IsNullOrEmpty(val.DigitalSetValue))
return new { time = time, val = (object)val.DigitalSetValue };
return new { time = time, val = val.Value };
}
return new { time = time, val = (object)ServiceValue.Error };
}).ToArray();
cykablyad 23.08.2017 12:40 # +1