Second upload

This commit is contained in:
qi_0527 2024-11-12 16:41:12 +08:00
parent 5ab2da3c3d
commit e695f63198

View File

@ -496,6 +496,7 @@ namespace Parking_space_WebAPI.Controllers
}
var license_plate_number = yuntech_out_car_table.license_plate_number;
var out_car_img = yuntech_out_car_table.out_car_img;
var out_location = yuntech_out_car_table.location;
var in_car_data = await(from c in _context.yuntech_in_car_table
where c.license_plate_number == license_plate_number
where c.out_time ==null
@ -506,11 +507,14 @@ namespace Parking_space_WebAPI.Controllers
DateTime time_30s_ago = now_time.AddSeconds(-30);
if (in_car_data != null && in_car_data.in_time<time_30s_ago)
{
// 处理找到记录的情况
_context.yuntech_in_car_table.Remove(in_car_data);
await _context.SaveChangesAsync();
in_car_data.out_time = DateTime.Now;
in_car_data.out_car_img = out_car_img;
in_car_data.out_location = out_location;
_context.yuntech_in_car_table.Add(in_car_data);
await _context.SaveChangesAsync();
@ -593,6 +597,7 @@ namespace Parking_space_WebAPI.Controllers
}
var license_plate_number = yuntech_out_car_table.license_plate_number;
var out_car_img = yuntech_out_car_table.out_car_img;
var location = yuntech_out_car_table.out_location;
var in_car_data = await (from c in _context.yuntech_in_car_table
where c.license_plate_number == license_plate_number
where c.out_time == null
@ -604,10 +609,12 @@ namespace Parking_space_WebAPI.Controllers
if (in_car_data != null && in_car_data.in_time < time_30s_ago)
{
// 处理找到记录的情况
_context.yuntech_in_car_table.Remove(in_car_data);
await _context.SaveChangesAsync();
in_car_data.out_time = DateTime.Now;
in_car_data.out_car_img = out_car_img;
in_car_data.out_location = location;
_context.yuntech_in_car_table.Add(in_car_data);
await _context.SaveChangesAsync();