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