Compare commits
25 Commits
d31a392c21
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ce7995105 | ||
|
|
d5cd1437fe | ||
|
|
d4d101c5c9 | ||
|
|
b8cb0aa237 | ||
|
|
eef42d9736 | ||
|
|
3316c11036 | ||
|
|
bf22ef5af0 | ||
|
|
52868742c0 | ||
|
|
30175a71d3 | ||
|
|
5fe8eeaeee | ||
|
|
fa10ea14fe | ||
|
|
f0af6853ee | ||
|
|
d213049fdd | ||
|
|
42e926f9c2 | ||
|
|
140249e824 | ||
|
|
5a77cdfdc2 | ||
|
|
015976dcb5 | ||
|
|
7627aa07fd | ||
|
|
aad961260a | ||
|
|
305d28617b | ||
|
|
851e753b74 | ||
|
|
c94688a794 | ||
|
|
9db6227566 | ||
|
|
d24b4f35f4 | ||
|
|
56656264c0 |
@@ -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')
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -80,7 +80,10 @@ class WireMasterPrint extends Page
|
||||
|
||||
return CustomerPoMaster::where('plant_id', $plantId)->distinct()->pluck('customer_po', 'customer_po'); //->pluck('customer_po', 'id'); ->distinct()
|
||||
})
|
||||
->required(),
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
$set('scan_pallet_no', null);
|
||||
}),
|
||||
Select::make('scan_pallet_no')
|
||||
->label('Scan Pallet No')
|
||||
->reactive()
|
||||
|
||||
@@ -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)',
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -178,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);
|
||||
@@ -384,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')
|
||||
@@ -478,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")) {
|
||||
|
||||
@@ -72,8 +72,6 @@ class CreatePanelBoxValidation extends CreateRecord {
|
||||
->send();
|
||||
$this->halt();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function checkIfHasCharacteristics(array $data)
|
||||
|
||||
@@ -71,44 +71,8 @@ class WireMasterPackingResource extends Resource
|
||||
})
|
||||
->required()
|
||||
->afterStateUpdated(function ($state, callable $set) {
|
||||
if (!$state) {
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$set('item_id', null);
|
||||
$set('wire_packing_number', null);
|
||||
|
||||
// $customerPo = CustomerPoMaster::find($state);
|
||||
|
||||
// if ($customerPo && $customerPo->item_id) {
|
||||
// $item = Item::find($customerPo->item_id);
|
||||
|
||||
// $set('item', $item?->code);
|
||||
// } else {
|
||||
// $set('item', null);
|
||||
// }
|
||||
}),
|
||||
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item Code')
|
||||
->reactive()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
|
||||
$customerPoId = $get('customer_po_master_id');
|
||||
|
||||
if (!$customerPoId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::whereIn(
|
||||
'id',
|
||||
CustomerPoMaster::where('customer_po', $customerPoId)
|
||||
->pluck('item_id')
|
||||
)->pluck('code', 'id');
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('wire_packing_number')
|
||||
->label('Scan Wire Packing No')
|
||||
->reactive()
|
||||
@@ -205,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', '');
|
||||
|
||||
@@ -54,8 +54,6 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
|
||||
$customerPo = trim($this->form->getState()['customer_po_master_id'])?? null;
|
||||
|
||||
$selectedItem = trim($this->form->getState()['item_id'])?? null;
|
||||
|
||||
$wirePackNo = trim($this->form->getState()['wire_packing_number'])?? null;
|
||||
|
||||
$wirePackNo = trim($wirePackNo) ?? null;
|
||||
@@ -166,30 +164,6 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
$itemId = Item::where('code', $materialCode)
|
||||
->where('plant_id', $plantId)
|
||||
->value('id');
|
||||
|
||||
if($itemId != $selectedItem){
|
||||
Notification::make()
|
||||
->title("Item Code Mismatch")
|
||||
->body("Scanned Item Code '$materialCode' does not match the selected Item in the form.")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'process_order' => null,
|
||||
'plant_id' => $plantId,
|
||||
'customer_po_master_id' => $customerPo,
|
||||
'wire_packing_number' => $wirePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$icodeAgaCPoPlant)
|
||||
@@ -282,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 '$customerPoRecord->name' 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();
|
||||
|
||||
@@ -163,16 +163,19 @@ class PalletPrintController extends Controller
|
||||
public function print(Request $request, $pallet, $plant)
|
||||
{
|
||||
|
||||
$customerPo = $request->query('customer');
|
||||
|
||||
$itemId = WireMasterPacking::where('plant_id', $plant)
|
||||
$customerPoMasterId = WireMasterPacking::where('plant_id', $plant)
|
||||
->where('wire_packing_number', $pallet)
|
||||
->value('item_id');
|
||||
->value('customer_po_master_id');
|
||||
|
||||
$customerPoIds = CustomerPoMaster::where('plant_id', $plant)
|
||||
->where('customer_po', $customerPo)
|
||||
->where('item_id', $itemId)
|
||||
->pluck('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)
|
||||
@@ -187,27 +190,23 @@ class PalletPrintController extends Controller
|
||||
];
|
||||
});
|
||||
|
||||
$masterBox = WireMasterPacking::where('plant_id', $plant)
|
||||
->where('wire_packing_number', $pallet)
|
||||
->value('customer_po_master_id');
|
||||
|
||||
$customer = CustomerPoMaster::find($masterBox);
|
||||
$customer = CustomerPoMaster::find($customerPoMasterId);
|
||||
|
||||
$customerCode = $customer->customer_po ?? '';
|
||||
$customerName = $customer->customer_name ?? '';
|
||||
|
||||
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||
// ->where('customer_po_master_id', $customerId)
|
||||
// ->distinct('wire_packing_number')
|
||||
// ->count('wire_packing_number');
|
||||
|
||||
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||
// ->whereIn('customer_po_master_id', $customerPoIds)
|
||||
// ->distinct('wire_packing_number')
|
||||
// ->count('wire_packing_number');
|
||||
// ->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', $customerPoIds)
|
||||
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||
->select('wire_packing_number')
|
||||
->groupBy('wire_packing_number')
|
||||
->havingRaw(
|
||||
@@ -217,7 +216,7 @@ class PalletPrintController extends Controller
|
||||
->count();
|
||||
|
||||
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||
// ->where('customer_po_master_id', $customerId)
|
||||
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||
// ->select('wire_packing_number')
|
||||
// ->groupBy('wire_packing_number')
|
||||
// ->havingRaw(
|
||||
@@ -229,20 +228,20 @@ class PalletPrintController extends Controller
|
||||
// ->values();
|
||||
|
||||
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||
->whereIn('customer_po_master_id', $customerPoIds)
|
||||
->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();
|
||||
->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 : 1;
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||
|
||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||
|
||||
@@ -254,11 +253,18 @@ class PalletPrintController extends Controller
|
||||
|
||||
$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' => now()->format('M-y'),
|
||||
'monthYear' => $scannedAt
|
||||
? \Carbon\Carbon::parse($scannedAt)->format('M-y')
|
||||
: '',
|
||||
'branch' => '',
|
||||
'customerCode' => $customerCode,
|
||||
'customerName' => $customerName,
|
||||
|
||||
@@ -151,19 +151,38 @@ public $records = [];
|
||||
|
||||
$characteristic = ProductCharacteristicsMaster::find($characteristicId);
|
||||
|
||||
if (($characteristic?->inspection_type ?? null) === 'Value') {
|
||||
if ($characteristic && is_numeric($value) && (($value >= $characteristic->lower && $value <= $characteristic->upper) || $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 {
|
||||
$status = 'NotOk';
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// $status = $value;
|
||||
// }
|
||||
else {
|
||||
$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,
|
||||
@@ -178,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');
|
||||
@@ -214,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';
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user