ICS modules
This commit is contained in:
@@ -3,8 +3,26 @@
|
||||
|
||||
require '../../../assets/utils/db_auth.php';
|
||||
|
||||
// identity source of zone and aisle
|
||||
if(empty($data["type"])){
|
||||
$warehouse = (int)$data['warehouse'];
|
||||
$zone = $data['zone'];
|
||||
$aisle = $data["aisle"];
|
||||
}else{
|
||||
$warehouse = (int)$data['warehouse_'.$data["type"]];
|
||||
$zone = $data['zone_'.$data["type"]];
|
||||
$aisle = $data["aisle_".$data["type"]];
|
||||
}
|
||||
|
||||
// Detect if numeric and zero-pad both input and query columns
|
||||
if (is_numeric($aisle)) {
|
||||
$aisle = str_pad($aisle, 5, '0', STR_PAD_LEFT);
|
||||
$condition = "LPAD(aisle_from, 5, '0') <= :aisle_from AND LPAD(aisle_to, 5, '0') >= :aisle_to";
|
||||
} else {
|
||||
$condition = ":aisle_from >= aisle_from AND :aisle_to <= aisle_to";
|
||||
}
|
||||
|
||||
$id = (int)$data['id'];
|
||||
$warehouse = (int)$data['warehouse'];
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM md_storage
|
||||
@@ -12,15 +30,16 @@
|
||||
company_id = :company_id and
|
||||
warehouse = :warehouse and
|
||||
`zone` = :zone and
|
||||
:aisle between aisle_from and aisle_to
|
||||
$condition
|
||||
";
|
||||
|
||||
$sth = $pdo2->prepare($sql);
|
||||
$sth->execute([
|
||||
":company_id" => $company_id,
|
||||
":warehouse" => $warehouse,
|
||||
":zone" => $data["zone"],
|
||||
":aisle" => $data["aisle"]
|
||||
":zone" => $zone,
|
||||
":aisle_from" => $aisle,
|
||||
":aisle_to" => $aisle
|
||||
]);
|
||||
db_check($sth, $answer);
|
||||
|
||||
@@ -28,7 +47,7 @@
|
||||
|
||||
$output = [];
|
||||
foreach ($pre as $key => $value) {
|
||||
$output = array_merge($output, range($value["rack_form"], $value["rack_to"]));
|
||||
$output = array_merge($output, range($value["rack_from"], $value["rack_to"]));
|
||||
}
|
||||
|
||||
$answer["output"] = $output;
|
||||
|
||||
Reference in New Issue
Block a user