feat(clgl)条码打印修改

This commit is contained in:
2026-06-24 09:59:56 +08:00
parent 75d7c48ff2
commit efa5c91aa1
15 changed files with 410 additions and 12 deletions
+2 -2
View File
@@ -1,4 +1,5 @@
using BLL;
using FastReport;
using Model;
using System;
using System.Collections.Generic;
@@ -433,8 +434,7 @@ namespace FineUIPro.Web.CLGL
{
BindDetailGrid(Grid1.SelectedRowID);
}
private void Print(string Id)
private void Print(string Id)
{
BLL.FastReportService.ResetData();
if (string.IsNullOrEmpty(Id))
+48
View File
@@ -254,6 +254,54 @@
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
function printByHiddenFrame(url) {
var frameId = 'fastreport-print-frame-' + new Date().getTime();
var frame = document.createElement('iframe');
frame.id = frameId;
frame.name = frameId;
frame.style.position = 'fixed';
frame.style.left = '-10000px';
frame.style.top = '-10000px';
frame.style.width = '1px';
frame.style.height = '1px';
frame.style.border = '0';
frame.style.opacity = '0';
frame.onload = function () {
setTimeout(function () {
try {
frame.contentWindow.onafterprint = cleanupPrintFrame;
frame.contentWindow.focus();
frame.contentWindow.print();
} catch (e) {
window.print();
}
}, 500);
};
frame.src = url;
document.body.appendChild(frame);
var cleaned = false;
function cleanupPrintFrame() {
if (cleaned) {
return;
}
cleaned = true;
if (frame && frame.parentNode) {
frame.parentNode.removeChild(frame);
}
window.removeEventListener('afterprint', cleanupPrintFrame);
}
window.addEventListener('afterprint', cleanupPrintFrame);
setTimeout(cleanupPrintFrame, 300000);
}
window.addEventListener('message', function (event) {
if (!event.data || event.data.type !== 'fastreport-print-finished') {
return;
}
var frame = document.getElementById(event.data.frameId);
if (frame && frame.parentNode) {
frame.parentNode.removeChild(frame);
}
});
</script>
</body>
</html>
+4 -2
View File
@@ -368,7 +368,7 @@ namespace FineUIPro.Web.CLGL
{
ShowNotify("请选择要打印的项", MessageBoxIcon.Warning);
return;
}
}
BLL.FastReportService.ResetData();
var query = new Tw_InputDetailBarCodeOutput
@@ -394,7 +394,9 @@ namespace FineUIPro.Web.CLGL
string initTemplatePath = "File\\Fastreport\\材料入库条码.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
//PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
string printUrl = ResolveUrl(BLL.FastReportService.ExportReport(rootPath + initTemplatePath));
PageContext.RegisterStartupScript(String.Format("printByHiddenFrame('{0}');", printUrl));
}
}