mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en la lista de envios proximos
This commit is contained in:
@ -57,7 +57,8 @@ class LogisticaService
|
||||
->join('orden_trabajo_dates ot_dates', 'ot_dates.orden_trabajo_id = ot.id')
|
||||
->whereIn('pr.id', $presupuestoIds)
|
||||
->whereIn('p.estado', ['finalizado', 'produccion'])
|
||||
->where('ot_dates.embalaje_at IS NOT NULL')
|
||||
->where('p.fecha_encuadernado IS NOT NULL')
|
||||
->where('DATE(p.fecha_encuadernado) <=', date('Y-m-d'))
|
||||
->where("NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM envios_lineas el
|
||||
@ -103,16 +104,15 @@ class LogisticaService
|
||||
->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.embalaje_at IS NOT NULL')
|
||||
->where('p.fecha_encuadernado IS NOT NULL')
|
||||
->where('DATE(p.fecha_encuadernado) <=', date('Y-m-d'))
|
||||
->groupBy('pl.id');
|
||||
|
||||
// 4. Envolver y filtrar por unidades pendientes
|
||||
$builder = $db->table("({$subBuilder->getCompiledSelect(false)}) AS sub");
|
||||
$builder->select('id, name');
|
||||
$builder->where('cantidad > unidades_enviadas');
|
||||
$builder->orderBy('name', 'ASC');
|
||||
|
||||
return $builder;
|
||||
}
|
||||
@ -539,6 +539,13 @@ class LogisticaService
|
||||
$ot = $otModel->where('pedido_id', $linea->pedido_id)
|
||||
->first();
|
||||
$ps = (new ProductionService())->init($ot->id);
|
||||
$date = $ps->getOrdenTrabajo()->dates()->embalaje_at;
|
||||
if (is_null($date) || empty($date)) {
|
||||
$ps->updateOrdenTrabajoDate([
|
||||
"name" => "embalaje_at",
|
||||
"embalaje_at" => date('Y-m-d H:i:s')
|
||||
]);
|
||||
}
|
||||
$ps->updateOrdenTrabajoDate([
|
||||
"name" => "envio_at",
|
||||
"envio_at" => date('Y-m-d H:i:s')
|
||||
@ -572,6 +579,29 @@ class LogisticaService
|
||||
return $data_return;
|
||||
}
|
||||
|
||||
public static function ficharEmbalaje($ids = null)
|
||||
{
|
||||
|
||||
if (is_null($ids) || empty($ids) || count($ids) == 0) {
|
||||
return [
|
||||
'status' => false,
|
||||
'message' => lang('Logistica.errors.noLineas'),
|
||||
];
|
||||
}
|
||||
|
||||
for ($index = 0; $index < count($ids); $index++) {
|
||||
$ps = (new ProductionService())->init($ids[$index]);
|
||||
$ps->updateOrdenTrabajoDate([
|
||||
"name" => "embalaje_at",
|
||||
"embalaje_at" => date('Y-m-d')
|
||||
]);
|
||||
}
|
||||
return [
|
||||
'status' => true,
|
||||
'message' => lang('Logistica.success.successFicharEmbalaje'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function generateEtiquetasTitulos($envio, $lineas, $printer, $cajas)
|
||||
{
|
||||
$data = [
|
||||
|
||||
Reference in New Issue
Block a user