Added validation in panel pallet validation page #1573
@@ -229,6 +229,65 @@ class CreatePanelPalletValidation extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
$panelBoxExistPallet = PanelPalletValidation::where('plant_id', $plantId)->where('pallet_number', $palletNumber)->where('panel_box_supplier', $supplierNo)->where('panel_box_serial_number', $pBoxSNo)->first();
|
||||
|
||||
if($panelBoxExistPallet){
|
||||
Notification::make()
|
||||
->title('Serial Number')
|
||||
->body("Scanned Panel Box Serial Number '$serNo' already added in pallet $palletNumber.")
|
||||
->danger()
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'item_id' => null,
|
||||
'pallet_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'serial_number' => null,
|
||||
'panel_box_supplier' => null,
|
||||
'panel_box_serial_number' => null,
|
||||
'panel_box_code' => null,
|
||||
'Sno_quantity' => 0,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$panelBoxExistOtherPallet = PanelPalletValidation::where('plant_id', $plantId)
|
||||
->where('pallet_number', '!=', $palletNumber)
|
||||
->where('panel_box_supplier', $supplierNo)
|
||||
->where('panel_box_serial_number', $pBoxSNo)
|
||||
->first();
|
||||
|
||||
if ($panelBoxExistOtherPallet) {
|
||||
|
||||
Notification::make()
|
||||
->title('Serial Number')
|
||||
->body("Scanned Panel Box Serial Number '$serNo' already added in another pallet: {$panelBoxExistOtherPallet->pallet_number}.")
|
||||
->danger()
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'item_id' => null,
|
||||
'pallet_number' => $palletNumber,
|
||||
'pending_pallet_list' => $pendingPallet,
|
||||
'serial_number' => null,
|
||||
'panel_box_supplier' => null,
|
||||
'panel_box_serial_number' => null,
|
||||
'panel_box_code' => null,
|
||||
'Sno_quantity' => 0,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user