mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
get file and upload_files methods
This commit is contained in:
@ -303,22 +303,26 @@ class Ordentrabajo extends BaseController
|
||||
->add("action", fn($q) => $q)
|
||||
->toJson(true);
|
||||
}
|
||||
public function select_maquina_planning_rot(){
|
||||
public function select_maquina_planning_rot()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
$result = $this->produccionService->querySelectMaquinaPlanningRotativa($q);
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
public function select_papel_planning_rot(){
|
||||
public function select_papel_planning_rot()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
$result = $this->produccionService->querySelectPapelPlanningRot($q);
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
public function select_maquina_planning_plana(){
|
||||
public function select_maquina_planning_plana()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
$result = $this->produccionService->querySelectMaquinaPlanningPlana($q);
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
public function select_papel_planning_plana(){
|
||||
public function select_papel_planning_plana()
|
||||
{
|
||||
$q = $this->request->getGet('q');
|
||||
$result = $this->produccionService->querySelectPapelPlanningPlana($q);
|
||||
return $this->response->setJSON($result);
|
||||
@ -328,5 +332,44 @@ class Ordentrabajo extends BaseController
|
||||
$status = $this->produccionService->tareaUpdateMaquinaCorte($orden_trabajo_id);
|
||||
return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $status]);
|
||||
}
|
||||
|
||||
public function get_files() {
|
||||
$bodyData = $this->request->getPost();
|
||||
$files = $this->produccionService->init($bodyData["orden_trabajo_id"])->getOtFiles();
|
||||
$response = [];
|
||||
foreach ($files as $key => $file) {
|
||||
$file_ci4 = new File($file->file_path);
|
||||
$response[] = [
|
||||
"name" => $file->name,
|
||||
"size" => $file_ci4->getSize(),
|
||||
"hash" => $file->hash()
|
||||
];
|
||||
}
|
||||
return json_encode($response);
|
||||
}
|
||||
public function upload_files()
|
||||
{
|
||||
try {
|
||||
//code...
|
||||
$otFiles = [];
|
||||
$bodyData = $this->request->getPost();
|
||||
$files = $this->request->getFileMultiple('file');
|
||||
$response = $this->produccionService
|
||||
->init($bodyData["orden_trabajo_id"])
|
||||
->storeOtFiles($files);
|
||||
return $this->response->setJSON([
|
||||
"message" => lang("App.global_alert_save_success"),
|
||||
"data" => $response,
|
||||
"status" => true
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
return $this->response->setJSON(
|
||||
[
|
||||
"message" => lang("App.global_alert_save_error"),
|
||||
"data" => $th,
|
||||
"error" => $th->getMessage(),
|
||||
"status" => false
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user