diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index d1b401de..95774bd2 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -744,8 +744,8 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func $routes->get('datatable_ferro_pendiente', 'Ordentrabajo::datatable_ferro_pendiente'); $routes->get('datatable_ferro_ok', 'Ordentrabajo::datatable_ferro_ok'); $routes->get('tareas/datatable/(:num)', 'Ordentrabajo::tareas_datatable/$1', ['as' => 'datatableTareasOrdenTrabajo']); - $routes->get("tarea/progress/(:num)","Ordentrabajo::get_orden_trabajo_progress_date/$1"); - + $routes->get("tarea/progress/(:num)", "Ordentrabajo::get_orden_trabajo_progress_date/$1"); + $routes->get('tarea/(:num)', 'Ordentrabajo::find_tarea/$1'); /**====================== * UPDATES *========================**/ @@ -760,15 +760,16 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func $routes->post("upload/portada", 'Ordentrabajo::upload_orden_trabajo_portada'); $routes->delete("portada/(:num)", 'Ordentrabajo::delete_orden_trabajo_portada/$1'); $routes->get("color/(:num)", 'Ordentrabajo::get_orden_trabajo_color_status/$1'); - $routes->post("update/tarea/progress","Ordentrabajo::store_orden_trabajo_progress_date"); - $routes->delete("tarea/progress/(:num)","Ordentrabajo::delete_orden_trabajo_progress_date/$1"); + $routes->post("update/tarea/progress", "Ordentrabajo::store_orden_trabajo_progress_date"); + $routes->post("update/tarea/pliegos", "Ordentrabajo::update_orden_trabajo_pliegos"); + $routes->delete("tarea/progress/(:num)", "Ordentrabajo::delete_orden_trabajo_progress_date/$1"); /**====================== * FILES *========================**/ $routes->post('get_files', 'Ordentrabajo::get_files'); $routes->post('upload_files', 'Ordentrabajo::upload_files'); - $routes->get('barcode/(:num)', 'Ordentrabajo::imprimir_codigo_safekat/$1',['as' => "getOrdenTrabajoBarCode"]); + $routes->get('barcode/(:num)', 'Ordentrabajo::imprimir_codigo_safekat/$1', ['as' => "getOrdenTrabajoBarCode"]); /**====================== * PDF *========================**/ @@ -818,7 +819,7 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi $routes->post('finalizarEnvio', 'LogisticaController::finalizarEnvio'); $routes->post('generateEnvio', 'LogisticaController::generarEnvio'); $routes->get('selectForNewEnvio', 'LogisticaController::findForNewEnvio'); - $routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio'); + $routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio'); $routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas'); }); diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index bded7f1d..efd40659 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -70,6 +70,11 @@ class Ordentrabajo extends BaseController } + public function find_tarea($orden_trabajo_tarea_id) + { + $t = $this->otTarea->find($orden_trabajo_tarea_id); + return $this->response->setJSON($t); + } public function get_orden_trabajo_summary($orden_trabajo_id) { try { @@ -100,7 +105,7 @@ class Ordentrabajo extends BaseController public function update_orden_trabajo_tarea() { $bodyData = $this->request->getPost(); - // return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $bodyData]); + return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $bodyData]); $validated = $this->validation->run($bodyData, "orden_trabajo_tarea"); if ($validated) { $r = $this->produccionService->updateOrdenTrabajoTarea($bodyData["orden_trabajo_tarea_id"], $bodyData); @@ -109,6 +114,18 @@ class Ordentrabajo extends BaseController return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400); } } + public function update_orden_trabajo_pliegos() + { + $bodyData = $this->request->getPost(); + // return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "data" => $bodyData]); + $validated = $this->validation->run($bodyData, "orden_trabajo"); + if ($validated) { + $r = $this->produccionService->init($bodyData["orden_trabajo_id"])->updateOrdenTrabajoTareaPliegos($bodyData); + return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "data" => $bodyData]); + } else { + return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400); + } + } public function update_orden_trabajo_date() { $bodyData = $this->request->getPost(); @@ -128,7 +145,7 @@ class Ordentrabajo extends BaseController $validated = $this->validation->run($bodyData, "orden_trabajo_date"); if ($validated) { $validatedData = $bodyData; - $r = $this->produccionService->emptyOrdenTrabajoDate($validatedData['orden_trabajo_id'],$validatedData['name']); + $r = $this->produccionService->emptyOrdenTrabajoDate($validatedData['orden_trabajo_id'], $validatedData['name']); return $this->response->setJSON(["message" => lang("App.global_alert_save_success"), "status" => $r, "user" => auth()->user(), "data" => $bodyData]); } else { return $this->response->setJSON(["errors" => $this->validation->getErrors()])->setStatusCode(400); @@ -524,10 +541,10 @@ class Ordentrabajo extends BaseController { return view(static::$viewPath . '/maquinista/viewMaquinistaPlanningList', $this->viewData); } - public function maquinista_maquina_tareas_datatable(string $content , int $maquina_id) + public function maquinista_maquina_tareas_datatable(string $content, int $maquina_id) { $pm = $this->produccionService->getMaquinaImpresionTareasList($maquina_id); - if($content == 'today'){ + if ($content == 'today') { $pm->like('pedidos.fecha_impresion', Time::now()->format('Y-m-d')); } return DataTable::of($pm) diff --git a/ci4/app/Database/Migrations/2025-04-22-204851_CreateCatalogoLibros.php b/ci4/app/Database/Migrations/2025-04-22-204851_CreateCatalogoLibros.php index d61b9c81..dc69047d 100644 --- a/ci4/app/Database/Migrations/2025-04-22-204851_CreateCatalogoLibros.php +++ b/ci4/app/Database/Migrations/2025-04-22-204851_CreateCatalogoLibros.php @@ -80,7 +80,7 @@ class CreateCatalogoLibros extends Migration $this->forge->addUniqueKey('isk'); $this->forge->addForeignKey('cliente_id', 'clientes', 'id'); - $this->forge->createTable('catalogo_libros'); + $this->forge->createTable('catalogo_libros',true); $this->db->query('SET foreign_key_checks = 1'); } diff --git a/ci4/app/Database/Migrations/2025-04-27-082200_AddPliegoColumnOrdenTrabajoTarea.php b/ci4/app/Database/Migrations/2025-04-27-082200_AddPliegoColumnOrdenTrabajoTarea.php new file mode 100644 index 00000000..b42be0d4 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-04-27-082200_AddPliegoColumnOrdenTrabajoTarea.php @@ -0,0 +1,41 @@ + [ + "type" => "INT", + "unsigned" => true, + "default" => 0, + ], + "pliego_1_total" => [ + "type" => "INT", + "unsigned" => true, + "default" => 0, + ], + "pliego_2" => [ + "type" => "INT", + "unsigned" => true, + "default" => 0, + ], + "pliego_2_total" => [ + "type" => "INT", + "unsigned" => true, + "default" => 0, + ], + ]; + public function up() + { + $this->forge->addColumn('orden_trabajo_tareas', $this->COLUMNS); + } + + public function down() + { + $this->forge->dropColumn('orden_trabajo_tareas', array_keys($this->COLUMNS)); + } +} diff --git a/ci4/app/Database/Migrations/2025-04-27-090400_AlterFkOrdenTrabajoTareaProgressDates.php b/ci4/app/Database/Migrations/2025-04-27-090400_AlterFkOrdenTrabajoTareaProgressDates.php new file mode 100644 index 00000000..66bdfa41 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-04-27-090400_AlterFkOrdenTrabajoTareaProgressDates.php @@ -0,0 +1,24 @@ +forge->dropForeignKey('orden_trabajo_tarea_progress_dates','orden_trabajo_tarea_progress_dates_ot_tarea_id_foreign'); + $this->forge->addForeignKey("ot_tarea_id","orden_trabajo_tareas","id",'CASCADE','CASCADE'); + $this->forge->processIndexes('orden_trabajo_tarea_progress_dates'); + } + + public function down() + { + $this->forge->dropForeignKey('orden_trabajo_tarea_progress_dates','orden_trabajo_tarea_progress_dates_ot_tarea_id_foreign'); + $this->forge->addForeignKey("ot_tarea_id","orden_trabajo_tareas","id"); + $this->forge->processIndexes('orden_trabajo_tarea_progress_dates'); + } +} diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index 5bc39032..b5d9216c 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -68,7 +68,7 @@ class OrdenTrabajoEntity extends Entity /** * Devuelve las tareas de la orden de trabajo. * - * @return array + * @return array */ public function tareas(): array { diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php index b98f7640..6eb09ce3 100755 --- a/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoTareaEntity.php @@ -34,8 +34,11 @@ class OrdenTrabajoTareaEntity extends Entity "comment" => null, "click_init" => null, "click_end" => null, + "pliego_1" => null, + "pliego_1_total" => null, + "pliego_2" => null, + "pliego_2_total" => null, ]; - protected $datamap = []; protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $casts = [ "id" => "integer", @@ -52,6 +55,10 @@ class OrdenTrabajoTareaEntity extends Entity "comment" => "?string", "click_init" => "integer", "click_end" => "integer", + "pliego_1" => "integer", + "pliego_1_total" => "integer", + "pliego_2" => "integer", + "pliego_2_total" => "integer", ]; /** @@ -113,6 +120,20 @@ class OrdenTrabajoTareaEntity extends Entity $m = model(PresupuestoAcabadosModel::class); return $m->find($this->attributes["presupuesto_linea_id"]); } + /** + * Devuelve el presupuesto acabado origen de esta tarea + * + * @return ?PresupuestoManipuladosEntity + */ + public function presupuesto_manipulado(): ?PresupuestoManipuladosEntity + { + $m = model(PresupuestoManipuladosModel::class); + $p = null; + if ($this->attributes['presupuesto_manipulado_id']) { + $p = $m->find($this->attributes["presupuesto_manipulado_id"]); + } + return $p; + } public function imposicion(): ?Imposicion { $m = model(ImposicionModel::class); @@ -152,5 +173,13 @@ class OrdenTrabajoTareaEntity extends Entity { return $this->attributes['click_end'] - $this->attributes['click_init']; } - + public function isCosido(): bool + { + $isTareaCosido = false; + $pm = $this->presupuesto_manipulado(); + if ($pm) { + $isTareaCosido = $pm->tarifa()->isCosido(); + } + return $isTareaCosido; + } } diff --git a/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php b/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php index d976de71..5c48cd96 100755 --- a/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php +++ b/ci4/app/Entities/Tarifas/TarifaManipuladoEntity.php @@ -33,4 +33,9 @@ class TarifaManipuladoEntity extends \CodeIgniter\Entity\Entity "user_updated_id" => "int", "is_deleted" => "int", ]; + + public function isCosido(): bool + { + return in_array($this->attributes['id'], [3, 17]); + } } diff --git a/ci4/app/Language/es/Produccion.php b/ci4/app/Language/es/Produccion.php index 002e918c..a511f03e 100755 --- a/ci4/app/Language/es/Produccion.php +++ b/ci4/app/Language/es/Produccion.php @@ -50,6 +50,7 @@ return [ "pendientes" => "Pendientes", "ferro_ok" => "Ferro ok", "envio" => "Envío", + "ferro" => "Ferro", "ot" => "Orden trabajo", "ots" => "Órdenes trabajo", "tiempo_procesamiento" => "Tiempo procesamiento", @@ -121,8 +122,9 @@ return [ ], + "progress_ferro" => "Ferro", "progress_preimpresion" => "Preimpresión", - "progress_logistica" => "Ferro/Logística", + "progress_logistica" => "Logística", "progress_impresion" => "Impresión", "progress_manipulado" => "Manipulado/Acabado", diff --git a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php index 0fb495c6..87e5ad98 100755 --- a/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php +++ b/ci4/app/Models/OrdenTrabajo/OrdenTrabajoTarea.php @@ -32,7 +32,11 @@ class OrdenTrabajoTarea extends Model "tipo_corte", "comment", "click_init", - "click_end" + "click_end", + "pliego_1", + "pliego_1_total", + "pliego_2", + "pliego_2_total" ]; protected bool $allowEmptyInserts = false; diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index 37f7503e..2c10a9d2 100755 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -98,6 +98,13 @@ class ProductionService extends BaseService * @var boolean */ public bool $isGofrado = false; //* CHECK DONE + + /** + * Indica si la orden de trabajo contiene cosido + * Se usa para mostrar la fecha correspondiente en la vista y pliegos + * @var boolean + */ + public bool $isCosido = false; //* CHECK DONE /** * Indica si la orden de trabajo contiene gofrado * Se usa para mostrar la fecha correspondiente en la vista @@ -222,7 +229,6 @@ class ProductionService extends BaseService { return $this->ot; } - /** * Crea una instancia de la orden de trabajo * @@ -814,6 +820,7 @@ class ProductionService extends BaseService "tareas_impresion" => $this->tareas_impresion(), "tiempo_procesamiento" => $this->getTiempoProcesamientoHHMM(), "statusColor" => $this->getOtColorStatus(), + "tareaCosido" => $this->getTareaCosido(), ]; return $summary; } @@ -842,8 +849,8 @@ class ProductionService extends BaseService "tiempo_impresion" => $this->getTiempoTareasImpresionHHMM(), "colors" => $this->getPdfColors(), "isPOD" => $this->isPOD, - "uvi" => $this->getUVI() - + "uvi" => $this->getUVI(), + "tareaCosido" => $this->getTareaCosido(), ]; } public function getImposicionTareaImpresion(): ?Imposicion @@ -894,27 +901,27 @@ class ProductionService extends BaseService public function getPresupuestoLineaImpresion() {} public function tareas_acabado(): array { - $q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll(); + $q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->where("presupuesto_acabado_id IS NOT NULL", NULL, FALSE)->findAll(); return $q; } public function tareas_impresion(): array { - $q = $this->otTarea->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll(); + $q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->where("presupuesto_linea_id IS NOT NULL", NULL, FALSE)->findAll(); return $q; } public function tareas_encuadernacion(): array { - $q = $this->otTarea->where("presupuesto_encuadernado_id IS NOT NULL", NULL, FALSE)->findAll(); + $q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->where("presupuesto_encuadernado_id IS NOT NULL", NULL, FALSE)->findAll(); return $q; } public function tareas_preimpresion(): array { - $q = $this->otTarea->where("presupuesto_preimpresion_id IS NOT NULL", NULL, FALSE)->findAll(); + $q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->where("presupuesto_preimpresion_id IS NOT NULL", NULL, FALSE)->findAll(); return $q; } public function tareas_manipulado(): array { - $q = $this->otTarea->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll(); + $q = $this->otTarea->where('orden_trabajo_id', $this->ot->id)->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll(); return $q; } /**======================================================================== @@ -929,6 +936,18 @@ class ProductionService extends BaseService } return $this->otTarea->update($tarea_id, $data); } + public function updateOrdenTrabajoTareaPliegos($data_pliegos): bool + { + $flag = false; + $tareas = $this->ot->tareas(); + foreach ($tareas as $key => $tarea) { + if ($tarea->isCosido()) { + $flag = $this->otTarea->update($tarea->id, $data_pliegos); + break; + } + } + return $flag; + } public function storeOrdenTrabajoTareaProgressDate($data): bool { $data["action_at"] = Time::now()->format('Y-m-d H:i:s'); @@ -1618,7 +1637,8 @@ class ProductionService extends BaseService "isColor" => $this->isColor, "isBN" => $this->isBN, "isCorte" => $this->corte(), - "isGrapado" => $this->isGrapado + "isGrapado" => $this->isGrapado, + "isCosido" => $this->cosido(), ]; } public function gofrado(): bool @@ -1638,6 +1658,20 @@ class ProductionService extends BaseService $this->isGofrado = $flag; return $this->isGofrado; } + public function cosido(): bool + { + $flag = false; + $manipulados = $this->presupuesto->manipulados(); + foreach ($manipulados as $key => $manipulado) { + $tarifa_manipulado = $manipulado->tarifa(); + if ($tarifa_manipulado->isCosido()) { + $flag = true; + break; + } + } + $this->isCosido = $flag; + return $this->isCosido; + } public function uvi(): bool { $flag = false; @@ -1737,4 +1771,16 @@ class ProductionService extends BaseService $url = route_to("viewProduccionMaquinistaTareaView", $id); return ""; } + public function getTareaCosido(): ?OrdenTrabajoTareaEntity + { + $tareaCosido = null; + $tareas = $this->ot->tareas(); + foreach ($tareas as $key => $tarea) { + if ($tarea->isCosido()) { + $tareaCosido = $tarea; + break; + } + } + return $tareaCosido; + } } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php index b1159005..002a23e1 100755 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otProgress.php @@ -21,7 +21,95 @@
+
"> + + +
+

+
+
"> + +
+ > + +
+
" ?>
+
+ +
"> + +
+ > + +
+
" ?>
+
+ +
"> + +
+ > + +
+
" ?>
+ +
+ +
"> + +
+ > + +
+
" ?>
+ +
+ +
"> + +
+ > + +
+
" ?>
+ +
+
+
"> + +
+

+
+
"> + +
+ > + +
+
" ?>
+ +
+ +
"> + +
+ > + +
+
" ?>
+
+ +
"> + +
+ > + +
+
" ?>
+ +
+
@@ -164,34 +252,7 @@

-
"> - -
- > - -
-
" ?>
-
- -
"> - -
- > - -
-
" ?>
-
- -
"> - -
- > - -
-
" ?>
- -
@@ -214,61 +275,7 @@
-
- - -
-

-
-
"> - -
- > - -
-
" ?>
-
- -
"> - -
- > - -
-
" ?>
-
- -
"> - -
- > - -
-
" ?>
- -
- -
"> - -
- > - -
-
" ?>
- -
- -
"> - -
- > - -
-
" ?>
- -
-
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php index 01b9a253..f6a20d62 100755 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otTask.php @@ -34,7 +34,23 @@