Преглед изворни кода

新增進場時可以設定進場時間

station_12112
QxQ пре 6 година
родитељ
комит
fa6e7ac437
3 измењених фајлова са 89 додато и 33 уклоњено
  1. +21
    -19
      controllers/Carpark.php
  2. +16
    -6
      models/Cars_model.php
  3. +52
    -8
      views/carpark/main_page.php

+ 21
- 19
controllers/Carpark.php Прегледај датотеку

@@ -187,6 +187,7 @@ class Carpark extends CC_Controller
$io = $this->input->post('io', true);
$ctype = $this->input->post('ctype', true);
$lpr = $this->input->post('lpr', true);
$time = $this->input->post('time', true);
$parms = array();
$parms['sno'] = preg_replace('/[^0-9]/', '', strtoupper(urldecode($sno)));
@@ -200,6 +201,7 @@ class Carpark extends CC_Controller
$parms['sq2'] = 0;
$parms['etag'] = 'NONE';
$parms['ant'] = 1;
$parms['in_time'] = $time;
// 補充
$parms['obj_type'] = 1;
$parms['curr_time_str'] = date('Y-m-d H:i:s');
@@ -356,24 +358,24 @@ class Carpark extends CC_Controller
//
// 接收端 (START)
//
// ------------------------------------------------
// [mqtt] 接收端
public function mqtt_service()
// ------------------------------------------------
// [mqtt] 接收端
public function mqtt_service()
{
$LOG_FLAG = 'mqtt://';
$topic = $this->input->post('topic', true);
$msg = $this->input->post('msg', true);
$ck = $this->input->post('ck', true);
if(md5($topic.'altob'.$msg) != $ck)
{
echo 'ck_error';
exit;
$LOG_FLAG = 'mqtt://';
$topic = $this->input->post('topic', true);
$msg = $this->input->post('msg', true);
$ck = $this->input->post('ck', true);
if(md5($topic.'altob'.$msg) != $ck)
{
echo 'ck_error';
exit;
}
trigger_error($LOG_FLAG . __FUNCTION__ . "|{$topic}|{$msg}");
trigger_error($LOG_FLAG . __FUNCTION__ . "|{$topic}|{$msg}");
if($topic == 'altob.888.mqtt')
{
$data_model = $this->data_model();
@@ -404,10 +406,10 @@ class Carpark extends CC_Controller
$value = isset($msg_arr[2]) ? $msg_arr[2] : 0;
$result = $data_model->force_sync_888($first_station_no, $group_id, $value);
trigger_error($LOG_FLAG . __FUNCTION__ . "..{$first_station_no}|{$group_id}|{$value}..result..{$result}..");
}
echo 'ok';
exit;
}
echo 'ok';
exit;
}
// [設定檔] 取得設定


+ 16
- 6
models/Cars_model.php Прегледај датотеку

@@ -362,12 +362,13 @@ class Cars_model extends CI_Model
trigger_error("err://入場郤已有歷史進場記錄[{$affect_rows}]筆,已設成錯誤並結清記錄".print_r($parms, true));
}
}
//20190113新增手動入場
// 15分鐘內, 可直接離場 (刷進刷出需過卡修正)
if(isset($parms['free_time']) && $parms['free_time'] > 0)
$out_before_time_value = date('Y-m-d H:i:s', strtotime(" + {$parms['free_time']} minutes"));
else
$out_before_time_value = date("Y-m-d H:i:s");
//if(isset($parms['free_time']) && $parms['free_time'] > 0)
// $out_before_time_value = date('Y-m-d H:i:s', strtotime(" + {$parms['free_time']} minutes"));
//else
// $out_before_time_value = date("Y-m-d H:i:s");
$data = array
(
@@ -381,9 +382,18 @@ class Cars_model extends CI_Model
'in_time' => $this->now_str,
'in_lane' => $parms['ivsno'],
'in_pic_name' => empty($parms['pic_name']) ? '' : $parms['pic_name'],
'out_before_time' => $out_before_time_value,
'out_before_time' => $this->now_str,
'ticket_no' => $this->gen_pass_code()
);
$data['in_time'] = isset($parms['in_time']) ? $parms['in_time'] : $this->now_str;
if(isset($parms['free_time']) && $parms['free_time'] > 0)
{
$data['out_before_time'] = date('Y-m-d H:i:s', strtotime(" + {$parms['free_time']} minutes",strtotime($parms['in_time'])));
}
else
{
$data['out_before_time'] = $data['in_time'];
}
$this->db->insert('cario', $data);
trigger_error("新增入場資料:".print_r($parms, true));


