Compare commits
61 Commits
c7239b02f2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 74cdcb89b9 | |||
|
|
4c7bed8c63 | ||
| 60d17902a2 | |||
|
|
253d319587 | ||
|
|
ead2edc63b | ||
|
|
18f23ce097 | ||
| 6a752b81b2 | |||
|
|
198b901671 | ||
|
|
3192e32d5d | ||
| 44b2ff6f24 | |||
|
|
61be13c367 | ||
| 7a242c820c | |||
|
|
3d139c005a | ||
| bc02a49b54 | |||
|
|
4325f2695f | ||
|
|
8eeb23e2aa | ||
| aa60fc14e0 | |||
|
|
73611a417b | ||
| e7a7ea063f | |||
|
|
37df670eab | ||
| 891b02b6a4 | |||
|
|
58b801b8e2 | ||
|
|
5aa2e7a871 | ||
| 10eff34cc9 | |||
|
|
97fb46883f | ||
| 1a37dd5e49 | |||
|
|
e20892cc83 | ||
|
|
658db00ac8 | ||
| 6bdabe3e1f | |||
|
|
ec8bfc8296 | ||
| 1dba08f5da | |||
|
|
6dff4fb77e | ||
| 80d24b7448 | |||
|
|
41d158877e | ||
| db43960f43 | |||
|
|
0b5b0b8dd4 | ||
| c633d78d7e | |||
|
|
9c582b73a5 | ||
|
|
a67386f7a0 | ||
| 31f96dd11e | |||
|
|
c8fafeb140 | ||
| 4044af92c4 | |||
|
|
f58044036b | ||
| 2ccf1a38e2 | |||
|
|
a91a4ef4f7 | ||
| 084c041f6d | |||
|
|
363241b880 | ||
| b3d39d416a | |||
|
|
23908b1493 | ||
| dbaadd27e3 | |||
|
|
1fe0012a9b | ||
| 313edfed0b | |||
|
|
2efa172e36 | ||
| a5d4c12348 | |||
|
|
a72f03b496 | ||
| 23cdc04a09 | |||
|
|
33ef93a23f | ||
| fb5f69df5f | |||
|
|
66a7406ee3 | ||
| 7ec3e5e9f7 | |||
|
|
392a563561 |
@@ -36,6 +36,8 @@ class ProcessOrderExporter extends Exporter
|
|||||||
->label('COIL NUMBER'),
|
->label('COIL NUMBER'),
|
||||||
ExportColumn::make('order_quantity')
|
ExportColumn::make('order_quantity')
|
||||||
->label('ORDER QUANTITY'),
|
->label('ORDER QUANTITY'),
|
||||||
|
ExportColumn::make('updated_order_quantity')
|
||||||
|
->label('UPDATED ORDER QUANTITY'),
|
||||||
ExportColumn::make('received_quantity')
|
ExportColumn::make('received_quantity')
|
||||||
->label('RECEIVED QUANTITY'),
|
->label('RECEIVED QUANTITY'),
|
||||||
ExportColumn::make('sfg_number')
|
ExportColumn::make('sfg_number')
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class StockDataMasterExporter extends Exporter
|
|||||||
public static function getColumns(): array
|
public static function getColumns(): array
|
||||||
{
|
{
|
||||||
static $rowNumber = 0;
|
static $rowNumber = 0;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
ExportColumn::make('no')
|
ExportColumn::make('no')
|
||||||
->label('NO')
|
->label('NO')
|
||||||
@@ -29,7 +30,7 @@ class StockDataMasterExporter extends Exporter
|
|||||||
->label('TYPE')
|
->label('TYPE')
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
}),
|
}),
|
||||||
ExportColumn::make('location')
|
ExportColumn::make('location')
|
||||||
@@ -60,8 +61,61 @@ class StockDataMasterExporter extends Exporter
|
|||||||
->label('PANEL BOX SNO'),
|
->label('PANEL BOX SNO'),
|
||||||
ExportColumn::make('scanned_status')
|
ExportColumn::make('scanned_status')
|
||||||
->label('SCANNED STATUS'),
|
->label('SCANNED STATUS'),
|
||||||
ExportColumn::make('scanned_count')
|
ExportColumn::make('scanned_quantity')
|
||||||
->label('SCANNED COUNT'),
|
->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')
|
ExportColumn::make('created_at')
|
||||||
->label('CREATED AT'),
|
->label('CREATED AT'),
|
||||||
ExportColumn::make('updated_at')
|
ExportColumn::make('updated_at')
|
||||||
@@ -78,10 +132,10 @@ class StockDataMasterExporter extends Exporter
|
|||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
{
|
{
|
||||||
$body = 'Your stock data master export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
$body = 'Your stock data master export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class ProcessOrderImporter extends Importer
|
|||||||
->example('1000')
|
->example('1000')
|
||||||
->label('ORDER QUANTITY')
|
->label('ORDER QUANTITY')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
|
ImportColumn::make('updated_order_quantity')
|
||||||
|
->exampleHeader('UPDATED ORDER QUANTITY')
|
||||||
|
->label('UPDATED ORDER QUANTITY'),
|
||||||
ImportColumn::make('coil_number')
|
ImportColumn::make('coil_number')
|
||||||
->exampleHeader('COIL NUMBER')
|
->exampleHeader('COIL NUMBER')
|
||||||
// ->example('01')
|
// ->example('01')
|
||||||
@@ -110,6 +113,7 @@ class ProcessOrderImporter extends Importer
|
|||||||
$sfgNo = trim($this->data['sfg_number'] ?? '');
|
$sfgNo = trim($this->data['sfg_number'] ?? '');
|
||||||
$machineName = trim($this->data['machine_name'] ?? '');
|
$machineName = trim($this->data['machine_name'] ?? '');
|
||||||
$orderQuan = trim($this->data['order_quantity'] ?? '');
|
$orderQuan = trim($this->data['order_quantity'] ?? '');
|
||||||
|
$updatedOrderQuan = trim($this->data['updated_order_quantity'] ?? '');
|
||||||
$scrapQuan = trim($this->data['scrap_quantity'] ?? '');
|
$scrapQuan = trim($this->data['scrap_quantity'] ?? '');
|
||||||
$reworkStatus = trim($this->data['rework_status'] ?? '');
|
$reworkStatus = trim($this->data['rework_status'] ?? '');
|
||||||
$recQuan = trim($this->data['received_quantity'] ?? '');
|
$recQuan = trim($this->data['received_quantity'] ?? '');
|
||||||
@@ -128,11 +132,14 @@ class ProcessOrderImporter extends Importer
|
|||||||
if ($iCode == null || $iCode == '') {
|
if ($iCode == null || $iCode == '') {
|
||||||
$warnMsg[] = "Item code can't be empty!";
|
$warnMsg[] = "Item code can't be empty!";
|
||||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||||
$warnMsg[] = 'Invalid item code found';
|
$warnMsg[] = 'Invalid item code found!';
|
||||||
|
}
|
||||||
|
if ($machineName != null && $machineName != '' && Str::length($machineName) > 18) {
|
||||||
|
$warnMsg[] = 'Invalid machine name found!';
|
||||||
}
|
}
|
||||||
if ($processOrder == null || $processOrder == '') {
|
if ($processOrder == null || $processOrder == '') {
|
||||||
$warnMsg[] = "Process order can't be empty!";
|
$warnMsg[] = "Process order can't be empty!";
|
||||||
} elseif ($processOrder && Str::contains($processOrder, '.')) {
|
} elseif ($processOrder && (Str::contains($processOrder, '.') || Str::contains($processOrder, 'E', ignoreCase: true))) {
|
||||||
$warnMsg[] = 'Invalid process order found!';
|
$warnMsg[] = 'Invalid process order found!';
|
||||||
}
|
}
|
||||||
if ($lineNam == null || $lineNam == '') {
|
if ($lineNam == null || $lineNam == '') {
|
||||||
@@ -145,6 +152,12 @@ class ProcessOrderImporter extends Importer
|
|||||||
} elseif (Str::length($orderQuan) >= 1 && ! is_numeric($orderQuan)) {
|
} elseif (Str::length($orderQuan) >= 1 && ! is_numeric($orderQuan)) {
|
||||||
$warnMsg[] = 'Invalid order quantity found!';
|
$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 == '') {
|
if ($coilNo == null || $coilNo == '') {
|
||||||
$coilNo = '0';
|
$coilNo = '0';
|
||||||
}
|
}
|
||||||
@@ -159,7 +172,7 @@ class ProcessOrderImporter extends Importer
|
|||||||
} elseif ($reworkStatus == 1 || $reworkStatus = '1') {
|
} elseif ($reworkStatus == 1 || $reworkStatus = '1') {
|
||||||
$reworkStatus = 1;
|
$reworkStatus = 1;
|
||||||
} else {
|
} else {
|
||||||
$warnMsg[] = 'Invalid rework status found';
|
$warnMsg[] = 'Invalid rework status found!';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($warnMsg)) {
|
if (! empty($warnMsg)) {
|
||||||
@@ -223,7 +236,7 @@ class ProcessOrderImporter extends Importer
|
|||||||
->first();
|
->first();
|
||||||
|
|
||||||
if ($existingOrder && $existingOrder->item_id !== ($itemId ?? null)) {
|
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!';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,6 +256,39 @@ class ProcessOrderImporter extends Importer
|
|||||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
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')) {
|
if ($coilNo != null && $coilNo != '' && $scrapQuan && $reworkStatus && $recQuan && $createdAt && $createdBy && $updatedAt && $updatedBy && Filament::auth()->user()->hasRole('Super Admin')) {
|
||||||
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
@@ -250,6 +296,17 @@ class ProcessOrderImporter extends Importer
|
|||||||
->where('coil_number', $coilNo)
|
->where('coil_number', $coilNo)
|
||||||
->first();
|
->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) {
|
if (! $existingCoil) {
|
||||||
ProcessOrder::Create(
|
ProcessOrder::Create(
|
||||||
[
|
[
|
||||||
@@ -259,6 +316,7 @@ class ProcessOrderImporter extends Importer
|
|||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'coil_number' => $coilNo,
|
'coil_number' => $coilNo,
|
||||||
'order_quantity' => $orderQuan,
|
'order_quantity' => $orderQuan,
|
||||||
|
'updated_order_quantity' => $existUpdateOrdQuan,
|
||||||
'received_quantity' => $recQuan,
|
'received_quantity' => $recQuan,
|
||||||
'scrap_quantity' => $scrapQuan,
|
'scrap_quantity' => $scrapQuan,
|
||||||
'sfg_number' => $sfgNo,
|
'sfg_number' => $sfgNo,
|
||||||
@@ -288,10 +346,16 @@ class ProcessOrderImporter extends Importer
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$coilNo = '0';
|
$coilNo = '0';
|
||||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
// $existing = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
// ->where('process_order', $processOrder)
|
||||||
// ->where('coil_number', $coilNo)
|
// // ->where('coil_number', $coilNo)
|
||||||
->first();
|
// ->first();
|
||||||
|
|
||||||
|
if ($existing) {
|
||||||
|
$existUpdateOrdQuan = $existing->updated_order_quantity;
|
||||||
|
} else {
|
||||||
|
$existUpdateOrdQuan = $updatedOrderQuan;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $existing && ($coilNo == '0' || $coilNo == 0)) {
|
if (! $existing && ($coilNo == '0' || $coilNo == 0)) {
|
||||||
ProcessOrder::create([
|
ProcessOrder::create([
|
||||||
@@ -301,6 +365,7 @@ class ProcessOrderImporter extends Importer
|
|||||||
'process_order' => $processOrder,
|
'process_order' => $processOrder,
|
||||||
'coil_number' => '0',
|
'coil_number' => '0',
|
||||||
'order_quantity' => $orderQuan,
|
'order_quantity' => $orderQuan,
|
||||||
|
'updated_order_quantity' => $existUpdateOrdQuan,
|
||||||
'received_quantity' => 0,
|
'received_quantity' => 0,
|
||||||
'scrap_quantity' => 0,
|
'scrap_quantity' => 0,
|
||||||
'created_by' => $createdBy,
|
'created_by' => $createdBy,
|
||||||
@@ -315,6 +380,7 @@ class ProcessOrderImporter extends Importer
|
|||||||
'process_order' => $processOrder,
|
'process_order' => $processOrder,
|
||||||
'coil_number' => $coilNo,
|
'coil_number' => $coilNo,
|
||||||
'order_quantity' => $orderQuan,
|
'order_quantity' => $orderQuan,
|
||||||
|
'updated_order_quantity' => $existUpdateOrdQuan,
|
||||||
'received_quantity' => $recQuan,
|
'received_quantity' => $recQuan,
|
||||||
'scrap_quantity' => $scrapQuan ?? 0,
|
'scrap_quantity' => $scrapQuan ?? 0,
|
||||||
'sfg_number' => $sfgNo,
|
'sfg_number' => $sfgNo,
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ use App\Models\Item;
|
|||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use App\Models\StockDataMaster;
|
use App\Models\StockDataMaster;
|
||||||
|
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||||
use Filament\Actions\Imports\ImportColumn;
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
use Filament\Actions\Imports\Importer;
|
use Filament\Actions\Imports\Importer;
|
||||||
use Filament\Actions\Imports\Models\Import;
|
use Filament\Actions\Imports\Models\Import;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Str;
|
use Str;
|
||||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
|
||||||
|
|
||||||
class StockDataMasterImporter extends Importer
|
class StockDataMasterImporter extends Importer
|
||||||
{
|
{
|
||||||
@@ -23,46 +23,46 @@ class StockDataMasterImporter extends Importer
|
|||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('PLANT CODE')
|
->exampleHeader('PLANT CODE')
|
||||||
->example('1000')
|
->examples(['1000', '1000'])
|
||||||
->label('PLANT CODE')
|
->label('PLANT CODE')
|
||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('type')
|
ImportColumn::make('type')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('TYPE')
|
->exampleHeader('TYPE')
|
||||||
->example('FG/SFG')
|
->examples(['FG', 'NON-FG'])
|
||||||
->label('TYPE'),
|
->label('TYPE'),
|
||||||
ImportColumn::make('location')
|
ImportColumn::make('location')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('LOCATION')
|
->exampleHeader('LOCATION')
|
||||||
->example('2001')
|
->examples(['2001', '2002'])
|
||||||
->label('LOCATION')
|
->label('LOCATION')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('item_reference')// stickerMaster
|
ImportColumn::make('item_reference')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('ITEM CODE')
|
->exampleHeader('ITEM CODE')
|
||||||
->example('123456')
|
->examples(['123456', '246118'])
|
||||||
->label('ITEM CODE')
|
->label('ITEM CODE')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('serial_number')
|
ImportColumn::make('serial_number')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('SERIAL NUMBER')
|
->exampleHeader('SERIAL NUMBER')
|
||||||
->example('200235236622')
|
->examples(['200235236622', '200235236623'])
|
||||||
->label('SERIAL NUMBER'),
|
->label('SERIAL NUMBER'),
|
||||||
ImportColumn::make('batch')
|
ImportColumn::make('batch')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('BATCH')
|
->exampleHeader('BATCH')
|
||||||
->example('20102')
|
->examples(['20102', '20103'])
|
||||||
->label('BATCH'),
|
->label('BATCH'),
|
||||||
ImportColumn::make('quantity')
|
ImportColumn::make('quantity')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('QUANTITY')
|
->exampleHeader('QUANTITY')
|
||||||
->example('1')
|
->examples(['1', '1'])
|
||||||
->label('QUANTITY'),
|
->label('QUANTITY'),
|
||||||
ImportColumn::make('doc_no')
|
ImportColumn::make('doc_no')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('DOCUMENT NUMBER')
|
->exampleHeader('DOCUMENT NUMBER')
|
||||||
->example('156566')
|
->examples(['82128', '21222'])
|
||||||
->label('DOCUMENT NUMBER'),
|
->label('DOCUMENT NUMBER'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -86,26 +86,21 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
|
|
||||||
if ($plantCod == null || $plantCod == '') {
|
if ($plantCod == null || $plantCod == '') {
|
||||||
$warnMsg[] = "Plant code can't be empty!";
|
$warnMsg[] = "Plant code can't be empty!";
|
||||||
}
|
} elseif ($typeValue == null || $typeValue == '') {
|
||||||
else if ($typeValue == null || $typeValue == '') {
|
|
||||||
$warnMsg[] = "Type can't be empty!";
|
$warnMsg[] = "Type can't be empty!";
|
||||||
}
|
} elseif ($iCode == null || $iCode == '') {
|
||||||
else if ($iCode == null || $iCode == '') {
|
|
||||||
$warnMsg[] = "Item code can't be empty!";
|
$warnMsg[] = "Item code can't be empty!";
|
||||||
}
|
} elseif ($location == null || $location == '') {
|
||||||
else if ($location == null || $location == '') {
|
|
||||||
$warnMsg[] = "Location can't be empty!";
|
$warnMsg[] = "Location can't be empty!";
|
||||||
}
|
} elseif ($serialNumber == null || $serialNumber == '') {
|
||||||
else if ($serialNumber == null || $serialNumber == '') {
|
|
||||||
$warnMsg[] = "Serial number can't be empty!";
|
$warnMsg[] = "Serial number can't be empty!";
|
||||||
}
|
}
|
||||||
// else if ($batch == null || $batch == '') {
|
// else if ($batch == null || $batch == '') {
|
||||||
// $warnMsg[] = "Batch can't be empty!";
|
// $warnMsg[] = "Batch can't be empty!";
|
||||||
// }
|
// }
|
||||||
else if ($quantity == null || $quantity == '') {
|
elseif ($quantity == null || $quantity == '') {
|
||||||
$warnMsg[] = "Quantity can't be empty!";
|
$warnMsg[] = "Quantity can't be empty!";
|
||||||
}
|
}
|
||||||
// else if ($docNo == null || $docNo == '') {
|
// else if ($docNo == null || $docNo == '') {
|
||||||
@@ -152,33 +147,27 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
$typeValue = strtoupper($typeValue);
|
$typeValue = strtoupper($typeValue);
|
||||||
|
|
||||||
if (! in_array($typeValue, ['FG', 'SFG'])) {
|
if (! in_array($typeValue, ['FG', 'NON-FG'])) {
|
||||||
$warnMsg[] = 'Invalid type found! It should be either FG or SFG and fg/sfg.';
|
$warnMsg[] = 'Invalid type found! It should be either FG or NON-FG.';
|
||||||
}
|
} elseif (Str::length($location) < 4) {
|
||||||
else if (Str::length($location) < 4) {
|
|
||||||
$warnMsg[] = 'Location should contain minimum 4 digits!';
|
$warnMsg[] = 'Location should contain minimum 4 digits!';
|
||||||
}
|
} elseif (! ctype_digit((string) $location)) {
|
||||||
else if (! ctype_digit((string) $location)) {
|
|
||||||
$warnMsg[] = 'Location must be an integer!';
|
$warnMsg[] = 'Location must be an integer!';
|
||||||
}
|
} elseif (Str::length($serialNumber) < 9) {
|
||||||
else if (Str::length($serialNumber) < 9) {
|
|
||||||
$warnMsg[] = 'Serial number should contain minimum 9 digits!';
|
$warnMsg[] = 'Serial number should contain minimum 9 digits!';
|
||||||
}
|
} elseif (! ctype_alnum($serialNumber)) {
|
||||||
else if (!ctype_alnum($serialNumber)) {
|
|
||||||
$warnMsg[] = 'Serial number should contain alpha-numeric values!';
|
$warnMsg[] = 'Serial number should contain alpha-numeric values!';
|
||||||
}
|
} elseif (! ctype_digit((string) $quantity) || (int) $quantity <= 0) {
|
||||||
|
|
||||||
else if (! ctype_digit((string) $quantity) || (int) $quantity <= 0) {
|
|
||||||
$warnMsg[] = 'Quantity must be an integer and greater than 0!';
|
$warnMsg[] = 'Quantity must be an integer and greater than 0!';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($batch){
|
if ($batch) {
|
||||||
if (Str::length($batch) < 5) {
|
if (Str::length($batch) < 5) {
|
||||||
$warnMsg[] = 'Batch should contain minimum 5 digits!';
|
$warnMsg[] = 'Batch should contain minimum 5 digits!';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($docNo){
|
if ($docNo) {
|
||||||
if (Str::length($docNo) < 5) {
|
if (Str::length($docNo) < 5) {
|
||||||
$warnMsg[] = 'Document number contain minimum 5 digits!';
|
$warnMsg[] = 'Document number contain minimum 5 digits!';
|
||||||
}
|
}
|
||||||
@@ -190,7 +179,7 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
$type = match ($typeValue) {
|
$type = match ($typeValue) {
|
||||||
'FG' => '0',
|
'FG' => '0',
|
||||||
'SFG' => '1',
|
'NON-FG' => '1',
|
||||||
default => null,
|
default => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -199,7 +188,7 @@ class StockDataMasterImporter extends Importer
|
|||||||
$record = StockDataMaster::where([
|
$record = StockDataMaster::where([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'sticker_master_id' => $stickId,
|
'sticker_master_id' => $stickId,
|
||||||
'serial_number' => $serialNumber
|
'serial_number' => $serialNumber,
|
||||||
])->first();
|
])->first();
|
||||||
|
|
||||||
if ($record) {
|
if ($record) {
|
||||||
@@ -234,10 +223,10 @@ class StockDataMasterImporter extends Importer
|
|||||||
|
|
||||||
public static function getCompletedNotificationBody(Import $import): string
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
{
|
{
|
||||||
$body = 'Your stock data master import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
$body = 'Your stock data master import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||||
|
|
||||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
|
|||||||
2231
app/Filament/Pages/CycleCount.php
Normal file
2231
app/Filament/Pages/CycleCount.php
Normal file
File diff suppressed because it is too large
Load Diff
181
app/Filament/Resources/DuplicateStockResource.php
Normal file
181
app/Filament/Resources/DuplicateStockResource.php
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
<?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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?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(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?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(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?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(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\NotInStockResource\Pages;
|
use App\Filament\Resources\NotInStockResource\Pages;
|
||||||
use App\Filament\Resources\NotInStockResource\RelationManagers;
|
|
||||||
use App\Models\NotInStock;
|
use App\Models\NotInStock;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -38,15 +37,15 @@ class NotInStockResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function ($get) {
|
->options(function ($get) {
|
||||||
if (!$get('plant_id')) {
|
if (! $get('plant_id')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return StickerMaster::with('item')
|
return StickerMaster::with('item')
|
||||||
->where('plant_id', $get('plant_id'))
|
->where('plant_id', $get('plant_id'))
|
||||||
->get()
|
->get()
|
||||||
->pluck('item.code', 'id')
|
->pluck('item.code', 'id')
|
||||||
->toArray();
|
->toArray();
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('location')
|
Forms\Components\TextInput::make('location')
|
||||||
->label('Location'),
|
->label('Location'),
|
||||||
@@ -64,7 +63,7 @@ class NotInStockResource extends Resource
|
|||||||
->label('Type')
|
->label('Type')
|
||||||
->options([
|
->options([
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
]),
|
]),
|
||||||
Forms\Components\TextInput::make('motor_scanned_status')
|
Forms\Components\TextInput::make('motor_scanned_status')
|
||||||
->label('Motor Scanned Status'),
|
->label('Motor Scanned Status'),
|
||||||
@@ -122,7 +121,7 @@ class NotInStockResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
})
|
})
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class ProcessOrderResource extends Resource
|
|||||||
$set('process_order', null);
|
$set('process_order', null);
|
||||||
$set('coil_number', '0');
|
$set('coil_number', '0');
|
||||||
$set('order_quantity', '0');
|
$set('order_quantity', '0');
|
||||||
|
$set('updated_order_quantity', '0');
|
||||||
$set('received_quantity', '0');
|
$set('received_quantity', '0');
|
||||||
$set('scrap_quantity', '0');
|
$set('scrap_quantity', '0');
|
||||||
$set('sfg_number', null);
|
$set('sfg_number', null);
|
||||||
@@ -113,6 +114,7 @@ class ProcessOrderResource extends Resource
|
|||||||
$set('process_order', null);
|
$set('process_order', null);
|
||||||
$set('coil_number', '0');
|
$set('coil_number', '0');
|
||||||
$set('order_quantity', '0');
|
$set('order_quantity', '0');
|
||||||
|
$set('updated_order_quantity', '0');
|
||||||
$set('received_quantity', '0');
|
$set('received_quantity', '0');
|
||||||
$set('scrap_quantity', '0');
|
$set('scrap_quantity', '0');
|
||||||
$set('sfg_number', null);
|
$set('sfg_number', null);
|
||||||
@@ -141,6 +143,7 @@ class ProcessOrderResource extends Resource
|
|||||||
$set('process_order', null);
|
$set('process_order', null);
|
||||||
$set('coil_number', '0');
|
$set('coil_number', '0');
|
||||||
$set('order_quantity', '0');
|
$set('order_quantity', '0');
|
||||||
|
$set('updated_order_quantity', '0');
|
||||||
$set('received_quantity', '0');
|
$set('received_quantity', '0');
|
||||||
$set('scrap_quantity', '0');
|
$set('scrap_quantity', '0');
|
||||||
$set('sfg_number', null);
|
$set('sfg_number', null);
|
||||||
@@ -217,6 +220,7 @@ class ProcessOrderResource extends Resource
|
|||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$set('coil_number', '0');
|
$set('coil_number', '0');
|
||||||
$set('order_quantity', '0');
|
$set('order_quantity', '0');
|
||||||
|
$set('updated_order_quantity', '0');
|
||||||
$set('received_quantity', '0');
|
$set('received_quantity', '0');
|
||||||
$set('scrap_quantity', '0');
|
$set('scrap_quantity', '0');
|
||||||
$set('sfg_number', null);
|
$set('sfg_number', null);
|
||||||
@@ -280,10 +284,10 @@ class ProcessOrderResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
->numeric()
|
->numeric()
|
||||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$processOrder = $get('process_order');
|
$processOrder = trim($get('process_order'));
|
||||||
// $coilNo = $get('coil_number');
|
// $coilNo = $get('coil_number');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
$set('poPlantError', 'Please select a plant first.');
|
$set('poPlantError', 'Please select a plant first.');
|
||||||
@@ -319,14 +323,29 @@ class ProcessOrderResource extends Resource
|
|||||||
function (callable $get) {
|
function (callable $get) {
|
||||||
return Rule::unique('process_orders', 'coil_number')
|
return Rule::unique('process_orders', 'coil_number')
|
||||||
->where('plant_id', $get('plant_id'))
|
->where('plant_id', $get('plant_id'))
|
||||||
->where('process_order', $get('process_order'))
|
->where('process_order', trim($get('process_order')))
|
||||||
->ignore($get('id'));
|
->ignore($get('id'));
|
||||||
},
|
},
|
||||||
function (callable $get): Closure {
|
function (callable $get): Closure {
|
||||||
return function (string $attribute, $value, Closure $fail) use ($get) {
|
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||||
$rework = $get('rework_status');
|
$rework = $get('rework_status');
|
||||||
if ($value && Str::contains($value, '.') && $rework == 0) {
|
$plantId = $get('plant_id');
|
||||||
$fail("Rework status should be 'Yes' for rework coil number '{$value}'!");
|
$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!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -334,7 +353,7 @@ class ProcessOrderResource extends Resource
|
|||||||
// ->rule(function (callable $get) {
|
// ->rule(function (callable $get) {
|
||||||
// return Rule::unique('process_orders', 'coil_number')
|
// return Rule::unique('process_orders', 'coil_number')
|
||||||
// ->where('plant_id', $get('plant_id'))
|
// ->where('plant_id', $get('plant_id'))
|
||||||
// ->where('process_order', $get('process_order'))
|
// ->where('process_order', trim($get('process_order')))
|
||||||
// ->ignore($get('id'));
|
// ->ignore($get('id'));
|
||||||
// })
|
// })
|
||||||
->extraAttributes(fn ($get) => [
|
->extraAttributes(fn ($get) => [
|
||||||
@@ -348,15 +367,17 @@ class ProcessOrderResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
->numeric()
|
->numeric()
|
||||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$itemId = $get('item_id');
|
$itemId = $get('item_id');
|
||||||
$processOrder = trim($get('process_order'));
|
$processOrder = trim($get('process_order'));
|
||||||
$set('received_quantity', '0');
|
$set('received_quantity', '0');
|
||||||
|
// $set('updated_order_quantity', $state);
|
||||||
$set('scrap_quantity', '0');
|
$set('scrap_quantity', '0');
|
||||||
if (! $plantId || ! $itemId || ! $processOrder) {
|
if (! $plantId || ! $itemId || ! $processOrder) {
|
||||||
$set('order_quantity', '0');
|
$set('order_quantity', '0');
|
||||||
|
$set('updated_order_quantity', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = ProcessOrder::where('plant_id', $plantId)
|
$query = ProcessOrder::where('plant_id', $plantId)
|
||||||
@@ -372,13 +393,175 @@ class ProcessOrderResource extends Resource
|
|||||||
}
|
}
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$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')
|
Forms\Components\TextInput::make('received_quantity')
|
||||||
->label('Received Quantity')
|
->label('Received Quantity')
|
||||||
->default('0.000')
|
->default('0.000')
|
||||||
->required()
|
->required()
|
||||||
->reactive()
|
->reactive()
|
||||||
->numeric()
|
->numeric()
|
||||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
->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}'.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('scrap_quantity', '0');
|
$set('scrap_quantity', '0');
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
@@ -387,7 +570,7 @@ class ProcessOrderResource extends Resource
|
|||||||
->label('Scrap Quantity')
|
->label('Scrap Quantity')
|
||||||
->default('0.000')
|
->default('0.000')
|
||||||
->required()
|
->required()
|
||||||
->readOnly(fn ($get) => ($get('rework_status') == 0 || $get('process_order') == null))
|
->readOnly(fn ($get) => ($get('rework_status') == 0 || trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||||
->reactive()
|
->reactive()
|
||||||
->numeric()
|
->numeric()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
@@ -414,7 +597,7 @@ class ProcessOrderResource extends Resource
|
|||||||
Forms\Components\TextInput::make('sfg_number')
|
Forms\Components\TextInput::make('sfg_number')
|
||||||
->label('SFG Number')
|
->label('SFG Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
$sfgNo = $get('sfg_number');
|
$sfgNo = $get('sfg_number');
|
||||||
@@ -448,7 +631,8 @@ class ProcessOrderResource extends Resource
|
|||||||
Forms\Components\TextInput::make('machine_name')
|
Forms\Components\TextInput::make('machine_name')
|
||||||
->label('Machine Name')
|
->label('Machine Name')
|
||||||
->reactive()
|
->reactive()
|
||||||
->readOnly(fn ($get) => ($get('process_order') == null))
|
->maxLength(18)
|
||||||
|
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
@@ -576,7 +760,7 @@ class ProcessOrderResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the value of process_order field
|
// Get the value of process_order field
|
||||||
$processOrder = $get('process_order');
|
$processOrder = trim($get('process_order'));
|
||||||
|
|
||||||
if ($batchId != $processOrder) {
|
if ($batchId != $processOrder) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -621,7 +805,7 @@ class ProcessOrderResource extends Resource
|
|||||||
return Filament::auth()->user()->can('view process order packing slip');
|
return Filament::auth()->user()->can('view process order packing slip');
|
||||||
})
|
})
|
||||||
->action(function ($get, callable $set) {
|
->action(function ($get, callable $set) {
|
||||||
$equipmentNumber = $get('process_order');
|
$equipmentNumber = trim($get('process_order'));
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
|
||||||
if (! $equipmentNumber) {
|
if (! $equipmentNumber) {
|
||||||
@@ -720,6 +904,11 @@ class ProcessOrderResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('updated_order_quantity')
|
||||||
|
->label('Updated Order Quantity')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('received_quantity')
|
Tables\Columns\TextColumn::make('received_quantity')
|
||||||
->label('Received Quantity')
|
->label('Received Quantity')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -1064,7 +1253,7 @@ class ProcessOrderResource extends Resource
|
|||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant');
|
$plantId = $get('plant');
|
||||||
$itemId = $get('Item');
|
$itemId = $get('Item');
|
||||||
$processOrder = $get('process_order');
|
$processOrder = trim($get('process_order'));
|
||||||
|
|
||||||
if (empty($plantId) || empty($itemId) || empty($processOrder)) {
|
if (empty($plantId) || empty($itemId) || empty($processOrder)) {
|
||||||
return [];
|
return [];
|
||||||
@@ -1081,7 +1270,7 @@ class ProcessOrderResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$plantId = $get('plant');
|
$plantId = $get('plant');
|
||||||
$itemId = $get('Item');
|
$itemId = $get('Item');
|
||||||
$processOrder = $get('process_order');
|
$processOrder = trim($get('process_order'));
|
||||||
|
|
||||||
if (! $plantId || ! $itemId || ! $processOrder || ! $state) {
|
if (! $plantId || ! $itemId || ! $processOrder || ! $state) {
|
||||||
$set('received_quantity', null);
|
$set('received_quantity', null);
|
||||||
|
|||||||
@@ -3,10 +3,28 @@
|
|||||||
namespace App\Filament\Resources\ProcessOrderResource\Pages;
|
namespace App\Filament\Resources\ProcessOrderResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\ProcessOrderResource;
|
use App\Filament\Resources\ProcessOrderResource;
|
||||||
|
use App\Models\ProcessOrder;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
class CreateProcessOrder extends CreateRecord
|
class CreateProcessOrder extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ProcessOrderResource::class;
|
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,13 +3,78 @@
|
|||||||
namespace App\Filament\Resources\ProcessOrderResource\Pages;
|
namespace App\Filament\Resources\ProcessOrderResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\ProcessOrderResource;
|
use App\Filament\Resources\ProcessOrderResource;
|
||||||
|
use App\Models\ProcessOrder;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
class EditProcessOrder extends EditRecord
|
class EditProcessOrder extends EditRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = ProcessOrderResource::class;
|
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
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -5,19 +5,26 @@ namespace App\Filament\Resources;
|
|||||||
use App\Filament\Exports\StockDataMasterExporter;
|
use App\Filament\Exports\StockDataMasterExporter;
|
||||||
use App\Filament\Imports\StockDataMasterImporter;
|
use App\Filament\Imports\StockDataMasterImporter;
|
||||||
use App\Filament\Resources\StockDataMasterResource\Pages;
|
use App\Filament\Resources\StockDataMasterResource\Pages;
|
||||||
use App\Filament\Resources\StockDataMasterResource\RelationManagers;
|
use App\Models\Item;
|
||||||
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use App\Models\StockDataMaster;
|
use App\Models\StockDataMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Radio;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
use Filament\Tables\Actions\ExportAction;
|
|
||||||
use Filament\Tables\Actions\ImportAction;
|
|
||||||
|
|
||||||
class StockDataMasterResource extends Resource
|
class StockDataMasterResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -42,15 +49,15 @@ class StockDataMasterResource extends Resource
|
|||||||
->required()
|
->required()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function ($get) {
|
->options(function ($get) {
|
||||||
if (!$get('plant_id')) {
|
if (! $get('plant_id')) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return StickerMaster::with('item')
|
return StickerMaster::with('item')
|
||||||
->where('plant_id', $get('plant_id'))
|
->where('plant_id', $get('plant_id'))
|
||||||
->get()
|
->get()
|
||||||
->pluck('item.code', 'id')
|
->pluck('item.code', 'id')
|
||||||
->toArray();
|
->toArray();
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('location')
|
Forms\Components\TextInput::make('location')
|
||||||
->label('Location'),
|
->label('Location'),
|
||||||
@@ -68,7 +75,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->label('Type')
|
->label('Type')
|
||||||
->options([
|
->options([
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
]),
|
]),
|
||||||
Forms\Components\TextInput::make('motor_scanned_status')
|
Forms\Components\TextInput::make('motor_scanned_status')
|
||||||
->label('Motor Scanned Status'),
|
->label('Motor Scanned Status'),
|
||||||
@@ -126,7 +133,7 @@ class StockDataMasterResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->formatStateUsing(fn ($state) => match ($state) {
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
'0' => 'FG',
|
'0' => 'FG',
|
||||||
'1' => 'SFG',
|
'1' => 'NON-FG',
|
||||||
default => '-',
|
default => '-',
|
||||||
})
|
})
|
||||||
->sortable(),
|
->sortable(),
|
||||||
@@ -164,37 +171,44 @@ class StockDataMasterResource extends Resource
|
|||||||
->label('Motor Scanned Status')
|
->label('Motor Scanned Status')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('pump_scanned_status')
|
Tables\Columns\TextColumn::make('pump_scanned_status')
|
||||||
->label('Pump Scanned Status')
|
->label('Pump Scanned Status')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('capacitor_scanned_status')
|
Tables\Columns\TextColumn::make('capacitor_scanned_status')
|
||||||
->label('Capacitor Scanned Status')
|
->label('Capacitor Scanned Status')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('scanned_status_set')
|
Tables\Columns\TextColumn::make('scanned_status_set')
|
||||||
->label('Scanned Status Set')
|
->label('Scanned Status Set')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('panel_box_item_code')
|
Tables\Columns\TextColumn::make('panel_box_item_code')
|
||||||
->label('Panel Box Item Code')
|
->label('Panel Box Item Code')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('panel_box_supplier')
|
Tables\Columns\TextColumn::make('panel_box_supplier')
|
||||||
->label('Panel Box Supplier')
|
->label('Panel Box Supplier')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('panel_box_sno')
|
Tables\Columns\TextColumn::make('panel_box_sno')
|
||||||
->label('Panel Box Serial Number')
|
->label('Panel Box Serial Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable()
|
||||||
|
->visible(fn ($livewire) => ($livewire->tableFilters['advanced_filters']['type'] ?? null) != '1'),
|
||||||
Tables\Columns\TextColumn::make('scanned_status')
|
Tables\Columns\TextColumn::make('scanned_status')
|
||||||
->label('Scanned Status')
|
->label('Scanned Status')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -205,6 +219,64 @@ class StockDataMasterResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->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')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -226,7 +298,252 @@ class StockDataMasterResource extends Resource
|
|||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
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([
|
->actions([
|
||||||
Tables\Actions\ViewAction::make(),
|
Tables\Actions\ViewAction::make(),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
|
|||||||
@@ -627,7 +627,7 @@ class PdfController extends Controller
|
|||||||
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
|
// 'coil_number' => $proOrdAgPlant->coil_number ?? "",
|
||||||
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
|
// 'order_quantity' => (string)$proOrdAgPlant->order_quantity ?? "",
|
||||||
'coil_number' => $currentCoil,
|
'coil_number' => $currentCoil,
|
||||||
'order_quantity' => (string) $lastRecord->order_quantity ?? '0.000',
|
'order_quantity' => (string) $lastRecord->updated_order_quantity ?? '0.000',
|
||||||
'ok_quantity' => (string) $okQty ?? '0',
|
'ok_quantity' => (string) $okQty ?? '0',
|
||||||
'not_ok_quantity' => (string) $notOkQty ?? '0',
|
'not_ok_quantity' => (string) $notOkQty ?? '0',
|
||||||
'received_quantity' => (string) (($totalReceivedQty == 0) ? '0.000' : $totalReceivedQty) ?? '0.000',
|
'received_quantity' => (string) (($totalReceivedQty == 0) ? '0.000' : $totalReceivedQty) ?? '0.000',
|
||||||
@@ -686,7 +686,7 @@ class PdfController extends Controller
|
|||||||
$itemCode = $data['item_code'] ?? '';
|
$itemCode = $data['item_code'] ?? '';
|
||||||
$lineName = $data['line_name'] ?? '';
|
$lineName = $data['line_name'] ?? '';
|
||||||
$coilNo = $data['coil_number'] ?? '';
|
$coilNo = $data['coil_number'] ?? '';
|
||||||
$orderQty = $data['order_quantity'] ?? 0;
|
$updatedOrderQty = $data['order_quantity'] ?? 0;
|
||||||
$receivedQty = $data['received_quantity'] ?? 0;
|
$receivedQty = $data['received_quantity'] ?? 0;
|
||||||
$scrapQty = $data['scrap_quantity'] ?? 0;
|
$scrapQty = $data['scrap_quantity'] ?? 0;
|
||||||
$sfgNo = $data['sfg_number'] ?? '';
|
$sfgNo = $data['sfg_number'] ?? '';
|
||||||
@@ -728,6 +728,17 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 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();
|
$line = Line::where('name', $lineName)->first();
|
||||||
|
|
||||||
if (! $line) {
|
if (! $line) {
|
||||||
@@ -861,7 +872,8 @@ class PdfController extends Controller
|
|||||||
->where('item_id', $itemId)
|
->where('item_id', $itemId)
|
||||||
->sum('received_quantity');
|
->sum('received_quantity');
|
||||||
|
|
||||||
if ($orderQty == 0) {
|
$orderQty = 0;
|
||||||
|
if ($updatedOrderQty == 0) {
|
||||||
$orderExist = ProcessOrder::where('plant_id', $plantId)
|
$orderExist = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
->where('item_id', $itemId)->latest()->first();
|
->where('item_id', $itemId)->latest()->first();
|
||||||
@@ -869,6 +881,7 @@ class PdfController extends Controller
|
|||||||
|
|
||||||
if ($orderExist) {
|
if ($orderExist) {
|
||||||
$orderQty = $orderExist->order_quantity ?? 0;
|
$orderQty = $orderExist->order_quantity ?? 0;
|
||||||
|
$updatedOrderQty = $orderExist->updated_order_quantity ?? 0;
|
||||||
} else {
|
} else {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -882,9 +895,11 @@ class PdfController extends Controller
|
|||||||
// ->value('order_quantity') ?? 0;
|
// ->value('order_quantity') ?? 0;
|
||||||
|
|
||||||
if ($orderExist) {
|
if ($orderExist) {
|
||||||
$existOrderQty = $orderExist->order_quantity ?? 0;
|
// $existOrderQty = $orderExist->updated_order_quantity ?? 0;
|
||||||
|
$orderQty = $orderExist->order_quantity ?? 0;
|
||||||
|
$existUpdatedOrdQuan = $orderExist->updated_order_quantity ?? 0;
|
||||||
|
|
||||||
if ($existOrderQty != $orderQty) {
|
if ($existUpdatedOrdQuan != $updatedOrderQty) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Order quantity doesn't equal to exist process order '{$processOrder}'",
|
'status_description' => "Order quantity doesn't equal to exist process order '{$processOrder}'",
|
||||||
@@ -895,20 +910,6 @@ class PdfController extends Controller
|
|||||||
|
|
||||||
$total = $alreadyReceived + $receivedQty;
|
$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') {
|
if ($rework != 'Yes' && $rework != 'No') {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -949,6 +950,13 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 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)
|
$existingCoil = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
->where('line_id', $lineNamePlantId)
|
->where('line_id', $lineNamePlantId)
|
||||||
@@ -964,6 +972,7 @@ class PdfController extends Controller
|
|||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'coil_number' => $coilNo,
|
'coil_number' => $coilNo,
|
||||||
'order_quantity' => $orderQty,
|
'order_quantity' => $orderQty,
|
||||||
|
'updated_order_quantity' => $updatedOrderQty,
|
||||||
'received_quantity' => $receivedQty,
|
'received_quantity' => $receivedQty,
|
||||||
'scrap_quantity' => $scrapQty,
|
'scrap_quantity' => $scrapQty,
|
||||||
'sfg_number' => $sfgNo,
|
'sfg_number' => $sfgNo,
|
||||||
@@ -994,7 +1003,7 @@ class PdfController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($coilNo >= 1) {
|
if ($coilNo > 1) {
|
||||||
$prevCoilNo = (string) ($coilNo - 1);
|
$prevCoilNo = (string) ($coilNo - 1);
|
||||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
@@ -1004,7 +1013,7 @@ class PdfController extends Controller
|
|||||||
if (! $existPrevCoil) {
|
if (! $existPrevCoil) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1022,6 +1031,19 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 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)
|
$updated = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
->where('line_id', $lineNamePlantId)
|
->where('line_id', $lineNamePlantId)
|
||||||
@@ -1070,7 +1092,7 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($coilNo >= 1) {
|
if ($coilNo > 1) {
|
||||||
$prevCoilNo = (string) ($coilNo - 1);
|
$prevCoilNo = (string) ($coilNo - 1);
|
||||||
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
$existPrevCoil = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
@@ -1080,11 +1102,18 @@ class PdfController extends Controller
|
|||||||
if (! $existPrevCoil) {
|
if (! $existPrevCoil) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Previouse coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
'status_description' => "Previous coil number '{$prevCoilNo}' not exist against plant code '{$plantCode}' and process order '{$processOrder}'!",
|
||||||
], 404);
|
], 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(
|
ProcessOrder::Create(
|
||||||
[
|
[
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -1093,6 +1122,7 @@ class PdfController extends Controller
|
|||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'coil_number' => $coilNo,
|
'coil_number' => $coilNo,
|
||||||
'order_quantity' => $orderQty,
|
'order_quantity' => $orderQty,
|
||||||
|
'updated_order_quantity' => $updatedOrderQty,
|
||||||
'received_quantity' => $receivedQty,
|
'received_quantity' => $receivedQty,
|
||||||
'scrap_quantity' => $scrapQty,
|
'scrap_quantity' => $scrapQty,
|
||||||
'sfg_number' => $sfgNo,
|
'sfg_number' => $sfgNo,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class UserController extends Controller
|
|||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*/
|
*/
|
||||||
// show(string $id)
|
// show(string $id)
|
||||||
public function get_testing_data(Request $request)
|
public function get_user_data(Request $request)
|
||||||
{
|
{
|
||||||
$expectedUser = env('API_AUTH_USER');
|
$expectedUser = env('API_AUTH_USER');
|
||||||
$expectedPw = env('API_AUTH_PW');
|
$expectedPw = env('API_AUTH_PW');
|
||||||
|
|||||||
558
app/Livewire/StockDataTable.php
Normal file
558
app/Livewire/StockDataTable.php
Normal file
@@ -0,0 +1,558 @@
|
|||||||
|
<?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
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
app/Models/DuplicateStock.php
Normal file
25
app/Models/DuplicateStock.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?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,6 +64,11 @@ class Item extends Model
|
|||||||
return $this->hasMany(CharacteristicValue::class);
|
return $this->hasMany(CharacteristicValue::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ClassCharacteristics()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ClassCharacteristic::class, 'item_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function weightValidations()
|
public function weightValidations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(WeightValidation::class);
|
return $this->hasMany(WeightValidation::class);
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ class Machine extends Model
|
|||||||
return $this->hasMany(CharacteristicValue::class);
|
return $this->hasMany(CharacteristicValue::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ClassCharacteristics()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ClassCharacteristic::class, 'machine_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function testingPanelReadings()
|
public function testingPanelReadings()
|
||||||
{
|
{
|
||||||
return $this->hasMany(TestingPanelReading::class);
|
return $this->hasMany(TestingPanelReading::class);
|
||||||
|
|||||||
@@ -53,6 +53,11 @@ class Plant extends Model
|
|||||||
return $this->hasMany(InvoiceValidation::class, 'plant_id', 'id');
|
return $this->hasMany(InvoiceValidation::class, 'plant_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function stockDataMasters()
|
||||||
|
{
|
||||||
|
return $this->hasMany(StockDataMaster::class, 'plant_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function qualityValidations()
|
public function qualityValidations()
|
||||||
{
|
{
|
||||||
return $this->hasMany(QualityValidation::class, 'plant_id', 'id');
|
return $this->hasMany(QualityValidation::class, 'plant_id', 'id');
|
||||||
@@ -108,6 +113,11 @@ class Plant extends Model
|
|||||||
return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');
|
return $this->hasMany(EquipmentMaster::class, 'plant_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ClassCharacteristics()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ClassCharacteristic::class, 'plant_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
// public function rejectReasons()
|
// public function rejectReasons()
|
||||||
// {
|
// {
|
||||||
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
|
// return $this->hasMany(RejectReason::class, 'plant_id', 'id');
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class ProcessOrder extends Model
|
|||||||
'coil_number',
|
'coil_number',
|
||||||
'order_quantity',
|
'order_quantity',
|
||||||
'received_quantity',
|
'received_quantity',
|
||||||
|
'updated_order_quantity',
|
||||||
'sfg_number',
|
'sfg_number',
|
||||||
'machine_name',
|
'machine_name',
|
||||||
'scrap_quantity',
|
'scrap_quantity',
|
||||||
|
|||||||
106
app/Policies/DuplicateStockPolicy.php
Normal file
106
app/Policies/DuplicateStockPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?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,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
@@ -11,7 +10,7 @@ return new class extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
$sql = <<<'SQL'
|
$sql = <<<'SQL'
|
||||||
CREATE TABLE device_masters (
|
CREATE TABLE device_masters (
|
||||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
plant_id BIGINT NOT NULL,
|
plant_id BIGINT NOT NULL,
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ return new class extends Migration
|
|||||||
zmm_type TEXT DEFAULT NULL,
|
zmm_type TEXT DEFAULT NULL,
|
||||||
zmm_usp TEXT DEFAULT NULL,
|
zmm_usp TEXT DEFAULT NULL,
|
||||||
mark_status TEXT DEFAULT NULL,
|
mark_status TEXT DEFAULT NULL,
|
||||||
marked_datetime TIMESTAMP DEFAULT NULL,
|
marked_datetime TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
marked_physical_count TEXT DEFAULT '0',
|
marked_physical_count TEXT DEFAULT '0',
|
||||||
marked_expected_time TEXT DEFAULT '0',
|
marked_expected_time TEXT DEFAULT '0',
|
||||||
marked_by TEXT DEFAULT NULL,
|
marked_by TEXT DEFAULT NULL,
|
||||||
@@ -178,6 +178,7 @@ return new class extends Migration
|
|||||||
updated_by TEXT DEFAULT NULL,
|
updated_by TEXT DEFAULT NULL,
|
||||||
deleted_at TIMESTAMP,
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
UNIQUE (gernr, plant_id),
|
||||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||||
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
FOREIGN KEY (machine_id) REFERENCES machines (id),
|
||||||
FOREIGN KEY (item_id) REFERENCES items (id)
|
FOREIGN KEY (item_id) REFERENCES items (id)
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?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');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
13
resources/views/filament/pages/cycle-count.blade.php
Normal file
13
resources/views/filament/pages/cycle-count.blade.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<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>
|
||||||
308
resources/views/livewire/stock-data-table.blade.php
Normal file
308
resources/views/livewire/stock-data-table.blade.php
Normal file
@@ -0,0 +1,308 @@
|
|||||||
|
<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,9 +136,13 @@ Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 's
|
|||||||
|
|
||||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||||
|
|
||||||
|
// User Controller
|
||||||
|
|
||||||
|
Route::get('user/get-data', [UserController::class, 'get_user_data']);
|
||||||
|
|
||||||
// Testing panel Controller
|
// Testing panel Controller
|
||||||
|
|
||||||
Route::get('testing/user/get-data', [UserController::class, 'get_testing_data']);
|
Route::get('testing/user/get-data', [UserController::class, 'get_user_data']);
|
||||||
|
|
||||||
Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_motor_master']);
|
Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_motor_master']);
|
||||||
|
|
||||||
@@ -170,7 +174,7 @@ Route::get('laser/characteristics/check', [CharacteristicsController::class, 'ch
|
|||||||
|
|
||||||
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||||
|
|
||||||
// ..serial (auto or manual)
|
// ..Marked serial (auto or manual)
|
||||||
|
|
||||||
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user