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:
195
usbsingle.asp
Normal file
195
usbsingle.asp
Normal file
@@ -0,0 +1,195 @@
|
||||
<%@ Language=VBScript %>
|
||||
<%
|
||||
Option Explicit
|
||||
Dim objConn, rs
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<title>Print USB Barcode Label</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.5/dist/JsBarcode.all.min.js"></script>
|
||||
<style>
|
||||
/* ULINE S-20135: 8.5x11 sheet, 3x3 labels, 2 cols x 3 rows */
|
||||
/* Each 3x3 label holds 3x4 grid of 1x0.75 mini-labels (12 per cell) */
|
||||
@page { size: letter; margin: 0; }
|
||||
body { font-family: Arial, sans-serif; background: #f0f0f0; margin: 0; padding: 20px; }
|
||||
|
||||
.no-print { margin-bottom: 20px; text-align: center; }
|
||||
.print-btn { padding: 10px 30px; font-size: 16px; cursor: pointer; background: #667eea; color: white; border: none; border-radius: 5px; margin: 5px; }
|
||||
.back-btn { padding: 10px 30px; font-size: 16px; cursor: pointer; background: #6c757d; color: white; border: none; border-radius: 5px; margin: 5px; text-decoration: none; }
|
||||
.position-select { padding: 8px; font-size: 14px; margin-left: 10px; }
|
||||
.copies-input { padding: 6px; font-size: 14px; width: 60px; text-align: center; }
|
||||
|
||||
.print-sheet { width: 8.5in; height: 11in; background: white; margin: 0 auto; position: relative; border: 1px solid #ccc; }
|
||||
|
||||
.label-cell {
|
||||
width: 3in;
|
||||
height: 3in;
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
border: 1px dashed #ccc;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.label-cell.active { border: 2px solid #667eea; }
|
||||
.label-cell.inactive { border: 1px dashed #ccc; }
|
||||
|
||||
/* Label cell positions */
|
||||
.cell-1 { top: 0.875in; left: 1.1875in; }
|
||||
.cell-2 { top: 0.875in; left: 4.3125in; }
|
||||
.cell-3 { top: 4in; left: 1.1875in; }
|
||||
.cell-4 { top: 4in; left: 4.3125in; }
|
||||
.cell-5 { top: 7.125in; left: 1.1875in; }
|
||||
.cell-6 { top: 7.125in; left: 4.3125in; }
|
||||
|
||||
.mini-grid { display: grid; grid-template-columns: repeat(3, 1in); grid-template-rows: repeat(4, 0.75in); width: 3in; height: 3in; }
|
||||
|
||||
.mini-label { width: 1in; height: 0.75in; display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; padding: 0.02in; border: 1px dotted #ddd; overflow: hidden; }
|
||||
.mini-label.filled { border: 1px solid #999; }
|
||||
.mini-label.empty { background: #f8f8f8; border: 1px dotted #eee; }
|
||||
|
||||
.barcode-container { text-align: center; line-height: 0; }
|
||||
.barcode-container svg { max-width: 0.9in; height: 24px; }
|
||||
.serial-text { font-size: 6pt; font-weight: bold; font-family: monospace; text-align: center; margin-top: 1px; letter-spacing: 0.3px; }
|
||||
|
||||
@media print {
|
||||
body { padding: 0; margin: 0; background: white; }
|
||||
.no-print { display: none; }
|
||||
.print-sheet { border: none; margin: 0; width: 8.5in; height: 11in; overflow: hidden; }
|
||||
.label-cell { border: none !important; }
|
||||
.label-cell.inactive { visibility: hidden; }
|
||||
.mini-label { border: 1px dotted #ccc !important; }
|
||||
.mini-label.empty { visibility: hidden; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<%
|
||||
Dim serialNumber, usbAlias, machineid, strSQL
|
||||
|
||||
serialNumber = Request.QueryString("serial")
|
||||
machineid = Request.QueryString("machineid")
|
||||
|
||||
If machineid <> "" And IsNumeric(machineid) Then
|
||||
strSQL = "SELECT serialnumber, alias FROM machines WHERE machineid = " & CLng(machineid) & " AND machinetypeid = 44"
|
||||
Set rs = objConn.Execute(strSQL)
|
||||
If Not rs.EOF Then
|
||||
serialNumber = rs("serialnumber") & ""
|
||||
usbAlias = rs("alias") & ""
|
||||
End If
|
||||
rs.Close
|
||||
Set rs = Nothing
|
||||
End If
|
||||
|
||||
objConn.Close
|
||||
|
||||
serialNumber = Trim(serialNumber)
|
||||
If serialNumber = "" Then serialNumber = "00000000"
|
||||
%>
|
||||
<div class="no-print">
|
||||
<h2>USB Barcode Label</h2>
|
||||
<p>Serial: <strong><code><%=Server.HTMLEncode(serialNumber)%></code></strong>
|
||||
<% If usbAlias <> "" Then %> (<%=Server.HTMLEncode(usbAlias)%>)<% End If %>
|
||||
</p>
|
||||
|
||||
<button class="print-btn" onclick="window.print()">Print Label</button>
|
||||
<a href="./displayusb.asp" class="back-btn">Back to USB Devices</a>
|
||||
|
||||
<div style="margin-top: 15px;">
|
||||
<label>Position:
|
||||
<select class="position-select" id="posSelect" onchange="updateLayout()">
|
||||
<option value="1">1 - Top Left</option>
|
||||
<option value="2">2 - Top Right</option>
|
||||
<option value="3">3 - Middle Left</option>
|
||||
<option value="4">4 - Middle Right</option>
|
||||
<option value="5">5 - Bottom Left</option>
|
||||
<option value="6">6 - Bottom Right</option>
|
||||
</select>
|
||||
</label>
|
||||
<label style="margin-left: 20px;">Copies (1-12):
|
||||
<input type="number" class="copies-input" id="copiesInput" value="12" min="1" max="12" onchange="updateLayout()">
|
||||
</label>
|
||||
</div>
|
||||
<p style="color: #666; font-size: 12px; margin-top: 10px;">Prints on ULINE S-20135 label sheet (3"x3" cells). Each cell holds up to 12 mini-labels (1"x0.75").</p>
|
||||
</div>
|
||||
|
||||
<div class="print-sheet">
|
||||
<div class="label-cell cell-1 active" id="cell-1"></div>
|
||||
<div class="label-cell cell-2 inactive" id="cell-2"></div>
|
||||
<div class="label-cell cell-3 inactive" id="cell-3"></div>
|
||||
<div class="label-cell cell-4 inactive" id="cell-4"></div>
|
||||
<div class="label-cell cell-5 inactive" id="cell-5"></div>
|
||||
<div class="label-cell cell-6 inactive" id="cell-6"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var serialNumber = "<%=Server.HTMLEncode(serialNumber)%>";
|
||||
|
||||
function updateLayout() {
|
||||
var pos = parseInt(document.getElementById('posSelect').value) || 1;
|
||||
var copies = parseInt(document.getElementById('copiesInput').value) || 12;
|
||||
if (copies < 1) copies = 1;
|
||||
if (copies > 12) copies = 12;
|
||||
document.getElementById('copiesInput').value = copies;
|
||||
|
||||
for (var i = 1; i <= 6; i++) {
|
||||
var cell = document.getElementById('cell-' + i);
|
||||
if (i === pos) {
|
||||
cell.className = 'label-cell cell-' + i + ' active';
|
||||
cell.innerHTML = buildMiniGrid(copies);
|
||||
} else {
|
||||
cell.className = 'label-cell cell-' + i + ' inactive';
|
||||
cell.innerHTML = '';
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
for (var j = 0; j < copies; j++) {
|
||||
var barcodeId = 'bc-' + j;
|
||||
var el = document.getElementById(barcodeId);
|
||||
if (el) {
|
||||
try {
|
||||
JsBarcode('#' + barcodeId, serialNumber, {
|
||||
format: "CODE128",
|
||||
width: 1,
|
||||
height: 22,
|
||||
displayValue: false,
|
||||
margin: 0,
|
||||
background: "transparent"
|
||||
});
|
||||
} catch(e) {
|
||||
console.error('Barcode error:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 50);
|
||||
}
|
||||
|
||||
function buildMiniGrid(copies) {
|
||||
var html = '<div class="mini-grid">';
|
||||
for (var i = 0; i < 12; i++) {
|
||||
if (i < copies) {
|
||||
html += '<div class="mini-label filled">' +
|
||||
'<div class="barcode-container"><svg id="bc-' + i + '"></svg></div>' +
|
||||
'<div class="serial-text">' + escapeHtml(serialNumber) + '</div>' +
|
||||
'</div>';
|
||||
} else {
|
||||
html += '<div class="mini-label empty"></div>';
|
||||
}
|
||||
}
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function escapeHtml(text) {
|
||||
if (!text) return '';
|
||||
var div = document.createElement('div');
|
||||
div.textContent = text;
|
||||
return div.innerHTML;
|
||||
}
|
||||
|
||||
updateLayout();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user