Merge pull request 'changed logic in panel check list' (#1550) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Reviewed-on: #1550
This commit was merged in pull request #1550.
This commit is contained in:
@@ -303,6 +303,9 @@ public $records = [];
|
|||||||
|
|
||||||
|
|
||||||
$insertedCount = 0;
|
$insertedCount = 0;
|
||||||
|
$expectedCount = $this->selectForNotOk ? count($this->records) : count($this->checklist);
|
||||||
|
|
||||||
|
|
||||||
if($this->selectForNotOk){
|
if($this->selectForNotOk){
|
||||||
|
|
||||||
$notOkCharacteristics = [];
|
$notOkCharacteristics = [];
|
||||||
@@ -313,7 +316,12 @@ public $records = [];
|
|||||||
|
|
||||||
$value = $this->checklist[$characteristicId] ?? null;
|
$value = $this->checklist[$characteristicId] ?? null;
|
||||||
|
|
||||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
// $characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||||
|
$characteristic = ProductCharacteristicsMaster::where('id', $characteristicId)
|
||||||
|
->where('plant_id', $this->data['plant_id'])
|
||||||
|
->where('item_id', $itemId)
|
||||||
|
->where('line_id', $this->data['line_id'])
|
||||||
|
->first();
|
||||||
|
|
||||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||||
->where('line_id', $this->data['line_id'])
|
->where('line_id', $this->data['line_id'])
|
||||||
@@ -360,6 +368,10 @@ public $records = [];
|
|||||||
'updated_by' => $this->data['updated_by'] ?? null,
|
'updated_by' => $this->data['updated_by'] ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($prod) {
|
||||||
|
$insertedCount++;
|
||||||
|
}
|
||||||
|
|
||||||
$notOkCharacteristics[] = [
|
$notOkCharacteristics[] = [
|
||||||
'characteristic_name' => $characteristic?->name ?? null,
|
'characteristic_name' => $characteristic?->name ?? null,
|
||||||
'observed_value' => $value ?? null,
|
'observed_value' => $value ?? null,
|
||||||
@@ -411,7 +423,12 @@ public $records = [];
|
|||||||
//All validations Passed
|
//All validations Passed
|
||||||
foreach ($this->checklist as $characteristicId => $value) {
|
foreach ($this->checklist as $characteristicId => $value) {
|
||||||
|
|
||||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
// $characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||||
|
$characteristic = ProductCharacteristicsMaster::where('id', $characteristicId)
|
||||||
|
->where('plant_id', $this->data['plant_id'])
|
||||||
|
->where('item_id', $itemId)
|
||||||
|
->where('line_id', $this->data['line_id'])
|
||||||
|
->first();
|
||||||
|
|
||||||
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
|
||||||
->where('line_id', $this->data['line_id'])
|
->where('line_id', $this->data['line_id'])
|
||||||
@@ -447,6 +464,10 @@ public $records = [];
|
|||||||
'created_by' => $this->data['created_by'] ?? null,
|
'created_by' => $this->data['created_by'] ?? null,
|
||||||
'updated_by' => $this->data['updated_by'] ?? null,
|
'updated_by' => $this->data['updated_by'] ?? null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if ($prod) {
|
||||||
|
$insertedCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,7 +481,7 @@ public $records = [];
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if ($insertedCount != count($this->records)) {
|
if ($insertedCount != $expectedCount) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Failed to Save Production Characteristics')
|
->title('Failed to Save Production Characteristics')
|
||||||
->body('One or more characteristic records were not inserted.')
|
->body('One or more characteristic records were not inserted.')
|
||||||
|
|||||||
Reference in New Issue
Block a user