remove item code checkign validation part in ocr validation page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 29s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 27s
Laravel Larastan / larastan (pull_request) Failing after 3m51s
Laravel Pint / pint (pull_request) Successful in 5m48s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 29s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 27s
Laravel Larastan / larastan (pull_request) Failing after 3m51s
Laravel Pint / pint (pull_request) Successful in 5m48s
This commit is contained in:
@@ -146,21 +146,22 @@ class OcrValidationResource extends Resource
|
|||||||
// $fullPath = storage_path('app/' . $storedPath);
|
// $fullPath = storage_path('app/' . $storedPath);
|
||||||
$fullPath = storage_path('app/private/'.$storedPath);
|
$fullPath = storage_path('app/private/'.$storedPath);
|
||||||
$parser = new Parser;
|
$parser = new Parser;
|
||||||
// $pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
|
$pdf = $parser->parseContent(file_get_contents($uploaded->getRealPath()));
|
||||||
$pdf = $parser->parseFile($fullPath);
|
$pdf = $parser->parseFile($fullPath);
|
||||||
$text = $pdf->getText();
|
$text = $pdf->getText();
|
||||||
|
|
||||||
// dd($text);
|
|
||||||
|
|
||||||
// dd($text);
|
|
||||||
$item1 = null;
|
$item1 = null;
|
||||||
$item2 = null;
|
$item2 = null;
|
||||||
|
|
||||||
if (preg_match('/Item code\s*:\s*(\S+)/i', $text, $matches)) {
|
// if (preg_match('/Item code\s*:\s*(\S+)/i', $text, $matches)) {
|
||||||
$item1 = $matches[1];
|
// $item1 = $matches[1];
|
||||||
} elseif (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
|
// }
|
||||||
$item2 = $matches[1];
|
// // elseif (preg_match('/E CODE\s*:\s*(\S+)/i', $text, $matches)) {
|
||||||
}
|
// else if (preg_match('/(?:Item\s*code|E[-\s]*CODE)\s*:\s*(\S+)/i', $text, $matches)) {
|
||||||
|
// $item2 = $matches[1];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// dd($item2);
|
||||||
|
|
||||||
$processOrder = $get('gr_number');
|
$processOrder = $get('gr_number');
|
||||||
|
|
||||||
@@ -194,7 +195,6 @@ class OcrValidationResource extends Resource
|
|||||||
'local'
|
'local'
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($itemCode == $item1) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Success')
|
->title('Success')
|
||||||
->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||||
@@ -202,28 +202,38 @@ class OcrValidationResource extends Resource
|
|||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if ($itemCode == $item2) {
|
|
||||||
Notification::make()
|
|
||||||
->title('Success')
|
|
||||||
->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
|
||||||
->success()
|
|
||||||
->send();
|
|
||||||
|
|
||||||
return;
|
// if ($itemCode == $item1) {
|
||||||
} else {
|
// Notification::make()
|
||||||
Notification::make()
|
// ->title('Success')
|
||||||
->title('Item Code not matched')
|
// ->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||||
->body("Item Code: {$item->code} not matched with the uploaded pdf code $item1.")
|
// ->success()
|
||||||
->danger()
|
// ->send();
|
||||||
->send();
|
|
||||||
|
|
||||||
if (Storage::disk('local')->exists($storedPath)) {
|
// return;
|
||||||
Storage::disk('local')->delete($storedPath);
|
// }
|
||||||
}
|
// if ($itemCode == $item2) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Success')
|
||||||
|
// ->body("Gr Number '$processOrder' PDF uploaded successfully.")
|
||||||
|
// ->success()
|
||||||
|
// ->send();
|
||||||
|
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
// else {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Item Code not matched')
|
||||||
|
// ->body("Item Code: {$item->code} not matched with the uploaded pdf code $item2.")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
|
||||||
|
// if (Storage::disk('local')->exists($storedPath)) {
|
||||||
|
// Storage::disk('local')->delete($storedPath);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
|
|||||||
Reference in New Issue
Block a user