Added ware house number logic for item code print logic #623
@@ -80,7 +80,8 @@ class ProductionOrderController extends Controller
|
|||||||
|
|
||||||
$wareHouseNo = Plant::where('code', $plantCode)->first();
|
$wareHouseNo = Plant::where('code', $plantCode)->first();
|
||||||
|
|
||||||
$wareNo = $wareHouseNo->warehouse_number;
|
$wareNo = $wareHouseNo->warehouse_number ?? null;
|
||||||
|
|
||||||
|
|
||||||
\Log::info('Plant Data', [
|
\Log::info('Plant Data', [
|
||||||
'plant' => $wareHouseNo ? $wareHouseNo->toArray() : null,
|
'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();
|
$order = ProductionOrder::where('production_order', $production_order)->first();
|
||||||
|
|
||||||
@@ -148,6 +149,14 @@ class ProductionOrderController extends Controller
|
|||||||
$itemCode = $order->item->code ?? '';
|
$itemCode = $order->item->code ?? '';
|
||||||
$itemDes = $order->item->description ?? '';
|
$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 = [];
|
$stickers = [];
|
||||||
|
|
||||||
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
||||||
@@ -155,7 +164,16 @@ class ProductionOrderController extends Controller
|
|||||||
|
|
||||||
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
$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(
|
// $qrBase64 = base64_encode(
|
||||||
// QrCode::format('png')->size(100)->generate($qrData)
|
// QrCode::format('png')->size(100)->generate($qrData)
|
||||||
@@ -168,7 +186,7 @@ class ProductionOrderController extends Controller
|
|||||||
$qrBase64 = base64_encode($qrBinary);
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
$stickers[] = [
|
$stickers[] = [
|
||||||
'serial' => $serial,
|
'serial' => $serialWithWarehouse,
|
||||||
'qr' => 'data:image/png;base64,' . $qrBase64,
|
'qr' => 'data:image/png;base64,' . $qrBase64,
|
||||||
'production_order' => $itemCode,
|
'production_order' => $itemCode,
|
||||||
'description' => $itemDes ?? ''
|
'description' => $itemDes ?? ''
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ Route::get('production-orders/{production_order}/{plant_code}/printpanel',
|
|||||||
[ProductionOrderController::class, 'printpanel']
|
[ProductionOrderController::class, 'printpanel']
|
||||||
)->name('production-orders.printpanel');
|
)->name('production-orders.printpanel');
|
||||||
|
|
||||||
Route::get('production-orders/{production_order}/printItemSerial',
|
Route::get('production-orders/{production_order}/{plant_code}/printItemSerial',
|
||||||
[ProductionOrderController::class, 'printItemSerial']
|
[ProductionOrderController::class, 'printItemSerial']
|
||||||
)->name('production-orders.printItemSerial');
|
)->name('production-orders.printItemSerial');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user