Compare commits

..

No commits in common. "fcf4b0c852c1122c81c927875f1911b4c1ae2d35" and "84bb1a95636077336404673b80aa3fcce66f9425" have entirely different histories.

2 changed files with 99 additions and 114 deletions

View File

@ -104,80 +104,84 @@ 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")
{ {
#if DEBUG //442400040
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo"; //442400039
List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp); List<DeviceInfo> ammeterInfos = new List<DeviceInfo>();
if (ammeterInfos == null || ammeterInfos.Count <= 0) ammeterInfos.Add(new DeviceInfo()
{ {
ammeterInfos = new List<DeviceInfo>(); Baudrate = 2400,
ammeterInfos.Add(new DeviceInfo() FocusAddress = "442400040",
{ Name = "保利单箱电表1",
Baudrate = 2400, FocusId = 95780,
FocusAddress = "442400040", DatabaseBusiID = 1,
Name = "保利单箱电表1", MeteringCode = 1,
FocusId = 95780, MeterAddress = "442405000040",
DatabaseBusiID = 1, MeterId = 127035,
MeteringCode = 0, TypeName = 1,
MeterAddress = "442405000040", 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",
MeterId = 127035, TimeDensity = 15,
TypeName = 1, BrandType = "DTS1980",
DataTypes = "581,589,592,597,601", MeterType = MeterTypeEnum.Ammeter,
TimeDensity = 15, ProjectID = 1,
BrandType = "DTS1980", MeteringPort = MeteringPortConst.MeteringPortTwo,
MeterType = MeterTypeEnum.Ammeter, Password = "000000",
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 = 0, MeteringCode = 1,
MeterAddress = "442405000039", MeterAddress = "442405000039",
MeterId = 95594, MeterId = 95594,
TypeName = 1, TypeName = 1,
DataTypes = "581,589,592,597,601", 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 = "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 = "中环半导体9#冷却泵-220KW(三相电表)", // Name = "张家祠工务(三相电表)",
FocusId = 106857, // FocusId = 95780,
DatabaseBusiID = 1, // DatabaseBusiID = 1,
MeteringCode = 0, // MeteringCode = 1,
MeterAddress = "402410040506", // MeterAddress = "402410040506",
MeterId = 139059, // MeterId = 127035,
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 = "DTS1980", // BrandType = "DDS1980",
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
{ {
@ -228,8 +232,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
{ {
throw ex; throw ex;
} }
#endif
} }
@ -286,55 +288,40 @@ 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()
//{
// 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() settingInfos.Add(new AmmeterAutoValveControlSetting()
{ {
MeterType = MeterTypeEnum.Ammeter, MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "402410040506", AmmerterAddress = "442405000040",
FocusAddress = "402440506", FocusAddress = "442400040",
FocusId = 106857, FocusId = 95780,
ProjectID = 1, ProjectID = 1,
TripType = "on", TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}", TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 139059, 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", LoopType = "EachDay",
EachDayWithout = "周六,周日", EachDayWithout = "周六,周日",
TimeDensity = 15, 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);
@ -343,6 +330,8 @@ 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)}";
@ -361,10 +350,6 @@ 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)
@ -407,7 +392,7 @@ namespace JiShe.CollectBus.ScheduledMeterReading
ammeterInfo.TripState = 0; ammeterInfo.TripState = 0;
tripStateResult = true; tripStateResult = true;
subItemCode = T6452007PacketItemCodeConst.C1C011C; subItemCode = T6452007PacketItemCodeConst.C1C011C;
if (ammeterInfo.TypeName > 3) if (ammeterInfo.TypeName != 1)
{ {
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";