107 lines
2.7 KiB
PHP
107 lines
2.7 KiB
PHP
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");
|
||
|
||
|
||
|
||
|
||
?>
|