corrected logic pallet print controller
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 2m25s
Laravel Larastan / larastan (pull_request) Failing after 4m19s

This commit is contained in:
dhanabalan
2026-07-06 12:28:51 +05:30
parent abf33605f5
commit 56656264c0

View File

@@ -163,16 +163,11 @@ class PalletPrintController extends Controller
public function print(Request $request, $pallet, $plant)
{
$customerPo = $request->query('customer');
// $customerPo = $request->query('customer');
$itemId = WireMasterPacking::where('plant_id', $plant)
$customerPoMasterId = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->value('item_id');
$customerPoIds = CustomerPoMaster::where('plant_id', $plant)
->where('customer_po', $customerPo)
->where('item_id', $itemId)
->pluck('id');
->value('customer_po_master_id');
$items = WireMasterPacking::with('item')
->where('plant_id', $plant)
@@ -187,49 +182,23 @@ class PalletPrintController extends Controller
];
});
$masterBox = WireMasterPacking::where('plant_id', $plant)
->where('wire_packing_number', $pallet)
->value('customer_po_master_id');
$customer = CustomerPoMaster::find($masterBox);
$customer = CustomerPoMaster::find($customerPoMasterId);
$customerCode = $customer->customer_po ?? '';
$customerName = $customer->customer_name ?? '';
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerId)
// ->distinct('wire_packing_number')
// ->count('wire_packing_number');
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
// ->whereIn('customer_po_master_id', $customerPoIds)
// ->distinct('wire_packing_number')
// ->count('wire_packing_number');
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
->whereIn('customer_po_master_id', $customerPoIds)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
['Completed']
)
->count();
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
// ->where('customer_po_master_id', $customerId)
// ->select('wire_packing_number')
// ->groupBy('wire_packing_number')
// ->havingRaw(
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
// ['Completed']
// )
// ->orderBy('wire_packing_number')
// ->pluck('wire_packing_number')
// ->values();
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
->where('customer_po_master_id', $customerPoMasterId)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(
'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
['Completed']
)
->count();
$completedPallets = WireMasterPacking::where('plant_id', $plant)
->whereIn('customer_po_master_id', $customerPoIds)
->where('customer_po_master_id', $customerPoMasterId)
->select('wire_packing_number')
->groupBy('wire_packing_number')
->havingRaw(