Fix dualpath propagation, getShopfloorPCs filtering, USB management, and printer features

- Fix dualpath PC propagation direction (Equipment->PC) in api.asp and db_helpers.asp
- Fix early exit in CreatePCMachineRelationship preventing propagation
- Fix getShopfloorPCs to filter machinetypeid IN (33,34,35) instead of >= 33
- Fix getShopfloorPCs to show equipment numbers via GROUP_CONCAT subquery
- Add detailed PropagateDP logging for dualpath debugging
- Default "Show on Shopfloor Dashboard" checkbox to checked in addnotification.asp
- Add USB label batch printing, single USB labels, and USB history pages
- Add printer supplies tracking and toner report enhancements
- Add uptime map visualization page
- Add dashboard/lobby display SQL migration
- Update CLAUDE.md with IIS 401 workaround documentation
- Update TODO.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-02-03 10:44:55 -05:00
parent 8945fe2a0a
commit e382a3246e
27 changed files with 1926 additions and 255 deletions

View File

@@ -3,6 +3,8 @@
<head>
<!--#include file="./includes/header.asp"-->
<!--#include file="./includes/sql.asp"-->
<!-- JsBarcode for barcode generation -->
<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"></script>
</head>
<%
@@ -60,15 +62,22 @@ End If
<form id="scanForm" method="post" action="./saveusbdirect.asp">
<div class="form-group">
<label for="serialnumber">Serial Number</label>
<input
type="text"
class="form-control form-control-lg"
id="serialnumber"
name="serialnumber"
placeholder="Scan barcode or type serial number..."
autocomplete="off"
autofocus
style="font-size: 24px; text-align: center; padding: 20px; font-family: monospace; letter-spacing: 2px;">
<div class="input-group">
<input
type="text"
class="form-control form-control-lg"
id="serialnumber"
name="serialnumber"
placeholder="Scan barcode or type serial number..."
autocomplete="off"
autofocus
style="font-size: 24px; text-align: center; padding: 20px; font-family: monospace; letter-spacing: 2px;">
<div class="input-group-append">
<button type="button" class="btn btn-info btn-lg" id="generateBtn" title="Generate random 8-digit serial">
<i class="zmdi zmdi-refresh"></i> Generate
</button>
</div>
</div>
</div>
<div class="form-group">
@@ -106,6 +115,25 @@ Set rsBU = Nothing
</button>
</div>
</form>
<!-- Barcode Preview Section -->
<div id="barcodeSection" style="display:none; margin-top:30px; border-top:1px solid #444; padding-top:20px;">
<h6><i class="zmdi zmdi-label"></i> Barcode Label Preview</h6>
<p class="text-muted small">Print this on a Uline sticker label. Click the barcode to print.</p>
<div id="barcodePreview" style="background:#fff; padding:10px; display:inline-block; border-radius:4px; cursor:pointer;" onclick="printBarcode()" title="Click to print">
<svg id="barcodeSvg"></svg>
</div>
<div style="margin-top:10px;">
<button type="button" class="btn btn-sm btn-outline-light" onclick="printBarcode()">
<i class="zmdi zmdi-print"></i> Quick Print
</button>
<a id="labelPageLink" href="#" target="_blank" class="btn btn-sm btn-outline-info" style="display:none;">
<i class="zmdi zmdi-label"></i> Print Label Page
</a>
</div>
</div>
</div>
<div id="successArea" style="display:none;">
@@ -191,6 +219,23 @@ $(document).ready(function() {
$('#serialnumber').val('').focus();
}
// Generate random 8-digit serial number
$('#generateBtn').on('click', function() {
var serial = generateSerial();
$('#serialnumber').val(serial);
updateBarcode(serial);
});
// Update barcode when serial number changes
$('#serialnumber').on('input', function() {
var serial = $(this).val().trim();
if (serial.length >= 3) {
updateBarcode(serial);
} else {
$('#barcodeSection').hide();
}
});
// Validate form before submission
$('#scanForm').on('submit', function(e) {
var serial = $('#serialnumber').val().trim();
@@ -202,6 +247,76 @@ $(document).ready(function() {
}
});
});
// Generate random 8-digit serial number
function generateSerial() {
var min = 10000000; // 8 digits minimum
var max = 99999999; // 8 digits maximum
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Update barcode preview
function updateBarcode(serial) {
if (serial && serial.length >= 3) {
try {
JsBarcode("#barcodeSvg", serial, {
format: "CODE128",
width: 1.5,
height: 30,
displayValue: true,
fontSize: 12,
margin: 5,
textMargin: 2
});
$('#barcodeSection').show();
$('#labelPageLink').attr('href', './usbsingle.asp?serial=' + encodeURIComponent(serial)).show();
} catch (e) {
console.error('Barcode error:', e);
$('#barcodeSection').hide();
$('#labelPageLink').hide();
}
} else {
$('#barcodeSection').hide();
$('#labelPageLink').hide();
}
}
// Print barcode label
function printBarcode() {
var serial = $('#serialnumber').val().trim();
if (!serial) {
alert('Please enter a serial number first');
return;
}
// Create print window with just the barcode
var printWindow = window.open('', '_blank', 'width=300,height=200');
printWindow.document.write('<html><head><title>USB Label - ' + serial + '</title>');
printWindow.document.write('<style>');
printWindow.document.write('body { margin: 0; padding: 5px; font-family: Arial, sans-serif; }');
printWindow.document.write('.label { text-align: center; }');
printWindow.document.write('@media print { @page { size: 1in 0.5in; margin: 0; } }');
printWindow.document.write('</style>');
printWindow.document.write('<scr' + 'ipt src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"></scr' + 'ipt>');
printWindow.document.write('</head><body>');
printWindow.document.write('<div class="label">');
printWindow.document.write('<svg id="printBarcode"></svg>');
printWindow.document.write('</div>');
printWindow.document.write('<scr' + 'ipt>');
printWindow.document.write('JsBarcode("#printBarcode", "' + serial + '", {');
printWindow.document.write(' format: "CODE128",');
printWindow.document.write(' width: 1.2,');
printWindow.document.write(' height: 25,');
printWindow.document.write(' displayValue: true,');
printWindow.document.write(' fontSize: 10,');
printWindow.document.write(' margin: 2,');
printWindow.document.write(' textMargin: 1');
printWindow.document.write('});');
printWindow.document.write('setTimeout(function() { window.print(); window.close(); }, 300);');
printWindow.document.write('</scr' + 'ipt>');
printWindow.document.write('</body></html>');
printWindow.document.close();
}
</script>
</body>