修改代码

This commit is contained in:
ChenYi 2025-05-15 14:05:18 +08:00
parent fcf4b0c852
commit 1b5b43fde6

View File

@ -104,81 +104,85 @@ namespace JiShe.CollectBus.ScheduledMeterReading
//[Route($"ammeter/list")]
public override async Task<List<DeviceInfo>> GetAmmeterInfoList(string gatherCode = "V4-Gather-8890")
{
#if DEBUG
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);
if (ammeterInfos == null || ammeterInfos.Count <= 0)
{
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",
});
//#if DEBUG
// var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
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",
});
// List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);//542400504
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,
});
// if (ammeterInfos == null || ammeterInfos.Count <= 0)
// {
// 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 = 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 = "中环半导体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,
// });
FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp,ammeterInfos);
}
// FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp,ammeterInfos);
// }
// return ammeterInfos;
//#else
//#endif
return ammeterInfos;
#else
try
{
string sql = $@"SELECT
@ -216,6 +220,11 @@ namespace JiShe.CollectBus.ScheduledMeterReading
WHERE 1=1 and C.Special = 0 ";
//TODO 记得移除特殊表过滤
#if DEBUG
sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')";
#endif
if (!string.IsNullOrWhiteSpace(gatherCode))
{
sql = $@"{sql} AND A.GatherCode = '{gatherCode}'";
@ -228,7 +237,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
{
throw ex;
}
#endif
}
@ -286,34 +294,34 @@ 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 = 57683,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 78971,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,
});
settingInfos.Add(new AmmeterAutoValveControlSetting()
{
MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "442405000039",
FocusAddress = "442400039",
FocusId = 57684,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 78972,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,
});
settingInfos.Add(new AmmeterAutoValveControlSetting()
@ -321,11 +329,26 @@ namespace JiShe.CollectBus.ScheduledMeterReading
MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "402410040506",
FocusAddress = "402440506",
FocusId = 106857,
FocusId = 57685,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 139059,
MeterId = 78973,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,
});
settingInfos.Add(new AmmeterAutoValveControlSetting()
{
MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "542410000504",
FocusAddress = "542400504",
FocusId = 57686,
ProjectID = 1,
TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}",
MeterId = 78974,
LoopType = "EachDay",
EachDayWithout = "周六,周日",
TimeDensity = 15,