ranjith-dev #470

Merged
jothi merged 2 commits from ranjith-dev into master 2026-03-11 04:58:56 +00:00
3 changed files with 78 additions and 20 deletions

View File

@@ -328,7 +328,7 @@ class StockDataMasterResource extends Resource
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get): void {
$set('sticker_master_id', null);
$set('operator_id', null);
$set('updated_by', null);
}),
TextInput::make('location')
->label('Location')
@@ -388,7 +388,7 @@ class StockDataMasterResource extends Resource
->native(false),
])
->query(function ($query, array $data) {
if (!isset($data['type']) && (empty($data['Plant']) && empty($data['invoice_number']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['operator_id']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
if (!isset($data['type']) && (empty($data['Plant']) && empty($data['location']) && empty($data['serial_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['updated_by']) && empty($data['scanned_status']) && empty($data['sticker_master_id']))) {
if (empty($data['type'])) {
Notification::make()
@@ -399,33 +399,53 @@ class StockDataMasterResource extends Resource
return $query->whereRaw('1 = 0');
}
if ($data['type'] == '0') {
if($data['type'] != ''){
$query->where('type', '0');
if ($data['type'] == '0') {
if (!empty($data['scanned_status'])) {
$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') {
if ($data['scanned_status'] == 'Scanned') {
$query->whereNotNull('scanned_status')
->where('scanned_status', '!=', '');
} elseif ($data['scanned_status'] == 'Pending') {
->where('scanned_status', '!=', '');
$query->where(function ($query) {
$query->whereNull('scanned_status')
} elseif ($data['scanned_status'] == 'Pending') {
$query->where(function ($q) {
$q->whereNull('scanned_status')
->orWhere('scanned_status', '!=', 'Scanned');
});
});
}
}
}
} elseif ($data['type'] == '1') {
$query->where('type', '1')
->whereNotNull('quantity');
}
else{
if ($data['scanned_status']) {
if ($data['scanned_status'] == 'Scanned') {
$query->whereNotNull('scanned_status')
$query->whereNotNull('scanned_status')
->where('scanned_status', '!=', '');
} elseif ($data['scanned_status'] == 'Pending') {

View File

@@ -2,6 +2,7 @@
namespace App\Livewire;
use App\Models\DuplicateStock;
use App\Models\Item;
use App\Models\NotInStock;
use App\Models\StickerMaster;
@@ -65,7 +66,8 @@ class StockDataTable extends Component
'refreshSfgNonData' => 'loadSfgNonQuanData',
'confirmStockUpdate',
'confirmSerialUpdate',
'confirmSerialFGUpdate'
'confirmSerialFGUpdate',
'confirmDuplicateUpdate'
];
public $capacitorInput = '';
@@ -170,6 +172,43 @@ class StockDataTable extends Component
}
}
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, $sNo, $stickerMasterId)
{

View File

@@ -1,7 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
@@ -11,7 +10,7 @@ return new class extends Migration
*/
public function up(): void
{
$sql = <<<'SQL'
$sql = <<<'SQL'
CREATE TABLE device_masters (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,