Compare commits
425 Commits
ranjith-de
...
a960752ba6
| Author | SHA1 | Date | |
|---|---|---|---|
| a960752ba6 | |||
| e84d0c7f00 | |||
| c5bd6cd995 | |||
| cf534af204 | |||
| 875ea7ac2d | |||
| bd93f3e86e | |||
| ad6d56b944 | |||
| 71f1b14757 | |||
| a0a1812a57 | |||
| d6b7b6a1af | |||
| 9091e7d080 | |||
| 957eb3cb58 | |||
| 9889f7b664 | |||
| 25ec7666ae | |||
| 87de4243aa | |||
| d1bf69fe68 | |||
| abd97d6bfb | |||
| 412b50c6c0 | |||
| 1bf85da54d | |||
| 7bfd534781 | |||
| f4f470a98a | |||
| 09cb02046f | |||
| a1eb635fe0 | |||
| 57ab4137a5 | |||
| 705d3416d7 | |||
| 77277cd4e8 | |||
| 3adfe42e95 | |||
| 9a2c8712a7 | |||
| f6bfa6ca13 | |||
| 9d3256a3a9 | |||
| 24d76f59a7 | |||
| 292e809a7f | |||
| 82c100162d | |||
| 417b6f4dea | |||
| 0379858239 | |||
| d7147084f9 | |||
| a3c37a16d2 | |||
| ab6925a896 | |||
| 8e7b8e52b7 | |||
| f1175ff5bc | |||
| bd0d9ba979 | |||
| 8038eabeda | |||
| afb045ca4c | |||
| bf977c08bd | |||
| db05e9e738 | |||
| 3c5c18cea4 | |||
| b9d1dcb1c1 | |||
| b105d38bfe | |||
| 1cc8403f2a | |||
| eb3ed2b8f1 | |||
| 6ff007e3a1 | |||
| 60cfab3b89 | |||
| 67ee3ce0f2 | |||
| 57c56fffeb | |||
| 88b6fb4256 | |||
| 9a514a758e | |||
| 6d01112c4d | |||
| b74095713b | |||
| d027156614 | |||
| 27ea356e8f | |||
| 435f46fae4 | |||
| b5be827bc3 | |||
| 8ba03cf2b9 | |||
| 0dcf34d713 | |||
| 4025fcf783 | |||
| 3363498fb6 | |||
| a6b8a5c0cc | |||
| c6714b195e | |||
| d392fe9c78 | |||
| eccc6342c0 | |||
| dbc9a02669 | |||
| 837b936b51 | |||
| 528914e2d0 | |||
| bb94206a1e | |||
| d7f758b584 | |||
| 85bfb99273 | |||
| 2f2faa3019 | |||
| d72f4c89fd | |||
| 4c07abe394 | |||
| 8a0e7d6878 | |||
| d1031d8a6e | |||
| fa06c2c6cb | |||
| e06a458fc0 | |||
| 36dd07817b | |||
| 51a20219db | |||
| dc564f9c28 | |||
| bab5b879e6 | |||
| a09264a053 | |||
| 82f776ef41 | |||
| 952b9a01a5 | |||
| 2b8a3a2838 | |||
| 4acb66c464 | |||
| ea64aea9ce | |||
| 72e6621cc0 | |||
| 2c49e6b272 | |||
| d6ec50c20e | |||
| 19382d0644 | |||
| 408e426545 | |||
| 62b338be22 | |||
| c407f9c6c2 | |||
| a09adf0ea5 | |||
| b864bda85e | |||
| 734ab9dfdc | |||
| 6907083ec0 | |||
| bd7e0422e6 | |||
| 53f14711b2 | |||
| a39a10d104 | |||
| 17bca76d06 | |||
| 500a2ae3ca | |||
| 0adb82afcf | |||
| cc7fd5b16d | |||
| 70d38c7a7b | |||
| efba8af539 | |||
| caac5ad7eb | |||
| 7e799d507a | |||
| 358d31cb71 | |||
| 4ffc2d7a92 | |||
| be5d02bc50 | |||
| eff0da491c | |||
| 2e0ccd7c34 | |||
| 2a2bf8db4c | |||
| c2c50eb451 | |||
| 75ba355252 | |||
| b40a7e3ae7 | |||
| b50493f2f2 | |||
| 7bc70341d6 | |||
| 9c869e9726 | |||
| b5fe0018df | |||
| 76216bd304 | |||
| 8b12d7612f | |||
| 717cfcaa53 | |||
| 1426f868cb | |||
| e6c103b56a | |||
| 8ab8e465b9 | |||
| 920a217613 | |||
| 780f00f11a | |||
| f631fcd43c | |||
| 444ec30b34 | |||
| d1b487aadb | |||
| c89574f070 | |||
| 2e52499aba | |||
| 8b08a54f04 | |||
| dda77f4ac7 | |||
| 5ebd5cfa47 | |||
| bddcc95c21 | |||
| 956c34a5da | |||
| 88046d7a2a | |||
| c60eae50a1 | |||
| 4289fb3ef1 | |||
| b032f14deb | |||
| 0653a69d8d | |||
| 3ce5867615 | |||
| 82aa723d52 | |||
| 72e1df1329 | |||
| 077872d418 | |||
| caeb0a5afd | |||
| e4fdd9521e | |||
| 3d26ad29ef | |||
| ce5393f858 | |||
| 12c9e55d45 | |||
| a1c9a1083c | |||
| b5ed826213 | |||
| f11b95e44e | |||
| 908ea3fb21 | |||
| 78987f1430 | |||
| a16ae0ca16 | |||
| 5ee964b5f7 | |||
| de1bf16ace | |||
| a1f5fa0457 | |||
| b7b6ab6c77 | |||
| 32b86b4289 | |||
| c33db6b934 | |||
| 4807c572eb | |||
| 252014bd51 | |||
| e1d5793922 | |||
| 56152816e2 | |||
| 8b2d4c4faf | |||
| 0430d605e7 | |||
| 0decbc6e29 | |||
| 9aa727cc36 | |||
| 22ece583b7 | |||
| 8c90d1fc03 | |||
| 5e68debd87 | |||
| 855e9f91c8 | |||
| 6d088471bf | |||
| f167b732c0 | |||
| 4264c5493c | |||
| 61774d240a | |||
| ae01370107 | |||
| f3389399eb | |||
| c18a07853e | |||
| 555f810c0f | |||
| 2e5d185be1 | |||
| 0ece1d0dd6 | |||
| e145560920 | |||
| e02052e536 | |||
| 39e40e011f | |||
| 7184eda58c | |||
| 3c4b419078 | |||
| 7ba5375386 | |||
| c3324caa08 | |||
| ace14124f3 | |||
| c68a45ef8d | |||
| 3edd8fafc6 | |||
| 2c66f2e6bd | |||
| e791176500 | |||
| 1eddecc660 | |||
| 379e8fc8f9 | |||
| b018ef48d7 | |||
| e45c166345 | |||
| d53d3dedbb | |||
| 18e74f4a52 | |||
| 16c525773b | |||
| 501cd541b9 | |||
| 62e14fb3c3 | |||
| 78f4929e27 | |||
| b674966886 | |||
| 103515a387 | |||
| dd182c6504 | |||
| 1fed559feb | |||
| 312de66a1c | |||
| 7d8a891f95 | |||
| 557c367f4c | |||
| cef3e17dc7 | |||
| f89ad49eff | |||
| c9006ee0a1 | |||
| 2fa58b587e | |||
| bb0a684366 | |||
| 16b1802412 | |||
| 079ed2eba6 | |||
| f1f6b596a4 | |||
| b2aa572994 | |||
| 44bdcba615 | |||
| 76a5379c02 | |||
| eeeec722ee | |||
| d8a4ddf6e9 | |||
| 9493bf5edf | |||
| feab063017 | |||
| b2f5194ef9 | |||
| 3a3322ccc4 | |||
| 7a9dac239d | |||
| 77d98b16fb | |||
| a2554fb4a9 | |||
| 353774b184 | |||
| 29fecaea3d | |||
| a35185e4b1 | |||
| f07ba9dd00 | |||
| 2a7f48cc75 | |||
| c7f4f49669 | |||
| 2e9a52a890 | |||
| 3c34495048 | |||
| b70907cb9f | |||
| 9ee4fe5c7e | |||
| 6f06319752 | |||
| 785be70629 | |||
| e5cb7f3d88 | |||
| 1dbbd53fc9 | |||
| 04d0c2dc82 | |||
| 048977a44b | |||
| 8395599d9d | |||
| 9a7b42dea5 | |||
| 0ce59ebe22 | |||
| c032cdc58d | |||
| 4074374614 | |||
| 15712c44b6 | |||
| 99f7450e5e | |||
| f6f6f0924e | |||
| 3bab0310a1 | |||
| 6924990ace | |||
| ba0b2c2709 | |||
| 51416cdf37 | |||
| a8ff5b5120 | |||
| 4ca965ccb1 | |||
| 22cbb6c4d3 | |||
| 6db07e1825 | |||
| 1bc0a4b01d | |||
| dc77a51c3c | |||
| b07a9596e5 | |||
| b96a54aae5 | |||
| fe0e1e139e | |||
| a95766fd45 | |||
| d5d5a6d193 | |||
| 25125cfead | |||
| d6c6cf0c69 | |||
| 99a95dc150 | |||
| 6d26307c4a | |||
| 8703aec73e | |||
| f8691500cf | |||
| 12f9cb683f | |||
| 73c26a649a | |||
| 80f6aeb3d6 | |||
| f633285a57 | |||
| 841922a4b3 | |||
| 3a819737cb | |||
| 18f60ec336 | |||
| 4ab7be97bb | |||
| a643bce1c2 | |||
| 45392419cd | |||
| 7b300f63d2 | |||
| 650314a435 | |||
| eaefffd51b | |||
| 084d9b04f1 | |||
| 75a3a8641c | |||
| f7f1d3a855 | |||
| f00fc8b4d7 | |||
| 73eb79a8d0 | |||
| 5856fe64c1 | |||
| 4615e45c74 | |||
| 486b94bb79 | |||
| 71eda460bd | |||
| 938f9b9fdf | |||
| 648551c619 | |||
| 308e68b79a | |||
| 5b9cb33a63 | |||
| 8b57518408 | |||
| 4b68133bf1 | |||
| a52fc9580a | |||
| 94819ccc4f | |||
| 6e51b9fba8 | |||
| 0a66526a63 | |||
| 0398cd5262 | |||
| cca6fbe428 | |||
| 633c8c89ca | |||
| 543ab7f44f | |||
| 09aeff2b96 | |||
| 2f3973f6af | |||
| 7f76a604a3 | |||
| 837ac47120 | |||
| e6fb2c1bae | |||
| a687b8af3b | |||
| cd45e6658a | |||
| 0b221c5eae | |||
| 8c062505c9 | |||
| 9411d0b33b | |||
| ab3a2047bb | |||
| f0ef2dda8e | |||
| 968d67d808 | |||
| 2342c6003d | |||
| 290d218a0d | |||
| c455c76715 | |||
| a1abe537c3 | |||
| c65265e68e | |||
| 3da016ae49 | |||
| ea17636670 | |||
| 31b56ae9b2 | |||
| 9517b38f9b | |||
| 2c1caa40a3 | |||
| c3fef2f3a0 | |||
| 904e18e63a | |||
| 27dc2690ca | |||
| 8e1c4f46e8 | |||
| d699c043d4 | |||
| 1806f32a7b | |||
| eb2ae19641 | |||
| 2dbcc8b859 | |||
| 79e3427cdb | |||
| 81a5fa16c4 | |||
| 6520c3ca87 | |||
| 2e167c75b0 | |||
| aca5d6c957 | |||
| 9edbaf3d43 | |||
| a46aaa72a2 | |||
| d917aa530d | |||
| 45944c5c25 | |||
| fda672948b | |||
| f15e6451ca | |||
| c8aac9116d | |||
| bcd107a8bc | |||
| 458e143b9a | |||
| de2dda0dc5 | |||
| 7543f8a416 | |||
| f76316ec91 | |||
| acea7b14a6 | |||
| 87f49e8491 | |||
| f612551288 | |||
| 4f84735eaf | |||
| 45b8c1fbb4 | |||
| 6015968043 | |||
| 2bc8584e7a | |||
| d126e931c8 | |||
| 62bf68ad2e | |||
| c6c63dcb35 | |||
| d1663ae58a | |||
| deb46cdda2 | |||
| 002bdc597d | |||
| a406d1b58a | |||
| 58d0b9f0ae | |||
| c0d8ca7b1e | |||
| f31ab62ec0 | |||
| 4285a31f94 | |||
| 0c9228bfec | |||
| 58b45c849d | |||
| 61a2e7ffad | |||
| 3779cf3e3b | |||
| acf955dd94 | |||
| 0de49f14ce | |||
| 0473ca33cf | |||
| 8a01033459 | |||
| 0555f9faff | |||
| 8cbbaa4845 | |||
| cb6b201648 | |||
| c3089a147c | |||
| 45f0e39f73 | |||
| fe1e1b9918 | |||
| e20915ca82 | |||
| 58e6cbfac0 | |||
| 1ace049687 | |||
| e5e85a8eea | |||
| 555802ab35 | |||
| 587b743f12 | |||
| 42555d4a81 | |||
| fd1e554076 | |||
| 022654f192 | |||
| 55f1088fda | |||
| f9233f44d8 | |||
| e0fec6b07c | |||
| 6bda9c1459 | |||
| 39bdd3df57 | |||
| 5bcf0703d9 | |||
| 80e522b7e6 | |||
| ee101f80ea | |||
| 37a99d03c1 | |||
| 5fdced003a | |||
| 0b0bb90efb | |||
| 32ce6da2c1 |
@@ -36,8 +36,6 @@ class ProcessOrderExporter extends Exporter
|
||||
->label('COIL NUMBER'),
|
||||
ExportColumn::make('order_quantity')
|
||||
->label('ORDER QUANTITY'),
|
||||
ExportColumn::make('updated_order_quantity')
|
||||
->label('UPDATED ORDER QUANTITY'),
|
||||
ExportColumn::make('received_quantity')
|
||||
->label('RECEIVED QUANTITY'),
|
||||
ExportColumn::make('sfg_number')
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\StockDataMaster;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class StockDataMasterExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = StockDataMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('type')
|
||||
->label('TYPE')
|
||||
->formatStateUsing(fn ($state) => match ($state) {
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
default => '-',
|
||||
}),
|
||||
ExportColumn::make('location')
|
||||
->label('LOCATION'),
|
||||
ExportColumn::make('bin')
|
||||
->label('BIN'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('batch')
|
||||
->label('BATCH'),
|
||||
ExportColumn::make('quantity')
|
||||
->label('QUANTITY'),
|
||||
ExportColumn::make('doc_no')
|
||||
->label('DOCUMENT NUMBER'),
|
||||
ExportColumn::make('motor_scanned_status')
|
||||
->label('MOTOR SCANNED STATUS'),
|
||||
ExportColumn::make('pump_scanned_status')
|
||||
->label('PUMP SCANNED STATUS'),
|
||||
ExportColumn::make('capacitor_scanned_status')
|
||||
->label('CAPACITOR SCANNED STATUS'),
|
||||
ExportColumn::make('scanned_status_set')
|
||||
->label('SCANNED STATUS SET'),
|
||||
ExportColumn::make('panel_box_item_code')
|
||||
->label('PANEL BOX ITEM CODE'),
|
||||
ExportColumn::make('panel_box_supplier')
|
||||
->label('PANEL BOX SUPPLIER'),
|
||||
ExportColumn::make('panel_box_sno')
|
||||
->label('PANEL BOX SNO'),
|
||||
ExportColumn::make('scanned_status')
|
||||
->label('SCANNED STATUS'),
|
||||
ExportColumn::make('scanned_quantity')
|
||||
->label('SCANNED QUANTITY'),
|
||||
ExportColumn::make('system_stock')
|
||||
->label('SYSTEM STOCK')
|
||||
->state(fn ($record) => $record->quantity),
|
||||
ExportColumn::make('scanned_stock')
|
||||
->label('SCANNED STOCK')
|
||||
->state(fn ($record) => $record->scanned_quantity),
|
||||
ExportColumn::make('duplicate_stock')
|
||||
->label('DUPLICATE STOCK')
|
||||
->state(function ($record) {
|
||||
return \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
}),
|
||||
ExportColumn::make('not_in_stock')
|
||||
->label('NOT IN STOCK')
|
||||
->state(function ($record) {
|
||||
return \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
}),
|
||||
ExportColumn::make('physical_stock')
|
||||
->label('PHYSICAL STOCK')
|
||||
->state(function ($record) {
|
||||
|
||||
$duplicate = \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
|
||||
$notInStock = \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
|
||||
$scanned = $record->scanned_quantity ?? 0;
|
||||
|
||||
return $scanned + $duplicate + $notInStock;
|
||||
}),
|
||||
|
||||
ExportColumn::make('stock_difference')
|
||||
->label('STOCK DIFFERENCE COUNT')
|
||||
->state(function ($record) {
|
||||
|
||||
$duplicate = \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
|
||||
$notInStock = \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
|
||||
$scanned = (int) $record->scanned_quantity;
|
||||
|
||||
$physicalStock = $scanned + $duplicate + $notInStock;
|
||||
|
||||
$systemStock = (int) $record->quantity;
|
||||
|
||||
$difference = $physicalStock - $systemStock;
|
||||
|
||||
return max($difference, 0);
|
||||
}),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->label('DELETED AT')
|
||||
->enabledByDefault(false),
|
||||
];
|
||||
}
|
||||
|
||||
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.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -52,9 +52,6 @@ class ProcessOrderImporter extends Importer
|
||||
->example('1000')
|
||||
->label('ORDER QUANTITY')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_order_quantity')
|
||||
->exampleHeader('UPDATED ORDER QUANTITY')
|
||||
->label('UPDATED ORDER QUANTITY'),
|
||||
ImportColumn::make('coil_number')
|
||||
->exampleHeader('COIL NUMBER')
|
||||
// ->example('01')
|
||||
@@ -113,7 +110,6 @@ class ProcessOrderImporter extends Importer
|
||||
$sfgNo = trim($this->data['sfg_number'] ?? '');
|
||||
$machineName = trim($this->data['machine_name'] ?? '');
|
||||
$orderQuan = trim($this->data['order_quantity'] ?? '');
|
||||
$updatedOrderQuan = trim($this->data['updated_order_quantity'] ?? '');
|
||||
$scrapQuan = trim($this->data['scrap_quantity'] ?? '');
|
||||
$reworkStatus = trim($this->data['rework_status'] ?? '');
|
||||
$recQuan = trim($this->data['received_quantity'] ?? '');
|
||||
@@ -132,14 +128,11 @@ class ProcessOrderImporter extends Importer
|
||||
if ($iCode == null || $iCode == '') {
|
||||
$warnMsg[] = "Item code can't be empty!";
|
||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found!';
|
||||
}
|
||||
if ($machineName != null && $machineName != '' && Str::length($machineName) > 18) {
|
||||
$warnMsg[] = 'Invalid machine name found!';
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
}
|
||||
if ($processOrder == null || $processOrder == '') {
|
||||
$warnMsg[] = "Process order can't be empty!";
|
||||
} elseif ($processOrder && (Str::contains($processOrder, '.') || Str::contains($processOrder, 'E', ignoreCase: true))) {
|
||||
} elseif ($processOrder && Str::contains($processOrder, '.')) {
|
||||
$warnMsg[] = 'Invalid process order found!';
|
||||
}
|
||||
if ($lineNam == null || $lineNam == '') {
|
||||
@@ -152,12 +145,6 @@ class ProcessOrderImporter extends Importer
|
||||
} elseif (Str::length($orderQuan) >= 1 && ! is_numeric($orderQuan)) {
|
||||
$warnMsg[] = 'Invalid order quantity found!';
|
||||
}
|
||||
if ($updatedOrderQuan == null || $updatedOrderQuan == '' || $updatedOrderQuan == 0 || $updatedOrderQuan == '0') {
|
||||
$updatedOrderQuan = $orderQuan;
|
||||
} elseif (Str::length($updatedOrderQuan) >= 1 && ! is_numeric($updatedOrderQuan)) {
|
||||
$warnMsg[] = 'Invalid Updated order quantity found!';
|
||||
}
|
||||
|
||||
if ($coilNo == null || $coilNo == '') {
|
||||
$coilNo = '0';
|
||||
}
|
||||
@@ -172,7 +159,7 @@ class ProcessOrderImporter extends Importer
|
||||
} elseif ($reworkStatus == 1 || $reworkStatus = '1') {
|
||||
$reworkStatus = 1;
|
||||
} else {
|
||||
$warnMsg[] = 'Invalid rework status found!';
|
||||
$warnMsg[] = 'Invalid rework status found';
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
@@ -236,7 +223,7 @@ class ProcessOrderImporter extends Importer
|
||||
->first();
|
||||
|
||||
if ($existingOrder && $existingOrder->item_id !== ($itemId ?? null)) {
|
||||
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code!';
|
||||
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,39 +243,6 @@ class ProcessOrderImporter extends Importer
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
// ->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
$receivedQty = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->sum('received_quantity');
|
||||
|
||||
if ($existing) {
|
||||
$liveOrdQuan = (float) $existing->order_quantity;
|
||||
$liveUpdatedOrdQuan = (float) $existing->updated_order_quantity;
|
||||
|
||||
$allowedIncrease = $liveOrdQuan * 0.10;
|
||||
|
||||
$maxAllowedQty = $liveOrdQuan + $allowedIncrease;
|
||||
$minAllowedQty = $liveOrdQuan - $allowedIncrease;
|
||||
|
||||
if ($liveUpdatedOrdQuan > $maxAllowedQty) {
|
||||
throw new RowImportFailedException(
|
||||
"Updated order quantity cannot exceed 10% of existing order quantity. Max allowed: {$maxAllowedQty}!"
|
||||
);
|
||||
} elseif ($liveUpdatedOrdQuan < $minAllowedQty) {
|
||||
throw new RowImportFailedException(
|
||||
"Updated order quantity cannot decrease -10% of existing order quantity. Min allowed: {$minAllowedQty}!"
|
||||
);
|
||||
} elseif ($liveUpdatedOrdQuan < $receivedQty) {
|
||||
throw new RowImportFailedException(
|
||||
"Updated order quantity cannot decrease below its received quantity {$receivedQty}!"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($coilNo != null && $coilNo != '' && $scrapQuan && $reworkStatus && $recQuan && $createdAt && $createdBy && $updatedAt && $updatedBy && Filament::auth()->user()->hasRole('Super Admin')) {
|
||||
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
@@ -296,17 +250,6 @@ class ProcessOrderImporter extends Importer
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
// $existingProcess = ProcessOrder::where('plant_id', $plantId)
|
||||
// ->where('process_order', $processOrder)
|
||||
// ->where('line_id', $lineId)
|
||||
// ->first();
|
||||
|
||||
if ($existing) {
|
||||
$existUpdateOrdQuan = $existing->updated_order_quantity;
|
||||
} else {
|
||||
$existUpdateOrdQuan = $updatedOrderQuan;
|
||||
}
|
||||
|
||||
if (! $existingCoil) {
|
||||
ProcessOrder::Create(
|
||||
[
|
||||
@@ -316,7 +259,6 @@ class ProcessOrderImporter extends Importer
|
||||
'item_id' => $itemId,
|
||||
'coil_number' => $coilNo,
|
||||
'order_quantity' => $orderQuan,
|
||||
'updated_order_quantity' => $existUpdateOrdQuan,
|
||||
'received_quantity' => $recQuan,
|
||||
'scrap_quantity' => $scrapQuan,
|
||||
'sfg_number' => $sfgNo,
|
||||
@@ -346,16 +288,10 @@ class ProcessOrderImporter extends Importer
|
||||
}
|
||||
} else {
|
||||
$coilNo = '0';
|
||||
// $existing = ProcessOrder::where('plant_id', $plantId)
|
||||
// ->where('process_order', $processOrder)
|
||||
// // ->where('coil_number', $coilNo)
|
||||
// ->first();
|
||||
|
||||
if ($existing) {
|
||||
$existUpdateOrdQuan = $existing->updated_order_quantity;
|
||||
} else {
|
||||
$existUpdateOrdQuan = $updatedOrderQuan;
|
||||
}
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
// ->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if (! $existing && ($coilNo == '0' || $coilNo == 0)) {
|
||||
ProcessOrder::create([
|
||||
@@ -365,7 +301,6 @@ class ProcessOrderImporter extends Importer
|
||||
'process_order' => $processOrder,
|
||||
'coil_number' => '0',
|
||||
'order_quantity' => $orderQuan,
|
||||
'updated_order_quantity' => $existUpdateOrdQuan,
|
||||
'received_quantity' => 0,
|
||||
'scrap_quantity' => 0,
|
||||
'created_by' => $createdBy,
|
||||
@@ -380,7 +315,6 @@ class ProcessOrderImporter extends Importer
|
||||
'process_order' => $processOrder,
|
||||
'coil_number' => $coilNo,
|
||||
'order_quantity' => $orderQuan,
|
||||
'updated_order_quantity' => $existUpdateOrdQuan,
|
||||
'received_quantity' => $recQuan,
|
||||
'scrap_quantity' => $scrapQuan ?? 0,
|
||||
'sfg_number' => $sfgNo,
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\StockDataMaster;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
|
||||
class StockDataMasterImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = StockDataMaster::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('PLANT CODE')
|
||||
->examples(['1000', '1000'])
|
||||
->label('PLANT CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('type')
|
||||
->requiredMapping()
|
||||
->exampleHeader('TYPE')
|
||||
->examples(['FG', 'NON-FG'])
|
||||
->label('TYPE'),
|
||||
ImportColumn::make('location')
|
||||
->requiredMapping()
|
||||
->exampleHeader('LOCATION')
|
||||
->examples(['2001', '2002'])
|
||||
->label('LOCATION')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item_reference')
|
||||
->requiredMapping()
|
||||
->exampleHeader('ITEM CODE')
|
||||
->examples(['123456', '246118'])
|
||||
->label('ITEM CODE')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('SERIAL NUMBER')
|
||||
->examples(['200235236622', '200235236623'])
|
||||
->label('SERIAL NUMBER'),
|
||||
ImportColumn::make('batch')
|
||||
->requiredMapping()
|
||||
->exampleHeader('BATCH')
|
||||
->examples(['20102', '20103'])
|
||||
->label('BATCH'),
|
||||
ImportColumn::make('quantity')
|
||||
->requiredMapping()
|
||||
->exampleHeader('QUANTITY')
|
||||
->examples(['1', '1'])
|
||||
->label('QUANTITY'),
|
||||
ImportColumn::make('doc_no')
|
||||
->requiredMapping()
|
||||
->exampleHeader('DOCUMENT NUMBER')
|
||||
->examples(['82128', '21222'])
|
||||
->label('DOCUMENT NUMBER'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?StockDataMaster
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantId = null;
|
||||
$stickId = null;
|
||||
|
||||
$plantCod = $this->data['plant'];
|
||||
$typeValue = $this->data['type'];
|
||||
$iCode = trim($this->data['item_reference']) ?? null;
|
||||
$location = trim($this->data['location']) ?? null;
|
||||
$serialNumber = trim($this->data['serial_number']) ?? null;
|
||||
$batch = trim($this->data['batch']) ?? null;
|
||||
$quantity = trim($this->data['quantity']) ?? null;
|
||||
$docNo = trim($this->data['doc_no']) ?? null;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
|
||||
$operatorName = $user->name;
|
||||
|
||||
if ($plantCod == null || $plantCod == '') {
|
||||
$warnMsg[] = "Plant code can't be empty!";
|
||||
} elseif ($typeValue == null || $typeValue == '') {
|
||||
$warnMsg[] = "Type can't be empty!";
|
||||
} elseif ($iCode == null || $iCode == '') {
|
||||
$warnMsg[] = "Item code can't be empty!";
|
||||
} elseif ($location == null || $location == '') {
|
||||
$warnMsg[] = "Location can't be empty!";
|
||||
} elseif ($serialNumber == null || $serialNumber == '') {
|
||||
$warnMsg[] = "Serial number can't be empty!";
|
||||
}
|
||||
// else if ($batch == null || $batch == '') {
|
||||
// $warnMsg[] = "Batch can't be empty!";
|
||||
// }
|
||||
elseif ($quantity == null || $quantity == '') {
|
||||
$warnMsg[] = "Quantity can't be empty!";
|
||||
}
|
||||
// else if ($docNo == null || $docNo == '') {
|
||||
// $warnMsg[] = "Doc No can't be empty!";
|
||||
// }
|
||||
|
||||
if (Str::length($plantCod) > 0 && (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod))) {
|
||||
$warnMsg[] = 'Invalid plant code found!';
|
||||
} elseif (Str::length($plantCod) > 0) {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant code not found!';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($iCode) > 0 && (Str::length($iCode) < 6 || ! ctype_alnum($iCode))) {
|
||||
$warnMsg[] = 'Invalid item code found!';
|
||||
} elseif ($plantId) {
|
||||
$itemCode = Item::where('code', $iCode)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found in item master!';
|
||||
} else {
|
||||
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found in item master for the given plant!';
|
||||
} else {
|
||||
$itemId = $itemCode->id;
|
||||
$itemCode = StickerMaster::where('item_id', $itemId)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found in sticker master!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$itemCode = StickerMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found in sticker master for the given plant!';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$typeValue = strtoupper($typeValue);
|
||||
|
||||
if (! in_array($typeValue, ['FG', 'NON-FG'])) {
|
||||
$warnMsg[] = 'Invalid type found! It should be either FG or NON-FG.';
|
||||
} elseif (Str::length($location) < 4) {
|
||||
$warnMsg[] = 'Location should contain minimum 4 digits!';
|
||||
} elseif (! ctype_digit((string) $location)) {
|
||||
$warnMsg[] = 'Location must be an integer!';
|
||||
} elseif (Str::length($serialNumber) < 9) {
|
||||
$warnMsg[] = 'Serial number should contain minimum 9 digits!';
|
||||
} elseif (! ctype_alnum($serialNumber)) {
|
||||
$warnMsg[] = 'Serial number should contain alpha-numeric values!';
|
||||
} elseif (! ctype_digit((string) $quantity) || (int) $quantity <= 0) {
|
||||
$warnMsg[] = 'Quantity must be an integer and greater than 0!';
|
||||
}
|
||||
|
||||
if ($batch) {
|
||||
if (Str::length($batch) < 5) {
|
||||
$warnMsg[] = 'Batch should contain minimum 5 digits!';
|
||||
}
|
||||
}
|
||||
|
||||
if ($docNo) {
|
||||
if (Str::length($docNo) < 5) {
|
||||
$warnMsg[] = 'Document number contain minimum 5 digits!';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
$type = match ($typeValue) {
|
||||
'FG' => '0',
|
||||
'NON-FG' => '1',
|
||||
default => null,
|
||||
};
|
||||
|
||||
$stickId = $itemCode->id;
|
||||
|
||||
$record = StockDataMaster::where([
|
||||
'plant_id' => $plantId,
|
||||
'sticker_master_id' => $stickId,
|
||||
'serial_number' => $serialNumber,
|
||||
])->first();
|
||||
|
||||
if ($record) {
|
||||
|
||||
$record->update([
|
||||
'type' => $type,
|
||||
'location' => $location ?? null,
|
||||
'batch' => $batch ?? null,
|
||||
'quantity' => $quantity ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
|
||||
} else {
|
||||
|
||||
StockDataMaster::create([
|
||||
'plant_id' => $plantId,
|
||||
'sticker_master_id' => $stickId,
|
||||
'type' => $type,
|
||||
'location' => $location ?? null,
|
||||
'serial_number' => $serialNumber ?? null,
|
||||
'batch' => $batch ?? null,
|
||||
'quantity' => $quantity ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
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.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,6 @@
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Filament\Widgets\CumulativeChart;
|
||||
use App\Filament\Widgets\ProductionQuantityStat;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
@@ -10,117 +9,64 @@ use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Widgets\Widget;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Dashboard extends \Filament\Pages\Dashboard
|
||||
{
|
||||
use HasFiltersForm;
|
||||
use HasFiltersForm;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-s-gift';
|
||||
protected static ?string $navigationGroup = 'Production DashBoard';
|
||||
|
||||
protected static string $view = 'filament.pages.dashboard';
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['selected_plant']);
|
||||
$this->filtersForm->fill([
|
||||
'plant' => null
|
||||
]);
|
||||
}
|
||||
|
||||
// public function mount(): void
|
||||
// {
|
||||
// session()->forget(['selected_plant']);
|
||||
// session()->forget(['from_date']);
|
||||
// session()->forget(['to_date']);
|
||||
// $this->filtersForm->fill([
|
||||
// 'plant' => null,
|
||||
// 'from_date' => null,
|
||||
// 'to_date' => null,
|
||||
// // 'success_status' => null
|
||||
// ]);
|
||||
// }
|
||||
public function filtersForm(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters') // Store form state in 'filters'
|
||||
->schema([
|
||||
Select::make('plant')
|
||||
->options(Plant::pluck('name', 'id'))
|
||||
->label('Select Plant')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state) {
|
||||
session(['selected_plant' => $state]); // fixed typo
|
||||
//$this->dispatch('cumulativeChart'); // custom Livewire event
|
||||
}),
|
||||
]);
|
||||
|
||||
// public function filtersForm(Form $form): Form
|
||||
// {
|
||||
// return $form
|
||||
// ->statePath('filters') // Store form state in 'filters'
|
||||
// ->schema([
|
||||
// Select::make('plant')
|
||||
// ->label('Select Plant')
|
||||
// ->reactive()
|
||||
// // ->options(Plant::pluck('name', 'id'))
|
||||
// ->options(function (callable $get) {
|
||||
// $userHas = Filament::auth()->user()->plant_id;
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
// })
|
||||
// ->afterStateUpdated(function ($state,callable $set) {
|
||||
// session(['selected_plant' => $state]); // fixed typo
|
||||
// //$this->dispatch('cumulativeChart'); // custom Livewire event
|
||||
// // Reset success_status whenever plant changes
|
||||
// $set('success_status', null);
|
||||
// session()->forget('success_status');
|
||||
// }),
|
||||
}
|
||||
|
||||
// // Select::make('success_status')
|
||||
// // ->label('Select Status')
|
||||
// // ->options([
|
||||
// // 'Ok' => 'Ok',
|
||||
// // 'Not Ok' => 'Not Ok',
|
||||
// // ])
|
||||
// // ->reactive()
|
||||
// // ->afterStateUpdated(function ($state) {
|
||||
// // session(['success_status' => $state]);
|
||||
// // }),
|
||||
|
||||
// DatePicker::make('created_from')
|
||||
// ->label('Created From')
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state,callable $set) {
|
||||
// session(['from_date' => $state]);
|
||||
// }),
|
||||
|
||||
// DatePicker::make('created_to')
|
||||
// ->label('Created To')
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state,callable $set) {
|
||||
// session(['to_date' => $state]);
|
||||
// }),
|
||||
|
||||
// ]);
|
||||
// }
|
||||
|
||||
|
||||
// public static function getNavigationLabel(): string
|
||||
// {
|
||||
// return 'Production Line Count';
|
||||
// }
|
||||
|
||||
// public function getHeading(): string
|
||||
// {
|
||||
// return 'Production Line Count';
|
||||
// }
|
||||
|
||||
// public function getWidgets(): array
|
||||
// {
|
||||
// $widgets = [];
|
||||
|
||||
// if (CumulativeChart::canView()) {
|
||||
// $widgets[] = CumulativeChart::class;
|
||||
|
||||
// }
|
||||
// return $widgets;
|
||||
// }
|
||||
|
||||
// public static function canAccess(): bool
|
||||
// {
|
||||
// return Auth::check() && Auth::user()->can('view production line count dashboard');
|
||||
// }
|
||||
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Welcome';
|
||||
return 'Production Line Count';
|
||||
}
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return 'Production Line Count';
|
||||
}
|
||||
|
||||
public function getWidgets(): array
|
||||
{
|
||||
$widgets = [];
|
||||
|
||||
if (CumulativeChart::canView()) {
|
||||
$widgets[] = CumulativeChart::class;
|
||||
}
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view production line count dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,124 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Filament\Widgets\CumulativeChart;
|
||||
use App\Filament\Widgets\ProductionQuantityStat;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Plant;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Widgets\Widget;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Welcome extends Page
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-s-gift'; // 'heroicon-o-document-text';
|
||||
|
||||
protected static string $view = 'filament.pages.welcome';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||
|
||||
use HasFiltersForm;
|
||||
|
||||
use InteractsWithForms;
|
||||
|
||||
protected static ?string $navigationGroup = 'Production DashBoard';
|
||||
|
||||
protected static ?string $slug = 'production-line-count';
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
session()->forget(['selected_plant']);
|
||||
// session()->forget(['from_date']);
|
||||
// session()->forget(['to_date']);
|
||||
$this->filtersForm->fill([
|
||||
'plant' => null,
|
||||
// 'from_date' => null,
|
||||
// 'to_date' => null,
|
||||
// 'success_status' => null
|
||||
]);
|
||||
}
|
||||
|
||||
public function filtersForm(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->statePath('filters')
|
||||
->schema([
|
||||
Select::make('plant')
|
||||
->label('Select Plant')
|
||||
->reactive()
|
||||
// ->options(Plant::pluck('name', 'id'))
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state,callable $set) {
|
||||
session(['selected_plant' => $state]);
|
||||
//$this->dispatch('cumulativeChart'); // custom Livewire event
|
||||
// Reset success_status whenever plant changes
|
||||
// $set('success_status', null);
|
||||
// session()->forget('success_status');
|
||||
}),
|
||||
|
||||
// Select::make('success_status')
|
||||
// ->label('Select Status')
|
||||
// ->options([
|
||||
// 'Ok' => 'Ok',
|
||||
// 'Not Ok' => 'Not Ok',
|
||||
// ])
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state) {
|
||||
// session(['success_status' => $state]);
|
||||
// }),
|
||||
|
||||
// DatePicker::make('created_from')
|
||||
// ->label('Created From')
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state,callable $set) {
|
||||
// session(['from_date' => $state]);
|
||||
// }),
|
||||
|
||||
// DatePicker::make('created_to')
|
||||
// ->label('Created To')
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state,callable $set) {
|
||||
// session(['to_date' => $state]);
|
||||
// }),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return 'Production Line Count';
|
||||
}
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
return 'Production Line Count';
|
||||
return '';
|
||||
}
|
||||
|
||||
// public function getWidgets(): array
|
||||
// public static function canAccess(): bool
|
||||
// {
|
||||
// $widgets = [];
|
||||
|
||||
// if (CumulativeChart::canView()) {
|
||||
// $widgets[] = CumulativeChart::class;
|
||||
|
||||
// }
|
||||
// return $widgets;
|
||||
// return Auth::check() && Auth::user()->can('view welcome page');
|
||||
// }
|
||||
|
||||
public static function canAccess(): bool
|
||||
{
|
||||
return Auth::check() && Auth::user()->can('view production line count dashboard');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,181 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\DuplicateStockResource\Pages;
|
||||
use App\Models\DuplicateStock;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class DuplicateStockResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DuplicateStock::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Cycle Count Software';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('stock_data_master_id')
|
||||
->relationship('stockDataMaster', 'id')
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.plant.name')
|
||||
->label('Plant Name')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.stickerMaster.item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.location')
|
||||
->label('Location')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.bin')
|
||||
->label('Bin')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.batch')
|
||||
->label('Batch')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.quantity')
|
||||
->label('Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.doc_no')
|
||||
->label('Document Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.type')
|
||||
->label('Type')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->formatStateUsing(fn ($state) => match ($state) {
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
default => '-',
|
||||
})
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.motor_scanned_status')
|
||||
->label('Motor Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.pump_scanned_status')
|
||||
->label('Pump Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.capacitor_scanned_status')
|
||||
->label('Capacitor Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.scanned_status_set')
|
||||
->label('Scanned Status Set')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stockDataMaster.scanned_status')
|
||||
->label('Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListDuplicateStocks::route('/'),
|
||||
'create' => Pages\CreateDuplicateStock::route('/create'),
|
||||
'view' => Pages\ViewDuplicateStock::route('/{record}'),
|
||||
'edit' => Pages\EditDuplicateStock::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DuplicateStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DuplicateStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateDuplicateStock extends CreateRecord
|
||||
{
|
||||
protected static string $resource = DuplicateStockResource::class;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DuplicateStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DuplicateStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditDuplicateStock extends EditRecord
|
||||
{
|
||||
protected static string $resource = DuplicateStockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DuplicateStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DuplicateStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListDuplicateStocks extends ListRecords
|
||||
{
|
||||
protected static string $resource = DuplicateStockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\DuplicateStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\DuplicateStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewDuplicateStock extends ViewRecord
|
||||
{
|
||||
protected static string $resource = DuplicateStockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,284 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\NotInStockExporter;
|
||||
use App\Filament\Imports\NotInStockImporter;
|
||||
use App\Filament\Resources\NotInStockResource\Pages;
|
||||
use App\Models\NotInStock;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
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\ImportAction;
|
||||
|
||||
|
||||
class NotInStockResource extends Resource
|
||||
{
|
||||
protected static ?string $model = NotInStock::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Cycle Count Software';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
Forms\Components\Select::make('sticker_master_id')
|
||||
->label('Item Code')
|
||||
->reactive()
|
||||
->required()
|
||||
->searchable()
|
||||
->options(function ($get) {
|
||||
if (! $get('plant_id')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return StickerMaster::with('item')
|
||||
->where('plant_id', $get('plant_id'))
|
||||
->get()
|
||||
->pluck('item.code', 'id')
|
||||
->toArray();
|
||||
}),
|
||||
Forms\Components\TextInput::make('location')
|
||||
->label('Location'),
|
||||
Forms\Components\TextInput::make('bin')
|
||||
->label('Bin'),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number'),
|
||||
Forms\Components\TextInput::make('batch')
|
||||
->label('Batch'),
|
||||
Forms\Components\TextInput::make('quantity')
|
||||
->label('Quantity'),
|
||||
Forms\Components\TextInput::make('doc_no')
|
||||
->label('Doc No'),
|
||||
Forms\Components\Select::make('type')
|
||||
->label('Type')
|
||||
->options([
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
]),
|
||||
Forms\Components\TextInput::make('motor_scanned_status')
|
||||
->label('Motor Scanned Status'),
|
||||
Forms\Components\TextInput::make('pump_scanned_status')
|
||||
->label('Pump Scanned Status'),
|
||||
Forms\Components\TextInput::make('capacitor_scanned_status')
|
||||
->label('Capacitor Scanned Status'),
|
||||
Forms\Components\TextInput::make('scanned_status_set')
|
||||
->label('Scanned Status Set'),
|
||||
Forms\Components\TextInput::make('panel_box_item_code')
|
||||
->label('Panel Box Item Code'),
|
||||
Forms\Components\TextInput::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier'),
|
||||
Forms\Components\TextInput::make('panel_box_sno')
|
||||
->label('Panel Box Sno'),
|
||||
Forms\Components\TextInput::make('scanned_status')
|
||||
->label('Scanned Status'),
|
||||
Forms\Components\TextInput::make('scanned_quantity')
|
||||
->label('Scanned Quantity'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stickerMaster.item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('type')
|
||||
->label('Type')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->formatStateUsing(fn ($state) => match ($state) {
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
default => '-',
|
||||
})
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('location')
|
||||
->label('Location')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('bin')
|
||||
->label('Bin')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('batch')
|
||||
->label('Batch')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('quantity')
|
||||
->label('Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('doc_no')
|
||||
->label('Document Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('motor_scanned_status')
|
||||
->label('Motor Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('pump_scanned_status')
|
||||
->label('Pump Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('capacitor_scanned_status')
|
||||
->label('Capacitor Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('scanned_status_set')
|
||||
->label('Scanned Status Set')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('panel_box_item_code')
|
||||
->label('Panel Box Item Code')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('panel_box_sno')
|
||||
->label('Panel Box Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('scanned_quantity')
|
||||
->label('Scanned Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Not In Stock')
|
||||
->color('warning')
|
||||
->importer(NotInStockImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import not in stock');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Not In Stock')
|
||||
->color('warning')
|
||||
->exporter(NotInStockExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export not in stock');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListNotInStocks::route('/'),
|
||||
'create' => Pages\CreateNotInStock::route('/create'),
|
||||
'view' => Pages\ViewNotInStock::route('/{record}'),
|
||||
'edit' => Pages\EditNotInStock::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\NotInStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\NotInStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateNotInStock extends CreateRecord
|
||||
{
|
||||
protected static string $resource = NotInStockResource::class;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\NotInStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\NotInStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditNotInStock extends EditRecord
|
||||
{
|
||||
protected static string $resource = NotInStockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\NotInStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\NotInStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListNotInStocks extends ListRecords
|
||||
{
|
||||
protected static string $resource = NotInStockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\NotInStockResource\Pages;
|
||||
|
||||
use App\Filament\Resources\NotInStockResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewNotInStock extends ViewRecord
|
||||
{
|
||||
protected static string $resource = NotInStockResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,6 @@ class ProcessOrderResource extends Resource
|
||||
$set('process_order', null);
|
||||
$set('coil_number', '0');
|
||||
$set('order_quantity', '0');
|
||||
$set('updated_order_quantity', '0');
|
||||
$set('received_quantity', '0');
|
||||
$set('scrap_quantity', '0');
|
||||
$set('sfg_number', null);
|
||||
@@ -114,7 +113,6 @@ class ProcessOrderResource extends Resource
|
||||
$set('process_order', null);
|
||||
$set('coil_number', '0');
|
||||
$set('order_quantity', '0');
|
||||
$set('updated_order_quantity', '0');
|
||||
$set('received_quantity', '0');
|
||||
$set('scrap_quantity', '0');
|
||||
$set('sfg_number', null);
|
||||
@@ -143,7 +141,6 @@ class ProcessOrderResource extends Resource
|
||||
$set('process_order', null);
|
||||
$set('coil_number', '0');
|
||||
$set('order_quantity', '0');
|
||||
$set('updated_order_quantity', '0');
|
||||
$set('received_quantity', '0');
|
||||
$set('scrap_quantity', '0');
|
||||
$set('sfg_number', null);
|
||||
@@ -220,7 +217,6 @@ class ProcessOrderResource extends Resource
|
||||
$plantId = $get('plant_id');
|
||||
$set('coil_number', '0');
|
||||
$set('order_quantity', '0');
|
||||
$set('updated_order_quantity', '0');
|
||||
$set('received_quantity', '0');
|
||||
$set('scrap_quantity', '0');
|
||||
$set('sfg_number', null);
|
||||
@@ -284,10 +280,10 @@ class ProcessOrderResource extends Resource
|
||||
->required()
|
||||
->reactive()
|
||||
->numeric()
|
||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$processOrder = trim($get('process_order'));
|
||||
$processOrder = $get('process_order');
|
||||
// $coilNo = $get('coil_number');
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
@@ -323,29 +319,14 @@ class ProcessOrderResource extends Resource
|
||||
function (callable $get) {
|
||||
return Rule::unique('process_orders', 'coil_number')
|
||||
->where('plant_id', $get('plant_id'))
|
||||
->where('process_order', trim($get('process_order')))
|
||||
->where('process_order', $get('process_order'))
|
||||
->ignore($get('id'));
|
||||
},
|
||||
function (callable $get): Closure {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
$rework = $get('rework_status');
|
||||
$plantId = $get('plant_id');
|
||||
$processOrder = trim($get('process_order'));
|
||||
|
||||
if ($value && Str::contains($value, '.')) {
|
||||
if ($rework == 0) {
|
||||
$fail("Rework status should be 'Yes' for rework coil number '{$value}'!");
|
||||
}
|
||||
} elseif ($value > 1) {
|
||||
$prevCoilNo = (string) ($value - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $prevCoilNo)
|
||||
->first();
|
||||
|
||||
if (! $existPrevCoil) {
|
||||
$fail("Previous coil number '{$prevCoilNo}' not exist against plant and process order!");
|
||||
}
|
||||
if ($value && Str::contains($value, '.') && $rework == 0) {
|
||||
$fail("Rework status should be 'Yes' for rework coil number '{$value}'!");
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -353,7 +334,7 @@ class ProcessOrderResource extends Resource
|
||||
// ->rule(function (callable $get) {
|
||||
// return Rule::unique('process_orders', 'coil_number')
|
||||
// ->where('plant_id', $get('plant_id'))
|
||||
// ->where('process_order', trim($get('process_order')))
|
||||
// ->where('process_order', $get('process_order'))
|
||||
// ->ignore($get('id'));
|
||||
// })
|
||||
->extraAttributes(fn ($get) => [
|
||||
@@ -367,17 +348,15 @@ class ProcessOrderResource extends Resource
|
||||
->required()
|
||||
->reactive()
|
||||
->numeric()
|
||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$plantId = $get('plant_id');
|
||||
$itemId = $get('item_id');
|
||||
$processOrder = trim($get('process_order'));
|
||||
$set('received_quantity', '0');
|
||||
// $set('updated_order_quantity', $state);
|
||||
$set('scrap_quantity', '0');
|
||||
if (! $plantId || ! $itemId || ! $processOrder) {
|
||||
$set('order_quantity', '0');
|
||||
$set('updated_order_quantity', '0');
|
||||
}
|
||||
|
||||
$query = ProcessOrder::where('plant_id', $plantId)
|
||||
@@ -393,175 +372,13 @@ class ProcessOrderResource extends Resource
|
||||
}
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
Forms\Components\TextInput::make('updated_order_quantity')
|
||||
->label('Updated Order Quantity')
|
||||
->required()
|
||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == '' || trim($get('order_quantity')) == '' || trim($get('order_quantity')) == null))
|
||||
->reactive()
|
||||
->rules([
|
||||
function (callable $get): Closure {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
$plantId = $get('plant_id');
|
||||
$processOrder = trim($get('process_order'));
|
||||
$receivedQty = $get('received_quantity');
|
||||
|
||||
$currentId = $get('id');
|
||||
|
||||
$orderQty = (float) $get('order_quantity');
|
||||
$updatedQty = (float) $value;
|
||||
|
||||
$allowedVariance = $orderQty * 0.10;
|
||||
|
||||
$maxAllowed = $orderQty + $allowedVariance;
|
||||
$minAllowed = $orderQty - $allowedVariance;
|
||||
|
||||
if ($updatedQty > $maxAllowed || $updatedQty < $minAllowed) {
|
||||
$fail('Quantity can vary by ±10% of the order quantity.');
|
||||
}
|
||||
|
||||
$otherReceivedQty = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->when($currentId, fn ($q) => $q->where('id', '!=', $currentId))
|
||||
->sum('received_quantity');
|
||||
|
||||
$currentReceivedQty = (float) $get('received_quantity');
|
||||
|
||||
$totalReceivedQty = $otherReceivedQty + $currentReceivedQty;
|
||||
|
||||
if ($updatedQty < $totalReceivedQty) {
|
||||
$fail("You cannot set quantity below received quantity ({$totalReceivedQty}).");
|
||||
}
|
||||
};
|
||||
},
|
||||
]),
|
||||
Forms\Components\TextInput::make('received_quantity')
|
||||
->label('Received Quantity')
|
||||
->default('0.000')
|
||||
->required()
|
||||
->reactive()
|
||||
->numeric()
|
||||
->maxValue(fn (Get $get) => $get('order_quantity') ?? PHP_INT_MAX)
|
||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||
->rule(function (callable $get) {
|
||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||
$rework = $get('rework_status');
|
||||
$plantId = $get('plant_id');
|
||||
$lineId = $get('line_id');
|
||||
$itemId = $get('item_id');
|
||||
$processOrder = trim($get('process_order'));
|
||||
$coilNo = trim($get('coil_number'));
|
||||
|
||||
$orderExist = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)->latest()->first();
|
||||
|
||||
if ($orderExist) {
|
||||
// $orderQty = $orderExist->order_quantity ?? 0;
|
||||
$orderQty = $orderExist->updated_order_quantity ?? 0;
|
||||
|
||||
$alreadyReceived = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)
|
||||
->sum('received_quantity');
|
||||
|
||||
$total = $alreadyReceived + $value;
|
||||
|
||||
if ($rework == 1) {
|
||||
if ($coilNo && Str::contains($coilNo, '.')) {
|
||||
$coilMain = explode('.', $coilNo)[0];
|
||||
|
||||
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('line_id', $lineId)
|
||||
->where('coil_number', $coilMain)
|
||||
->first();
|
||||
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existPrevCoil && $existPrevCoil->received_quantity < $value) {
|
||||
$fail('Rework received quantity should not exceed exist received quantity!');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($existingCoil && $existingCoil->rework_status == 1 && $total > $orderQty) {
|
||||
$fail("Rework received quantity should not exceed exist order quantity! Already Exist Total Received Qty = '{$alreadyReceived}'.");
|
||||
}
|
||||
} else {
|
||||
if ($coilNo > 1) {
|
||||
$prevCoilNo = (string) ($coilNo - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $prevCoilNo)
|
||||
->first();
|
||||
|
||||
if (! $existPrevCoil) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('line_id', $lineId)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if (! $existingCoil) {
|
||||
return;
|
||||
}
|
||||
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existPrevCoil && $existPrevCoil->received_quantity < $value) {
|
||||
$fail('Rework received quantity should not exceed exist received quantity!');
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($coilNo && Str::contains($coilNo, '.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
if ($existing) {
|
||||
if ($existing->received_quantity < $value) {
|
||||
$fail('Received quantity should not exceed exist received quantity!'); // Exist Received Qty = '{$existing->received_quantity}'.
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($coilNo > 1) {
|
||||
$prevCoilNo = (string) ($coilNo - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $prevCoilNo)
|
||||
->first();
|
||||
|
||||
if (! $existPrevCoil) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($total > $orderQty) {
|
||||
$fail("Received quantity should not exceed exist order quantity! Already Exist Total Received Qty = '{$alreadyReceived}'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('scrap_quantity', '0');
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
@@ -570,7 +387,7 @@ class ProcessOrderResource extends Resource
|
||||
->label('Scrap Quantity')
|
||||
->default('0.000')
|
||||
->required()
|
||||
->readOnly(fn ($get) => ($get('rework_status') == 0 || trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||
->readOnly(fn ($get) => ($get('rework_status') == 0 || $get('process_order') == null))
|
||||
->reactive()
|
||||
->numeric()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
@@ -597,7 +414,7 @@ class ProcessOrderResource extends Resource
|
||||
Forms\Components\TextInput::make('sfg_number')
|
||||
->label('SFG Number')
|
||||
->reactive()
|
||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$sfgNo = $get('sfg_number');
|
||||
@@ -631,8 +448,7 @@ class ProcessOrderResource extends Resource
|
||||
Forms\Components\TextInput::make('machine_name')
|
||||
->label('Machine Name')
|
||||
->reactive()
|
||||
->maxLength(18)
|
||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
}),
|
||||
@@ -760,7 +576,7 @@ class ProcessOrderResource extends Resource
|
||||
}
|
||||
|
||||
// Get the value of process_order field
|
||||
$processOrder = trim($get('process_order'));
|
||||
$processOrder = $get('process_order');
|
||||
|
||||
if ($batchId != $processOrder) {
|
||||
Notification::make()
|
||||
@@ -805,7 +621,7 @@ class ProcessOrderResource extends Resource
|
||||
return Filament::auth()->user()->can('view process order packing slip');
|
||||
})
|
||||
->action(function ($get, callable $set) {
|
||||
$equipmentNumber = trim($get('process_order'));
|
||||
$equipmentNumber = $get('process_order');
|
||||
$set('updated_by', Filament::auth()->user()?->name);
|
||||
|
||||
if (! $equipmentNumber) {
|
||||
@@ -904,11 +720,6 @@ class ProcessOrderResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('updated_order_quantity')
|
||||
->label('Updated Order Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('received_quantity')
|
||||
->label('Received Quantity')
|
||||
->alignCenter()
|
||||
@@ -1253,7 +1064,7 @@ class ProcessOrderResource extends Resource
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant');
|
||||
$itemId = $get('Item');
|
||||
$processOrder = trim($get('process_order'));
|
||||
$processOrder = $get('process_order');
|
||||
|
||||
if (empty($plantId) || empty($itemId) || empty($processOrder)) {
|
||||
return [];
|
||||
@@ -1270,7 +1081,7 @@ class ProcessOrderResource extends Resource
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant');
|
||||
$itemId = $get('Item');
|
||||
$processOrder = trim($get('process_order'));
|
||||
$processOrder = $get('process_order');
|
||||
|
||||
if (! $plantId || ! $itemId || ! $processOrder || ! $state) {
|
||||
$set('received_quantity', null);
|
||||
|
||||
@@ -3,28 +3,10 @@
|
||||
namespace App\Filament\Resources\ProcessOrderResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ProcessOrderResource;
|
||||
use App\Models\ProcessOrder;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateProcessOrder extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ProcessOrderResource::class;
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
$plantId = $this->data['plant_id'];
|
||||
$processOrder = $this->data['process_order'];
|
||||
$updatedQty = (float) $this->data['updated_order_quantity'];
|
||||
|
||||
ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->update([
|
||||
'updated_order_quantity' => $updatedQty,
|
||||
'updated_by' => Filament::auth()->user()->name,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,78 +3,13 @@
|
||||
namespace App\Filament\Resources\ProcessOrderResource\Pages;
|
||||
|
||||
use App\Filament\Resources\ProcessOrderResource;
|
||||
use App\Models\ProcessOrder;
|
||||
use Filament\Actions;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditProcessOrder extends EditRecord
|
||||
{
|
||||
protected static string $resource = ProcessOrderResource::class;
|
||||
|
||||
protected function beforeSave(): void
|
||||
{
|
||||
$plantId = $this->data['plant_id'] ?? null;
|
||||
$processOrder = $this->data['process_order'] ?? null;
|
||||
$extraQty = (float) ($this->data['updated_order_quantity'] ?? 0);
|
||||
$extraQtyRaw = $this->data['updated_order_quantity'] ?? '';
|
||||
|
||||
if (!preg_match('/^\d+(\.\d{1,3})?$/', $extraQtyRaw)) {
|
||||
Notification::make()
|
||||
->title('Invalid Quantity')
|
||||
->body('Only positive numbers with up to 3 decimal places are allowed.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->halt(); // stop save
|
||||
}
|
||||
|
||||
if ($extraQty < 0)
|
||||
{
|
||||
Notification::make()
|
||||
->title('Invalid Quantity')
|
||||
->body('Negative values are not allowed.')
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->halt();
|
||||
}
|
||||
|
||||
if ($extraQty > 0) {
|
||||
|
||||
$order = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->first();
|
||||
|
||||
if ($order) {
|
||||
|
||||
$baseQty = (float) $order->order_quantity;
|
||||
$maxAllowed = $baseQty * 0.10;
|
||||
|
||||
$maxFinalQty = $baseQty + $maxAllowed;
|
||||
|
||||
if ($extraQty > $maxFinalQty) {
|
||||
Notification::make()
|
||||
->title('Limit Exceeded')
|
||||
->body("You can only increase the order by 10% (Max allowed: {$maxFinalQty}).")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
$this->halt(); // stops save
|
||||
}
|
||||
|
||||
ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->update([
|
||||
'updated_order_quantity' => $extraQty,
|
||||
'updated_by' => Filament::auth()->user()?->name,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -1,600 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\StockDataMasterExporter;
|
||||
use App\Filament\Imports\StockDataMasterImporter;
|
||||
use App\Filament\Resources\StockDataMasterResource\Pages;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\StockDataMaster;
|
||||
use Filament\Facades\Filament;
|
||||
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\Notifications\Notification;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class StockDataMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StockDataMaster::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Cycle Count Software';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->reactive()
|
||||
->relationship('plant', 'name')
|
||||
->required(),
|
||||
Forms\Components\Select::make('sticker_master_id')
|
||||
->label('Item Code')
|
||||
->reactive()
|
||||
->required()
|
||||
->searchable()
|
||||
->options(function ($get) {
|
||||
if (! $get('plant_id')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return StickerMaster::with('item')
|
||||
->where('plant_id', $get('plant_id'))
|
||||
->get()
|
||||
->pluck('item.code', 'id')
|
||||
->toArray();
|
||||
}),
|
||||
Forms\Components\TextInput::make('location')
|
||||
->label('Location'),
|
||||
Forms\Components\TextInput::make('bin')
|
||||
->label('Bin'),
|
||||
Forms\Components\TextInput::make('serial_number')
|
||||
->label('Serial Number'),
|
||||
Forms\Components\TextInput::make('batch')
|
||||
->label('Batch'),
|
||||
Forms\Components\TextInput::make('quantity')
|
||||
->label('Quantity'),
|
||||
Forms\Components\TextInput::make('doc_no')
|
||||
->label('Doc No'),
|
||||
Forms\Components\Select::make('type')
|
||||
->label('Type')
|
||||
->options([
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
]),
|
||||
Forms\Components\TextInput::make('motor_scanned_status')
|
||||
->label('Motor Scanned Status'),
|
||||
Forms\Components\TextInput::make('pump_scanned_status')
|
||||
->label('Pump Scanned Status'),
|
||||
Forms\Components\TextInput::make('capacitor_scanned_status')
|
||||
->label('Capacitor Scanned Status'),
|
||||
Forms\Components\TextInput::make('scanned_status_set')
|
||||
->label('Scanned Status Set'),
|
||||
Forms\Components\TextInput::make('panel_box_item_code')
|
||||
->label('Panel Box Item Code'),
|
||||
Forms\Components\TextInput::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier'),
|
||||
Forms\Components\TextInput::make('panel_box_sno')
|
||||
->label('Panel Box Sno'),
|
||||
Forms\Components\TextInput::make('scanned_status')
|
||||
->label('Scanned Status'),
|
||||
Forms\Components\TextInput::make('scanned_quantity')
|
||||
->label('Scanned Quantity'),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('stickerMaster.item.code')
|
||||
->label('Item Code')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('type')
|
||||
->label('Type')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->formatStateUsing(fn ($state) => match ($state) {
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
default => '-',
|
||||
})
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('location')
|
||||
->label('Location')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('bin')
|
||||
->label('Bin')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('batch')
|
||||
->label('Batch')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('quantity')
|
||||
->label('Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('doc_no')
|
||||
->label('Document Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('motor_scanned_status')
|
||||
->label('Motor Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('pump_scanned_status')
|
||||
->label('Pump Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('capacitor_scanned_status')
|
||||
->label('Capacitor Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('scanned_status_set')
|
||||
->label('Scanned Status Set')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('panel_box_item_code')
|
||||
->label('Panel Box Item Code')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||
->label('Panel Box Supplier')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('panel_box_sno')
|
||||
->label('Panel Box Serial Number')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable()
|
||||
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||
Tables\Columns\TextColumn::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('scanned_quantity')
|
||||
->label('Scanned Quantity')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('system_stock')
|
||||
->label('System Stock')
|
||||
->alignCenter()
|
||||
->getStateUsing(fn ($record) => $record->quantity),
|
||||
Tables\Columns\TextColumn::make('scanned_stock')
|
||||
->label('Scanned Stock')
|
||||
->alignCenter()
|
||||
->getStateUsing(fn ($record) => $record->scanned_quantity),
|
||||
Tables\Columns\TextColumn::make('duplicate_stock')
|
||||
->label('Duplicate Stock')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record) {
|
||||
return \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('not_in_stock')
|
||||
->label('Not In Stock')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record) {
|
||||
return \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('physical_stock')
|
||||
->label('Physical Stock')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record) {
|
||||
|
||||
$duplicate = \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
|
||||
$notInStock = \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
|
||||
$scanned = $record->scanned_quantity ?? 0;
|
||||
|
||||
return $scanned + $duplicate + $notInStock;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('stock_difference')
|
||||
->label('Stock Difference Count')
|
||||
->alignCenter()
|
||||
->getStateUsing(function ($record) {
|
||||
|
||||
$duplicate = \App\Models\DuplicateStock::where('stock_data_master_id', $record->id)->count();
|
||||
|
||||
$notInStock = \App\Models\NotInStock::where('serial_number', $record->serial_number)
|
||||
->where('plant_id', $record->plant_id)
|
||||
->count();
|
||||
|
||||
$scanned = (int) $record->scanned_quantity;
|
||||
|
||||
$physicalStock = $scanned + $duplicate + $notInStock;
|
||||
|
||||
$systemStock = (int) $record->quantity;
|
||||
|
||||
$difference = $physicalStock - $systemStock;
|
||||
|
||||
return max($difference, 0); // prevents negative values
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Radio::make('type')
|
||||
->label('Stock Type')
|
||||
->options([
|
||||
'0' => 'FG',
|
||||
'1' => 'NON-FG',
|
||||
])
|
||||
->inline()
|
||||
->default('0')
|
||||
->nullable(),
|
||||
Select::make('Plant')
|
||||
->label('Select Plant')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
return Plant::whereHas('stockDataMasters', function ($query) {
|
||||
$query->whereNotNull('id');
|
||||
})->orderBy('code')->pluck('name', 'id');
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get): void {
|
||||
$set('sticker_master_id', null);
|
||||
$set('updated_by', null);
|
||||
}),
|
||||
TextInput::make('location')
|
||||
->label('Location')
|
||||
->placeholder(placeholder: 'Enter Location'),
|
||||
TextInput::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->placeholder(placeholder: 'Enter Serial Number'),
|
||||
Select::make('sticker_master_id')
|
||||
->label('Search by Item Code')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$pId = $get('Plant');
|
||||
|
||||
if (empty($pId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::whereHas('stickerMasters', function ($query) use ($pId) {
|
||||
if ($pId) {
|
||||
$query->where('plant_id', $pId);
|
||||
}
|
||||
// $query->whereHas('stockDataMasters');
|
||||
})->pluck('code', 'id');
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('scanned_status')
|
||||
->label('Scanned Status')
|
||||
->nullable()
|
||||
->options([
|
||||
'Scanned' => 'Scanned',
|
||||
'Pending' => 'Pending',
|
||||
])
|
||||
->searchable()
|
||||
->reactive(),
|
||||
Select::make('updated_by')
|
||||
->label('Created By')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
if (! $plantId) {
|
||||
return StockDataMaster::whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
} else {
|
||||
return StockDataMaster::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||
}
|
||||
})
|
||||
->searchable()
|
||||
->reactive(),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->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 (empty($data['type'])) {
|
||||
Notification::make()
|
||||
->title('Please, choose valid type to filter.')
|
||||
->danger()
|
||||
->send();
|
||||
}
|
||||
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if ($data['type'] != '') {
|
||||
|
||||
if ($data['type'] == '0') {
|
||||
|
||||
$query->where('type', '0');
|
||||
|
||||
if (! empty($data['scanned_status'])) {
|
||||
|
||||
if ($data['scanned_status'] == 'Scanned') {
|
||||
$query->whereNotNull('scanned_status')
|
||||
->where('scanned_status', '!=', '');
|
||||
} elseif ($data['scanned_status'] == 'Pending') {
|
||||
|
||||
$query->where(function ($query) {
|
||||
$query->whereNull('scanned_status')
|
||||
->orWhere('scanned_status', '!=', 'Scanned');
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
} elseif ($data['type'] == '1') {
|
||||
$query->where('type', '1')
|
||||
->whereNotNull('quantity');
|
||||
|
||||
if ($data['scanned_status']) {
|
||||
|
||||
if ($data['scanned_status'] == 'Scanned') {
|
||||
|
||||
$query->whereNotNull('scanned_status')
|
||||
->where('scanned_status', '!=', '');
|
||||
|
||||
} elseif ($data['scanned_status'] == 'Pending') {
|
||||
|
||||
$query->where(function ($q) {
|
||||
$q->whereNull('scanned_status')
|
||||
->orWhere('scanned_status', '!=', 'Scanned');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($data['scanned_status']) {
|
||||
|
||||
if ($data['scanned_status'] == 'Scanned') {
|
||||
|
||||
$query->whereNotNull('scanned_status')
|
||||
->where('scanned_status', '!=', '');
|
||||
|
||||
} elseif ($data['scanned_status'] == 'Pending') {
|
||||
|
||||
$query->where(function ($q) {
|
||||
$q->whereNull('scanned_status')
|
||||
->orWhere('scanned_status', '!=', 'Scanned');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['Plant'])) { // $plant = $data['Plant'] ?? null
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['location'])) {
|
||||
$query->where('location', 'like', '%'.$data['location'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$query->where('serial_number', 'like', '%'.$data['serial_number'].'%');
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$query->where('updated_by', $data['updated_by']);
|
||||
}
|
||||
|
||||
if (! empty($data['sticker_master_id'])) {
|
||||
$stickerMasterIds = StickerMaster::where('item_id', $data['sticker_master_id'])
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
|
||||
if (! empty($stickerMasterIds)) {
|
||||
$query->whereIn('sticker_master_id', $stickerMasterIds);
|
||||
}
|
||||
}
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (! empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: '.Plant::where('id', $data['Plant'])->value('name');
|
||||
} else {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return 'Plant: Choose plant to filter records.';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($data['location'])) {
|
||||
$indicators[] = 'Location: '.$data['location'];
|
||||
}
|
||||
|
||||
if (! empty($data['serial_number'])) {
|
||||
$indicators[] = 'Serial Number: '.$data['serial_number'];
|
||||
}
|
||||
|
||||
if (! empty($data['sticker_master_id'])) {
|
||||
$itemCode = Item::find($data['sticker_master_id'])->code ?? 'Unknown';
|
||||
$indicators[] = 'Item Code: '.$itemCode;
|
||||
}
|
||||
|
||||
if (! empty($data['updated_by'])) {
|
||||
$indicators[] = 'Created By: '.$data['updated_by'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_from'])) {
|
||||
$indicators[] = 'From: '.$data['created_from'];
|
||||
}
|
||||
|
||||
if (! empty($data['created_to'])) {
|
||||
$indicators[] = 'To: '.$data['created_to'];
|
||||
}
|
||||
|
||||
if (! empty($data['scanned_status'])) {
|
||||
$indicators[] = 'Scanned Status: '.$data['scanned_status'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
}),
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->label('Import Stock Data')
|
||||
->color('warning')
|
||||
->importer(StockDataMasterImporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import stock data master');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->label('Export Stock Data')
|
||||
->color('warning')
|
||||
->exporter(StockDataMasterExporter::class)
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export stock data master');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStockDataMasters::route('/'),
|
||||
'create' => Pages\CreateStockDataMaster::route('/create'),
|
||||
'view' => Pages\ViewStockDataMaster::route('/{record}'),
|
||||
'edit' => Pages\EditStockDataMaster::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StockDataMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StockDataMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStockDataMaster extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StockDataMasterResource::class;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StockDataMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StockDataMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStockDataMaster extends EditRecord
|
||||
{
|
||||
protected static string $resource = StockDataMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StockDataMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StockDataMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStockDataMasters extends ListRecords
|
||||
{
|
||||
protected static string $resource = StockDataMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\StockDataMasterResource\Pages;
|
||||
|
||||
use App\Filament\Resources\StockDataMasterResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewStockDataMaster extends ViewRecord
|
||||
{
|
||||
protected static string $resource = StockDataMasterResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -627,7 +627,7 @@ class PdfController extends Controller
|
||||
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
|
||||
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
|
||||
'coil_number' => $currentCoil,
|
||||
'order_quantity' => (string) $lastRecord->updated_order_quantity ?? '0.000',
|
||||
'order_quantity' => (string) $lastRecord->order_quantity ?? '0.000',
|
||||
'ok_quantity' => (string) $okQty ?? '0',
|
||||
'not_ok_quantity' => (string) $notOkQty ?? '0',
|
||||
'received_quantity' => (string) (($totalReceivedQty == 0) ? '0.000' : $totalReceivedQty) ?? '0.000',
|
||||
@@ -686,7 +686,7 @@ class PdfController extends Controller
|
||||
$itemCode = $data['item_code'] ?? '';
|
||||
$lineName = $data['line_name'] ?? '';
|
||||
$coilNo = $data['coil_number'] ?? '';
|
||||
$updatedOrderQty = $data['order_quantity'] ?? 0;
|
||||
$orderQty = $data['order_quantity'] ?? 0;
|
||||
$receivedQty = $data['received_quantity'] ?? 0;
|
||||
$scrapQty = $data['scrap_quantity'] ?? 0;
|
||||
$sfgNo = $data['sfg_number'] ?? '';
|
||||
@@ -728,17 +728,6 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($scrapQty == null || $scrapQty == '') {
|
||||
$scrapQty = 0;
|
||||
}
|
||||
|
||||
if ($rework == null || $rework == '' || ! $rework) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework value can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$line = Line::where('name', $lineName)->first();
|
||||
|
||||
if (! $line) {
|
||||
@@ -872,8 +861,7 @@ class PdfController extends Controller
|
||||
->where('item_id', $itemId)
|
||||
->sum('received_quantity');
|
||||
|
||||
$orderQty = 0;
|
||||
if ($updatedOrderQty == 0) {
|
||||
if ($orderQty == 0) {
|
||||
$orderExist = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)->latest()->first();
|
||||
@@ -881,7 +869,6 @@ class PdfController extends Controller
|
||||
|
||||
if ($orderExist) {
|
||||
$orderQty = $orderExist->order_quantity ?? 0;
|
||||
$updatedOrderQty = $orderExist->updated_order_quantity ?? 0;
|
||||
} else {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -895,11 +882,9 @@ class PdfController extends Controller
|
||||
// ->value('order_quantity') ?? 0;
|
||||
|
||||
if ($orderExist) {
|
||||
// $existOrderQty = $orderExist->updated_order_quantity ?? 0;
|
||||
$orderQty = $orderExist->order_quantity ?? 0;
|
||||
$existUpdatedOrdQuan = $orderExist->updated_order_quantity ?? 0;
|
||||
$existOrderQty = $orderExist->order_quantity ?? 0;
|
||||
|
||||
if ($existUpdatedOrdQuan != $updatedOrderQty) {
|
||||
if ($existOrderQty != $orderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Order quantity doesn't equal to exist process order '{$processOrder}'",
|
||||
@@ -910,6 +895,20 @@ class PdfController extends Controller
|
||||
|
||||
$total = $alreadyReceived + $receivedQty;
|
||||
|
||||
if ($total > $orderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Received quantity should not exceed order quantity! Order Qty = {$orderQty}, Already Received Qty = {$alreadyReceived}, Trying to Insert Qty = {$receivedQty}",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($rework == null || $rework == '' || ! $rework) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework value can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($rework != 'Yes' && $rework != 'No') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -950,13 +949,6 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($total > $updatedOrderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework received quantity should not exceed exist order quantity! Exist Order Qty = '{$updatedOrderQty}', Already Exist Total Received Qty = '{$alreadyReceived}', Trying to Insert Rework Received Qty = '{$receivedQty}'",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('line_id', $lineNamePlantId)
|
||||
@@ -972,7 +964,6 @@ class PdfController extends Controller
|
||||
'item_id' => $itemId,
|
||||
'coil_number' => $coilNo,
|
||||
'order_quantity' => $orderQty,
|
||||
'updated_order_quantity' => $updatedOrderQty,
|
||||
'received_quantity' => $receivedQty,
|
||||
'scrap_quantity' => $scrapQty,
|
||||
'sfg_number' => $sfgNo,
|
||||
@@ -1003,7 +994,7 @@ class PdfController extends Controller
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if ($coilNo > 1) {
|
||||
if ($coilNo >= 1) {
|
||||
$prevCoilNo = (string) ($coilNo - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
@@ -1013,7 +1004,7 @@ class PdfController extends Controller
|
||||
if (! $existPrevCoil) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
@@ -1031,19 +1022,6 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', $itemId)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existPrevCoil->received_quantity < $receivedQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Rework received quantity should not exceed exist received quantity! Exist Received Qty = '{$existPrevCoil->received_quantity}', Trying to Insert Rework Received Qty = '{$receivedQty}'",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$updated = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('line_id', $lineNamePlantId)
|
||||
@@ -1092,7 +1070,7 @@ class PdfController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($coilNo > 1) {
|
||||
if ($coilNo >= 1) {
|
||||
$prevCoilNo = (string) ($coilNo - 1);
|
||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
@@ -1102,18 +1080,11 @@ class PdfController extends Controller
|
||||
if (! $existPrevCoil) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||
], 404);
|
||||
}
|
||||
}
|
||||
|
||||
if ($total > $updatedOrderQty) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Received quantity should not exceed exist order quantity! Exist Order Qty = '{$updatedOrderQty}', Already Exist Total Received Qty = '{$alreadyReceived}', Trying to Insert Received Qty = '{$receivedQty}'",
|
||||
], 404);
|
||||
}
|
||||
|
||||
ProcessOrder::Create(
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
@@ -1122,7 +1093,6 @@ class PdfController extends Controller
|
||||
'item_id' => $itemId,
|
||||
'coil_number' => $coilNo,
|
||||
'order_quantity' => $orderQty,
|
||||
'updated_order_quantity' => $updatedOrderQty,
|
||||
'received_quantity' => $receivedQty,
|
||||
'scrap_quantity' => $scrapQty,
|
||||
'sfg_number' => $sfgNo,
|
||||
|
||||
@@ -9,7 +9,14 @@ use App\Models\MotorTestingMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\TestingPanelReading;
|
||||
use App\Models\WorkGroupMaster;
|
||||
use DB;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Http\Request;
|
||||
use Mpdf\Mpdf;
|
||||
use chillerlan\QRCode\QROptions;
|
||||
use chillerlan\QRCode\Output\QROutputInterface;
|
||||
use Mpdf\QrCode\Output;
|
||||
use Mpdf\QrCode\QrCode;
|
||||
use Str;
|
||||
|
||||
class TestingPanelController extends Controller
|
||||
@@ -28,151 +35,173 @@ class TestingPanelController extends Controller
|
||||
public function store(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
], 403);
|
||||
}
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
if ($data['plant_code'] == null || $data['plant_code'] == '') {
|
||||
if ($data['plant_code'] == null || $data['plant_code'] == '')
|
||||
{
|
||||
// return response("ERROR: Please provide a valid plant code.", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
'status_description' => "Plant code can't be empty!"
|
||||
], 400);
|
||||
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
|
||||
}
|
||||
else if (Str::length($data['plant_code']) < 4 || !is_numeric($data['plant_code']) || !preg_match('/^[1-9]\d{3,}$/', $data['plant_code']))//!ctype_digit($data['plant_code'])
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
'status_description' => "Invalid plant code found!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
||||
if (! $plant) {
|
||||
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
||||
if (!$plant) {
|
||||
//return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant not found!',
|
||||
'status_description' => 'Plant not found!'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
if ($data['line_name'] == null || $data['line_name'] == '') {
|
||||
if ($data['line_name'] == null || $data['line_name'] == '')
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Group work center can't be empty!",
|
||||
'status_description' => "Group work center can't be empty!"
|
||||
], 400);
|
||||
} elseif (Str::length($data['line_name']) < 0) {
|
||||
}
|
||||
else if (Str::length($data['line_name']) < 0)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid group work center found!',
|
||||
'status_description' => "Invalid group work center found!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->first();
|
||||
if (! $gWorkCenter) {
|
||||
if (!$gWorkCenter)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Group work center not found!',
|
||||
'status_description' => 'Group work center not found!'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->where('plant_id', $plantId)->first();
|
||||
if (! $gWorkCenter) {
|
||||
// return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
|
||||
if (!$gWorkCenter)
|
||||
{
|
||||
//return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!",
|
||||
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$gWorkCenterId = $gWorkCenter->id;
|
||||
|
||||
if ($data['machine_name'] == null || $data['machine_name'] == '') {
|
||||
if ($data['machine_name'] == null || $data['machine_name'] == '')
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center can't be empty!",
|
||||
'status_description' => "Work center can't be empty!"
|
||||
], 400);
|
||||
} elseif (Str::length($data['machine_name']) < 0) {
|
||||
}
|
||||
else if (Str::length($data['machine_name']) < 0)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid work center found!',
|
||||
'status_description' => "Invalid work center found!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->first();
|
||||
if (! $machine) {
|
||||
if (!$machine)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Work center not found!',
|
||||
'status_description' => 'Work center not found!'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->first();
|
||||
if (! $machine) {
|
||||
if (!$machine)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!",
|
||||
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->where('work_group_master_id', $gWorkCenterId)->first();
|
||||
if (! $machine) {
|
||||
if (!$machine)
|
||||
{
|
||||
// return response("Machine not found for the specified line : {$data['line_name']}", 400)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!",
|
||||
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!"
|
||||
], 400);
|
||||
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
|
||||
if (! $machine) {
|
||||
if (!$machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!",
|
||||
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$lineId = $machine->line_id;
|
||||
$machineId = $machine->id;
|
||||
|
||||
try {
|
||||
try
|
||||
{
|
||||
$insertedSerials = [];
|
||||
$missedItemCodes = [];
|
||||
$duplicateItemCodes = [];
|
||||
$existSnoCount = [];
|
||||
|
||||
if (! empty($data['item_codes']) && is_array($data['item_codes'])) {
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
if (!empty($data['item_codes']) && is_array($data['item_codes']))
|
||||
{
|
||||
foreach ($data['item_codes'] as $item)
|
||||
{
|
||||
$code = $item['item_code'] ?? null;
|
||||
|
||||
// Check if item_code is present
|
||||
if ($code == '' || $code == null) {
|
||||
if ($code == '' || $code == null)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code can't be empty!",
|
||||
'status_description' => "Item code can't be empty!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
// Collect duplicates
|
||||
if (isset($itemCodeCounts[$code])) {
|
||||
if (isset($itemCodeCounts[$code]))
|
||||
{
|
||||
$itemCodeCounts[$code]++;
|
||||
// Only add to duplicates array once
|
||||
if ($itemCodeCounts[$code] == 2) {
|
||||
$duplicateItemCodes[] = $code;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$itemCodeCounts[$code] = 1;
|
||||
}
|
||||
|
||||
@@ -180,41 +209,43 @@ class TestingPanelController extends Controller
|
||||
$query->where('code', $item['item_code']);
|
||||
})->where('plant_id', $plantId)->first();
|
||||
|
||||
if (! $motorTestingMaster) {
|
||||
if (!$motorTestingMaster) {
|
||||
$missedItemCodes[] = $item['item_code'];
|
||||
}
|
||||
|
||||
if (! empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
|
||||
foreach ($item['serial_numbers'] as $serial) {
|
||||
if (!empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
|
||||
foreach ($item['serial_numbers'] as $serial)
|
||||
{
|
||||
$existSnoCount[] = $serial['serial_number'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If any duplicates found, return error
|
||||
if (! empty($duplicateItemCodes)) {
|
||||
if (!empty($duplicateItemCodes)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Duplicate item codes found in request: '.implode(', ', $duplicateItemCodes),
|
||||
'status_description' => 'Duplicate item codes found in request: ' . implode(', ', $duplicateItemCodes)
|
||||
], 400);
|
||||
}
|
||||
|
||||
$uniqueInvalidCodes = array_unique($missedItemCodes);
|
||||
|
||||
if (! empty($uniqueInvalidCodes)) {
|
||||
if (!empty($uniqueInvalidCodes)) {
|
||||
|
||||
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plant->name}", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
// return response("Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in motor testing master for the specified plant {$plant->name}", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item codes : '.implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plant->name}'!",
|
||||
'status_description' => "Item codes : ". implode(', ', $uniqueInvalidCodes)." not found in master for the specified plant : '{$plant->name}'!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$insertedSnoCount = [];
|
||||
|
||||
foreach ($data['item_codes'] as $item) {
|
||||
foreach ($data['item_codes'] as $item)
|
||||
{
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::whereHas('item', callback: function ($query) use ($item) {
|
||||
$query->where('code', $item['item_code']);
|
||||
@@ -222,16 +253,18 @@ class TestingPanelController extends Controller
|
||||
|
||||
$motorTestingMasterId = $motorTestingMaster->id;
|
||||
|
||||
if (! empty($item['serial_numbers']) && is_array($item['serial_numbers'])) {
|
||||
foreach ($item['serial_numbers'] as $serial) {
|
||||
// For update_count calculation
|
||||
if (!empty($item['serial_numbers']) && is_array($item['serial_numbers']))
|
||||
{
|
||||
foreach ($item['serial_numbers'] as $serial)
|
||||
{
|
||||
//For update_count calculation
|
||||
$updateCount = [
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id' => $motorTestingMasterId,
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id' => $motorTestingMasterId,
|
||||
'serial_number' => $serial['serial_number'] ?? null,
|
||||
'rework_count' => $serial['rework_count'] ?? 0,
|
||||
'rework_count' => $serial['rework_count'] ?? 0,
|
||||
];
|
||||
|
||||
// // Find the current max update_count for this composite key //updated_at
|
||||
@@ -244,64 +277,64 @@ class TestingPanelController extends Controller
|
||||
$maxLength = TestingPanelReading::where($updateCount)->selectRaw('MAX(LENGTH(update_count)) as max_length')->value('max_length');
|
||||
|
||||
// Then, get all records with that length
|
||||
$lastUpdateCount = TestingPanelReading::where($updateCount)->whereRaw('LENGTH(update_count) = ?', [$maxLength])->orderByDesc('update_count')->select('update_count')->first(); // ->get();
|
||||
$lastUpdateCount = TestingPanelReading::where($updateCount)->whereRaw('LENGTH(update_count) = ?', [$maxLength])->orderByDesc('update_count')->select('update_count')->first();//->get();
|
||||
|
||||
$newUpdateCount = ($lastUpdateCount == null || $lastUpdateCount == '') ? 0 : (int) $lastUpdateCount?->update_count + 1; // $maxUpdateCount?->update_count
|
||||
$newUpdateCount = ($lastUpdateCount == null || $lastUpdateCount == '') ? 0 : (int)$lastUpdateCount?->update_count + 1;//$maxUpdateCount?->update_count
|
||||
|
||||
$updateCountString = (string) $newUpdateCount;
|
||||
$updateCountString = (string)$newUpdateCount;
|
||||
|
||||
$row = [
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id' => $motorTestingMasterId,
|
||||
'serial_number' => $serial['serial_number'] ?? null,
|
||||
'winded_serial_number' => $serial['winded_serial_number'] ?? null,
|
||||
'output' => $serial['output'] ?? null,
|
||||
'before_fr_volt' => $serial['before_fr_volt'] ?? null,
|
||||
'before_fr_cur' => $serial['before_fr_cur'] ?? null,
|
||||
'before_fr_pow' => $serial['before_fr_pow'] ?? null,
|
||||
'before_fr_res_ry' => $serial['before_fr_res_ry'] ?? null,
|
||||
'before_fr_res_yb' => $serial['before_fr_res_yb'] ?? null,
|
||||
'before_fr_res_br' => $serial['before_fr_res_br'] ?? null,
|
||||
'before_fr_ir' => $serial['before_fr_ir'] ?? null,
|
||||
'before_fr_ir_r' => $serial['before_fr_ir_r'] ?? null,
|
||||
'before_fr_ir_y' => $serial['before_fr_ir_y'] ?? null,
|
||||
'before_fr_ir_b' => $serial['before_fr_ir_b'] ?? null,
|
||||
'before_fr_freq' => $serial['before_fr_freq'] ?? null,
|
||||
'before_fr_speed' => $serial['before_fr_speed'] ?? null,
|
||||
'after_fr_vol' => $serial['after_fr_vol'] ?? null,
|
||||
'after_fr_cur' => $serial['after_fr_cur'] ?? null,
|
||||
'after_fr_pow' => $serial['after_fr_pow'] ?? null,
|
||||
'after_fr_ir_hot' => $serial['after_fr_ir_hot'] ?? null,
|
||||
'after_fr_ir_hot_r' => $serial['after_fr_ir_hot_r'] ?? null,
|
||||
'after_fr_ir_hot_y' => $serial['after_fr_ir_hot_y'] ?? null,
|
||||
'after_fr_ir_hot_b' => $serial['after_fr_ir_hot_b'] ?? null,
|
||||
'after_fr_ir_cool' => $serial['after_fr_ir_cool'] ?? null,
|
||||
'after_fr_ir_cool_r' => $serial['after_fr_ir_cool_r'] ?? null,
|
||||
'after_fr_ir_cool_y' => $serial['after_fr_ir_cool_y'] ?? null,
|
||||
'after_fr_ir_cool_b' => $serial['after_fr_ir_cool_b'] ?? null,
|
||||
'after_fr_freq' => $serial['after_fr_freq'] ?? null,
|
||||
'after_fr_speed' => $serial['after_fr_speed'] ?? null,
|
||||
'after_fr_leak_cur' => $serial['after_fr_leak_cur'] ?? null,
|
||||
'locked_rt_volt' => $serial['locked_rt_volt'] ?? null,
|
||||
'locked_rt_cur' => $serial['locked_rt_cur'] ?? null,
|
||||
'locked_rt_pow' => $serial['locked_rt_pow'] ?? null,
|
||||
'no_load_pickup_volt' => $serial['no_load_pickup_volt'] ?? null,
|
||||
'room_temperature' => $serial['room_temperature'] ?? null,
|
||||
'hv_test' => $serial['hv_test'] ?? null,
|
||||
'batch_number' => $serial['batch_number'] ?? null,
|
||||
'batch_count' => $serial['batch_count'] ?? 0,
|
||||
'result' => $serial['result'] ?? null,
|
||||
'remark' => $serial['remark'] ?? null,
|
||||
'rework_count' => $serial['rework_count'] ?? 0,
|
||||
'output_flag' => $serial['output_flag'] ?? 0,
|
||||
'tested_by' => $serial['tested_by'] ?? null,
|
||||
'updated_by' => $serial['updated_by'] ?? null,
|
||||
'created_at' => $serial['created_at'] ?? null,
|
||||
'updated_at' => $serial['updated_at'] ?? $serial['created_at'],
|
||||
'scanned_at' => $serial['scanned_at'] ?? null,
|
||||
'update_count' => $updateCountString,
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'machine_id' => $machineId,
|
||||
'motor_testing_master_id'=> $motorTestingMasterId,
|
||||
'serial_number' => $serial['serial_number'] ?? null,
|
||||
'winded_serial_number' => $serial['winded_serial_number'] ?? null,
|
||||
'output' => $serial['output'] ?? null,
|
||||
'before_fr_volt' => $serial['before_fr_volt'] ?? null,
|
||||
'before_fr_cur' => $serial['before_fr_cur'] ?? null,
|
||||
'before_fr_pow' => $serial['before_fr_pow'] ?? null,
|
||||
'before_fr_res_ry' => $serial['before_fr_res_ry'] ?? null,
|
||||
'before_fr_res_yb' => $serial['before_fr_res_yb'] ?? null,
|
||||
'before_fr_res_br' => $serial['before_fr_res_br'] ?? null,
|
||||
'before_fr_ir' => $serial['before_fr_ir'] ?? null,
|
||||
'before_fr_ir_r' => $serial['before_fr_ir_r'] ?? null,
|
||||
'before_fr_ir_y' => $serial['before_fr_ir_y'] ?? null,
|
||||
'before_fr_ir_b' => $serial['before_fr_ir_b'] ?? null,
|
||||
'before_fr_freq' => $serial['before_fr_freq'] ?? null,
|
||||
'before_fr_speed' => $serial['before_fr_speed'] ?? null,
|
||||
'after_fr_vol' => $serial['after_fr_vol'] ?? null,
|
||||
'after_fr_cur' => $serial['after_fr_cur'] ?? null,
|
||||
'after_fr_pow' => $serial['after_fr_pow'] ?? null,
|
||||
'after_fr_ir_hot' => $serial['after_fr_ir_hot'] ?? null,
|
||||
'after_fr_ir_hot_r' => $serial['after_fr_ir_hot_r'] ?? null,
|
||||
'after_fr_ir_hot_y' => $serial['after_fr_ir_hot_y'] ?? null,
|
||||
'after_fr_ir_hot_b' => $serial['after_fr_ir_hot_b'] ?? null,
|
||||
'after_fr_ir_cool' => $serial['after_fr_ir_cool'] ?? null,
|
||||
'after_fr_ir_cool_r' => $serial['after_fr_ir_cool_r'] ?? null,
|
||||
'after_fr_ir_cool_y' => $serial['after_fr_ir_cool_y'] ?? null,
|
||||
'after_fr_ir_cool_b' => $serial['after_fr_ir_cool_b'] ?? null,
|
||||
'after_fr_freq' => $serial['after_fr_freq'] ?? null,
|
||||
'after_fr_speed' => $serial['after_fr_speed'] ?? null,
|
||||
'after_fr_leak_cur' => $serial['after_fr_leak_cur'] ?? null,
|
||||
'locked_rt_volt' => $serial['locked_rt_volt'] ?? null,
|
||||
'locked_rt_cur' => $serial['locked_rt_cur'] ?? null,
|
||||
'locked_rt_pow' => $serial['locked_rt_pow'] ?? null,
|
||||
'no_load_pickup_volt' => $serial['no_load_pickup_volt'] ?? null,
|
||||
'room_temperature' => $serial['room_temperature'] ?? null,
|
||||
'hv_test' => $serial['hv_test'] ?? null,
|
||||
'batch_number' => $serial['batch_number'] ?? null,
|
||||
'batch_count' => $serial['batch_count'] ?? 0,
|
||||
'result' => $serial['result'] ?? null,
|
||||
'remark' => $serial['remark'] ?? null,
|
||||
'rework_count' => $serial['rework_count'] ?? 0,
|
||||
'output_flag' => $serial['output_flag'] ?? 0,
|
||||
'tested_by' => $serial['tested_by'] ?? null,
|
||||
'updated_by' => $serial['updated_by'] ?? null,
|
||||
'created_at' => $serial['created_at'] ?? null,
|
||||
'updated_at' => $serial['updated_at'] ?? $serial['created_at'],
|
||||
'scanned_at' => $serial['scanned_at'] ?? null,
|
||||
'update_count' => $updateCountString,
|
||||
];
|
||||
|
||||
// Insert the new record
|
||||
@@ -313,27 +346,32 @@ class TestingPanelController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($insertedSerials)) {
|
||||
if (count($existSnoCount) == count($insertedSnoCount)) {
|
||||
if (!empty($insertedSerials))
|
||||
{
|
||||
if(count($existSnoCount) == count($insertedSnoCount))
|
||||
{
|
||||
// $messages[] = "Inserted serial numbers are: " . implode(', ', $insertedSerials);
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => 'Inserted serial numbers are: '.implode(', ', $insertedSerials),
|
||||
'status_description' => 'Inserted serial numbers are: ' . implode(', ', $insertedSerials)
|
||||
], 200);
|
||||
} else {
|
||||
$missingSno = array_diff($existSnoCount, $insertedSnoCount);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$missingSno = array_diff($existSnoCount,$insertedSnoCount);
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Missed serial numbers are: '.implode(', ', $missingSno),
|
||||
'status_description' => "Missed serial numbers are: " . implode(', ', $missingSno)
|
||||
], 400);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
// return response($e->getMessage(), 500)->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Store testing panel readings internal server error : '.$e?->getCode(),
|
||||
'status_description' => 'Store testing panel readings internal server error : '.$e?->getCode()
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
@@ -344,15 +382,16 @@ class TestingPanelController extends Controller
|
||||
public function get_motor_master(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$header_auth = $request->header('Authorization');
|
||||
$expectedToken = $expectedUser . ':' . $expectedPw;
|
||||
|
||||
// $data = $request->all();
|
||||
if ('Bearer '.$expectedToken != $header_auth) {
|
||||
//$data = $request->all();
|
||||
if ("Bearer " . $expectedToken != $header_auth)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
'status_description' => 'Invalid authorization token!'
|
||||
], 403);
|
||||
}
|
||||
|
||||
@@ -360,46 +399,45 @@ class TestingPanelController extends Controller
|
||||
$itemCode = $request->header('item-code');
|
||||
// $description = $item ? $item->description : '';
|
||||
|
||||
if ($plantCode == null || $plantCode == '') {
|
||||
if ($plantCode == null || $plantCode == '')
|
||||
{
|
||||
// return response("ERROR: Plant Name can't be empty", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
'status_description' => "Plant code can't be empty!"
|
||||
], 400);
|
||||
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
|
||||
}
|
||||
else if (Str::length($plantCode) < 4 || !is_numeric($plantCode) || !preg_match('/^[1-9]\d{3,}$/', $plantCode))
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
'status_description' => "Invalid plant code found!"
|
||||
], 400);
|
||||
} elseif ($itemCode == null || $itemCode == '' || ! $itemCode) {
|
||||
}
|
||||
else if($itemCode == null || $itemCode == '')
|
||||
{
|
||||
// return response("ERROR: OBD Number can't be empty", 400)
|
||||
// ->header('Content-Type', 'text/plain');
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code can't be empty!",
|
||||
], 404);
|
||||
} elseif (Str::length($itemCode) < 6) {
|
||||
'status_description' => "Item Code can't be empty!"
|
||||
], 400);
|
||||
}
|
||||
else if(Str::length($itemCode) < 6 || !ctype_alnum($itemCode))
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' should contain minimum 6 digits!",
|
||||
], 404);
|
||||
} elseif (! ctype_alnum($itemCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' should contain only alpha-numeric values!",
|
||||
], 404);
|
||||
} elseif (! preg_match('/^[a-zA-Z1-9][a-zA-Z0-9]{5,}$/', $itemCode)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' should not begin with '0'!",
|
||||
], 404);
|
||||
'status_description' => "Invalid item code found!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
|
||||
if (! $plant) {
|
||||
if (!$plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Plant not found!',
|
||||
'status_description' => "Plant not found!"
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -407,79 +445,72 @@ class TestingPanelController extends Controller
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
if (! $item) {
|
||||
if (!$item)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item code not found in item table!',
|
||||
'status_description' => "Item Code not found in item table!"
|
||||
], 404);
|
||||
}
|
||||
|
||||
$item = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
|
||||
|
||||
if (! $item) {
|
||||
if (!$item)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code not found in item table for the plant : '$plant->name'!",
|
||||
'status_description' => "Item Code not found in item table for the plant : '$plant->name'!"
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
// Get description or empty string if not found
|
||||
$description = $item ? $item->description : '';
|
||||
|
||||
$category = $item ? $item->category : '';
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::where('item_id', $itemId)->first();
|
||||
$motorTestingMaster = MotorTestingMaster::where('plant_id', $plantId)->where('item_id', $item->id)->first();
|
||||
|
||||
if (! $motorTestingMaster) {
|
||||
if (!$motorTestingMaster)
|
||||
{
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Item code not found in motor testing master table!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$motorTestingMaster = MotorTestingMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first();
|
||||
|
||||
if (! $motorTestingMaster) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code not found in motor testing master table for the plant : '$plant->name'!",
|
||||
'status_description' => "Item Code not found in motor testing master table for the plant : '$plant->name'!"
|
||||
], 404);
|
||||
}
|
||||
|
||||
$output = [
|
||||
'mot_subassembly_code' => $motorTestingMaster->subassembly_code ?? '',
|
||||
'mot_model_name' => ($itemCode == '123456') ? 'SAMPLE TYPE' : $description,
|
||||
'mot_non_isi_model' => $motorTestingMaster->isi_model ? '0' : '1',
|
||||
'mot_phase' => $motorTestingMaster->phase ?? '',
|
||||
'mot_hp' => $motorTestingMaster->hp ?? '',
|
||||
'mot_kw' => $motorTestingMaster->kw ?? '',
|
||||
'mot_volt' => $motorTestingMaster->volt ?? '',
|
||||
'mot_cur' => $motorTestingMaster->current ?? '',
|
||||
'mot_rpm' => $motorTestingMaster->rpm ?? '',
|
||||
'mot_rate_torque_kg' => $motorTestingMaster->torque ?? '',
|
||||
'mot_freq' => $motorTestingMaster->frequency ?? '',
|
||||
'mot_conn' => $motorTestingMaster->connection ?? '',
|
||||
'mot_ins_res_limit' => $motorTestingMaster->ins_res_limit ?? '',
|
||||
'mot_ins_res_type' => $motorTestingMaster->ins_res_type ?? '',
|
||||
'mot_category' => $category,
|
||||
'mot_routine_test_time' => $motorTestingMaster->routine_test_time ?? '',
|
||||
'mot_res_ry_ll' => $motorTestingMaster->res_ry_ll ?? '',
|
||||
'mot_res_ry_ul' => $motorTestingMaster->res_ry_ul ?? '',
|
||||
'mot_res_yb_ll' => $motorTestingMaster->res_yb_ll ?? '',
|
||||
'mot_res_yb_ul' => $motorTestingMaster->res_yb_ul ?? '',
|
||||
'mot_res_br_ll' => $motorTestingMaster->res_br_ll ?? '',
|
||||
'mot_res_br_ul' => $motorTestingMaster->res_br_ul ?? '',
|
||||
'mot_lock_volt_limit' => $motorTestingMaster->lock_volt_limit ?? '',
|
||||
'mot_leak_cur_limit' => $motorTestingMaster->leak_cur_limit ?? '',
|
||||
'mot_lock_cur_ll' => $motorTestingMaster->lock_cur_ll ?? '',
|
||||
'mot_lock_cur_ul' => $motorTestingMaster->lock_cur_ul ?? '',
|
||||
'mot_noload_cur_ll' => $motorTestingMaster->noload_cur_ll ?? '',
|
||||
'mot_noload_cur_ul' => $motorTestingMaster->noload_cur_ul ?? '',
|
||||
'mot_noload_pow_ll' => $motorTestingMaster->noload_pow_ll ?? '',
|
||||
'mot_noload_pow_ul' => $motorTestingMaster->noload_pow_ul ?? '',
|
||||
'mot_noload_spd_ll' => $motorTestingMaster->noload_spd_ll ?? '',
|
||||
'mot_noload_spd_ul' => $motorTestingMaster->noload_spd_ul ?? '',
|
||||
"mot_subassembly_code" => $motorTestingMaster->subassembly_code ?? "",
|
||||
"mot_model_name" => $description,
|
||||
"mot_non_isi_model" => $motorTestingMaster->isi_model ? "0" :"1",
|
||||
"mot_phase" => $motorTestingMaster->phase ?? "",
|
||||
"mot_hp" => $motorTestingMaster->hp ?? "",
|
||||
"mot_kw" => $motorTestingMaster->kw ?? "",
|
||||
"mot_volt" => $motorTestingMaster->volt ?? "",
|
||||
"mot_cur" => $motorTestingMaster->current ?? "",
|
||||
"mot_rpm" => $motorTestingMaster->rpm ?? "",
|
||||
"mot_rate_torque_kg" => $motorTestingMaster->torque ?? "",
|
||||
"mot_freq" => $motorTestingMaster->frequency ?? "",
|
||||
"mot_conn" => $motorTestingMaster->connection ?? "",
|
||||
"mot_ins_res_limit" => $motorTestingMaster->ins_res_limit ?? "",
|
||||
"mot_ins_res_type" => $motorTestingMaster->ins_res_type ?? "",
|
||||
"mot_category" => $category,
|
||||
"mot_routine_test_time" => $motorTestingMaster->routine_test_time ?? "",
|
||||
"mot_res_ry_ll" => $motorTestingMaster->res_ry_ll ?? "",
|
||||
"mot_res_ry_ul" => $motorTestingMaster->res_ry_ul ?? "",
|
||||
"mot_res_yb_ll" => $motorTestingMaster->res_yb_ll ?? "",
|
||||
"mot_res_yb_ul" => $motorTestingMaster->res_yb_ul ?? "",
|
||||
"mot_res_br_ll" => $motorTestingMaster->res_br_ll ?? "",
|
||||
"mot_res_br_ul" => $motorTestingMaster->res_br_ul ?? "",
|
||||
"mot_lock_volt_limit" => $motorTestingMaster->lock_volt_limit ?? "",
|
||||
"mot_leak_cur_limit" => $motorTestingMaster->leak_cur_limit ?? "",
|
||||
"mot_lock_cur_ll" => $motorTestingMaster->lock_cur_ll ?? "",
|
||||
"mot_lock_cur_ul" => $motorTestingMaster->lock_cur_ul ?? "",
|
||||
"mot_noload_cur_ll" => $motorTestingMaster->noload_cur_ll ?? "",
|
||||
"mot_noload_cur_ul" => $motorTestingMaster->noload_cur_ul ?? "",
|
||||
"mot_noload_pow_ll" => $motorTestingMaster->noload_pow_ll ?? "",
|
||||
"mot_noload_pow_ul" => $motorTestingMaster->noload_pow_ul ?? "",
|
||||
"mot_noload_spd_ll" => $motorTestingMaster->noload_spd_ll ?? "",
|
||||
"mot_noload_spd_ul" => $motorTestingMaster->noload_spd_ul ?? ""
|
||||
];
|
||||
|
||||
return response()->json($output, 200);
|
||||
|
||||
@@ -30,7 +30,7 @@ class UserController extends Controller
|
||||
* Display the specified resource.
|
||||
*/
|
||||
// show(string $id)
|
||||
public function get_user_data(Request $request)
|
||||
public function get_testing_data(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
|
||||
@@ -1,558 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Models\DuplicateStock;
|
||||
use App\Models\Item;
|
||||
use App\Models\NotInStock;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\StockDataMaster;
|
||||
use Filament\Notifications\Notification;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class StockDataTable extends Component
|
||||
{
|
||||
public $invoiceData = [];
|
||||
|
||||
use WithPagination;
|
||||
|
||||
protected $paginationTheme = 'tailwind';
|
||||
|
||||
// public $invoiceRecords;
|
||||
|
||||
public $plantId = 0;
|
||||
|
||||
public $package = [];
|
||||
|
||||
public $scannedIds = [];
|
||||
|
||||
public $scannedRecords = [];
|
||||
|
||||
public $scannedSerials = [];
|
||||
|
||||
public $packageCount = 0;
|
||||
|
||||
public string $location = '';
|
||||
|
||||
public bool $completedInvoice = false;
|
||||
|
||||
public bool $isSerial = false;
|
||||
|
||||
public $isnonQuanSfg = false;
|
||||
|
||||
public bool $onCapFocus = false;
|
||||
|
||||
public bool $emptyInvoice = false;
|
||||
|
||||
public bool $hasSearched = false;
|
||||
|
||||
public bool $materialInvoice = false;
|
||||
|
||||
public bool $showCapacitorInput = false;
|
||||
|
||||
public bool $isSfg = false;
|
||||
|
||||
public $itemCode, $serialNumber, $serial_number;
|
||||
|
||||
public $scannedSfgData = [];
|
||||
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
|
||||
protected $listeners = [
|
||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||
'refreshInvoiceData' => 'loadData',
|
||||
'refreshSfgData' => 'loadSfgData',
|
||||
'refreshSfgNonData' => 'loadSfgNonQuanData',
|
||||
'confirmStockUpdate',
|
||||
'confirmSerialUpdate',
|
||||
'confirmSerialFGUpdate',
|
||||
'confirmDuplicateUpdate'
|
||||
];
|
||||
|
||||
public $capacitorInput = '';
|
||||
|
||||
public $panel_box_supplier;
|
||||
|
||||
public $panel_box_code;
|
||||
|
||||
public $panel_box_serial_number;
|
||||
|
||||
public string $currentItemCode = '';
|
||||
|
||||
public string $currentSerialNumber = '';
|
||||
|
||||
public $stickerMasterId;
|
||||
|
||||
public $sNo;
|
||||
|
||||
public function confirmStockUpdate($plantId, $location, $bin, $stickerMasterId, $batch, $docNo, $quantity)
|
||||
{
|
||||
|
||||
$record = NotInStock::where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('doc_no', $docNo)
|
||||
->where('bin', $bin)
|
||||
->first();
|
||||
|
||||
if (!$record) {
|
||||
|
||||
NotInStock::create([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'sticker_master_id' => $stickerMasterId,
|
||||
'type' => '1',
|
||||
'serial_number' => $this->serialNumber ?? null,
|
||||
'batch' => $batch ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
'scanned_quantity' => $quantity ?? '0',
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record inserted successfully in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
} else {
|
||||
|
||||
$record->update([
|
||||
'scanned_quantity' => $record->scanned_quantity + $quantity,
|
||||
'batch' => $batch ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record updated in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmSerialUpdate($plantId, $location, $bin, $serial_number, $stickerMasterId, $batch, $docNo, $quantity)
|
||||
{
|
||||
$sNo = $serial_number;
|
||||
$record = NotInStock::where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('serial_number', $sNo)
|
||||
->where('bin', $bin)
|
||||
->first();
|
||||
|
||||
if (!$record) {
|
||||
|
||||
NotInStock::create([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'sticker_master_id' => $stickerMasterId,
|
||||
'type' => '1',
|
||||
'serial_number' => $sNo ?? null,
|
||||
'batch' => $batch ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
'scanned_quantity' => $quantity ?? '1',
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record inserted successfully in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
} else {
|
||||
|
||||
$record->update([
|
||||
'batch' => $batch ?? null,
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record updated in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmDuplicateUpdate($plantId, $location, $bin, $serial_number, $stickerMasterId, $batch, $docNo, $quantity)
|
||||
{
|
||||
$sNo = $serial_number;
|
||||
$stockRecord = StockDataMaster::where('serial_number', $sNo)
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
if (!$stockRecord) {
|
||||
return;
|
||||
}
|
||||
|
||||
$record = DuplicateStock::where('stock_data_master_id', $stockRecord->id)->first();
|
||||
|
||||
if (!$record) {
|
||||
|
||||
DuplicateStock::create([
|
||||
'stock_data_master_id' => $stockRecord->id,
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record inserted successfully in duplicate stock table.')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
} else {
|
||||
|
||||
DuplicateStock::create([
|
||||
'stock_data_master_id' => $stockRecord->id,
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record inserted successfully in duplicate stock table.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function confirmSerialFGUpdate($plantId, $location, $bin, $serial_number, $stickerMasterId)
|
||||
{
|
||||
$sNo = $serial_number;
|
||||
$record = NotInStock::where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('serial_number', $sNo)
|
||||
->where('bin', $bin)
|
||||
->first();
|
||||
|
||||
if (!$record) {
|
||||
|
||||
NotInStock::create([
|
||||
'plant_id' => $plantId,
|
||||
'location' => $location,
|
||||
'bin' => $bin,
|
||||
'sticker_master_id' => $stickerMasterId,
|
||||
'type' => '0',
|
||||
'serial_number' => $sNo ?? null,
|
||||
'batch' => $batch ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
'scanned_quantity' => $quantity ?? '1',
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record inserted successfully in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
|
||||
} else {
|
||||
|
||||
$record->update([
|
||||
'batch' => $batch ?? null,
|
||||
'doc_no' => $docNo ?? null,
|
||||
]);
|
||||
|
||||
Notification::make()
|
||||
->title('Record updated in not in stock table.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function loadCompletedData($location, $plantId, $isSerial)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
$this->location = $location;
|
||||
$this->completedInvoice = true;
|
||||
$this->isSerial = $isSerial;
|
||||
$this->onCapFocus = false;
|
||||
$this->emptyInvoice = false;
|
||||
$this->hasSearched = false;
|
||||
$this->materialInvoice = false;
|
||||
$this->packageCount = 0;
|
||||
// $this->showCapacitorInput = false;
|
||||
$this->dispatch('focus-invoice-number');
|
||||
}
|
||||
|
||||
public function loadEmptyData($location, $plantId)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
$this->location = $location;
|
||||
$this->completedInvoice = false;
|
||||
$this->onCapFocus = false;
|
||||
$this->emptyInvoice = true;
|
||||
$this->hasSearched = false;
|
||||
$this->materialInvoice = false;
|
||||
$this->packageCount = 0;
|
||||
// $this->showCapacitorInput = false;
|
||||
}
|
||||
|
||||
public function loadSfgData($location, $plantId, $itemCode,$docNo)
|
||||
{
|
||||
$this->isSfg = true;
|
||||
$this->hasSearched = false;
|
||||
// $this->materialInvoice = false;
|
||||
// $this->completedInvoice = false;
|
||||
// $this->emptyInvoice = false;
|
||||
|
||||
$item = Item::where('plant_id', $plantId)
|
||||
->where('code', $itemCode)
|
||||
->first();
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
$stickerMaster = StickerMaster::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
$stickerMasterId = $stickerMaster->id;
|
||||
|
||||
$record = StockDataMaster::with('stickerMaster.item')
|
||||
->where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('doc_no', $docNo)
|
||||
->where('type', '1')
|
||||
->first();
|
||||
|
||||
if ($record) {
|
||||
|
||||
$itemCode = optional($record->stickerMaster->item)->code;
|
||||
|
||||
$foundIndex = null;
|
||||
|
||||
foreach ($this->scannedSfgData as $index => $row) {
|
||||
|
||||
if (
|
||||
$row['location'] == $record->location &&
|
||||
$row['doc_no'] == $record->doc_no &&
|
||||
$row['item_code'] == $itemCode
|
||||
) {
|
||||
$foundIndex = $index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($foundIndex !== null) {
|
||||
|
||||
$this->scannedSfgData[$foundIndex]['scanned_quantity'] = $record->scanned_quantity;
|
||||
|
||||
} else {
|
||||
|
||||
if (count($this->scannedSfgData) >= 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->scannedSfgData[] = [
|
||||
'serial_number' => $record->serial_number,
|
||||
'bin' => $record->bin,
|
||||
'item_code' => $itemCode,
|
||||
'batch' => $record->batch,
|
||||
'doc_no' => $record->doc_no,
|
||||
'quantity' => $record->quantity,
|
||||
'scanned_quantity' => $record->scanned_quantity,
|
||||
'location' => $record->location,
|
||||
'updated_by' => $record->updated_by,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function loadSfgNonQuanData($location, $plantId, $serialNumber, $itemCode){
|
||||
|
||||
$this->isnonQuanSfg = true;
|
||||
|
||||
$record = StockDataMaster::with('stickerMaster.item')
|
||||
->where('plant_id', $plantId)
|
||||
->where('location', $location)
|
||||
->where('serial_number', $serialNumber)
|
||||
->whereHas('stickerMaster.item', function ($q) use ($itemCode) {
|
||||
$q->where('code', $itemCode);
|
||||
})
|
||||
->where('type', '1')
|
||||
->orderBy('updated_at', 'desc')
|
||||
->first();
|
||||
|
||||
if ($record) {
|
||||
|
||||
// foreach ($this->scannedSerials as $row) {
|
||||
// if ($row['serial_number'] == $serialNumber) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $this->scannedSerials[] = [
|
||||
array_unshift($this->scannedSerials, [
|
||||
'location' => $record->location,
|
||||
'bin' => $record->bin ?? '',
|
||||
'item_code' => $record->stickerMaster->item->code ?? '',
|
||||
'serial_number' => $serialNumber,
|
||||
'batch' => $record->batch ?? '',
|
||||
'doc_no' => $record->doc_no ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'scanned_quantity' => $record->scanned_quantity ?? '',
|
||||
'updated_by' => $record->updated_by ?? '',
|
||||
]);
|
||||
// ];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function loadData($location, $plantId, $itemCode, $serialNumber)
|
||||
{
|
||||
$this->location = $location;
|
||||
$this->plantId = $plantId;
|
||||
$this->itemCode = $itemCode;
|
||||
$this->serialNumber = $serialNumber;
|
||||
|
||||
|
||||
$this->completedInvoice = false;
|
||||
$this->isSerial = true;
|
||||
$this->emptyInvoice = false;
|
||||
$this->hasSearched = true;
|
||||
$this->materialInvoice = false;
|
||||
|
||||
$this->resetPage();
|
||||
$this->packageCount = 0;
|
||||
|
||||
$item = Item::where('plant_id', $plantId)
|
||||
->where('code', $this->itemCode)
|
||||
->first();
|
||||
|
||||
$itemId = $item->id;
|
||||
|
||||
$stickerMaster = StickerMaster::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
$stickerMasterId = $stickerMaster->id;
|
||||
|
||||
$records = StockDataMaster::with('stickerMasterRelation')
|
||||
->where('location', $this->location)
|
||||
->where('type', '=', '0')
|
||||
->where('plant_id', $this->plantId)
|
||||
->where('sticker_master_id', $stickerMasterId)
|
||||
->where('serial_number', $this->serialNumber)
|
||||
->orderBy('updated_at', 'desc')
|
||||
->limit(100)
|
||||
->get();
|
||||
|
||||
foreach ($records as $record) {
|
||||
|
||||
if ($record->scanned_status == 'Scanned') {
|
||||
|
||||
if (!in_array($record->id, $this->scannedIds)) {
|
||||
$this->scannedIds[] = $record->id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$this->scannedIds = array_slice(array_unique($this->scannedIds), 0, 100);
|
||||
|
||||
|
||||
$this->packageCount = $records->sum(function ($record) {
|
||||
|
||||
$sm = $record->stickerMasterRelation;
|
||||
|
||||
if (! $sm) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$stickCount = 0;
|
||||
$scannedCount = 0;
|
||||
|
||||
|
||||
if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
|
||||
|
||||
if ($sm->tube_sticker_motor == 1) {
|
||||
$stickCount++;
|
||||
if ($record->motor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
$sm->tube_sticker_pump == 1 ||
|
||||
($sm->tube_sticker_pumpset != 1 &&
|
||||
$sm->tube_sticker_pump != 1 &&
|
||||
$sm->pack_slip_pump == 1)
|
||||
) {
|
||||
$stickCount++;
|
||||
if ($record->pump_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sm->tube_sticker_pumpset == 1) {
|
||||
$stickCount++;
|
||||
if ($record->scanned_status_set == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
} elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1) {
|
||||
if ($sm->pack_slip_motor == 1) {
|
||||
$stickCount++;
|
||||
if ($record->motor_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sm->pack_slip_pump == 1) {
|
||||
$stickCount++;
|
||||
if ($record->pump_scanned_status == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sm->pack_slip_pumpset == 1) {
|
||||
$stickCount++;
|
||||
if ($record->scanned_status_set == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return max($stickCount - $scannedCount, 0);
|
||||
});
|
||||
|
||||
// $this->dispatch(
|
||||
// $onCapFocus ? 'focus-capacitor-input' : 'focus-serial-number'
|
||||
// );
|
||||
}
|
||||
|
||||
// public function getInvoiceRecordsProperty()
|
||||
// {
|
||||
// return StockDataMaster::with('stickerMasterRelation.item')
|
||||
// ->where('plant_id', $this->plantId)
|
||||
// ->where('location', $this->location)
|
||||
// ->where('type', '=', '0')
|
||||
// ->where('scanned_status', 'Scanned')
|
||||
// // ->where(function ($query) {
|
||||
// // $query->whereNull('scanned_status')
|
||||
// // ->orWhere('scanned_status', 'Scanned');
|
||||
// // })
|
||||
// // ->when($this->hasSearched, function ($query) {
|
||||
// // $query->where('invoice_number', $this->invoiceNumber)
|
||||
// // ->where('plant_id', $this->plantId)
|
||||
// // ->where('scanned_status', '=', '');
|
||||
// // })
|
||||
// ->orderBy('updated_at', 'desc')
|
||||
// ->paginate(6);
|
||||
// }
|
||||
|
||||
|
||||
public function getInvoiceRecordsProperty()
|
||||
{
|
||||
if (empty($this->scannedIds)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
return StockDataMaster::with('stickerMasterRelation.item')
|
||||
->whereIn('id', $this->scannedIds)
|
||||
->orderBy('updated_at', 'desc')
|
||||
->paginate(6);
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
// return view('livewire.stock-data-table');
|
||||
return view('livewire.stock-data-table', [
|
||||
'records' => $this->invoiceRecords,
|
||||
'scannedSfgData' => $this->scannedSfgData,
|
||||
'scannedSerials' => $this->scannedSerials
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DuplicateStock extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'stock_data_master_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function stockDataMaster(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StockDataMaster::class);
|
||||
}
|
||||
}
|
||||
@@ -64,11 +64,6 @@ class Item extends Model
|
||||
return $this->hasMany(CharacteristicValue::class);
|
||||
}
|
||||
|
||||
public function ClassCharacteristics()
|
||||
{
|
||||
return $this->hasMany(ClassCharacteristic::class, 'item_id', 'id');
|
||||
}
|
||||
|
||||
public function weightValidations()
|
||||
{
|
||||
return $this->hasMany(WeightValidation::class);
|
||||
|
||||
@@ -43,11 +43,6 @@ class Machine extends Model
|
||||
return $this->hasMany(CharacteristicValue::class);
|
||||
}
|
||||
|
||||
public function ClassCharacteristics()
|
||||
{
|
||||
return $this->hasMany(ClassCharacteristic::class, 'machine_id', 'id');
|
||||
}
|
||||
|
||||
public function testingPanelReadings()
|
||||
{
|
||||
return $this->hasMany(TestingPanelReading::class);
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class NotInStock extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'sticker_master_id',
|
||||
'location',
|
||||
'bin',
|
||||
'serial_number',
|
||||
'batch',
|
||||
'quantity',
|
||||
'doc_no',
|
||||
'type',
|
||||
'motor_scanned_status',
|
||||
'pump_scanned_status',
|
||||
'capacitor_scanned_status',
|
||||
'scanned_status_set',
|
||||
'panel_box_item_code',
|
||||
'panel_box_supplier',
|
||||
'panel_box_sno',
|
||||
'scanned_status',
|
||||
'scanned_quantity',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function stickerMaster(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StickerMaster::class);
|
||||
}
|
||||
|
||||
public function stickerMasterRelation()
|
||||
{
|
||||
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,11 +53,6 @@ class Plant extends Model
|
||||
return $this->hasMany(InvoiceValidation::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function stockDataMasters()
|
||||
{
|
||||
return $this->hasMany(StockDataMaster::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function qualityValidations()
|
||||
{
|
||||
return $this->hasMany(QualityValidation::class, 'plant_id', 'id');
|
||||
@@ -113,11 +108,6 @@ class Plant extends Model
|
||||
return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
public function ClassCharacteristics()
|
||||
{
|
||||
return $this->hasMany(ClassCharacteristic::class, 'plant_id', 'id');
|
||||
}
|
||||
|
||||
// public function rejectReasons()
|
||||
// {
|
||||
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
|
||||
|
||||
@@ -21,7 +21,6 @@ class ProcessOrder extends Model
|
||||
'coil_number',
|
||||
'order_quantity',
|
||||
'received_quantity',
|
||||
'updated_order_quantity',
|
||||
'sfg_number',
|
||||
'machine_name',
|
||||
'scrap_quantity',
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class StockDataMaster extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'sticker_master_id',
|
||||
'location',
|
||||
'bin',
|
||||
'serial_number',
|
||||
'batch',
|
||||
'quantity',
|
||||
'doc_no',
|
||||
'type',
|
||||
'motor_scanned_status',
|
||||
'pump_scanned_status',
|
||||
'capacitor_scanned_status',
|
||||
'scanned_status_set',
|
||||
'panel_box_item_code',
|
||||
'panel_box_supplier',
|
||||
'panel_box_sno',
|
||||
'scanned_status',
|
||||
'scanned_quantity',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function stickerMaster(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(StickerMaster::class);
|
||||
}
|
||||
|
||||
public function stickerMasterRelation()
|
||||
{
|
||||
return $this->belongsTo(StickerMaster::class, 'sticker_master_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\DuplicateStock;
|
||||
use App\Models\User;
|
||||
|
||||
class DuplicateStockPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, DuplicateStock $duplicatestock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, DuplicateStock $duplicatestock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, DuplicateStock $duplicatestock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, DuplicateStock $duplicatestock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, DuplicateStock $duplicatestock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, DuplicateStock $duplicatestock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete DuplicateStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any DuplicateStock');
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\NotInStock;
|
||||
use App\Models\User;
|
||||
|
||||
class NotInStockPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, NotInStock $notinstock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, NotInStock $notinstock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, NotInStock $notinstock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, NotInStock $notinstock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, NotInStock $notinstock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, NotInStock $notinstock): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete NotInStock');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any NotInStock');
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\StockDataMaster;
|
||||
use App\Models\User;
|
||||
|
||||
class StockDataMasterPolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, StockDataMaster $stockdatamaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, StockDataMaster $stockdatamaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, StockDataMaster $stockdatamaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, StockDataMaster $stockdatamaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, StockDataMaster $stockdatamaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, StockDataMaster $stockdatamaster): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete StockDataMaster');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any StockDataMaster');
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
@@ -10,7 +11,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE device_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
|
||||
@@ -142,7 +142,7 @@ return new class extends Migration
|
||||
zmm_type TEXT DEFAULT NULL,
|
||||
zmm_usp TEXT DEFAULT NULL,
|
||||
mark_status TEXT DEFAULT NULL,
|
||||
marked_datetime TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
marked_datetime TIMESTAMP DEFAULT NULL,
|
||||
marked_physical_count TEXT DEFAULT '0',
|
||||
marked_expected_time TEXT DEFAULT '0',
|
||||
marked_by TEXT DEFAULT NULL,
|
||||
@@ -178,7 +178,6 @@ return new class extends Migration
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (gernr, plant_id),
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items (id)
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE stock_data_masters (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
sticker_master_id BIGINT NOT NULL,
|
||||
location TEXT DEFAULT NULL,
|
||||
bin TEXT DEFAULT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
batch TEXT DEFAULT NULL,
|
||||
quantity TEXT DEFAULT NULL,
|
||||
doc_no TEXT DEFAULT NULL,
|
||||
type TEXT DEFAULT '0',
|
||||
motor_scanned_status TEXT DEFAULT NULL,
|
||||
pump_scanned_status TEXT DEFAULT NULL,
|
||||
capacitor_scanned_status TEXT DEFAULT NULL,
|
||||
scanned_status_set TEXT DEFAULT NULL,
|
||||
panel_box_item_code TEXT DEFAULT NULL,
|
||||
panel_box_supplier TEXT DEFAULT NULL,
|
||||
panel_box_sno TEXT DEFAULT NULL,
|
||||
scanned_status TEXT DEFAULT NULL,
|
||||
|
||||
scanned_quantity TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('stock_data_masters');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE not_in_stocks (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
plant_id BIGINT NOT NULL,
|
||||
sticker_master_id BIGINT NOT NULL,
|
||||
location TEXT DEFAULT NULL,
|
||||
bin TEXT DEFAULT NULL,
|
||||
serial_number TEXT DEFAULT NULL,
|
||||
batch TEXT DEFAULT NULL,
|
||||
quantity TEXT DEFAULT NULL,
|
||||
doc_no TEXT DEFAULT NULL,
|
||||
type TEXT DEFAULT '0',
|
||||
motor_scanned_status TEXT DEFAULT NULL,
|
||||
pump_scanned_status TEXT DEFAULT NULL,
|
||||
capacitor_scanned_status TEXT DEFAULT NULL,
|
||||
scanned_status_set TEXT DEFAULT NULL,
|
||||
panel_box_item_code TEXT DEFAULT NULL,
|
||||
panel_box_supplier TEXT DEFAULT NULL,
|
||||
panel_box_sno TEXT DEFAULT NULL,
|
||||
scanned_status TEXT DEFAULT NULL,
|
||||
|
||||
scanned_quantity TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
UNIQUE (plant_id, serial_number),
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants(id),
|
||||
FOREIGN KEY (sticker_master_id) REFERENCES sticker_masters (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('not_in_stocks');
|
||||
}
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE duplicate_stocks (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
|
||||
stock_data_master_id BIGINT NOT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (stock_data_master_id) REFERENCES stock_data_masters(id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('duplicate_stocks');
|
||||
}
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$sql1 = <<<'SQL'
|
||||
ALTER TABLE process_orders
|
||||
ADD COLUMN updated_order_quantity NUMERIC(10,3) NULL
|
||||
SQL;
|
||||
|
||||
DB::statement($sql1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -1,13 +0,0 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
<div class="space-y-4">
|
||||
{{-- Render the Select form fields --}}
|
||||
<div class="space-y-4">
|
||||
{{ $this->form }}
|
||||
</div>
|
||||
<div class="bg-white shadow rounded-xl p-4 mt-6">
|
||||
<livewire:stock-data-table />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-filament-panels::page>
|
||||
@@ -1,126 +0,0 @@
|
||||
<x-filament-panels::page>
|
||||
|
||||
<!-- HEADER -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-4xl font-bold tracking-tight">
|
||||
CRI Digital Manufacturing IIoT Platform
|
||||
</h1>
|
||||
<p class="text-lg text-gray-600 mt-2">
|
||||
Complete visibility, traceability, and control across your manufacturing operations.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- BANNER -->
|
||||
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
|
||||
<div class="w-full overflow-hidden rounded-xl shadow">
|
||||
<img
|
||||
src="{{ asset('images/iiot-banner.jpg') }}"
|
||||
alt="CRI Digital Manufacturing IIoT"
|
||||
class="w-full h-72 object-cover"
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- INTRO -->
|
||||
<div class="max-w-4xl mb-10">
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
CRI Digital Manufacturing IIoT is built to deliver
|
||||
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
|
||||
across plants, lines, and production processes.
|
||||
</p>
|
||||
|
||||
<p class="text-lg text-gray-700">
|
||||
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
|
||||
complete tracking of materials, production orders, and finished goods—helping teams
|
||||
make faster, data-driven decisions with confidence.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- KEY PILLARS -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
|
||||
<p class="text-gray-600">
|
||||
Track materials, batches, and serials from input to dispatch.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">✅ Quality Assurance</h3>
|
||||
<p class="text-gray-600">
|
||||
Validate process data and ensure first-time-right production.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">⏱ On-Time Delivery</h3>
|
||||
<p class="text-gray-600">
|
||||
Identify delays early and meet production commitments.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
|
||||
<p class="text-gray-600">
|
||||
Monitor performance and take quick corrective actions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SUPPORT -->
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
|
||||
<p class="text-gray-700 mb-2">
|
||||
Our dedicated IIoT support team is available round-the-clock to ensure
|
||||
uninterrupted operations and quick issue resolution.
|
||||
</p>
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
||||
</p>
|
||||
{{-- <p class="text-lg font-medium text-gray-900">
|
||||
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p> --}}
|
||||
</div>
|
||||
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
|
||||
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
Our support structure is designed to ensure quick resolution based on the type
|
||||
of issue — whether it is on-site, application-related, or infrastructure-related.
|
||||
</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
🏭 <strong>Plant & On-Site Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For plant visits, industry-level issues, and on-ground validation
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">8925899458 / 8925899459</span>
|
||||
</p>
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
💻 <strong>Application & Logic Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For website errors, logic issues, and application-level problems
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
<!-- TEAM -->
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
|
||||
<div class="flex items-center gap-2">👤 Jothikumar</div>
|
||||
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
|
||||
<div class="flex items-center gap-2">👤 Dhanabalan</div>
|
||||
<div class="flex items-center gap-2">👤 Ranjith</div>
|
||||
<div class="flex items-center gap-2">👤 Srimathy</div>
|
||||
<div class="flex items-center gap-2">👤 Gokul</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
</x-filament-panels::page>
|
||||
@@ -1,13 +1,126 @@
|
||||
<x-filament-panels::page>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-4 md:gap-4 p-2 md:p-4 items-start">
|
||||
{{-- Filters form --}}
|
||||
<div class="space-y-4 w-full max-w-full col-span-1">
|
||||
{{ $this->filtersForm($this->form) }}
|
||||
|
||||
<!-- HEADER -->
|
||||
<div class="mb-8">
|
||||
<h1 class="text-4xl font-bold tracking-tight">
|
||||
CRI Digital Manufacturing IIoT Platform
|
||||
</h1>
|
||||
<p class="text-lg text-gray-600 mt-2">
|
||||
Complete visibility, traceability, and control across your manufacturing operations.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- BANNER -->
|
||||
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
|
||||
<div class="w-full overflow-hidden rounded-xl shadow">
|
||||
<img
|
||||
src="{{ asset('images/iiot-banner.jpg') }}"
|
||||
alt="CRI Digital Manufacturing IIoT"
|
||||
class="w-full h-72 object-cover"
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- INTRO -->
|
||||
<div class="max-w-4xl mb-10">
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
CRI Digital Manufacturing IIoT is built to deliver
|
||||
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
|
||||
across plants, lines, and production processes.
|
||||
</p>
|
||||
|
||||
<p class="text-lg text-gray-700">
|
||||
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
|
||||
complete tracking of materials, production orders, and finished goods—helping teams
|
||||
make faster, data-driven decisions with confidence.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- KEY PILLARS -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
|
||||
<p class="text-gray-600">
|
||||
Track materials, batches, and serials from input to dispatch.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{-- Stat widget --}}
|
||||
<div class="w-full max-w-full col-span-1 sm:col-span-1 lg:col-span-2">
|
||||
@livewire(\App\Filament\Widgets\CumulativeChart::class)
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">✅ Quality Assurance</h3>
|
||||
<p class="text-gray-600">
|
||||
Validate process data and ensure first-time-right production.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">⏱ On-Time Delivery</h3>
|
||||
<p class="text-gray-600">
|
||||
Identify delays early and meet production commitments.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
|
||||
<p class="text-gray-600">
|
||||
Monitor performance and take quick corrective actions.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SUPPORT -->
|
||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
|
||||
<p class="text-gray-700 mb-2">
|
||||
Our dedicated IIoT support team is available round-the-clock to ensure
|
||||
uninterrupted operations and quick issue resolution.
|
||||
</p>
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
||||
</p>
|
||||
{{-- <p class="text-lg font-medium text-gray-900">
|
||||
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p> --}}
|
||||
</div>
|
||||
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
|
||||
|
||||
<p class="text-lg text-gray-700 mb-4">
|
||||
Our support structure is designed to ensure quick resolution based on the type
|
||||
of issue — whether it is on-site, application-related, or infrastructure-related.
|
||||
</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
🏭 <strong>Plant & On-Site Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For plant visits, industry-level issues, and on-ground validation
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">8925899458 / 8925899459</span>
|
||||
</p>
|
||||
|
||||
<p class="text-lg font-medium text-gray-900">
|
||||
💻 <strong>Application & Logic Support</strong> <br>
|
||||
<span class="text-gray-700">
|
||||
For website errors, logic issues, and application-level problems
|
||||
</span><br>
|
||||
📞 <span class="font-semibold">9952468104 / 9100832269</span>
|
||||
</p>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
<!-- TEAM -->
|
||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
|
||||
<div class="flex items-center gap-2">👤 Jothikumar</div>
|
||||
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
|
||||
<div class="flex items-center gap-2">👤 Dhanabalan</div>
|
||||
<div class="flex items-center gap-2">👤 Ranjith</div>
|
||||
<div class="flex items-center gap-2">👤 Srimathy</div>
|
||||
<div class="flex items-center gap-2">👤 Gokul</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
</x-filament-panels::page>
|
||||
|
||||
@@ -1,308 +0,0 @@
|
||||
<div>
|
||||
<div class="mb-4">
|
||||
<h2 class="text-lg font-bold text-gray-800">
|
||||
@if ($hasSearched)
|
||||
FG STOCK DATA TABLE
|
||||
@elseif ($isSfg)
|
||||
SFG STOCK DATA TABLE
|
||||
@elseif ($isnonQuanSfg)
|
||||
SFG STOCK DATA TABLE
|
||||
@else
|
||||
STOCK DATA TABLE
|
||||
@endif
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
<hr class="border-t-2 border-gray-300">
|
||||
</div>
|
||||
|
||||
|
||||
@if ($hasSearched)
|
||||
<div class="overflow-x-auto" style="height: 385px;">
|
||||
<table class="min-w-full text-sm text-center border border-gray-300">
|
||||
<table class="table-fixed min-w-[1500px] text-sm text-center border border-gray-300">
|
||||
<thead class="bg-gray-100 font-bold">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Material Code</th>
|
||||
<th class="border px-4 py-2">Serial Number</th>
|
||||
<th class="border px-4 py-2">Motor Scanned Status</th>
|
||||
<th class="border px-4 py-2">Pump Scanned Status</th>
|
||||
<th class="border px-4 py-2">Scanned Status Set</th>
|
||||
<th class="border px-4 py-2">Scanned Status</th>
|
||||
<th class="border px-4 py-2 w-[300px] whitespace-nowrap">Time Stamp</th>
|
||||
<th class="border px-4 py-2">Operator ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@forelse ($records as $index => $record)
|
||||
<tr wire:key="inv-{{ $record->id }}" class="border-t">
|
||||
<td class="border px-2 py-2">{{ $records->firstItem() + $index }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->stickerMasterRelation?->item?->code ?? 'N/A' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->serial_number ?? 'N/A' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->motor_scanned_status ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->pump_scanned_status ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->scanned_status_set ? '1' : '' }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->scanned_status ?? '' }}</td>
|
||||
<td class="border px-2 py-2 whitespace-nowrap">{{ optional($record->created_at)->format('d-m-Y H:i:s') }}</td>
|
||||
<td class="border px-2 py-2">{{ $record->updated_by ?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="12" class="py-4 text-gray-500">
|
||||
No scanned data found for location <strong>{{ $location }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{-- <div class="mt-3 flex justify-center">
|
||||
{{ $records->onEachSide(3)->links() }}
|
||||
</div> --}}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($isSfg)
|
||||
|
||||
<div class="w-full overflow-x-auto" style="height:385px">
|
||||
|
||||
<table class="w-full text-sm text-center border border-gray-300">
|
||||
|
||||
<thead class="bg-gray-100 font-bold">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Location</th>
|
||||
<th class="border px-4 py-2">Bin</th>
|
||||
<th class="border px-4 py-2">Item Code</th>
|
||||
<th class="border px-4 py-2">Serial Number</th>
|
||||
<th class="border px-4 py-2">Batch</th>
|
||||
<th class="border px-4 py-2">Document Number</th>
|
||||
<th class="border px-4 py-2">Total Quantity</th>
|
||||
<th class="border px-4 py-2">Scanned Quantity</th>
|
||||
<th class="border px-4 py-2">Operator ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@forelse($scannedSfgData as $index => $row)
|
||||
|
||||
<tr>
|
||||
<td class="border px-3 py-2">{{ $index+1 }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['location'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['bin'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['item_code'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['serial_number'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['batch'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['doc_no'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['quantity'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['scanned_quantity'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['updated_by'] }}</td>
|
||||
</tr>
|
||||
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="10" class="py-4 text-gray-500">
|
||||
No scanned SFG data
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if($isnonQuanSfg)
|
||||
|
||||
<div class="w-full overflow-x-auto" style="height:385px">
|
||||
|
||||
<table class="w-full text-sm text-center border border-gray-300">
|
||||
|
||||
<thead class="bg-gray-100 font-bold">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Location</th>
|
||||
<th class="border px-4 py-2">Bin</th>
|
||||
<th class="border px-4 py-2">Item Code</th>
|
||||
<th class="border px-4 py-2">Serial Number</th>
|
||||
<th class="border px-4 py-2">Batch</th>
|
||||
<th class="border px-4 py-2">Document Number</th>
|
||||
<th class="border px-4 py-2">Total Quantity</th>
|
||||
<th class="border px-4 py-2">Scanned Quantity</th>
|
||||
<th class="border px-4 py-2">Operator ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
@forelse($scannedSerials as $index => $row)
|
||||
|
||||
<tr>
|
||||
<td class="border px-3 py-2">{{ $index+1 }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['location'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['bin'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['item_code'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['serial_number'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['batch'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['doc_no'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['quantity'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['scanned_quantity'] }}</td>
|
||||
<td class="border px-3 py-2">{{ $row['updated_by'] }}</td>
|
||||
</tr>
|
||||
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="10" class="py-4 text-gray-500">
|
||||
No scanned SFG data
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Modal for Capacitor Input --}}
|
||||
<div>
|
||||
<button wire:click="$set('showCapacitorInput', true)"></button>
|
||||
@if($showCapacitorInput)
|
||||
<div class="fixed inset-0 z-[9999] bg-black bg-opacity-50 flex items-center justify-center">
|
||||
<div style="background:white; border:4px solid orange;" class="p-6 rounded-xl shadow-2xl w-[450px]">
|
||||
<h3 class="text-xl font-semibold text-orange-700 mb-4">
|
||||
Scan the Panel Box Supplier/Item Code/Serial Number
|
||||
</h3>
|
||||
|
||||
<input
|
||||
type="text"
|
||||
id="capacitorInput"
|
||||
autocomplete="off"
|
||||
wire:model.defer="capacitorInput"
|
||||
wire:keydown.enter.prevent="processCapacitorInput"
|
||||
class="w-full border border-orange-300 rounded px-3 py-2 focus:outline-none focus:ring-0 focus:border-orange-300"
|
||||
placeholder="Scan the panel box QR code"
|
||||
{{-- autofocus --}}
|
||||
onload="this.focus(); this.select();"
|
||||
{{-- onfocus="this.select();" --}}
|
||||
/>
|
||||
|
||||
<div class="flex justify-end gap-2 mt-4">
|
||||
<button type="button" wire:click="cancelCapacitorInput"
|
||||
class="mt-6 ml-10 bg-gray-300 hover:bg-gray-400 px-4 py-2 rounded transition">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{-- Add this script to focus on the input --}}
|
||||
<script>
|
||||
document.getElementById('capacitorInput').focus();
|
||||
</script>
|
||||
{{-- <script>
|
||||
document.addEventListener('livewire:initialized', () => {
|
||||
@this.on('focus-capacitor-input', () => {
|
||||
setTimeout(() => {
|
||||
const el = document.getElementById('capacitorInput');
|
||||
if (el) el.focus();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
</script> --}}
|
||||
@endif
|
||||
</div>
|
||||
|
||||
{{-- Modal for material invoice--}}
|
||||
@if($materialInvoice)
|
||||
{{-- <div class="flex justify-center overflow-x-auto overflow-y-visible" style="height: 385px;"> --}}
|
||||
<div class="overflow-x-auto overflow-y-visible" style="height: 385px;">
|
||||
{{-- <table class="min-w-full text-sm text-center border border-gray-300"> --}}
|
||||
<table class="min-w-full mx-auto text-sm text-center border border-gray-300">
|
||||
<thead class="bg-gray-100 font-bold">
|
||||
<tr>
|
||||
<th class="border px-4 py-2">No</th>
|
||||
<th class="border px-4 py-2">Material Code</th>
|
||||
<th class="border px-4 py-2">Material Type</th>
|
||||
<th class="border px-4 py-2">Material Quantity</th>
|
||||
<th class="border px-4 py-2">Serial Number</th>
|
||||
<th class="border px-4 py-2">Batch Number</th>
|
||||
<th class="border px-4 py-2">TimeStamp</th>
|
||||
<th class="border px-4 py-2">Operator ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($invoiceData as $index => $row)
|
||||
<tr class="border-t">
|
||||
<td class="border px-4 py-2">{{ $index + 1 }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['code'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">
|
||||
@if(($row['material_type'] ?? '') === 'Individual' || ($row['material_type'] ?? '') === 'Bundle')
|
||||
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
|
||||
@else
|
||||
{{ $row['quantity'] ?? 'N/A' }}
|
||||
@endif
|
||||
</td>
|
||||
<td class="border px-4 py-2">{{ $row['serial_number'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['batch_number'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['created_at'] ?? 'N/A' }}</td>
|
||||
<td class="border px-4 py-2">{{ $row['operator_id'] ?? 'N/A' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="10" class="text-center py-4 text-gray-500">
|
||||
No data found for invoice number <strong>{{ $invoiceNumber }}</strong>.
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
{{-- <script>
|
||||
// Clear input and set focus on form load
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const input = document.getElementById('capacitorInput');
|
||||
input.value = ''; // Clear the input field
|
||||
input.focus(); // Set focus to the input field
|
||||
});
|
||||
</script> --}}
|
||||
<script>
|
||||
window.addEventListener('focus-capacitor-input', () => {
|
||||
setTimeout(() => {
|
||||
const input = document.getElementById('capacitorInput');
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
|
||||
window.addEventListener('focus-serial-number', () => {
|
||||
setTimeout(() => {
|
||||
const container = document.getElementById('serial_number_input');
|
||||
const input = container?.querySelector('input'); // gets the actual input inside
|
||||
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
|
||||
window.addEventListener('focus-invoice-number', () => {
|
||||
setTimeout(() => {
|
||||
const container = document.getElementById('invoice_number_input');
|
||||
const input = container?.querySelector('input'); // gets the actual input inside
|
||||
|
||||
if (input) {
|
||||
input.focus();
|
||||
input.select();
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -136,13 +136,9 @@ Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 's
|
||||
|
||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||
|
||||
// User Controller
|
||||
|
||||
Route::get('user/get-data', [UserController::class, 'get_user_data']);
|
||||
|
||||
// Testing panel Controller
|
||||
|
||||
Route::get('testing/user/get-data', [UserController::class, 'get_user_data']);
|
||||
Route::get('testing/user/get-data', [UserController::class, 'get_testing_data']);
|
||||
|
||||
Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_motor_master']);
|
||||
|
||||
@@ -174,7 +170,7 @@ Route::get('laser/characteristics/check', [CharacteristicsController::class, 'ch
|
||||
|
||||
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||
|
||||
// ..Marked serial (auto or manual)
|
||||
// ..serial (auto or manual)
|
||||
|
||||
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user