取数据库不同表的值统一返回 public function sel_production_details($id){// 取到详情工序表中的所有信息,根据传过来的产品id$date['arr'] = $this-db-select('production_details_id,production_list_id,ps_id,produc
public function sel_production_details($id) { // 取到详情工序表中的所有信息,根据传过来的产品id $date['arr'] = $this->db ->select('production_details_id,production_list_id,ps_id,production_personnel_id,plan_work_hours,production_start_time,production_end_time,production_state,production_remark,inspector_id') ->where('production_list_id',$id) ->get('production_details') ->result_array(); //根据上面取到值里的一些别的表的id,取该id下所对应的值 foreach ($date['arr'] as $k=>$v){ $date['arr'][$k]['ps_name'] = $this->sel_ps_name($v['ps_id']); $date['arr'][$k]['ps_superior_id'] = $this->sel_ps_superior_id($v['ps_id']); $date['arr'][$k]['quality_testing_status'] = $this->sel_quality_testing_status($v['production_details_id']); $date['arr'][$k]['quality_testing_remark'] = $this->sel_quality_testing_remark($v['production_details_id']); $date['arr'][$k]['quality_testing_time'] = $this->sel_quality_testing_time($v['production_details_id']); $date['arr'][$k]['realname'] = $this->sel_realname($v['production_personnel_id']); $date['arr'][$k]['inspector_name'] = $this->sel_inspector_id($v['inspector_id']); } return $date; } // 根据工序id 工序名称 public function sel_ps_name($id) { $ps_name = $this->db ->where('ps_id',$id) ->get('procedure_setting') ->row_array()['ps_name']; if (empty($ps_name)) { return ''; }else{ return $ps_name; } }