| @@ -0,0 +1,84 @@ | |||||
| <?php | |||||
| if (!defined('BASEPATH')) exit('No direct script access allowed'); | |||||
| class Cario_seat_model extends CI_Model { | |||||
| public function __construct() { | |||||
| parent::__construct(); | |||||
| $this->db=$this->load->database(); | |||||
| $this->db3=$this->load->database('local', TRUE); | |||||
| } | |||||
| public function sel_cario($sin_time,$ein_time) { | |||||
| $this->db3->select('cario_no, station_no, obj_id as lpr, in_out, in_lane, in_time as in_lane_datetime, out_time as out_lane_datetime, out_lane') | |||||
| ->from('cario') | |||||
| ->where('in_time>=',$sin_time) | |||||
| ->where('in_time<',$ein_time) | |||||
| ->order_by('cario_no asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_cario_seat_log($cario_no) { | |||||
| $this->db3->from('cario_seat_log') | |||||
| ->where('cario_no',$cario_no) | |||||
| ->order_by('cario_no asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function insert_cario_seat_log($data) { | |||||
| $this->db3->insert('cario_seat_log',$data); | |||||
| $sqlString = $this->db3->last_query(); | |||||
| } | |||||
| public function update_cario_seat_log($cario_no,$data) { | |||||
| $this->db3->where('cario_no',$cario_no) | |||||
| ->update('cario_seat_log',$data); | |||||
| $sqlString = $this->db3->last_query(); | |||||
| } | |||||
| public function sel_cario_seat($sin_time,$ein_time) { | |||||
| $this->db3->select('*') | |||||
| ->from('cario_seat_log') | |||||
| ->where('in_lane_datetime>=',$sin_time) | |||||
| ->where('in_lane_datetime<',$ein_time) | |||||
| ->order_by('cario_no asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_cario_lpr($obj_id) { | |||||
| $this->db3->select('*') | |||||
| ->from('cario') | |||||
| ->where('obj_id',$obj_id) | |||||
| ->order_by('in_time desc') | |||||
| ->limit('1'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,88 @@ | |||||
| <?php | |||||
| if (!defined('BASEPATH')) exit('No direct script access allowed'); | |||||
| class Erpapidb_model extends CI_Model { | |||||
| public function __construct() { | |||||
| parent::__construct(); | |||||
| $this->db=$this->load->database(); | |||||
| $this->db3=$this->load->database('local', TRUE); | |||||
| } | |||||
| public function sel_cario($in_lane,$start,$end) { | |||||
| $this->db3->select('obj_id') | |||||
| ->from('cario') | |||||
| ->where('in_lane',$in_lane) | |||||
| ->where('in_time>=',$start) | |||||
| ->where('in_time<=',$end); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_in_lane() { | |||||
| $this->db3->select('in_lane,name,note') | |||||
| ->from('in_lane'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_cario_out($in_lane,$start,$end) { | |||||
| $this->db3->select('obj_id') | |||||
| ->from('cario') | |||||
| ->where('out_lane',$in_lane) | |||||
| ->where('in_time>=',$start) | |||||
| ->where('in_time<=',$end); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_cario_api() { | |||||
| $this->db3->select('*') | |||||
| ->from('cario') | |||||
| ->where('in_out','CI') | |||||
| ->where('member_no',0) | |||||
| ->order_by('in_time desc') | |||||
| ->limit('100'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_cario_lpr($obj_id) { | |||||
| $this->db3->select('*') | |||||
| ->from('cario') | |||||
| ->where('obj_id',$obj_id) | |||||
| ->order_by('in_time desc') | |||||
| ->limit('1'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function save_cario_lpr($cario_no, $data) { | |||||
| $this->db3->where('cario_no',$cario_no) | |||||
| ->update('cario',$data); | |||||
| $sqlString = $this->db3->last_query(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,165 @@ | |||||
| <?php | |||||
| if (!defined('BASEPATH')) exit('No direct script access allowed'); | |||||
| class Update_pks_groups_model extends CI_Model { | |||||
| public function __construct() { | |||||
| parent::__construct(); | |||||
| $this->db=$this->load->database(); | |||||
| $this->db3=$this->load->database('local', TRUE); | |||||
| } | |||||
| public function sel_pks_groups_all() { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_groups') | |||||
| ->where('group_type !=',0) | |||||
| ->order_by('group_id asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks_groups_floors_id($floors) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_groups') | |||||
| ->where('floors',$floors) | |||||
| ->order_by('group_id asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks_groups_floors() { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_groups') | |||||
| ->where('floors',"B1") | |||||
| ->or_where('floors',"B2") | |||||
| ->order_by('floors asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks_groups($station_no,$group_type) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_groups') | |||||
| ->where('station_no',$station_no) | |||||
| ->where('group_type',$group_type) | |||||
| ->order_by('group_id asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks_groups_group_id($station_no,$group_id) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_groups') | |||||
| ->where('station_no',$station_no) | |||||
| ->where('group_id',$group_id) | |||||
| ->order_by('group_id asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks_all($station_no, $fgroup_id) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks') | |||||
| ->join('pks_group_member','pks_group_member.pksno=pks.pksno') | |||||
| ->where('pks.station_no',$station_no) | |||||
| ->where('pks_group_member.group_id',$fgroup_id) | |||||
| ->order_by('cario_no asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks($station_no, $fgroup_id) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks') | |||||
| ->join('pks_group_member','pks_group_member.pksno=pks.pksno') | |||||
| ->where('pks.station_no',$station_no) | |||||
| ->where('pks.lpr !=','') | |||||
| ->where('pks_group_member.group_id',$fgroup_id) | |||||
| ->order_by('cario_no asc'); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function update_pks_groups($data, $fgroup_id) { | |||||
| $this->db3->where('group_id',$fgroup_id) | |||||
| ->update('pks_groups',$data); | |||||
| $sqlString = $this->db3->last_query(); | |||||
| return true; | |||||
| } | |||||
| public function sel_pks_group_member($pksno) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_group_member') | |||||
| ->where('pksno',$pksno); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function sel_pks_group_member($pksno) { | |||||
| $this->db3->select('*') | |||||
| ->from('pks_group_member') | |||||
| ->where('pksno',$pksno); | |||||
| $rows = $this->db3->get(); | |||||
| return $rows->result_array(); | |||||
| } | |||||
| public function update_pks_groupfunction($parms) { | |||||
| $pksno=$parms['pksno']; | |||||
| $sel_pks_group_member=$this->sel_pks_group_member($pksno); | |||||
| $group_id=$sel_pks_group_member[0]['group_id']; | |||||
| $sel_pks_group_member=$this->sel_pks_group_member($pksno); | |||||
| if($parms['io']=="KI"){ | |||||
| }elseif($parms['io']=="K0"){ | |||||
| }else{ | |||||
| } | |||||
| $this->db3->where('group_id',$fgroup_id) | |||||
| ->update('pks_groups',$data); | |||||
| $sqlString = $this->db3->last_query(); | |||||
| } | |||||
| } | |||||