diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 6c9baeb3..97078d23 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -760,6 +760,7 @@ $routes->group('produccion', ['namespace' => 'App\Controllers\Produccion'], func *========================**/ $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"]); /**====================== * PDF *========================**/ diff --git a/ci4/app/Controllers/Produccion/Ordentrabajo.php b/ci4/app/Controllers/Produccion/Ordentrabajo.php index 6165a89d..31ff93fc 100755 --- a/ci4/app/Controllers/Produccion/Ordentrabajo.php +++ b/ci4/app/Controllers/Produccion/Ordentrabajo.php @@ -443,6 +443,15 @@ class Ordentrabajo extends BaseController $color = $this->produccionService->init($orden_trabajo_id)->getOtColorStatus(); return $this->response->setJSON(["color" => $color]); } + public function imprimir_codigo_safekat(int $orden_trabajo_id) + { + helper('file'); + $barcode = $this->produccionService->init($orden_trabajo_id)->getFileBarCode(); + return $this->response + ->setHeader('Content-Type', 'image/png') + ->setHeader('Content-Disposition', "attachment; filename=CodigoBarrasOT_{$orden_trabajo_id}.png") + ->setBody($barcode); + } public function maquinista_maquinas_view(){} public function maquinista_colas_view(){} diff --git a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php index 743bb5c4..55bcfc5b 100644 --- a/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php +++ b/ci4/app/Entities/Produccion/OrdenTrabajoEntity.php @@ -121,6 +121,14 @@ class OrdenTrabajoEntity extends Entity $barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id); return base64_encode($renderer->render($barcodeData, 200, 50)); } + public function getBarCodeFile() + { + $barcode = new TypeCode128(); + $renderer = new PngRenderer(); + $renderer->setBackgroundColor([255, 255, 255]); // Give a color blue for the background, default is transparent. Give it as 3 times 0-255 values for red, green and blue. + $barcodeData = $barcode->getBarcode($this->pedido()->presupuesto()->id); + return ($renderer->render($barcodeData, 200, 50)); + } public function files(): array { $m = model(OrdenTrabajoFileModel::class); diff --git a/ci4/app/Services/ProductionService.php b/ci4/app/Services/ProductionService.php index e90f025c..a82464e9 100644 --- a/ci4/app/Services/ProductionService.php +++ b/ci4/app/Services/ProductionService.php @@ -1617,4 +1617,7 @@ class ProductionService extends BaseService } return $this->isCorte; } + public function getFileBarCode(){ + return $this->ot->getBarCodeFile(); + } } diff --git a/ci4/app/Views/themes/vuexy/form/produccion/ot/otHeader.php b/ci4/app/Views/themes/vuexy/form/produccion/ot/otHeader.php index a3f1019d..2777d260 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/ot/otHeader.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/ot/otHeader.php @@ -19,10 +19,16 @@

;">OT : id ?>

;"> -

;">progreso ?> %

Progreso +

;">progreso ?> %

+
+
+ Código safekat +
+ barcode +
@@ -39,6 +45,9 @@ "> PDF + + +
diff --git a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php index c44f29dc..20ec1304 100644 --- a/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php +++ b/ci4/app/Views/themes/vuexy/form/produccion/viewOrdenTrabajoEdit.php @@ -33,9 +33,6 @@
-
- -
@@ -45,8 +42,10 @@ "> - - + prototipo): ?> + + +