Ejemplo n.º 1
0
 public function logout()
 {
     if (Session::has('process_id')) {
         $process = ProcessModel::find(Session::get('process_id'));
         $process->end_time = date('H:i:s');
         $process->save();
         Session::forget('process_id');
     }
     $agent = AgentModel::find(Session::get('agent_id'));
     $agent->is_active = false;
     $agent->save();
     Session::forget('agent_id');
     return Redirect::route('agent.auth.login');
 }
Ejemplo n.º 2
0
 public function asyncNext()
 {
     $agent = AgentModel::find(Session::get('agent_id'));
     $agent->is_active = true;
     $agent->save();
     $status = StatusModel::where('store_id', $agent->store_id)->first();
     if (Session::has('process_id')) {
         $process = ProcessModel::find(Session::get('process_id'));
         $process->end_time = date('H:i:s');
         if (Input::has('ticket_type') && Input::get('ticket_type') != '') {
             $process->ticket_type = Input::get('ticket_type');
         }
         $process->save();
         Session::forget('process_id');
     }
     if (Input::get('is_next') == '1') {
         if ($status->current_queue_no + 1 <= $status->last_queue_no) {
             $status->current_queue_no = $status->current_queue_no + 1;
             $status->save();
             $process = new ProcessModel();
             $process->agent_id = Session::get('agent_id');
             $process->queue_no = $status->current_queue_no;
             $process->start_time = date('H:i:s');
             $process->save();
             Session::set('process_id', $process->id);
             return Response::json(['result' => 'success', 'currentQueueNo' => $status->current_queue_no, 'lastQueueNo' => $status->last_queue_no, 'processId' => $process->id]);
         } else {
             $agent->is_active = false;
             $agent->save();
             return Response::json(['result' => 'failed', 'msg' => 'The queue is empty']);
         }
     } else {
         $agent->is_active = false;
         $agent->save();
         return Response::json(['result' => 'failed', 'msg' => 'Your status is DEACTIVE']);
     }
 }
Ejemplo n.º 3
0
 function get_undo_procs()
 {
     $procs = Process::find('all', array('conditions' => array(' `production_date` > 0 AND `is_done` = 0 '), 'order' => 'id desc'));
     $results = array();
     foreach ($procs as $proc) {
         $results[] = array('name' => get_proc_name($proc->name), 'part_num' => $proc->part->num, 'part_name' => $proc->part->name, 'count' => $proc->count, 'production_date' => date('Y-m-d', strtotime($proc->production_date)), 'staffs' => get_proc_all_staffs($proc), 'check_date' => get_proc_first_work_check_date($proc));
     }
     return $results;
 }