Merge pull request 'Added catch for rework scenario in panel box validation' (#964) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Reviewed-on: #964
This commit was merged in pull request #964.
This commit is contained in:
@@ -180,30 +180,40 @@ public $records = [];
|
|||||||
$latestReworkRecord = PanelBoxValidation::where('plant_id', $this->data['plant_id'] ?? null)->where('serial_number', $this->data['serial_number'] ?? null)->latest()->first();
|
$latestReworkRecord = PanelBoxValidation::where('plant_id', $this->data['plant_id'] ?? null)->where('serial_number', $this->data['serial_number'] ?? null)->latest()->first();
|
||||||
|
|
||||||
if($latestReworkRecord){
|
if($latestReworkRecord){
|
||||||
$qualityValidation = PanelBoxValidation::create([
|
try{
|
||||||
'plant_id' => $this->data['plant_id'] ?? null,
|
$qualityValidation = PanelBoxValidation::create([
|
||||||
'line_id' => $this->data['line_id'] ?? null,
|
'plant_id' => $this->data['plant_id'] ?? null,
|
||||||
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
'line_id' => $this->data['line_id'] ?? null,
|
||||||
'production_order' => $this->data['production_order'] ?? null,
|
'sticker_master_id' => $this->data['sticker_master_id'] ?? null,
|
||||||
'serial_number' => $this->data['serial_number'] ?? null,
|
'production_order' => $this->data['production_order'] ?? null,
|
||||||
'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
'serial_number' => $this->data['serial_number'] ?? null,
|
||||||
'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
'serial_number_panel' => $this->data['serial_number_panel'] ?? null,
|
||||||
'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
'pack_slip_panel' => $this->data['pack_slip_panel'] ?? null,
|
||||||
'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
'name_plate_panel' => $this->data['name_plate_panel'] ?? null,
|
||||||
'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
'tube_sticker_panel' => $this->data['tube_sticker_panel'] ?? null,
|
||||||
'part_validation1' => $this->data['part_validation1'] ?? null,
|
'warranty_card_panel' => $this->data['warranty_card_panel'] ?? null,
|
||||||
'part_validation2' => $this->data['part_validation2'] ?? null,
|
'part_validation1' => $this->data['part_validation1'] ?? null,
|
||||||
'part_validation3' => $this->data['part_validation3'] ?? null,
|
'part_validation2' => $this->data['part_validation2'] ?? null,
|
||||||
'part_validation4' => $this->data['part_validation4'] ?? null,
|
'part_validation3' => $this->data['part_validation3'] ?? null,
|
||||||
'part_validation5' => $this->data['part_validation5'] ?? null,
|
'part_validation4' => $this->data['part_validation4'] ?? null,
|
||||||
'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
'part_validation5' => $this->data['part_validation5'] ?? null,
|
||||||
'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
'panel_box_supplier' => $this->data['panel_box_supplier'] ?? null,
|
||||||
'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
'panel_box_serial_number' => $this->data['panel_box_serial_number'] ?? null,
|
||||||
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
'panel_box_code' => $this->data['panel_box_code'] ?? null,
|
||||||
'rework_count' => $latestReworkRecord ? ((int) $latestReworkRecord->rework_count + 1) : 0,
|
'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
|
||||||
'created_by' => $this->data['created_by'] ?? null,
|
'rework_count' => $latestReworkRecord ? ((int) $latestReworkRecord->rework_count + 1) : 0,
|
||||||
'updated_by' => $this->data['updated_by'] ?? null,
|
'created_by' => $this->data['created_by'] ?? null,
|
||||||
]);
|
'updated_by' => $this->data['updated_by'] ?? null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
catch (\Illuminate\Database\QueryException $e) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Duplicate Record')
|
||||||
|
->body("Duplicate serial number found against doc number '{$this->data['production_order'] }' and inspection lot number '{$this->data['inspection_lot_number']}'.")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$qualityValidation = PanelBoxValidation::create([
|
$qualityValidation = PanelBoxValidation::create([
|
||||||
@@ -262,7 +272,6 @@ public $records = [];
|
|||||||
->body('Something went wrong while inserting data.')
|
->body('Something went wrong while inserting data.')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user