Files
citrus-cms/resources/views/cron/weld_logs-weldlog-to-ndt-logs-sync.blade.php
T
2026-04-28 21:15:09 +03:00

107 lines
2.7 KiB
PHP
Raw 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.
Bu cron verinin anasını bellediği için durdurulmuştur.
<!?php
$weldLogs = db("weld_logs")
->
->get();
//dump($weldLogs->count());
if($weldLogs->count() == 0) {
Cache::put($lastIdPrefix, 0);
}
$testTypes = log_test_types();
DB::beginTransaction();
$k = 0;
$say = 0;
try {
foreach($weldLogs AS $weldLog) {
$run = false;
foreach($testTypes AS $testType => $testTableName) {
$requestDate = $testType. "_request_date";
if(isset($weldLog->$requestDate)) {
if(!rejected_date($weldLog->$requestDate)) {
$tableName = $testTableName;
$run = true;
}
}
if($run) {
$data = [];
$columns = table_columns($tableName);
unset($columns['id']);
foreach($columns AS $column) {
if(array_key_exists($column, (Array) $weldLog)) {
$data[$column] = $weldLog->$column;
} else {
}
}
try {
unset($data['id']);
$whereData = [
'iso_number' => $weldLog->iso_number,
'no_of_the_joint_as_per_as_built_survey' => $weldLog->no_of_the_joint_as_per_as_built_survey
];
db($tableName)->updateOrInsert($whereData, $data);
if($say == $commitSize) {
DB::commit();
DB::beginTransaction();
$say = 0;
}
$say++;
/*
if($weldLog->iso_number == "KWR-150-AH01PZ-FA00.870-PP") {
if($weldLog->no_of_the_joint_as_per_as_built_survey == "6R1") {
echo "ok";
//dump($whereData);
//dump($data);
//dump($tableName);
}
}
*/
$k++;
DB::commit();
} catch (\Throwable $th) {
//dump($data);
Log::error($th->getMessage());
}
}
}
}
} catch (\Throwable $th) {
//dump($th);
DB::rollback();
Log::error($th->getMessage());
}
//dump("$k data processed");
Log::debug("$k data processed");
?>