mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ordenes trabajo
This commit is contained in:
@ -10,10 +10,14 @@ use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoDate;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoTarea;
|
||||
use App\Models\OrdenTrabajo\OrdenTrabajoUser;
|
||||
use App\Models\Usuarios\UserModel;
|
||||
use CodeIgniter\Config\BaseService;
|
||||
use CodeIgniter\Database\BaseBuilder;
|
||||
use CodeIgniter\Database\BaseResult;
|
||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||
use CodeIgniter\I18n\Time;
|
||||
use Dompdf\Dompdf;
|
||||
|
||||
/**
|
||||
* Clase con las funcionalidades necesarias trabajar con las ordenes de trabajo.
|
||||
@ -23,7 +27,25 @@ class ProductionService extends BaseService
|
||||
protected OrdenTrabajoModel $otModel;
|
||||
protected OrdenTrabajoTarea $otTarea;
|
||||
protected OrdenTrabajoDate $otDate;
|
||||
protected OrdenTrabajoUser $otUser;
|
||||
protected OrdenTrabajoEntity $ot;
|
||||
protected UserModel $userModel;
|
||||
protected array $MAPPING_DATE_USER = [
|
||||
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
||||
// "fecha_externo_at" => "null",
|
||||
"fecha_impresion_at" => "null",
|
||||
"pendiente_ferro_at" => "pendiente_ferro_user_id",
|
||||
"ferro_en_cliente_at" => "ferro_en_cliente_user_id",
|
||||
"ferro_ok_at" => "ferro_ok_user_id",
|
||||
"interior_bn_at" => "interior_bn_user_id",
|
||||
"interior_color_at" => "interior_color_user_id",
|
||||
"preparacion_interiores_at" => "preparacion_interior_user_id",
|
||||
"cubierta_at" => "cubierta_user_id",
|
||||
"plastificado_at" => "plastificado_user_id",
|
||||
"corte_at" => "corte_user_id",
|
||||
"embalaje_at" => "embalaje_user_id",
|
||||
"entrada_manipulado_at" => "entrada_manipulado_user_id"
|
||||
];
|
||||
|
||||
/**
|
||||
* Pedido Entity
|
||||
@ -38,6 +60,14 @@ class ProductionService extends BaseService
|
||||
*/
|
||||
protected PresupuestoEntity $presupuesto;
|
||||
|
||||
public function __construct() {
|
||||
$this->otModel = model(OrdenTrabajoModel::class);
|
||||
$this->otDate = model(OrdenTrabajoDate::class);
|
||||
$this->otTarea = model(OrdenTrabajoTarea::class);
|
||||
$this->otUser = model(OrdenTrabajoUser::class);
|
||||
$this->userModel = model(UserModel::class);
|
||||
|
||||
}
|
||||
public function init(int $orden_trabajo_id): self
|
||||
{
|
||||
$this->otModel = model(OrdenTrabajoModel::class);
|
||||
@ -97,9 +127,10 @@ class ProductionService extends BaseService
|
||||
$ot_id = $this->otModel->getInsertID();
|
||||
$ot->id = $ot_id;
|
||||
$this->init($ot_id);
|
||||
$this->storeOrdenTrabajoDates($ot);
|
||||
$this->storeOrdenTrabajoUsers();
|
||||
$this->storeOrdenTrabajoDates();
|
||||
$this->storeAllTareas();
|
||||
return $ot;
|
||||
return $this->ot;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,16 +139,26 @@ class ProductionService extends BaseService
|
||||
* @param OrdenTrabajoEntity $ot
|
||||
* @return integer|boolean|string ID
|
||||
*/
|
||||
protected function storeOrdenTrabajoDates(OrdenTrabajoEntity $ot): bool|int|string
|
||||
protected function storeOrdenTrabajoDates() : int|bool|string
|
||||
{
|
||||
$fecha_encuadernado = Time::now()->addDays(2)->format("Y-m-d");
|
||||
$fecha_entrega_real = Time::now()->addDays(5)->format("Y-m-d");
|
||||
$fecha_embalaje_at = Time::now()->addDays(4)->format("Y-m-d");
|
||||
return $this->otDate->insert([
|
||||
"orden_trabajo_id" => $ot->id,
|
||||
"fecha_encuadernado_at" => $this->pedido->fecha_encuadernado,
|
||||
"fecha_entrega_real_at" => $this->pedido->fecha_entrega_real,
|
||||
"fecha_impresion_at" => $this->pedido->fecha_impresion,
|
||||
"orden_trabajo_id" => $this->ot->id,
|
||||
"fecha_encuadernado_at" => $fecha_encuadernado,
|
||||
"fecha_entrega_real_at" => $fecha_entrega_real,
|
||||
"fecha_impresion_at" => Time::now()->format("Y-m-d"),
|
||||
"embalaje_at" => $fecha_embalaje_at,
|
||||
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
|
||||
]);
|
||||
}
|
||||
protected function storeOrdenTrabajoUsers() : int|bool|string
|
||||
{
|
||||
return $this->otUser->insert([
|
||||
"orden_trabajo_id" => $this->ot->id,
|
||||
]);
|
||||
}
|
||||
protected function storeAllTareas()
|
||||
{
|
||||
$this->storeOrdenTrabajoTareas();
|
||||
@ -148,12 +189,11 @@ class ProductionService extends BaseService
|
||||
|
||||
foreach ($p_lineas as $key => $p_linea) {
|
||||
$p_linea_maquina = $p_linea->maquina();
|
||||
$nombre = $p_linea->get_nombre_tarea();
|
||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||
$ot_tareas["presupuesto_linea_id"] = $p_linea->id;
|
||||
//TODO : Por ahora nombre maquina, asignar nombre tarea en
|
||||
//TODO : base a la tarifa asociada a la linea de presupuesto
|
||||
$ot_tareas["nombre"] = $p_linea_maquina->nombre;
|
||||
$ot_tareas["orden"] = $p_linea_maquina->orden_planning;
|
||||
$ot_tareas["nombre"] = $nombre;
|
||||
$ot_tareas["orden"] = $p_linea_maquina->orden_planning ?? 0;
|
||||
$ot_tareas["maquina_id"] = $p_linea_maquina->id;
|
||||
$ot_tareas["imposicion_id"] = null;
|
||||
$ot_tareas["tiempo_estimado"] = $p_linea->horas_maquina;
|
||||
@ -173,8 +213,8 @@ class ProductionService extends BaseService
|
||||
foreach ($p_linea_maquinas as $key => $linea) {
|
||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||
$ot_tareas["presupuesto_acabado_id"] = $p_linea->id;
|
||||
$ot_tareas["nombre"] = $linea->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning;
|
||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
||||
$ot_tareas["maquina_id"] = $linea->id;
|
||||
$ot_tareas["imposicion_id"] = null;
|
||||
$this->otTarea->insert($ot_tareas);
|
||||
@ -199,8 +239,8 @@ class ProductionService extends BaseService
|
||||
foreach ($p_linea_maquinas as $key => $linea) {
|
||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||
$ot_tareas["presupuesto_manipulado_id"] = $p_linea->id;
|
||||
$ot_tareas["nombre"] = $linea->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning;
|
||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
||||
$ot_tareas["maquina_id"] = $linea->id;
|
||||
$ot_tareas["imposicion_id"] = null;
|
||||
$this->otTarea->insert($ot_tareas);
|
||||
@ -225,8 +265,8 @@ class ProductionService extends BaseService
|
||||
foreach ($p_linea_maquinas as $key => $linea) {
|
||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||
$ot_tareas["presupuesto_preimpresion_id"] = $p_linea->id;
|
||||
$ot_tareas["nombre"] = $linea->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning;
|
||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
||||
$ot_tareas["maquina_id"] = $linea->id;
|
||||
$ot_tareas["imposicion_id"] = null;
|
||||
$this->otTarea->insert($ot_tareas);
|
||||
@ -251,8 +291,8 @@ class ProductionService extends BaseService
|
||||
foreach ($p_linea_maquinas as $key => $linea) {
|
||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||
$ot_tareas["presupuesto_encuadernado_id"] = $p_linea->id;
|
||||
$ot_tareas["nombre"] = $linea->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning;
|
||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning ?? 0;
|
||||
$ot_tareas["maquina_id"] = $linea->id;
|
||||
$ot_tareas["imposicion_id"] = null;
|
||||
$this->otTarea->insert($ot_tareas);
|
||||
@ -277,7 +317,7 @@ class ProductionService extends BaseService
|
||||
foreach ($p_linea_maquinas as $key => $linea) {
|
||||
$ot_tareas["orden_trabajo_id"] = $this->ot->id;
|
||||
$ot_tareas["presupuesto_extra_id"] = $p_linea->id;
|
||||
$ot_tareas["nombre"] = $linea->nombre;
|
||||
$ot_tareas["nombre"] = $p_linea->tarifa()->nombre;
|
||||
$ot_tareas["orden"] = $linea->orden_planning;
|
||||
$ot_tareas["maquina_id"] = $linea->id;
|
||||
$ot_tareas["imposicion_id"] = null;
|
||||
@ -313,12 +353,90 @@ class ProductionService extends BaseService
|
||||
return ["tareas" => $tareas];
|
||||
}
|
||||
|
||||
public function getPdf()
|
||||
{
|
||||
return view("themes/vuexy/pdfs/orden_trabajo",$this->getDataPdf());
|
||||
}
|
||||
/**
|
||||
* Query para mostrar en datatable
|
||||
*
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function taskDatatableQuery(): BaseBuilder
|
||||
{
|
||||
$q = $this->otModel->builder()->select([
|
||||
"orden_trabajo_tareas.id",
|
||||
"orden_trabajo_tareas.orden",
|
||||
"orden_trabajo_tareas.nombre",
|
||||
"lgmp.nombre as maquina_presupuesto_linea",
|
||||
"orden_trabajo_tareas.maquina_id as maquina_tarea",
|
||||
"lg_maquinas.nombre as maquina_nombre",
|
||||
"lg_imposiciones.id as imposicion_id",
|
||||
"orden_trabajo_tareas.tiempo_estimado",
|
||||
"orden_trabajo_tareas.tiempo_real",
|
||||
"orden_trabajo_tareas.comment",
|
||||
|
||||
])
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||
->join("presupuesto_acabados", "presupuesto_acabados.id = orden_trabajo_tareas.presupuesto_acabado_id", "left")
|
||||
->join("presupuesto_manipulados", "presupuesto_manipulados.id = orden_trabajo_tareas.presupuesto_manipulado_id", "left")
|
||||
->join("presupuesto_preimpresiones", "presupuesto_preimpresiones.id = orden_trabajo_tareas.presupuesto_preimpresion_id", "left")
|
||||
->join("presupuesto_encuadernaciones", "presupuesto_encuadernaciones.id = orden_trabajo_tareas.presupuesto_encuadernado_id", "left")
|
||||
->join("presupuesto_serviciosExtra", "presupuesto_serviciosExtra.id = orden_trabajo_tareas.presupuesto_extra_id", "left")
|
||||
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
|
||||
->join("lg_maquinas as lgmp", "lgmp.id = presupuesto_linea.maquina_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.deleted_at", null)
|
||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Query para mostrar en datatable
|
||||
*
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function planningRotativaQueryDatatable(): BaseBuilder
|
||||
{
|
||||
$q = $this->otModel->builder()->select([
|
||||
"ordenes_trabajo.id as otId",
|
||||
"orden_trabajo_dates.fecha_entrega_real_at",
|
||||
"presupuestos.titulo as presupuesto_titulo",
|
||||
"orden_trabajo_tareas.maquina_id",
|
||||
"lg_maquinas.nombre as maquina_planning_nombre",
|
||||
"ordenes_trabajo.total_tirada as ot_tirada",
|
||||
"lg_papel_formato.ancho as maquina_ancho",
|
||||
"lg_papel_formato.alto as maquina_alto",
|
||||
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') as maquina_ancho",
|
||||
// "JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') as maquina_alto",
|
||||
"lg_papel_impresion.nombre as papel_impresion",
|
||||
"presupuesto_linea.gramaje as papel_gramaje",
|
||||
|
||||
|
||||
|
||||
])
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("orden_trabajo_dates", "orden_trabajo_dates.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||
->join("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right")
|
||||
->join("lg_papel_formato", "lg_papel_formato.id = presupuestos.papel_formato_id", "left")
|
||||
->join("lg_maquinas", "lg_maquinas.id = orden_trabajo_tareas.maquina_id", "left")
|
||||
->join("lg_papel_impresion", "lg_papel_impresion.id = presupuesto_linea.papel_impresion_id", "left")
|
||||
->join("lg_maquinas as lgmp", "lgmp.id = presupuesto_linea.maquina_id", "left")
|
||||
->join("lg_imposiciones", "lg_imposiciones.id = orden_trabajo_tareas.imposicion_id", "left")
|
||||
// ->where("orden_trabajo_tareas.orden_trabajo_id", $this->ot->id)
|
||||
->whereIn("presupuesto_linea.tipo", ["lp_rot_bn","lp_rot_color"])
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Query para mostrar en datatable
|
||||
*
|
||||
* @return BaseBuilder
|
||||
*/
|
||||
public function costDatatableQuery(): BaseBuilder
|
||||
{
|
||||
$q = $this->otModel->builder()->select([
|
||||
"orden_trabajo_tareas.id",
|
||||
@ -343,10 +461,28 @@ class ProductionService extends BaseService
|
||||
->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.deleted_at", null)
|
||||
->orderBy("orden_trabajo_tareas.orden", "DESC");
|
||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||
return $q;
|
||||
}
|
||||
public function papelGramajeDatatableQuery() : BaseBuilder
|
||||
{
|
||||
$q = $this->otModel->builder()->select([
|
||||
"lg_papel_impresion.nombre as papelImpresionNombre",
|
||||
"lg_papel_impresion.gramaje as papelImpresionGramaje",
|
||||
"COUNT(orden_trabajo_tareas.id) as tareasCount",
|
||||
"SUM(ordenes_trabajo.total_tirada) as totalTirada",
|
||||
"SUM(orden_trabajo_tareas.tiempo_real) as tiempoReal"
|
||||
])
|
||||
->join("orden_trabajo_tareas", "orden_trabajo_tareas.orden_trabajo_id = ordenes_trabajo.id", "left")
|
||||
->join("presupuesto_linea", "presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id", "left")
|
||||
->join("lg_papel_impresion","presupuesto_linea.papel_impresion_id = lg_papel_impresion.id","left")
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL,FALSE);
|
||||
|
||||
|
||||
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
* Get a summary from ot with the following structure
|
||||
*
|
||||
@ -364,17 +500,128 @@ class ProductionService extends BaseService
|
||||
|
||||
$summary = [
|
||||
"ot" => $this->ot,
|
||||
"pedido" => $this->pedido,
|
||||
"presupuesto" => $this->presupuesto,
|
||||
"dates" => $this->ot->dates(),
|
||||
"tasks" => $this->ot->tareas(),
|
||||
"acabados" => $this->presupuesto->acabados(),
|
||||
"preimpresiones" => $this->presupuesto->preimpresiones(),
|
||||
"manipulados" => $this->presupuesto->manipulados(),
|
||||
"encuadernaciones" => $this->presupuesto->encuadernaciones(),
|
||||
|
||||
"impresion_interior_bn" => $this->getTareaImpresionInteriorBn(),
|
||||
"impresion_interior_color" => $this->getTareaImpresionInteriorColor(),
|
||||
"tareas_acabado" => $this->tareas_acabado(),
|
||||
"tareas_manipulado" => $this->tareas_manipulado(),
|
||||
"tareas_encuadernacion" => $this->tareas_encuadernacion(),
|
||||
"tareas_preimpresion" => $this->tareas_preimpresion(),
|
||||
"tareas_impresion" => $this->tareas_impresion(),
|
||||
];
|
||||
return $summary;
|
||||
}
|
||||
public function getDataPdf(){
|
||||
$logistica_data = $this->logistica_data();
|
||||
return [
|
||||
"ot" => $this->ot,
|
||||
"pedido" => $this->pedido,
|
||||
"presupuesto" => $this->presupuesto,
|
||||
"cliente" => $this->presupuesto->cliente(),
|
||||
"ubicacion" => $this->pedido->ubicacion()->nombre,
|
||||
"dates" => $this->ot->dates(),
|
||||
"tasks" => $this->ot->tareas(),
|
||||
"papel_formato" => $this->presupuesto->papel_formato(),
|
||||
"acabados" => $this->presupuesto->acabados(),
|
||||
"preimpresiones" => $this->presupuesto->preimpresiones(),
|
||||
"manipulados" => $this->presupuesto->manipulados(),
|
||||
"encuadernaciones" => $this->presupuesto->encuadernaciones(),
|
||||
"linea_impresion" => $this->presupuesto->presupuestoLineaImpresion(),
|
||||
"linea_cubierta" => $this->presupuesto->presupuestoLineaCubierta(),
|
||||
"peso_unidad" => $logistica_data["peso_unidad"],
|
||||
"peso_pedido" => $logistica_data["peso_pedido"]
|
||||
];
|
||||
}
|
||||
public function getTareaImpresionSobreCubierta() : array
|
||||
{
|
||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
||||
->whereIn("presupuesto_linea.tipo",["lp_sobrecubierta"])->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function getTareaImpresionCubierta() : array
|
||||
{
|
||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
||||
->whereIn("presupuesto_linea.tipo",["lp_cubierta"])->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function getTareaImpresionInteriorBn() : array
|
||||
{
|
||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
||||
->whereIn("presupuesto_linea.tipo",["lp_rot_bn","lp_bn","lp_bnhq"])->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function getTareaImpresionInteriorColor() : array
|
||||
{
|
||||
$q = $this->otTarea->select('orden_trabajo_tareas.*')
|
||||
->join("presupuesto_linea","presupuesto_linea.id = orden_trabajo_tareas.presupuesto_linea_id","left")
|
||||
->where("orden_trabajo_tareas.orden_trabajo_id",$this->ot->id)
|
||||
->whereIn("presupuesto_linea.tipo",["lp_rot_color","lp_color","lp_colorhq"])->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function getPresupuestoLineaImpresion(){
|
||||
}
|
||||
public function tareas_acabado(): array
|
||||
{
|
||||
$q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL",NULL,FALSE)->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function tareas_impresion(): array
|
||||
{
|
||||
$q = $this->otTarea->where("presupuesto_linea_id IS NOT NULL",NULL,FALSE)->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function tareas_encuadernacion(): array
|
||||
{
|
||||
$q = $this->otTarea->where("presupuesto_encuadernado_id IS NOT NULL",NULL,FALSE)->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function tareas_preimpresion(): array
|
||||
{
|
||||
$q = $this->otTarea->where("presupuesto_preimpresion_id IS NOT NULL",NULL,FALSE)->findAll();
|
||||
return $q;
|
||||
}
|
||||
public function tareas_manipulado(): array
|
||||
{
|
||||
$q = $this->otTarea->where("presupuesto_manipulado_id IS NOT NULL",NULL,FALSE)->findAll();
|
||||
return $q;
|
||||
}
|
||||
/**========================================================================
|
||||
* UPDATES
|
||||
*========================================================================**/
|
||||
|
||||
public function updateOrdenTrabajoTarea($tarea_id,$data) : bool
|
||||
{
|
||||
return $this->otTarea->update($tarea_id,$data);
|
||||
}
|
||||
|
||||
public function updateOrdenTrabajoDate($data)
|
||||
{
|
||||
// return $this->otDate->find($this->ot->id);
|
||||
$r = $this->otDate->update($this->ot->id,$data);
|
||||
$ot_users = $this->ot->users();
|
||||
$ot_users = $ot_users->toArray();
|
||||
$user_id = $ot_users[$this->MAPPING_DATE_USER[$data["name"]]];
|
||||
$user = $this->userModel->find($user_id);
|
||||
return ["user" => $user,"status" => $r];
|
||||
}
|
||||
|
||||
public function updateOrdenTrabajo($data) : bool
|
||||
{
|
||||
return $this->otModel->update($this->ot->id,$data);
|
||||
}
|
||||
/**========================================================================
|
||||
* RELATION METHODS
|
||||
*========================================================================**/
|
||||
@ -431,4 +678,19 @@ class ProductionService extends BaseService
|
||||
{
|
||||
return $this->presupuesto->extras();
|
||||
}
|
||||
protected function logistica_data() : array
|
||||
{
|
||||
$presupuesto_lineas = $this->presupuesto->presupuestoLineas();
|
||||
$peso = 0;
|
||||
foreach ($presupuesto_lineas as $key => $linea) {
|
||||
$peso += $linea->peso;
|
||||
}
|
||||
return [
|
||||
"peso_unidad" => $peso,
|
||||
"peso_pedido" => $peso*$this->ot->total_tirada
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user