Merge pull request 'add zmm mrp column in class characteristic importer' (#1107) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s

Reviewed-on: #1107
This commit was merged in pull request #1107.
This commit is contained in:
2026-09-28 09:10:20 +00:00

View File

@@ -2667,6 +2667,7 @@ class ClassCharacteristicResource extends Resource
$seenSerialNumbers = []; $seenSerialNumbers = [];
$validRowsFound = false; $validRowsFound = false;
$duplicateSerialNoInDb = []; $duplicateSerialNoInDb = [];
$invalidMasterFound = [];
foreach ($rows as $index => $row) { foreach ($rows as $index => $row) {
if ($index == 0) { if ($index == 0) {
@@ -2714,10 +2715,16 @@ class ClassCharacteristicResource extends Resource
if ($itemCode) { if ($itemCode) {
$itemCodeExist = Item::where('plant_id', $plantId)->where('code', $itemCode)->first(); $itemCodeExist = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
if (! $itemCodeExist) { if (! $itemCodeExist) {
$invalidMatCodesNotFound = $itemCode; $invalidMatCodesNotFound[] = $itemCode;
continue; continue;
} }
if($itemCodeExist){
$itemCharacMaster = ItemCharacteristic::where('plant_id', $plantId)->where('item_id', $itemCodeExist->id)->first();
if(!$itemCharacMaster){
$invalidMasterFound[] = $itemCode;
continue;
}
}
} }
if (empty($workCenter)) { if (empty($workCenter)) {
@@ -2780,6 +2787,8 @@ class ClassCharacteristicResource extends Resource
} }
} }
} }
$uniqueInvalidCodes = array_unique($invalidItemCodes); $uniqueInvalidCodes = array_unique($invalidItemCodes);
@@ -2806,7 +2815,21 @@ class ClassCharacteristicResource extends Resource
$duplicateSerialCodesInDb = array_unique($duplicateSerialNoInDb); $duplicateSerialCodesInDb = array_unique($duplicateSerialNoInDb);
if (! empty($uniqueInvalidCodes)) { $uniqueInvalidItemCharMast = array_unique($invalidMasterFound);
if (! empty($uniqueInvalidPlaCodesMaster)) {
Notification::make()
->title('Invalid Plant Codes')
->body('The following plant codes not found in plant master:<br>'.implode(', ', $uniqueInvalidPlaCodesMaster))
->danger()
->send();
if ($disk->exists($path)) {
$disk->delete($path);
}
return;
} elseif (! empty($uniqueInvalidCodes)) {
Notification::make() Notification::make()
->title('Invalid Item Codes') ->title('Invalid Item Codes')
->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>'.implode(', ', $uniqueInvalidCodes)) ->body('The following item codes should contain minimum 6 digit alpha numeric values:<br>'.implode(', ', $uniqueInvalidCodes))
@@ -2828,10 +2851,11 @@ class ClassCharacteristicResource extends Resource
} }
return; return;
} elseif (! empty($uniqueInvalidPlaCodesMaster)) { }
elseif (! empty($uniqueInvalidItemCharMast)) {
Notification::make() Notification::make()
->title('Invalid Plant Codes') ->title('Invalid Item Codes')
->body('The following plant codes not found in plant master:<br>'.implode(', ', $uniqueInvalidPlaCodesMaster)) ->body('The following item codes not found in item characteristic master:<br>'.implode(', ', $uniqueInvalidItemCharMast))
->danger() ->danger()
->send(); ->send();
if ($disk->exists($path)) { if ($disk->exists($path)) {
@@ -2940,7 +2964,7 @@ class ClassCharacteristicResource extends Resource
return; return;
} elseif (! $validRowsFound) { } elseif (! $validRowsFound) {
Notification::make() Notification::make()
->title('Invalid Serial Invoice') ->title('Invalid Class Characteristic Serial')
->danger() // This makes the notification red to indicate an error ->danger() // This makes the notification red to indicate an error
->body('Uploaded Excel sheet is empty or<br>contains no valid data.') ->body('Uploaded Excel sheet is empty or<br>contains no valid data.')
->send(); ->send();
@@ -2951,6 +2975,8 @@ class ClassCharacteristicResource extends Resource
return; return;
} }
// ..Insert Logic // ..Insert Logic
$insertedCount = 0; $insertedCount = 0;
@@ -3143,6 +3169,7 @@ class ClassCharacteristicResource extends Resource
'zqmm_qty' => $itemCharacteristic->zqmm_qty, 'zqmm_qty' => $itemCharacteristic->zqmm_qty,
'zmm_operating_temperature' => $itemCharacteristic->zmm_operating_temperature, 'zmm_operating_temperature' => $itemCharacteristic->zmm_operating_temperature,
'zmm_axial_force' => $itemCharacteristic->zmm_axial_force, 'zmm_axial_force' => $itemCharacteristic->zmm_axial_force,
'zmm_mrp' => $itemCharacteristic->zmm_mrp,
]); ]);
} }