Exemplo n.º 1
0
 /**
  * Returns a random active job
  *
  * @return mixed
  */
 protected function getRandomJob($department = null)
 {
     $jobs = \App\Models\JobCard::active()->lists('job_cards_id')->toArray();
     if ($department == 'printing') {
         $jobs = \App\Models\JobCard::active()->printingCurrentTen()->lists('job_cards_id')->toArray();
     }
     $randomJob = \App\Models\JobCard::find($this->fake->randomElements($jobs))[0];
     return $randomJob;
 }
 /**
  * Determine job to be run in this shift given a starting time
  *
  * @param Carbon $shiftStartTime
  */
 public function shiftJobs($shiftStartTime)
 {
     $printingJobs = JobCard::active()->printingCurrentTen()->get()->sortBy('job_cards_print_priority');
     while ($printingJobs->first() != null && $printingJobs->first()->job_cards_print_date->lt($shiftStartTime)) {
         $previousJob = $printingJobs->shift();
     }
     if (isset($previousJob) && $printingJobs->first() != $shiftStartTime) {
         $printingJobs->prepend($previousJob);
     }
     return $printingJobs;
 }
Exemplo n.º 3
0
 private function getRandomActiveJob()
 {
     $this->jobs = App\Models\JobCard::active()->lists('job_cards_id')->toArray();
     return App\Models\JobCard::find($this->fake->randomElements($this->jobs))[0];
 }
Exemplo n.º 4
0
 /**
  *Simple view of required ink for top 10 jobs to be printed next
  *
  * @return $this
  */
 public function ink_planner_index()
 {
     $this->authorize('view_ink_planner');
     return view('warehouse.planner.ink')->with(['jobs' => JobCard::active()->InkRequired()->orderBy('sequence')->limit(10)->get()]);
 }
 /**
  * List current active jobs - for easy access to waste register entries
  *
  * @return $this
  */
 public function index()
 {
     $this->authorize('view_waste_register');
     return view('warehouse.wasteregister.index')->with(['jobs' => JobCard::active()->get()]);
 }
Exemplo n.º 6
0
 /**
  * Testing API functionality
  *
  * @param User $user
  * @return string
  */
 public function getActiveJobs(User $user)
 {
     Auth::loginUsingId($user->id);
     $this->authorize('view_buffer_management');
     return JobCard::active()->get();
 }