This commit is contained in:
2026-11-21 12:33:27 +08:00
3 changed files with 13 additions and 13 deletions
@@ -6,7 +6,7 @@
<title>领料确认单</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<script src="../../res/js/dtpweb-material-label.js?v=2"></script>
<script src="../../res/js/dtpweb-material-label.js?v=4"></script>
<style type="text/css">
.customlabel
{
@@ -6,7 +6,7 @@
<head runat="server">
<title>焊材领用查询</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<script src="../../res/js/dtpweb-material-label.js?v=2"></script>
<script src="../../res/js/dtpweb-material-label.js?v=4"></script>
</head>
<body>
<form id="form1" runat="server">
@@ -34,31 +34,31 @@ window.DtpWebMaterialLabel = (() => {
['时 间', fields.UsingDate]
];
// 按《材料标签.frx》将表格坐标换算为毫米,左边框内移约一个打印点。
const leftMargin = 2;
const left = leftMargin + 0.2, split = leftMargin + 11.75, right = leftMargin + 35.5;
const rowHeight = 3.64, lineWidth = 0.2;
const bottom = (rows.length + 1) * rowHeight;
// 按 50 × 40 mm 标签排版,四周为走纸留出余量。
const jobWidth = 50, jobHeight = 40;
const left = 2, top = 2, split = left + 15, right = jobWidth - left;
const rowHeight = 5, lineWidth = 0.2;
const tableTop = top + rowHeight, tableHeight = rows.length * rowHeight;
const page = [
{ type: 'rectangle', x: left, y: rowHeight, width: right - left, height: bottom - rowHeight, lineWidth },
{ type: 'line', x1: split, y1: rowHeight, x2: split, y2: bottom, lineWidth }
{ type: 'rectangle', x: left, y: tableTop, width: right - left, height: tableHeight, lineWidth },
{ type: 'line', x1: split, y1: tableTop, x2: split, y2: tableTop + tableHeight, lineWidth }
];
function drawText(text, x, y, width) {
if (!text) return;
page.push({ type: 'text', text, x: x + 0.35, y, width: width - 0.7, height: rowHeight,
fontName: '黑体', fontHeight: 2.12, autoReturn: 0, horizontalAlignment: 1, verticalAlignment: 1 });
fontName: '黑体', fontHeight: 2.75, autoReturn: 0, horizontalAlignment: 1, verticalAlignment: 1 });
}
drawText('材料标签', left, 0, right - left);
drawText('材料标签', left, top, right - left);
rows.forEach(([label, value], index) => {
const y = (index + 1) * rowHeight;
const y = tableTop + index * rowHeight;
if (index > 0) page.push({ type: 'line', x1: left, y1: y, x2: right, y2: y, lineWidth });
drawText(label, left, y, split - left);
drawText(value, split, y, right - split);
});
return { printerInfo: { printerName }, jobInfo: { jobWidth: 40, jobHeight: 30, orientation: 0, gapType: 2 }, jobPages: [page] };
return { printerInfo: { printerName }, jobInfo: { jobWidth, jobHeight, orientation: 0, gapType: 2 }, jobPages: [page] };
}
async function print(fields) {