mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
fix encuadernacion pliegos ot pdf and tareas maquinas primera
This commit is contained in:
@ -28,8 +28,8 @@ use Dompdf\Dompdf;
|
|||||||
*/
|
*/
|
||||||
class ProductionService extends BaseService
|
class ProductionService extends BaseService
|
||||||
{
|
{
|
||||||
public array $TIPOS_PLANA = ['lp_bn','lp_color','lp_colorhq'];
|
public array $TIPOS_PLANA = ['lp_bn', 'lp_color', 'lp_colorhq'];
|
||||||
public array $TIPOS_ROTATIVA = ['lp_rot_bn','lp_rot_color'];
|
public array $TIPOS_ROTATIVA = ['lp_rot_bn', 'lp_rot_color'];
|
||||||
|
|
||||||
protected OrdenTrabajoModel $otModel;
|
protected OrdenTrabajoModel $otModel;
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ class ProductionService extends BaseService
|
|||||||
$this->ot = $this->otModel->find($orden_trabajo_id);
|
$this->ot = $this->otModel->find($orden_trabajo_id);
|
||||||
$pedido = $this->ot->pedido();
|
$pedido = $this->ot->pedido();
|
||||||
$this->setPedido($pedido);
|
$this->setPedido($pedido);
|
||||||
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre',$this->defaultMaquinaCorteName)->first();
|
$this->defaultMaquinaCorte = $this->maquinaModel->where('nombre', $this->defaultMaquinaCorteName)->first();
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -162,7 +162,7 @@ class ProductionService extends BaseService
|
|||||||
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
|
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
|
||||||
];
|
];
|
||||||
$otDateId = $this->otDate->insert($data);
|
$otDateId = $this->otDate->insert($data);
|
||||||
$this->otDate->updateUserDateMap($this->ot->id,$data);
|
$this->otDate->updateUserDateMap($this->ot->id, $data);
|
||||||
return $otDateId;
|
return $otDateId;
|
||||||
}
|
}
|
||||||
protected function storeOrdenTrabajoUsers(): int|bool|string
|
protected function storeOrdenTrabajoUsers(): int|bool|string
|
||||||
@ -219,7 +219,7 @@ class ProductionService extends BaseService
|
|||||||
protected function storeTareaCorte(PresupuestoLineaEntity $pLinea): ?OrdenTrabajoTareaEntity
|
protected function storeTareaCorte(PresupuestoLineaEntity $pLinea): ?OrdenTrabajoTareaEntity
|
||||||
{
|
{
|
||||||
$otCorte = null;
|
$otCorte = null;
|
||||||
if($pLinea->isRotativa()){
|
if ($pLinea->isRotativa()) {
|
||||||
$tareaId = $this->otTarea->insert([
|
$tareaId = $this->otTarea->insert([
|
||||||
'orden_trabajo_id' => $this->ot->id,
|
'orden_trabajo_id' => $this->ot->id,
|
||||||
'presupuesto_linea_id' => $pLinea->id,
|
'presupuesto_linea_id' => $pLinea->id,
|
||||||
@ -241,16 +241,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
foreach ($p_linea_maquinas as $key => $linea) {
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_acabado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_acabado_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 0;
|
||||||
$ot_tareas["maquina_id"] = $linea->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_acabado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_acabado_id"] = $p_linea->id;
|
||||||
@ -267,16 +266,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
foreach ($p_linea_maquinas as $key => $linea) {
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_manipulado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_manipulado_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 0;
|
||||||
$ot_tareas["maquina_id"] = $linea->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_manipulado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_manipulado_id"] = $p_linea->id;
|
||||||
@ -293,16 +291,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
foreach ($p_linea_maquinas as $key => $linea) {
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 0;
|
||||||
$ot_tareas["maquina_id"] = $linea->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
||||||
@ -319,16 +316,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
foreach ($p_linea_maquinas as $key => $linea) {
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning ?? 0;
|
||||||
$ot_tareas["maquina_id"] = $linea->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
||||||
@ -345,16 +341,15 @@ class ProductionService extends BaseService
|
|||||||
$p_linea_maquinas = $p_linea->maquinas();
|
$p_linea_maquinas = $p_linea->maquinas();
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
if (count($p_linea_maquinas) > 0) {
|
if (count($p_linea_maquinas) > 0) {
|
||||||
foreach ($p_linea_maquinas as $key => $linea) {
|
$linea_maquina = $p_linea_maquinas[0]; //Se obtiene la primera máquina aunque tenga varias
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
||||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||||
$ot_tareas["orden"] = $linea->orden_planning;
|
$ot_tareas["orden"] = $linea_maquina->orden_planning;
|
||||||
$ot_tareas["maquina_id"] = $linea->id;
|
$ot_tareas["maquina_id"] = $linea_maquina->id;
|
||||||
$ot_tareas["imposicion_id"] = null;
|
$ot_tareas["imposicion_id"] = null;
|
||||||
$this->otTarea->insert($ot_tareas);
|
$this->otTarea->insert($ot_tareas);
|
||||||
$ot_tareas = [];
|
$ot_tareas = [];
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||||
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
||||||
@ -459,12 +454,12 @@ class ProductionService extends BaseService
|
|||||||
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
|
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
|
||||||
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo", $this->TIPOS_ROTATIVA)
|
->whereIn("presupuesto_linea.tipo", $this->TIPOS_ROTATIVA)
|
||||||
->where('lg_maquinas.is_rotativa',true)
|
->where('lg_maquinas.is_rotativa', true)
|
||||||
->where("orden_trabajo_tareas.deleted_at", null)
|
->where("orden_trabajo_tareas.deleted_at", null)
|
||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
return $q;
|
return $q;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Query para mostrar en datatable
|
* Query para mostrar en datatable
|
||||||
*
|
*
|
||||||
* @return BaseBuilder
|
* @return BaseBuilder
|
||||||
@ -500,7 +495,7 @@ class ProductionService extends BaseService
|
|||||||
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
|
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
|
||||||
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||||
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
|
->whereIn("presupuesto_linea.tipo", $this->TIPOS_PLANA)
|
||||||
->where('lg_maquinas.is_rotativa',false)
|
->where('lg_maquinas.is_rotativa', false)
|
||||||
->where("orden_trabajo_tareas.deleted_at", null)
|
->where("orden_trabajo_tareas.deleted_at", null)
|
||||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||||
return $q;
|
return $q;
|
||||||
@ -725,16 +720,16 @@ class ProductionService extends BaseService
|
|||||||
$otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id)
|
$otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id)
|
||||||
->set([$data['name'] => $data[$data['name']]])
|
->set([$data['name'] => $data[$data['name']]])
|
||||||
->update($data);
|
->update($data);
|
||||||
$this->otDate->updateUserDateMap($this->ot->id,$data);
|
$this->otDate->updateUserDateMap($this->ot->id, $data);
|
||||||
$ot_users = $this->ot->users();
|
$ot_users = $this->ot->users();
|
||||||
if(isset($this->MAPPING_DATE_USER[$data["name"]])){
|
if (isset($this->MAPPING_DATE_USER[$data["name"]])) {
|
||||||
$user_id = $ot_users->{$this->MAPPING_DATE_USER[$data["name"]]};
|
$user_id = $ot_users->{$this->MAPPING_DATE_USER[$data["name"]]};
|
||||||
$user = $this->userModel->find($user_id);
|
$user = $this->userModel->find($user_id);
|
||||||
if($user_id){
|
if ($user_id) {
|
||||||
$result = ["user" => null, "status" => false];
|
$result = ["user" => null, "status" => false];
|
||||||
}
|
}
|
||||||
$result = ["user" => $user, "status" => $otDate];
|
$result = ["user" => $user, "status" => $otDate];
|
||||||
}else{
|
} else {
|
||||||
$result = ["user" => null, "status" => false];
|
$result = ["user" => null, "status" => false];
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@ -288,7 +288,7 @@ $settings = $session->get('settings');
|
|||||||
<th class="t-header" style="width: 10%;">Máquina</th>
|
<th class="t-header" style="width: 10%;">Máquina</th>
|
||||||
<td class="t-cell"><?= implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> </td>
|
<td class="t-cell"><?= implode("/", array_map(fn($q) => $q->nombre, $acabados[0]->maquinas())) ?> </td>
|
||||||
<th class="t-header" style="width: 10%;">Operario</th>
|
<th class="t-header" style="width: 10%;">Operario</th>
|
||||||
<td class="t-cell"><?= $ot->users()->plastificado_by->getFullName() ?> </td>
|
<td class="t-cell"><?= $ot->users()->plastificado_by?->getFullName() ?? null ?> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
@ -307,7 +307,7 @@ $settings = $session->get('settings');
|
|||||||
<td><?= $value->tarifa()->nombre ?></td>
|
<td><?= $value->tarifa()->nombre ?></td>
|
||||||
<td><?= $presupuesto->solapas ? "SI" : "NO" ?></td>
|
<td><?= $presupuesto->solapas ? "SI" : "NO" ?></td>
|
||||||
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
|
<td><?= $presupuesto->hasSobrecubierta() ? "SI" : "NO" ?></td>
|
||||||
<td> ______ pliegos de ______ </td>
|
<td> <?= $linea_impresion->pliegos_libro?>/<?=$linea_impresion->pliegos_pedido?> </td>
|
||||||
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
|
<td><?= $presupuesto->guardas ? "SI" : "NO" ?></td>
|
||||||
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
|
<td><?= $presupuesto->retractilado ? "SI" : "NO" ?></td>
|
||||||
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
|
<td><?= $presupuesto->marcapaginas ? "SI" : "NO" ?></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user