優化 新增違規資料並比對10秒內
This commit is contained in:
parent
4ccfd9cb78
commit
3e3bd91f6a
@ -331,32 +331,27 @@ namespace Parking_space_WebAPI.Controllers
|
||||
//判斷10秒內有多少資料
|
||||
if (Data_list.Count == 1) //只有1筆 若與全景判斷的車牌不同就替換車牌
|
||||
{
|
||||
if (Data_list[0].license_plate_number != license_plate_number && time.Hour <= 17)
|
||||
if (Data_list[0].license_plate_number != license_plate_number)
|
||||
{
|
||||
var data = Data_list[0];
|
||||
_context.violation_car_table.Remove(Data_list[0]);
|
||||
await _context.SaveChangesAsync();
|
||||
data.license_plate_number = license_plate_number;
|
||||
|
||||
if (time.Hour <= 17)
|
||||
{
|
||||
// 如果时间早于或等于17:00,则只更新车牌号码
|
||||
_context.violation_car_table.Add(data);
|
||||
await _context.SaveChangesAsync();
|
||||
return Ok();
|
||||
|
||||
}
|
||||
else {
|
||||
return Ok();
|
||||
}
|
||||
|
||||
if (Data_list[0].license_plate_number != license_plate_number && time.Hour > 17)
|
||||
else
|
||||
{
|
||||
var data = Data_list[0];
|
||||
_context.violation_car_table.Remove(Data_list[0]);
|
||||
await _context.SaveChangesAsync();
|
||||
data.license_plate_number = license_plate_number;
|
||||
// 如果时间晚于17:00,则同时更新车牌号码和车辆入场图片
|
||||
data.car_start_img = in_car_img;
|
||||
_context.violation_car_table.Add(data);
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Ok();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -364,6 +359,7 @@ namespace Parking_space_WebAPI.Controllers
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if (Data_list.Count > 1)//超過2筆
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user