Second upload
This commit is contained in:
parent
c64eff200c
commit
5ab2da3c3d
@ -43,6 +43,7 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
in_time = c.in_time,
|
in_time = c.in_time,
|
||||||
out_time = c.out_time,
|
out_time = c.out_time,
|
||||||
location = c.location,
|
location = c.location,
|
||||||
|
out_location=c.out_location,
|
||||||
}
|
}
|
||||||
).ToListAsync();
|
).ToListAsync();
|
||||||
|
|
||||||
@ -704,7 +705,6 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
/// <param name="start_time">起始時間</param>
|
/// <param name="start_time">起始時間</param>
|
||||||
/// <param name="end_time">結束時間</param>
|
/// <param name="end_time">結束時間</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
||||||
[HttpGet("location_name_2_-{id}-start_time-{start_time}-end_time-{end_time}-export_excel")]
|
[HttpGet("location_name_2_-{id}-start_time-{start_time}-end_time-{end_time}-export_excel")]
|
||||||
public async Task<IActionResult> ExportYuntech_in_car_table_date_to_excel(string id, DateTime start_time, DateTime end_time)
|
public async Task<IActionResult> ExportYuntech_in_car_table_date_to_excel(string id, DateTime start_time, DateTime end_time)
|
||||||
{
|
{
|
||||||
@ -731,14 +731,22 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
worksheet.Cells["C1"].Value = "進入時間";
|
worksheet.Cells["C1"].Value = "進入時間";
|
||||||
worksheet.Cells["D1"].Value = "出去時間";
|
worksheet.Cells["D1"].Value = "出去時間";
|
||||||
|
|
||||||
|
// 設置列寬
|
||||||
|
worksheet.Column(1).Width = 20;
|
||||||
|
worksheet.Column(2).Width = 15;
|
||||||
|
worksheet.Column(3).Width = 25;
|
||||||
|
worksheet.Column(4).Width = 25;
|
||||||
|
|
||||||
// 添加資料
|
// 添加資料
|
||||||
int row = 2;
|
int row = 2;
|
||||||
foreach (var item in in_car_table)
|
foreach (var item in in_car_table)
|
||||||
{
|
{
|
||||||
worksheet.Cells["A" + row].Value = item.location;
|
worksheet.Cells["A" + row].Value = item.location;
|
||||||
worksheet.Cells["B" + row].Value = item.license_plate_number;
|
worksheet.Cells["B" + row].Value = item.license_plate_number;
|
||||||
worksheet.Cells["C" + row].Value = item.in_time.ToString(); // 可以自行調整日期時間的格式
|
worksheet.Cells["C" + row].Value = item.in_time?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
|
||||||
worksheet.Cells["D" + row].Value = item.out_time?.ToString();
|
worksheet.Cells["D" + row].Value = item.out_time?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
|
||||||
|
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,6 +760,7 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 自動生成時間段Excel文件
|
#region 自動生成時間段Excel文件
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自動生成包含時間範圍內車輛資料的 Excel 文件
|
/// 自動生成包含時間範圍內車輛資料的 Excel 文件
|
||||||
@ -788,15 +797,19 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
worksheet.Cells["B1"].Value = "車牌號碼";
|
worksheet.Cells["B1"].Value = "車牌號碼";
|
||||||
worksheet.Cells["C1"].Value = "進入時間";
|
worksheet.Cells["C1"].Value = "進入時間";
|
||||||
worksheet.Cells["D1"].Value = "出去時間";
|
worksheet.Cells["D1"].Value = "出去時間";
|
||||||
|
// 設置列寬
|
||||||
|
worksheet.Column(1).Width = 20;
|
||||||
|
worksheet.Column(2).Width = 15;
|
||||||
|
worksheet.Column(3).Width = 25;
|
||||||
|
worksheet.Column(4).Width = 25;
|
||||||
// 添加資料
|
// 添加資料
|
||||||
int row = 2;
|
int row = 2;
|
||||||
foreach (var item in in_car_table)
|
foreach (var item in in_car_table)
|
||||||
{
|
{
|
||||||
worksheet.Cells["A" + row].Value = item.location;
|
worksheet.Cells["A" + row].Value = item.location;
|
||||||
worksheet.Cells["B" + row].Value = item.license_plate_number;
|
worksheet.Cells["B" + row].Value = item.license_plate_number;
|
||||||
worksheet.Cells["C" + row].Value = item.in_time.ToString(); // 可以自行調整日期時間的格式
|
worksheet.Cells["C" + row].Value = item.in_time?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
|
||||||
worksheet.Cells["D" + row].Value = item.out_time.ToString();
|
worksheet.Cells["D" + row].Value = item.out_time?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -840,6 +853,11 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
worksheet.Cells["B1"].Value = "車牌號碼";
|
worksheet.Cells["B1"].Value = "車牌號碼";
|
||||||
worksheet.Cells["C1"].Value = "進入時間";
|
worksheet.Cells["C1"].Value = "進入時間";
|
||||||
worksheet.Cells["D1"].Value = "出去時間";
|
worksheet.Cells["D1"].Value = "出去時間";
|
||||||
|
// 設置列寬
|
||||||
|
worksheet.Column(1).Width = 20;
|
||||||
|
worksheet.Column(2).Width = 15;
|
||||||
|
worksheet.Column(3).Width = 25;
|
||||||
|
worksheet.Column(4).Width = 25;
|
||||||
|
|
||||||
// 添加資料
|
// 添加資料
|
||||||
int row = 2;
|
int row = 2;
|
||||||
@ -847,8 +865,8 @@ namespace Parking_space_WebAPI.Controllers
|
|||||||
{
|
{
|
||||||
worksheet.Cells["A" + row].Value = item.location;
|
worksheet.Cells["A" + row].Value = item.location;
|
||||||
worksheet.Cells["B" + row].Value = item.license_plate_number;
|
worksheet.Cells["B" + row].Value = item.license_plate_number;
|
||||||
worksheet.Cells["C" + row].Value = item.in_time.ToString(); // 可以自行調整日期時間的格式
|
worksheet.Cells["C" + row].Value = item.in_time?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
|
||||||
worksheet.Cells["D" + row].Value = item.out_time.ToString();
|
worksheet.Cells["D" + row].Value = item.out_time?.ToString("yyyy-MM-dd HH:mm:ss") ?? "";
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,5 +8,6 @@
|
|||||||
public string? location { get; set; }
|
public string? location { get; set; }
|
||||||
public DateTime? in_time { get; set; }
|
public DateTime? in_time { get; set; }
|
||||||
public DateTime? out_time { get; set; }
|
public DateTime? out_time { get; set; }
|
||||||
|
public string? out_location { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user