SingleForkRGVAnalysis.cs
2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using HHECS.BllModel;
using HHECS.DAQHandle.Dto;
using HHECS.DAQShared.Common.Enums;
using HHECS.DAQShared.Models;
namespace HHECS.DAQHandle.EquipmentHandle
{
internal class SingleForkRGVAnalysis : AnalysisBase
{
public SingleForkRGVAnalysis(AnalysisParameter parameter) : base(parameter)
{
}
protected override BllResult<EquipmentStatus> GetEquipmentStatus(EquipmentExtend equipment, EquipmentDataRecord record)
{
try
{
var tagResult = JsonConvertToTagList(record.Tags);
if (!tagResult.Success)
{
return BllResultFactory.Error<EquipmentStatus>(tagResult.Msg);
}
var dictionaryResult = TagListConvertToDictionary(equipment.EquipmentProps, tagResult.Data);
if (!dictionaryResult.Success)
{
return BllResultFactory.Error<EquipmentStatus>(dictionaryResult.Msg);
}
var dictionary = dictionaryResult.Data;
var totalError = dictionary[SingleForkRGVProp.TotalError.ToString()];
var operationModel = dictionary[SingleForkRGVProp.OperationModel.ToString()];
var fork1TaskNo = dictionary[SingleForkRGVProp.Fork1TaskNo.ToString()];
var validationResult = ValidationIsNullOrWhiteSpace(totalError, operationModel, fork1TaskNo);
if (!validationResult.Success)
{
return BllResultFactory.Error<EquipmentStatus>(validationResult.Msg);
}
if (totalError == bool.TrueString)
{
return BllResultFactory.Success(EquipmentStatus.Failure);
}
//联机状态,且有任务号,则认为是运行状态
if (operationModel == "5" && fork1TaskNo != "0")
{
return BllResultFactory.Success(EquipmentStatus.Running);
}
return BllResultFactory.Success(EquipmentStatus.Free);
}
catch (Exception ex)
{
return BllResultFactory.Error<EquipmentStatus>(ex.Message);
}
}
}
}