Files
citrus-cms/resources/views/cron/line_lists-sync-from-linelist-paint_systems.blade.php
2026-04-28 21:15:09 +03:00

50 lines
1.4 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
//paint system sync
$lineLists = DB::table('line_lists')
->whereNotNull('painting_cycle') // paint_cycle boş olmayan verileri al
->get();
$count = 0;
foreach ($lineLists as $line) {
// paint_cycle'a göre update veya insert işlemi yap
// Check if record exists
$existingRecord = DB::table('paint_systems')
->where('paint_cycle', $line->painting_cycle)
->first();
if ($existingRecord) {
// Update existing record
DB::table('paint_systems')
->where('paint_cycle', $line->painting_cycle)
->update([
'paint_cycle' => $line->painting_cycle,
'revision' => $line->rev ?? "",
]);
} else {
// Insert new record
DB::table('paint_systems')
->insert([
'paint_cycle' => $line->painting_cycle,
'revision' => $line->rev ?? "",
]);
}
DB::table('color_systems')->updateOrInsert(
['fluid_code' => $line->fluid_code], // Güncellenecek veya eklenecek satırı belirler
[
'fluid_code_description' => $line->fluid_en ?? "",
'fluid_code' => $line->fluid_code,
'design_temperature' => $line->design_temperature ?? "",
'working_temperature' => $line->working_temperature ?? "",
'unit' => $line->unit,
]
);
$count++;
}
?>