/** * Implement destroy($id) */ public function destroy($id) { $tote = $this->toteRepository->find($id); $deleted = false; if (isset($tote)) { /* * In the case of a Tote delete request * 1. make sure there are no Inventory records in this Tote * ok to delete */ $inventories = $this->inventoryRepository->filterOn(['container.parent' => $id]); Log::debug('Inventories: ' . (isset($inventories) ? count($inventories) : 'none')); if (isset($inventories) and count($inventories) > 0) { $children = Lang::get('labels.titles.Inventories'); $model = Lang::get('labels.titles.Tote'); $errors = [[Lang::get('internal.errors.deleteHasChildren', ['Model' => $model, 'Children' => $children])]]; return Redirect::back()->withErrors($errors)->withInput(); } //dd(__METHOD__.'('.__LINE__.')',compact('id','tote','inventories')); $this->transaction(function ($this) use($id, &$deleted) { $deleted = $this->toteRepository->delete($id); }); } Log::debug('deleted: ' . ($deleted ? 'yes' : 'no')); return Redirect::route('tote.index'); }
/** * Implement destroy($id) */ public function destroy($id) { $inventory = $this->inventoryRepository->find($id); $deleted = false; if (isset($inventory)) { /* * In the case of a Inventory delete request * 1. make sure it's not allocated to an Outbound_Order_Detail line * ok to delete */ //TODO define OutboundOrderDetail /* $oods = $this->outboundOrderDetailRepository->filterOn(['id' => $inventory->Order_Line]); Log::debug('oods: '.(isset($oods) ? count($oods) : 'none' )); if(isset($oods) and count($oods) > 0) { $children = Lang::get('labels.titles.Outbound_Order_Details'); $model = Lang::get('labels.titles.Inventory'); $errors = [[Lang::get('internal.errors.deleteHasChildren', ['Model' => $model, 'Children' => $children])]]; return Redirect::back()->withErrors($errors)->withInput(); } //dd(__METHOD__.'('.__LINE__.')',compact('id','inventory','oods')); */ $this->transaction(function ($this) use($id, &$deleted) { $deleted = $this->inventoryRepository->delete($id); }); } Log::debug('deleted: ' . ($deleted ? 'yes' : 'no')); return Redirect::route('inventory.index'); }
/** * 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(); }