/** * Execute the job. * * @return void */ public function handle(CountersRepositoryInterface $countersRepository, ReceiptHistoryRepositoryInterface $receiptHistoryRepository, ReworkReportInterface $reworkReport, JobExperienceInterface $jobExperience, JobStatusInterface $jobStatus) { $this->countersRepository = $countersRepository; $this->receiptHistoryRepository = $receiptHistoryRepository; $this->reworkReport = $reworkReport; $jobExperience->setClass($this); $jobStatus->starting($this, $this->jobID); // First count the number of UPCs that have Inventory // filter to count received $filter = ['fromDate' => $this->fromDate, 'toDate' => $this->toDate, 'Activity' => preg_replace('/ - .*/', '', Lang::get('internal.receiptHistory.putUPCinTote'))]; $itemCount = $this->receiptHistoryRepository->countOn($filter); Log::debug($this->forUser . ' - Receipt History count: ' . $itemCount); $jobExperience->setNumberOfRecordsProcessed($itemCount); Log::debug($this->forUser . " - calling export({$this->fromDate}, {$this->toDate}, {$this->exportType})"); $this->export(); if (isset($this->emailTo) && strlen($this->emailTo) > 4) { Log::debug($this->forUser . " - email results({$this->emailTo})" . (is_string($this->results) ? $this->results : serialize($this->results))); $this->email(); } if (isset($this->results) == false) { $this->results = $this->fileName; } $rc = 0; if (is_string($this->results) && substr($this->results, 0, 5) == 'ERROR') { $rc = 10; } $jobStatus->completed($rc, $this->results); $jobExperience->ended(); }
/** * Execute the job. * * @return void */ public function handle(InventoryRepositoryInterface $inventoryRepository, InventorySummaryRepositoryInterface $inventorySummaryRepository, JobExperienceInterface $jobExperience) { $jobExperience->setClass($this); Log::debug(' attempts: ' . $this->attempts()); // First count the number of UPCs that have Inventory $itemCount = $inventoryRepository->countUPCs(); Log::debug(' Inventory Items count: ' . $itemCount); $jobExperience->setNumberOfRecordsProcessed($itemCount); // divide by 2000 to get number of invocations required $invocations = intval($itemCount / 2000 * 1.6) + 1; Log::debug(' invocations: ' . $invocations); $sleepSeconds = 1; // run the invocations for ($i = 0; $i < $invocations; $i++) { sleep($sleepSeconds); Log::debug(' run: ' . $i); //$sleepSeconds = 5; $inventorySummaryRepository->fireStoredProcedure(); } $jobExperience->ended(); }