This commit is contained in:
2025-04-25 17:50:30 +02:00
parent 86dafb1133
commit 151e4a2d7a
4 changed files with 181 additions and 0 deletions

View File

@ -436,6 +436,62 @@ class LogisticaService
];
}
public static function imprimirEtiquetas($envio_id, $ids)
{
$array = [
"printer" => "LABPRINT-1",
"header" => [
"_FORMAT" => "E:PEDIDO.ZPL",
"_QUANTITY" => 1,
"_PRINBTERNAME" => "Printer 1",
"_JOBNAME" => "LBL101"
],
"labels" => [
/* Ejemplo etiqueta
[
"cliente" => "Cliente Potencial",
"titulo" => "[1234] TEST OLIVEROS",
"cantidad" => 100,
"tirada" => 50,
"cajas" => 1,
"ean" => null,
"nombre" => "___Nombre___",
"direccion" => "C/ test n10, Madrid, 12345, España",
"notas" => "Nota....",
"refcliente" => "Refclient:1234",
"npedido" => "1234"
]
*/
]
];
$EnvioModel = model('App\Models\Logistica\EnvioModel');
$EnvioLineasModel = model('App\Models\Logistica\EnvioLineaModel');
$envios = $EnvioModel->whereIn('id', $ids)->findAll();
if (empty($envios)) {
return [
'status' => false,
'message' => lang('Logistica.errors.noEnvio'),
];
}
foreach ($envios as $envio) {
$lineasEnvio = $EnvioLineasModel->where('envio_id', $envio->id)->findAll();
if (empty($lineasEnvio)) {
return [
'status' => false,
'message' => lang('Logistica.errors.noEnvioLineas'),
];
}
}
return [
'status' => true,
'data' => $envios,
];
}
public static function finalizarEnvio($envio_id, $finalizar_ot = false)