Added all balde files related to production order screen and routes and controllers
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled
This commit is contained in:
92
app/Http/Controllers/ProductionOrderController.php
Normal file
92
app/Http/Controllers/ProductionOrderController.php
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\ProductionOrder;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use SimpleSoftwareIO\QrCode\Facades\QrCode;
|
||||||
|
use Barryvdh\DomPDF\Facade\Pdf;
|
||||||
|
|
||||||
|
class ProductionOrderController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function print($production_order)
|
||||||
|
{
|
||||||
|
$order = ProductionOrder::where('production_order', $production_order)->first();
|
||||||
|
|
||||||
|
if (!$order) {
|
||||||
|
abort(404, 'Production Order not found');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$fromSerial = (int) $order->from_serial_number;
|
||||||
|
$toSerial = (int) $order->to_serial_number;
|
||||||
|
$itemCode = $order->item->code ?? '';
|
||||||
|
$itemDes = $order->item->description ?? '';
|
||||||
|
|
||||||
|
$stickers = [];
|
||||||
|
|
||||||
|
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
$qrData = $itemCode . '|' . $serial;
|
||||||
|
|
||||||
|
$qrBase64 = base64_encode(
|
||||||
|
QrCode::format('png')->size(100)->generate($qrData)
|
||||||
|
);
|
||||||
|
|
||||||
|
$stickers[] = [
|
||||||
|
'serial' => $serial,
|
||||||
|
'qr' => 'data:image/png;base64,' . $qrBase64,
|
||||||
|
'production_order' => $production_order,
|
||||||
|
'description' => $itemDes ?? ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('production-orders.print', compact('stickers'))
|
||||||
|
->setPaper([0, 0, 170, 40]);
|
||||||
|
|
||||||
|
return $pdf->stream('stickers.pdf');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*/
|
||||||
|
public function show(string $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*/
|
||||||
|
public function update(Request $request, string $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*/
|
||||||
|
public function destroy(string $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="saveProductionOrder"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="printProductionOrder"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Print
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
105
resources/views/production-orders/print.blade.php
Normal file
105
resources/views/production-orders/print.blade.php
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
@page {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker {
|
||||||
|
width: 170pt;
|
||||||
|
height: 40pt;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker:last-child {
|
||||||
|
page-break-after: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr {
|
||||||
|
width: 26pt;
|
||||||
|
height: 26pt;
|
||||||
|
padding-top: 7pt;
|
||||||
|
padding-left: 6.5pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .text {
|
||||||
|
padding-left: 5pt;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.text {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 5pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .serial {
|
||||||
|
font-size: 10pt;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 6pt;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.serial {
|
||||||
|
font-size: 10pt;
|
||||||
|
font-weight: bold;
|
||||||
|
position: relative;
|
||||||
|
top: 5pt;
|
||||||
|
right: 6pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .po {
|
||||||
|
font-size: 8pt;
|
||||||
|
margin-bottom: 6pt;
|
||||||
|
margin-left: 75pt;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.po {
|
||||||
|
font-size: 8pt;
|
||||||
|
position: absolute;
|
||||||
|
right: 5pt;
|
||||||
|
top: 6pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
.desc {
|
||||||
|
font-size: 7pt;
|
||||||
|
margin-left: -5pt;
|
||||||
|
padding-top: 10pt;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
@foreach($stickers as $sticker)
|
||||||
|
<div class="sticker">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="width:40pt;">
|
||||||
|
<img class="qr" src="{{ $sticker['qr'] }}">
|
||||||
|
</td>
|
||||||
|
<td class="text">
|
||||||
|
<div class="serial">{{ $sticker['serial'] }}</div>
|
||||||
|
<div class="po">{{ $sticker['production_order'] }}</div>
|
||||||
|
<div class="desc">{{ $sticker['description'] }}</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\CharacteristicApprovalController;
|
use App\Http\Controllers\CharacteristicApprovalController;
|
||||||
|
use App\Http\Controllers\ProductionOrderController;
|
||||||
// use App\Http\Controllers\FileUploadController;
|
// use App\Http\Controllers\FileUploadController;
|
||||||
use App\Models\EquipmentMaster;
|
use App\Models\EquipmentMaster;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@@ -52,6 +53,10 @@ Route::get('/approval/approve-success', function () {
|
|||||||
return view('approval.approve-success');
|
return view('approval.approve-success');
|
||||||
})->name('approval.approve.success');
|
})->name('approval.approve.success');
|
||||||
|
|
||||||
|
Route::get('/production-orders/print/{production_order}',
|
||||||
|
[ProductionOrderController::class, 'print']
|
||||||
|
)->name('production-orders.print');
|
||||||
|
|
||||||
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
||||||
// ->name('characteristic.approve')
|
// ->name('characteristic.approve')
|
||||||
// ->middleware('signed');
|
// ->middleware('signed');
|
||||||
@@ -67,6 +72,7 @@ Route::get('/approval/approve-success', function () {
|
|||||||
// ->middleware('signed');
|
// ->middleware('signed');
|
||||||
|
|
||||||
// routes/web.php
|
// routes/web.php
|
||||||
|
|
||||||
Route::post('/save-serials-to-session', function (Request $request) {
|
Route::post('/save-serials-to-session', function (Request $request) {
|
||||||
session(['serial_numbers' => $request->serial_numbers]);
|
session(['serial_numbers' => $request->serial_numbers]);
|
||||||
|
|
||||||
@@ -86,6 +92,16 @@ Route::get('/part-validation-image/{filename}', function ($filename) {
|
|||||||
return response()->file($path);
|
return response()->file($path);
|
||||||
})->name('part.validation.image');
|
})->name('part.validation.image');
|
||||||
|
|
||||||
|
Route::get('/workflow-image/{filename}', function ($filename) {
|
||||||
|
$path = storage_path("app/private/uploads/LaserDocs/{$filename}");
|
||||||
|
|
||||||
|
if (! file_exists($path)) {
|
||||||
|
abort(404, 'Image not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->file($path);
|
||||||
|
})->name('workflow.image');
|
||||||
|
|
||||||
// web.php
|
// web.php
|
||||||
Route::post('/temp-upload', function (Request $request) {
|
Route::post('/temp-upload', function (Request $request) {
|
||||||
if (! $request->hasFile('photo')) {
|
if (! $request->hasFile('photo')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user