Compare commits
10 Commits
44b2ff6f24
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10081fd20e | ||
|
|
5d7b9d52f8 | ||
|
|
499fa0b2dd | ||
|
|
27b5ad2cfe | ||
|
|
4c7bed8c63 | ||
|
|
253d319587 | ||
|
|
ead2edc63b | ||
|
|
18f23ce097 | ||
|
|
198b901671 | ||
|
|
3192e32d5d |
@@ -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')
|
||||||
|
|||||||
@@ -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,7 +132,10 @@ 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!";
|
||||||
@@ -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,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use App\Filament\Widgets\CumulativeChart;
|
use App\Filament\Widgets\CumulativeChart;
|
||||||
|
use App\Filament\Widgets\ProductionQuantityStat;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Components\TextInput;
|
use Filament\Forms\Components\TextInput;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
@@ -9,6 +10,8 @@ use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
|||||||
use Filament\Tables\Filters\SelectFilter;
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
use Filament\Widgets\Widget;
|
use Filament\Widgets\Widget;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
@@ -16,57 +19,108 @@ class Dashboard extends \Filament\Pages\Dashboard
|
|||||||
{
|
{
|
||||||
use HasFiltersForm;
|
use HasFiltersForm;
|
||||||
|
|
||||||
protected static ?string $navigationGroup = 'Production DashBoard';
|
protected static ?string $navigationIcon = 'heroicon-s-gift';
|
||||||
|
|
||||||
public function mount(): void
|
protected static string $view = 'filament.pages.dashboard';
|
||||||
{
|
|
||||||
session()->forget(['selected_plant']);
|
|
||||||
$this->filtersForm->fill([
|
|
||||||
'plant' => null
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function filtersForm(Form $form): Form
|
// public function mount(): void
|
||||||
{
|
// {
|
||||||
return $form
|
// session()->forget(['selected_plant']);
|
||||||
->statePath('filters') // Store form state in 'filters'
|
// session()->forget(['from_date']);
|
||||||
->schema([
|
// session()->forget(['to_date']);
|
||||||
Select::make('plant')
|
// $this->filtersForm->fill([
|
||||||
->options(Plant::pluck('name', 'id'))
|
// 'plant' => null,
|
||||||
->label('Select Plant')
|
// 'from_date' => null,
|
||||||
->reactive()
|
// 'to_date' => null,
|
||||||
->afterStateUpdated(function ($state) {
|
// // 'success_status' => null
|
||||||
session(['selected_plant' => $state]); // fixed typo
|
// ]);
|
||||||
//$this->dispatch('cumulativeChart'); // custom Livewire event
|
// }
|
||||||
}),
|
|
||||||
]);
|
|
||||||
|
|
||||||
}
|
// public function filtersForm(Form $form): Form
|
||||||
|
// {
|
||||||
|
// return $form
|
||||||
|
// ->statePath('filters') // Store form state in 'filters'
|
||||||
|
// ->schema([
|
||||||
|
// Select::make('plant')
|
||||||
|
// ->label('Select Plant')
|
||||||
|
// ->reactive()
|
||||||
|
// // ->options(Plant::pluck('name', 'id'))
|
||||||
|
// ->options(function (callable $get) {
|
||||||
|
// $userHas = Filament::auth()->user()->plant_id;
|
||||||
|
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
|
// })
|
||||||
|
// ->afterStateUpdated(function ($state,callable $set) {
|
||||||
|
// session(['selected_plant' => $state]); // fixed typo
|
||||||
|
// //$this->dispatch('cumulativeChart'); // custom Livewire event
|
||||||
|
// // Reset success_status whenever plant changes
|
||||||
|
// $set('success_status', null);
|
||||||
|
// session()->forget('success_status');
|
||||||
|
// }),
|
||||||
|
|
||||||
|
// // Select::make('success_status')
|
||||||
|
// // ->label('Select Status')
|
||||||
|
// // ->options([
|
||||||
|
// // 'Ok' => 'Ok',
|
||||||
|
// // 'Not Ok' => 'Not Ok',
|
||||||
|
// // ])
|
||||||
|
// // ->reactive()
|
||||||
|
// // ->afterStateUpdated(function ($state) {
|
||||||
|
// // session(['success_status' => $state]);
|
||||||
|
// // }),
|
||||||
|
|
||||||
|
// DatePicker::make('created_from')
|
||||||
|
// ->label('Created From')
|
||||||
|
// ->reactive()
|
||||||
|
// ->afterStateUpdated(function ($state,callable $set) {
|
||||||
|
// session(['from_date' => $state]);
|
||||||
|
// }),
|
||||||
|
|
||||||
|
// DatePicker::make('created_to')
|
||||||
|
// ->label('Created To')
|
||||||
|
// ->reactive()
|
||||||
|
// ->afterStateUpdated(function ($state,callable $set) {
|
||||||
|
// session(['to_date' => $state]);
|
||||||
|
// }),
|
||||||
|
|
||||||
|
// ]);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
public static function getNavigationLabel(): string
|
// public static function getNavigationLabel(): string
|
||||||
{
|
// {
|
||||||
return 'Production Line Count';
|
// return 'Production Line Count';
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
// public function getHeading(): string
|
||||||
|
// {
|
||||||
|
// return 'Production Line Count';
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function getWidgets(): array
|
||||||
|
// {
|
||||||
|
// $widgets = [];
|
||||||
|
|
||||||
|
// if (CumulativeChart::canView()) {
|
||||||
|
// $widgets[] = CumulativeChart::class;
|
||||||
|
|
||||||
|
// }
|
||||||
|
// return $widgets;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static function canAccess(): bool
|
||||||
|
// {
|
||||||
|
// return Auth::check() && Auth::user()->can('view production line count dashboard');
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
public function getHeading(): string
|
public function getHeading(): string
|
||||||
{
|
{
|
||||||
return 'Production Line Count';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWidgets(): array
|
public static function getNavigationLabel(): string
|
||||||
{
|
{
|
||||||
$widgets = [];
|
return 'Welcome';
|
||||||
|
|
||||||
if (CumulativeChart::canView()) {
|
|
||||||
$widgets[] = CumulativeChart::class;
|
|
||||||
}
|
|
||||||
return $widgets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function canAccess(): bool
|
|
||||||
{
|
|
||||||
return Auth::check() && Auth::user()->can('view production line count dashboard');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,124 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Filament\Pages;
|
namespace App\Filament\Pages;
|
||||||
|
|
||||||
use Filament\Pages\Page;
|
use App\Filament\Widgets\CumulativeChart;
|
||||||
|
use App\Filament\Widgets\ProductionQuantityStat;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Pages\Dashboard\Concerns\HasFiltersForm;
|
||||||
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms\Components\DatePicker;
|
||||||
|
use Filament\Widgets\Widget;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Filament\Pages\Page;
|
||||||
|
use Filament\Forms\Concerns\InteractsWithForms;
|
||||||
|
|
||||||
class Welcome extends Page
|
class Welcome extends Page
|
||||||
{
|
{
|
||||||
protected static ?string $navigationIcon = 'heroicon-s-gift'; // 'heroicon-o-document-text';
|
|
||||||
|
|
||||||
protected static string $view = 'filament.pages.welcome';
|
protected static string $view = 'filament.pages.welcome';
|
||||||
|
|
||||||
public function getHeading(): string
|
protected static ?string $navigationIcon = 'heroicon-o-document-text';
|
||||||
|
|
||||||
|
use HasFiltersForm;
|
||||||
|
|
||||||
|
use InteractsWithForms;
|
||||||
|
|
||||||
|
protected static ?string $navigationGroup = 'Production DashBoard';
|
||||||
|
|
||||||
|
protected static ?string $slug = 'production-line-count';
|
||||||
|
|
||||||
|
public function mount(): void
|
||||||
{
|
{
|
||||||
return '';
|
session()->forget(['selected_plant']);
|
||||||
|
// session()->forget(['from_date']);
|
||||||
|
// session()->forget(['to_date']);
|
||||||
|
$this->filtersForm->fill([
|
||||||
|
'plant' => null,
|
||||||
|
// 'from_date' => null,
|
||||||
|
// 'to_date' => null,
|
||||||
|
// 'success_status' => null
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static function canAccess(): bool
|
public function filtersForm(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->statePath('filters')
|
||||||
|
->schema([
|
||||||
|
Select::make('plant')
|
||||||
|
->label('Select Plant')
|
||||||
|
->reactive()
|
||||||
|
// ->options(Plant::pluck('name', 'id'))
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function ($state,callable $set) {
|
||||||
|
session(['selected_plant' => $state]);
|
||||||
|
//$this->dispatch('cumulativeChart'); // custom Livewire event
|
||||||
|
// Reset success_status whenever plant changes
|
||||||
|
// $set('success_status', null);
|
||||||
|
// session()->forget('success_status');
|
||||||
|
}),
|
||||||
|
|
||||||
|
// Select::make('success_status')
|
||||||
|
// ->label('Select Status')
|
||||||
|
// ->options([
|
||||||
|
// 'Ok' => 'Ok',
|
||||||
|
// 'Not Ok' => 'Not Ok',
|
||||||
|
// ])
|
||||||
|
// ->reactive()
|
||||||
|
// ->afterStateUpdated(function ($state) {
|
||||||
|
// session(['success_status' => $state]);
|
||||||
|
// }),
|
||||||
|
|
||||||
|
// DatePicker::make('created_from')
|
||||||
|
// ->label('Created From')
|
||||||
|
// ->reactive()
|
||||||
|
// ->afterStateUpdated(function ($state,callable $set) {
|
||||||
|
// session(['from_date' => $state]);
|
||||||
|
// }),
|
||||||
|
|
||||||
|
// DatePicker::make('created_to')
|
||||||
|
// ->label('Created To')
|
||||||
|
// ->reactive()
|
||||||
|
// ->afterStateUpdated(function ($state,callable $set) {
|
||||||
|
// session(['to_date' => $state]);
|
||||||
|
// }),
|
||||||
|
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getNavigationLabel(): string
|
||||||
|
{
|
||||||
|
return 'Production Line Count';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHeading(): string
|
||||||
|
{
|
||||||
|
return 'Production Line Count';
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function getWidgets(): array
|
||||||
// {
|
// {
|
||||||
// return Auth::check() && Auth::user()->can('view welcome page');
|
// $widgets = [];
|
||||||
|
|
||||||
|
// if (CumulativeChart::canView()) {
|
||||||
|
// $widgets[] = CumulativeChart::class;
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
// return $widgets;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static function canAccess(): bool
|
||||||
|
{
|
||||||
|
return Auth::check() && Auth::user()->can('view production line count dashboard');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\NotInStockExporter;
|
||||||
|
use App\Filament\Imports\NotInStockImporter;
|
||||||
use App\Filament\Resources\NotInStockResource\Pages;
|
use App\Filament\Resources\NotInStockResource\Pages;
|
||||||
use App\Models\NotInStock;
|
use App\Models\NotInStock;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
@@ -13,6 +15,9 @@ use Filament\Tables;
|
|||||||
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 NotInStockResource extends Resource
|
class NotInStockResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -232,6 +237,22 @@ class NotInStockResource extends Resource
|
|||||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
Tables\Actions\RestoreBulkAction::make(),
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
]),
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
ImportAction::make()
|
||||||
|
->label('Import Not In Stock')
|
||||||
|
->color('warning')
|
||||||
|
->importer(NotInStockImporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view import not in stock');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->label('Export Not In Stock')
|
||||||
|
->color('warning')
|
||||||
|
->exporter(NotInStockExporter::class)
|
||||||
|
->visible(function () {
|
||||||
|
return Filament::auth()->user()->can('view export not in stock');
|
||||||
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +273,7 @@ class NotInStockResource extends Resource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
return parent::getEloquentQuery()
|
return parent::getEloquentQuery()
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -369,9 +373,11 @@ class ProcessOrderResource extends Resource
|
|||||||
$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)
|
||||||
@@ -387,6 +393,47 @@ 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')
|
||||||
@@ -409,7 +456,8 @@ class ProcessOrderResource extends Resource
|
|||||||
->where('item_id', $itemId)->latest()->first();
|
->where('item_id', $itemId)->latest()->first();
|
||||||
|
|
||||||
if ($orderExist) {
|
if ($orderExist) {
|
||||||
$orderQty = $orderExist->order_quantity ?? 0;
|
// $orderQty = $orderExist->order_quantity ?? 0;
|
||||||
|
$orderQty = $orderExist->updated_order_quantity ?? 0;
|
||||||
|
|
||||||
$alreadyReceived = ProcessOrder::where('plant_id', $plantId)
|
$alreadyReceived = ProcessOrder::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrder)
|
||||||
@@ -583,6 +631,7 @@ class ProcessOrderResource extends Resource
|
|||||||
Forms\Components\TextInput::make('machine_name')
|
Forms\Components\TextInput::make('machine_name')
|
||||||
->label('Machine Name')
|
->label('Machine Name')
|
||||||
->reactive()
|
->reactive()
|
||||||
|
->maxLength(18)
|
||||||
->readOnly(fn ($get) => (trim($get('process_order')) == null || trim($get('process_order')) == ''))
|
->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);
|
||||||
@@ -855,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()
|
||||||
|
|||||||
@@ -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 [
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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'] ?? '';
|
||||||
@@ -872,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();
|
||||||
@@ -880,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',
|
||||||
@@ -893,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}'",
|
||||||
@@ -946,10 +950,10 @@ class PdfController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total > $orderQty) {
|
if ($total > $updatedOrderQty) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Rework received quantity should not exceed exist order quantity! Exist Order Qty = '{$orderQty}', Already Exist Total Received Qty = '{$alreadyReceived}', Trying to Insert Rework Received Qty = '{$receivedQty}'",
|
'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);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -968,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,
|
||||||
@@ -1102,10 +1107,10 @@ class PdfController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($total > $orderQty) {
|
if ($total > $updatedOrderQty) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Received quantity should not exceed exist order quantity! Exist Order Qty = '{$orderQty}', Already Exist Total Received Qty = '{$alreadyReceived}', Trying to Insert Received Qty = '{$receivedQty}'",
|
'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);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1117,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,
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
126
resources/views/filament/pages/dashboard.blade.php
Normal file
126
resources/views/filament/pages/dashboard.blade.php
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<x-filament-panels::page>
|
||||||
|
|
||||||
|
<!-- HEADER -->
|
||||||
|
<div class="mb-8">
|
||||||
|
<h1 class="text-4xl font-bold tracking-tight">
|
||||||
|
CRI Digital Manufacturing IIoT Platform
|
||||||
|
</h1>
|
||||||
|
<p class="text-lg text-gray-600 mt-2">
|
||||||
|
Complete visibility, traceability, and control across your manufacturing operations.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- BANNER -->
|
||||||
|
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
|
||||||
|
<div class="w-full overflow-hidden rounded-xl shadow">
|
||||||
|
<img
|
||||||
|
src="{{ asset('images/iiot-banner.jpg') }}"
|
||||||
|
alt="CRI Digital Manufacturing IIoT"
|
||||||
|
class="w-full h-72 object-cover"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- INTRO -->
|
||||||
|
<div class="max-w-4xl mb-10">
|
||||||
|
<p class="text-lg text-gray-700 mb-4">
|
||||||
|
CRI Digital Manufacturing IIoT is built to deliver
|
||||||
|
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
|
||||||
|
across plants, lines, and production processes.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="text-lg text-gray-700">
|
||||||
|
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
|
||||||
|
complete tracking of materials, production orders, and finished goods—helping teams
|
||||||
|
make faster, data-driven decisions with confidence.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- KEY PILLARS -->
|
||||||
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
|
||||||
|
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
|
||||||
|
<p class="text-gray-600">
|
||||||
|
Track materials, batches, and serials from input to dispatch.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h3 class="text-lg font-semibold mb-2">✅ Quality Assurance</h3>
|
||||||
|
<p class="text-gray-600">
|
||||||
|
Validate process data and ensure first-time-right production.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h3 class="text-lg font-semibold mb-2">⏱ On-Time Delivery</h3>
|
||||||
|
<p class="text-gray-600">
|
||||||
|
Identify delays early and meet production commitments.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
|
||||||
|
<p class="text-gray-600">
|
||||||
|
Monitor performance and take quick corrective actions.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SUPPORT -->
|
||||||
|
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
|
||||||
|
<p class="text-gray-700 mb-2">
|
||||||
|
Our dedicated IIoT support team is available round-the-clock to ensure
|
||||||
|
uninterrupted operations and quick issue resolution.
|
||||||
|
</p>
|
||||||
|
<p class="text-lg font-medium text-gray-900">
|
||||||
|
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
||||||
|
</p>
|
||||||
|
{{-- <p class="text-lg font-medium text-gray-900">
|
||||||
|
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
||||||
|
</p> --}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
|
||||||
|
|
||||||
|
<p class="text-lg text-gray-700 mb-4">
|
||||||
|
Our support structure is designed to ensure quick resolution based on the type
|
||||||
|
of issue — whether it is on-site, application-related, or infrastructure-related.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="space-y-3">
|
||||||
|
|
||||||
|
<p class="text-lg font-medium text-gray-900">
|
||||||
|
🏭 <strong>Plant & On-Site Support</strong> <br>
|
||||||
|
<span class="text-gray-700">
|
||||||
|
For plant visits, industry-level issues, and on-ground validation
|
||||||
|
</span><br>
|
||||||
|
📞 <span class="font-semibold">8925899458 / 8925899459</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="text-lg font-medium text-gray-900">
|
||||||
|
💻 <strong>Application & Logic Support</strong> <br>
|
||||||
|
<span class="text-gray-700">
|
||||||
|
For website errors, logic issues, and application-level problems
|
||||||
|
</span><br>
|
||||||
|
📞 <span class="font-semibold">9952468104 / 9100832269</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div> --}}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TEAM -->
|
||||||
|
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
||||||
|
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
|
||||||
|
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
|
||||||
|
<div class="flex items-center gap-2">👤 Jothikumar</div>
|
||||||
|
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
|
||||||
|
<div class="flex items-center gap-2">👤 Dhanabalan</div>
|
||||||
|
<div class="flex items-center gap-2">👤 Ranjith</div>
|
||||||
|
<div class="flex items-center gap-2">👤 Srimathy</div>
|
||||||
|
<div class="flex items-center gap-2">👤 Gokul</div>
|
||||||
|
</div>
|
||||||
|
</div> --}}
|
||||||
|
|
||||||
|
</x-filament-panels::page>
|
||||||
@@ -1,126 +1,13 @@
|
|||||||
<x-filament-panels::page>
|
<x-filament-panels::page>
|
||||||
|
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-4 md:gap-4 p-2 md:p-4 items-start">
|
||||||
<!-- HEADER -->
|
{{-- Filters form --}}
|
||||||
<div class="mb-8">
|
<div class="space-y-4 w-full max-w-full col-span-1">
|
||||||
<h1 class="text-4xl font-bold tracking-tight">
|
{{ $this->filtersForm($this->form) }}
|
||||||
CRI Digital Manufacturing IIoT Platform
|
|
||||||
</h1>
|
|
||||||
<p class="text-lg text-gray-600 mt-2">
|
|
||||||
Complete visibility, traceability, and control across your manufacturing operations.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- BANNER -->
|
{{-- Stat widget --}}
|
||||||
{{-- <div class="w-full overflow-hidden rounded-2xl shadow mb-10"> --}}
|
<div class="w-full max-w-full col-span-1 sm:col-span-1 lg:col-span-2">
|
||||||
<div class="w-full overflow-hidden rounded-xl shadow">
|
@livewire(\App\Filament\Widgets\CumulativeChart::class)
|
||||||
<img
|
|
||||||
src="{{ asset('images/iiot-banner.jpg') }}"
|
|
||||||
alt="CRI Digital Manufacturing IIoT"
|
|
||||||
class="w-full h-72 object-cover"
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- INTRO -->
|
|
||||||
<div class="max-w-4xl mb-10">
|
|
||||||
<p class="text-lg text-gray-700 mb-4">
|
|
||||||
CRI Digital Manufacturing IIoT is built to deliver
|
|
||||||
<strong>end-to-end traceability, real-time insights, and operational transparency</strong>
|
|
||||||
across plants, lines, and production processes.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="text-lg text-gray-700">
|
|
||||||
The platform ensures <strong>right quality and on-time delivery</strong> by enabling
|
|
||||||
complete tracking of materials, production orders, and finished goods—helping teams
|
|
||||||
make faster, data-driven decisions with confidence.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- KEY PILLARS -->
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-10">
|
|
||||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h3 class="text-lg font-semibold mb-2">🔍 Traceability</h3>
|
|
||||||
<p class="text-gray-600">
|
|
||||||
Track materials, batches, and serials from input to dispatch.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h3 class="text-lg font-semibold mb-2">✅ Quality Assurance</h3>
|
|
||||||
<p class="text-gray-600">
|
|
||||||
Validate process data and ensure first-time-right production.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h3 class="text-lg font-semibold mb-2">⏱ On-Time Delivery</h3>
|
|
||||||
<p class="text-gray-600">
|
|
||||||
Identify delays early and meet production commitments.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h3 class="text-lg font-semibold mb-2">📊 Real-Time Insights</h3>
|
|
||||||
<p class="text-gray-600">
|
|
||||||
Monitor performance and take quick corrective actions.
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- SUPPORT -->
|
|
||||||
<div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h2 class="text-2xl font-semibold mb-3">24×7 Support</h2>
|
|
||||||
<p class="text-gray-700 mb-2">
|
|
||||||
Our dedicated IIoT support team is available round-the-clock to ensure
|
|
||||||
uninterrupted operations and quick issue resolution.
|
|
||||||
</p>
|
|
||||||
<p class="text-lg font-medium text-gray-900">
|
|
||||||
📞 Support Landline: <span class="font-semibold">0422 711 7179</span>
|
|
||||||
</p>
|
|
||||||
{{-- <p class="text-lg font-medium text-gray-900">
|
|
||||||
📞 Technical Support Contact: <span class="font-semibold">9952468104 / 9100832269</span>
|
|
||||||
</p> --}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h2 class="text-2xl font-semibold mb-4">24×7 Support</h2>
|
|
||||||
|
|
||||||
<p class="text-lg text-gray-700 mb-4">
|
|
||||||
Our support structure is designed to ensure quick resolution based on the type
|
|
||||||
of issue — whether it is on-site, application-related, or infrastructure-related.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div class="space-y-3">
|
|
||||||
|
|
||||||
<p class="text-lg font-medium text-gray-900">
|
|
||||||
🏭 <strong>Plant & On-Site Support</strong> <br>
|
|
||||||
<span class="text-gray-700">
|
|
||||||
For plant visits, industry-level issues, and on-ground validation
|
|
||||||
</span><br>
|
|
||||||
📞 <span class="font-semibold">8925899458 / 8925899459</span>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p class="text-lg font-medium text-gray-900">
|
|
||||||
💻 <strong>Application & Logic Support</strong> <br>
|
|
||||||
<span class="text-gray-700">
|
|
||||||
For website errors, logic issues, and application-level problems
|
|
||||||
</span><br>
|
|
||||||
📞 <span class="font-semibold">9952468104 / 9100832269</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div> --}}
|
|
||||||
|
|
||||||
|
|
||||||
<!-- TEAM -->
|
|
||||||
{{-- <div class="bg-white rounded-xl border p-6 shadow-sm">
|
|
||||||
<h2 class="text-2xl font-semibold mb-4">IIOT Team Members</h2>
|
|
||||||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4 text-gray-700">
|
|
||||||
<div class="flex items-center gap-2">👤 Jothikumar</div>
|
|
||||||
<div class="flex items-center gap-2">👤 Jeithef Shibu</div>
|
|
||||||
<div class="flex items-center gap-2">👤 Dhanabalan</div>
|
|
||||||
<div class="flex items-center gap-2">👤 Ranjith</div>
|
|
||||||
<div class="flex items-center gap-2">👤 Srimathy</div>
|
|
||||||
<div class="flex items-center gap-2">👤 Gokul</div>
|
|
||||||
</div>
|
|
||||||
</div> --}}
|
|
||||||
|
|
||||||
</x-filament-panels::page>
|
</x-filament-panels::page>
|
||||||
|
|||||||
Reference in New Issue
Block a user