修改代码

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

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 //#if DEBUG
var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo"; // var redisCacheDeviceInfoHashKeyTemp = $"CollectBus:Energy:JiSheCollectBus109:DeviceInfo";
List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp); // List<DeviceInfo> ammeterInfos = FreeRedisProvider.Instance.Get<List<DeviceInfo>>(redisCacheDeviceInfoHashKeyTemp);//542400504
if (ammeterInfos == null || ammeterInfos.Count <= 0) // if (ammeterInfos == null || ammeterInfos.Count <= 0)
{ // {
ammeterInfos = new List<DeviceInfo>(); // ammeterInfos = new List<DeviceInfo>();
ammeterInfos.Add(new DeviceInfo() // ammeterInfos.Add(new DeviceInfo()
{ // {
Baudrate = 2400, // Baudrate = 2400,
FocusAddress = "442400040", // FocusAddress = "442400040",
Name = "保利单箱电表1", // Name = "保利单箱电表1",
FocusId = 95780, // FocusId = 95780,
DatabaseBusiID = 1, // DatabaseBusiID = 1,
MeteringCode = 0, // MeteringCode = 0,
MeterAddress = "442405000040", // MeterAddress = "442405000040",
MeterId = 127035, // MeterId = 127035,
TypeName = 1, // TypeName = 1,
DataTypes = "581,589,592,597,601", // 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 = "442400039", // FocusAddress = "442400039",
Name = "保利单箱电表2", // Name = "保利单箱电表2",
FocusId = 69280, // FocusId = 69280,
DatabaseBusiID = 1, // DatabaseBusiID = 1,
MeteringCode = 0, // MeteringCode = 0,
MeterAddress = "442405000039", // MeterAddress = "442405000039",
MeterId = 95594, // MeterId = 95594,
TypeName = 1, // TypeName = 1,
DataTypes = "581,589,592,597,601", // 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 = "中环半导体9#冷却泵-220KW(三相电表)", // Name = "中环半导体9#冷却泵-220KW(三相电表)",
FocusId = 106857, // FocusId = 106857,
DatabaseBusiID = 1, // DatabaseBusiID = 1,
MeteringCode = 0, // MeteringCode = 0,
MeterAddress = "402410040506", // MeterAddress = "402410040506",
MeterId = 139059, // 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 = "DTS1980", // BrandType = "DTS1980",
Password = "000000", // Password = "000000",
ProjectID = 1, // ProjectID = 1,
MeterType = MeterTypeEnum.Ammeter, // MeterType = MeterTypeEnum.Ammeter,
MeteringPort = MeteringPortConst.MeteringPortTwo, // MeteringPort = MeteringPortConst.MeteringPortTwo,
}); // });
FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp,ammeterInfos); // FreeRedisProvider.Instance.Set(redisCacheDeviceInfoHashKeyTemp,ammeterInfos);
} // }
// return ammeterInfos;
//#else
//#endif
return ammeterInfos;
#else
try try
{ {
@ -216,6 +220,11 @@ namespace JiShe.CollectBus.ScheduledMeterReading
WHERE 1=1 and C.Special = 0 "; WHERE 1=1 and C.Special = 0 ";
//TODO 记得移除特殊表过滤 //TODO 记得移除特殊表过滤
#if DEBUG
sql = $@"{sql} and c.Address in('542410000504','442405000040','442405000039','402410040506')";
#endif
if (!string.IsNullOrWhiteSpace(gatherCode)) if (!string.IsNullOrWhiteSpace(gatherCode))
{ {
sql = $@"{sql} AND A.GatherCode = '{gatherCode}'"; sql = $@"{sql} AND A.GatherCode = '{gatherCode}'";
@ -228,7 +237,6 @@ namespace JiShe.CollectBus.ScheduledMeterReading
{ {
throw ex; throw ex;
} }
#endif
} }
@ -286,34 +294,34 @@ 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 = 57683,
// ProjectID = 1, ProjectID = 1,
// TripType = "on", TripType = "on",
// TripTime = $"{DateTime.Now:HH:mm}", TripTime = $"{DateTime.Now:HH:mm}",
// MeterId = 127035, MeterId = 78971,
// 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 = 57684,
// ProjectID = 1, ProjectID = 1,
// TripType = "on", TripType = "on",
// TripTime = $"{DateTime.Now:HH:mm}", TripTime = $"{DateTime.Now:HH:mm}",
// MeterId = 95594, MeterId = 78972,
// LoopType = "EachDay", LoopType = "EachDay",
// EachDayWithout = "周六,周日", EachDayWithout = "周六,周日",
// TimeDensity = 15, TimeDensity = 15,
//}); });
settingInfos.Add(new AmmeterAutoValveControlSetting() settingInfos.Add(new AmmeterAutoValveControlSetting()
@ -321,11 +329,26 @@ namespace JiShe.CollectBus.ScheduledMeterReading
MeterType = MeterTypeEnum.Ammeter, MeterType = MeterTypeEnum.Ammeter,
AmmerterAddress = "402410040506", AmmerterAddress = "402410040506",
FocusAddress = "402440506", FocusAddress = "402440506",
FocusId = 106857, FocusId = 57685,
ProjectID = 1, ProjectID = 1,
TripType = "on", TripType = "on",
TripTime = $"{DateTime.Now:HH:mm}", 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", LoopType = "EachDay",
EachDayWithout = "周六,周日", EachDayWithout = "周六,周日",
TimeDensity = 15, TimeDensity = 15,