GrooveService.cs
3.07 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using HHECS.BllModel;
using HHECS.RobotTool.Dto;
using HHECS.RobotTool.Model;
using HHECS.RobotTool.Utils;
namespace HHECS.RobotTool.Service
{
public class GrooveService
{
private readonly IFreeSql _freeSql;
public GrooveService(IFreeSql freeSql)
{
_freeSql = freeSql;
}
/// <summary>
/// 获取坡口自适应工艺参数
/// </summary>
/// <param name="parameter">输入参数</param>
/// <returns></returns>
public BllResult<RobotOutputParameter> GetComputedData(RobotInputParameter parameter)
{
try
{
return GrooveComputerTool.GetComputedData(parameter);
}
catch (Exception ex)
{
return BllResultFactory.Error<RobotOutputParameter>(ex.Message);
}
}
/// <summary>
/// 获取输入参数默认值
/// </summary>
/// <param name="robotCode">机器人编码</param>
/// <returns></returns>
public BllResult<RobotInputParameter> GetInputParameterDefault(string robotCode)
{
try
{
//测试代码
//var temp = new RobotInputParameter
//{
// GrooveWidth = 37,
// GrooveDepth = 30,
// WeldingWire = 1.2,
// ReservedGap = 0,
// BluntEdgeSize = 2,
// WeldLength = 1000,
// WeldWidth = 1.5,
// WeldHeight = 2
//};
//return BllResultFactory.Success(temp);
var configId = _freeSql.Queryable<EquipmentExtend>().Where(x => x.Code == robotCode).First(x => x.RobotConfigId);
var config = _freeSql.Queryable<RobotConfig>().Where(x => x.Id == configId).First();
if (config == null)
{
return BllResultFactory.Error<RobotInputParameter>($"设备:{robotCode},默认参数ID[{configId}]在配置中不存在,请检查参数配置数据后再试!");
}
var result = new RobotInputParameter
{
//WeldingWire = config.WeldingWire,
////ReservedGap = config.ReservedGap,
////BluntEdgeSize = config.BluntEdgeSize,
//WeldLength = config.WeldLength,
////WeldWidth = config.WeldWidth,
//WeldHeight = config.WeldHeight,
};
return BllResultFactory.Success(result);
}
catch (Exception ex)
{
return BllResultFactory.Error<RobotInputParameter>(ex.Message);
}
}
/// <summary>
/// 获取输入参数默认值
/// </summary>
/// <param name="robotNo">机器人编号</param>
/// <returns></returns>
public BllResult<RobotInputParameter> GetInputParameterDefault(int robotNo) => GetInputParameterDefault($"Robot{robotNo}");
}
}