Update process order logic on importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m32s
Laravel Larastan / larastan (pull_request) Failing after 3m49s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m32s
Laravel Larastan / larastan (pull_request) Failing after 3m49s
This commit is contained in:
@@ -146,11 +146,6 @@ class ProcessOrderImporter extends Importer
|
|||||||
$reworkStatus = 0;
|
$reworkStatus = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($createdBy == null || $createdBy == '') {
|
|
||||||
$createdBy = Filament::auth()->user()?->name;
|
|
||||||
$updatedBy = $createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||||
$warnMsg[] = 'Invalid plant code found';
|
$warnMsg[] = 'Invalid plant code found';
|
||||||
} else {
|
} else {
|
||||||
@@ -209,22 +204,10 @@ class ProcessOrderImporter extends Importer
|
|||||||
$lineId = null;
|
$lineId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($createdBy != null && $createdBy != '') {
|
// $user = User::where('name', $this->data['created_by'])->first();
|
||||||
if ($plantId) {
|
// if (! $user) {
|
||||||
$user = User::where('name', $createdBy)->first();
|
// $warnMsg[] = 'User not found';
|
||||||
|
// }
|
||||||
$userPlant = User::where('name', $createdBy)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
if (! $user) {
|
|
||||||
$warnMsg[] = 'Created By user name not found!';
|
|
||||||
} elseif (! $userPlant && ! $user->hasRole('Super Admin')) {
|
|
||||||
$warnMsg[] = "Created By user '{$createdBy}' not found for Plant '{$plantCod}'!";
|
|
||||||
} elseif (! $user->hasRole(['Super Admin', 'Process Quality Manager', 'Process Manager', 'Process Supervisor', 'Process Employee'])) {
|
|
||||||
$warnMsg[] = 'Created By user does not have rights!';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$updatedBy = Filament::auth()->user()?->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($warnMsg)) {
|
if (! empty($warnMsg)) {
|
||||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
@@ -280,9 +263,10 @@ class ProcessOrderImporter extends Importer
|
|||||||
->where('coil_number', $coilNo)
|
->where('coil_number', $coilNo)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (! $existing && $coilNo == '0' || $coilNo == 0) {
|
if (! $existing && ($coilNo == '0' || $coilNo == 0)) {
|
||||||
ProcessOrder::create([
|
ProcessOrder::create([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
|
'line_id' => $lineId,
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'process_order' => $processOrder,
|
'process_order' => $processOrder,
|
||||||
'coil_number' => '0',
|
'coil_number' => '0',
|
||||||
@@ -297,8 +281,8 @@ class ProcessOrderImporter extends Importer
|
|||||||
[
|
[
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'line_id' => $lineId,
|
'line_id' => $lineId,
|
||||||
'process_order' => $processOrder,
|
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
|
'process_order' => $processOrder,
|
||||||
'coil_number' => $coilNo,
|
'coil_number' => $coilNo,
|
||||||
'order_quantity' => $orderQuan,
|
'order_quantity' => $orderQuan,
|
||||||
'received_quantity' => $recQuan,
|
'received_quantity' => $recQuan,
|
||||||
|
|||||||
Reference in New Issue
Block a user