34 Commits

Author SHA1 Message Date
dhanabalan
1ce7995105 removed inspection status column in production characteristic
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 58s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 2m4s
Laravel Pint / pint (pull_request) Successful in 2m59s
Laravel Larastan / larastan (pull_request) Failing after 4m20s
2026-07-13 14:03:27 +05:30
dhanabalan
d5cd1437fe Removed afterStateUpdated method in actions control
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 2m22s
Laravel Larastan / larastan (pull_request) Failing after 4m6s
2026-07-09 12:40:13 +05:30
dhanabalan
d4d101c5c9 Added searchable method for plant and work center and updated_by name on every change and deleted_at column added at the end and Enhance EquipmentMasterResource form
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 18s
Laravel Pint / pint (pull_request) Successful in 3m1s
Laravel Larastan / larastan (pull_request) Failing after 5m2s
2026-07-08 18:44:17 +05:30
dhanabalan
b8cb0aa237 Added number of person in visitor mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 20s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m45s
Laravel Larastan / larastan (pull_request) Failing after 3m17s
2026-07-08 16:18:22 +05:30
dhanabalan
eef42d9736 changed logic in pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 1m48s
Laravel Larastan / larastan (pull_request) Failing after 3m5s
2026-07-08 11:29:21 +05:30
dhanabalan
3316c11036 issue solved undefined column error in wire
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 23s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 19s
Laravel Pint / pint (pull_request) Successful in 1m56s
Laravel Larastan / larastan (pull_request) Failing after 3m9s
2026-07-08 11:20:24 +05:30
dhanabalan
bf22ef5af0 changed logic in wire pallet print
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m47s
Laravel Larastan / larastan (pull_request) Failing after 3m28s
2026-07-08 11:18:50 +05:30
dhanabalan
52868742c0 Added created by and updated by in customer po master page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m47s
Laravel Larastan / larastan (pull_request) Failing after 3m18s
2026-07-08 10:47:27 +05:30
dhanabalan
30175a71d3 Added id column for customer po page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m59s
Laravel Larastan / larastan (pull_request) Failing after 3m20s
2026-07-08 10:25:12 +05:30
dhanabalan
5fe8eeaeee Added plant code validation logic in resource page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 22s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 24s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 22s
Laravel Pint / pint (pull_request) Successful in 1m48s
Laravel Larastan / larastan (pull_request) Failing after 3m25s
2026-07-08 09:58:02 +05:30
dhanabalan
fa10ea14fe removed unwanted lines in create panel box validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Failing after 25s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 19s
Laravel Pint / pint (pull_request) Successful in 1m45s
Laravel Larastan / larastan (pull_request) Failing after 3m16s
2026-07-08 09:56:36 +05:30
dhanabalan
f0af6853ee Added updated logic in panel box validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 34s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 21s
Laravel Pint / pint (pull_request) Successful in 1m50s
Laravel Larastan / larastan (pull_request) Failing after 3m12s
2026-07-08 09:55:07 +05:30
dhanabalan
d213049fdd added one more validation in customer po master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 2m21s
Laravel Larastan / larastan (pull_request) Failing after 4m13s
2026-07-08 09:53:08 +05:30
dhanabalan
42e926f9c2 loaded pending pallet list against plant and customer po
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 19s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m38s
Laravel Larastan / larastan (pull_request) Failing after 5m8s
2026-07-07 12:39:29 +05:30
dhanabalan
140249e824 changed month logic in pallet print
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m52s
Laravel Larastan / larastan (pull_request) Failing after 3m27s
2026-07-07 09:22:33 +05:30
dhanabalan
5a77cdfdc2 Adjusted pdf column size in wire pallet pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m48s
Laravel Larastan / larastan (pull_request) Failing after 3m6s
2026-07-07 09:09:10 +05:30
dhanabalan
015976dcb5 Updated length validation on approver master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 2m15s
Laravel Larastan / larastan (pull_request) Failing after 3m29s
2026-07-06 19:03:43 +05:30
dhanabalan
7627aa07fd changed item row size in wire pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 24s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 29s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 25s
Laravel Pint / pint (pull_request) Failing after 1m45s
Laravel Larastan / larastan (pull_request) Failing after 3m23s
2026-07-06 17:14:33 +05:30
dhanabalan
aad961260a changed logic in wire pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 2m0s
Laravel Larastan / larastan (pull_request) Failing after 3m54s
2026-07-06 17:12:26 +05:30
dhanabalan
305d28617b changed column size in wire pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Larastan / larastan (pull_request) Failing after 1m51s
Laravel Pint / pint (pull_request) Failing after 1m45s
2026-07-06 17:09:33 +05:30
dhanabalan
851e753b74 adjusted size of the wire pallet pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 2m9s
Laravel Larastan / larastan (pull_request) Failing after 4m18s
2026-07-06 17:04:28 +05:30
dhanabalan
c94688a794 added after state updated in wire master print page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Pint / pint (pull_request) Successful in 2m14s
Laravel Larastan / larastan (pull_request) Failing after 3m31s
2026-07-06 16:17:56 +05:30
dhanabalan
9db6227566 modified logic against customer po in create page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 2m49s
Laravel Larastan / larastan (pull_request) Failing after 4m34s
2026-07-06 16:12:00 +05:30
dhanabalan
d24b4f35f4 removed select item_id box in wire master packing resource page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
2026-07-06 16:11:24 +05:30
dhanabalan
56656264c0 corrected logic pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m25s
Laravel Larastan / larastan (pull_request) Failing after 4m19s
2026-07-06 12:28:51 +05:30
dhanabalan
abf33605f5 changed logic of total box count in wire master print
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 3m57s
Laravel Larastan / larastan (pull_request) Failing after 5m44s
2026-07-06 12:12:55 +05:30
dhanabalan
60eb3c05a5 Added pallet in wire master print page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 1m48s
Laravel Larastan / larastan (pull_request) Failing after 3m15s
2026-07-06 12:06:56 +05:30
dhanabalan
ccd06a4b6e changed logic in wire master print
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 1m48s
Laravel Larastan / larastan (pull_request) Failing after 3m27s
2026-07-06 11:59:49 +05:30
dhanabalan
0d6ced5f63 corrected logic in wire print page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m14s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 59s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 1m33s
Laravel Pint / pint (pull_request) Successful in 2m11s
Laravel Larastan / larastan (pull_request) Failing after 4m20s
2026-07-06 11:50:46 +05:30
dhanabalan
faa355ad79 Added group name of panel box validation page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m13s
Laravel Larastan / larastan (pull_request) Failing after 3m51s
2026-07-04 09:10:24 +05:30
dhanabalan
cc75016575 Added logic for characteristics not found halting record
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 2m8s
Laravel Larastan / larastan (pull_request) Failing after 3m39s
2026-07-04 09:04:06 +05:30
dhanabalan
6180cdda52 Added item id select box in wire master packing
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 1m50s
Laravel Larastan / larastan (pull_request) Failing after 3m14s
2026-07-03 11:49:47 +05:30
dhanabalan
776d1664ce Added logic in panel check list
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 2m0s
Laravel Larastan / larastan (pull_request) Failing after 3m31s
2026-07-03 08:27:16 +05:30
dhanabalan
65b4ce50d3 solved issue in lower value in panel box
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 19s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 21s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 15s
Laravel Pint / pint (pull_request) Successful in 2m1s
Laravel Larastan / larastan (pull_request) Failing after 4m19s
2026-07-02 17:23:07 +05:30
14 changed files with 463 additions and 297 deletions

