ICS modules

This commit is contained in:
Thanakorn S
2026-03-21 14:58:15 +07:00
parent 2e558a55bb
commit a4f474b5df
45 changed files with 3110 additions and 597 deletions
+24 -5
View File
@@ -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;