Added duplicate validation in panel box validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 3m17s
Laravel Larastan / larastan (pull_request) Failing after 6m45s

This commit is contained in:
dhanabalan
2026-10-27 10:38:48 +05:30
parent 64d2d749d3
commit 1e93321f52

View File

@@ -19,6 +19,7 @@ use App\Models\Item;
use App\Models\Line;
use App\Models\Plant;
use App\Models\StickerMaster;
use App\Models\InvoiceValidation;
use App\Models\PanelGrMaster;
use Filament\Notifications\Notification;
use Filament\Forms\Components\DateTimePicker;
@@ -632,6 +633,25 @@ class PanelBoxValidationResource extends Resource
return;
}
$panelExistsInvoice = InvoiceValidation::where('plant_id', $plantId)
->where('panel_box_serial_number', $serialNumber)
->where('panel_box_supplier', $supplier)
->first();
if ($panelExistsInvoice) {
Notification::make()
->title('Duplicate Panel Box Serial Number')
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier against invoice Number: $panelExistsInvoice->invoice_number")
->danger()
->seconds(4)
->send();
$set('item_id', null);
$set('serial_exists', false);
return;
}
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('inspection_lot_number', $inspecLotNo)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
if(!$existInMaster){