[後端] 水電表增加設備名稱
This commit is contained in:
parent
048bb80f9c
commit
59ccf99d1e
@ -142,6 +142,11 @@ namespace FrontendWebApi.ApiControllers
|
||||
var rawData = await backendRepository.GetAllAsync<HydroMeterRawDataOutput>(sql,
|
||||
new { startTime = startTime, endtime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat });
|
||||
|
||||
foreach (var rd in rawData)
|
||||
{
|
||||
rd.device_full_name = await backendRepository.GetOneAsync<string>($"select full_name from device where device_number = '{rd.device_number}' and deleted = 0");
|
||||
}
|
||||
|
||||
List<HydroMeterOutput> list = new List<HydroMeterOutput>();
|
||||
if (tag_quantity == "5")
|
||||
{
|
||||
@ -314,6 +319,11 @@ namespace FrontendWebApi.ApiControllers
|
||||
var rawData = await backendRepository.GetAllAsync<HydroMeterRawDataOutput>(sql,
|
||||
new { startTime = startTime, endTime = endTime, building_tag = input.building_tag, floor_tag = input.floor_tag, dateFormat = dateFormat });
|
||||
|
||||
foreach (var rd in rawData)
|
||||
{
|
||||
rd.device_full_name = await backendRepository.GetOneAsync<string>($"select full_name from device where device_number = '{rd.device_number}' and deleted = 0");
|
||||
}
|
||||
|
||||
List<HydroMeterOutput> list = new List<HydroMeterOutput>();
|
||||
if (tag_quantity == "5")
|
||||
{
|
||||
@ -325,8 +335,8 @@ namespace FrontendWebApi.ApiControllers
|
||||
else
|
||||
{
|
||||
list = rawData
|
||||
.GroupBy(x => new { building_tag = x.device_number.Split("_")[1], floor_tag = x.device_number.Split("_")[4], device_serial_tag = x.device_number.Split("_")[7] })
|
||||
.Select(x => new HydroMeterOutput { building_tag = x.Key.building_tag, floor_tag = x.Key.floor_tag, device_serial_tag = x.Key.device_serial_tag })
|
||||
.GroupBy(x => new { building_tag = x.device_number.Split("_")[1], floor_tag = x.device_number.Split("_")[4], device_master = x.device_number.Split("_")[5], device_serial_tag = x.device_number.Split("_")[7] })
|
||||
.Select(x => new HydroMeterOutput { building_tag = x.Key.building_tag, floor_tag = x.Key.floor_tag, device_serial_tag = x.Key.device_serial_tag, device_master = x.Key.device_master })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@ -342,7 +352,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
else
|
||||
{
|
||||
l.rawData.AddRange(
|
||||
rawData.Where(x => x.device_number.Split("_")[1] == l.building_tag && x.device_number.Split("_")[4] == l.floor_tag && x.device_number.Split("_")[7] == l.device_serial_tag)
|
||||
rawData.Where(x => x.device_number.Split("_")[1] == l.building_tag && x.device_number.Split("_")[4] == l.floor_tag && x.device_number.Split("_")[5] == l.device_master && x.device_number.Split("_")[7] == l.device_serial_tag)
|
||||
);
|
||||
}
|
||||
l.building_name = await backendRepository.GetOneAsync<string>("select full_name from building where building_tag = @building_tag and deleted = 0",
|
||||
|
@ -36,6 +36,7 @@ namespace FrontendWebApi.Models
|
||||
public string timeStamp { get; set; }
|
||||
public string device_number { get; set; }
|
||||
public decimal avg_rawdata { get; set; }
|
||||
public string device_full_name { get; set; }
|
||||
}
|
||||
|
||||
public class HydroMeterPriceInput
|
||||
|
Loading…
Reference in New Issue
Block a user