Merge pull request 'Added updated logic in panel box validation' (#816) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #816
This commit was merged in pull request #816.
This commit is contained in:
@@ -151,19 +151,38 @@ public $records = [];
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
if (($characteristic?->inspection_type ?? null) === 'Value') {
|
||||
if ($characteristic && is_numeric($value) && (($value >= $characteristic->lower && $value <= $characteristic->upper) || $value == $characteristic->lower || $value == $characteristic->upper)
|
||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||
->where('line_id', $this->data['line_id'])
|
||||
->where('name', $characteristic->name)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
// if (($characteristic?->inspection_type ?? null) === 'Value') {
|
||||
// if ($characteristic && is_numeric($value) && (($value >= $characteristic->lower && $value <= $characteristic->upper) || $value == $characteristic->lower || $value == $characteristic->upper)
|
||||
// ) {
|
||||
// $status = 'Ok';
|
||||
// } else {
|
||||
// $status = 'NotOk';
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// $status = $value;
|
||||
// }
|
||||
|
||||
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
|
||||
|
||||
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
|
||||
) {
|
||||
$status = 'Ok';
|
||||
} else {
|
||||
$status = 'NotOk';
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// $status = $value;
|
||||
// }
|
||||
else {
|
||||
$status = $value;
|
||||
}
|
||||
|
||||
ProductionCharacteristic::create([
|
||||
$prod = ProductionCharacteristic::create([
|
||||
'plant_id' => $this->data['plant_id'] ?? null,
|
||||
'item_id' => $itemId ?? null,
|
||||
'line_id' => $this->data['line_id'] ?? null,
|
||||
@@ -178,6 +197,15 @@ public $records = [];
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $prod) {
|
||||
Notification::make()
|
||||
->title('Failed to save Panel Box Validation')
|
||||
->body('Something went wrong while inserting data.')
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$this->showChecklist = false;
|
||||
|
||||
$this->dispatch('checklist-saved');
|
||||
@@ -214,11 +242,24 @@ public $records = [];
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
$itemCode = $this->data['item_id'];
|
||||
|
||||
$itemId = Item::where('plant_id', $characteristic->plant_id)->where('code', $itemCode)->value('id');
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
$limit = ProductCharacteristicsMaster::where('plant_id', $characteristic->plant_id)
|
||||
->where('line_id', $characteristic->line_id)
|
||||
->where('name', $characteristic->name)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if (! $characteristic || ! is_numeric($value)) {
|
||||
return 'Not Ok';
|
||||
}
|
||||
// return ($value >= $characteristic->lower && $value <= $characteristic->upper) ? 'Ok' : 'Not Ok';
|
||||
|
||||
return ($value >= $characteristic->lower && $value <= $characteristic->upper) ? 'Ok' : 'Not Ok';
|
||||
return ($value >= $limit->lower && $value <= $limit->upper) ? 'Ok' : 'Not Ok';
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user