diff --git a/ci4/app/Config/OrdenTrabajo.php b/ci4/app/Config/OrdenTrabajo.php index 72233900..8b029b02 100755 --- a/ci4/app/Config/OrdenTrabajo.php +++ b/ci4/app/Config/OrdenTrabajo.php @@ -65,7 +65,7 @@ class OrdenTrabajo extends BaseConfig ["bg" => "yellow", "color" => "black"], ["bg" => "purple", "color" => "white"], ["bg" => "orange", "color" => "white"], - ["bg" => "blue", "color" => "black"], + ["bg" => "blue", "color" => "white"], ["bg" => "pink", "color" => "black"], ["bg" => "#FFFFFF", "color" => "black"], ]; diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index e71f2a08..95ae5dbf 100755 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -749,8 +749,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 *========================**/ @@ -765,15 +765,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 *========================**/ @@ -808,6 +809,7 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi $routes->get('print/label/test', 'LogisticaController::print_test_label'); $routes->get('panel', 'LogisticaController::panel', ['as' => 'LogisticaPanel']); $routes->get('envios', 'LogisticaController::gestionEnvios', ['as' => 'gestionEnvios']); + $routes->get('enviosFerros', 'LogisticaController::gestionEnviosFerros', ['as' => 'gestionEnviosFerros']); $routes->get('datatableEnvios', 'LogisticaController::datatable_envios'); $routes->get('datatableLineasEnvios/(:num)', 'LogisticaController::datatable_enviosEdit/$1'); $routes->get('envio/(:num)', 'LogisticaController::editEnvio/$1'); @@ -822,8 +824,9 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi $routes->post('updateProveedorEnvio', 'LogisticaController::updateProveedorEnvio'); $routes->post('finalizarEnvio', 'LogisticaController::finalizarEnvio'); $routes->post('generateEnvio', 'LogisticaController::generarEnvio'); + $routes->post('generateEnvioFerro', 'LogisticaController::generarEnvioFerro'); $routes->get('selectForNewEnvio', 'LogisticaController::findForNewEnvio'); - $routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio'); + $routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio'); $routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas'); $routes->get('listAlbaranes', 'LogisticaController::listAlbaranes', ['as' => 'albaranesList']); diff --git a/ci4/app/Controllers/Logistica/LogisticaController.php b/ci4/app/Controllers/Logistica/LogisticaController.php index f293bb3e..3dc24a88 100755 --- a/ci4/app/Controllers/Logistica/LogisticaController.php +++ b/ci4/app/Controllers/Logistica/LogisticaController.php @@ -62,6 +62,22 @@ class LogisticaController extends BaseController 'currentModule' => static::$controllerSlug, 'boxTitle' => lang('Logistica.gestionEnvios'), 'usingServerSideDataTable' => true, + 'tipo_envio' => 'estandar', + ]; + + $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class + + return view(static::$viewPath . 'viewLogisticaSelectEnvios', $viewData); + } + + + public function gestionEnviosFerros() + { + $viewData = [ + 'currentModule' => static::$controllerSlug, + 'boxTitle' => lang('Logistica.envioFerros'), + 'usingServerSideDataTable' => true, + 'tipo_envio' => 'ferro_prototipo', ]; $viewData = array_merge($this->viewData, $viewData); // merge any possible values from the parent controller class @@ -85,7 +101,14 @@ class LogisticaController extends BaseController { if ($this->request->isAJAX()) { - $query = LogisticaService::findForNewEnvio(); + + $tipo_envio = $this->request->getGet('tipo_envio') ?? 'estandar'; + + if($tipo_envio == 'ferro_prototipo'){ + $query = LogisticaService::findForNewEnvioFerro(); + } else { + $query = LogisticaService::findForNewEnvio(); + } if ($this->request->getGet("q")) { $query->groupStart() ->orLike("id", $this->request->getGet("q")) @@ -105,12 +128,12 @@ class LogisticaController extends BaseController public function selectDireccionForEnvio(){ if ($this->request->isAJAX()) { - $pedido_id = $this->request->getGet('pedido_id'); - if($pedido_id == null || $pedido_id == 0){ + $ot = $this->request->getGet('ot_id'); + if($ot == null || $ot == 0){ return []; } $searchVal = $this->request->getGet("q") ?? ""; - $result = LogisticaService::findDireccionesNewEnvio($pedido_id, $searchVal); + $result = LogisticaService::findDireccionesNewEnvio($ot, $searchVal); return $this->response->setJSON($result); } else { @@ -124,9 +147,22 @@ class LogisticaController extends BaseController { if ($this->request->isAJAX()) { - $pedido_id = $this->request->getPost('pedido_id'); - $direccion = $this->request->getPost('direccion'); - $result = LogisticaService::generateEnvio($pedido_id, $direccion); + $ot_id = $this->request->getPost('ot_id'); + $direccion = $this->request->getPost('direccion') ?? ""; + $result = LogisticaService::generateEnvio($ot_id, $direccion); + return $this->response->setJSON($result); + } else { + return $this->failUnauthorized('Invalid request', 403); + } + } + + + public function generarEnvioFerro() + { + if ($this->request->isAJAX()) { + + $ot_id = $this->request->getPost('ot_id'); + $result = LogisticaService::generateEnvioFerro($ot_id); return $this->response->setJSON($result); } else { return $this->failUnauthorized('Invalid request', 403); @@ -233,9 +269,10 @@ class LogisticaController extends BaseController { $otsFilter = $this->request->getGetPost('otsFilter'); + $tipo_envio = $this->request->getGetPost('tipo_envio') ?? 'estandar'; $model = model('App\Models\Logistica\EnvioModel'); - $q = $model->getDatatableQuery(); + $q = $model->getDatatableQuery($tipo_envio); if (!empty($otsFilter)) { $q->groupStart(); @@ -370,7 +407,7 @@ class LogisticaController extends BaseController )->edit( "unidadesEnvio", function ($row, $meta) { - if($row->finalizado == 1){ + if($row->finalizado == 1 || $row->tipo_envio == 'ferro_prototipo'){ return $row->unidadesEnvio; } return ' $presupuesto_id, @@ -73,6 +74,7 @@ class Presupuestodirecciones extends \App\Controllers\BaseResourceController "proveedor" => $proveedor, "proveedor_id" => $proveedor_id, "entregaPieCalle" => $entregaPieCalle, + "is_ferro_prototipo" => $is_ferro_prototipo ]; $response = $this->model->insert($data); 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-26-180000_AddFerroProtoPresupuestoDirecciones.php b/ci4/app/Database/Migrations/2025-04-26-180000_AddFerroProtoPresupuestoDirecciones.php index a80e7131..d5fd4b58 100644 --- a/ci4/app/Database/Migrations/2025-04-26-180000_AddFerroProtoPresupuestoDirecciones.php +++ b/ci4/app/Database/Migrations/2025-04-26-180000_AddFerroProtoPresupuestoDirecciones.php @@ -7,30 +7,24 @@ use CodeIgniter\Database\Migration; use CodeIgniter\Database\RawSql; use CodeIgniter\I18n\Time; -class AddClickColumnOrdenTrabajoTarea extends Migration +class AddFerroProtoPresupuestoDirecciones extends Migration { protected array $COLUMNS = [ - "click_init" => [ - "type" => "INT", + "is_ferro_prototipo" => [ + "type" => "TINYINT", "unsigned" => true, "default" => 0, - "comment" => "Click iniciales de una tarea de impresion" - ], - "click_end" => [ - "type" => "INT", - "unsigned" => true, - "default" => 0, - "comment" => "Click finales de una tarea de impresion" + "comment" => "Indica si es una direccion para el prototipo o ferro", ], ]; public function up() { - $this->forge->addColumn('orden_trabajo_tareas', $this->COLUMNS); + $this->forge->addColumn('presupuesto_direcciones', $this->COLUMNS); } public function down() { - $this->forge->dropColumn('orden_trabajo_tareas', array_keys($this->COLUMNS)); + $this->forge->dropColumn('presupuesto_direcciones', array_keys($this->COLUMNS)); } } diff --git a/ci4/app/Database/Migrations/2025-04-26-200000_AddTipoEnvioEnvios.php b/ci4/app/Database/Migrations/2025-04-26-200000_AddTipoEnvioEnvios.php new file mode 100644 index 00000000..228ee536 --- /dev/null +++ b/ci4/app/Database/Migrations/2025-04-26-200000_AddTipoEnvioEnvios.php @@ -0,0 +1,30 @@ + [ + "type" => "enum", + "constraint" => ['estandar', 'ferro_prototipo'], + "default" => 'estandar', + "comment" => "Indica el tipo de envio", + ], + ]; + public function up() + { + $this->forge->addColumn('envios', $this->COLUMNS); + } + + public function down() + { + $this->forge->dropColumn('envios', array_keys($this->COLUMNS)); + } +} 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..63f92d24 --- /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/Logistica/EnvioEntity.php b/ci4/app/Entities/Logistica/EnvioEntity.php index e6bef114..6f22b7f7 100644 --- a/ci4/app/Entities/Logistica/EnvioEntity.php +++ b/ci4/app/Entities/Logistica/EnvioEntity.php @@ -31,5 +31,6 @@ class EnvioEntity extends Entity 'created_at' => 'datetime', 'updated_at' => 'datetime', 'cajas' => 'int', + 'tipo_envio' => 'string', ]; } diff --git a/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php index 65917b3e..11538041 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoDireccionesEntity.php @@ -25,6 +25,7 @@ class PresupuestoDireccionesEntity extends \CodeIgniter\Entity\Entity "proveedor_id" => null, "margen" => null, "entregaPieCalle" => null, + "is_ferro_prototipo" => null, ]; protected $casts = [ "presupuesto_id" => "int", @@ -38,6 +39,7 @@ class PresupuestoDireccionesEntity extends \CodeIgniter\Entity\Entity "margen" => "float", "proveedor_id" => "int", "entregaPieCalle" => "int", + "is_ferro_prototipo" => "int", ]; } diff --git a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php index 3fa722b7..83ad9323 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoLineaEntity.php @@ -194,39 +194,75 @@ class PresupuestoLineaEntity extends \CodeIgniter\Entity\Entity return $m->find($this->attributes['tarifa_impresion_id']); } - public function get_impresion_logo(){ + public function get_impresion_logo() + { $logo = config(LogoImpresion::class); return $logo->get_logo_path($this->attributes["tipo"]); } - public function get_nombre_tarea() : ?string + public function get_nombre_tarea(): ?string { $nombre = null; - $impresion_bn = ["lp_bn","lp_bnhq","lp_rot_bn"]; - $impresion_color = ["lp_color","lp_colorhq","lp_rot_color"]; + $impresion_bn = ["lp_bn", "lp_bnhq", "lp_rot_bn"]; + $impresion_color = ["lp_color", "lp_colorhq", "lp_rot_color"]; $impresion_cubierta = ["lp_cubierta"]; $impresion_guardas = ["lp_guardas"]; $impresion_sobrecubierta = ["lp_sobrecubierta"]; - $is_bn = in_array($this->attributes["tipo"],$impresion_bn); - $is_color = in_array($this->attributes["tipo"],$impresion_color); - $is_impresion_cubierta = in_array($this->attributes["tipo"],$impresion_cubierta); - $is_impresion_guarda = in_array($this->attributes["tipo"],$impresion_guardas); - $is_impresion_sobrecubierta = in_array($this->attributes["tipo"],$impresion_sobrecubierta); + $is_bn = in_array($this->attributes["tipo"], $impresion_bn); + $is_color = in_array($this->attributes["tipo"], $impresion_color); + $is_impresion_cubierta = in_array($this->attributes["tipo"], $impresion_cubierta); + $is_impresion_guarda = in_array($this->attributes["tipo"], $impresion_guardas); + $is_impresion_sobrecubierta = in_array($this->attributes["tipo"], $impresion_sobrecubierta); - if($is_bn) $nombre ="Impresión B/N"; - if($is_color) $nombre ="Impresión color"; - if($is_impresion_cubierta) $nombre ="Impresión cubierta"; - if($is_impresion_guarda) $nombre ="Impresión guarda"; - if($is_impresion_sobrecubierta) $nombre ="Impresión sobrecubierta"; + if ($is_bn) $nombre = "Impresión B/N"; + if ($is_color) $nombre = "Impresión color"; + if ($is_impresion_cubierta) $nombre = "Impresión cubierta"; + if ($is_impresion_guarda) $nombre = "Impresión guarda"; + if ($is_impresion_sobrecubierta) $nombre = "Impresión sobrecubierta"; return $nombre; } - public function isRotativa() : bool - { - return in_array($this->attributes['tipo'],['lp_rot_color','lp_rot_bn']); + public function isGuarda(): bool + { + return in_array($this->attributes["tipo"], ["lp_guardas"]); } - public function isColor():bool { - return in_array($this->attributes['tipo'],['lp_color','lp_colorhq','lp_rot_color']); - + public function isCubierta(): bool + { + return in_array($this->attributes["tipo"], ["lp_cubierta"]); + } + public function isSobreCubierta(): bool + { + return in_array($this->attributes["tipo"], ["lp_sobrecubierta"]); + } + public function isRotativa(): bool + { + return in_array($this->attributes['tipo'], ['lp_rot_color', 'lp_rot_bn']); + } + public function isColor(): bool + { + return in_array($this->attributes['tipo'], ['lp_color', 'lp_colorhq', 'lp_rot_color']); + } + public function isBN(): bool + { + return in_array($this->attributes['tipo'], ["lp_bn", "lp_bnhq", "lp_rot_bn"]); + } + + public function tinta(): string + { + $tinta = ""; + if ($this->isCubierta()) { + $paginas = $this->attributes['paginas']; + if ($paginas / 2 == 1) { + $tinta = '4/0'; + } + if ($paginas / 2 == 2) { + $tinta = '4/4'; + } + } elseif ($this->isColor()) { + $tinta = '4/4'; + } elseif ($this->isBN()) { + $tinta = '4/0'; + } + return $tinta; } } 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/Logistica/EnvioLineaModel.php b/ci4/app/Models/Logistica/EnvioLineaModel.php index 26938014..a50709d3 100644 --- a/ci4/app/Models/Logistica/EnvioLineaModel.php +++ b/ci4/app/Models/Logistica/EnvioLineaModel.php @@ -37,7 +37,7 @@ class EnvioLineaModel extends Model ->select( "t1.id, t1.pedido_id as pedido, t3.id as presupuesto, t3.titulo as titulo, t1.unidades_envio as unidadesEnvio, t1.unidades_envio as unidadesEnvioRaw, - t1.unidades_total as unidadesTotal, + t1.unidades_total as unidadesTotal, t2.tipo_envio as tipo_envio, IFNULL(( SELECT SUM(t_sub.unidades_envio) FROM envios_lineas t_sub diff --git a/ci4/app/Models/Logistica/EnvioModel.php b/ci4/app/Models/Logistica/EnvioModel.php index f94556c8..2222b0aa 100644 --- a/ci4/app/Models/Logistica/EnvioModel.php +++ b/ci4/app/Models/Logistica/EnvioModel.php @@ -32,13 +32,14 @@ class EnvioModel extends Model 'created_at', 'updated_at', 'cajas', + 'tipo_envio', ]; protected $useTimestamps = true; protected $createdField = 'created_at'; protected $updatedField = 'updated_at'; - public function getDatatableQuery(): BaseBuilder + public function getDatatableQuery($tipo_envio = "estandar"): BaseBuilder { $builder = $this->db ->table($this->table . " t1") @@ -51,6 +52,24 @@ class EnvioModel extends Model $builder->join("lg_paises t3", "t3.id = t1.pais_id", "left"); $builder->join("pedidos t4", "t4.id = t2.pedido_id", "left"); $builder->join('ordenes_trabajo t5', 't5.pedido_id = t4.id'); + $builder->where("t1.tipo_envio", $tipo_envio); + + $builder->groupBy("t1.id"); + return $builder; + } + + public function getDatatableQueryFerroPrototipo(): BaseBuilder + { + $builder = $this->db + ->table($this->table . " t1") + ->select( + "t1.id, GROUP_CONCAT(DISTINCT t5.id) AS ots, + t1.att, t1.direccion, t1.ciudad, t3.nombre as pais, t1.cp, t1.email, t1.telefono, t1.finalizado" + ); + $builder->join("lg_paises t3", "t3.id = t1.pais_id", "left"); + $builder->join("pedidos t4", "t4.id = t2.pedido_id", "left"); + $builder->join('ordenes_trabajo t5', 't5.pedido_id = t4.id'); + $builder->whereIn("t1.tipo_envio", ["estandar"]); $builder->groupBy("t1.id"); return $builder; 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/Models/Presupuestos/PresupuestoDireccionesModel.php b/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php index cc24fb30..15f63294 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoDireccionesModel.php @@ -45,6 +45,7 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel "proveedor_id", "proveedor", "entregaPieCalle", + "is_ferro_prototipo" ]; protected $returnType = "App\Entities\Presupuestos\PresupuestoDireccionesEntity"; @@ -69,7 +70,8 @@ class PresupuestoDireccionesModel extends \App\Models\BaseModel t1.email AS email, t1.direccion AS direccion, t1.pais_id AS pais_id, t2.nombre AS pais, t1.municipio AS municipio, t1.provincia AS provincia, t1.cp AS cp, t1.telefono AS telefono, t1.peso AS peso, t1.cantidad AS cantidad, t1.precio AS precio, t1.margen AS margen, - t1.proveedor_id AS proveedor_id, t1.proveedor AS proveedor, t1.entregaPieCalle AS entregaPieCalle" + t1.proveedor_id AS proveedor_id, t1.proveedor AS proveedor, t1.entregaPieCalle AS entregaPieCalle, + t1.is_ferro_prototipo AS is_ferro_prototipo" ); $builder->where('t1.presupuesto_id', $presupuesto_id); diff --git a/ci4/app/Services/LogisticaService.php b/ci4/app/Services/LogisticaService.php index fe8929d2..d2251313 100644 --- a/ci4/app/Services/LogisticaService.php +++ b/ci4/app/Services/LogisticaService.php @@ -94,6 +94,7 @@ class LogisticaService WHERE el.pedido_id = p.id AND el.presupuesto_id = pr.id AND e.finalizado = 1 + AND e.tipo_envio = 'estandar' ) AS unidades_enviadas, pd.cantidad AS cantidad ") @@ -115,7 +116,47 @@ class LogisticaService return $builder; } - public static function findDireccionesNewEnvio($pedido_id, $searchVal = "") + public static function findForNewEnvioFerro() + { + $db = \Config\Database::connect(); + + // 3. Subconsulta principal + $subBuilder = $db->table('pedidos_linea pl') + ->select(" + ot.id AS id, + CONCAT('[', ot.id, '] - ', pr.titulo) AS name, + p.id as pedido_id, + pr.id as presupuesto_id + ") + ->join('pedidos p', 'p.id = pl.pedido_id') + ->join('presupuestos pr', 'pr.id = pl.presupuesto_id') + ->join('presupuesto_direcciones pd', 'pd.presupuesto_id = pr.id') + ->join('ordenes_trabajo ot', 'ot.pedido_id = p.id') + ->join('orden_trabajo_dates ot_dates', 'ot_dates.orden_trabajo_id = ot.id') + ->whereIn('p.estado', ['finalizado', 'produccion']) + ->where('ot_dates.pendiente_ferro_at IS NOT NULL') + ->where('pd.is_ferro_prototipo', 1) + ->groupBy('pl.id'); + + // 4. Envolver y filtrar por unidades pendientes + $builder = $db->table("({$subBuilder->getCompiledSelect(false)}) AS sub"); + $builder->select('id, name'); + $builder->orderBy('name', 'ASC'); + + $builder->where(" + NOT EXISTS ( + SELECT 1 + FROM envios e + INNER JOIN envios_lineas le ON le.envio_id = e.id + WHERE e.tipo_envio = 'ferro_prototipo' + AND (le.pedido_id = sub.pedido_id OR le.presupuesto_id = sub.presupuesto_id) + ) + ", null, false); + + return $builder; + } + + public static function findDireccionesNewEnvio($ot_id, $searchVal = "") { $direcciones = []; @@ -126,7 +167,9 @@ class LogisticaService ->join('presupuestos pr', 'pr.id=presupuesto_direcciones.presupuesto_id') ->join('pedidos_linea pl', 'pl.presupuesto_id = pr.id') ->join('pedidos p', 'pl.pedido_id=p.id') - ->where('p.id', $pedido_id); + ->join('ordenes_trabajo ot', 'ot.pedido_id = p.id') + ->where('ot.id', $ot_id) + ->where("presupuesto_direcciones.is_ferro_prototipo", 0); if ($searchVal != "") { $dirs = $dirs->groupStart() ->Like("id", $searchVal) @@ -138,10 +181,13 @@ class LogisticaService $unidades_en_direccion = $modelEnvioLineasModel->select('SUM(envios_lineas.unidades_envio) as unidades_enviadas, envios_lineas.unidades_total') ->join('envios', 'envios.id = envios_lineas.envio_id') - ->where('pedido_id', $pedido_id) + ->join('pedidos_linea', 'pedidos_linea.pedido_id = envios_lineas.pedido_id') + ->join('pedidos', 'pedidos.id = pedidos_linea.pedido_id') + ->join('ordenes_trabajo', 'ordenes_trabajo.pedido_id = pedidos.id') + ->where('ordenes_trabajo.id', $ot_id) ->where('envios.direccion', $direccion->direccion) ->where('envios.finalizado', 1) - ->groupBy('pedido_id')->get()->getResult(); + ->groupBy('ordenes_trabajo.pedido_id')->get()->getResult(); if (count($unidades_en_direccion) == 0 || $unidades_en_direccion[0]->unidades_enviadas < $unidades_en_direccion[0]->unidades_total) { array_push( $direcciones, @@ -196,6 +242,7 @@ class LogisticaService ->join('pedidos p', 'p.id = pl.pedido_id') ->join('presupuestos pr', 'pr.id = pl.presupuesto_id') ->join('presupuesto_direcciones pd', 'pd.presupuesto_id = pr.id') + ->where('pd.is_ferro_prototipo', 0) ->where('p.id', $pedido_id) ->whereIn('p.estado', ['finalizado', 'produccion']) ->where("TRIM(LOWER(pd.direccion)) = '$direccionNormalizada'", null, false) @@ -242,7 +289,7 @@ class LogisticaService - public static function generateEnvio($pedido_id, $direccion = null) + public static function generateEnvio($ot_id, $direccion = null) { $presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel'); $direccionNormalizada = strtolower(trim($direccion)); @@ -259,6 +306,7 @@ class LogisticaService presupuesto_direcciones.pais_id, presupuesto_direcciones.cantidad as cantidad_total, presupuestos.cliente_id as cliente_id, + ordenes_trabajo.pedido_id as pedido_id, ( presupuesto_direcciones.cantidad - IFNULL(( @@ -275,7 +323,9 @@ class LogisticaService ->join('pedidos_linea', 'pedidos_linea.presupuesto_id = presupuesto_direcciones.presupuesto_id') ->join('pedidos', 'pedidos.id = pedidos_linea.pedido_id') ->join('presupuestos', 'pedidos_linea.presupuesto_id = presupuestos.id') - ->where('pedidos.id', $pedido_id) + ->join('ordenes_trabajo', 'ordenes_trabajo.pedido_id = pedidos.id') + ->where('ordenes_trabajo.id', $ot_id) + ->where('presupuesto_direcciones.is_ferro_prototipo', 0) ->like('presupuesto_direcciones.direccion', $direccion) ->groupBy('presupuesto_direcciones.id') ->first(); @@ -311,7 +361,7 @@ class LogisticaService $EnvioLineasModel = model('App\Models\Logistica\EnvioLineaModel'); $EnvioLineasModel->save([ 'envio_id' => $idEnvio, - 'pedido_id' => $pedido_id, + 'pedido_id' => $datosEnvio->pedido_id, 'unidades_envio' => $datosEnvio->cantidad, 'unidades_total' => $datosEnvio->cantidad_total, 'cajas' => 1, @@ -332,6 +382,96 @@ class LogisticaService } + public static function generateEnvioFerro($ot_id) + { + $presupuestoDireccionesModel = model('App\Models\Presupuestos\PresupuestoDireccionesModel'); + + $datosEnvio = $presupuestoDireccionesModel + ->select(" + presupuestos.id as presupuesto_id, + presupuesto_direcciones.att, + presupuesto_direcciones.direccion, + presupuesto_direcciones.provincia as ciudad, + presupuesto_direcciones.cp, + presupuesto_direcciones.telefono, + presupuesto_direcciones.email, + presupuesto_direcciones.pais_id, + presupuesto_direcciones.cantidad as cantidad_total, + presupuestos.cliente_id as cliente_id, + ordenes_trabajo.pedido_id as pedido_id, + ") + ->join('pedidos_linea', 'pedidos_linea.presupuesto_id = presupuesto_direcciones.presupuesto_id') + ->join('pedidos', 'pedidos.id = pedidos_linea.pedido_id') + ->join('presupuestos', 'pedidos_linea.presupuesto_id = presupuestos.id') + ->join('ordenes_trabajo', 'ordenes_trabajo.pedido_id = pedidos.id') + ->where('ordenes_trabajo.id', $ot_id) + ->where('presupuesto_direcciones.is_ferro_prototipo', 1) + ->where(" + NOT EXISTS ( + SELECT 1 + FROM envios e + INNER JOIN envios_lineas el ON el.envio_id = e.id + WHERE e.tipo_envio = 'ferro_prototipo' + AND (el.pedido_id = pedidos.id OR el.presupuesto_id = presupuestos.id) + ) + ", null, false) // <= Esta es la parte nueva, importante + ->groupBy('presupuesto_direcciones.id') + ->first(); + + // Validación si no hay datos o no quedan unidades + if (empty($datosEnvio)) { + return [ + 'status' => false, + 'message' => lang('Logistica.errors.noAddresses') + ]; + } + + // Crear envío + $EnvioModel = model('App\Models\Logistica\EnvioModel'); + $EnvioModel->set([ + 'cliente_id' => $datosEnvio->cliente_id, + 'att' => $datosEnvio->att, + 'direccion' => $datosEnvio->direccion, + 'ciudad' => $datosEnvio->ciudad, + 'cp' => $datosEnvio->cp, + 'telefono' => $datosEnvio->telefono, + 'email' => $datosEnvio->email, + 'pais_id' => $datosEnvio->pais_id, + 'cantidad' => 1, + 'cajas' => 1, + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + 'tipo_envio' => 'ferro_prototipo', + ]); + $EnvioModel->insert(); + $idEnvio = $EnvioModel->insertID(); + + // Crear línea de envío + $EnvioLineasModel = model('App\Models\Logistica\EnvioLineaModel'); + $EnvioLineasModel->save([ + 'envio_id' => $idEnvio, + 'pedido_id' => $datosEnvio->pedido_id, + 'unidades_envio' => 1, + 'unidades_total' => 1, + 'cajas' => 1, + 'unidades_cajas' => 1, + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + 'created_by' => auth()->user()->id, + 'updated_by' => auth()->user()->id, + 'presupuesto_id' => (int) $datosEnvio->presupuesto_id + ]); + + return [ + 'status' => true, + 'data' => [ + 'id_envio' => $idEnvio, + ], + ]; + } + + + public static function finalizarEnvio($envio_id, $finalizar_ot = false) { // hay que comprobar que para todas las lineas de envio de este envio @@ -383,24 +523,36 @@ class LogisticaService $cantidad_enviada = $cantidad_enviada[0]->unidades_enviadas; } - if ($cantidad_enviada + $linea->unidades_envio == $pedido->total_tirada) { + if ($envio->tipo_envio == 'ferro_prototipo') { $otModel = model('App\Models\OrdenTrabajo\OrdenTrabajoModel'); $ot = $otModel->where('pedido_id', $linea->pedido_id) ->first(); $ps = (new ProductionService())->init($ot->id); $ps->updateOrdenTrabajoDate([ - "name" => "envio_at", - "envio_at" => date('Y-m-d H:i:s') + "name" => "ferro_en_cliente_at", + "ferro_en_cliente_at" => date('Y-m-d H:i:s') ]); - if ($finalizar_ot) { - $ps->updateOrdenTrabajo( - [ - "estado" => 'F' - ] - ); - array_push($ots, $ot->id); + } else { + if ($cantidad_enviada + $linea->unidades_envio == $pedido->total_tirada) { + $otModel = model('App\Models\OrdenTrabajo\OrdenTrabajoModel'); + $ot = $otModel->where('pedido_id', $linea->pedido_id) + ->first(); + $ps = (new ProductionService())->init($ot->id); + $ps->updateOrdenTrabajoDate([ + "name" => "envio_at", + "envio_at" => date('Y-m-d H:i:s') + ]); + if ($finalizar_ot) { + $ps->updateOrdenTrabajo( + [ + "estado" => 'F' + ] + ); + array_push($ots, $ot->id); + } } } + } $EnvioModel->update($envio_id, ['finalizado' => 1]); @@ -424,19 +576,19 @@ class LogisticaService $data = [ "printer" => $printer->name, "header" => [ - "_FORMAT" => "E:PEDIDO.ZPL", - "_QUANTITY" => 1, - "_PRINBTERNAME" => $printer->name, - "_JOBNAME" => "LBL101" - ], + "_FORMAT" => "E:PEDIDO.ZPL", + "_QUANTITY" => 1, + "_PRINBTERNAME" => $printer->name, + "_JOBNAME" => "LBL101" + ], ]; foreach ($lineas as $linea) { $data["labels"][] = [ "cliente" => $envio->cliente, - "titulo" => "[" . $linea->pedido_id . "] - " . $linea->titulo, + "titulo" => "[" . $linea->pedido_id . "] - " . $linea->titulo, "cantidad" => $linea->unidades_envio, - "tirada" => $linea->unidades_total, + "tirada" => $linea->unidades_total, "cajas" => $cajas, "ean" => null, "nombre" => $envio->att, @@ -449,15 +601,15 @@ class LogisticaService $servicioImpresora = new ImpresoraEtiquetaService(); $xml = $servicioImpresora->createEtiqueta($data); - if($xml == null){ + if ($xml == null) { return [ 'status' => false, 'message' => lang('Logistica.errors.noEtiquetas'), ]; } $sk_environment = getenv('SK_ENVIRONMENT'); - if($sk_environment == 'production'){ - + if ($sk_environment == 'production') { + $status = $servicioImpresora->sendToImpresoraEtiqueta("ETIQUETA", $xml, $printer); if ($status) { return [ @@ -472,7 +624,7 @@ class LogisticaService ]; } - }else{ + } else { return [ 'status' => true, 'message' => lang('Logistica.success.imprimirEtiquetas'), 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/logistica/viewEnvioEditForm.php b/ci4/app/Views/themes/vuexy/form/logistica/viewEnvioEditForm.php index 23229291..7c63bd17 100644 --- a/ci4/app/Views/themes/vuexy/form/logistica/viewEnvioEditForm.php +++ b/ci4/app/Views/themes/vuexy/form/logistica/viewEnvioEditForm.php @@ -10,6 +10,7 @@

+ tipo_envio == 'ferro_prototipo') ? 'FERRO':'' ?> finalizado == 0) ? '' : 'FINALIZADO' ?>

