Ejemplo n.º 1
0
 public function _index()
 {
     $fo_group = $this->getFoGroup();
     $code_flow_phase = CodeFlowPhase::all(['ID', 'NAME']);
     $code_alloc_type = CodeAllocType::all(['ID', 'NAME']);
     $loProductionUnit = LoProductionUnit::all(['ID', 'NAME']);
     return view('front.formula', ['fo_group' => $fo_group, 'code_flow_phase' => $code_flow_phase, 'code_alloc_type' => $code_alloc_type, 'loProductionUnit' => $loProductionUnit]);
 }
Ejemplo n.º 2
0
 public function _indexDiagram()
 {
     $codeFlowPhase = CodeFlowPhase::all(['ID', 'NAME']);
     $loProductionUnit = LoProductionUnit::all(['ID', 'NAME']);
     $loArea = LoArea::where(['PRODUCTION_UNIT_ID' => $loProductionUnit[0]->ID])->get(['ID', 'NAME']);
     $facility = Facility::where(['AREA_ID' => $loArea[0]->ID])->get(['ID', 'NAME']);
     $intObjectType = IntObjectType::where(['DISPLAY_TYPE' => 1])->get(['CODE', 'NAME']);
     $tmp = ucwords($intObjectType[0]->NAME);
     $mode = 'App\\Models\\' . str_replace(' ', '', $tmp);
     $type = $mode::where(['FACILITY_ID' => $facility[0]->ID])->get(['ID', 'NAME']);
     return view('front.diagram', ['codeFlowPhase' => $codeFlowPhase, 'loProductionUnit' => $loProductionUnit, 'loArea' => $loArea, 'facility' => $facility, 'intObjectType' => $intObjectType, 'type' => $type]);
 }
Ejemplo n.º 3
0
 public function initProductionFilterGroup($workspace, $extras = null)
 {
     if ($workspace) {
         $pid = $workspace->PRODUCTION_UNIT_ID;
         $aid = $workspace->AREA_ID;
         $fid = $workspace->W_FACILITY_ID;
     } else {
         $pid = 0;
         $aid = 0;
         $fid = 0;
     }
     $productionUnits = LoProductionUnit::all(['ID', 'NAME']);
     $currentProductUnit = ProductionGroupComposer::getCurrentSelect($productionUnits, $pid);
     $areas = $currentProductUnit->LoArea()->getResults();
     $currentArea = ProductionGroupComposer::getCurrentSelect($areas, $aid);
     $facilities = $currentArea->Facility()->getResults();
     $currentFacility = ProductionGroupComposer::getCurrentSelect($facilities, $fid);
     $productionFilterGroup = ['LoProductionUnit' => ProductionGroupComposer::getFilterArray('LoProductionUnit', $productionUnits, $currentProductUnit), 'LoArea' => ProductionGroupComposer::getFilterArray('LoArea', $areas, $currentArea), 'Facility' => ProductionGroupComposer::getFilterArray('Facility', $facilities, $currentFacility)];
     $currentObject = $currentFacility;
     foreach ($extras as $source => $model) {
         $option = $this->getExtraOptions($productionFilterGroup, $model, $source);
         if ($option && array_key_exists($source, $option) && array_key_exists("object", $option[$source])) {
             $currentObject = $option[$source]["object"];
         }
         $rs = ProductionGroupComposer::initExtraDependence($productionFilterGroup, $model, $currentObject, $option);
         $eCollection = $rs['collection'];
         $modelName = $rs['model'];
         $extraFilter = ProductionGroupComposer::getCurrentSelect($eCollection);
         $productionFilterGroup[$modelName] = ProductionGroupComposer::getFilterArray($modelName, $eCollection, $extraFilter, $model);
     }
     return $productionFilterGroup;
 }
Ejemplo n.º 4
0
 public function addUser()
 {
     $userRole = UserRole::where(['ACTIVE' => 1])->get(['ID', 'NAME']);
     $loProductionUnit = LoProductionUnit::all(['ID', 'NAME']);
     return view('admin.add_users', ['userRole' => $userRole, 'loProductionUnit' => $loProductionUnit]);
 }
Ejemplo n.º 5
0
 private function getWorkSpaceInfo()
 {
     $user_name = '';
     if (auth()->user() != null) {
         $user_name = auth()->user()->username;
     }
     $user_workspace = UserWorkspace::getTableName();
     $facility = Facility::getTableName();
     $lo_area = LoArea::getTableName();
     $lo_production_unit = LoProductionUnit::getTableName();
     $workspace = DB::table($user_workspace . ' AS a')->join($facility . ' AS b', 'a.W_FACILITY_ID', '=', 'b.ID')->join($lo_area . ' AS c', 'b.AREA_ID', '=', 'c.ID')->join($lo_production_unit . ' AS d', 'c.PRODUCTION_UNIT_ID', '=', 'd.ID')->where(['a.USER_NAME' => $user_name])->select('a.*', DB::raw('DATE_FORMAT(a.W_DATE_BEGIN, "%m/%d/%Y") as DATE_BEGIN'), DB::raw('DATE_FORMAT(a.W_DATE_END, "%m/%d/%Y") as DATE_END'), 'b.AREA_ID', 'c.PRODUCTION_UNIT_ID')->first();
     return $workspace;
 }