192824ea90
- 安全巡检表新增编码字段(Code,全局唯一 XJ-序号),WebAPI/桌面端新增时自动生成,不可重复 - 修复危大超危工程公示牌二维码不显示:urlName 含非法字符?导致 image.Save 抛异常,改用主键+内容哈希安全文件名 - 安全问题统计(mainProject/main3)排除作废数据(States=4),图表口径与顶部计数一致 - Word 导出文件名改为 监督巡视部位+编号 - Model.cs 由 SqlMetal 重新生成,补齐巡检人ID/签收人ID/发现问题/处理要求等字段;新增 HSSE_SafetyPatrol.Code.cs 补充 Code 列 - 新增安全巡检完整建表脚本(SGGLDB_V2026-08-25-001);删除已过时的接口文档 SafetyPatrol_API.md
83 lines
2.6 KiB
C#
83 lines
2.6 KiB
C#
using BLL;
|
|
using System;
|
|
using System.IO;
|
|
using System.Text;
|
|
using System.Web.UI;
|
|
using ThoughtWorks.QRCode.Codec;
|
|
|
|
namespace FineUIPro.Web.Controls
|
|
{
|
|
public partial class ShowQRImage : Page
|
|
{
|
|
#region 自定义
|
|
/// <summary>
|
|
/// 二维码路径id
|
|
/// </summary>
|
|
public string FileUrl
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["FileUrl"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["FileUrl"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.txtName.InnerText = System.Web.HttpUtility.UrlDecode(Request.Params["title"]);
|
|
this.FileUrl = "FileUpload\\ShowQRImage\\";
|
|
string urlName = Request.Params["urlName"];
|
|
string filePath = this.FileUrl + urlName + ".jpg";
|
|
if (!File.Exists(Funs.RootPath + filePath))
|
|
{
|
|
this.CreateCode_Simple(Request.Params["strValue"], urlName);
|
|
}
|
|
|
|
this.divBeImageUrl.InnerHtml = UploadAttachmentService.ShowImage("../", filePath, 280, 280);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成二维码方法
|
|
/// </summary>
|
|
/// <param name="nr"></param>
|
|
/// <param name="urlName"></param>
|
|
private void CreateCode_Simple(string nr, string urlName)
|
|
{
|
|
string imageUrl = string.Empty;
|
|
////QRCodeScale 为每个二维码模块的像素倍数,固定值 5(原为 nr.Length,会随内容长度放大成超大图)
|
|
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder
|
|
{
|
|
QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE,
|
|
QRCodeScale = 5,
|
|
QRCodeVersion = 0,
|
|
QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
|
|
};
|
|
System.Drawing.Image image = qrCodeEncoder.Encode(nr, Encoding.UTF8);
|
|
|
|
string filepath = Funs.RootPath + this.FileUrl;
|
|
////如果文件夹不存在,则创建
|
|
if (!Directory.Exists(filepath))
|
|
{
|
|
Directory.CreateDirectory(filepath);
|
|
}
|
|
|
|
string filename = urlName + ".jpg";
|
|
imageUrl = filepath + filename;
|
|
|
|
FileStream fs = new FileStream(imageUrl, FileMode.OpenOrCreate, FileAccess.Write);
|
|
image.Save(fs, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
|
|
fs.Close();
|
|
image.Dispose();
|
|
|
|
}
|
|
}
|
|
}
|