mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
planning rot
This commit is contained in:
@ -194,7 +194,7 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->produccionService->papelGramajeDatatableQuery();
|
||||
return DataTable::of($q)
|
||||
->edit("tiempoReal", fn($q) => float_seconds_to_hhmm_string($q->tiempoReal * 3600))
|
||||
->add("metros", fn($q) => $q->maquina_ancho*$q->totalTirada/1000)
|
||||
->add("metros", fn($q) => $q->papel_ancho*$q->totalTirada/1000)
|
||||
->add("action", fn($q) => ["title" => lang('Produccion.datatable.filter_by_task'), 'data' => $q])
|
||||
->toJson(true);
|
||||
}
|
||||
@ -264,6 +264,10 @@ class Ordentrabajo extends BaseController
|
||||
$q = $this->produccionService->planningRotativaQueryDatatable();
|
||||
return DataTable::of($q)
|
||||
->edit("fecha_entrega_real_at", fn($q) => $q->fecha_entrega_real_at ? Time::createFromFormat("Y-m-d", $q->fecha_entrega_real_at)->format("d/m/Y") : "")
|
||||
->add("metros_check", fn($q) => $q->otId)
|
||||
->add("corte", fn($q) => $q->otId)
|
||||
->add("metros", fn($q) => $q->papel_ancho*$q->ot_tirada/1000)
|
||||
|
||||
->add("action", fn($q) => $q)
|
||||
->toJson(true);
|
||||
}
|
||||
|
||||
@ -37,28 +37,28 @@ class OrdenTrabajoDateEntity extends Entity
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'fecha_entrega_at',
|
||||
'fecha_entrega_change_at',
|
||||
'fecha_entrega_real_at',
|
||||
'fecha_entrega_real_warning',
|
||||
'fecha_impresion_at',
|
||||
'fecha_encuadernado_at',
|
||||
'fecha_externo_at',
|
||||
'fecha_entrega_warning',
|
||||
'fecha_entrega_warning_revised',
|
||||
'pendiente_ferro_at',
|
||||
'ferro_en_cliente_at',
|
||||
'ferro_ok_at',
|
||||
'interior_bn_at',
|
||||
'interior_color_at',
|
||||
'preparacion_interiores_at',
|
||||
'cubierta_at',
|
||||
'plastificado_at',
|
||||
'encuadernacion_at',
|
||||
'corte_at',
|
||||
'embalaje_at',
|
||||
'envio_at',
|
||||
'entrada_manipulado_at'
|
||||
// 'fecha_entrega_at',
|
||||
// 'fecha_entrega_change_at',
|
||||
// 'fecha_entrega_real_at',
|
||||
// 'fecha_entrega_real_warning',
|
||||
// 'fecha_impresion_at',
|
||||
// 'fecha_encuadernado_at',
|
||||
// 'fecha_externo_at',
|
||||
// 'fecha_entrega_warning',
|
||||
// 'fecha_entrega_warning_revised',
|
||||
// 'pendiente_ferro_at',
|
||||
// 'ferro_en_cliente_at',
|
||||
// 'ferro_ok_at',
|
||||
// 'interior_bn_at',
|
||||
// 'interior_color_at',
|
||||
// 'preparacion_interiores_at',
|
||||
// 'cubierta_at',
|
||||
// 'plastificado_at',
|
||||
// 'encuadernacion_at',
|
||||
// 'corte_at',
|
||||
// 'embalaje_at',
|
||||
// 'envio_at',
|
||||
// 'entrada_manipulado_at'
|
||||
];
|
||||
protected $casts = [
|
||||
// "fecha_entrada_at" => "?datetime",
|
||||
|
||||
@ -79,12 +79,12 @@ class OrdenTrabajoEntity extends Entity
|
||||
public function dates(): ?OrdenTrabajoDateEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoDate::class);
|
||||
return $m->find($this->attributes["id"]);
|
||||
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
|
||||
}
|
||||
public function users(): ?OrdenTrabajoUserEntity
|
||||
{
|
||||
$m = model(OrdenTrabajoUser::class);
|
||||
return $m->find($this->attributes["id"]);
|
||||
return $m->where('orden_trabajo_id',$this->attributes["id"])->first();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,33 +8,7 @@ class OrdenTrabajoUserEntity extends Entity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected array $casts = [
|
||||
"orden_trabajo_id" => "integer",
|
||||
"user_created_id" => "?integer",
|
||||
"user_update_id" => "?integer",
|
||||
"inaplazable_revised_change_user_id" => "?integer",
|
||||
"ferro_disponible_hecho_user_id" => "?integer",
|
||||
"ferro_disponible_ok_user_id" => "?integer",
|
||||
"ferro_entregado_user_id" => "?integer",
|
||||
"pendiente_ferro_user_id" => "?integer",
|
||||
"ferro_en_cliente_user_id" => "?integer",
|
||||
"ferro_ok_user_id" => "?integer",
|
||||
"interior_bn_user_id" => "?integer",
|
||||
"interior_color_user_id" => "?integer",
|
||||
"preparacion_interior_user_id" => "?integer",
|
||||
"cubierta_user_id" => "?integer",
|
||||
"plastificado_user_id" => "?integer",
|
||||
"encuadernacion_user_id" => "?integer",
|
||||
"corte_user_id" => "?integer",
|
||||
"embalaje_user_id" => "?integer",
|
||||
"entrada_manipulado_user_id" => "?integer",
|
||||
"pre_formato_user_id" => "?integer",
|
||||
"pre_lomo_user_id" => "?integer",
|
||||
"pre_solapa_user_id" => "?integer",
|
||||
"pre_codbarras_user_id" => "?integer",
|
||||
"pre_imposicion_user_id" => "?integer",
|
||||
"pre_imprimir_user_id" => "?integer"
|
||||
];
|
||||
|
||||
protected $attributes = [
|
||||
"orden_trabajo_id"=> null,
|
||||
"user_created_id"=> null,
|
||||
@ -62,4 +36,31 @@ class OrdenTrabajoUserEntity extends Entity
|
||||
"pre_imposicion_user_id"=> null,
|
||||
"pre_imprimir_user_id" => null
|
||||
];
|
||||
// protected array $casts = [
|
||||
// "orden_trabajo_id" => "integer",
|
||||
// "user_created_id" => "?integer",
|
||||
// "user_update_id" => "?integer",
|
||||
// "inaplazable_revised_change_user_id" => "?integer",
|
||||
// "ferro_disponible_hecho_user_id" => "?integer",
|
||||
// "ferro_disponible_ok_user_id" => "?integer",
|
||||
// "ferro_entregado_user_id" => "?integer",
|
||||
// "pendiente_ferro_user_id" => "?integer",
|
||||
// "ferro_en_cliente_user_id" => "?integer",
|
||||
// "ferro_ok_user_id" => "?integer",
|
||||
// "interior_bn_user_id" => "?integer",
|
||||
// "interior_color_user_id" => "?integer",
|
||||
// "preparacion_interior_user_id" => "?integer",
|
||||
// "cubierta_user_id" => "?integer",
|
||||
// "plastificado_user_id" => "?integer",
|
||||
// "encuadernacion_user_id" => "?integer",
|
||||
// "corte_user_id" => "?integer",
|
||||
// "embalaje_user_id" => "?integer",
|
||||
// "entrada_manipulado_user_id" => "?integer",
|
||||
// "pre_formato_user_id" => "?integer",
|
||||
// "pre_lomo_user_id" => "?integer",
|
||||
// "pre_solapa_user_id" => "?integer",
|
||||
// "pre_codbarras_user_id" => "?integer",
|
||||
// "pre_imposicion_user_id" => "?integer",
|
||||
// "pre_imprimir_user_id" => "?integer"
|
||||
// ];
|
||||
}
|
||||
|
||||
@ -24,7 +24,8 @@ return [
|
||||
"progreso" => "Progreso",
|
||||
"logo" => "Logo impresion",
|
||||
"filter_by_task" => "Filtrar por tarea",
|
||||
"metros" => "Metros"
|
||||
"metros" => "Metros",
|
||||
"corte" => "Corte"
|
||||
|
||||
|
||||
],
|
||||
|
||||
@ -98,11 +98,11 @@ class OrdenTrabajoDate extends Model
|
||||
if(!isset($data["data"])){
|
||||
return $data;
|
||||
}else{
|
||||
$this->updateUserDateMap($data["data"]);
|
||||
$this->updateUserDateMap($data["id"],$data["data"]);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
protected function updateUserDateMap($data){
|
||||
protected function updateUserDateMap($data,$values){
|
||||
$mapping = [
|
||||
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
||||
// "fecha_externo_at" => "null",
|
||||
@ -121,7 +121,7 @@ class OrdenTrabajoDate extends Model
|
||||
];
|
||||
$otUser = model(OrdenTrabajoUser::class);
|
||||
$auth_user_id = auth()->user()->id;
|
||||
foreach ($data as $key => $value) {
|
||||
foreach ($values as $key => $value) {
|
||||
if(isset($mapping[$key])){
|
||||
if($value){
|
||||
$otUser->where('orden_trabajo_id',$data['orden_trabajo_id'])
|
||||
|
||||
@ -45,9 +45,7 @@ class OrdenTrabajoUser extends Model
|
||||
protected bool $allowEmptyInserts = false;
|
||||
protected bool $updateOnlyChanged = true;
|
||||
|
||||
protected array $casts = [
|
||||
|
||||
];
|
||||
protected array $castHandlers = [];
|
||||
|
||||
// Dates
|
||||
|
||||
@ -33,7 +33,7 @@ class ProductionService extends BaseService
|
||||
protected array $MAPPING_DATE_USER = [
|
||||
"fecha_encuadernado_at" => "encuadernacion_user_id",
|
||||
// "fecha_externo_at" => "null",
|
||||
"fecha_impresion_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",
|
||||
@ -44,7 +44,7 @@ class ProductionService extends BaseService
|
||||
"plastificado_at" => "plastificado_user_id",
|
||||
"corte_at" => "corte_user_id",
|
||||
"embalaje_at" => "embalaje_user_id",
|
||||
"entrada_manipulado_at" => "entrada_manipulado_user_id"
|
||||
"entrada_manipulado_at" => "entrada_manipulado_user_id"
|
||||
];
|
||||
|
||||
/**
|
||||
@ -60,13 +60,13 @@ class ProductionService extends BaseService
|
||||
*/
|
||||
protected PresupuestoEntity $presupuesto;
|
||||
|
||||
public function __construct() {
|
||||
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
|
||||
{
|
||||
@ -135,7 +135,7 @@ class ProductionService extends BaseService
|
||||
* @param OrdenTrabajoEntity $ot
|
||||
* @return integer|boolean|string ID
|
||||
*/
|
||||
protected function storeOrdenTrabajoDates() : int|bool|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");
|
||||
@ -149,7 +149,7 @@ class ProductionService extends BaseService
|
||||
"fecha_entrega_externo" => $this->pedido->fecha_entrega_externo,
|
||||
]);
|
||||
}
|
||||
protected function storeOrdenTrabajoUsers() : int|bool|string
|
||||
protected function storeOrdenTrabajoUsers(): int|bool|string
|
||||
{
|
||||
return $this->otUser->insert([
|
||||
"orden_trabajo_id" => $this->ot->id,
|
||||
@ -351,7 +351,7 @@ class ProductionService extends BaseService
|
||||
|
||||
public function getPdf()
|
||||
{
|
||||
return view("themes/vuexy/pdfs/orden_trabajo",$this->getDataPdf());
|
||||
return view("themes/vuexy/pdfs/orden_trabajo", $this->getDataPdf());
|
||||
}
|
||||
/**
|
||||
* Query para mostrar en datatable
|
||||
@ -388,7 +388,7 @@ class ProductionService extends BaseService
|
||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||
return $q;
|
||||
}
|
||||
/**
|
||||
/**
|
||||
* Query para mostrar en datatable
|
||||
*
|
||||
* @return BaseBuilder
|
||||
@ -402,8 +402,8 @@ class ProductionService extends BaseService
|
||||
"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",
|
||||
"lg_papel_formato.ancho as papel_ancho",
|
||||
"lg_papel_formato.alto as papel_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",
|
||||
@ -422,7 +422,7 @@ class ProductionService extends BaseService
|
||||
->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"])
|
||||
->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;
|
||||
@ -461,24 +461,28 @@ class ProductionService extends BaseService
|
||||
->orderBy("orden_trabajo_tareas.orden", "ASC");
|
||||
return $q;
|
||||
}
|
||||
public function papelGramajeDatatableQuery() : BaseBuilder
|
||||
public function papelGramajeDatatableQuery(): BaseBuilder
|
||||
{
|
||||
$q = $this->otModel->builder()->select([
|
||||
"lg_papel_impresion.id as papelImpresionId",
|
||||
"lg_papel_impresion.nombre as papelImpresionNombre",
|
||||
"lg_papel_impresion.gramaje as papelImpresionGramaje",
|
||||
"COUNT(orden_trabajo_tareas.id) as tareasCount",
|
||||
"CAST(JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') AS DOUBLE) as maquina_ancho",
|
||||
"CAST(JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') AS DOUBLE) as maquina_alto",
|
||||
"lg_papel_formato.ancho as papel_ancho",
|
||||
"lg_papel_formato.alto as papel_alto",
|
||||
// "CAST(JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_ancho') AS DOUBLE) as maquina_ancho",
|
||||
// "CAST(JSON_EXTRACT(presupuesto_linea.formas,'$.maquina_alto') AS DOUBLE) as maquina_alto",
|
||||
"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)
|
||||
->groupBy('lg_papel_impresion.id');
|
||||
->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("presupuestos", "presupuestos.id = presupuesto_linea.presupuesto_id", "right")
|
||||
->join("lg_papel_impresion", "presupuesto_linea.papel_impresion_id = lg_papel_impresion.id", "left")
|
||||
->join("lg_papel_formato", "lg_papel_formato.id = presupuestos.papel_formato_id", "left")
|
||||
->where("orden_trabajo_tareas.deleted_at", null)
|
||||
->where("orden_trabajo_tareas.presupuesto_linea_id IS NOT NULL", NULL, FALSE)
|
||||
->groupBy('lg_papel_impresion.id');
|
||||
|
||||
|
||||
|
||||
@ -519,7 +523,8 @@ class ProductionService extends BaseService
|
||||
];
|
||||
return $summary;
|
||||
}
|
||||
public function getDataPdf(){
|
||||
public function getDataPdf()
|
||||
{
|
||||
$logistica_data = $this->logistica_data();
|
||||
return [
|
||||
"ot" => $this->ot,
|
||||
@ -540,88 +545,92 @@ class ProductionService extends BaseService
|
||||
"peso_pedido" => $logistica_data["peso_pedido"]
|
||||
];
|
||||
}
|
||||
public function getTareaImpresionSobreCubierta() : array
|
||||
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();
|
||||
->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
|
||||
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();
|
||||
->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
|
||||
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();
|
||||
->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
|
||||
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();
|
||||
->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 getPresupuestoLineaImpresion() {}
|
||||
public function tareas_acabado(): array
|
||||
{
|
||||
$q = $this->otTarea->where("presupuesto_acabado_id IS NOT NULL",NULL,FALSE)->findAll();
|
||||
$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();
|
||||
$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();
|
||||
$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();
|
||||
$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();
|
||||
$q = $this->otTarea->where("presupuesto_manipulado_id IS NOT NULL", NULL, FALSE)->findAll();
|
||||
return $q;
|
||||
}
|
||||
/**========================================================================
|
||||
* UPDATES
|
||||
*========================================================================**/
|
||||
|
||||
public function updateOrdenTrabajoTarea($tarea_id,$data) : bool
|
||||
public function updateOrdenTrabajoTarea($tarea_id, $data): bool
|
||||
{
|
||||
return $this->otTarea->update($tarea_id,$data);
|
||||
return $this->otTarea->update($tarea_id, $data);
|
||||
}
|
||||
|
||||
public function updateOrdenTrabajoDate($data)
|
||||
public function updateOrdenTrabajoDate($data)
|
||||
{
|
||||
// return $this->otDate->find($this->ot->id);
|
||||
$r = $this->otDate->update($this->ot->id,$data);
|
||||
// // return $this->otDate->find($this->ot->id);
|
||||
$otDate = $this->otDate->where('orden_trabajo_id', $this->ot->id)
|
||||
->set([$data['name'] => $data[$data['name']]])
|
||||
->update($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];
|
||||
if($this->MAPPING_DATE_USER[$data["name"]]){
|
||||
$user_id = $ot_users->{$this->MAPPING_DATE_USER[$data["name"]]};
|
||||
$user = $this->userModel->find($user_id);
|
||||
return ["user" => $user, "status" => $otDate];
|
||||
}else{
|
||||
return ["user" => null, "status" => false];
|
||||
}
|
||||
}
|
||||
|
||||
public function updateOrdenTrabajo($data) : bool
|
||||
public function updateOrdenTrabajo($data): bool
|
||||
{
|
||||
return $this->otModel->update($this->ot->id,$data);
|
||||
return $this->otModel->update($this->ot->id, $data);
|
||||
}
|
||||
/**========================================================================
|
||||
* RELATION METHODS
|
||||
@ -679,7 +688,7 @@ class ProductionService extends BaseService
|
||||
{
|
||||
return $this->presupuesto->extras();
|
||||
}
|
||||
protected function logistica_data() : array
|
||||
protected function logistica_data(): array
|
||||
{
|
||||
$presupuesto_lineas = $this->presupuesto->presupuestoLineas();
|
||||
$peso = 0;
|
||||
@ -688,14 +697,12 @@ class ProductionService extends BaseService
|
||||
}
|
||||
return [
|
||||
"peso_unidad" => $peso,
|
||||
"peso_pedido" => $peso*$this->ot->total_tirada
|
||||
"peso_pedido" => $peso * $this->ot->total_tirada
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
protected function actionButtonFilterTask(int $id)
|
||||
{
|
||||
return ["title" => lang('ot.filter_by_task'),'id' => $id];
|
||||
}
|
||||
|
||||
protected function actionButtonFilterTask(int $id)
|
||||
{
|
||||
return ["title" => lang('ot.filter_by_task'), 'id' => $id];
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th colspan="4" style="text-align:right">Total:</th>
|
||||
<th id="total-metros"></th>
|
||||
<th><span class="autonumeric" id="total-metros"></span>(m)</th>
|
||||
<th id="total-tiempo-papel"></th>
|
||||
<th></th>
|
||||
|
||||
|
||||
@ -12,9 +12,9 @@
|
||||
<th><?= lang('Produccion.datatable.alto') ?></th>
|
||||
<th><?= lang('Produccion.datatable.papel') ?></th>
|
||||
<th><?= lang('Produccion.datatable.gramaje') ?></th>
|
||||
<!-- <th><?= lang('Produccion.datatable.corte') ?></th>
|
||||
<th><?= lang('Produccion.datatable.metros_sel') ?></th>
|
||||
<th><?= lang('Produccion.datatable.metros_papel') ?></th> -->
|
||||
<th><?= lang('Produccion.datatable.corte') ?></th>
|
||||
<th></th>
|
||||
<th><?= lang('Produccion.datatable.metros') ?></th>
|
||||
<th class="text-nowrap"><?= lang('Basic.global.Action') ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -26,9 +26,23 @@
|
||||
<th><input type="text" class="form-control planning-filter" name="maquina_ancho" placeholder="Ancho"></th>
|
||||
<th><input type="text" class="form-control planning-filter" name="maquina_alto" placeholder="Alto"></th>
|
||||
<th><select class="select2 form-select select-maquina" id="papel-impresion-select-filter" name="papel_impresion"></select></th>
|
||||
<th><input type="text" class="form-control planning-filter" name=""></th>
|
||||
<th><input type="text" class="form-control planning-filter" name="gramaje"></th>
|
||||
<th>
|
||||
<select class="select2 form-select w-100" name="corte">
|
||||
<option value="0" default></option>
|
||||
<option value="1">Guillotina</option>
|
||||
<option value="2">Bobina</option>
|
||||
</select>
|
||||
</th>
|
||||
<th>
|
||||
<div class="form-check mt-4">
|
||||
<input class="form-check-input" id="metros-check-all" type="checkbox" value="" />
|
||||
</div>
|
||||
</th>
|
||||
<th><span class="autonumeric" id="metros-sel-total"></span></th>
|
||||
<th></th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@ -8,16 +8,20 @@ class PlanningRotativa {
|
||||
this.tablePlanningRot = this.item.find("#planning-rotativa-datatable")
|
||||
this.papelGramajeTablePlanning = this.item.find("#planning-papel-datatable")
|
||||
this.papelImpresionHeader = this.item.find('#papel-impresion-name-header')
|
||||
this.checkAllMetros = this.item.find("#metros-check-all")
|
||||
this.datatableColumns = [
|
||||
{ data: 'otId', searchable: false, sortable: false },
|
||||
{ data: 'fecha_entrega_real_at', searchable: true, sortable: false },
|
||||
{ data: 'presupuesto_titulo', searchable: true, sortable: false },
|
||||
{ data: 'maquina_planning_nombre', searchable: true, sortable: false },
|
||||
{ data: 'ot_tirada', searchable: false, sortable: false },
|
||||
{ data: 'maquina_ancho', searchable: false, sortable: false,render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'maquina_alto', searchable: false, sortable: false ,render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'ot_tirada', searchable: false, sortable: false, },
|
||||
{ data: 'papel_ancho', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'papel_alto', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'papel_impresion', searchable: false, sortable: false },
|
||||
{ data: 'papel_gramaje', searchable: false, sortable: false },
|
||||
{ data: 'papel_gramaje', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'corte', searchable: false, sortable: false, render: d => d },
|
||||
{ data: 'metros_check', searchable: false, sortable: false, render: d => `<input class="form-check-input metros-check" data-id="${d}" type="checkbox" value="" />` },
|
||||
{ data: 'metros', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'action', searchable: false, sortable: false, render: this._renderBtnAction },
|
||||
|
||||
]
|
||||
@ -26,7 +30,7 @@ class PlanningRotativa {
|
||||
{ data: 'papelImpresionGramaje', searchable: true, sortable: true },
|
||||
{ data: 'tareasCount', searchable: true, sortable: true },
|
||||
{ data: 'totalTirada', searchable: false, sortable: false },
|
||||
{ data: 'metros', searchable: false, sortable: false },
|
||||
{ data: 'metros', searchable: false, sortable: false, render: d => `<span class="autonumeric">${d}</span>` },
|
||||
{ data: 'tiempoReal', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false, render: (d) => {
|
||||
@ -43,6 +47,10 @@ class PlanningRotativa {
|
||||
init() {
|
||||
this.maquinaSelectFilter.init()
|
||||
this.papelImpresionFilter.init()
|
||||
this.checkAllMetros.on('change', () => {
|
||||
let isChecked = this.checkAllMetros.prop('checked')
|
||||
this.item.find(".metros-check").prop('checked', isChecked).trigger("change")
|
||||
})
|
||||
this.papelGramajeTablePlanning.on('click', '.papel-gramaje-btn', this.filterPapelGramaje.bind(this))
|
||||
this.papelImpresionFilter.onChange(() => {
|
||||
this.papelImpresionHeader.text(this.papelImpresionFilter.getText())
|
||||
@ -101,6 +109,8 @@ class PlanningRotativa {
|
||||
this.datatablePlanningRot.column(columnIndex).search(this.papelImpresionFilter.getText()).draw()
|
||||
})
|
||||
this.papelGramajeDatatable.on('draw', this.addTotalFooter.bind(this))
|
||||
this.tablePlanningRot.on('change', ".metros-check", this.calcMetrosCheck.bind(this))
|
||||
|
||||
}
|
||||
_renderBtnAction(d) {
|
||||
return `<a href="/produccion/ordentrabajo/edit/${d.otId}" class="ot-tarea-comment" data-id="${d.otId}"><i class="ti ti-eye"></i></a>`
|
||||
@ -127,7 +137,7 @@ class PlanningRotativa {
|
||||
this.papelImpresionHeader.text(response.nombre)
|
||||
}
|
||||
getPapelImpresionError(response) { }
|
||||
formatSeconds(s){
|
||||
formatSeconds(s) {
|
||||
return [parseInt(s / 60 / 60), parseInt(s / 60 % 60)].join(':').replace(/\b(\d)\b/g, '0$1');
|
||||
}
|
||||
addTotalFooter() {
|
||||
@ -141,13 +151,24 @@ class PlanningRotativa {
|
||||
return hb + mb + ha + ma
|
||||
})
|
||||
const metros = this.papelGramajeDatatable.column(4).data().reduce((a, b) => {
|
||||
|
||||
|
||||
return a + b
|
||||
})
|
||||
$('#total-tiempo-papel').text(this.formatSeconds(data))
|
||||
$('#total-metros').text(metros)
|
||||
|
||||
}
|
||||
calcMetrosCheck() {
|
||||
const metros_sel = this.datatablePlanningRot.rows((idx, data, node) => {
|
||||
return $(node).find('input[type="checkbox"]').prop('checked');
|
||||
}).data().toArray().reduce((a, b) => {
|
||||
a = a?.metros ?? 0
|
||||
b = b?.metros ?? 0
|
||||
return a + b
|
||||
}, null)
|
||||
this.item.find('#metros-sel-total').text(metros_sel)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user