mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
a falta de validar
This commit is contained in:
@ -145,6 +145,7 @@ class MaquinasDefectoModel extends \App\Models\GoBaseModel
|
||||
->select(
|
||||
"t1.id AS id, t1.tipo AS tipo, t1.ancho_min AS ancho_min, t1.ancho_max AS ancho_max, t1.alto_min AS alto_min, t1.alto_max AS alto_max, t1.tirada_min AS tirada_min, t1.tirada_max AS tirada_max, t2.nombre AS maquina"
|
||||
);
|
||||
$builder->where('t1.is_deleted', 0);
|
||||
$builder->join("lg_maquinas t2", "t1.maquina_id = t2.id", "left");
|
||||
|
||||
return empty($search)
|
||||
@ -172,4 +173,46 @@ class MaquinasDefectoModel extends \App\Models\GoBaseModel
|
||||
->orLike("t2.nombre", $search)
|
||||
->groupEnd();
|
||||
}
|
||||
|
||||
public function checkIntervals($data = []){
|
||||
$ancho_min = $this->db
|
||||
->table($this->table)
|
||||
->selectMin("ancho_min")
|
||||
->where("is_deleted", 0)
|
||||
->where("tipo", $data["tipo"])->get()->getRow()->ancho_min;
|
||||
|
||||
$ancho_max = $this->db
|
||||
->table($this->table)
|
||||
->selectMin("ancho_max")
|
||||
->where("is_deleted", 0)
|
||||
->where("tipo", $data["tipo"])->get()->getRow()->ancho_max;
|
||||
|
||||
$tirada_min = $this->db
|
||||
->table($this->table)
|
||||
->selectMin("tirada_min")
|
||||
->where("is_deleted", 0)
|
||||
->where("tipo", $data["tipo"])->get()->getRow()->tirada_min;
|
||||
|
||||
$tirada_max = $this->db
|
||||
->table($this->table)
|
||||
->selectMin("tirada_max")
|
||||
->where("is_deleted", 0)
|
||||
->where("tipo", $data["tipo"])->get()->getRow()->tirada_max;
|
||||
|
||||
if(!is_null($ancho_max) && !is_null($ancho_min)){
|
||||
if($data["ancho_min"]>=intval($ancho_min) ||
|
||||
$data["ancho_max"]<=intval($ancho_max) )
|
||||
return lang('MaquinasPorDefecto.validation.error_ancho_overlap');
|
||||
}
|
||||
|
||||
if(!is_null($tirada_max) && !is_null($tirada_min)){
|
||||
if($data["tirada_min"]>=intval($tirada_min) ||
|
||||
$data["tirada_max"]<=intval($tirada_max) )
|
||||
return lang('MaquinasPorDefecto.validation.error_tirada_overlap');
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user