refactor(hjgl): 整理历史资源并完善焊接查询

归档数据库版本脚本并清理历史地图资源,补充焊口查询和焊接任务相关逻辑,降低项目资源维护成本并完善焊接业务查询。
This commit is contained in:
2026-09-22 14:22:04 +08:00
parent dc19b6d6b6
commit 2105a7c6d6
1321 changed files with 3432 additions and 47368 deletions
@@ -1,7 +1,5 @@
using BLL;
using MiniExcelLibs;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Data;
@@ -392,10 +390,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage
string htmlStr = "<table runat='server' cellpadding='5' cellspacing='5' style=\"width: 100%\">";
foreach (string item in photoUrl.ToString().Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries))
{
string imageUrl = "../../" + item.Replace('\\', '/');
string imageUrl = "../../" + item.Trim().Replace('\\', '/');
// 日报表格图片只用于本页放大预览,不包跳转链接,避免点击时打开新标签页。
htmlStr += "<tr><td style=\"width: 60%\" align=\"left\"><img class='img' width='100' height='100' src='"
+ HttpUtility.HtmlAttributeEncode(imageUrl) + "'></img></td></tr>";
+ HttpUtility.HtmlAttributeEncode(imageUrl) + "' alt='焊接日报照片' /></td></tr>";
}
htmlStr += "</table>";
return htmlStr;
@@ -730,135 +728,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
}
/// <summary>
/// 导出俄文焊接日志。
/// </summary>
protected void btnWeldingLogOut_Click(object sender, EventArgs e)
{
if (tvControlItem.SelectedNode == null
|| (tvControlItem.SelectedNode.CommandName != "UnitWork"
&& tvControlItem.SelectedNode.CommandName != "WeldingDaily"))
{
Alert.ShowInTop("请选择单位工程或焊接日报!", MessageBoxIcon.Warning);
return;
}
string unitWorkId = null;
string weldingDailyId = null;
string fileName;
if (tvControlItem.SelectedNode.CommandName == "WeldingDaily")
{
weldingDailyId = tvControlItem.SelectedNodeID;
var daily = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(weldingDailyId);
if (daily == null || daily.ProjectId != this.CurrUser.LoginProjectId)
{
Alert.ShowInTop("所选焊接日报不存在!", MessageBoxIcon.Warning);
return;
}
var unitWork = UnitWorkService.getUnitWorkByUnitWorkId(daily.UnitWorkId);
fileName = "焊接日志-" + (unitWork == null ? string.Empty : unitWork.UnitWorkName + "-")
+ daily.WeldingDailyCode + ".xlsx";
}
else
{
unitWorkId = tvControlItem.SelectedNodeID;
var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(unitWorkId);
if (unitWork == null || unitWork.ProjectId != this.CurrUser.LoginProjectId)
{
Alert.ShowInTop("所选单位工程不存在!", MessageBoxIcon.Warning);
return;
}
fileName = "焊接日志-" + unitWork.UnitWorkName + "-" + txtMonth.Text.Trim() + ".xlsx";
}
DataTable data = BLL.WeldingDailyService.GetWeldingLogExportData(
this.CurrUser.LoginProjectId, unitWorkId, weldingDailyId, txtMonth.Text.Trim());
if (data.Rows.Count == 0)
{
Alert.ShowInTop("无数据,无法导出!", MessageBoxIcon.Warning);
return;
}
byte[] fileBytes;
var workbook = new XSSFWorkbook();
using (var stream = new MemoryStream())
{
ISheet sheet = workbook.CreateSheet("Сварочный журнал");
ICellStyle headerStyle = workbook.CreateCellStyle();
headerStyle.Alignment = HorizontalAlignment.Center;
headerStyle.VerticalAlignment = VerticalAlignment.Center;
headerStyle.WrapText = true;
headerStyle.BorderTop = BorderStyle.Thin;
headerStyle.BorderRight = BorderStyle.Thin;
headerStyle.BorderBottom = BorderStyle.Thin;
headerStyle.BorderLeft = BorderStyle.Thin;
IFont headerFont = workbook.CreateFont();
headerFont.IsBold = true;
headerFont.FontHeightInPoints = 10;
headerStyle.SetFont(headerFont);
ICellStyle dataStyle = workbook.CreateCellStyle();
dataStyle.Alignment = HorizontalAlignment.Center;
dataStyle.VerticalAlignment = VerticalAlignment.Center;
dataStyle.WrapText = true;
dataStyle.BorderTop = BorderStyle.Thin;
dataStyle.BorderRight = BorderStyle.Thin;
dataStyle.BorderBottom = BorderStyle.Thin;
dataStyle.BorderLeft = BorderStyle.Thin;
IRow headerRow = sheet.CreateRow(0);
headerRow.HeightInPoints = 90;
for (int columnIndex = 0; columnIndex < data.Columns.Count; columnIndex++)
{
ICell cell = headerRow.CreateCell(columnIndex);
cell.SetCellValue(data.Columns[columnIndex].ColumnName);
cell.CellStyle = headerStyle;
}
for (int rowIndex = 0; rowIndex < data.Rows.Count; rowIndex++)
{
IRow row = sheet.CreateRow(rowIndex + 1);
row.HeightInPoints = 30;
for (int columnIndex = 0; columnIndex < data.Columns.Count; columnIndex++)
{
ICell cell = row.CreateCell(columnIndex);
object value = data.Rows[rowIndex][columnIndex];
if (columnIndex == 0 && value != DBNull.Value)
{
cell.SetCellValue(Convert.ToDouble(value));
}
else
{
cell.SetCellValue(value == DBNull.Value ? string.Empty : value.ToString());
}
cell.CellStyle = dataStyle;
}
}
int[] columnWidths = { 6, 45, 25, 35, 25, 25, 16, 45, 24, 18, 26, 24, 24, 28, 35, 45, 35 };
for (int i = 0; i < columnWidths.Length; i++)
{
sheet.SetColumnWidth(i, columnWidths[i] * 256);
}
sheet.CreateFreezePane(0, 1);
sheet.FitToPage = true;
sheet.PrintSetup.Landscape = true;
sheet.PrintSetup.FitWidth = 1;
workbook.Write(stream);
fileBytes = stream.ToArray();
}
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
response.AddHeader("Content-Disposition", "attachment;filename="
+ HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
response.AddHeader("Content-Length", fileBytes.Length.ToString());
response.BinaryWrite(fileBytes);
response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
protected void btnMenuDeleteDetail_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))