三相表断闸合闸

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

View File

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