View File

@@ -39,8 +39,6 @@ class ProductionCharacteristicExporter extends Exporter
->label('OBSERVED VALUE'),
ExportColumn::make('status')
->label('STATUS'),
ExportColumn::make('inspection_status')
->label('INSPECTION STATUS'),
ExportColumn::make('remark')
->label('REMARK'),
ExportColumn::make('created_at')

View File

@@ -111,6 +111,13 @@ class CustomerPoMasterImporter extends Importer
$warnMsg[] = "Customer PO '{$this->data['customer_po']}' is already mapped to customer '{$existingPo->customer_name}'.";
}
$existingPoItem = CustomerPoMaster::where('plant_id', $plant->id)->where('item_id', $item->id)->where('customer_po', $this->data['customer_po'])->where('customer_name', $this->data['customer_name'])->first();
if ($existingPoItem)
{
$warnMsg[] = "Customer PO '{$this->data['customer_po']}' is already exist with item code '{$this->data['item']}' and customer name '{$this->data['customer_name']}'.";
}
// $user = User::where('name', $this->data['created_by'])->first();
// if (! $user) {
// $warnMsg[] = 'User not found';

View File

@@ -15,6 +15,7 @@ use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Log;
class WireMasterPrint extends Page
{
@@ -77,41 +78,69 @@ class WireMasterPrint extends Page
return [];
}
return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
return CustomerPoMaster::where('plant_id', $plantId)->distinct()->pluck('customer_po', 'customer_po'); //->pluck('customer_po', 'id'); ->distinct()
})
->required(),
select::make('scan_pallet_no')
->required()
->afterStateUpdated(function ($state, callable $set) {
$set('scan_pallet_no', null);
}),
Select::make('scan_pallet_no')
->label('Scan Pallet No')
->reactive()
->searchable()
->options(function ($get) {
$plantId = $get('plant_id');
$customerPoId = $get('customer_po_master_id');
// $plantId = $get('plant_id');
// $customerPoId = $get('customer_po_master_id');
if (! $plantId || ! $customerPoId) {
// if (! $plantId || ! $customerPoId) {
// return [];
// }
// $palletNumbers = WireMasterPacking::query()
// ->select('wire_packing_number')
// ->where('plant_id', $plantId)
// ->where('customer_po_master_id', $customerPoId)
// ->whereNotNull('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw('COUNT(*) = COUNT(wire_packing_status)')
// ->havingRaw("SUM(CASE WHEN TRIM(wire_packing_status) = '' THEN 1 ELSE 0 END) = 0")
// ->orderBy('wire_packing_number', 'asc')
// ->pluck('wire_packing_number')
// ->toArray();
// return collect($palletNumbers)
// ->mapWithKeys(fn ($number) => [$number => $number])
// ->toArray();
//..New Logic
$plantId = $get('plant_id');
$customerPo = $get('customer_po_master_id');
if (! $plantId || ! $customerPo)
{
return [];
}
$poIds = CustomerPoMaster::where('plant_id', $plantId)->where('customer_po', $customerPo)->pluck('id');
$palletNumbers = WireMasterPacking::query()
->select('wire_packing_number')
->where('plant_id', $plantId)
->where('customer_po_master_id', $customerPoId)
->whereIn('customer_po_master_id', $poIds)
->whereNotNull('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw('COUNT(*) = COUNT(wire_packing_status)')
->havingRaw("SUM(CASE WHEN TRIM(wire_packing_status) = '' THEN 1 ELSE 0 END) = 0")
->orderBy('wire_packing_number', 'asc')
->orderBy('wire_packing_number')
->pluck('wire_packing_number')
->toArray();
return collect($palletNumbers)
->mapWithKeys(fn ($number) => [$number => $number])
->toArray();
return collect($palletNumbers) ->mapWithKeys(fn ($number) => [$number => $number]) ->toArray();
})
->afterStateUpdated(function ($state, callable $set, $get) {
$palletNo = $state;
$plantId = $get('plant_id');
$this->dispatch('loadData', $palletNo, $plantId);
})
->extraAttributes([

View File

@@ -6,25 +6,24 @@ use App\Filament\Exports\CharacteristicApproverMasterExporter;
use App\Filament\Imports\CharacteristicApproverMasterImporter;
use App\Filament\Resources\CharacteristicApproverMasterResource\Pages;
use App\Models\CharacteristicApproverMaster;
use App\Models\Item;
use App\Models\Machine;
use App\Models\Plant;
use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Actions\ExportAction;
use Filament\Tables\Actions\ImportAction;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Validation\Rule;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Tables\Filters\Filter;
class CharacteristicApproverMasterResource extends Resource
{
@@ -34,6 +33,8 @@ class CharacteristicApproverMasterResource extends Resource
protected static ?string $navigationGroup = 'Laser Marking';
protected static ?int $navigationSort = 2;
public static function form(Form $form): Form
{
return $form
@@ -224,7 +225,8 @@ class CharacteristicApproverMasterResource extends Resource
Forms\Components\TextInput::make('duration2')
->label('Duration (HH.MM)')
->reactive()
->length(4)
->minLength(4)
->maxLength(5)
->regex('/^([0-9]|0[0-9]|1[0-9]|2[0-3])\.(0[0-9]|[1-5][0-9])$/')
->validationMessages([
'regex' => 'Duration must be HH.MM format (example: 00.00 - 23.59)',
@@ -256,7 +258,8 @@ class CharacteristicApproverMasterResource extends Resource
Forms\Components\TextInput::make('duration3')
->label('Duration (HH.MM)')
->reactive()
->length(4)
->minLength(4)
->maxLength(5)
->regex('/^([0-9]|0[0-9]|1[0-9]|2[0-3])\.(0[0-9]|[1-5][0-9])$/')
->validationMessages([
'regex' => 'Duration must be HH.MM format (example: 00.00 - 23.59)',

View File

@@ -82,6 +82,13 @@ class CustomerPoMasterResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('id')
->label('ID')
->numeric()
->alignCenter()
->sortable()
->searchable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->alignCenter()
@@ -110,10 +117,18 @@ class CustomerPoMasterResource extends Resource
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('created_by')
->label('Created By')
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('deleted_at')
->dateTime()
->sortable()

View File

@@ -12,6 +12,7 @@ use Filament\Facades\Filament;
use Filament\Forms;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Filament\Notifications\Notification;
use Filament\Resources\Resource;
use Filament\Tables;
@@ -39,18 +40,32 @@ class EquipmentMasterResource extends Resource
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->reactive()
->label('Plant Name')
->relationship('plant', 'name')
->required()
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required(),
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('machine_id', null);
$set('updated_by', Filament::auth()->user()?->name);
})
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(EquipmentMaster::latest()->first())->plant_id;
}),
Forms\Components\Select::make('machine_id')
// ->relationship('machine', 'name')
->label('Work Center')
->required()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
@@ -60,15 +75,30 @@ class EquipmentMasterResource extends Resource
return \App\Models\Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
})
->required(),
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('name')
->label('Name'),
->label('Name')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('description')
->label('Description'),
->label('Description')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('make')
->label('Make'),
->label('Make')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('model')
->label('Model'),
->label('Model')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('equipment_number')
->label('Equipment Number')
->reactive()
@@ -82,6 +112,8 @@ class EquipmentMasterResource extends Resource
];
})
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
if (! $state) {
return;
}
@@ -108,7 +140,10 @@ class EquipmentMasterResource extends Resource
// }
// }),
Forms\Components\TextInput::make('instrument_serial_number')
->label('Instrument Serial Number'),
->label('Instrument Serial Number')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
// Forms\Components\DateTimePicker::make('calibrated_on')
// ->label('Calibrated On')
// ->required(),
@@ -128,6 +163,7 @@ class EquipmentMasterResource extends Resource
$frequency = $get('frequency') ?? '1';
$nextDate = self::calculateNextCalibrationDate($state, $frequency);
$set('next_calibration_date', $nextDate);
$set('updated_by', Filament::auth()->user()?->name);
}),
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
// $frequency = (int) $get('frequency');
@@ -152,6 +188,7 @@ class EquipmentMasterResource extends Resource
$calibratedOn = $get('calibrated_on');
$nextDate = self::calculateNextCalibrationDate($calibratedOn, $state);
$set('next_calibration_date', $nextDate);
$set('updated_by', Filament::auth()->user()?->name);
}),
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
// $calibratedOn = $get('calibrated_on');
@@ -171,12 +208,21 @@ class EquipmentMasterResource extends Resource
Forms\Components\DateTimePicker::make('next_calibration_date')
->label('Next Calibration Date')
->readOnly()
->required(),
->required()
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('calibrated_by')
->label('Calibrated By'),
->label('Calibrated By')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\Textarea::make('calibration_certificate')
->label('Calibration Certificate'),
->label('Calibration Certificate')
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\FileUpload::make('attachment')
->label('PDF Upload')
@@ -185,7 +231,10 @@ class EquipmentMasterResource extends Resource
->disk('local')
->directory('uploads/temp')
->preserveFilenames()
->reactive(),
->reactive()
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
}),
// Forms\Components\Actions::make([
// Action::make('uploadNow')
@@ -341,7 +390,11 @@ class EquipmentMasterResource extends Resource
->label('Created By')
->default(Filament::auth()->user()?->name),
Forms\Components\Hidden::make('updated_by')
->label('Updated By'),
->label('Updated By')
->default(Filament::auth()->user()?->name),
Forms\Components\TextInput::make('id')
->hidden()
->readOnly(),
]);
}
@@ -359,7 +412,7 @@ class EquipmentMasterResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->label('Plant Name')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('machine.work_center')
@@ -413,24 +466,30 @@ class EquipmentMasterResource extends Resource
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_by')
->label('Created Bys')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->label('Created By')
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('created_at')
->label('Created At')
->dateTime()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('updated_by')
->label('Updated By')
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
->toggleable(isToggledHiddenByDefault: false),
Tables\Columns\TextColumn::make('updated_at')
->label('Updated At')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: false),
Tables\Columns\TextColumn::make('deleted_at')
->label('Deleted At')
->dateTime()
->alignCenter()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([

View File

@@ -27,6 +27,8 @@ class PanelBoxValidationResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Panel Box';
public $isSubmitted = false;
public $data = [];
@@ -176,6 +178,8 @@ class PanelBoxValidationResource extends Resource
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$pId = $get('line_id');
$plantId = $get('plant_id');
$plaCode = Plant::find($plantId)?->code;
$set('part_validation_type', null);
$set('show_validation_image', false);
$set('validation1_image_url', null);
@@ -382,7 +386,17 @@ class PanelBoxValidationResource extends Resource
$set('item_id', null);
return;
}
} else {
else if($plantCode != $plaCode){
Notification::make()
->title('Invalid Plant Code')
->body("Scanned plant code doesn't match the selected plant.")
->danger()
->send();
$set('item_id', null);
return;
}
}
else {
Notification::make()
->title('Invalid QR Format')
@@ -476,6 +490,7 @@ class PanelBoxValidationResource extends Resource
// $set('serial_number', null);
// $set('serial_number', $serialNumber);
}
// Check if user input matches the database values
foreach ($partValidationColumns as $field) {
if ($get("{$field}_visible")) {

View File

@@ -65,8 +65,13 @@ class CreatePanelBoxValidation extends CreateRecord {
$this->showChecklist = true;
$this->halt();
}
return $data;
else{
\Filament\Notifications\Notification::make()
->title('Characteristics not found for the scanned item.')
->danger()
->send();
$this->halt();
}
}
protected function checkIfHasCharacteristics(array $data)

View File

@@ -65,30 +65,14 @@ class WireMasterPackingResource extends Resource
return [];
}
return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
// return CustomerPoMaster::where('plant_id', $plantId)->pluck('customer_po', 'id');
return CustomerPoMaster::where('plant_id', $plantId)->distinct()->pluck('customer_po', 'customer_po');
})
->required()
->afterStateUpdated(function ($state, callable $set) {
if (!$state) {
$set('item', null);
return;
}
$customerPo = CustomerPoMaster::find($state);
if ($customerPo && $customerPo->item_id) {
$item = Item::find($customerPo->item_id);
$set('item', $item?->code);
} else {
$set('item', null);
}
$set('wire_packing_number', null);
}),
Forms\Components\TextInput::make('item')
->label('Item Code')
->reactive()
->readOnly()
->dehydrated(false),
Forms\Components\TextInput::make('wire_packing_number')
->label('Scan Wire Packing No')
->reactive()
@@ -185,13 +169,19 @@ class WireMasterPackingResource extends Resource
->options(function ($get) {
$plantId = $get('plant_id');
$customerPo = $get('customer_po_master_id');
if (! $plantId) {
if (!$plantId || !$customerPo) {
return [];
}
$customerPoIds = CustomerPoMaster::where('plant_id', $plantId)
->where('customer_po', $customerPo)
->pluck('id');
return WireMasterPacking::query()
->where('plant_id', $plantId)
->whereIn('customer_po_master_id', $customerPoIds)
->where(function ($query) {
$query->whereNull('wire_packing_status')
->orWhere('wire_packing_status', '');

View File

@@ -164,10 +164,6 @@ class CreateWireMasterPacking extends CreateRecord
return;
}
$itemId = Item::where('code', $materialCode)
->where('plant_id', $plantId)
->value('id');
$icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
if(!$icodeAgaCPoPlant)
@@ -214,23 +210,24 @@ class CreateWireMasterPacking extends CreateRecord
return;
}
$customerPoRecord = CustomerPoMaster::where('id', $customerPo)
$customerPoRecord = CustomerPoMaster::where('customer_po', $customerPo)
->where('plant_id', $plantId)
->where('item_id', $itemId)
->first();
$customerPoName = $customerPoRecord->customer_po;
// $customerPoName = $customerPoRecord->customer_po;
if ($customerPoRecord) {
$customerPoName = $customerPoRecord->customer_po;
} else {
$customerPoName = null;
}
// if ($customerPoRecord) {
// $customerPoName = $customerPoRecord->customer_po;
// } else {
// $customerPoName = null;
// }
if(!$customerPoRecord)
{
Notification::make()
->title("PO Not Found")
->body("Customer PO '$customerPoName' for Item '$materialCode' not found against Plant '$plantcode'")
->body("Customer PO '$customerPoRecord->customer_po' for Item '$materialCode' not found against Plant '$plantcode'")
->danger()
->duration(5000)
->send();
@@ -247,7 +244,7 @@ class CreateWireMasterPacking extends CreateRecord
return;
}
$alreadyScannedQty = WireMasterPacking::where('customer_po_master_id', $customerPo)
$alreadyScannedQty = WireMasterPacking::where('customer_po_master_id', $customerPoRecord->id)
->where('plant_id', $plantId)
->where('item_id', $itemId)
->selectRaw('SUM(CAST(weight AS NUMERIC)) as total_weight')
@@ -259,7 +256,7 @@ class CreateWireMasterPacking extends CreateRecord
{
Notification::make()
->title("Scanned Weight Exceeds PO Quantity")
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoName' and Item '$materialCode'")
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoRecord->customer_po' and Item '$materialCode'")
->danger()
->duration(5000)
->send();
@@ -268,6 +265,7 @@ class CreateWireMasterPacking extends CreateRecord
'process_order' => null,
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'Sno_quantity' => 0,
'created_by' => $operatorName,
@@ -294,7 +292,7 @@ class CreateWireMasterPacking extends CreateRecord
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => $processOrderId . '-' . $coilNo,
'customer_po_master_id' => $customerPo,
'customer_po_master_id' => $customerPoRecord->id,
'weight' => $weight,
'created_by' => $createdBy,
'scanned_by' => $operatorName,
@@ -314,6 +312,7 @@ class CreateWireMasterPacking extends CreateRecord
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,
@@ -334,6 +333,7 @@ class CreateWireMasterPacking extends CreateRecord
$this->form->fill([
'plant_id' => $plantId,
'customer_po_master_id' => $customerPo,
'item_id' => $itemId,
'wire_packing_number' => $wirePackNo,
'process_order' => null,
// 'pending_pallet_list' => $pendingPallet,

View File

@@ -19,168 +19,9 @@ class PalletPrintController extends Controller
//
}
public function print(Request $request, $pallet, $plant)
{
$customerId = $request->query('customer');
// $customerName = $request->query('customer_name');
// $items = WireMasterPacking::with('item')
// ->where('plant_id', $plant)
// ->where('wire_packing_number', $pallet)
// ->get()
// ->groupBy('item_id')
// ->map(function ($rows) {
// $first = $rows->first();
// return (object) [
// 'code' => $first->item->code,
// 'description' => $first->item->description,
// 'box_count' => $rows->count(),
// 'weight' => $rows->sum('weight'),
// ];
// })
// ->values();
$items = WireMasterPacking::with('item')
->where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->get()
->map(function ($row) {
return (object) [
'code' => $row->item->code,
'description' => $row->item->description,
'box_count' => 1, // each row = one box
'weight' => $row->weight,
];
});
$masterBox = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->value('customer_po_master_id');
$customer = CustomerPoMaster::find($masterBox);
$customerCode = $customer->customer_po ?? '';
$customerName = $customer->customer_name ?? '';
// $masterBox = WireMasterPacking::where('plant_id', $plant)
// ->where('wire_packing_number', $pallet)
// ->distinct('customer_po')
// ->count('customer_po');
// $pallets = WireMasterPacking::where('plant_id', $plant)
// ->select('wire_packing_number', 'updated_at')
// ->distinct('wire_packing_number')
// ->orderBy('wire_packing_number')
// ->orderBy('updated_at', 'asc')
// ->get()
// ->pluck('wire_packing_number')
// ->values();
// $currentPalletNo = $pallets->search($pallet) + 1;
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// // ->where('wire_packing_number', $pallet)
// ->distinct()
// ->count('customer_po');
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
->where('customer_po_master_id', $customerId)
->distinct('wire_packing_number')
->count('wire_packing_number');
$completedPallets = WireMasterPacking::where('plant_id', $plant)
->where('customer_po_master_id', $customerId)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
['Completed']
)
->orderBy('wire_packing_number')
->pluck('wire_packing_number')
->values();
$index = $completedPallets->search($pallet);
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
// ->select('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw('COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)', ['Completed'])
// ->orderBy('wire_packing_number')
// ->pluck('wire_packing_number')
// ->values();
// $currentPalletNo = $completedPallets->search($pallet) != false
// ? $completedPallets->search($pallet) + 1
// : 0;
// $boxLabel = $currentPalletNo . '/' . $totalBoxes;
$grossWeight = $items->sum('weight');
$widthPt = 85 * 2.83465; // 85mm → points
$heightPt = 100 * 2.83465; // 100mm → points
$plantName = Plant::where('id', $plant)->value('name');
$plantAddress = Plant::where('id', $plant)->value('address');
$pdf = Pdf::loadView('pdf.wire-pallet', [
'product' => 'Submersible Winding Wire',
'plantName' => $plantName,
'plantAddress' => $plantAddress,
'monthYear' => now()->format('M-y'),
'branch' => '',
'customerCode' => $customerCode,
'customerName' => $customerName,
'masterBox' => $boxLabel,
'items' => $items,
'grossWeight' => $grossWeight + 3.050,
'netWeight' => $grossWeight,
// 'grossWeight' => $grossWeight,
// 'netWeight' => $grossWeight - 3.05,
'pallet' => $pallet,
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
return $pdf->stream("Pallet-{$pallet}.pdf");
// $pdfPath = storage_path("app/public/Pallet-{$pallet}.pdf");
// $pdf->save($pdfPath);
// $printerName = 'Tsc';
// $output = [];
// $returnVar = 0;
// exec("lp -d {$printerName} " . escapeshellarg($pdfPath), $output, $returnVar);
// if ($returnVar == 0) {
// return response()->json([
// 'status' => 'success',
// 'message' => "PDF sent to printer $printerName successfully."
// ]);
// } else {
// return response()->json([
// 'status' => 'error',
// 'message' => "Failed to send PDF to printer $printerName.",
// 'output' => $output,
// 'code' => $returnVar
// ], 500);
// }
}
/**
* Store a newly created resource in storage.
*/
// public function print(Request $request, $pallet, $plant)
// {
// $customerId = $request->query('customer');
// $items = WireMasterPacking::with('item')
@@ -205,6 +46,29 @@ class PalletPrintController extends Controller
// $customerCode = $customer->customer_po ?? '';
// $customerName = $customer->customer_name ?? '';
// // $masterBox = WireMasterPacking::where('plant_id', $plant)
// // ->where('wire_packing_number', $pallet)
// // ->distinct('customer_po')
// // ->count('customer_po');
// // $pallets = WireMasterPacking::where('plant_id', $plant)
// // ->select('wire_packing_number', 'updated_at')
// // ->distinct('wire_packing_number')
// // ->orderBy('wire_packing_number')
// // ->orderBy('updated_at', 'asc')
// // ->get()
// // ->pluck('wire_packing_number')
// // ->values();
// // $currentPalletNo = $pallets->search($pallet) + 1;
// // $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// // // ->where('wire_packing_number', $pallet)
// // ->distinct()
// // ->count('customer_po');
// // $boxLabel = $currentPalletNo . '/' . $totalBoxes;
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerId)
// ->distinct('wire_packing_number')
@@ -250,43 +114,173 @@ class PalletPrintController extends Controller
// $plantAddress = Plant::where('id', $plant)->value('address');
// $qrBase64 = $this->generateQrDataUri($pallet);
// $mpdf = new Mpdf([
// 'format' => [85, 100],
// 'margin_left' => 0,
// 'margin_right' => 0,
// 'margin_top' => 0,
// 'margin_bottom' => 0,
// 'tempDir' => '/var/www/tmp/mpdf'
// ]);
// $html = view('pdf.wire-pallet', [
// $pdf = Pdf::loadView('pdf.wire-pallet', [
// 'product' => 'Submersible Winding Wire',
// 'plantName' => $plantName,
// 'plantAddress' => $plantAddress,
// 'monthYear' => now()->format('M-y'),
// 'branch' => '',
// 'customerCode' => $customerCode,
// 'customerName' => $customerName,
// 'masterBox' => $pallet,
// 'masterBox' => $boxLabel,
// 'items' => $items,
// 'grossWeight' => $grossWeight,
// 'netWeight' => $grossWeight - 3.05,
// 'grossWeight' => $grossWeight + 3.050,
// 'netWeight' => $grossWeight,
// // 'grossWeight' => $grossWeight,
// // 'netWeight' => $grossWeight - 3.05,
// 'pallet' => $pallet,
// 'qrBase64' => $qrBase64,
// ])->render();
// ])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
// $mpdf->WriteHTML($html);
// return $mpdf->Output("Pallet-{$pallet}.pdf", 'I'); // 'I' = inline view in browser
// return $pdf->stream("Pallet-{$pallet}.pdf");
// // $pdfPath = storage_path("app/public/Pallet-{$pallet}.pdf");
// // $pdf->save($pdfPath);
// // $printerName = 'Tsc';
// // $output = [];
// // $returnVar = 0;
// // exec("lp -d {$printerName} " . escapeshellarg($pdfPath), $output, $returnVar);
// // if ($returnVar == 0) {
// // return response()->json([
// // 'status' => 'success',
// // 'message' => "PDF sent to printer $printerName successfully."
// // ]);
// // } else {
// // return response()->json([
// // 'status' => 'error',
// // 'message' => "Failed to send PDF to printer $printerName.",
// // 'output' => $output,
// // 'code' => $returnVar
// // ], 500);
// // }
// }
// private function generateQrDataUri(string $data): string
// {
// $qr = new \Mpdf\QrCode\QrCode($data, 'H');
// $output = new \Mpdf\QrCode\Output\Png();
// $pngData = $output->output($qr, 80, [255, 255, 255], [0, 0, 0]);
// return 'data:image/png;base64,' . base64_encode($pngData);
// }
/**
* Store a newly created resource in storage.
*/
public function print(Request $request, $pallet, $plant)
{
$customerPoMasterId = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->value('customer_po_master_id');
$masterIds = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->pluck('customer_po_master_id');
$customerPo = CustomerPoMaster::whereIn('id', $masterIds)
->value('customer_po');
$customerPoMasterIds = CustomerPoMaster::where('customer_po', $customerPo)
->pluck('id');
$items = WireMasterPacking::with('item')
->where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->get()
->map(function ($row) {
return (object) [
'code' => $row->item->code,
'description' => $row->item->description,
'box_count' => 1, // each row = one box
'weight' => $row->weight,
];
});
$customer = CustomerPoMaster::find($customerPoMasterId);
$customerCode = $customer->customer_po ?? '';
$customerName = $customer->customer_name ?? '';
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerPoMasterId)
// ->select('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw(
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
// ['Completed']
// )
// ->count();
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
->whereIn('customer_po_master_id', $customerPoMasterIds)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
['Completed']
)
->count();
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerPoMasterId)
// ->select('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw(
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
// ['Completed']
// )
// ->orderBy('wire_packing_number')
// ->pluck('wire_packing_number')
// ->values();
$completedPallets = WireMasterPacking::where('plant_id', $plant)
->whereIn('customer_po_master_id', $customerPoMasterIds)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
['Completed']
)
->orderBy('wire_packing_number')
->pluck('wire_packing_number')
->values();
$index = $completedPallets->search($pallet);
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
$grossWeight = $items->sum('weight');
$widthPt = 85 * 2.83465; // 85mm → points
$heightPt = 100 * 2.83465; // 100mm → points
$plantName = Plant::where('id', $plant)->value('name');
$plantAddress = Plant::where('id', $plant)->value('address');
$scannedAt = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->value('scanned_at');
$pdf = Pdf::loadView('pdf.wire-pallet', [
'product' => 'Submersible Winding Wire',
'plantName' => $plantName,
'plantAddress' => $plantAddress,
// 'monthYear' => now()->format('M-y'),
'monthYear' => $scannedAt
? \Carbon\Carbon::parse($scannedAt)->format('M-y')
: '',
'branch' => '',
'customerCode' => $customerCode,
'customerName' => $customerName,
'masterBox' => $boxLabel,
'items' => $items,
'grossWeight' => $grossWeight + 3.050,
'netWeight' => $grossWeight,
'pallet' => $pallet,
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
return $pdf->stream("Pallet-{$pallet}.pdf");
}
public function store(Request $request)
{

View File

@@ -151,12 +151,27 @@ public $records = [];
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
if (($characteristic?->inspection_type ?? null) === 'Value') {
if (
$characteristic &&
is_numeric($value) &&
$value >= $characteristic->lower &&
$value <= $characteristic->upper
$itemCharacteristic = ProductCharacteristicsMaster::where('plant_id', $this->data['plant_id'])
->where('line_id', $this->data['line_id'])
->where('name', $characteristic->name)
->where('item_id', $itemId)
->first();
// if (($characteristic?->inspection_type ?? null) === 'Value') {
// if ($characteristic && is_numeric($value) && (($value >= $characteristic->lower && $value <= $characteristic->upper) || $value == $characteristic->lower || $value == $characteristic->upper)
// ) {
// $status = 'Ok';
// } else {
// $status = 'NotOk';
// }
// }
// else {
// $status = $value;
// }
if (($itemCharacteristic?->inspection_type ?? null) === 'Value') {
if ($itemCharacteristic && is_numeric($value) && $value >= $itemCharacteristic->lower && $value <= $itemCharacteristic->upper
) {
$status = 'Ok';
} else {
@@ -167,7 +182,7 @@ public $records = [];
$status = $value;
}
ProductionCharacteristic::create([
$prod = ProductionCharacteristic::create([
'plant_id' => $this->data['plant_id'] ?? null,
'item_id' => $itemId ?? null,
'line_id' => $this->data['line_id'] ?? null,
@@ -182,6 +197,15 @@ public $records = [];
]);
}
if (! $prod) {
Notification::make()
->title('Failed to save Panel Box Validation')
->body('Something went wrong while inserting data.')
->danger()
->send();
return;
}
$this->showChecklist = false;
$this->dispatch('checklist-saved');
@@ -201,7 +225,7 @@ public $records = [];
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
if (! $characteristic || ! is_numeric($value) || $value <= $characteristic->lower || $value >= $characteristic->upper){
if (! $characteristic || ! is_numeric($value) || ($value < $characteristic->lower || $value > $characteristic->upper)) {
return false;
}
}
@@ -218,11 +242,24 @@ public $records = [];
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
$itemCode = $this->data['item_id'];
$itemId = Item::where('plant_id', $characteristic->plant_id)->where('code', $itemCode)->value('id');
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
$limit = ProductCharacteristicsMaster::where('plant_id', $characteristic->plant_id)
->where('line_id', $characteristic->line_id)
->where('name', $characteristic->name)
->where('item_id', $itemId)
->first();
if (! $characteristic || ! is_numeric($value)) {
return 'Not Ok';
}
// return ($value >= $characteristic->lower && $value <= $characteristic->upper) ? 'Ok' : 'Not Ok';
return ($value > $characteristic->lower && $value < $characteristic->upper) ? 'Ok' : 'Not Ok';
return ($value >= $limit->lower && $value <= $limit->upper) ? 'Ok' : 'Not Ok';
}

View File

@@ -83,6 +83,15 @@
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
No of Person
</td>
<td style="border:1px solid #d1d5db;">
{{ $visitor->number_of_person }}
</td>
</tr>
<tr>
<td style="border:1px solid #d1d5db;font-weight:bold;">
Visit Time

View File

@@ -26,7 +26,7 @@
$grossWeightHeight = 5;
$netWeightHeight = 5;
$licenseHeight = 5;
$companyInfoHeight = 6.9;
$companyInfoHeight = 6.9; //6.9
$logoHeight = $titleHeight * 0.8;
$logoMaxWidth = 20;
$isilogoHeight = $titleHeight * 0.9;
@@ -240,8 +240,13 @@
/* Column widths */
.col-1 { width: 22%; }
.col-2 { width: 45%; }
.col-3 { width: 11%; }
.col-4 { width: 29%; }
/* .col-1 { width: 20%; }
.col-2 { width: 48%; }
.col-3 { width: 15%; }
.col-4 { width: 25%; }
.col-4 { width: 17%; } */
/* Force exact heights for rows - ALL FIXED EXCEPT ITEM ROWS */
.title-row {