Updated alignment on import
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s

This commit is contained in:
dhanabalan
2026-01-13 16:38:42 +05:30
parent 05f059ece1
commit 2f8d7615a3

View File

@@ -135,51 +135,47 @@ class ReworkLocatorInvoiceValidationImporter extends Importer
$reworkedBy = $this->data['reworked_by']; $reworkedBy = $this->data['reworked_by'];
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 $plant = Plant::where('code', $plantCod)->first();
{
$plant = Plant::where('code', $this->data['plant'])->first();
if (! $plant) { if (! $plant) {
$warnMsg[] = "Plant not found"; $warnMsg[] = 'Plant not found';
} } else {
else
{
if (Str::length($invoiceNo) < 5 || ! ctype_alnum($invoiceNo)) { if (Str::length($invoiceNo) < 5 || ! ctype_alnum($invoiceNo)) {
$warnMsg[] = "Invalid invoice number found"; $warnMsg[] = 'Invalid invoice number found';
} }
if (Str::length($serialNo) < 9 || Str::length($serialNo) > 20 || ! ctype_alnum($serialNo)) { if (Str::length($serialNo) < 9 || Str::length($serialNo) > 20 || ! ctype_alnum($serialNo)) {
$warnMsg[] = "Invalid serial number found"; $warnMsg[] = 'Invalid serial number found';
} }
if (Str::length($palletNo) > 0 && Str::length($palletNo) < 10) { if (Str::length($palletNo) > 0 && Str::length($palletNo) < 10) {
$warnMsg[] = "Invalid pallet number found"; $warnMsg[] = 'Invalid pallet number found';
} }
if (Str::length($locatorNo) > 0 && Str::length($locatorNo) < 7) { if (Str::length($locatorNo) > 0 && Str::length($locatorNo) < 7) {
$warnMsg[] = "Invalid locator number found"; $warnMsg[] = 'Invalid locator number found';
} }
if ($scannedStat != 'Scanned') { if ($scannedStat != 'Scanned') {
$warnMsg[] = "Invalid scanned status found"; $warnMsg[] = 'Invalid scanned status found';
} }
if ($uploadStat != 'Y' && $uploadStat != 'N') { if ($uploadStat != 'Y' && $uploadStat != 'N') {
$warnMsg[] = "Invalid upload status found"; $warnMsg[] = 'Invalid upload status found';
} }
$created = User::where('name', $createdBy)->first(); $created = User::where('name', $createdBy)->first();
if (! $created) { if (! $created) {
$warnMsg[] = "Created by not found"; $warnMsg[] = 'Created by not found';
} }
$scanned = User::where('name', $scannedBy)->first(); $scanned = User::where('name', $scannedBy)->first();
if (! $scanned) { if (! $scanned) {
$warnMsg[] = "Scanned by not found"; $warnMsg[] = 'Scanned by not found';
} }
if (Str::length($updatedBy) > 0) { if (Str::length($updatedBy) > 0) {
$updated = User::where('name', $updatedBy)->first(); $updated = User::where('name', $updatedBy)->first();
if (! $updated) { if (! $updated) {
$warnMsg[] = "Updated by not found"; $warnMsg[] = 'Updated by not found';
} }
} }
$reworked = User::where('name', $reworkedBy)->first(); $reworked = User::where('name', $reworkedBy)->first();
if (! $reworked) { if (! $reworked) {
$warnMsg[] = "Reworked by not found"; $warnMsg[] = 'Reworked by not found';
} }
$formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; // '07-05-2025 08:00' or '07-05-2025 08:00:00' $formats = ['d-m-Y H:i', 'd-m-Y H:i:s']; // '07-05-2025 08:00' or '07-05-2025 08:00:00'
@@ -225,9 +221,7 @@ class ReworkLocatorInvoiceValidationImporter extends Importer
if (! isset($uDateTime)) { if (! isset($uDateTime)) {
$warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS"; $warnMsg[] = "Invalid 'Updated DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
} } else {
else
{
if (isset($cDateTime) && isset($uDateTime)) { if (isset($cDateTime) && isset($uDateTime)) {
if ($cDateTime->greaterThan($uDateTime)) { if ($cDateTime->greaterThan($uDateTime)) {
$warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'."; $warnMsg[] = "'Created DataTime' is greater than 'Updated DateTime'.";
@@ -247,9 +241,7 @@ class ReworkLocatorInvoiceValidationImporter extends Importer
if (! isset($rDateTime)) { if (! isset($rDateTime)) {
$warnMsg[] = "Invalid 'Reworked DateTime' format. Expected DD-MM-YYYY HH:MM:SS"; $warnMsg[] = "Invalid 'Reworked DateTime' format. Expected DD-MM-YYYY HH:MM:SS";
} } else {
else
{
if (isset($cDateTime) && isset($rDateTime)) { if (isset($cDateTime) && isset($rDateTime)) {
if ($cDateTime->greaterThan($rDateTime)) { if ($cDateTime->greaterThan($rDateTime)) {
$warnMsg[] = "'Created DataTime' is greater than 'Reworked DateTime'."; $warnMsg[] = "'Created DataTime' is greater than 'Reworked DateTime'.";
@@ -283,9 +275,10 @@ class ReworkLocatorInvoiceValidationImporter extends Importer
'created_by' => $createdBy, 'created_by' => $createdBy,
'scanned_by' => $scannedBy, 'scanned_by' => $scannedBy,
'updated_by' => $updatedBy, 'updated_by' => $updatedBy,
'reworked_by' => $reworkedBy 'reworked_by' => $reworkedBy,
] ]
); );
return null; return null;
// // return ReworkLocatorInvoiceValidation::firstOrNew([ // // return ReworkLocatorInvoiceValidation::firstOrNew([
// // // Update existing records, matching them by `$this->data['column_name']` // // // Update existing records, matching them by `$this->data['column_name']`