ranjith-dev #476
@@ -14,6 +14,7 @@ class StockDataMasterExporter extends Exporter
|
|||||||
public static function getColumns(): array
|
public static function getColumns(): array
|
||||||
{
|
{
|
||||||
static $rowNumber = 0;
|
static $rowNumber = 0;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
ExportColumn::make('no')
|
ExportColumn::make('no')
|
||||||
->label('NO')
|
->label('NO')
|
||||||
@@ -29,7 +30,7 @@ class StockDataMasterExporter extends Exporter
|
|||||||
->label('TYPE')
|
->label('TYPE')
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
}),
|
}),
|
||||||
ExportColumn::make('location')
|
ExportColumn::make('location')
|
||||||
@@ -131,10 +132,10 @@ class StockDataMasterExporter extends Exporter
|
|||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
{
|
{
|
||||||
$body = 'Your stock data master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
$body = 'Your stock data master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ use App\Models\Item;
|
|||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use App\Models\StockDataMaster;
|
use App\Models\StockDataMaster;
|
||||||
|
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
use Filament\Actions\Imports\Importer;
|
use Filament\Actions\Imports\Importer;
|
||||||
use Filament\Actions\Imports\Models\Import;
|
use Filament\Actions\Imports\Models\Import;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Str;
|
use Str;
|
||||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
|
||||||
|
|
||||||
class StockDataMasterImporter extends Importer
|
class StockDataMasterImporter extends Importer
|
||||||
{
|
{
|
||||||
@@ -23,46 +23,46 @@ class StockDataMasterImporter extends Importer
|
|||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('PLANT CODE')
|
->exampleHeader('PLANT CODE')
|
||||||
->example('1000')
|
->examples(['1000', '1000'])
|
||||||
->label('PLANT CODE')
|
->label('PLANT CODE')
|
||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('type')
|
ImportColumn::make('type')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('TYPE')
|
->exampleHeader('TYPE')
|
||||||
->example('FG/SFG')
|
->examples(['FG', 'NON-FG'])
|
||||||
->label('TYPE'),
|
->label('TYPE'),
|
||||||
ImportColumn::make('location')
|
ImportColumn::make('location')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('LOCATION')
|
->exampleHeader('LOCATION')
|
||||||
->example('2001')
|
->examples(['2001', '2002'])
|
||||||
->label('LOCATION')
|
->label('LOCATION')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('item_reference')// stickerMaster
|
ImportColumn::make('item_reference')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('ITEM CODE')
|
->exampleHeader('ITEM CODE')
|
||||||
->example('123456')
|
->examples(['123456', '246118'])
|
||||||
->label('ITEM CODE')
|
->label('ITEM CODE')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('serial_number')
|
ImportColumn::make('serial_number')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('SERIAL NUMBER')
|
->exampleHeader('SERIAL NUMBER')
|
||||||
->example('200235236622')
|
->examples(['200235236622', '200235236623'])
|
||||||
->label('SERIAL NUMBER'),
|
->label('SERIAL NUMBER'),
|
||||||
ImportColumn::make('batch')
|
ImportColumn::make('batch')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('BATCH')
|
->exampleHeader('BATCH')
|
||||||
->example('20102')
|
->examples(['20102', '20103'])
|
||||||
->label('BATCH'),
|
->label('BATCH'),
|
||||||
ImportColumn::make('quantity')
|
ImportColumn::make('quantity')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('QUANTITY')
|
->exampleHeader('QUANTITY')
|
||||||
->example('1')
|
->examples(['1', '1'])
|
||||||
->label('QUANTITY'),
|
->label('QUANTITY'),
|
||||||
ImportColumn::make('doc_no')
|
ImportColumn::make('doc_no')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('DOCUMENT NUMBER')
|
->exampleHeader('DOCUMENT NUMBER')
|
||||||
->example('156566')
|
->examples(['82128', '21222'])
|
||||||
->label('DOCUMENT NUMBER'),
|
->label('DOCUMENT NUMBER'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -86,26 +86,21 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
|
|
||||||
if ($plantCod == null || $plantCod == '') {
|
if ($plantCod == null || $plantCod == '') {
|
||||||
$warnMsg[] = "Plant code can't be empty!";
|
$warnMsg[] = "Plant code can't be empty!";
|
||||||
}
|
} elseif ($typeValue == null || $typeValue == '') {
|
||||||
else if ($typeValue == null || $typeValue == '') {
|
|
||||||
$warnMsg[] = "Type can't be empty!";
|
$warnMsg[] = "Type can't be empty!";
|
||||||
}
|
} elseif ($iCode == null || $iCode == '') {
|
||||||
else if ($iCode == null || $iCode == '') {
|
|
||||||
$warnMsg[] = "Item code can't be empty!";
|
$warnMsg[] = "Item code can't be empty!";
|
||||||
}
|
} elseif ($location == null || $location == '') {
|
||||||
else if ($location == null || $location == '') {
|
|
||||||
$warnMsg[] = "Location can't be empty!";
|
$warnMsg[] = "Location can't be empty!";
|
||||||
}
|
} elseif ($serialNumber == null || $serialNumber == '') {
|
||||||
else if ($serialNumber == null || $serialNumber == '') {
|
|
||||||
$warnMsg[] = "Serial number can't be empty!";
|
$warnMsg[] = "Serial number can't be empty!";
|
||||||
}
|
}
|
||||||
// else if ($batch == null || $batch == '') {
|
// else if ($batch == null || $batch == '') {
|
||||||
// $warnMsg[] = "Batch can't be empty!";
|
// $warnMsg[] = "Batch can't be empty!";
|
||||||
// }
|
// }
|
||||||
else if ($quantity == null || $quantity == '') {
|
elseif ($quantity == null || $quantity == '') {
|
||||||
$warnMsg[] = "Quantity can't be empty!";
|
$warnMsg[] = "Quantity can't be empty!";
|
||||||
}
|
}
|
||||||
// else if ($docNo == null || $docNo == '') {
|
// else if ($docNo == null || $docNo == '') {
|
||||||
@@ -152,33 +147,27 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
$typeValue = strtoupper($typeValue);
|
$typeValue = strtoupper($typeValue);
|
||||||
|
|
||||||
if (! in_array($typeValue, ['FG', 'SFG'])) {
|
if (! in_array($typeValue, ['FG', 'NON-FG'])) {
|
||||||
$warnMsg[] = 'Invalid type found! It should be either FG or SFG and fg/sfg.';
|
$warnMsg[] = 'Invalid type found! It should be either FG or NON-FG.';
|
||||||
}
|
} elseif (Str::length($location) < 4) {
|
||||||
else if (Str::length($location) < 4) {
|
|
||||||
$warnMsg[] = 'Location should contain minimum 4 digits!';
|
$warnMsg[] = 'Location should contain minimum 4 digits!';
|
||||||
}
|
} elseif (! ctype_digit((string) $location)) {
|
||||||
else if (! ctype_digit((string) $location)) {
|
|
||||||
$warnMsg[] = 'Location must be an integer!';
|
$warnMsg[] = 'Location must be an integer!';
|
||||||
}
|
} elseif (Str::length($serialNumber) < 9) {
|
||||||
else if (Str::length($serialNumber) < 9) {
|
|
||||||
$warnMsg[] = 'Serial number should contain minimum 9 digits!';
|
$warnMsg[] = 'Serial number should contain minimum 9 digits!';
|
||||||
}
|
} elseif (! ctype_alnum($serialNumber)) {
|
||||||
else if (!ctype_alnum($serialNumber)) {
|
|
||||||
$warnMsg[] = 'Serial number should contain alpha-numeric values!';
|
$warnMsg[] = 'Serial number should contain alpha-numeric values!';
|
||||||
}
|
} elseif (! ctype_digit((string) $quantity) || (int) $quantity <= 0) {
|
||||||
|
|
||||||
else if (! ctype_digit((string) $quantity) || (int) $quantity <= 0) {
|
|
||||||
$warnMsg[] = 'Quantity must be an integer and greater than 0!';
|
$warnMsg[] = 'Quantity must be an integer and greater than 0!';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($batch){
|
if ($batch) {
|
||||||
if (Str::length($batch) < 5) {
|
if (Str::length($batch) < 5) {
|
||||||
$warnMsg[] = 'Batch should contain minimum 5 digits!';
|
$warnMsg[] = 'Batch should contain minimum 5 digits!';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($docNo){
|
if ($docNo) {
|
||||||
if (Str::length($docNo) < 5) {
|
if (Str::length($docNo) < 5) {
|
||||||
$warnMsg[] = 'Document number contain minimum 5 digits!';
|
$warnMsg[] = 'Document number contain minimum 5 digits!';
|
||||||
}
|
}
|
||||||
@@ -190,7 +179,7 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
$type = match ($typeValue) {
|
$type = match ($typeValue) {
|
||||||
'FG' => '0',
|
'FG' => '0',
|
||||||
'SFG' => '1',
|
'NON-FG' => '1',
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -199,7 +188,7 @@ class StockDataMasterImporter extends Importer
|
|||||||
$record = StockDataMaster::where([
|
$record = StockDataMaster::where([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'sticker_master_id' => $stickId,
|
'sticker_master_id' => $stickId,
|
||||||
'serial_number' => $serialNumber
|
'serial_number' => $serialNumber,
|
||||||
])->first();
|
])->first();
|
||||||
|
|
||||||
if ($record) {
|
if ($record) {
|
||||||
@@ -234,10 +223,10 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
{
|
{
|
||||||
$body = 'Your stock data master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
$body = 'Your stock data master import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
|
|||||||
@@ -2,25 +2,22 @@
|
|||||||
|
|
||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use App\Models\CustomerPoMaster;
|
|
||||||
use App\Models\InvoiceValidation;
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\NotInStock;
|
use App\Models\NotInStock;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use App\Models\StockDataMaster;
|
use App\Models\StockDataMaster;
|
||||||
use App\Models\WireMasterPacking;
|
use Filament\Actions\Action;
|
||||||
use Carbon\Carbon;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Pages\Page;
|
|
||||||
use Filament\Forms\Form;
|
|
||||||
use Filament\Forms\Concerns\InteractsWithForms;
|
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Actions\Action;
|
use Filament\Pages\Page;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
class CycleCount extends Page
|
class CycleCount extends Page
|
||||||
@@ -28,28 +25,40 @@ class CycleCount extends Page
|
|||||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||||
|
|
||||||
protected static string $view = 'filament.pages.cycle-count';
|
protected static string $view = 'filament.pages.cycle-count';
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Cycle Count Software';
|
protected static ?string $navigationGroup = 'Cycle Count Software';
|
||||||
|
|
||||||
use InteractsWithForms;
|
|
||||||
|
|
||||||
use InteractsWithActions;
|
use InteractsWithActions;
|
||||||
|
use InteractsWithForms;
|
||||||
|
|
||||||
public $serialNumber;
|
public $serialNumber;
|
||||||
|
|
||||||
public $location, $bin;
|
public $location;
|
||||||
|
|
||||||
|
public $bin;
|
||||||
|
|
||||||
public $snoCount = 0;
|
public $snoCount = 0;
|
||||||
|
|
||||||
public $state = [];
|
public $state = [];
|
||||||
|
|
||||||
public $plantId, $itemCode, $batch, $docNo, $quantity, $sNo;
|
public $plantId;
|
||||||
|
|
||||||
|
public $itemCode;
|
||||||
|
|
||||||
|
public $batch;
|
||||||
|
|
||||||
|
public $docNo;
|
||||||
|
|
||||||
|
public $quantity;
|
||||||
|
|
||||||
|
public $sNo;
|
||||||
|
|
||||||
public array $filters = [];
|
public array $filters = [];
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
'plant_id'=>$this->plantId,
|
'plant_id' => $this->plantId,
|
||||||
'pallet_quantity' => 0,
|
'pallet_quantity' => 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -66,6 +75,7 @@ class CycleCount extends Page
|
|||||||
->reactive()
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->required(),
|
->required(),
|
||||||
@@ -95,7 +105,7 @@ class CycleCount extends Page
|
|||||||
// ->reactive()
|
// ->reactive()
|
||||||
// ->readOnly(),
|
// ->readOnly(),
|
||||||
])
|
])
|
||||||
->columns(4)
|
->columns(4),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +133,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
||||||
|
|
||||||
if (!preg_match($pattern1, $value) && !preg_match($pattern2, $value) && !preg_match($pattern3, $value))
|
if (! preg_match($pattern1, $value) && ! preg_match($pattern2, $value) && ! preg_match($pattern3, $value)) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid QR Format')
|
->title('Invalid QR Format')
|
||||||
@@ -142,8 +151,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preg_match($pattern1, $value))
|
if (preg_match($pattern1, $value)) {
|
||||||
{
|
|
||||||
$value = rtrim($value, '#');
|
$value = rtrim($value, '#');
|
||||||
$parts = explode('#', $value);
|
$parts = explode('#', $value);
|
||||||
|
|
||||||
@@ -152,10 +160,9 @@ class CycleCount extends Page
|
|||||||
$this->docNo = $parts[2] ?? null;
|
$this->docNo = $parts[2] ?? null;
|
||||||
$this->quantity = $parts[3] ?? null;
|
$this->quantity = $parts[3] ?? null;
|
||||||
|
|
||||||
if (strlen($this->itemCode) < 6)
|
if (strlen($this->itemCode) < 6) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Item Code")
|
->title('Unknown Item Code')
|
||||||
->body("Item Code should contain minimum 6 digits '$this->itemCode'")
|
->body("Item Code should contain minimum 6 digits '$this->itemCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
@@ -165,11 +172,11 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! ctype_alnum($this->itemCode)) {
|
||||||
elseif(!ctype_alnum($this->itemCode)){
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Item Code")
|
->title('Unknown Item Code')
|
||||||
->body("Item Code should contain alpha-numeric values '$this->itemCode'")
|
->body("Item Code should contain alpha-numeric values '$this->itemCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -180,13 +187,13 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
return;
|
|
||||||
}
|
|
||||||
elseif($this->batch != '' || $this->batch != null){
|
|
||||||
|
|
||||||
if(strlen($this->batch) < 5){
|
return;
|
||||||
|
} elseif ($this->batch != '' || $this->batch != null) {
|
||||||
|
|
||||||
|
if (strlen($this->batch) < 5) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Batch")
|
->title('Unknown Batch')
|
||||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -197,13 +204,13 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} elseif (strlen($this->docNo) < 5) {
|
||||||
elseif(strlen($this->docNo) < 5){
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Doc No")
|
->title('Unknown Doc No')
|
||||||
->body("Doc No should contain minimum 5 digits '$this->docNo'")
|
->body("Doc No should contain minimum 5 digits '$this->docNo'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -214,11 +221,11 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! ctype_digit($this->quantity)) {
|
||||||
elseif (!ctype_digit($this->quantity)) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Quantity")
|
->title('Unknown Quantity')
|
||||||
->body("Quantity must be an integer value '$this->quantity'")
|
->body("Quantity must be an integer value '$this->quantity'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -229,14 +236,15 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = Item::where('code', $this->itemCode)->first();
|
$item = Item::where('code', $this->itemCode)->first();
|
||||||
|
|
||||||
if(!$item){
|
if (! $item) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Item Code Not Found")
|
->title('Item Code Not Found')
|
||||||
->body("Item code not found '$this->itemCode'")
|
->body("Item code not found '$this->itemCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -247,6 +255,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,9 +265,9 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$plantCode = $plantCo->code;
|
$plantCode = $plantCo->code;
|
||||||
|
|
||||||
if(!$itemCodeAgaPlant){
|
if (! $itemCodeAgaPlant) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Item Code Not Found")
|
->title('Item Code Not Found')
|
||||||
->body("Item code '$this->itemCode' not found against plant code '$plantCode'")
|
->body("Item code '$this->itemCode' not found against plant code '$plantCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -269,15 +278,16 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stickerExists = StickerMaster::where('item_id', $item->id)->first();
|
$stickerExists = StickerMaster::where('item_id', $item->id)->first();
|
||||||
|
|
||||||
if (!$stickerExists) {
|
if (! $stickerExists) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Sticker Master")
|
->title('Unknown Sticker Master')
|
||||||
->body("Item code not found in sticker master '{$this->itemCode}'")
|
->body("Item code not found in sticker master '{$this->itemCode}'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -297,10 +307,10 @@ class CycleCount extends Page
|
|||||||
->where('item_id', $item->id)
|
->where('item_id', $item->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!$stickerExists) {
|
if (! $stickerExists) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Sticker Master")
|
->title('Unknown Sticker Master')
|
||||||
->body("Item code not found in sticker master '{$this->itemCode}' in plant '{$plantCode}'")
|
->body("Item code not found in sticker master '{$this->itemCode}' in plant '{$plantCode}'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -322,7 +332,7 @@ class CycleCount extends Page
|
|||||||
->where('location', $location)
|
->where('location', $location)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationExist){
|
if (! $locationExist) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -361,8 +371,8 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
])
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
@@ -372,6 +382,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +391,7 @@ class CycleCount extends Page
|
|||||||
->where('location', $location)
|
->where('location', $location)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationAgaPlant){
|
if (! $locationAgaPlant) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -418,8 +429,8 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
])
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
@@ -439,7 +450,7 @@ class CycleCount extends Page
|
|||||||
->where('sticker_master_id', $stickerMasterId)
|
->where('sticker_master_id', $stickerMasterId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationItemAgaPlant){
|
if (! $locationItemAgaPlant) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -477,7 +488,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -530,7 +541,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -583,7 +594,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -611,7 +622,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
// $remainingStock = $stock->quantity - $currentScanned;
|
// $remainingStock = $stock->quantity - $currentScanned;
|
||||||
|
|
||||||
if($stock->scanned_status == 'Scanned'){
|
if ($stock->scanned_status == 'Scanned') {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Duplicate Serial Number')
|
->title('Duplicate Serial Number')
|
||||||
@@ -629,7 +640,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -640,6 +651,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -667,12 +679,10 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'scanned_quantity' => $newScannedQty,
|
'scanned_quantity' => $newScannedQty,
|
||||||
'scanned_status' => $status
|
'scanned_status' => $status,
|
||||||
]);
|
]);
|
||||||
$this->dispatch('refreshSfgData', location: $location, plantId: $plantId, itemCode: $this->itemCode, docNo: $this->docNo);
|
$this->dispatch('refreshSfgData', location: $location, plantId: $plantId, itemCode: $this->itemCode, docNo: $this->docNo);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown : Data Found')
|
->title('Unknown : Data Found')
|
||||||
->body("No matching record found for the given Location, Item Code, Batch, and Document Number under Plant Code '$plantCode' in stock data master.")
|
->body("No matching record found for the given Location, Item Code, Batch, and Document Number under Plant Code '$plantCode' in stock data master.")
|
||||||
@@ -688,7 +698,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -705,9 +715,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
} elseif (preg_match($pattern2, $value)) {
|
||||||
else if(preg_match($pattern2, $value))
|
|
||||||
{
|
|
||||||
$value = rtrim($value, '|');
|
$value = rtrim($value, '|');
|
||||||
$parts = explode('|', $value);
|
$parts = explode('|', $value);
|
||||||
|
|
||||||
@@ -720,10 +728,9 @@ class CycleCount extends Page
|
|||||||
$this->sNo = $parts[2];
|
$this->sNo = $parts[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->itemCode) < 6)
|
if (strlen($this->itemCode) < 6) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Item Code")
|
->title('Unknown Item Code')
|
||||||
->body("Item Code should contain minimum 6 digits '$this->itemCode'")
|
->body("Item Code should contain minimum 6 digits '$this->itemCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
@@ -734,11 +741,11 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! ctype_alnum($this->itemCode)) {
|
||||||
elseif(!ctype_alnum($this->itemCode)){
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Item Code")
|
->title('Unknown Item Code')
|
||||||
->body("Item Code should contain alpha-numeric values '$this->itemCode'")
|
->body("Item Code should contain alpha-numeric values '$this->itemCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -749,20 +756,20 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (strlen($this->batch) < 5) {
|
||||||
elseif(strlen($this->batch) < 5){
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Batch")
|
->title('Unknown Batch')
|
||||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (strlen($this->sNo) < 9) {
|
||||||
elseif(strlen($this->sNo) < 9){
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Serial Number")
|
->title('Unknown Serial Number')
|
||||||
->body("Serial Number should contain minimum 9 digits '$this->sNo'")
|
->body("Serial Number should contain minimum 9 digits '$this->sNo'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -773,11 +780,11 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif (! ctype_alnum($this->sNo)) {
|
||||||
elseif(!ctype_alnum($this->sNo)){
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Serial Number")
|
->title('Unknown Serial Number')
|
||||||
->body("Serial Number should contain alpha-numeric values '$this->sNo'")
|
->body("Serial Number should contain alpha-numeric values '$this->sNo'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -788,14 +795,15 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = Item::where('code', $this->itemCode)->first();
|
$item = Item::where('code', $this->itemCode)->first();
|
||||||
|
|
||||||
if(!$item){
|
if (! $item) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Item Code Not Found")
|
->title('Item Code Not Found')
|
||||||
->body("Item code not found '$this->itemCode'")
|
->body("Item code not found '$this->itemCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -806,6 +814,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -815,9 +824,9 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$plantCode = $plantCo->code;
|
$plantCode = $plantCo->code;
|
||||||
|
|
||||||
if(!$itemCodeAgaPlant){
|
if (! $itemCodeAgaPlant) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Item Code Not Found")
|
->title('Item Code Not Found')
|
||||||
->body("Item code '$this->itemCode' not found against plant code '$plantCode'")
|
->body("Item code '$this->itemCode' not found against plant code '$plantCode'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -828,15 +837,16 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stickerExists = StickerMaster::where('item_id', $item->id)->first();
|
$stickerExists = StickerMaster::where('item_id', $item->id)->first();
|
||||||
|
|
||||||
if (!$stickerExists) {
|
if (! $stickerExists) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Sticker Master")
|
->title('Unknown Sticker Master')
|
||||||
->body("Item code not found in sticker master '{$this->itemCode}'")
|
->body("Item code not found in sticker master '{$this->itemCode}'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -856,9 +866,9 @@ class CycleCount extends Page
|
|||||||
->where('item_id', $item->id)
|
->where('item_id', $item->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if (!$stickerExists) {
|
if (! $stickerExists) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title("Unknown Sticker Master")
|
->title('Unknown Sticker Master')
|
||||||
->body("Item code not found in sticker master '{$this->itemCode}' in plant '{$plantCode}'")
|
->body("Item code not found in sticker master '{$this->itemCode}' in plant '{$plantCode}'")
|
||||||
->danger()
|
->danger()
|
||||||
->duration(5000)
|
->duration(5000)
|
||||||
@@ -869,6 +879,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,7 +889,7 @@ class CycleCount extends Page
|
|||||||
->where('type', '1')
|
->where('type', '1')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationExist){
|
if (! $locationExist) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -917,7 +928,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -937,7 +948,7 @@ class CycleCount extends Page
|
|||||||
->where('type', '1')
|
->where('type', '1')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationAgaPlant){
|
if (! $locationAgaPlant) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -976,7 +987,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -991,7 +1002,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bin == '' || $bin == null){
|
if ($bin == '' || $bin == null) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Bin')
|
->title('Unknown Bin')
|
||||||
->body("Bin can't be empty!")
|
->body("Bin can't be empty!")
|
||||||
@@ -1010,7 +1021,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$serialExist = StockDataMaster::where('serial_number', $this->sNo)->where('type', '1')->first();
|
$serialExist = StockDataMaster::where('serial_number', $this->sNo)->where('type', '1')->first();
|
||||||
|
|
||||||
if(!$serialExist){
|
if (! $serialExist) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -1049,7 +1060,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1066,7 +1077,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$serialAgaPlant = StockDataMaster::where('plant_id', $plantId)->where('serial_number', $this->sNo)->where('type', '1')->first();
|
$serialAgaPlant = StockDataMaster::where('plant_id', $plantId)->where('serial_number', $this->sNo)->where('type', '1')->first();
|
||||||
|
|
||||||
if(!$serialAgaPlant){
|
if (! $serialAgaPlant) {
|
||||||
|
|
||||||
$sNoExist = NotInStock::where('plant_id', $plantId)
|
$sNoExist = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -1105,7 +1116,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1159,7 +1170,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1213,7 +1224,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1230,7 +1241,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
||||||
|
|
||||||
if($serialAgaPlant->batch != $this->batch){
|
if ($serialAgaPlant->batch != $this->batch) {
|
||||||
|
|
||||||
$sNoExistLocation = NotInStock::where('plant_id', $plantId)
|
$sNoExistLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -1269,7 +1280,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1326,14 +1337,13 @@ class CycleCount extends Page
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
$serial = StockDataMaster::where('plant_id', $plantId)
|
$serial = StockDataMaster::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
->where('location', $location)
|
->where('location', $location)
|
||||||
->where('type', '1')
|
->where('type', '1')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if($serial->quantity == '' || $serial->quantity == null){
|
if ($serial->quantity == '' || $serial->quantity == null) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->warning()
|
->warning()
|
||||||
->title('Unknown Quantity')
|
->title('Unknown Quantity')
|
||||||
@@ -1349,8 +1359,7 @@ class CycleCount extends Page
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif ((int) $serial->quantity > 1) {
|
||||||
elseif ((int) $serial->quantity > 1) {
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->warning()
|
->warning()
|
||||||
->title('Invalid Quantity')
|
->title('Invalid Quantity')
|
||||||
@@ -1370,7 +1379,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
if ($serial) {
|
if ($serial) {
|
||||||
|
|
||||||
if($serial->scanned_status == 'Scanned'){
|
if ($serial->scanned_status == 'Scanned') {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Duplicate Serial Number')
|
->title('Duplicate Serial Number')
|
||||||
@@ -1388,7 +1397,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1399,6 +1408,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1409,7 +1419,7 @@ class CycleCount extends Page
|
|||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'scanned_quantity' => '1',
|
'scanned_quantity' => '1',
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
'updated_by' => $operatorName
|
'updated_by' => $operatorName,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
@@ -1421,9 +1431,7 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$this->dispatch('refreshSfgNonData', location: $location, plantId: $plantId, serialNumber: $this->sNo, itemCode: $this->itemCode);
|
$this->dispatch('refreshSfgNonData', location: $location, plantId: $plantId, serialNumber: $this->sNo, itemCode: $this->itemCode);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$serNo = $value;
|
$serNo = $value;
|
||||||
|
|
||||||
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/', $serNo, $matches)) {
|
if (! preg_match('/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/', $serNo, $matches)) {
|
||||||
@@ -1489,7 +1497,7 @@ class CycleCount extends Page
|
|||||||
->where('code', $itemCode)
|
->where('code', $itemCode)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$item){
|
if (! $item) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Item Code')
|
->title('Invalid Item Code')
|
||||||
->body("Item code '$this->itemCode' not found for the type FG against plant code '$plantCode'.")
|
->body("Item code '$this->itemCode' not found for the type FG against plant code '$plantCode'.")
|
||||||
@@ -1502,6 +1510,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1511,7 +1520,7 @@ class CycleCount extends Page
|
|||||||
->where('item_id', $itemId)
|
->where('item_id', $itemId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$stickerMaster){
|
if (! $stickerMaster) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid Item Code')
|
->title('Invalid Item Code')
|
||||||
->body("Item code '$this->itemCode' not found in sticker master for the type FG against plant code '$plantCode'.")
|
->body("Item code '$this->itemCode' not found in sticker master for the type FG against plant code '$plantCode'.")
|
||||||
@@ -1524,6 +1533,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1533,7 +1543,7 @@ class CycleCount extends Page
|
|||||||
->where('type', '0')
|
->where('type', '0')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationExist){
|
if (! $locationExist) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -1572,7 +1582,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1592,7 +1602,7 @@ class CycleCount extends Page
|
|||||||
->where('type', '0')
|
->where('type', '0')
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if(!$locationAgaPlant){
|
if (! $locationAgaPlant) {
|
||||||
|
|
||||||
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
$existingInOtherLocation = NotInStock::where('plant_id', $plantId)
|
||||||
->where('serial_number', $this->sNo)
|
->where('serial_number', $this->sNo)
|
||||||
@@ -1631,7 +1641,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1704,6 +1714,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'qr_code' => null,
|
'qr_code' => null,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1765,7 +1776,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($record->scanned_status == 'Scanned'){
|
if ($record->scanned_status == 'Scanned') {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Duplicate Serial Number')
|
->title('Duplicate Serial Number')
|
||||||
@@ -1783,7 +1794,7 @@ class CycleCount extends Page
|
|||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
])
|
])
|
||||||
->send();
|
->send();
|
||||||
@@ -1839,8 +1850,7 @@ class CycleCount extends Page
|
|||||||
$hasMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
$hasMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
||||||
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
||||||
$hasPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
$hasPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (! $hasPumpSetQr && ! $hasPumpQr) {
|
if (! $hasPumpSetQr && ! $hasPumpQr) {
|
||||||
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
||||||
}
|
}
|
||||||
@@ -2044,8 +2054,7 @@ class CycleCount extends Page
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
} elseif ($isMarkPs) {
|
||||||
elseif ($isMarkPs) {
|
|
||||||
if (! $hasPumpSetQr) {
|
if (! $hasPumpSetQr) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown: Pump Set QR')
|
->title('Unknown: Pump Set QR')
|
||||||
@@ -2155,6 +2164,7 @@ class CycleCount extends Page
|
|||||||
->title('Sticker Master Not Found')
|
->title('Sticker Master Not Found')
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$existingRecord = NotInStock::where('serial_number', $this->serialNumber)
|
$existingRecord = NotInStock::where('serial_number', $this->serialNumber)
|
||||||
@@ -2174,6 +2184,7 @@ class CycleCount extends Page
|
|||||||
->body("Serial number '{$this->serialNumber}' already exists with Item Code '{$existingItemCode}'.")
|
->body("Serial number '{$this->serialNumber}' already exists with Item Code '{$existingItemCode}'.")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2186,12 +2197,13 @@ class CycleCount extends Page
|
|||||||
})
|
})
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
if($record){
|
if ($record) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Duplicate : Item Code')
|
->title('Duplicate : Item Code')
|
||||||
->body("Item Code '$itemCode' with Serial number '$this->serialNumber' already exist in not in stock table!")
|
->body("Item Code '$itemCode' with Serial number '$this->serialNumber' already exist in not in stock table!")
|
||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2215,5 +2227,4 @@ class CycleCount extends Page
|
|||||||
{
|
{
|
||||||
return Auth::check() && Auth::user()->can('view cycle count page');
|
return Auth::check() && Auth::user()->can('view cycle count page');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\DuplicateStockResource\Pages;
|
use App\Filament\Resources\DuplicateStockResource\Pages;
|
||||||
use App\Filament\Resources\DuplicateStockResource\RelationManagers;
|
|
||||||
use App\Models\DuplicateStock;
|
use App\Models\DuplicateStock;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
@@ -97,7 +96,7 @@ class DuplicateStockResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
})
|
})
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\NotInStockResource\Pages;
|
use App\Filament\Resources\NotInStockResource\Pages;
|
||||||
use App\Filament\Resources\NotInStockResource\RelationManagers;
|
|
||||||
use App\Models\NotInStock;
|
use App\Models\NotInStock;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -38,7 +37,7 @@ class NotInStockResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function ($get) {
|
->options(function ($get) {
|
||||||
if (!$get('plant_id')) {
|
if (! $get('plant_id')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ class NotInStockResource extends Resource
|
|||||||
->label('Type')
|
->label('Type')
|
||||||
->options([
|
->options([
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
]),
|
]),
|
||||||
Forms\Components\TextInput::make('motor_scanned_status')
|
Forms\Components\TextInput::make('motor_scanned_status')
|
||||||
->label('Motor Scanned Status'),
|
->label('Motor Scanned Status'),
|
||||||
@@ -122,7 +121,7 @@ class NotInStockResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
})
|
})
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|||||||
@@ -5,28 +5,26 @@ namespace App\Filament\Resources;
|
|||||||
use App\Filament\Exports\StockDataMasterExporter;
|
use App\Filament\Exports\StockDataMasterExporter;
|
||||||
use App\Filament\Imports\StockDataMasterImporter;
|
use App\Filament\Imports\StockDataMasterImporter;
|
||||||
use App\Filament\Resources\StockDataMasterResource\Pages;
|
use App\Filament\Resources\StockDataMasterResource\Pages;
|
||||||
use App\Filament\Resources\StockDataMasterResource\RelationManagers;
|
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\SerialValidation;
|
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use App\Models\StockDataMaster;
|
use App\Models\StockDataMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Radio;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
use Filament\Tables\Table;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
||||||
use Filament\Tables\Actions\ExportAction;
|
use Filament\Tables\Actions\ExportAction;
|
||||||
use Filament\Tables\Actions\ImportAction;
|
use Filament\Tables\Actions\ImportAction;
|
||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Tables\Table;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Forms\Components\Radio;
|
|
||||||
use Filament\Notifications\Notification;
|
|
||||||
|
|
||||||
class StockDataMasterResource extends Resource
|
class StockDataMasterResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -51,7 +49,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function ($get) {
|
->options(function ($get) {
|
||||||
if (!$get('plant_id')) {
|
if (! $get('plant_id')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +75,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->label('Type')
|
->label('Type')
|
||||||
->options([
|
->options([
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
]),
|
]),
|
||||||
Forms\Components\TextInput::make('motor_scanned_status')
|
Forms\Components\TextInput::make('motor_scanned_status')
|
||||||
->label('Motor Scanned Status'),
|
->label('Motor Scanned Status'),
|
||||||
@@ -135,7 +133,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
})
|
})
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -307,7 +305,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->label('Stock Type')
|
->label('Stock Type')
|
||||||
->options([
|
->options([
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
])
|
])
|
||||||
->inline()
|
->inline()
|
||||||
->default('0')
|
->default('0')
|
||||||
@@ -346,6 +344,7 @@ class StockDataMasterResource extends Resource
|
|||||||
if (empty($pId)) {
|
if (empty($pId)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
|
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
|
||||||
if ($pId) {
|
if ($pId) {
|
||||||
$query->where('plant_id', $pId);
|
$query->where('plant_id', $pId);
|
||||||
@@ -389,7 +388,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->native(false),
|
->native(false),
|
||||||
])
|
])
|
||||||
->query(function ($query, array $data) {
|
->query(function ($query, array $data) {
|
||||||
if (!isset($data['type']) && (empty($data['Plant']) && empty($data['location']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
|
if (! isset($data['type']) && (empty($data['Plant']) && empty($data['location']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
|
||||||
|
|
||||||
if (empty($data['type'])) {
|
if (empty($data['type'])) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -397,16 +396,17 @@ class StockDataMasterResource extends Resource
|
|||||||
->danger()
|
->danger()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query->whereRaw('1 = 0');
|
return $query->whereRaw('1 = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data['type'] != ''){
|
if ($data['type'] != '') {
|
||||||
|
|
||||||
if ($data['type'] == '0') {
|
if ($data['type'] == '0') {
|
||||||
|
|
||||||
$query->where('type', '0');
|
$query->where('type', '0');
|
||||||
|
|
||||||
if (!empty($data['scanned_status'])) {
|
if (! empty($data['scanned_status'])) {
|
||||||
|
|
||||||
if ($data['scanned_status'] == 'Scanned') {
|
if ($data['scanned_status'] == 'Scanned') {
|
||||||
$query->whereNotNull('scanned_status')
|
$query->whereNotNull('scanned_status')
|
||||||
@@ -440,8 +440,7 @@ class StockDataMasterResource extends Resource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
if ($data['scanned_status']) {
|
if ($data['scanned_status']) {
|
||||||
|
|
||||||
if ($data['scanned_status'] == 'Scanned') {
|
if ($data['scanned_status'] == 'Scanned') {
|
||||||
|
|||||||
Reference in New Issue
Block a user