三相表断闸合闸

This commit is contained in:
ChenYi 2025-05-15 11:23:08 +08:00
parent e02a0953e9
commit e0c7ceab32
2 changed files with 123 additions and 108 deletions

View File

@ -104,85 +104,81 @@ namespace JiShe.CollectBus.ScheduledMeterReading
//[Route($"ammeter/list")]
public override async Task<List<DeviceInfo>> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890")
{
//442400040
//442400039
List<DeviceInfo> ammeterInfos = new List<DeviceInfo>();
ammeterInfos.Add(new DeviceInfo()
#if DEBUG
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);
if (ammeterInfos == null || ammeterInfos.Count <= 0)
{
Baudrate = 2400,
FocusAddress = "442400040",
Name = "保利单箱电表1",
FocusId = 95780,
DatabaseBusiID = 1,
MeteringCode = 1,
MeterAddress = "442405000040",
MeterId = 127035,
TypeName = 1,
DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
TimeDensity = 15,
BrandType = "DTS1980",
MeterType = MeterTypeEnum.Ammeter,
ProjectID = 1,
MeteringPort = MeteringPortConst.MeteringPortTwo,
Password = "000000",
});
ammeterInfos = new List<DeviceInfo>();
ammeterInfos.Add(new DeviceInfo()
{
Baudrate = 2400,
FocusAddress = "442400040",
Name = "保利单箱电表1",
FocusId = 95780,
DatabaseBusiID = 1,
MeteringCode = 0,
MeterAddress = "442405000040",
MeterId = 127035,
TypeName = 1,
DataTypes = "581,589,592,597,601",
TimeDensity = 15,
BrandType = "DTS1980",
MeterType = MeterTypeEnum.Ammeter,
ProjectID = 1,
MeteringPort = MeteringPortConst.MeteringPortTwo,
Password = "000000",
});
ammeterInfos.Add(new DeviceInfo()
{
Baudrate = 2400,
FocusAddress = "442400039",
Name = "保利单箱电表2",
FocusId = 69280,
DatabaseBusiID = 1,
MeteringCode = 1,
MeterAddress = "442405000039",
MeterId = 95594,
TypeName = 1,
DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
TimeDensity = 15,
BrandType = "DTS1980",
MeterType = MeterTypeEnum.Ammeter,
ProjectID = 1,
MeteringPort = MeteringPortConst.MeteringPortTwo,
Password = "000000",
});
ammeterInfos.Add(new DeviceInfo()
{
Baudrate = 2400,
FocusAddress = "442400039",
Name = "保利单箱电表2",
FocusId = 69280,
DatabaseBusiID = 1,
MeteringCode = 0,
MeterAddress = "442405000039",
MeterId = 95594,
TypeName = 1,
DataTypes = "581,589,592,597,601",
TimeDensity = 15,
BrandType = "DTS1980",
MeterType = MeterTypeEnum.Ammeter,
ProjectID = 1,
MeteringPort = MeteringPortConst.MeteringPortTwo,
Password = "000000",
});
//ammeterInfos.Add(new DeviceInfo()
//{
// Baudrate = 2400,
// FocusAddress = "402440506",
// Name = "张家祠工务(三相电表)",
// FocusId = 95780,
// DatabaseBusiID = 1,
// MeteringCode = 1,
// MeterAddress = "402410040506",
// MeterId = 127035,
// TypeName = 3,
// DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
// TimeDensity = 15,
// BrandType = "DDS1980",
//});
ammeterInfos.Add(new DeviceInfo()
{
Baudrate = 2400,
FocusAddress = "402440506",
Name = "中环半导体9#冷却泵-220KW(三相电表)",
FocusId = 106857,
DatabaseBusiID = 1,
MeteringCode = 0,
MeterAddress = "402410040506",
MeterId = 139059,
TypeName = 3,
DataTypes = "449,503,581,582,583,584,585,586,587,588,589,590,591,592,593,594,597,598,599,600,601,602,603,604,605,606,607,608,661,663,677,679",
TimeDensity = 15,
BrandType = "DTS1980",
Password = "000000",
ProjectID = 1,
MeterType = MeterTypeEnum.Ammeter,
MeteringPort = MeteringPortConst.MeteringPortTwo,
});
//ammeterInfos.Add(new DeviceInfo()
//{
// Baudrate = 2400,
// FocusAddress = "542400504",
// Name = "五号配(长芦二所四排)(单相电表)",
// FocusId = 69280,
// DatabaseBusiID = 1,
// MeteringCode = 2,
// MeterAddress = "542410000504",
// MeterId = 95594,
// TypeName = 1,
// DataTypes = "581,589,592,597,601",
// TimeDensity = 15,
// BrandType = "DDS1980",
//});
FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp,ammeterInfos);
}
return ammeterInfos;
#else
try
{
string sql = $@"SELECT
@ -232,6 +228,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading
{
throw ex;
}
#endif
}
@ -288,40 +286,55 @@ namespace JiShe.CollectBus.ScheduledMeterReading
if (settingInfos == null || settingInfos.Count <= 0)
{
settingInfos = new List<AmmeterAutoValveControlSetting>();
settingInfos.Add(new AmmeterAutoValveControlSetting()
{
MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "442405000040",
FocusAddress = "442400040",
FocusId = 95780,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 127035,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,
});
settingInfos.Add(new AmmeterAutoValveControlSetting()
{
MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "442405000039",
FocusAddress = "442400039",
FocusId = 69280,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 95594,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,
});
//settingInfos.Add(new AmmeterAutoValveControlSetting()
//{
// MeterType = MeterTypeEnum.Ammeter,
// AmmerterAddress = "442405000040",
// FocusAddress = "442400040",
// FocusId = 95780,
// ProjectID = 1,
// TripType = "on",
// TripTime = $"{DateTime.Now:HH:mm}",
// MeterId = 127035,
// LoopType = "EachDay",
// EachDayWithout = "周六,周日",
// TimeDensity = 15,
//});
//settingInfos.Add(new AmmeterAutoValveControlSetting()
//{
// MeterType = MeterTypeEnum.Ammeter,
// AmmerterAddress = "442405000039",
// FocusAddress = "442400039",
// FocusId = 69280,
// ProjectID = 1,
// TripType = "on",
// TripTime = $"{DateTime.Now:HH:mm}",
// MeterId = 95594,
// LoopType = "EachDay",
// EachDayWithout = "周六,周日",
// TimeDensity = 15,
//});
settingInfos.Add(new AmmeterAutoValveControlSetting()
{
MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "402410040506",
FocusAddress = "402440506",
FocusId = 106857,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 139059,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,
});
FreeRedisProvider.Instance.Set(redisCacheDeviceSettingInfoHashKey, settingInfos);
}
List<DeviceInfo> meterInfos =await GetAmmeterInfoList();
#else
//获取电表阀控配置
var settingInfos = await GetAmmeterAutoValveControlSetting(currentTimeStr);
@ -330,8 +343,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
_logger.LogError($"{nameof(AmmeterScheduledAutoValveControl)} 电表自动阀控时,阀控数据为空, -101");
return null;
}
#endif
//设备hash缓存key
string redisCacheDeviceInfoHashKey = $"{string.Format(RedisConst.CacheDeviceInfoHashKey, SystemType, ServerTagName)}";
@ -350,6 +361,10 @@ namespace JiShe.CollectBus.ScheduledMeterReading
}
}
}
#endif
List<MeterReadingTelemetryPacketInfo> taskList = new List<MeterReadingTelemetryPacketInfo>();
foreach (var settingInfo in settingInfos)
@ -392,7 +407,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
ammeterInfo.TripState = 0;
tripStateResult = true;
subItemCode = T6452007PacketItemCodeConst.C1C011C;
if (ammeterInfo.TypeName != 1)
if (ammeterInfo.TypeName > 3)
{
subItemCode = T6452007PacketItemCodeConst.C1C011B;
}

View File

@ -19,15 +19,15 @@ namespace JiShe.CollectBus.Common.Consts
public const string C1C011A = "1C_01_1A";
/// <summary>
/// 单相合闸
/// 合闸允许
/// </summary>
public const string C1C011B = "1C_01_1B";
/// <summary>
/// 三相合闸
/// 合闸
/// </summary>
public const string C1C011C = "1C_01_1C";
/// <summary>
/// 触发报警
/// </summary>