Files
2026-04-28 21:14:25 +03:00

36 lines
1.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
function lineToIso()
{
// ISO numaralarına karşılık gelen line_number'ları almak
$isoToLine = db("weld_logs")
->select('line_number', 'iso_number')
->pluck('iso_number', 'line_number')
->toArray();
return $isoToLine;
}
function lineTypeWelderToIso()
{
// (line_number, type_of_welds, welder) kombinasyonuna karşılık gelen iso_number'ları almak
$rows = db("weld_logs")
->select('line_number', 'type_of_welds', 'welder_1', 'welder_2', 'iso_number')
->get();
$map = [];
foreach ($rows as $row) {
// welder_1 için map oluştur
if (!empty($row->welder_1)) {
$key = $row->line_number . '|' . $row->type_of_welds . '|' . $row->welder_1;
$map[$key] = $row->iso_number;
}
// welder_2 için de map oluştur (eğer welder_1'den farklıysa)
if (!empty($row->welder_2) && $row->welder_2 !== $row->welder_1) {
$key = $row->line_number . '|' . $row->type_of_welds . '|' . $row->welder_2;
$map[$key] = $row->iso_number;
}
}
return $map;
}
?>