Example #1
0
 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     // $schedule->command('inspire')
     //          ->hourly();
     $schedule->call(function () {
         $workOrderSchedulerService = new WorkOrderSchedulerService();
         $workOrderSchedulerService->sendWorkOrderReport();
     })->daily()->timezone('America/Halifax');
 }
Example #2
0
 public function scheduleTest()
 {
     $woss = new WorkOrderSchedulerService();
     $woss->sendWorkOrderReport();
     echo 'done';
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $purchaseOrder = PurchaseOrder::where('id', $id)->first();
     if (isset($purchaseOrder)) {
         try {
             $workOrderScheduleService = new WorkOrderSchedulerService();
             \DB::beginTransaction();
             // Restore stock for any non workorder quantities
             $workOrderScheduleService->restoreStockForProducts($purchaseOrder->id);
             // Delete any work orders for this PO
             $workOrderScheduleService->deleteWorkOrdersForPo($purchaseOrder->id);
             // Now delete the PO itself
             $purchaseOrder->delete();
             \DB::commit();
         } catch (\Exception $ex) {
             \DB::rollBack();
             throw $ex;
         }
     }
 }