mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
cambios
This commit is contained in:
@ -809,6 +809,7 @@ $routes->group('logistica', ['namespace' => 'App\Controllers\Logistica'], functi
|
||||
$routes->post('generateEnvio', 'LogisticaController::generarEnvio');
|
||||
$routes->get('selectPedidosForEnvio', 'LogisticaController::findPedidosNewEnvio');
|
||||
$routes->get('selectDireccionForEnvio', 'LogisticaController::selectDireccionForEnvio');
|
||||
$routes->post('imprimirEtiquetas', 'LogisticaController::imprimirEtiquetas');
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@ -137,6 +137,21 @@ class LogisticaController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function imprimirEtiquetas()
|
||||
{
|
||||
if ($this->request->isAJAX()) {
|
||||
$envio_id = $this->request->getPost('envio_id');
|
||||
$ids = $this->request->getPost('envio_lineas');
|
||||
$cajas = $this->request->getPost('cajas');
|
||||
|
||||
$result = ['status' => true];//LogisticaService::imprimirEtiquetas($ids);
|
||||
return $this->response->setJSON($result);
|
||||
|
||||
} else {
|
||||
return $this->failUnauthorized('Invalid request', 403);
|
||||
}
|
||||
}
|
||||
|
||||
public function selectAddEnvioLinea()
|
||||
{
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user