Merge pull request 'Added ware house number logic for item code print logic' (#623) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #623
This commit was merged in pull request #623.
This commit is contained in:
2026-05-20 07:21:00 +00:00
2 changed files with 23 additions and 5 deletions

View File

@@ -80,7 +80,8 @@ class ProductionOrderController extends Controller
$wareHouseNo = Plant::where('code', $plantCode)->first();
$wareNo = $wareHouseNo->warehouse_number;
$wareNo = $wareHouseNo->warehouse_number ?? null;
\Log::info('Plant Data', [
'plant' => $wareHouseNo ? $wareHouseNo->toArray() : null,
@@ -135,7 +136,7 @@ class ProductionOrderController extends Controller
}
}
public function printitemserial($production_order)
public function printitemserial($production_order, $plantCode)
{
$order = ProductionOrder::where('production_order', $production_order)->first();
@@ -148,6 +149,14 @@ class ProductionOrderController extends Controller
$itemCode = $order->item->code ?? '';
$itemDes = $order->item->description ?? '';
$wareHouseNo = Plant::where('code', $plantCode)->first();
$wareNo = $wareHouseNo->warehouse_number ?? null;
$now = Carbon::now();
$year = $now->format('y');
$month = $now->format('m');
$stickers = [];
for ($i = $fromSerial; $i <= $toSerial; $i++)
@@ -155,7 +164,16 @@ class ProductionOrderController extends Controller
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
$qrData = $itemCode . '|' . $serial;
// $qrData = $itemCode . '|' . $serial;
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
$serialCount = substr(str_pad($i, 6, '0', STR_PAD_LEFT), -6);
$serialWithWarehouse = substr($serial, 0, 4) . $wareNo . substr($serial, 4);
$qrData = $itemCode . '|' . $serialWithWarehouse;
// $panel = $plantCode . $wareNo . '/' . $itemCode . '/' . $year.$month . '/' . $serialCount;
// $qrBase64 = base64_encode(
// QrCode::format('png')->size(100)->generate($qrData)
@@ -168,7 +186,7 @@ class ProductionOrderController extends Controller
$qrBase64 = base64_encode($qrBinary);
$stickers[] = [
'serial' => $serial,
'serial' => $serialWithWarehouse,
'qr' => 'data:image/png;base64,' . $qrBase64,
'production_order' => $itemCode,
'description' => $itemDes ?? ''

View File

@@ -61,7 +61,7 @@ Route::get('production-orders/{production_order}/{plant_code}/printpanel',
[ProductionOrderController::class, 'printpanel']
)->name('production-orders.printpanel');
Route::get('production-orders/{production_order}/printItemSerial',
Route::get('production-orders/{production_order}/{plant_code}/printItemSerial',
[ProductionOrderController::class, 'printItemSerial']
)->name('production-orders.printItemSerial');