Example #1
0
 public function countWorkflowTask()
 {
     $user_name = '';
     if (auth()->user() != null) {
         $user_name = auth()->user()->username;
     }
     $tmworkflow = collect(TmWorkflow::where(['ISRUN' => 'yes'])->get(['ID']))->toArray();
     $tmworkflow = collect(TmWorkflow::where(['ISRUN' => 'yes'])->get(['ID']))->toArray();
     $tmworkflowtask = TmWorkflowTask::whereIn('ISRUN', [2, 3])->whereIn('WF_ID', $tmworkflow)->where(function ($q) use($user_name) {
         $q->where('USER', 'like', '%,' . $user_name . ',%');
         $q->orWhere('USER', 'like', $user_name . ',%');
         $q->orWhere('USER', 'like', '%,' . $user_name);
         $q->orWhere('USER', '=', $user_name);
     })->get(['WF_ID']);
     return response()->json(count($tmworkflowtask));
 }
Example #2
0
 public function runWorkFlow(Request $request)
 {
     $data = $request->all();
     TmWorkflow::where(['ID' => $data['ID']])->update(['ISRUN' => 'yes']);
     \DB::enableQueryLog();
     $tmWorkflowTask = TmWorkflowTask::where(['WF_ID' => $data['ID'], 'ISBEGIN' => 1])->first();
     \Log::info(\DB::getQueryLog());
     if (count($tmWorkflowTask) > 0) {
         TmWorkflowTask::where(['WF_ID' => $data['ID']])->where('ID', '<>', $tmWorkflowTask['id'])->update(['ISRUN' => 0]);
         $objRun = new WorkflowProcessController(null, $tmWorkflowTask);
         $objRun->runTask(null, $tmWorkflowTask);
         /* $job = (new runAllocation(null, $tmWorkflowTask));
         			$this->dispatch($job); */
     }
     $result = $this->getTmWorkflow();
     return response()->json(['result' => $result]);
 }
Example #3
0
File: run.php Project: hunglmtb/eb
 public function finalizeTask($task_id, $status, $log, $email)
 {
     if ($task_id > 0) {
         $now = Carbon::now('Europe/London');
         $time = date('Y-m-d H:i:s', strtotime($now));
         TmWorkflowTask::where(['ID' => $task_id])->update(['ISRUN' => $status, 'FINISH_TIME' => $time, 'LOG' => addslashes($log)]);
         if ($status == 1) {
             //task finish, check next task
             $objAll = new WorkflowProcessController(null, null);
             $objAll->processNextTask($task_id);
         }
     }
 }
 private function check_prev_finish($prev_id)
 {
     $ids = explode(',', $prev_id);
     if (count($ids) == 1) {
         return true;
     }
     $tmp = TmWorkflowTask::whereIn('ID', $ids)->where('ISRUN', '<>', 1)->where('TASK_CODE', '<>', 'CONDITION_BLOCK')->where('TASK_CODE', '<>', '')->whereNotNull('TASK_CODE')->get();
     if (count($tmp) > 0) {
         return false;
     } else {
         return true;
     }
 }