function quick_list_get_html($part) { $app = get_app(); $cur_proc_id = ''; // 查找当前工序 foreach ($part->processes as $proc) { if (!empty($proc->production_date) && !$proc->is_done) { $cur_proc_id = $proc->id; } } if (empty($cur_proc_id)) { $processes = $part->processes; $cur_proc_id = $processes[0]->id; } // 渲染现场工时列表View $staffs = Staff::find('all', array('order' => 'id asc')); $works = Work::find_all_by_process_id($cur_proc_id, array('order' => 'id asc')); if (count($works)) { $slider_step = get_slider_step($works); $loongest_float_work = get_loongest_float_num_work($works); $fixed_num = get_float_num($loongest_float_work->count); } else { $slider_step = 1; $fixed_num = 2; } $available_count = Process::get_available_count($cur_proc_id, $fixed_num); $proc_id = $cur_proc_id; return array('html' => $app->view->fetch('Works/list.php', compact('proc_id', 'works', 'staffs', 'available_count', 'slider_step')), 'cur_proc_id' => $cur_proc_id); }
function get_loongest_float_num_work($works) { $loongest_work = $works[0]; foreach ($works as $work) { if (get_float_num($work->count) > get_float_num($loongest_work->count)) { $loongest_work = $work; } } return $loongest_work; }