@@ -18,7 +19,6 @@ -
@@ -114,7 +114,7 @@
- finalizado == 0): ?> + finalizado == 0 && $envioEntity->tipo_envio=='estandar'): ?>

@@ -172,7 +172,7 @@

- finalizado == 0): ?> + finalizado == 0 && $envioEntity->tipo_envio=='estandar'): ?>
+ tipo_envio=='estandar'): ?>
+
diff --git a/ci4/app/Views/themes/vuexy/form/logistica/viewEnvioForm.php b/ci4/app/Views/themes/vuexy/form/logistica/viewEnvioForm.php deleted file mode 100644 index 75b3bbc6..00000000 --- a/ci4/app/Views/themes/vuexy/form/logistica/viewEnvioForm.php +++ /dev/null @@ -1,97 +0,0 @@ -include("themes/_commonPartialsBs/sweetalert") ?> -include('themes/_commonPartialsBs/datatables') ?> -extend('themes/vuexy/main/defaultlayout') ?> - -section('content'); ?> -
-
-
-
-

-
-
- - - -
-

- -

- -
-
- -
- -
- - -
- -
-
-
-
- - -
-

- -

- -
-
- -
- - - - - - - - - - - - - - - - - - - -
- - -
-
-
-
- -
- -
-
- -
-
-
-endSection() ?> - - -section('css') ?> - -endSection() ?> - -section('additionalExternalJs') ?> - - -endSection() ?> \ No newline at end of file diff --git a/ci4/app/Views/themes/vuexy/form/logistica/viewLogisticaSelectEnvios.php b/ci4/app/Views/themes/vuexy/form/logistica/viewLogisticaSelectEnvios.php index cea9b37b..5cad908a 100644 --- a/ci4/app/Views/themes/vuexy/form/logistica/viewLogisticaSelectEnvios.php +++ b/ci4/app/Views/themes/vuexy/form/logistica/viewLogisticaSelectEnvios.php @@ -12,6 +12,8 @@
+ +
diff --git a/ci4/app/Views/themes/vuexy/form/logistica/viewPanelLogistica.php b/ci4/app/Views/themes/vuexy/form/logistica/viewPanelLogistica.php index d716dbe5..150044b0 100755 --- a/ci4/app/Views/themes/vuexy/form/logistica/viewPanelLogistica.php +++ b/ci4/app/Views/themes/vuexy/form/logistica/viewPanelLogistica.php @@ -17,7 +17,7 @@ " alt="Envíos">
-
+
" alt="Envío de Ferros/Prototipos">
diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosEnvios.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosEnvios.php index 982bf06f..891f10aa 100755 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosEnvios.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_datosEnvios.php @@ -39,6 +39,7 @@ Pallets? + Ferro o Prototipo? @@ -60,6 +61,7 @@
+ diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_presupuestoDireccionesForm.php b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_presupuestoDireccionesForm.php index 18e014fd..c87a07a5 100755 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_presupuestoDireccionesForm.php +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/admin/_presupuestoDireccionesForm.php @@ -8,6 +8,15 @@
+
"> + + +
+

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

+
+
"> + +
+ > + +
+
" ?>
+ +
+ +
"> + +
+ > + +
+
" ?>
+
+ +
"> + +
+ > + +
+
" ?>
+ +
+
@@ -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 @@