[後端] 新增需求欄位
This commit is contained in:
parent
59ccf99d1e
commit
2c3a9a82e7
@ -142,30 +142,26 @@ 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")
|
||||
{
|
||||
list = rawData
|
||||
.GroupBy(x => new { building_tag = x.device_number.Split("_")[0], floor_tag = x.device_number.Split("_")[2], device_serial_tag = x.device_number.Split("_")[4] })
|
||||
.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("_")[0], floor_tag = x.device_number.Split("_")[2], device_serial_tag = x.device_number.Split("_")[4], device_number = x.device_number })
|
||||
.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_number = x.Key.device_number })
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
list = rawData
|
||||
.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 })
|
||||
.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], device_number = x.device_number })
|
||||
.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, device_number = x.Key.device_number })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
foreach (var l in list)
|
||||
{
|
||||
l.rawData = new List<HydroMeterRawDataOutput>();
|
||||
l.device_full_name = await backendRepository.GetOneAsync<string>($"select full_name from device where device_number = '{l.device_number}' and deleted = 0");
|
||||
if (tag_quantity == "5")
|
||||
{
|
||||
l.rawData.AddRange(
|
||||
@ -319,30 +315,26 @@ 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")
|
||||
{
|
||||
list = rawData
|
||||
.GroupBy(x => new { building_tag = x.device_number.Split("_")[0], floor_tag = x.device_number.Split("_")[2], device_serial_tag = x.device_number.Split("_")[4] })
|
||||
.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("_")[0], floor_tag = x.device_number.Split("_")[2], device_serial_tag = x.device_number.Split("_")[4], device_number = x.device_number })
|
||||
.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_number = x.Key.device_number })
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
list = rawData
|
||||
.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 })
|
||||
.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], device_number = x.device_number })
|
||||
.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, device_number = x.Key.device_number })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
foreach (var l in list)
|
||||
{
|
||||
l.rawData = new List<HydroMeterRawDataOutput>();
|
||||
l.device_full_name = await backendRepository.GetOneAsync<string>($"select full_name from device where device_number = '{l.device_number}' and deleted = 0");
|
||||
if (tag_quantity == "5")
|
||||
{
|
||||
l.rawData.AddRange(
|
||||
@ -516,7 +508,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
if (j == 2)
|
||||
{
|
||||
cell.SetCellValue(r.device_serial_tag);
|
||||
cell.SetCellValue(r.device_full_name);
|
||||
}
|
||||
|
||||
if (j == 3)
|
||||
|
@ -25,6 +25,8 @@ namespace FrontendWebApi.Models
|
||||
public string floor_tag { get; set; }
|
||||
public string device_serial_tag { get; set; }
|
||||
public string device_master { get; set; }
|
||||
public string device_number { get; set; }
|
||||
public string device_full_name { get; set; }
|
||||
public string total { get; set; }
|
||||
public string price { get; set; }
|
||||
public string total_price { get; set; }
|
||||
@ -36,7 +38,6 @@ 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