+ 52
- 8
views/carpark/main_page.php Прегледај датотеку

@@ -2032,9 +2032,13 @@ function logout(event)
<div id="cms_io_box"/>
</td>
</tr>
<tr class="form-group">
<td style="text-align:right;">時間</td>
<td style="text-align:left;">
<input id="cms_time_box" name="cms_time" type="datetime" class="form-control" style="font-size:48px;height:56px;" readonly="" disabled="disabled">
<input id="cms_time_box" name="cms_time" type="datetime-local" class="form-control" style="font-size:36px;height:56px;" autocomplete="off" disabled="disabled"
value="<?php echo substr(date("c"),0,16); ?>"
min="<?php echo substr(date("c",strtotime("-1months")),0,16); ?>"
max="<?php echo substr(date("c"),0,16); ?>"/>
</td>
</tr>
<tr class="form-group">
@@ -2068,6 +2072,20 @@ function logout(event)
<script>
//選擇進場車道時可以設定進場時間
function time_check()
{
var station_no = AltobObject.xvars["create_cario_info"]["station_no"];
var io = $("#sel_cms_io_" + station_no).val();
if(io == 'I')
{
$("#cms_time_box").attr('disabled', false);
}
else
{
$("#cms_time_box").attr('disabled', true);
}
}
// 顯示新增車辨記錄
function show_create_cario_dialog()
@@ -2092,13 +2110,13 @@ function show_create_cario_dialog()
// 進出場
var cms_io_content = [];
cms_io_content = cms_io_content.concat(["<select id='sel_cms_io_", AltobObject.station_no, "'><option value='choice'>請選擇</option>"]);
cms_io_content = cms_io_content.concat(["<select onClick=\"time_check();\" id='sel_cms_io_", AltobObject.station_no, "'><option value='choice'>請選擇</option>"]);
cms_io_content = cms_io_content.concat(["<option value='I'>進場</option>"]);
cms_io_content = cms_io_content.concat(["<option value='O'>離場</option>"]);
$("#cms_io_box").html('').html(cms_io_content.join(''));
//時間
$("#cms_time_box").html('').html(date("Y-m-d H:m:s"));
$("#cms_time_box").html('').text(date("Y-m-d H:m:s"));
// 車種
var cms_ctype_content = [];
@@ -2122,14 +2140,40 @@ function do_create_cario()
var io = $("#sel_cms_io_" + station_no).val();
var ctype = $("#sel_cms_ctype_" + station_no).val();
var lpr = $("#cms_lpr").val();
var time = $("#cms_time").val();
var time = $("#cms_time_box").val();
if(!(station_no && lpr))
if(!(station_no))
{
alertify_msg("系統錯誤");
return false;
}
if(io!='I' && io!='O')
{
alertify_msg("請選擇此車是進場還是出場?");
return false;
}
if(ctype!='C' && ctype!='M')
{
alertify_msg("請選擇車種");
return false;
}
if(lpr.length < 4 || lpr.length > 7)
{
alertify_msg("資料不足。。");
alertify_msg("請檢查車號是否正確?");
return false;
}
var dt = new Date(time.replace("-", "/").replace("-", "/").replace("T", " "));
var dt1 = new Date();
var dt2 = new Date();
dt2.setMonth(dt1.getMonth() - 1);
if(dt > dt1 || dt < dt2)
{
alertify_msg("請注意:時間不能大於現在時間,以及不能低於1個月");
return false;
}
if (!confirm("確認資料無誤並送出 ?")) return false;
$.ajax
({
url: "<?=APP_URL?>local_lprio",
@@ -2142,7 +2186,7 @@ function do_create_cario()
"ivsno": 0, // 都帶 0
"io":io,
"ctype":ctype,
"time":time
"time":time,
"lpr":lpr
},
error:function(xhr, ajaxOptions, thrownError)


Loading…
Откажи
Сачувај