VM暫存
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
4.2KB

  1. <?php
  2. if (!defined('BASEPATH')) exit('No direct script access allowed');
  3. class Update_pks_groups_model extends CI_Model {
  4. public function __construct() {
  5. parent::__construct();
  6. $this->db=$this->load->database();
  7. $this->db3=$this->load->database('local', TRUE);
  8. }
  9. public function sel_pks_groups_all() {
  10. $this->db3->select('*')
  11. ->from('pks_groups')
  12. ->where('group_type !=',0)
  13. ->order_by('group_id asc');
  14. $rows = $this->db3->get();
  15. return $rows->result_array();
  16. }
  17. public function sel_pks_groups_floors_id($floors) {
  18. $this->db3->select('*')
  19. ->from('pks_groups')
  20. ->where('floors',$floors)
  21. ->order_by('group_id asc');
  22. $rows = $this->db3->get();
  23. return $rows->result_array();
  24. }
  25. public function sel_pks_groups_floors() {
  26. $this->db3->select('*')
  27. ->from('pks_groups')
  28. ->where('floors',"B1")
  29. ->or_where('floors',"B2")
  30. ->order_by('floors asc');
  31. $rows = $this->db3->get();
  32. return $rows->result_array();
  33. }
  34. public function sel_pks_groups($station_no,$group_type) {
  35. $this->db3->select('*')
  36. ->from('pks_groups')
  37. ->where('station_no',$station_no)
  38. ->where('group_type',$group_type)
  39. ->order_by('group_id asc');
  40. $rows = $this->db3->get();
  41. return $rows->result_array();
  42. }
  43. public function sel_pks_groups_group_id($station_no,$group_id) {
  44. $this->db3->select('*')
  45. ->from('pks_groups')
  46. ->where('station_no',$station_no)
  47. ->where('group_id',$group_id)
  48. ->order_by('group_id asc');
  49. $rows = $this->db3->get();
  50. return $rows->result_array();
  51. }
  52. public function sel_pks_all($station_no, $fgroup_id) {
  53. $this->db3->select('*')
  54. ->from('pks')
  55. ->join('pks_group_member','pks_group_member.pksno=pks.pksno')
  56. ->where('pks.station_no',$station_no)
  57. ->where('pks_group_member.group_id',$fgroup_id)
  58. ->order_by('cario_no asc');
  59. $rows = $this->db3->get();
  60. return $rows->result_array();
  61. }
  62. public function sel_pks($station_no, $fgroup_id) {
  63. $this->db3->select('*')
  64. ->from('pks')
  65. ->join('pks_group_member','pks_group_member.pksno=pks.pksno')
  66. ->where('pks.station_no',$station_no)
  67. ->where('pks.lpr !=','')
  68. ->where('pks_group_member.group_id',$fgroup_id)
  69. ->order_by('cario_no asc');
  70. $rows = $this->db3->get();
  71. return $rows->result_array();
  72. }
  73. public function update_pks_groups($data, $fgroup_id) {
  74. $this->db3->where('group_id',$fgroup_id)
  75. ->update('pks_groups',$data);
  76. $sqlString = $this->db3->last_query();
  77. return true;
  78. }
  79. public function sel_pks_group_member($pksno) {
  80. $this->db3->select('*')
  81. ->from('pks_group_member')
  82. ->where('pksno',$pksno);
  83. $rows = $this->db3->get();
  84. return $rows->result_array();
  85. }
  86. public function sel_pks_group_member($pksno) {
  87. $this->db3->select('*')
  88. ->from('pks_group_member')
  89. ->where('pksno',$pksno);
  90. $rows = $this->db3->get();
  91. return $rows->result_array();
  92. }
  93. public function update_pks_groupfunction($parms) {
  94. $pksno=$parms['pksno'];
  95. $sel_pks_group_member=$this->sel_pks_group_member($pksno);
  96. $group_id=$sel_pks_group_member[0]['group_id'];
  97. $sel_pks_group_member=$this->sel_pks_group_member($pksno);
  98. if($parms['io']=="KI"){
  99. }elseif($parms['io']=="K0"){
  100. }else{
  101. }
  102. $this->db3->where('group_id',$fgroup_id)
  103. ->update('pks_groups',$data);
  104. $sqlString = $this->db3->last_query();
  105. }
  106. }