我需要确定最近连续几天的车牌已记录在表格中。板在给定的一天中可能会多次出现在桌子上,但是至少每24小时进行一次库存检查(以避免24小时的“结帐”)。
一天不是报告的24小时。 12hr <=天<= 24hr 。即-如果车辆在8:00 am进入库存,并且一直呆到第二天8:00 pm(共36小时),则将记录为2天。
如果车辆离开存货的时间超过假定的25小时以上,则当前停留已结束,任何进一步的停留都是新的停留。
仅应报告任何一个LicensePlate的最新停留时间。
示例数据:
LicensePlate | TimeStamp | Location
---------------------------------------------
abc123 | 1969-01-01 08:42:23 | West Lot ---
abc123 | 1969-01-01 12:34:29 | West Lot ---
abc123 | 1969-01-01 18:20:10 | West Lot ---
abc123 | 1969-01-02 02:19:02 | West Lot --- 2 Days Closed
abc123 | 1969-01-02 08:38:05 | West Lot ---
abc123 | 1969-01-02 12:13:39 | West Lot ---
abc123 | 1969-01-02 20:43:34 | West Lot ---
123abc | 1969-01-02 09:31:04 | South Lot ---
123abc | 1969-01-02 15:31:04 | South Lot --- 1 Day (more than 12hr) Closed
123abc | 1969-01-02 22:31:04 | South Lot ---
abc123 | 1969-01-04 22:48:37 | North Lot ---
abc123 | 1969-01-05 17:57:32 | North Lot --- 4 Days (reported)
abc123 | 1969-01-06 14:12:48 | North Lot ---
abc123 | 1969-01-07 13:05:18 | North Lot ---
123abc | 1969-01-03 12:22:32 | East Lot ---
123abc | 1969-01-03 19:16:25 | East Lot ---
123abc | 1969-01-04 06:22:13 | East Lot ---
123abc | 1969-01-04 13:22:56 | East Lot --- 3 Days (reported)
123abc | 1969-01-05 11:22:32 | East Lot ---
123abc | 1969-01-06 08:22:44 | East Lot ---
123abc | 1969-01-06 12:22:08 | East Lot ---
生成的报告将包含以下数据
LicensePlate | EnteredDate | Location | DaysIn
----------------------------------------------------------
abc123 | 1969-01-04 12:48:37 | North Lot | 4
123abc | 1969-01-03 12:22:32 | North Lot | 3
实际表在架构上有所不同,只需要我应该如何完成此操作的指针即可。
答案 0 :(得分:0)
找到了一种完全可以完成我需要做的事情的方法。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery.inArray demo</title>
<style>
div {
color: blue;
}
span {
color: red;
}
.em{
font-color:white;
}
</style>
<script src="jquery-1.10.2.js"></script>
<link href="emoji.css" rel="stylesheet">
</head>
<body>
<div class ="see"></div>
<code>HEY</code>
<input class="input">
<div class ="see"></div>
<div class ="see2"></div>
<div class ="see3"></div>
<div class="add"></div>
<script>
var emojiss = [ "--abc", "--woman","--eye"];
var emoji=["-angel","-alien","----1","---1","--100","--1234","--8ball","--a","--ab","--abc","--abcd","--accept","--admission_tickets","--adult","--aerial_tramway","--airplane","--airplane_arriving","--airplane_departure"]
var input=$(".input");
var input2=$(".input").val();
$(input).change(function(){
$(".see").html( $(".input").val());
if(jQuery.inArray($(".input").val(), emoji) != -1) {
var see=$(".see").html().replace('--', '').replace('--', '');
$(".see2").html(see);
var classs =see+"";
alert($(".see").html());
<!-- $(".see3").html(real); -->
$(this).addClass("em em"+$(".see").html()).removeClass("see");
} else {
alert("is NOT in array");
}
});
</script>
</body>
</html>