1
This commit is contained in:
commit
68b3caeafb
@ -18,5 +18,12 @@ namespace YunDa.ISAS.Application.GeneralInformation.SecondaryCircuitInfo
|
|||||||
/// <param name="dzType"></param>
|
/// <param name="dzType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<RequestResult<List<ImDeviceDzOutput>>> FindDZDataByEquipmentInfoId(Guid? equipmentInfoId, string dzType);
|
Task<RequestResult<List<ImDeviceDzOutput>>> FindDZDataByEquipmentInfoId(Guid? equipmentInfoId, string dzType);
|
||||||
|
/// <summary>
|
||||||
|
/// 根据装置获取定值
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="deviceAddr"></param>
|
||||||
|
/// <param name="cpuIndex"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
RequestResult<List<ImDeviceDzOutput>> GetDzByDeviceAddr(int deviceAddr, int cpuIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -138,8 +138,7 @@ namespace YunDa.ISAS.Application.GeneralInformation.ProtectionSettingInfo
|
|||||||
{
|
{
|
||||||
var data = _imDeviceDzRepository.GetAllIncluding(t => t.Device,t=>t.DzTypeNavigation).Where(t => t.Device.DeviceAddr == deviceAddr)
|
var data = _imDeviceDzRepository.GetAllIncluding(t => t.Device,t=>t.DzTypeNavigation).Where(t => t.Device.DeviceAddr == deviceAddr)
|
||||||
.Where(t => t.CpuIndex == cpuIndex).OrderBy(t=>t.DzIndex);
|
.Where(t => t.CpuIndex == cpuIndex).OrderBy(t=>t.DzIndex);
|
||||||
|
rst.ResultData = MapDzPutput(data);
|
||||||
rst.ResultData =ObjectMapper.Map<List<ImDeviceDzOutput>>(data);
|
|
||||||
rst.Flag = true;
|
rst.Flag = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -366,7 +365,8 @@ namespace YunDa.ISAS.Application.GeneralInformation.ProtectionSettingInfo
|
|||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
var list = dz.Where(t => t.CpuIndex == 9).OrderBy(t=>t.DzIndex);
|
var list = dz.Where(t => t.CpuIndex == 9).OrderBy(t=>t.DzIndex);
|
||||||
List<ImDeviceDzOutput> imDeviceDzOutputs = ObjectMapper.Map<List<ImDeviceDzOutput>>(list);
|
// 手动转换为 ImDeviceDzOutput 列表
|
||||||
|
List<ImDeviceDzOutput> imDeviceDzOutputs = MapDzPutput(list);
|
||||||
List<string> redisSystems = imDeviceDzOutputs.Select(t => t.Id).ToList();
|
List<string> redisSystems = imDeviceDzOutputs.Select(t => t.Id).ToList();
|
||||||
await _imDeviceDzRedis.HashSetUpdateManyAsync($"DZ_{dz.Key.ToString("X2")}_System", redisSystems, imDeviceDzOutputs);
|
await _imDeviceDzRedis.HashSetUpdateManyAsync($"DZ_{dz.Key.ToString("X2")}_System", redisSystems, imDeviceDzOutputs);
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ namespace YunDa.ISAS.Application.GeneralInformation.ProtectionSettingInfo
|
|||||||
if (true)
|
if (true)
|
||||||
{
|
{
|
||||||
var list = dz.Where(t => t.CpuIndex == 1).OrderBy(t => t.DzIndex);
|
var list = dz.Where(t => t.CpuIndex == 1).OrderBy(t => t.DzIndex);
|
||||||
List<ImDeviceDzOutput> imDeviceDzOutputs = ObjectMapper.Map<List<ImDeviceDzOutput>>(list);
|
List<ImDeviceDzOutput> imDeviceDzOutputs = MapDzPutput(list);
|
||||||
List<string> redisSystems = imDeviceDzOutputs.Select(t => t.Id).ToList();
|
List<string> redisSystems = imDeviceDzOutputs.Select(t => t.Id).ToList();
|
||||||
await _imDeviceDzRedis.HashSetUpdateManyAsync($"DZ_{dz.Key.ToString("X2")}_User", redisSystems, imDeviceDzOutputs);
|
await _imDeviceDzRedis.HashSetUpdateManyAsync($"DZ_{dz.Key.ToString("X2")}_User", redisSystems, imDeviceDzOutputs);
|
||||||
}
|
}
|
||||||
@ -390,53 +390,37 @@ namespace YunDa.ISAS.Application.GeneralInformation.ProtectionSettingInfo
|
|||||||
return rst;
|
return rst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private List<ImDeviceDzOutput> MapDzPutput(IEnumerable<ImDeviceDz> list)
|
||||||
/// 获取定值类型
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[ShowApi]
|
|
||||||
[AbpAllowAnonymous]
|
|
||||||
[HttpGet]
|
|
||||||
public async Task<RequestResult<List<ImDztype>>> GetDeviceSettingType()
|
|
||||||
{
|
{
|
||||||
RequestResult<List<ImDztype>> rst = new RequestResult<List<ImDztype>>();
|
return list.Select(t => new ImDeviceDzOutput
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
var repo = await _imDztypeRepository.GetAllAsync();
|
Id = t.Id,
|
||||||
rst.ResultData = repo.ToList();
|
DeviceId = t.DeviceId,
|
||||||
rst.Flag = true;
|
CpuIndex = t.CpuIndex,
|
||||||
}
|
DzIndex = t.DzIndex,
|
||||||
catch (Exception ex)
|
DzName = t.DzName,
|
||||||
{
|
DzComment = t.DzComment,
|
||||||
rst.Message = ex.Message;
|
DzRange = t.DzRange,
|
||||||
}
|
DzMin = t.DzMin,
|
||||||
|
DzMax = t.DzMax,
|
||||||
return rst;
|
DzUnit = t.DzUnit,
|
||||||
}
|
DzCoeff = t.DzCoeff,
|
||||||
/// <summary>
|
DzPrecise = t.DzPrecise,
|
||||||
/// 获取定值枚举
|
DzUnit1 = t.DzUnit1,
|
||||||
/// </summary>
|
DzCoeff1 = t.DzCoeff1,
|
||||||
/// <returns></returns>
|
DzPrecise1 = t.DzPrecise1,
|
||||||
[ShowApi]
|
CtrlWordTypeId = t.CtrlWordTypeId,
|
||||||
[AbpAllowAnonymous]
|
DzType = t.DzType,
|
||||||
[HttpGet]
|
PUCtgyCode = t.Device.PuctgyCode, // 假设这个字段由某些条件决定
|
||||||
public async Task<RequestResult<List<ImDeviceDzenumPu>>> GetDeviceSettingEnumPu()
|
EnumTypeId = t.EnumTypeId,
|
||||||
{
|
DzUnitCvtCoeff = t.DzUnitCvtCoeff,
|
||||||
RequestResult<List<ImDeviceDzenumPu>> rst = new RequestResult<List<ImDeviceDzenumPu>>();
|
RelatePtId = t.RelatePtId,
|
||||||
|
RelateCtId = t.RelateCtId,
|
||||||
try
|
ReadOnly = t.ReadOnly,
|
||||||
{
|
Hidden = t.Hidden,
|
||||||
var repo = await _imDeviceDzenumPuitory.GetAllAsync();
|
DzTypeNavigation = new ImDztypeOutput { /* 映射 ImDztype 到 ImDztypeOutput 的属性 */ },
|
||||||
rst.ResultData = repo.ToList();
|
Value = (new Random().Next(0, 10)).ToString() // 随机值
|
||||||
rst.Flag = true;
|
}).ToList();
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
rst.Message = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rst;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ namespace YunDa.SOMS.DataTransferObject.GeneralInformation.ProtectionSettingDto
|
|||||||
public int? DzPrecise1 { get; set; }
|
public int? DzPrecise1 { get; set; }
|
||||||
public int? CtrlWordTypeId { get; set; }
|
public int? CtrlWordTypeId { get; set; }
|
||||||
public int DzType { get; set; }
|
public int DzType { get; set; }
|
||||||
|
public int PUCtgyCode { get; set; }
|
||||||
public int? EnumTypeId { get; set; }
|
public int? EnumTypeId { get; set; }
|
||||||
public double? DzUnitCvtCoeff { get; set; }
|
public double? DzUnitCvtCoeff { get; set; }
|
||||||
public string? RelatePtId { get; set; }
|
public string? RelatePtId { get; set; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user