updated on workstations, validation checked with qrcodes
This commit is contained in:
parent
19bfbf8857
commit
02911be806
|
|
@ -27,12 +27,13 @@ protected function schedule(Schedule $schedule): void
|
|||
|
||||
// Atualiza sessões inativas
|
||||
\App\Models\ControlEquipmentWorkstation::where('status', 1)
|
||||
->whereNull('departure_date')
|
||||
->where('last_active_at', '<', $inactiveLimit)
|
||||
->update([
|
||||
'status' => 0,
|
||||
'id_workstations' => null,
|
||||
'elemental_tasks_id' => null,
|
||||
'entry_date' => null
|
||||
'entry_date' => null,
|
||||
]);
|
||||
|
||||
// Adicione outras tarefas necessárias aqui
|
||||
|
|
|
|||
|
|
@ -1225,8 +1225,6 @@ public function processStep2(Request $request)
|
|||
|
||||
if ($chooseAction == 'selectEquipments') {
|
||||
|
||||
|
||||
|
||||
if ($existingEquipment) {
|
||||
|
||||
$foundInExcel = false;
|
||||
|
|
@ -1274,8 +1272,6 @@ public function processStep2(Request $request)
|
|||
// Continua com o processo de salvar o novo registro
|
||||
$newEquipmentWorkHistory->ispt_number = $isptNumber;
|
||||
|
||||
|
||||
|
||||
$newEquipmentWorkHistory->save();
|
||||
|
||||
// Recebe o Id do 'EquipmentWorkHistory' criado.
|
||||
|
|
@ -1283,7 +1279,6 @@ public function processStep2(Request $request)
|
|||
|
||||
$isptNumber++;
|
||||
|
||||
|
||||
$ambit = AmbitsEquipment::where('ambits_description', $datas['ambit'])->first();
|
||||
|
||||
if ($ambit) {
|
||||
|
|
@ -1473,8 +1468,8 @@ public function processStep2(Request $request)
|
|||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
->with('danger', 'Equipamentos Pendentes criados: ' . $countPendingEquipments)
|
||||
->with('dangerLogs', $ignoredLines)
|
||||
->with('equipmentPendingLogs', $equipmentPendingLogs)
|
||||
->with('pendingEquipments', $pendingEquipments);
|
||||
->with('equipmentPendingLogs', $equipmentPendingLogs);
|
||||
// ->with('pendingEquipments', $pendingEquipments);
|
||||
} else {
|
||||
// Se não houver equipamentos pendentes, redirecione com uma mensagem de sucesso e inclua os $linhasIgnoradas se não estiverem vazios
|
||||
return redirect()->route('articulated_2', ['id' => $request->numberProject])
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Mockery\Undefined;
|
||||
|
||||
|
||||
class WorkstationsJobsController extends Controller
|
||||
|
|
@ -116,10 +117,11 @@ public function updateSessionStatus(Request $request, $controlEquipmentId)
|
|||
|
||||
public function receiveAnswersEquipment(Request $request, $control_equipment_workstation_id)
|
||||
{
|
||||
dd($request);
|
||||
//No request recebemos ID(NUmero da tarela elementar) , esta variavel vai receber este ID apos selerar o id da string
|
||||
$elementalTaskID = 0;
|
||||
|
||||
// Deve receber o id da control atual.
|
||||
// Deve receber as perguntas e respostas para a tarefa selecionada
|
||||
$requestData = $request->all();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
|
@ -195,10 +197,12 @@ public function receiveAnswersEquipment(Request $request, $control_equipment_wor
|
|||
// Agora que guardamos os dados anteriores, vamos criar a nova linha na tabela Control Equipment ID para que o equipamento continue
|
||||
// $newControlEquipment = new ControlEquipmentWorkstation;
|
||||
// $newControlEquipment->equipmentWorkHistorys_id = $recebeDataControlWs->equipmentWorkHistorys_id;
|
||||
// $newControlEquipment->id_workstations = $recebeDataControlWs->id_workstations;
|
||||
// $newControlEquipment->entry_date = now();
|
||||
// $newControlEquipment->last_active_at = now();
|
||||
// $newControlEquipment->status = 0;
|
||||
// $newControlEquipment->save();
|
||||
|
||||
// dd($newControlEquipment);
|
||||
|
||||
// Vamos buscar os dados da tarefa elementar comcluida para mandar uma mensagem ao Front e indicar que esta completada
|
||||
$receiveDataElementalTask = ElementalTasks::find($recebeDataControlWs->elemental_tasks_id, 'elemental_tasks_id')->first();
|
||||
|
||||
|
|
@ -211,36 +215,46 @@ public function receiveAnswersEquipment(Request $request, $control_equipment_wor
|
|||
// Ao selecionar o equipamento para se inicializar a tarefa deve mostrar os dados relacionados.
|
||||
public function getEquipmentData($equipment_id, $component_tag)
|
||||
{
|
||||
// dd($equipment_id);
|
||||
//vai receber o email atual, no caso o da workstation que se encontra
|
||||
$userEmail = Auth::user();
|
||||
|
||||
// Busca os dados da Ws com base no Login
|
||||
$receiveDataWs = ConstructionWorkstation::where('name_workstations', $userEmail->user_name)->first();
|
||||
|
||||
|
||||
// Recebe os dados do Equipamento
|
||||
$receiveDataEquipment = Equipment::where('equipment_id', $equipment_id)->first();
|
||||
|
||||
|
||||
$tagType = explode('@', $component_tag)[1]; // Isola o tipo da tag após o '@'
|
||||
|
||||
// Recebe o id do Historico do equipamento, em sua obra atual
|
||||
$receiveEquipmentWorkHistory = EquipmentWorkHistory::where('equipment_id', $receiveDataEquipment->equipment_id)
|
||||
->where('company_projects_id', $receiveDataEquipment->company_projects_id)
|
||||
->first();
|
||||
|
||||
|
||||
|
||||
//Verificar se o equipamento ja esta sendo utilizado em outra Ws se sim, retorna para a pagina anterior.
|
||||
$equipmentInUse = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
->whereNull('departure_date')
|
||||
->whereNotNull('id_workstations')
|
||||
->where('id_workstations', '!=', $receiveDataWs->id_workstations)
|
||||
->where('status', 1)
|
||||
->exists();
|
||||
->whereNull('departure_date') // A data de saída deve ser nula, indicando que a tarefa ainda está ativa
|
||||
->whereNotNull('id_workstations') // Deve ter um posto de trabalho associado
|
||||
->where('id_workstations', '!=', $receiveDataWs->id_workstations) // E esse posto de trabalho não deve ser o atual
|
||||
->where(function ($query) use ($tagType) {
|
||||
if ($tagType == 'Obturador') {
|
||||
// Apenas se a tarefa for igual a 9, indicando uma tarefa de Obturador
|
||||
$query->where('elemental_tasks_id', '=', 9);
|
||||
} elseif ($tagType == 'Corpo') {
|
||||
// Apenas se a tarefa for NULL, indicando uma tarefa de Corpo que não foi especificada
|
||||
$query->whereNull('elemental_tasks_id');
|
||||
}
|
||||
})
|
||||
->where('status', 1) // O status deve indicar que está ativo
|
||||
->whereNotNull('entry_date') // Deve ter uma data de entrada, indicando que a tarefa foi iniciada
|
||||
->exists(); // Verifica se existe ao menos um registro que atenda às condições
|
||||
|
||||
|
||||
// Se o equipamento já estiver em uso, redirecione com uma mensagem de erro
|
||||
if ($equipmentInUse) {
|
||||
return redirect()->back()->with('danger', 'O equipamento já se encontra a executar tarefas noutro posto de trabalho.');
|
||||
}
|
||||
|
||||
|
||||
// Recebe todas as tarefas elementares do equipamento.
|
||||
$recebeTasksForEquipment = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)->get();
|
||||
|
||||
|
|
@ -277,35 +291,90 @@ public function getEquipmentData($equipment_id, $component_tag)
|
|||
$divisionElementalTasks[2] = $receiveTasksThatCannotBeDone->all();
|
||||
|
||||
|
||||
//Aplica 2 condicoes a variavel a primeira e se os 3 campos forem nulos e a segunda e se a id_workstations nao for null e tiver o valor igual ao da sessao atual,
|
||||
$existingDataControlEquipment = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
->where(function ($query) use ($receiveDataWs) {
|
||||
$query->where(function ($q) {
|
||||
$q->whereNull('elemental_tasks_id')
|
||||
|
||||
|
||||
|
||||
// // //Aplica 2 condicoes a variavel a primeira e se os 3 campos forem nulos e a segunda e se a id_workstations nao for null e tiver o valor igual ao da sessao atual,
|
||||
// $existingDataControlEquipment = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
// ->whereNull('departure_date')
|
||||
// ->whereNull('elemental_tasks_id')
|
||||
// ->orWhere('elemental_tasks_id',9)
|
||||
// ->where(function ($query) use ($receiveDataWs) {
|
||||
// $query->whereNull('id_workstations')
|
||||
// ->orWhere(function ($q) use ($receiveDataWs) {
|
||||
// $q->whereNotNull('id_workstations')
|
||||
// ->where('id_workstations', $receiveDataWs->id_workstations);
|
||||
// });
|
||||
// })
|
||||
// ->first();
|
||||
|
||||
// dd($existingDataControlEquipment);
|
||||
|
||||
// if ($existingDataControlEquipment) {
|
||||
// // Registro existente encontrado, atualize conforme necessário
|
||||
// if (strpos($component_tag, '@Obturador') !== false) {
|
||||
// $existingDataControlEquipment->elemental_tasks_id = 9;
|
||||
// }
|
||||
// $existingDataControlEquipment->id_workstations = $receiveDataWs->id_workstations;
|
||||
// $existingDataControlEquipment->entry_date = now();
|
||||
// $existingDataControlEquipment->status = 1;
|
||||
// $existingDataControlEquipment->last_active_at = now();
|
||||
|
||||
// $existingDataControlEquipment->save();
|
||||
|
||||
// $receiveDataControlEquipment = $existingDataControlEquipment;
|
||||
|
||||
$existingDataControlEquipment = null;
|
||||
|
||||
|
||||
// Inicia a consulta baseada no tipo de tag
|
||||
$query = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
->whereNull('departure_date')
|
||||
->whereNull('id_workstations');
|
||||
})->orWhere(function ($q) use ($receiveDataWs) {
|
||||
$q->whereNotNull('id_workstations')
|
||||
->where('id_workstations', $receiveDataWs->id_workstations)
|
||||
->whereNull('departure_date');
|
||||
});
|
||||
})
|
||||
->first();
|
||||
->where('status', 1); // Suponho que você deseja apenas registros ativos
|
||||
|
||||
|
||||
if ($existingDataControlEquipment) {
|
||||
// Registro existente encontrado, atualize conforme necessário
|
||||
if (strpos($component_tag, '@Obturador') !== false) {
|
||||
$existingDataControlEquipment->elemental_tasks_id = 9;
|
||||
// Adiciona condições específicas baseadas no tipo de tag
|
||||
if ($tagType == 'Obturador') {
|
||||
// Procura por registros com elemental_tasks_id = 9
|
||||
$query->where('elemental_tasks_id', 9);
|
||||
} elseif ($tagType == 'Corpo') {
|
||||
// Procura por registros com elemental_tasks_id NULL
|
||||
$query->whereNull('elemental_tasks_id');
|
||||
}
|
||||
// Se encontrar Dados nestas condicoes, provavelmente, se refere a Uma atualizacao na pagina atual
|
||||
if ($query->first()) {
|
||||
|
||||
$existingDataControlEquipment = $query->first();
|
||||
|
||||
// Caso nao seja uma possivel atualizacao, antes de criar um dado novo, deve verificar, se exsite um control_equipment_workstation_id, que nao estaja em uso para este equipamento.
|
||||
} else {
|
||||
|
||||
$query = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
->whereNull('departure_date')
|
||||
->where('status', 0)
|
||||
->whereNull('id_workstations')
|
||||
->whereNull('elemental_tasks_id');
|
||||
|
||||
if ($query->first()) {
|
||||
|
||||
$existingDataControlEquipment = $query->first();
|
||||
|
||||
}
|
||||
}
|
||||
// Verifica se um registro foi encontrado e atualiza conforme necessário
|
||||
if ($existingDataControlEquipment) {
|
||||
|
||||
$existingDataControlEquipment->id_workstations = $receiveDataWs->id_workstations;
|
||||
$existingDataControlEquipment->entry_date = now();
|
||||
$existingDataControlEquipment->status = 1;
|
||||
$existingDataControlEquipment->last_active_at = now();
|
||||
|
||||
// Se a tag for 'Obturador', atualiza o elemental_tasks_id se nao deixa como NULL
|
||||
if ($tagType == 'Obturador') {
|
||||
$existingDataControlEquipment->elemental_tasks_id = 9;
|
||||
}
|
||||
$existingDataControlEquipment->save();
|
||||
|
||||
$receiveDataControlEquipment = $existingDataControlEquipment;
|
||||
|
||||
} else {
|
||||
// Nenhum registro existente encontrado, crie um novo
|
||||
$newDataControlEquipment = new ControlEquipmentWorkstation;
|
||||
|
|
@ -323,7 +392,6 @@ public function getEquipmentData($equipment_id, $component_tag)
|
|||
$receiveDataControlEquipment = $newDataControlEquipment;
|
||||
}
|
||||
|
||||
|
||||
// Primeiro, obtenha o registro de ControlEquipmentWorkstation que não deve ter 'elemental_tasks_id' e 'departure_date' como null
|
||||
$completedTasks = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
->whereNotNull('elemental_tasks_id')
|
||||
|
|
@ -442,7 +510,6 @@ public function getEquipmentData($equipment_id, $component_tag)
|
|||
$recebeTasksForEquipment = $recebeTasksForEquipment->sortBy('elemental_tasks_id');
|
||||
}
|
||||
|
||||
dd($receiveDataControlEquipment);
|
||||
|
||||
return view('workstations.workstations', [
|
||||
// Deve receber o atual COntrol ID ? tudo a vez que atualizar ??
|
||||
|
|
@ -455,32 +522,25 @@ public function getEquipmentData($equipment_id, $component_tag)
|
|||
}
|
||||
|
||||
|
||||
public function cancelElementalTaskForEquipment($equipmentID,)
|
||||
public function cancelElementalTaskForEquipment($controlEquipmentID)
|
||||
{
|
||||
//Nesta funcao se o utilizador da Ws utilizar o botao cancelar na view principal,o equipamento deve se desvincular na Ws atual e poder ser selecionado por outra.
|
||||
// Assim sendo mais pratico excluindo o ultimo dado desta Ws da tabela control_equipment_workstation, quando seu 'elemental_tasks_id' e 'departure_date' forem 'Null'
|
||||
$receiveDataEquipment = Equipment::where('equipment_id', $equipmentID)->first();
|
||||
// $receiveDataEquipment = Equipment::where('equipment_id', $equipmentID)->first();
|
||||
|
||||
// Recebe o id do Historico do equipamento, em sua obra atual
|
||||
$receiveEquipmentWorkHistory = EquipmentWorkHistory::where('equipment_id', $receiveDataEquipment->equipment_id)
|
||||
->where('company_projects_id', $receiveDataEquipment->company_projects_id)
|
||||
->first();
|
||||
$receiveControlEquipmentID = ControlEquipmentWorkstation::where('control_equipment_workstation_id', $controlEquipmentID)->first();
|
||||
|
||||
$existingControlEquipment = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $receiveEquipmentWorkHistory->equipmentWorkHistorys_id)
|
||||
->whereNull('elemental_tasks_id')
|
||||
->whereNull('departure_date')
|
||||
->first();
|
||||
if ($receiveControlEquipmentID) {
|
||||
|
||||
$receiveControlEquipmentID->id_workstations = null;
|
||||
$receiveControlEquipmentID->elemental_tasks_id = null;
|
||||
$receiveControlEquipmentID->status = 0;
|
||||
$receiveControlEquipmentID->entry_date = null;
|
||||
$receiveControlEquipmentID->save();
|
||||
|
||||
if ($existingControlEquipment) {
|
||||
$existingControlEquipment->id_workstations = null;
|
||||
$existingControlEquipment->elemental_tasks_id = null;
|
||||
$existingControlEquipment->status = 0;
|
||||
$existingControlEquipment->entry_date = null;
|
||||
$existingControlEquipment->last_active_at = null;
|
||||
$existingControlEquipment->save();
|
||||
}
|
||||
|
||||
|
||||
return redirect(route('enterWorkstation'));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
316
app/Http/ViewComposers/WorkstationComposer copy.php
Executable file
316
app/Http/ViewComposers/WorkstationComposer copy.php
Executable file
|
|
@ -0,0 +1,316 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use App\Models\ConstructionWorkstation;
|
||||
use App\Models\ControlEquipmentWorkstation;
|
||||
use App\Models\Equipment;
|
||||
use App\Models\EquipmentWorkHistory;
|
||||
use App\Models\OrderEquipmentTasks;
|
||||
use App\Models\QrcodesAssociatedEquipment;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WorkstationComposer
|
||||
{
|
||||
public function compose(View $view)
|
||||
{
|
||||
|
||||
//Recebe o User pela sessao atual e recebe seus dados.
|
||||
$userEmail = Auth::user()->email;
|
||||
$receiveDataEmail = User::where('email', $userEmail)->first();
|
||||
$receiveDataWs = ConstructionWorkstation::where('name_workstations', $receiveDataEmail->user_name)->first();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Busca todos os equipamentos associados a um determinado projeto.
|
||||
// $receiveAllEquipmentOfProject = Equipment::where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
// ->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation', function ($query) use ($excludedEquipmentsQuery) {
|
||||
// //Quarto filtro : Com base na variavel $excludedEquipmentsQuery que serve para excluir equipamentos PSV, quando tem o @Corpo e @Obturador sendo feito em simultanio.
|
||||
// $query->whereIn('equipmentWorkHistorys_id', $excludedEquipmentsQuery);
|
||||
// // Primeiro filtro: Equipamentos sem ocorrência em ControlEquipmentWorkstation
|
||||
// $query->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation');
|
||||
// // Segundo filtro: Equipamentos que ja tiverem um controlEquipmentWorkstation_ID criado uma dos Ws o fechou sem concluir por um metodo nao convencional e o script do servidor limpou o controlEquipmentWorkstation_ID
|
||||
// $query->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
// $subQuery->whereNull('id_workstations')
|
||||
// ->whereNull('elemental_tasks_id')
|
||||
// ->whereNull('departure_date')
|
||||
// ->where('status', 0);
|
||||
// });
|
||||
// // Terceiro filtro: Equipamentos com todas as colunas sao prenchidas como deve ser, signifca que e uma tarefa concluida(finalizada) e agora vai criar um novo dado na controlEquipmentWorkstation para a proxima tarefa.
|
||||
// $query->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
// $subQuery->whereNotNull('id_workstations')
|
||||
// ->where(function ($innerQuery) {
|
||||
// $innerQuery->whereNotNull('elemental_tasks_id')
|
||||
// ->whereNotNull('departure_date')
|
||||
// ->where('status', 1);
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// // Adiciona condição para PSV (equipment_type_id = 3)
|
||||
// ->orWhere(function ($query) use ($receiveDataWs) {
|
||||
// // Verifica no sistema se for uma 'PSV' , mesmo apos entrar como @Corpo, ou pelo @Obutador deve deixar o outro disponivel.
|
||||
// $query->whereHas('equipmentType', function ($typeQuery) {
|
||||
// $typeQuery->where('equipment_type_id', 3);
|
||||
// })
|
||||
// ->whereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
// $subQuery->where('status', 1)
|
||||
// ->whereNull('departure_date')
|
||||
// ->where(function ($taskQuery) {
|
||||
// $taskQuery->where('elemental_tasks_id', 9)
|
||||
// ->orWhereNull('elemental_tasks_id');
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// ->with([
|
||||
// 'equipmentWorkHistory' => function ($query) use ($receiveDataWs) {
|
||||
// $query->where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
// ->select('equipment_id', 'equipmentWorkHistorys_id');
|
||||
// }
|
||||
// ])
|
||||
// ->get()
|
||||
// ->map(function ($equipment) {
|
||||
// if (!$equipment->equipmentWorkHistory->isEmpty()) {
|
||||
// $equipmentWorkHistory = $equipment->equipmentWorkHistory->first();
|
||||
// $equipment->equipmentWorkHistoryId = $equipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
// } else {
|
||||
// $equipment->equipmentWorkHistoryId = null;
|
||||
// }
|
||||
// return $equipment;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// foreach ($receiveAllEquipmentOfProject as $equipment) {
|
||||
// // Agora 'equipmentWorkHistoryId' contém um único ID, então não usamos 'pluck'
|
||||
// $workHistoryId = $equipment->equipmentWorkHistoryId; // Obter ID do histórico de trabalho diretamente
|
||||
|
||||
// // Verifica se existe um workHistoryId antes de prosseguir
|
||||
// if (is_null($workHistoryId)) {
|
||||
// continue; // Se não houver histórico de trabalho, continua para o próximo equipamento
|
||||
// }
|
||||
|
||||
// $taskIds = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $workHistoryId)
|
||||
// ->pluck('elemental_tasks_id'); // Obter IDs de tarefas elementares baseado em um único workHistoryId
|
||||
|
||||
// if ($taskIds->isEmpty()) {
|
||||
// continue; // Se não houver tarefas, continua para o próximo equipamento
|
||||
// }
|
||||
|
||||
// //ESTE Code ve quantas vezes ja foi realizada cada tarefa do equipamento atual, saber o code a baixo ver se falta muito ou ja esta quase a acaber
|
||||
// $workstationTaskCounts = ControlEquipmentWorkstation::whereIn('elemental_tasks_id', $taskIds)
|
||||
// ->select('elemental_tasks_id', DB::raw('count(*) as total'))
|
||||
// ->groupBy('elemental_tasks_id')
|
||||
// ->pluck('total', 'elemental_tasks_id'); // Contagem de tarefas nas estações de trabalho
|
||||
|
||||
// // Verificar se todas as tarefas foram concluídas pelo menos uma vez
|
||||
// $allTasksCompleted = $taskIds->every(function ($taskId) use ($workstationTaskCounts) {
|
||||
// return isset ($workstationTaskCounts[$taskId]) && $workstationTaskCounts[$taskId] >= 1;
|
||||
// });
|
||||
|
||||
// if ($allTasksCompleted && $workstationTaskCounts->count() >= $taskIds->count()) {
|
||||
// $completedEquipments->push($equipment); // Adicionar equipamento à lista de concluídos
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Remover equipamentos concluídos da coleção original
|
||||
// $receiveAllEquipmentOfProject = $receiveAllEquipmentOfProject->reject(function ($equipment) use ($completedEquipments) {
|
||||
// return $completedEquipments->contains($equipment);
|
||||
// });
|
||||
|
||||
// $equipmentIds = $receiveAllEquipmentOfProject->pluck('equipment_id');
|
||||
|
||||
// $receiveQrcodeEquipmentsProject = QrcodesAssociatedEquipment::whereIn('equipment_id', $equipmentIds)->get();
|
||||
|
||||
// //VAMOS filtrar os valores recebidos e terar todas as correspondencias de Flange, ja nao e uma tag que nao vai entrar no percurso do Equipamento.
|
||||
// $filteredQrcodeEquipments = $receiveQrcodeEquipmentsProject->reject(function ($item) {
|
||||
// return strpos($item->component_tag, '@Flange') !== false;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Este código identifica equipmentWorkHistorys_id que estão simultaneamente envolvidos em duas tarefas
|
||||
// (uma identificada por elemental_tasks_id = 9 e elemental_tasks_id = NULL), quando o departure_date é null) ou seja, ainda em progresso...
|
||||
// Agrupando-os por equipmentWorkHistorys_id e filtrando para garantir que existam exatamente dois tipos distintos de tarefas elementais para cada equipamento.
|
||||
$excludedEquipmentsQuery = ControlEquipmentWorkstation::select('equipmentWorkHistorys_id')
|
||||
->whereNull('departure_date')
|
||||
->where(function ($query) {
|
||||
$query->where('elemental_tasks_id', 9)
|
||||
->orWhereNull('elemental_tasks_id');
|
||||
})
|
||||
->groupBy('equipmentWorkHistorys_id')
|
||||
->havingRaw('COUNT(DISTINCT elemental_tasks_id) = 2');
|
||||
|
||||
// Este código filtra equipamentos de um projeto específico, excluindo aqueles já entrados no (excludedEquipmentsQuery),
|
||||
$receiveAllEquipmentOfProject = Equipment::where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation', function ($query) use ($excludedEquipmentsQuery) {
|
||||
$query->whereIn('equipmentWorkHistorys_id', $excludedEquipmentsQuery);
|
||||
})
|
||||
// Condicao 1 : Se todos esses campos foram confirmados como NULL e status = 0, signifca que e um control_equipment_workstation_id de um equipamento que foi limpo pelos metodos de fechar atividade do equipamento na Ws de forma nao convencional. pelo script do servidor
|
||||
->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
$subQuery->whereNull('id_workstations')
|
||||
->whereNull('elemental_tasks_id')
|
||||
->whereNull('entry_date')
|
||||
->where('status', 0);
|
||||
})
|
||||
// Condicao 2 : Se os dados encontrados do equipamento tiverem com o departure_date principalmente diferente de NUll, signica que o ultima dado deste equipamento fez e concluiu uma de suas tarefas e agora precisa criar um dado novo.
|
||||
->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
$subQuery->whereNotNull('id_workstations')
|
||||
->where(function ($innerQuery) {
|
||||
$innerQuery->whereNotNull('elemental_tasks_id')
|
||||
->whereNotNull('departure_date')
|
||||
->where('status',1);
|
||||
// ->orWhere('elemental_tasks_id', 9);
|
||||
});
|
||||
})
|
||||
|
||||
->with([
|
||||
'equipmentWorkHistory' => function ($query) use ($receiveDataWs) {
|
||||
$query->where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
->select('equipment_id', 'equipmentWorkHistorys_id');
|
||||
}
|
||||
])
|
||||
->get()
|
||||
->map(function ($equipment) {
|
||||
$equipmentWorkHistory = $equipment->equipmentWorkHistory->first() ?? null;
|
||||
$equipment->equipmentWorkHistoryId = $equipmentWorkHistory?->equipmentWorkHistorys_id;
|
||||
return $equipment;
|
||||
});
|
||||
|
||||
dd($receiveAllEquipmentOfProject);
|
||||
|
||||
$completedEquipments = collect(); // Coleção para armazenar equipamentos concluídos
|
||||
|
||||
// Inicializa um array para armazenar o status de cada equipamento
|
||||
$equipmentStatus = [];
|
||||
|
||||
foreach ($receiveAllEquipmentOfProject as $equipment) {
|
||||
// Agora 'equipmentWorkHistoryId' contém um único ID, então não usamos 'pluck'
|
||||
$workHistoryId = $equipment->equipmentWorkHistoryId; // Obter ID do histórico de trabalho diretamente
|
||||
|
||||
// Verifica se existe um workHistoryId antes de prosseguir
|
||||
if (is_null($workHistoryId)) {
|
||||
continue; // Se não houver histórico de trabalho, continua para o próximo equipamento
|
||||
}
|
||||
|
||||
$taskIds = OrderEquipmentTasks::where('equipmentWorkHistorys_id', $workHistoryId)
|
||||
->pluck('elemental_tasks_id'); // Obter IDs de tarefas elementares baseado em um único workHistoryId
|
||||
|
||||
if ($taskIds->isEmpty()) {
|
||||
continue; // Se não houver tarefas, continua para o próximo equipamento
|
||||
}
|
||||
|
||||
|
||||
// Busca registros na ControlEquipmentWorkstation com base no equipmentWorkHistoryId
|
||||
$controlRecords = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $workHistoryId)->get();
|
||||
|
||||
if ($controlRecords->isEmpty()) {
|
||||
// Se não houver registros, considera como valor 0 (nenhuma tarefa ativa)
|
||||
$equipmentStatus[$equipment->equipment_id] = 0;
|
||||
} else {
|
||||
//Deve verificar se o departure_date e NULL e o id_workstations <> null, e status = 0
|
||||
// $activeTasks = $controlRecords->whereNull('departure_date');
|
||||
$activeTasks = $controlRecords->whereNull('departure_date')
|
||||
->whereNotNull('id_workstations')
|
||||
->where('status', '!=', 0);
|
||||
|
||||
if ($activeTasks->isEmpty()) {
|
||||
// Se não houver tarefas ativas, considera como valor 0 (nenhuma tarefa ativa)
|
||||
$equipmentStatus[$equipment->equipment_id] = 0;
|
||||
} else {
|
||||
// Verifica as condições para determinar os valores 1 ou 2
|
||||
$hasObturadorTask = $activeTasks->contains('elemental_tasks_id', 9);
|
||||
$hasCorpoTask = $activeTasks->contains('elemental_tasks_id', null);
|
||||
|
||||
if ($hasObturadorTask) {
|
||||
// Se tiver tarefa ativa para Obturador, valor = 2
|
||||
$equipmentStatus[$equipment->equipment_id] = 2;
|
||||
} elseif ($hasCorpoTask) {
|
||||
// Se tiver tarefa ativa para Corpo, valor = 1
|
||||
$equipmentStatus[$equipment->equipment_id] = 1;
|
||||
} else {
|
||||
// Caso contrário, considera como 0
|
||||
$equipmentStatus[$equipment->equipment_id] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workstationTaskCounts = ControlEquipmentWorkstation::whereIn('elemental_tasks_id', $taskIds)
|
||||
->select('elemental_tasks_id', DB::raw('count(*) as total'))
|
||||
->groupBy('elemental_tasks_id')
|
||||
->pluck('total', 'elemental_tasks_id'); // Contagem de tarefas nas estações de trabalho
|
||||
|
||||
// Verificar se todas as tarefas foram concluídas pelo menos uma vez
|
||||
$allTasksCompleted = $taskIds->every(function ($taskId) use ($workstationTaskCounts) {
|
||||
return isset ($workstationTaskCounts[$taskId]) && $workstationTaskCounts[$taskId] >= 1;
|
||||
});
|
||||
|
||||
if ($allTasksCompleted && $workstationTaskCounts->count() >= $taskIds->count()) {
|
||||
$completedEquipments->push($equipment); // Adicionar equipamento à lista de concluídos
|
||||
}
|
||||
}
|
||||
|
||||
// Remover equipamentos concluídos da coleção original
|
||||
$receiveAllEquipmentOfProject = $receiveAllEquipmentOfProject->reject(function ($equipment) use ($completedEquipments) {
|
||||
return $completedEquipments->contains($equipment);
|
||||
});
|
||||
|
||||
$equipmentIds = array_keys($equipmentStatus);
|
||||
|
||||
|
||||
|
||||
// Obtendo os registros QrcodesAssociatedEquipment para esses equipamentos
|
||||
$receiveQrcodeEquipmentsProject = QrcodesAssociatedEquipment::whereIn('equipment_id', $equipmentIds)
|
||||
->get();
|
||||
|
||||
|
||||
$filteredQrcodeEquipments = $receiveQrcodeEquipmentsProject->filter(function ($qrcodeEquipment) use ($equipmentStatus) {
|
||||
// Exclui 'Flange'
|
||||
if (strpos($qrcodeEquipment->component_tag, '@Flange') !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Obtém o status do equipamento atual
|
||||
$equipmentId = $qrcodeEquipment->equipment_id;
|
||||
$status = $equipmentStatus[$equipmentId] ?? null;
|
||||
|
||||
// Decide se 'Corpo' ou 'Obturador' deve ser excluído com base no status
|
||||
switch ($status) {
|
||||
case 1: // Exclui 'Corpo' se o status for 1
|
||||
return strpos($qrcodeEquipment->component_tag, '@Corpo') === false;
|
||||
case 2: // Exclui 'Obturador' se o status for 2
|
||||
return strpos($qrcodeEquipment->component_tag, '@Obturador') === false;
|
||||
case 0: // Mantém ambos se o status for 0
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
//Returning values of the queries to workstations layout
|
||||
$view->with([
|
||||
'receiveAllEquipmentOfProject' => $receiveAllEquipmentOfProject,
|
||||
// foi alterado para a variavel 'filteredQrcodeEquipments' pois nao tem a necessidade do utilizador selecionar 'Flange'(AINDA NAO !)
|
||||
'receiveQrcodeEquipmentsProject' => $filteredQrcodeEquipments,
|
||||
'completedEquipments' => $completedEquipments,
|
||||
'receiveDataWs' => $receiveDataWs,
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -18,69 +18,70 @@ class WorkstationComposer
|
|||
{
|
||||
public function compose(View $view)
|
||||
{
|
||||
//Recebe o User pela sessao atual e recebe seus dados.
|
||||
$userEmail = Auth::user()->email;
|
||||
$receiveDataEmail = User::where('email', $userEmail)->first();
|
||||
|
||||
$receiveDataWs = ConstructionWorkstation::where('name_workstations', $receiveDataEmail->user_name)->first();
|
||||
|
||||
// Busca todos os equipamentos associados a um determinado projeto.
|
||||
|
||||
// Verifica equipamentos que tenho 2 dados com o departure_date = NULL e especificamente um dado tem o elemental_tasks_id = 9 e o outro igual a NULL.
|
||||
//Isto para ser possivel identificar equipamentos (psv-Provavelmente) que esta sendo feitas em simultanio suas pecas e nao deve ser diponivel ate uma de suas pecas tiverem deponivel.
|
||||
$excludedEquipmentsQuery = ControlEquipmentWorkstation::select('equipmentWorkHistorys_id')
|
||||
->whereNull('departure_date')
|
||||
->where('status', 1)
|
||||
->groupBy('equipmentWorkHistorys_id')
|
||||
->havingRaw('SUM(CASE WHEN elemental_tasks_id = 9 THEN 1 ELSE 0 END) = 1') // Assegura um registro com elemental_tasks_id = 9
|
||||
->havingRaw('SUM(CASE WHEN elemental_tasks_id IS NULL THEN 1 ELSE 0 END) = 1') // Assegura um registro com elemental_tasks_id NULL
|
||||
->pluck('equipmentWorkHistorys_id'); // Obtém os IDs para exclusão
|
||||
|
||||
|
||||
// // Busca todos os equipamentos associados a um determinado projeto.
|
||||
// $receiveAllEquipmentOfProject = Equipment::where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
// // Verifica se existe histórico de trabalho associado ao equipamento e ao projeto específico.
|
||||
// ->whereHas('equipmentWorkHistory', function ($query) use ($receiveDataWs) {
|
||||
// $query->where('company_projects_id', $receiveDataWs->company_projects_id);
|
||||
// })
|
||||
// // Exclui os equipamentos cujo histórico de trabalho mais recente (controlEquipmentWorkstation) tem 'elemental_tasks_id' e 'departure_date' nulos.
|
||||
// ->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation', function ($query) {
|
||||
// $query->where(function ($q) {
|
||||
// $q->whereNull('elemental_tasks_id')
|
||||
// ->WhereNull('departure_date')
|
||||
// ->WhereNotNull('id_workstations');
|
||||
// }) ;
|
||||
// })
|
||||
|
||||
// // Carrega o histórico de trabalho associado ao equipamento e ao projeto específico.
|
||||
// ->with([
|
||||
// 'equipmentWorkHistory' => function ($query) use ($receiveDataWs) {
|
||||
// // Filtra o histórico de trabalho pelo 'company_projects_id' para obter os registros relevantes.
|
||||
// $query->where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
// ->select('equipment_id', 'equipmentWorkHistorys_id'); // Seleciona apenas os campos necessários.
|
||||
// }
|
||||
// ])
|
||||
// ->get() // Obtém os resultados da consulta.
|
||||
// ->map(function ($equipment) {
|
||||
// // Supondo que cada equipamento tem apenas um 'equipmentWorkHistory' relevante para este contexto
|
||||
// if (!$equipment->equipmentWorkHistory->isEmpty()) {
|
||||
// $equipmentWorkHistory = $equipment->equipmentWorkHistory->first();
|
||||
// $equipment->equipmentWorkHistoryId = $equipmentWorkHistory->equipmentWorkHistorys_id;
|
||||
// } else {
|
||||
// // Definir como null ou algum valor padrão se não houver histórico correspondente
|
||||
// $equipment->equipmentWorkHistoryId = null;
|
||||
// }
|
||||
// return $equipment;
|
||||
// });
|
||||
|
||||
// $receiveAllEquipmentOfProject = Equipment::where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
// ->WhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) use ($excludedEquipmentsQuery) {
|
||||
// $subQuery->whereNot('equipmentWorkHistorys_id', $excludedEquipmentsQuery);
|
||||
// })
|
||||
// // Primeiro filtro: Equipamentos sem ocorrência em ControlEquipmentWorkstation
|
||||
// ->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation')
|
||||
// // Segundo filtro: Equipamentos com ocorrências onde id_workstations e elemental_tasks_id são nulos
|
||||
// ->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($query) {
|
||||
// $query->whereNull('id_workstations')
|
||||
// ->whereNull('elemental_tasks_id');
|
||||
|
||||
// // Segundo filtro: Equipamentos que ja tiverem um controlEquipmentWorkstation_ID criado uma dos Ws o fechou sem concluir por um metodo nao convencional e o script do servidor limpou o controlEquipmentWorkstation_ID
|
||||
// ->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
// $subQuery->whereNull('id_workstations')
|
||||
// ->whereNull('elemental_tasks_id')
|
||||
// ->whereNull('departure_date')
|
||||
// ->where('status', 0);
|
||||
// })
|
||||
// // Terceiro filtro: Equipamentos com todas as ocorrências onde id_workstations, elemental_tasks_id e departure_date não são nulos
|
||||
// ->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($query) {
|
||||
// $query->whereNotNull('id_workstations')
|
||||
// ->whereNotNull('elemental_tasks_id')
|
||||
// ->whereNotNull('departure_date');
|
||||
// // Terceiro filtro: Equipamentos com todas as colunas sao prenchidas como deve ser, signifca que e uma tarefa concluida(finalizada) e agora vai criar um novo dado na controlEquipmentWorkstation para a proxima tarefa.
|
||||
// ->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
// $subQuery->whereNotNull('id_workstations')
|
||||
// ->where(function ($innerQuery) {
|
||||
// $innerQuery->whereNotNull('elemental_tasks_id')
|
||||
// ->whereNotNull('departure_date')
|
||||
// ->where('status', 1);
|
||||
// });
|
||||
// })
|
||||
|
||||
// // No geral esta condicao verifica que e uma psv, e que tem a possiblidade de ficar diponivel para selecionar o equipamento , mesmo com ele ja dentro de uma Ws.
|
||||
// // Adiciona condição para PSV (equipment_type_id = 3)
|
||||
// ->orWhere(function ($query) {
|
||||
// // Verifica no sistema se for uma 'PSV' , mesmo apos entrar como @Corpo, ou pelo @Obutador deve deixar o outro disponivel.
|
||||
// $query->whereHas('equipmentType', function ($typeQuery) {
|
||||
// $typeQuery->where('equipment_type_id', 3);
|
||||
// })
|
||||
// ->whereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
// $subQuery->where('status', 1)
|
||||
// ->whereNull('departure_date')
|
||||
// ->where(function ($taskQuery) {
|
||||
// $taskQuery->where('elemental_tasks_id', 9)
|
||||
// ->orWhereNull('elemental_tasks_id');
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// // Último filtro: Equipamentos cujo equipmentWorkHistorys_id NÃO estão na lista excluída.
|
||||
// ->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) use ($excludedEquipmentsQuery) {
|
||||
// // Aqui é onde verificamos se o equipmentWorkHistorys_id NÃO está contido na lista excluída.
|
||||
// $subQuery->whereIn('equipmentWorkHistorys_id', $excludedEquipmentsQuery);
|
||||
// })
|
||||
// // Carrega o histórico de trabalho associado ao equipamento e ao projeto específico
|
||||
// ->with([
|
||||
// 'equipmentWorkHistory' => function ($query) use ($receiveDataWs) {
|
||||
// $query->where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
// ->select('equipment_id', 'equipmentWorkHistorys_id');
|
||||
// }
|
||||
// ])
|
||||
// ->get()
|
||||
// ->map(function ($equipment) {
|
||||
// if (!$equipment->equipmentWorkHistory->isEmpty()) {
|
||||
|
|
@ -93,34 +94,49 @@ public function compose(View $view)
|
|||
// });
|
||||
|
||||
|
||||
// Busca todos os equipamentos associados a um determinado projeto.
|
||||
$receiveAllEquipmentOfProject = Equipment::where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
->where(function ($query) use ($receiveDataWs) {
|
||||
// Use whereDoesntHave para excluir os equipamentos cujos IDs de histórico estão no array excluído
|
||||
->where(function ($query) use ($excludedEquipmentsQuery) {
|
||||
// Agrupa as condições para aplicar corretamente a lógica de exclusão e inclusão
|
||||
$query->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) use ($excludedEquipmentsQuery) {
|
||||
// Exclui os equipamentos cujos IDs de histórico estão no array excluído
|
||||
$subQuery->whereIn('equipmentWorkHistorys_id', $excludedEquipmentsQuery);
|
||||
})
|
||||
->orWhere(function ($query) {
|
||||
// Aplica o segundo filtro somente aos equipamentos que não foram excluídos pelo primeiro
|
||||
$query->whereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
$subQuery->whereNotNull('id_workstations')
|
||||
->whereNotNull('elemental_tasks_id')
|
||||
->whereNotNull('departure_date')
|
||||
->where('status', 1);
|
||||
});
|
||||
|
||||
// Verifica no sistema se for uma 'PSV' , mesmo apos entrar como @Corpo, ou pelo @Obutador deve deixar o outro disponivel.
|
||||
$query->whereHas('equipmentType', function ($typeQuery) {
|
||||
$typeQuery->where('equipment_type_id', 3);
|
||||
})
|
||||
->whereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
$subQuery->where('status', 1)
|
||||
->whereNull('departure_date')
|
||||
->where(function ($taskQuery) {
|
||||
$taskQuery->where('elemental_tasks_id', 9)
|
||||
->orWhereNull('elemental_tasks_id');
|
||||
});
|
||||
});
|
||||
});
|
||||
// Primeiro filtro: Equipamentos sem ocorrência em ControlEquipmentWorkstation
|
||||
$query->whereDoesntHave('equipmentWorkHistory.controlEquipmentWorkstation');
|
||||
|
||||
// Segundo filtro: Equipamentos com ocorrências onde id_workstations e elemental_tasks_id são nulos
|
||||
// Segundo filtro: Equipamentos que ja tiverem um controlEquipmentWorkstation_ID criado uma dos Ws o fechou sem concluir por um metodo nao convencional e o script do servidor limpou o controlEquipmentWorkstation_ID
|
||||
$query->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
$subQuery->whereNull('id_workstations')
|
||||
->whereNull('elemental_tasks_id');
|
||||
});
|
||||
|
||||
// Terceiro filtro: Equipamentos com todas as ocorrências onde id_workstations, elemental_tasks_id e departure_date não são nulos
|
||||
// Inclui a condição para elemental_tasks_id = 9
|
||||
$query->orWhereHas('equipmentWorkHistory.controlEquipmentWorkstation', function ($subQuery) {
|
||||
$subQuery->whereNotNull('id_workstations')
|
||||
->where(function ($innerQuery) {
|
||||
$innerQuery->whereNotNull('elemental_tasks_id')
|
||||
->whereNotNull('departure_date')
|
||||
->orWhere('elemental_tasks_id', 9); // Inclui equipamentos com elemental_tasks_id = 9 independentemente de outros critérios
|
||||
});
|
||||
->whereNull('elemental_tasks_id')
|
||||
->whereNull('departure_date')
|
||||
->where('status', 0);
|
||||
});
|
||||
})
|
||||
->with([
|
||||
'equipmentWorkHistory' => function ($query) use ($receiveDataWs) {
|
||||
$query->where('company_projects_id', $receiveDataWs->company_projects_id)
|
||||
->select('equipment_id', 'equipmentWorkHistorys_id');
|
||||
}
|
||||
])
|
||||
->with('equipmentWorkHistory') // Carrega o relacionamento equipmentWorkHistory
|
||||
->get()
|
||||
->map(function ($equipment) {
|
||||
if (!$equipment->equipmentWorkHistory->isEmpty()) {
|
||||
|
|
@ -132,10 +148,11 @@ public function compose(View $view)
|
|||
return $equipment;
|
||||
});
|
||||
|
||||
|
||||
|
||||
$completedEquipments = collect(); // Coleção para armazenar equipamentos concluídos
|
||||
|
||||
// Inicializa um array para armazenar o status de cada equipamento
|
||||
$equipmentStatus = [];
|
||||
|
||||
foreach ($receiveAllEquipmentOfProject as $equipment) {
|
||||
// Agora 'equipmentWorkHistoryId' contém um único ID, então não usamos 'pluck'
|
||||
$workHistoryId = $equipment->equipmentWorkHistoryId; // Obter ID do histórico de trabalho diretamente
|
||||
|
|
@ -152,6 +169,40 @@ public function compose(View $view)
|
|||
continue; // Se não houver tarefas, continua para o próximo equipamento
|
||||
}
|
||||
|
||||
// Busca registros na ControlEquipmentWorkstation com base no equipmentWorkHistoryId
|
||||
$controlRecords = ControlEquipmentWorkstation::where('equipmentWorkHistorys_id', $workHistoryId)->get();
|
||||
|
||||
if ($controlRecords->isEmpty()) {
|
||||
// Se não houver registros, considera como valor 0 (nenhuma tarefa ativa)
|
||||
$equipmentStatus[$equipment->equipment_id] = 0;
|
||||
} else {
|
||||
//Deve verificar se o departure_date e NULL e o id_workstations <> null, e status = 0
|
||||
// $activeTasks = $controlRecords->whereNull('departure_date');
|
||||
$activeTasks = $controlRecords->whereNull('departure_date')
|
||||
->whereNotNull('id_workstations')
|
||||
->where('status', '!=', 0);
|
||||
|
||||
if ($activeTasks->isEmpty()) {
|
||||
// Se não houver tarefas ativas, considera como valor 0 (nenhuma tarefa ativa)
|
||||
$equipmentStatus[$equipment->equipment_id] = 0;
|
||||
} else {
|
||||
// Verifica as condições para determinar os valores 1 ou 2
|
||||
$hasObturadorTask = $activeTasks->contains('elemental_tasks_id', 9);
|
||||
$hasCorpoTask = $activeTasks->contains('elemental_tasks_id', null);
|
||||
|
||||
if ($hasObturadorTask) {
|
||||
// Se tiver tarefa ativa para Obturador, valor = 2
|
||||
$equipmentStatus[$equipment->equipment_id] = 2;
|
||||
} elseif ($hasCorpoTask) {
|
||||
// Se tiver tarefa ativa para Corpo, valor = 1
|
||||
$equipmentStatus[$equipment->equipment_id] = 1;
|
||||
} else {
|
||||
// Caso contrário, considera como 0
|
||||
$equipmentStatus[$equipment->equipment_id] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workstationTaskCounts = ControlEquipmentWorkstation::whereIn('elemental_tasks_id', $taskIds)
|
||||
->select('elemental_tasks_id', DB::raw('count(*) as total'))
|
||||
->groupBy('elemental_tasks_id')
|
||||
|
|
@ -172,18 +223,39 @@ public function compose(View $view)
|
|||
return $completedEquipments->contains($equipment);
|
||||
});
|
||||
|
||||
$equipmentIds = array_keys($equipmentStatus);
|
||||
|
||||
$equipmentIds = $receiveAllEquipmentOfProject->pluck('equipment_id');
|
||||
|
||||
$receiveQrcodeEquipmentsProject = QrcodesAssociatedEquipment::whereIn('equipment_id', $equipmentIds)->get();
|
||||
|
||||
//VAMOS filtrar os valores recebidos e terar todas as correspondencias de Flange, ja nao e uma tag que nao vai entrar no percurso do Equipamento.
|
||||
$filteredQrcodeEquipments = $receiveQrcodeEquipmentsProject->reject(function ($item) {
|
||||
return strpos($item->component_tag, '@Flange') !== false;
|
||||
// Obtendo os registros QrcodesAssociatedEquipment para esses equipamentos
|
||||
$receiveQrcodeEquipmentsProject = QrcodesAssociatedEquipment::whereIn('equipment_id', $equipmentIds)
|
||||
->get();
|
||||
|
||||
|
||||
$filteredQrcodeEquipments = $receiveQrcodeEquipmentsProject->filter(function ($qrcodeEquipment) use ($equipmentStatus) {
|
||||
// Exclui 'Flange'
|
||||
if (strpos($qrcodeEquipment->component_tag, '@Flange') !== false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Obtém o status do equipamento atual
|
||||
$equipmentId = $qrcodeEquipment->equipment_id;
|
||||
$status = $equipmentStatus[$equipmentId] ?? null;
|
||||
|
||||
// Decide se 'Corpo' ou 'Obturador' deve ser excluído com base no status
|
||||
switch ($status) {
|
||||
case 1: // Exclui 'Corpo' se o status for 1
|
||||
return strpos($qrcodeEquipment->component_tag, '@Corpo') === false;
|
||||
case 2: // Exclui 'Obturador' se o status for 2
|
||||
return strpos($qrcodeEquipment->component_tag, '@Obturador') === false;
|
||||
case 0: // Mantém ambos se o status for 0
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//Returning values of the queries to workstations layout
|
||||
$view->with([
|
||||
'receiveAllEquipmentOfProject' => $receiveAllEquipmentOfProject,
|
||||
|
|
|
|||
BIN
public/user_logos/1710242399.jpg
Normal file
BIN
public/user_logos/1710242399.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
|
|
@ -416,13 +416,12 @@ function(errorMessage) {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{{--
|
||||
<script>
|
||||
let scannerCheck = new Html5Qrcode("readerUnique");
|
||||
let startScanCheck = document.getElementById("startScanUnique");
|
||||
let readerCheck = document.getElementById("readerUnique");
|
||||
|
||||
|
||||
startScanCheck.addEventListener('click', function() {
|
||||
startScanCheck.style.display = "none";
|
||||
readerCheck.style.display = "block";
|
||||
|
|
@ -430,53 +429,318 @@ function(errorMessage) {
|
|||
scannerCheck.start({
|
||||
facingMode: "environment"
|
||||
}, {
|
||||
fps: 20,
|
||||
fps: 40,
|
||||
qrbox: {
|
||||
width: 250,
|
||||
height: 250
|
||||
width: 450,
|
||||
height: 450
|
||||
}
|
||||
},
|
||||
|
||||
function(qrCodeMessage) {
|
||||
scannerCheck.stop().then(() => {
|
||||
|
||||
//recebe e sepera o valor do Qrcode.
|
||||
const parts = qrCodeMessage.split('@');
|
||||
const valor = parts[0];
|
||||
const componente = parts[1];
|
||||
|
||||
|
||||
// Verifica se a variável do Laravel está definida e não é vazia.
|
||||
//verica se existe $receiveComponentTag e se nao e vazio, se nao for separa a varaivel e guarda o valor antes do @
|
||||
@if (isset($receiveComponentTag) && !empty($receiveComponentTag))
|
||||
expectedTag = "{{ $receiveComponentTag }}".split('@');
|
||||
var expectedTag = "{{ $receiveComponentTag }}".split('@');
|
||||
@endif
|
||||
|
||||
const expectedValor = expectedTag[0];
|
||||
const expectedComponente = "Obturador";
|
||||
// Cria a varaivel para receber valores e alterar com base acoes do qrcode.
|
||||
let receiveValueValidateQRcode;
|
||||
|
||||
const qrCodeErrorInput = document.querySelector(
|
||||
'#form10 #qrCodeError #qrCodeErrorText');
|
||||
|
||||
const qrCodeError = document.querySelector('#form10 #qrCodeError');
|
||||
|
||||
let modalContent;
|
||||
if (valor === expectedValor && componente === expectedComponente) {
|
||||
modalContent =
|
||||
`Valores corretos.<br> QR Lido: ${valor}@${componente}. Esperado: ${expectedValor}@${expectedComponente}`;
|
||||
|
||||
const verificationStatusP = document.querySelector(
|
||||
'#form10 #verificationStatus');
|
||||
|
||||
if (valor == expectedValor && componente == expectedComponente) {
|
||||
|
||||
receiveValueValidateQRcode = 1; // Atualiza para 1 (confirmado)
|
||||
verificationStatusP.textContent = 'Verificado com sucesso !!!';
|
||||
verificationStatusP.style.color = 'green'; // Muda a cor do texto para verde
|
||||
$('#exampleModal').modal('hide'); // Fecha a modal após confirmação
|
||||
qrCodeError.style.display = 'none';
|
||||
|
||||
} else {
|
||||
modalContent =
|
||||
`Valores não correspondem.<br> QR Lido: ${valor}@${componente}.<br> Esperado: ${expectedValor}@${expectedComponente}`;
|
||||
|
||||
$('#exampleModal').modal('hide'); // Fecha a modal após confirmação
|
||||
verificationStatusP.textContent =
|
||||
'Tags nao correspondem ao mesmo equipamento, tente novamente com a Tag correta !!! ';
|
||||
verificationStatusP.style.color = 'red'; // Muda a cor do texto para verde
|
||||
|
||||
qrCodeErrorText.textContent =
|
||||
`QR Lido: ${valor}@${componente} ||| Esperado: ${expectedValor}@${expectedComponente}`;
|
||||
qrCodeErrorText.style.color = 'red';
|
||||
|
||||
qrCodeError.style.display = 'block'
|
||||
}
|
||||
|
||||
// Atualiza o conteúdo da modal
|
||||
document.querySelector('#exampleModal .modal-body').innerHTML = modalContent;
|
||||
// Atualiza o valor do input no formulário
|
||||
//Se o Qrcode nao for o qrcode esperado, ele e devolvido como: ''undefined' se nao ele devolve '1'
|
||||
const confirmCheckbox = document.querySelector(
|
||||
'input[name="ID10[confirm_label_compliance-checkbox]"]');
|
||||
confirmCheckbox.value = receiveValueValidateQRcode;
|
||||
|
||||
// Esconde o botão para não permitir nova varredura
|
||||
readerCheck.style.display = "none";
|
||||
startScanCheck.style.display = "none";
|
||||
// Seleciona o botão pelo seu ID
|
||||
const submitButton = document.getElementById('checkValidateQrCode');
|
||||
|
||||
// Verifica se 'receiveValueValidateQRcode' não é 'undefined'
|
||||
if (receiveValueValidateQRcode !== undefined) {
|
||||
// Se 'receiveValueValidateQRcode' tiver um valor (não 'undefined'), habilita o botão
|
||||
submitButton.disabled = false;
|
||||
} else {
|
||||
// Se 'receiveValueValidateQRcode' for 'undefined', desabilita o botão
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
|
||||
|
||||
readerCheck.style.display = "block";
|
||||
startScanCheck.style.display = "block";
|
||||
});
|
||||
},
|
||||
function(errorMessage) {
|
||||
console.log(errorMessage);
|
||||
}
|
||||
).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
const btnConfirmManual = document.getElementById('btnConfirmManual');
|
||||
const submitButton = document.getElementById(
|
||||
'checkValidateQrCode'); // Supondo que este seja o ID do seu botão de envio.
|
||||
const verificationStatusP = document.querySelector('#form10 #verificationStatus');
|
||||
|
||||
|
||||
btnConfirmManual.addEventListener('click', function() {
|
||||
// Atualiza 'receiveValueValidateQRcode' para 0.
|
||||
let receiveValueValidateQRcode = 0;
|
||||
|
||||
// Atualiza o valor do input no formulário.
|
||||
const confirmCheckbox = document.querySelector(
|
||||
'input[name="ID10[confirm_label_compliance-checkbox]"]');
|
||||
confirmCheckbox.value = receiveValueValidateQRcode;
|
||||
|
||||
// Atualiza o texto de status (opcional).
|
||||
verificationStatusP.textContent = 'Etiquetas confirmadas manualmente';
|
||||
verificationStatusP.style.color = 'orange'; // Altera a cor do texto conforme necessário.
|
||||
|
||||
// Habilita o botão de envio (se necessário).
|
||||
submitButton.disabled = false;
|
||||
|
||||
// Fecha a segunda modal.
|
||||
$('#exampleModalSmall').modal('hide');
|
||||
$('#exampleModal').modal('hide');
|
||||
|
||||
});
|
||||
|
||||
const input = document.getElementById('inputReceiveErrors');
|
||||
const submitButton = document.getElementById('checkValidateQrCode');
|
||||
|
||||
// Função para verificar e ajustar o estado do botão baseado no valor do input
|
||||
function checkInputAndToggleSubmit() {
|
||||
const value = input.value;
|
||||
submitButton.disabled = !(value === '1' || value === '0');
|
||||
}
|
||||
|
||||
// Inicialmente checa o estado para desabilitar o botão se necessário
|
||||
checkInputAndToggleSubmit();
|
||||
});
|
||||
</script> --}}
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
//Variavel para utilizacao de Qrcode
|
||||
let scannerCheck = new Html5Qrcode("readerUnique");
|
||||
let startScanCheck = document.getElementById("startScanUnique");
|
||||
let readerCheck = document.getElementById("readerUnique");
|
||||
|
||||
//Variavel para receber erro em caso de falha de leitura de QrCode
|
||||
const qrCodeError = document.querySelector('#form10 #qrCodeError');
|
||||
const qrCodeErrorText = document.querySelector('#form10 #qrCodeError #qrCodeErrorText');
|
||||
|
||||
//Recebe mensagem variavel de acordo com a leitura do Qrcode ou se foi feito Manualmente
|
||||
const verificationStatusP = document.querySelector('#form10 #verificationStatus');
|
||||
const confirmCheckbox = document.querySelector('input[name="ID10[confirm_label_compliance-checkbox]"]');
|
||||
|
||||
//Botao de confirmacao Manual
|
||||
const btnConfirmManual = document.getElementById('btnConfirmManual');
|
||||
|
||||
//Botao do Submit do formulario, nao deve ficar disponivel ate ter algum valor da verificacao de juncao de equipamentos.
|
||||
const submitButton = document.getElementById('checkValidateQrCode');
|
||||
|
||||
|
||||
|
||||
|
||||
// Função para verificar e ajustar o estado do botão baseado no valor do input
|
||||
function checkInputAndToggleSubmit() {
|
||||
const value = confirmCheckbox.value;
|
||||
submitButton.disabled = !(value == '1' || value == '0');
|
||||
}
|
||||
|
||||
// Inicialmente checa o estado para desabilitar o botão se necessário
|
||||
checkInputAndToggleSubmit();
|
||||
|
||||
startScanCheck.addEventListener('click', function() {
|
||||
startScanCheck.style.display = "none";
|
||||
readerCheck.style.display = "block";
|
||||
|
||||
// Inicia o scanner de QR Code
|
||||
scannerCheck.start({
|
||||
facingMode: "environment"
|
||||
}, {
|
||||
fps: 10,
|
||||
qrbox: 250
|
||||
}, function(qrCodeMessage) {
|
||||
// Lógica de processamento do QR Code
|
||||
processQRCode(qrCodeMessage);
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
//Botao para fechar e cancelar a Leitura do Qrcode.
|
||||
document.getElementById('stopQrcodeRead').addEventListener('click', function() {
|
||||
scannerCheck.stop().then(() => {
|
||||
|
||||
readerCheck.style.display = "none"; // Esconde a área de leitura
|
||||
startScanCheck.style.display =
|
||||
"block"; // Mostra novamente o botão de iniciar leitura
|
||||
|
||||
// Opcionalmente, limpa qualquer mensagem de erro ou de sucesso mostrada durante a leitura
|
||||
const verificationStatusP = document.querySelector(
|
||||
'#form10 #verificationStatus');
|
||||
if (verificationStatusP) {
|
||||
verificationStatusP.textContent = ''; // Limpa o texto
|
||||
verificationStatusP.style.color = ''; // Remove a cor do texto
|
||||
}
|
||||
|
||||
const qrCodeError = document.querySelector('#form10 #qrCodeError');
|
||||
if (qrCodeError) {
|
||||
qrCodeError.style.display = 'none'; // Esconde a mensagem de erro
|
||||
}
|
||||
|
||||
// Reseta o valor do input para um estado inicial, se necessário
|
||||
const confirmCheckbox = document.querySelector(
|
||||
'input[name="ID10[confirm_label_compliance-checkbox]"]');
|
||||
if (confirmCheckbox) {
|
||||
confirmCheckbox.value = ''; // Reseta o valor do input
|
||||
}
|
||||
|
||||
// Reseta ou ajusta qualquer outro elemento da interface conforme necessário
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function processQRCode(qrCodeMessage) {
|
||||
scannerCheck.stop().then(() => {
|
||||
|
||||
//recebe e sepera o valor do Qrcode.
|
||||
const parts = qrCodeMessage.split('@');
|
||||
const valor = parts[0];
|
||||
const componente = parts[1];
|
||||
|
||||
//verica se existe $receiveComponentTag e se nao e vazio, se nao for separa a varaivel e guarda o valor antes do @
|
||||
@if (isset($receiveComponentTag) && !empty($receiveComponentTag))
|
||||
var expectedTag = "{{ $receiveComponentTag }}".split('@');
|
||||
@endif
|
||||
|
||||
const expectedValor = expectedTag[0];
|
||||
const expectedComponente = "Obturador";
|
||||
// Cria a varaivel para receber valores e alterar com base acoes do qrcode.
|
||||
let receiveValueValidateQRcode;
|
||||
|
||||
const qrCodeErrorInput = document.querySelector(
|
||||
'#form10 #qrCodeError #qrCodeErrorText');
|
||||
|
||||
const qrCodeError = document.querySelector('#form10 #qrCodeError');
|
||||
|
||||
let modalContent;
|
||||
|
||||
|
||||
const verificationStatusP = document.querySelector(
|
||||
'#form10 #verificationStatus');
|
||||
|
||||
if (valor == expectedValor && componente == expectedComponente) {
|
||||
|
||||
receiveValueValidateQRcode = 1; // Atualiza para 1 (confirmado)
|
||||
verificationStatusP.textContent = 'Verificado com sucesso !!!';
|
||||
verificationStatusP.style.color = 'green'; // Muda a cor do texto para verde
|
||||
$('#exampleModal').modal('hide'); // Fecha a modal após confirmação
|
||||
qrCodeError.style.display = 'none';
|
||||
|
||||
} else {
|
||||
|
||||
$('#exampleModal').modal('hide'); // Fecha a modal após confirmação
|
||||
verificationStatusP.textContent =
|
||||
'Tags nao correspondem ao mesmo equipamento, tente novamente com a Tag correta !!! ';
|
||||
verificationStatusP.style.color = 'red'; // Muda a cor do texto para verde
|
||||
|
||||
qrCodeErrorText.textContent =
|
||||
`QR Lido: ${valor}@${componente} ||| Esperado: ${expectedValor}@${expectedComponente}`;
|
||||
qrCodeErrorText.style.color = 'red';
|
||||
|
||||
qrCodeError.style.display = 'block'
|
||||
}
|
||||
|
||||
// Atualiza o valor do input no formulário
|
||||
//Se o Qrcode nao for o qrcode esperado, ele e devolvido como: ''undefined' se nao ele devolve '1'
|
||||
const confirmCheckbox = document.querySelector(
|
||||
'input[name="ID10[confirm_label_compliance-checkbox]"]');
|
||||
confirmCheckbox.value = receiveValueValidateQRcode;
|
||||
|
||||
// Seleciona o botão pelo seu ID
|
||||
const submitButton = document.getElementById('checkValidateQrCode');
|
||||
|
||||
// Verifica se 'receiveValueValidateQRcode' não é 'undefined'
|
||||
if (receiveValueValidateQRcode !== undefined) {
|
||||
// Se 'receiveValueValidateQRcode' tiver um valor (não 'undefined'), habilita o botão
|
||||
submitButton.disabled = false;
|
||||
} else {
|
||||
// Se 'receiveValueValidateQRcode' for 'undefined', desabilita o botão
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
readerCheck.style.display = "block";
|
||||
startScanCheck.style.display = "block";
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
btnConfirmManual.addEventListener('click', function() {
|
||||
// Atualiza 'receiveValueValidateQRcode' para 0.
|
||||
let receiveValueValidateQRcode = 0;
|
||||
confirmCheckbox.value =
|
||||
receiveValueValidateQRcode; // Atualiza o valor do input para refletir a confirmação manual
|
||||
|
||||
verificationStatusP.textContent = 'Etiquetas confirmadas manualmente';
|
||||
verificationStatusP.style.color = 'orange'; // Altera a cor do texto conforme necessário.
|
||||
|
||||
checkInputAndToggleSubmit(); // Checa e ajusta o estado do botão após modificar o valor
|
||||
|
||||
scannerCheck.stop().then(() => {
|
||||
$('#exampleModalSmall').modal('hide'); // Fecha a segunda modal.
|
||||
$('#exampleModal').modal('hide'); // Fecha a primeira modal.
|
||||
|
||||
// Apos fechar as Modais, cancelamos o mode de leitura se por acaso tiver sido selecionado e nao apertou em fechar.
|
||||
readerCheck.style.display = "none"; // Esconde a área de leitura
|
||||
startScanCheck.style.display = "block"; // Mostra novamente o botão de iniciar leitura
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Clone the behavior of treeview to control-treeview
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
<script>
|
||||
$.widget.bridge('uibutton', $.ui.button)
|
||||
</script>
|
||||
<!-- Bootstrap 4 -->
|
||||
|
||||
{{-- <!-- Bootstrap 4 -->
|
||||
<script src="{{ URL::asset('assets/plugins/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
|
||||
<!-- ChartJS -->
|
||||
<script src="{{ URL::asset('assets/plugins/chart.js/Chart.min.js') }}"></script>
|
||||
|
|
@ -35,19 +36,25 @@
|
|||
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
|
||||
<script src="{{ URL::asset('assets/dist/js/pages/dashboard.js') }}"></script>
|
||||
<!-- HTML5 QRCode-->
|
||||
<script src="{{ URL::asset('assets/plugins/html5-qrcode/html5-qrcode.min.js') }}"></script>
|
||||
<script src="{{ URL::asset('assets/plugins/html5-qrcode/html5-qrcode.min.js') }}"></script> --}}
|
||||
|
||||
|
||||
@section('content')
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.3/jquery-ui-timepicker-addon.min.js">
|
||||
|
||||
@if (session('danger'))
|
||||
<div class="content">
|
||||
<div class="alert alert-danger" role="alert" id="alert-message-danger" style="transition: opacity 1s;">
|
||||
{{ session('danger') }}
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
$('#alert-message-danger').fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000); // A mensagem desaparecerá após 5 segundos
|
||||
</script>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.3/jquery-ui-timepicker-addon.min.css">
|
||||
|
||||
|
||||
@endif
|
||||
|
||||
<section class="content">
|
||||
|
||||
|
|
@ -430,11 +437,11 @@ class="form-control card_inputs" id="isolation"
|
|||
<!-- Card corpo do equipamento para onde vai receber as Tarefas elementares -->
|
||||
<div class="card-body">
|
||||
|
||||
<form action="{{ route('cancelElementalTaskForEquipment', $receiveDataEquipment->equipment_id,$receiveDataControlEquipment) }}"
|
||||
<form action="{{ route('cancelElementalTaskForEquipment', ['controlEquipmentID' => $dataControlEquipment->control_equipment_workstation_id]) }}"
|
||||
method="get">
|
||||
<div class="card-footer">
|
||||
<button type="submit" data-action="cancel"
|
||||
class="btn btn-danger float-right" style="background-color: red">Finalizar Ações do equipamento</button>
|
||||
class="btn btn-danger float-right" style="background-color: red">Finalizar Ações ao equipamento</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
|
@ -463,13 +470,19 @@ class="btn btn-danger float-right" style="background-color: red">Finalizar Açõ
|
|||
<div class="card-body">
|
||||
<form
|
||||
action="{{ route('receiveAnswersEquipment', $dataControlEquipment->control_equipment_workstation_id) }}"
|
||||
method="POST" id="form1">
|
||||
method="POST" id="form1" enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="controlEquipmentID"
|
||||
value="{{ $receiveDataControlEquipment->control_equipment_workstation_id ?? '' }}">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="image"></label>
|
||||
<input type="file" id="image" name="image" class="from-control-file">
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Conformidade da etiqueta -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6 icheck-primary">
|
||||
|
|
@ -3507,28 +3520,23 @@ class="btn btn-primary float-right">Guardar</button>
|
|||
@csrf
|
||||
<div class="form-group">
|
||||
<!-- Single form-group for all content -->
|
||||
|
||||
<!-- Conformidade da etiqueta -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6 icheck-primary">
|
||||
<input id="ID10[confirm_label_compliance-checkbox]"
|
||||
type="checkbox"
|
||||
name="ID10[confirm_label_compliance-checkbox]"
|
||||
@if (isset($task_todo->formatted_answers['confirm_label_compliance']) &&
|
||||
$task_todo->formatted_answers['confirm_label_compliance'] == 'on') checked @endif
|
||||
@if ($task_todo->cardTypeStyle == 'gray') disabled @endif required>
|
||||
<label for="ID10[confirm_label_compliance-checkbox]">
|
||||
Conformidade da etiqueta <span style="color: red;">*</span>
|
||||
|
||||
</label>
|
||||
<div class="row mt-2" id="qrCodeError" style="display: none">
|
||||
<div class="col-md-4">
|
||||
<label style="color:red;">Erro encontrado:</label>
|
||||
</div>
|
||||
</div> <!-- ./ Conformidade da etiqueta -->
|
||||
<div class="col-md-8">
|
||||
<p id="qrCodeErrorText"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="mt-5 text-center" id="verificationStatus"></p>
|
||||
|
||||
<input id="inputReceiveErrors" class="confirm_component_joints-boolean" type="hidden" name="ID10[confirm_label_compliance-checkbox]">
|
||||
|
||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
|
||||
Confirmar juncao de etiquetas
|
||||
Confirmar juncao de etiquetas <span style="color: red;">*</span>
|
||||
</button>
|
||||
|
||||
|
||||
<!-- Perno de calibração -->
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
|
|
@ -3809,8 +3817,10 @@ class="form-control select2" required>
|
|||
@if ($task_todo->cardTypeStyle != 'gray')
|
||||
<div class="card-footer">
|
||||
<!-- Botão alinhado à direita -->
|
||||
<button type="submit"
|
||||
class="btn btn-primary float-right">Guardar</button>
|
||||
{{-- <button type="submit" id="checkValidateQrCode"
|
||||
class="btn btn-primary float-right">Guardar</button> --}}
|
||||
<button type="submit" id="checkValidateQrCode" class="btn btn-primary float-right" disabled>Guardar</button>
|
||||
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
|
@ -3821,10 +3831,10 @@ class="btn btn-primary float-right">Guardar</button>
|
|||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
|
||||
<div class="modal-header bg-primary">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Conformidade da etiqueta</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
|
@ -3832,7 +3842,8 @@ class="btn btn-primary float-right">Guardar</button>
|
|||
<div class="modal-body">
|
||||
|
||||
<div class="row justify-content-center align-items-center" style="height: 50vh">
|
||||
<div class="col-6">
|
||||
|
||||
<div class="col-12 col-lg-7">
|
||||
<div class="card card-info">
|
||||
<div class="card-header" style="background-color: #00B0EA">
|
||||
<h3 class="card-title text-center">Escaneie a outra Tag para confimar a junção </h3>
|
||||
|
|
@ -3848,18 +3859,46 @@ class="btn btn-primary float-right">Guardar</button>
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button id="stopQrcodeRead" class="btn btn-warning">Parar Leitura</button>
|
||||
|
||||
<button type="button" class="btn btn-danger float-right" data-toggle="modal" data-target="#exampleModalSmall" style="background-color: red">
|
||||
Confirmar juncao de etiquetas <b>Manualmente</b>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary">Save changes</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="exampleModalSmall">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">Confirmar etiquetas Manualmente</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">x</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
Deseja realmente confirmar as etiquetas manualmente? Esta ação deve ser efetuada apenas se a confirmação por QR code não for possível. Ao confirmar, está a validar que o <b>Corpo</b> e o <b>Obturador</b> pertencem ao mesmo equipamento.
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
|
||||
<button type="button" id="btnConfirmManual" class="btn btn-primary">Confirmar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- TE7(2)-CV - Fecho da válvula e substituição de componentes -->
|
||||
@if ($task_todo->elemental_tasks_id == 11)
|
||||
<!-- Workstation card -->
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
|
||||
|
||||
|
||||
Route::get('cancelElementalTaskForEquipment/{equipmentID}', [WorkstationsJobsController::class, 'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
||||
Route::get('cancelElementalTaskForEquipment/{controlEquipmentID}', [WorkstationsJobsController::class, 'cancelElementalTaskForEquipment'])->name('cancelElementalTaskForEquipment');
|
||||
|
||||
// Nao gosto que esteja neste controller, verificar mais tarde
|
||||
Route::get('articulated_2/{projectID}/{equipmentID}', [ProjectoDatacontroller::class, 'projectDetails_11'])->name('projectDetails_11');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user