Merge pull request 'changed logic for select for not ok allowed for incomplete checklist' (#923) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 27s

Reviewed-on: #923
This commit was merged in pull request #923.
This commit is contained in:
2026-08-22 07:02:22 +00:00

View File

@@ -69,14 +69,16 @@ public $records = [];
public function saveChecklist()
{
if(!$this->selectForNotOk){
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
Notification::make()
->title('Incomplete Checklist')
->body('Please complete all checklist fields before submitting.')
->danger()
->send();
return;
if (empty($this->checklist) || count($this->checklist) != count($this->records)) {
Notification::make()
->title('Incomplete Checklist')
->body('Please complete all checklist fields before submitting.')
->danger()
->send();
return;
}
}
$item = Item::where('code', $this->data['item_id'])->first();
@@ -209,10 +211,58 @@ public $records = [];
return;
}
// if($this->selectForNotOk){
// foreach ($this->checklist as $characteristicId => $value) {
// $characteristic = ProductCharacteristicsMaster::find($characteristicId);
// $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 (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
// if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
// ) {
// $status = 'Ok';
// } else {
// $status = 'NotOk';
// }
// }
// else {
// $status = $value;
// }
// $prod = ProductionCharacteristic::create([
// 'plant_id' => $this->data['plant_id'] ?? null,
// 'item_id' => $itemId ?? null,
// 'line_id' => $this->data['line_id'] ?? null,
// 'machine_id' => $characteristic?->machine_id ?? null,
// 'production_order' => $this->data['production_order'] ?? null,
// 'serial_number' => $this->data['serial_number'] ?? null,
// 'characteristic_name' => $characteristic?->name ?? null,
// 'observed_value' => $value ?? null,
// 'status' => $status,
// 'inspection_status' => $finalInspectionStatus ?? null,
// 'inspection_lot_number' => $this->data['inspection_lot_number'] ?? null,
// 'created_by' => $this->data['created_by'] ?? null,
// 'updated_by' => $this->data['updated_by'] ?? null,
// ]);
// }
// }
if($this->selectForNotOk){
foreach ($this->checklist as $characteristicId => $value) {
foreach ($this->records as $record) {
$characteristicId = $record['id'];
$value = $this->checklist[$characteristicId] ?? null;
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
@@ -223,8 +273,10 @@ public $records = [];
->first();
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
if ($value == null || $value == '') {
$status = null;
}
else if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
) {
$status = 'Ok';
} else {
@@ -232,7 +284,7 @@ public $records = [];
}
}
else {
$status = $value;
$status = !empty($value) ? $value : null;
}
$prod = ProductionCharacteristic::create([
@@ -251,7 +303,6 @@ public $records = [];
'updated_by' => $this->data['updated_by'] ?? null,
]);
}
}
else {
@@ -267,7 +318,7 @@ public $records = [];
->where('item_id', $itemId)
->first();
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
if (($itemCharacteristic?->inspection_type ?? null) == 'Value') {
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
) {