Compare commits
1 Commits
a52fc9580a
...
renovate/v
| Author | SHA1 | Date | |
|---|---|---|---|
| 63e7f1a344 |
@@ -13,49 +13,30 @@ class CharacteristicValueExporter extends Exporter
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
static $rowNumber = 0;
|
||||
return [
|
||||
ExportColumn::make('no')
|
||||
->label('NO')
|
||||
->state(function ($record) use (&$rowNumber) {
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('line.name')
|
||||
->label('LINE NAME'),
|
||||
ExportColumn::make('item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('machine.name')
|
||||
->label('WORK CENTER'),
|
||||
ExportColumn::make('process_order')
|
||||
->label('PROCESS ORDER'),
|
||||
ExportColumn::make('coil_number')
|
||||
->label('COIL NUMBER'),
|
||||
ExportColumn::make('status')
|
||||
->label('STATUS'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
ExportColumn::make('created_by')
|
||||
->label('CREATED BY'),
|
||||
ExportColumn::make('updated_by')
|
||||
->label('UPDATED BY'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
ExportColumn::make('plant.name'),
|
||||
ExportColumn::make('line.name'),
|
||||
ExportColumn::make('item.id'),
|
||||
ExportColumn::make('machine.name'),
|
||||
ExportColumn::make('process_order'),
|
||||
ExportColumn::make('coil_number'),
|
||||
ExportColumn::make('status'),
|
||||
ExportColumn::make('created_at'),
|
||||
ExportColumn::make('updated_at'),
|
||||
ExportColumn::make('created_by'),
|
||||
ExportColumn::make('updated_by'),
|
||||
ExportColumn::make('deleted_at'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your characteristic value export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your characteristic value export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -24,16 +24,14 @@ class InvoiceValidationExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('invoice_number')
|
||||
->label('INVOICE NUMBER'),
|
||||
ExportColumn::make('serial_number')
|
||||
->label('SERIAL NUMBER'),
|
||||
ExportColumn::make('stickerMaster.item.code')
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('stickerMaster.item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('motor_scanned_status')
|
||||
->label('MOTOR SCANNED STATUS'),
|
||||
ExportColumn::make('pump_scanned_status')
|
||||
@@ -60,23 +58,23 @@ class InvoiceValidationExporter extends Exporter
|
||||
->label('OPERATOR ID'),
|
||||
ExportColumn::make('created_at')
|
||||
->label('CREATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('updated_at')
|
||||
->label('UPDATED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
// ->dateTimeFormat('d-m-Y H:i:s'),
|
||||
//->dateTimeFormat('d-m-Y H:i:s'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your invoice validation export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||
$body = 'Your invoice validation export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -3,16 +3,9 @@
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProcessOrder;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Str;
|
||||
|
||||
class CharacteristicValueImporter extends Importer
|
||||
{
|
||||
@@ -23,52 +16,25 @@ class CharacteristicValueImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Line Name')
|
||||
->example('4 inch pump line')
|
||||
->label('Line Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Item Code')
|
||||
->example('123456')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Work Center')
|
||||
->example('RMGS09745')
|
||||
->label('Work Center')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('process_order')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Process Order')
|
||||
->example('23455256352')
|
||||
->label('Process Order'),
|
||||
ImportColumn::make('coil_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Coil Number')
|
||||
->example('0')
|
||||
->label('Coil Number'),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Status')
|
||||
->example('Ok')
|
||||
->label('Status'),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example('RAW01234')
|
||||
->label('Created By'),
|
||||
ImportColumn::make('process_order'),
|
||||
ImportColumn::make('coil_number'),
|
||||
ImportColumn::make('status'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -79,180 +45,15 @@ class CharacteristicValueImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
$warnMsg = [];
|
||||
$plantId = null;
|
||||
$itemId = null;
|
||||
$LineId = null;
|
||||
$machineId = null;
|
||||
$itemAgainstPlant = null;
|
||||
|
||||
$plantCode = $this->data['plant'];
|
||||
$processOrder = trim($this->data['process_order'] ?? '');
|
||||
$iCode = trim($this->data['item']);
|
||||
$workCenter = trim($this->data['machine']);
|
||||
$lineName = trim($this->data['line']);
|
||||
$status = trim($this->data['status']);
|
||||
$createdBy = trim($this->data['created_by']);
|
||||
$coilNo = trim($this->data['coil_number']);
|
||||
|
||||
if ($plantCode == null || $plantCode == '') {
|
||||
$warnMsg[] = 'Plant code cannot be empty';
|
||||
} elseif ($iCode == null || $iCode == '') {
|
||||
$warnMsg[] = 'Process Order cannot be empty';
|
||||
} elseif ($workCenter == null || $workCenter == '') {
|
||||
$warnMsg[] = 'Work center cannot be empty';
|
||||
} elseif ($lineName == null || $lineName == '') {
|
||||
$warnMsg[] = 'Line cannot be empty';
|
||||
}
|
||||
|
||||
if (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
} else {
|
||||
$itemCode = Item::where('code', $iCode)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$itemAgainstPlant = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
if (! $itemAgainstPlant) {
|
||||
$warnMsg[] = 'Item code not found for the given plant';
|
||||
} else {
|
||||
$itemId = $itemAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lineExists = Line::where('name', $lineName)->first();
|
||||
if (! $lineExists) {
|
||||
$warnMsg[] = 'Line name not found';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$lineAgainstPlant = Line::where('name', $lineName)->where('plant_id', $plantId)->first();
|
||||
if (! $lineAgainstPlant) {
|
||||
$warnMsg[] = 'Line name not found for the given plant';
|
||||
} else {
|
||||
$LineId = $lineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workCenterExist = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $workCenterExist) {
|
||||
$warnMsg[] = 'Work Center not found';
|
||||
}
|
||||
|
||||
// $workCenterAgainstPlant = Machine::where('work_center', $workCenter)
|
||||
// ->where('plant_id', $plantId)
|
||||
// ->first();
|
||||
|
||||
// if (!$workCenterAgainstPlant) {
|
||||
// $warnMsg[] = 'Work center not found for the given plant';
|
||||
// } else {
|
||||
// $MachineId = $workCenterAgainstPlant->id;
|
||||
// }
|
||||
|
||||
if ($plantId != null && $LineId != null) {
|
||||
$machineAgaPlantLine = Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $LineId)
|
||||
->where('work_center', $workCenter)
|
||||
->first();
|
||||
|
||||
if (! $machineAgaPlantLine) {
|
||||
$warnMsg[] = 'Work center not found for the given plant and line';
|
||||
} else {
|
||||
$machineId = $machineAgaPlantLine->id;
|
||||
}
|
||||
}
|
||||
|
||||
if ($processOrder == null || $processOrder == '') {
|
||||
$warnMsg[] = 'Process Order cannot be empty';
|
||||
}
|
||||
|
||||
if ($coilNo == null || $coilNo == '') {
|
||||
$warnMsg[] = 'Coil No cannot be empty';
|
||||
} elseif (! is_numeric($coilNo)) {
|
||||
$warnMsg[] = 'Coil number should contain only numeric values!';
|
||||
}
|
||||
|
||||
if ($status == null || $status == '' || ! $status) {
|
||||
$warnMsg[] = 'Status cannot be empty';
|
||||
} elseif (! in_array($status, ['Ok', 'NotOk'], true)) {
|
||||
$warnMsg[] = "Status must be either 'Ok' or 'NotOk'!";
|
||||
}
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
$warnMsg[] = 'Created By cannot be empty';
|
||||
}
|
||||
|
||||
// $existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
// ->where('process_order', $processOrder)
|
||||
// ->where('coil_number', $coilNo)
|
||||
// ->first();
|
||||
|
||||
// if ($existing) {
|
||||
// $warnMsg[] = "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!";
|
||||
// }
|
||||
|
||||
if ($plantId && $processOrder) {
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
$warnMsg[] = "Coil number '{$coilNo}' already exists for Plant '{$plantCode}' and Process Order '{$processOrder}'.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($plant && $itemCode && $processOrder != '') {
|
||||
|
||||
$existingOrder = ProcessOrder::where('plant_id', $plant->id)
|
||||
->where('process_order', $processOrder)
|
||||
->first();
|
||||
|
||||
if ($existingOrder && $existingOrder->item_id !== ($itemCode->id ?? null)) {
|
||||
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return CharacteristicValue::create([
|
||||
'plant_id' => $plantId,
|
||||
'item_id' => $itemId,
|
||||
'line_id' => $LineId,
|
||||
'machine_id' => $machineId,
|
||||
'process_order' => trim($this->data['process_order']),
|
||||
'coil_number' => trim($this->data['coil_number']),
|
||||
'status' => trim($this->data['status']),
|
||||
'created_by' => trim($this->data['created_by']),
|
||||
]);
|
||||
|
||||
// return null;
|
||||
|
||||
// return new CharacteristicValue;
|
||||
return new CharacteristicValue();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your characteristic value import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
$body = 'Your characteristic value import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -641,322 +641,322 @@ class StickerReprint extends Page implements HasForms
|
||||
|
||||
// ********************************
|
||||
|
||||
// $exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
// ->where('shift_id', $this->sId)
|
||||
// ->where('line_id', $this->lId)
|
||||
// ->whereDate('created_at', today())
|
||||
// ->latest()
|
||||
// ->exists();
|
||||
$exists = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
->where('shift_id', $this->sId)
|
||||
->where('line_id', $this->lId)
|
||||
->whereDate('created_at', today())
|
||||
->latest()
|
||||
->exists();
|
||||
|
||||
// if ($exists)
|
||||
// {
|
||||
// $currentDate = date('Y-m-d');
|
||||
if ($exists)
|
||||
{
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
// $shiftId = Shift::where('id', $this->sId)
|
||||
// ->first();
|
||||
$shiftId = Shift::where('id', $this->sId)
|
||||
->first();
|
||||
|
||||
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
// $hRs = (int) $hRs;
|
||||
// //$miNs = (int) $miNs;-*/
|
||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
$hRs = (int) $hRs;
|
||||
//$miNs = (int) $miNs;-*/
|
||||
|
||||
// $totalMinutes = $hRs * 60 + $miNs;
|
||||
$totalMinutes = $hRs * 60 + $miNs;
|
||||
|
||||
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
|
||||
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
|
||||
// $currentDateTime = date('Y-m-d H:i:s');
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
|
||||
// // Check if current date time is within the range
|
||||
// if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// Check if current date time is within the range
|
||||
if (!($currentDateTime >= $from_dt && $currentDateTime < $to_dt)) {
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Shift')
|
||||
// ->body("Please select a valid shift.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
// ->where('shift_id', $this->sId)
|
||||
// ->where('line_id', $this->lId)
|
||||
// ->whereDate('created_at', Carbon::yesterday())
|
||||
// ->latest()
|
||||
// ->exists();
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Shift')
|
||||
->body("Please select a valid shift.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId)
|
||||
->where('shift_id', $this->sId)
|
||||
->where('line_id', $this->lId)
|
||||
->whereDate('created_at', Carbon::yesterday())
|
||||
->latest()
|
||||
->exists();
|
||||
|
||||
// if ($existShifts) //if ($existShifts->count() > 0)
|
||||
// { // record exist on yesterday
|
||||
// //$currentDate = date('Y-m-d');
|
||||
// $yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||
if ($existShifts) //if ($existShifts->count() > 0)
|
||||
{ // record exist on yesterday
|
||||
//$currentDate = date('Y-m-d');
|
||||
$yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||
|
||||
// $shiftId = Shift::where('id', $this->sId)
|
||||
// ->first();
|
||||
$shiftId = Shift::where('id', $this->sId)
|
||||
->first();
|
||||
|
||||
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
// $hRs = (int) $hRs;
|
||||
// // $miNs = (int) $miNs;-*/
|
||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
$hRs = (int) $hRs;
|
||||
// $miNs = (int) $miNs;-*/
|
||||
|
||||
// $totalMinutes = $hRs * 60 + $miNs;
|
||||
$totalMinutes = $hRs * 60 + $miNs;
|
||||
|
||||
// $from_dt = $yesterday . ' ' . $shiftId->start_time;
|
||||
$from_dt = $yesterday . ' ' . $shiftId->start_time;
|
||||
|
||||
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
|
||||
// $currentDateTime = date('Y-m-d H:i:s');
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
|
||||
// // Check if current date time is within the range
|
||||
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $currentDate = date('Y-m-d');
|
||||
// Check if current date time is within the range
|
||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
// $shiftId = Shift::where('id', $this->sId)
|
||||
// ->first();
|
||||
$shiftId = Shift::where('id', $this->sId)
|
||||
->first();
|
||||
|
||||
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
// $hRs = (int) $hRs;
|
||||
// // $miNs = (int) $miNs;-*/
|
||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
$hRs = (int) $hRs;
|
||||
// $miNs = (int) $miNs;-*/
|
||||
|
||||
// $totalMinutes = $hRs * 60 + $miNs;
|
||||
$totalMinutes = $hRs * 60 + $miNs;
|
||||
|
||||
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
|
||||
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
|
||||
// $currentDateTime = date('Y-m-d H:i:s');
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
|
||||
// // Check if current date time is within the range
|
||||
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// Check if current date time is within the range
|
||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Plan Not Found')
|
||||
// ->body("Please set production plan first.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Plan Not Found')
|
||||
->body("Please set production plan first.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Shift')
|
||||
// ->body("Please select a valid shift.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// { // record not exist on yesterday
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Shift')
|
||||
->body("Please select a valid shift.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // record not exist on yesterday
|
||||
|
||||
// //$currentDate = date('Y-m-d');
|
||||
// $yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||
//$currentDate = date('Y-m-d');
|
||||
$yesterday = date('Y-m-d', strtotime('-1 days'));
|
||||
|
||||
// $shiftId = Shift::where('id', $this->sId)
|
||||
// ->first();
|
||||
$shiftId = Shift::where('id', $this->sId)
|
||||
->first();
|
||||
|
||||
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
// $hRs = (int) $hRs;
|
||||
// // $miNs = (int) $miNs;-*/
|
||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
$hRs = (int) $hRs;
|
||||
// $miNs = (int) $miNs;-*/
|
||||
|
||||
// $totalMinutes = $hRs * 60 + $miNs;
|
||||
$totalMinutes = $hRs * 60 + $miNs;
|
||||
|
||||
// $from_dt = $yesterday . ' ' . $shiftId->start_time;
|
||||
$from_dt = $yesterday . ' ' . $shiftId->start_time;
|
||||
|
||||
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
|
||||
// $currentDateTime = date('Y-m-d H:i:s');
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
|
||||
// // Check if current date time is within the range
|
||||
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// Check if current date time is within the range
|
||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Plan Not Found')
|
||||
// ->body("Please set production plan first.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $currentDate = date('Y-m-d');
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Plan Not Found')
|
||||
->body("Please set production plan first.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
// $shiftId = Shift::where('id', $this->sId)
|
||||
// ->first();
|
||||
$shiftId = Shift::where('id', $this->sId)
|
||||
->first();
|
||||
|
||||
// [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
// $hRs = (int) $hRs;
|
||||
// // $miNs = (int) $miNs;-*/
|
||||
[$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0];
|
||||
$hRs = (int) $hRs;
|
||||
// $miNs = (int) $miNs;-*/
|
||||
|
||||
// $totalMinutes = $hRs * 60 + $miNs;
|
||||
$totalMinutes = $hRs * 60 + $miNs;
|
||||
|
||||
// $from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
$from_dt = $currentDate . ' ' . $shiftId->start_time;
|
||||
|
||||
// $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
$to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes"));
|
||||
|
||||
// $currentDateTime = date('Y-m-d H:i:s');
|
||||
$currentDateTime = date('Y-m-d H:i:s');
|
||||
|
||||
// // Check if current date time is within the range
|
||||
// if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// Check if current date time is within the range
|
||||
if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) {
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Plan Not Found')
|
||||
// ->body("Please set production plan first.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //echo "Choosed a valid shift...";
|
||||
// // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Plan Not Found')
|
||||
->body("Please set production plan first.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "Choosed a valid shift...";
|
||||
// $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Shift')
|
||||
// ->body("Please select a valid shift.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Shift')
|
||||
->body("Please select a valid shift.")
|
||||
->danger()
|
||||
->send();
|
||||
//$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************
|
||||
|
||||
@@ -1155,27 +1155,12 @@ class StickerReprint extends Page implements HasForms
|
||||
// Only search when all parent IDs are selected
|
||||
$parts = explode('|', $formQRData);
|
||||
$itemCode = trim($parts[0]);
|
||||
|
||||
|
||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
// // Remove slash and everything after it
|
||||
// if ($serialNumberRaw != null) {
|
||||
// $serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
// $serialNumber = trim($serialNumber);
|
||||
// } else {
|
||||
// $serialNumber = null;
|
||||
// }
|
||||
// Remove slash and everything after it
|
||||
if ($serialNumberRaw != null) {
|
||||
if (strpos($serialNumberRaw, '/') !== false) {
|
||||
$serialNumber = strstr($serialNumberRaw, '/', true); // gets text before slash
|
||||
} else {
|
||||
$serialNumber = $serialNumberRaw; // keep original
|
||||
|
||||
}
|
||||
|
||||
$serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$serialNumber = trim($serialNumber);
|
||||
|
||||
} else {
|
||||
$serialNumber = null;
|
||||
}
|
||||
@@ -1284,86 +1269,86 @@ class StickerReprint extends Page implements HasForms
|
||||
return;
|
||||
}
|
||||
|
||||
//$line = Line::find($this->lId);
|
||||
//$lineName = $line ? $line->name : null;
|
||||
$line = Line::find($this->lId);
|
||||
$lineName = $line ? $line->name : null;
|
||||
|
||||
// $categoryName = (Str::length($item->category) > 0) ? $item->category : "";
|
||||
$categoryName = (Str::length($item->category) > 0) ? $item->category : "";
|
||||
|
||||
// if ($categoryName == 'Submersible Motor')
|
||||
// {
|
||||
// if ($lineName != '6 inch motor line')
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Line Found')
|
||||
// ->body("Choose '6 inch motor line' to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else if ($categoryName == 'Submersible Pump')
|
||||
// {
|
||||
// if ($lineName != '6 inch pump line')
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Line Found')
|
||||
// ->body("Choose '6 inch pump line' to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $this->form->fill([
|
||||
// 'plant_id'=> $this->pId,
|
||||
// 'block_name'=> $this->bId,
|
||||
// 'shift_id'=> $this->sId,
|
||||
// 'line_id'=> $this->lId,
|
||||
// 'item_id'=> null,
|
||||
// 'serial_number'=> null,
|
||||
// 'success_msg'=> null,
|
||||
// 'production_order'=> $this->prodOrder,
|
||||
// 'sap_msg_status' => null,
|
||||
// 'sap_msg_description' => null,
|
||||
// 'operator_id'=> $operatorName,
|
||||
// 'recent_qr' => $this->recQr,
|
||||
// ]);
|
||||
// Notification::make()
|
||||
// ->title('Invalid Category Found')
|
||||
// ->body("Set proper category to proceed..!")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
if ($categoryName == 'Submersible Motor')
|
||||
{
|
||||
if ($lineName != '6 inch motor line')
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Line Found')
|
||||
->body("Choose '6 inch motor line' to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if ($categoryName == 'Submersible Pump')
|
||||
{
|
||||
if ($lineName != '6 inch pump line')
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Line Found')
|
||||
->body("Choose '6 inch pump line' to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
'line_id'=> $this->lId,
|
||||
'item_id'=> null,
|
||||
'serial_number'=> null,
|
||||
'success_msg'=> null,
|
||||
'production_order'=> $this->prodOrder,
|
||||
'sap_msg_status' => null,
|
||||
'sap_msg_description' => null,
|
||||
'operator_id'=> $operatorName,
|
||||
'recent_qr' => $this->recQr,
|
||||
]);
|
||||
Notification::make()
|
||||
->title('Invalid Category Found')
|
||||
->body("Set proper category to proceed..!")
|
||||
->danger()
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->succId == null) {
|
||||
$this->form->fill([
|
||||
@@ -1398,33 +1383,6 @@ class StickerReprint extends Page implements HasForms
|
||||
$itemCode = trim($parts[0]);
|
||||
$this->sNoId = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
$originalQR = $this->qrData;
|
||||
|
||||
if (strpos($originalQR, '/') != false)
|
||||
{
|
||||
// Allowed endings
|
||||
$allowed = ['/m', '/M', '/p', '/P', '/m|', '/M|', '/p|', '/P|'];
|
||||
|
||||
$foundValidEnding = false;
|
||||
|
||||
foreach ($allowed as $end) {
|
||||
if (str_ends_with($originalQR, $end)) {
|
||||
$foundValidEnding = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$foundValidEnding) {
|
||||
Notification::make()
|
||||
->title('Invalid QR Code')
|
||||
->body("Invalid QR format: '$originalQR'")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->sNoId != null) {
|
||||
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$this->sNoId = trim($this->sNoId);
|
||||
@@ -1432,7 +1390,7 @@ class StickerReprint extends Page implements HasForms
|
||||
$this->sNoId = null;
|
||||
}
|
||||
|
||||
//$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||
$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||
|
||||
ProductionQuantity::create([
|
||||
'plant_id'=> $this->pId,
|
||||
@@ -1448,6 +1406,7 @@ class StickerReprint extends Page implements HasForms
|
||||
|
||||
// after success insertion
|
||||
$this->form->fill([
|
||||
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
@@ -1470,7 +1429,7 @@ class StickerReprint extends Page implements HasForms
|
||||
->duration(1000)
|
||||
->send();
|
||||
|
||||
$url = route('download-qr1-pdf', ['palletNo' => urlencode($originalQR)]);
|
||||
$url = route('download-qr1-pdf', ['palletNo' => $this->qrData]);
|
||||
$this->js(<<<JS
|
||||
window.dispatchEvent(new CustomEvent('open-pdf', {
|
||||
detail: {
|
||||
|
||||
@@ -184,10 +184,6 @@ class CharacteristicValueResource extends Resource
|
||||
->hint(fn ($get) => $get('coilNumberError') ? $get('coilNumberError') : null)
|
||||
->hintColor('danger')
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('observed_value')
|
||||
->label('Observed Value')
|
||||
->reactive()
|
||||
->required(),
|
||||
Forms\Components\Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
@@ -248,11 +244,6 @@ class CharacteristicValueResource extends Resource
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('observed_value')
|
||||
->label('Observed value')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->searchable()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
public bool $showCapacitorInput = false;
|
||||
|
||||
public $excel_file;
|
||||
public $mInvoiceNo;
|
||||
|
||||
public function getFormActions(): array
|
||||
{
|
||||
@@ -104,8 +103,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
{
|
||||
$invoiceNumber = trim($invoiceNumber);
|
||||
|
||||
$parts = explode('.', $invoiceNumber);
|
||||
|
||||
$this->showCapacitorInput = false;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
@@ -121,62 +118,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
// ..GET SERIAL INVOICE API
|
||||
|
||||
if(strlen($invoiceNumber) > 15)
|
||||
{
|
||||
|
||||
$payloadJson = base64_decode(strtr($parts[1], '-_', '+/'));
|
||||
|
||||
if (empty($payloadJson)) {
|
||||
Notification::make()
|
||||
->title('Invalid payload for scanned qr code.')
|
||||
->danger()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = json_decode($payloadJson, true);
|
||||
|
||||
|
||||
if (!isset($payload['data'])) {
|
||||
Notification::make()
|
||||
->title('Invalid payload for scanned qr code.')
|
||||
->info()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$documentData = $payload['data'];
|
||||
|
||||
if($documentData == '' || $documentData == ''){
|
||||
Notification::make()
|
||||
->title('Invalid payload for scanned qr code.')
|
||||
->info()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract DocNo
|
||||
preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
||||
|
||||
if (!isset($matches[1])) {
|
||||
Notification::make()
|
||||
->title('Invoice number not found.')
|
||||
->info()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($matches[1])) {
|
||||
$invoiceNumber = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
//dd($invoiceNumber);
|
||||
|
||||
// ..
|
||||
|
||||
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
||||
@@ -2801,6 +2742,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -2830,6 +2784,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -2858,6 +2825,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -3401,6 +3381,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
@@ -3518,6 +3511,20 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
@@ -3577,6 +3584,22 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
|
||||
// $mUserName = Filament::auth()->user()->name;
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'DuplicateCapacitorQR')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
|
||||
@@ -30,8 +30,6 @@ use Filament\Forms\Components\Select;
|
||||
use App\Models\Line;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use App\Models\Item;
|
||||
// use App\Models\PalletValidation;
|
||||
// use Dom\Text;
|
||||
|
||||
class ProcessOrderResource extends Resource
|
||||
{
|
||||
@@ -83,7 +81,7 @@ class ProcessOrderResource extends Resource
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
return \App\Models\Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
})
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
$plantId = $get('plant_id');
|
||||
@@ -92,23 +90,20 @@ class ProcessOrderResource extends Resource
|
||||
|
||||
if ($plantId && $itemId) {
|
||||
// Get the item code using item_id
|
||||
$itemCode = Item::where('id', $itemId)->value('code');
|
||||
$itemCode = \App\Models\Item::where('id', $itemId)->value('code');
|
||||
|
||||
if ($itemCode) {
|
||||
// Now get the item description using plant_id + code
|
||||
$item = Item::where('plant_id', $plantId)
|
||||
$item = \App\Models\Item::where('plant_id', $plantId)
|
||||
->where('code', $itemCode)
|
||||
->first();
|
||||
|
||||
$set('item_description', $item?->description);
|
||||
$set('item_uom', $item?->uom);
|
||||
} else {
|
||||
$set('item_description', null);
|
||||
$set('item_uom', null);
|
||||
}
|
||||
} else {
|
||||
$set('item_description', null);
|
||||
$set('item_uom', null);
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
@@ -120,7 +115,7 @@ class ProcessOrderResource extends Resource
|
||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||
$itemId = $get('item_id');
|
||||
if ($get('id')) {
|
||||
$item = Item::where('id', $itemId)->first()?->description;
|
||||
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
||||
if ($item) {
|
||||
$set('item_description', $item);
|
||||
} else {
|
||||
@@ -129,22 +124,6 @@ class ProcessOrderResource extends Resource
|
||||
}
|
||||
}),
|
||||
|
||||
Forms\Components\TextInput::make('item_uom')
|
||||
->label('UOM')
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||
$itemId = $get('item_id');
|
||||
if ($get('id')) {
|
||||
$item = Item::where('id', $itemId)->first()?->uom;
|
||||
if ($item) {
|
||||
$set('item_uom', $item);
|
||||
} else {
|
||||
$set('item_uom', null);
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
Forms\Components\TextInput::make('id')
|
||||
->hidden()
|
||||
->readOnly(),
|
||||
@@ -471,6 +450,7 @@ class ProcessOrderResource extends Resource
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
@@ -488,11 +468,6 @@ class ProcessOrderResource extends Resource
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.uom')
|
||||
->label('Uom')
|
||||
->alignCenter()
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('process_order')
|
||||
->label('Process Order')
|
||||
->alignCenter()
|
||||
@@ -553,7 +528,8 @@ class ProcessOrderResource extends Resource
|
||||
// ->filters([
|
||||
// Tables\Filters\TrashedFilter::make(),
|
||||
// ])
|
||||
->filters([
|
||||
->filters([
|
||||
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
@@ -572,17 +548,10 @@ class ProcessOrderResource extends Resource
|
||||
Select::make('Item')
|
||||
->label('Item Code')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if(empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
|
||||
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
@@ -642,6 +611,8 @@ class ProcessOrderResource extends Resource
|
||||
if (!empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
|
||||
//$query->orderBy('created_at', 'asc');
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
@@ -691,130 +662,6 @@ class ProcessOrderResource extends Resource
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\Action::make('reprint_process')
|
||||
->label('Re-Print Process Order')
|
||||
->form([
|
||||
Forms\Components\Section::make()
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant')
|
||||
->label('Select Plant')
|
||||
// ->options(Plant::pluck('name', 'id')->toArray())
|
||||
->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();
|
||||
})
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
$set('process_order', null);
|
||||
$set('coil_number', null);
|
||||
$set('received_quantity', null);
|
||||
$set('machine_name', null);
|
||||
}),
|
||||
Select::make('Item')
|
||||
->label('Item Code')
|
||||
->nullable()
|
||||
->required()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant');
|
||||
|
||||
if(empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
|
||||
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('process_order', null);
|
||||
$set('coil_number', null);
|
||||
$set('received_quantity', null);
|
||||
$set('machine_name', null);
|
||||
}),
|
||||
TextInput::make('process_order')
|
||||
->label('Process Order')
|
||||
->required()
|
||||
->placeholder('Enter Process Order')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('coil_number', null);
|
||||
$set('received_quantity', null);
|
||||
$set('machine_name', null);
|
||||
}),
|
||||
Select::make('coil_number')
|
||||
->label('Coil Number')
|
||||
->nullable()
|
||||
->required()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('plant');
|
||||
$itemId = $get('Item');
|
||||
$processOrder = $get('process_order');
|
||||
|
||||
if(empty($plantId) || empty($itemId) || empty($processOrder)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return ProcessOrder::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->where('process_order', $processOrder)
|
||||
->pluck('coil_number', 'coil_number');
|
||||
|
||||
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$plantId = $get('plant');
|
||||
$itemId = $get('Item');
|
||||
$processOrder = $get('process_order');
|
||||
|
||||
if(!$plantId || !$itemId || !$processOrder || !$state) {
|
||||
$set('received_quantity', null);
|
||||
$set('machine_name', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$processOrderData = ProcessOrder::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $state)
|
||||
->first();
|
||||
|
||||
$set('received_quantity', $processOrderData?->received_quantity);
|
||||
$set('machine_name', $processOrderData?->machine_name);
|
||||
}),
|
||||
TextInput::make('received_quantity')
|
||||
->label('Received Quantity')
|
||||
->readOnly(),
|
||||
|
||||
TextInput::make('machine_name')
|
||||
->label('Machine ID')
|
||||
->readOnly(),
|
||||
])
|
||||
->columns(['default' => 1, 'sm' => 3]),
|
||||
])
|
||||
// ->action(function (array $data) {
|
||||
// $selectedPalletNumber = $data['pallet_list'];
|
||||
// return redirect()->route('download-reprint-qr-pdf', ['palletNo' => $selectedPalletNumber]);
|
||||
// })
|
||||
->action(function (array $data) {
|
||||
$username = Filament::auth()->user()->name;
|
||||
return redirect()->route('download-reprint-process-pdf', [
|
||||
'plant' => $data['plant'],
|
||||
'item' => $data['Item'],
|
||||
'process_order' => $data['process_order'],
|
||||
'coil_number' => $data['coil_number'],
|
||||
'name' => $username,
|
||||
]);
|
||||
})
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view reprint process order');
|
||||
}),
|
||||
ImportAction::make()
|
||||
->label('Import Process Order')
|
||||
->color('warning')
|
||||
|
||||
@@ -606,8 +606,7 @@ class CharacteristicsController extends Controller
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '2') {
|
||||
@@ -624,7 +623,7 @@ class CharacteristicsController extends Controller
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} else {
|
||||
@@ -640,7 +639,7 @@ class CharacteristicsController extends Controller
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
@@ -658,7 +657,7 @@ class CharacteristicsController extends Controller
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} else {
|
||||
@@ -674,7 +673,7 @@ class CharacteristicsController extends Controller
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
@@ -695,8 +694,7 @@ class CharacteristicsController extends Controller
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'motor_expected_time' => $char['motor_expected_time'] ?? null,
|
||||
'pump_expected_time' => $char['pump_expected_time'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
@@ -711,15 +709,8 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$updatedRows += $affected;
|
||||
} else {
|
||||
$curStat = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->where('gernr', $serialNumber)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
$manStat = ($curStat->man_marked_status == null || $curStat->man_marked_status == '' || $curStat->man_marked_status == '0') ? 0 : (int) $curStat->man_marked_status;
|
||||
$values = [
|
||||
'man_marked_status' => (string) ($manStat + 1),
|
||||
'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
@@ -858,7 +849,9 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$machineId = $machine->id;
|
||||
|
||||
$availFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'motor_expected_time', 'pump_expected_time'];
|
||||
$availFields = [
|
||||
'class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_logo_ce', 'zmm_codeclass', 'zmm_colour', 'zmm_logo_cp', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_logo_nsf', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'pump_marked_status', 'motor_pump_pumpset_status', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time',
|
||||
];
|
||||
|
||||
if ($itemCode != '' && $itemCode != null && $itemCode && Str::length($itemCode) > 0) {
|
||||
$existingJob = ClassCharacteristic::where('plant_id', $plantId)
|
||||
@@ -944,7 +937,7 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||
$col = ['marked_by', 'man_marked_by'];
|
||||
$missingUsers = [];
|
||||
$missingUsersPlant = [];
|
||||
$missingUsersRight = [];
|
||||
@@ -1049,8 +1042,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$insertData['marked_by'] = ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null;
|
||||
$insertData['man_marked_by'] = ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null;
|
||||
$insertData['motor_marked_by'] = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null;
|
||||
$insertData['pump_marked_by'] = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null;
|
||||
|
||||
$existing = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
@@ -1130,7 +1121,7 @@ class CharacteristicsController extends Controller
|
||||
} else {
|
||||
$hasNewSno = true;
|
||||
|
||||
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||
$col = ['marked_by', 'man_marked_by'];
|
||||
$missingUsers = [];
|
||||
$missingUsersPlant = [];
|
||||
$missingUsersRight = [];
|
||||
@@ -1222,7 +1213,9 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$masterFields = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf'];
|
||||
$masterFields = [
|
||||
'class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name',
|
||||
];
|
||||
|
||||
$isInsertOrUpdate = false;
|
||||
|
||||
@@ -1285,8 +1278,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$insertData['marked_by'] = ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null;
|
||||
$insertData['man_marked_by'] = ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null;
|
||||
$insertData['motor_marked_by'] = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null;
|
||||
$insertData['pump_marked_by'] = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null;
|
||||
|
||||
$existing = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
@@ -1479,9 +1470,9 @@ class CharacteristicsController extends Controller
|
||||
], 400);
|
||||
}
|
||||
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'motor_expected_time', 'pump_expected_time'];
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf'];
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||
->where('plant_id', $plantId)
|
||||
@@ -1648,7 +1639,7 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($serialExists->mark_status != 'Marked' && $serialExists->motor_marked_status != 'Marked' && $serialExists->pump_marked_status != 'Marked') {
|
||||
if ($serialExists->mark_status != 'Marked' && $serialExists->mark_status != 'marked') {
|
||||
// "Serial number '{$serialNumber}' is not marked yet.<br>Please proceed with marking first.";
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -1868,9 +1859,9 @@ class CharacteristicsController extends Controller
|
||||
], 400);
|
||||
}
|
||||
|
||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','motor_expected_time','pump_expected_time'];
|
||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','expected_time'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf'];
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_laser_name'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||
->where('plant_id', $plantId)
|
||||
@@ -2099,7 +2090,7 @@ class CharacteristicsController extends Controller
|
||||
// ], 404);
|
||||
// }
|
||||
|
||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','motor_expected_time','pump_expected_time'];
|
||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','expected_time'];
|
||||
|
||||
// $characteristicsColumns = ['class','arbid','gamng','lmnga','zz1_cn_bill_ord','zmm_amps','zmm_brand','zmm_degreeofprotection','zmm_delivery','zmm_dir_rot','zmm_discharge','zmm_discharge_max','zmm_discharge_min','zmm_duty','zmm_eff_motor','zmm_eff_pump','zmm_frequency','zmm_head','zmm_heading','zmm_head_max','zmm_head_minimum','zmm_idx_eff_mtr','zmm_idx_eff_pump','zmm_kvacode','zmm_maxambtemp','zmm_mincoolingflow','zmm_motorseries','zmm_motor_model','zmm_outlet','zmm_phase','zmm_pressure','zmm_pumpflowtype','zmm_pumpseries','zmm_pump_model','zmm_ratedpower','zmm_region','zmm_servicefactor','zmm_servicefactormaximumamps','zmm_speed','zmm_suction','zmm_suctionxdelivery','zmm_supplysource','zmm_temperature','zmm_thrustload','zmm_volts','zmm_wire','zmm_package','zmm_pvarrayrating','zmm_isi','zmm_isimotor','zmm_isipump','zmm_isipumpset','zmm_pumpset_model','zmm_stages','zmm_headrange','zmm_overall_efficiency','zmm_connection','zmm_min_bore_size','zmm_isireference','zmm_category','zmm_submergence','zmm_capacitorstart','zmm_capacitorrun','zmm_inch','zmm_motor_type','zmm_dismantle_direction','zmm_eff_ovrall','zmm_bodymoc','zmm_rotormoc','zmm_dlwl','zmm_inputpower','zmm_imp_od','zmm_ambtemp','zmm_de','zmm_dischargerange','zmm_efficiency_class','zmm_framesize','zmm_impellerdiameter','zmm_insulationclass','zmm_maxflow','zmm_minhead','zmm_mtrlofconst','zmm_nde','zmm_powerfactor','zmm_tagno','zmm_year','zmm_laser_name'];
|
||||
|
||||
@@ -2133,8 +2124,6 @@ class CharacteristicsController extends Controller
|
||||
'MOTOR_MACHINE_NAME' => $serialExists->motor_machine_name ?? '',
|
||||
'PUMP_MACHINE_NAME' => $serialExists->pump_machine_name ?? '',
|
||||
'PUMPSET_MACHINE_NAME' => $serialExists->pumpset_machine_name ?? '',
|
||||
'MOTOR_EXPECTED_TIME' => $serialExists->motor_expected_time ?? '',
|
||||
'PUMP_EXPECTED_TIME' => $serialExists->pump_expected_time ?? '',
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -2418,7 +2407,6 @@ class CharacteristicsController extends Controller
|
||||
$processOrder = $data['process_order'] ?? '';
|
||||
$coilNo = $data['coil_number'] ?? '';
|
||||
$status = $data['status'] ?? '';
|
||||
$obsValue = $data['observed_value'] ?? '';
|
||||
$createdBy = $data['created_by'] ?? '';
|
||||
|
||||
if ($processOrder == null || $processOrder == '' || ! $processOrder) {
|
||||
@@ -2457,13 +2445,6 @@ class CharacteristicsController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($obsValue == null || $obsValue == '' || ! $obsValue) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Observed value can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -2503,7 +2484,6 @@ class CharacteristicsController extends Controller
|
||||
'process_order' => $processOrder,
|
||||
'coil_number' => $coilNo,
|
||||
'status' => $status,
|
||||
'observed_value' => $obsValue,
|
||||
'created_by' => $createdBy,
|
||||
]);
|
||||
|
||||
|
||||
@@ -20,23 +20,12 @@ class ProductionStickerReprintController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
public function downloadQrPdf(Request $request)
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
// $palletNo = urldecode($palletNo);
|
||||
$palletNo = urldecode($request->query('palletNo'));
|
||||
|
||||
if (!$palletNo) {
|
||||
abort(400, 'palletNo is required');
|
||||
}
|
||||
|
||||
$parts = explode('|', $palletNo);
|
||||
$itemCode = trim($parts[0]);
|
||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
// dd($serialNumberRaw);
|
||||
|
||||
if ($serialNumberRaw != null) {
|
||||
$serial = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$serial = trim($serial);
|
||||
@@ -61,42 +50,14 @@ class ProductionStickerReprintController extends Controller
|
||||
|
||||
$productionOrder = $production->production_order ?? '';
|
||||
|
||||
if(!preg_match('/\//', $palletNo)){
|
||||
if ($item->category == 'Submersible Motor')
|
||||
{
|
||||
$copies = 1;
|
||||
}
|
||||
elseif ($item->category == 'Submersible Pump')
|
||||
{
|
||||
$copies = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
if ($item->category == 'Submersible Motor')
|
||||
{
|
||||
// if ($item->category == 'Submersible Motor')
|
||||
// {
|
||||
// $copies = 1;
|
||||
// }
|
||||
// elseif ($item->category == 'Submersible Pump')
|
||||
// {
|
||||
// $copies = 1;
|
||||
// }
|
||||
$copies = 1;
|
||||
|
||||
if ($serialNumberRaw) {
|
||||
// Check if serial ends with /m or /M, optionally followed by |
|
||||
if (preg_match('/\/[mM](\|)?$/', $serialNumberRaw)) {
|
||||
$copies = 1;
|
||||
}
|
||||
// Check if serial ends with /p or /P, optionally followed by |
|
||||
elseif (preg_match('/\/[pP](\|)?$/', $serialNumberRaw)) {
|
||||
$copies = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $palletNo = preg_replace('/\/.*/', '', $palletNo);
|
||||
|
||||
elseif ($item->category == 'Submersible Pump')
|
||||
{
|
||||
$copies = 2;
|
||||
}
|
||||
// 5. Generate QR Code (base64)
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
@@ -112,8 +73,6 @@ class ProductionStickerReprintController extends Controller
|
||||
'copies'=> $copies,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
@@ -19,7 +19,6 @@ class CharacteristicValue extends Model
|
||||
'process_order',
|
||||
'coil_number',
|
||||
'status',
|
||||
'observed_value',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?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
|
||||
{
|
||||
DB::statement(<<<SQL
|
||||
ALTER TABLE characteristic_values
|
||||
ADD COLUMN observed_value NUMERIC(10,3);
|
||||
SQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('characteristic_values', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -13,6 +13,6 @@
|
||||
"laravel-vite-plugin": "^1.2.0",
|
||||
"postcss": "^8.4.47",
|
||||
"tailwindcss": "^3.4.13",
|
||||
"vite": "^6.0.11"
|
||||
"vite": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,9 +77,7 @@ Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'dow
|
||||
|
||||
// Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
||||
|
||||
//Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->where('palletNo', '.*')->name('download-qr1-pdf');
|
||||
Route::get('/download-qr1-pdf', [ProductionStickerReprintController::class, 'downloadQrPdf'])
|
||||
->name('download-qr1-pdf');
|
||||
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
|
||||
|
||||
// Production Dashboard Controller
|
||||
|
||||
@@ -161,23 +159,23 @@ Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_m
|
||||
|
||||
Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)
|
||||
|
||||
// ..Part Validation - Characteristics
|
||||
// //..Part Validation - Characteristics
|
||||
|
||||
// Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||
// // Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||
|
||||
// ..Serial or job
|
||||
// // //..Serial or job
|
||||
|
||||
// Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||
// // Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||
|
||||
// Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||
// // Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||
|
||||
// ..Job or Master - Characteristics
|
||||
// // //..Job or Master - Characteristics
|
||||
|
||||
// Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||
// // Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||
|
||||
// ..serial auto or manual
|
||||
// // //..serial auto or manual
|
||||
|
||||
// Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||
// // Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||
|
||||
// ..Product Characteristics
|
||||
|
||||
|
||||
@@ -9,9 +9,14 @@ Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
|
||||
Artisan::command('auto:scheduler', function () {
|
||||
$this->call('custom:scheduler');
|
||||
})->everyMinute()->withoutOverlapping();
|
||||
})->everyMinute();
|
||||
|
||||
|
||||
// Schedule::command('send:invoice-report');
|
||||
// Schedule::command('send:production-report');
|
||||
|
||||
// app()->booted(function () {
|
||||
// $schedule = app(Schedule::class);
|
||||
|
||||
Reference in New Issue
Block a user