From b7fb2e95bba16166ee19e875d1320269a51d6383 Mon Sep 17 00:00:00 2001 From: fei550 <1420031550@qq.com> Date: Sun, 19 Apr 2026 00:53:26 +0800 Subject: [PATCH] 1 --- SGGL/BLL/CLGL/TwArrivalStatisticsService.cs | 2 +- .../File/Fastreport/任务单焊口号_安装.frx | 87 ++++++++++++++ .../File/Fastreport/任务单焊口号_预制.frx | 93 +++++++++++++++ .../HJGL/WeldingManage/WeldMatMatch.aspx.cs | 15 ++- .../HJGL/WeldingManage/WeldTask.aspx | 7 ++ .../HJGL/WeldingManage/WeldTask.aspx.cs | 112 +++++++++++++++++- .../WeldingManage/WeldTask.aspx.designer.cs | 27 +++++ 7 files changed, 331 insertions(+), 12 deletions(-) create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_安装.frx create mode 100644 SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_预制.frx diff --git a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs index f55d890c..6d6dab07 100644 --- a/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs +++ b/SGGL/BLL/CLGL/TwArrivalStatisticsService.cs @@ -149,7 +149,7 @@ var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStoc /// /// public static decimal? GetPipeMatch(string pipelineId) - { + { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { var twPipeMatMatchOutputs = new List(); diff --git a/SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_安装.frx b/SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_安装.frx new file mode 100644 index 00000000..bfcff17b --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_安装.frx @@ -0,0 +1,87 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + private void TableData_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Table1"); + rowData.Init(); + while (rowData.HasMoreRows) + { + TableData.PrintRow(0); + TableData.PrintColumns(); + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_预制.frx b/SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_预制.frx new file mode 100644 index 00000000..93877237 --- /dev/null +++ b/SGGL/FineUIPro.Web/File/Fastreport/任务单焊口号_预制.frx @@ -0,0 +1,93 @@ + + + using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Table; +using FastReport.Utils; + +namespace FastReport +{ + public class ReportScript + { + private void TableData_ManualBuild(object sender, EventArgs e) + { + DataSourceBase rowData = Report.GetDataSource("Table1"); + rowData.Init(); + while (rowData.HasMoreRows) + { + TableData.PrintRow(0); + TableData.PrintColumns(); + rowData.Next(); + } + } + } +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs index 48c7970f..23e995f0 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldMatMatch.aspx.cs @@ -574,13 +574,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage protected void btnDeletePipelineMatchMat_Click(object sender, EventArgs e) { - if (Grid3.SelectedRowID != "") + if (Grid3.SelectedRowIDArray != null && Grid3.SelectedRowIDArray.Any()) { - dicSeclectPipeLine.Remove(Grid3.SelectedRowID); - var node = tvControlItem.FindNode(Grid3.SelectedRowID); - if (node != null) + foreach (string rowId in Grid3.SelectedRowIDArray) { - node.Checked = false; + dicSeclectPipeLine.Remove(rowId); + var node = tvControlItem.FindNode(rowId); + if (node != null) + { + node.Checked = false; + } } tw_PipeMatMatchOutputs = TwArrivalStatisticsService.GetPipeMatMatch(this.CurrUser.LoginProjectId, dicSeclectPipeLine.Keys.ToList(), drpWarehouse.SelectedValue); @@ -770,4 +773,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage this.InitTreeMenu();//加载树 } } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx index 81126cf3..a1b1b068 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx @@ -85,6 +85,7 @@ + + + + + diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs index 15d9cfe6..2e70d43c 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.cs @@ -279,6 +279,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage private void BindGrid(List weldingTask) { + UpdateTotalSizeLabel(weldingTask); if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim())) { weldingTask = weldingTask.Where(e => e.PipelineCode.Contains(this.txtPipelineCode.Text.Trim())).OrderBy(x => x.PipeLineSortIndex).ToList(); @@ -320,6 +321,97 @@ namespace FineUIPro.Web.HJGL.WeldingManage //this.btnSave.Hidden = false; } } + + private void UpdateTotalSizeLabel(List weldingTask) + { + decimal totalSize = 0; + if (weldingTask != null && weldingTask.Count > 0) + { + totalSize = weldingTask.Sum(x => x.Size ?? 0); + } + lblTotalSize.Text = "总达因数:" + totalSize.ToString("0.##"); + } + + private List GetCurrentTaskList() + { + if (string.IsNullOrEmpty(tvControlItem.SelectedNodeID) || !tvControlItem.SelectedNodeID.Contains("|")) + { + return null; + } + + DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]); + if (taskTime == null) + { + return null; + } + + return BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, + tvControlItem.SelectedNodeID.Split('|')[0], + tvControlItem.SelectedNodeID.Split('|')[1], + Convert.ToDateTime(taskTime), + this.rbIsAudit.SelectedValue, + tvControlItem.SelectedNodeID.Split('|')[3]); + } + + private void PrintTaskJoint(bool isInstall) + { + var taskList = GetCurrentTaskList(); + if (taskList == null || !taskList.Any()) + { + ShowNotify("请选择任务单", MessageBoxIcon.Question); + return; + } + + BLL.FastReportService.ResetData(); + var pipelineIds = taskList.Select(x => x.PipelineId).Distinct().ToList(); + var pipelines = Funs.DB.HJGL_Pipeline.Where(x => pipelineIds.Contains(x.PipelineId)).ToList(); + var result = taskList.OrderBy(x => x.PipeLineSortIndex).ThenBy(x => x.WeldJointCode).Select(x => + { + var pipeline = pipelines.FirstOrDefault(y => y.PipelineId == x.PipelineId); + return new + { + PipelineCode = x.PipelineCode, + SegmentCode = isInstall ? string.Empty : (pipeline?.FlowingSection ?? x.PipelineCode), + WeldJointCode = !string.IsNullOrEmpty(x.PipelineCode) ? x.WeldJointCode.Replace(x.PipelineCode + "/", "") : x.WeldJointCode, + WeldJointMaterial = x.MaterialCode, + DiaAndThickness = x.Specification + }; + }).ToList(); + + var tb = LINQToDataTable(result); + if (tb == null || tb.Rows.Count == 0) + { + ShowNotify("当前任务单无焊口数据", MessageBoxIcon.Question); + return; + } + + tb.TableName = "Table1"; + BLL.FastReportService.AddFastreportTable(tb); + var firstTask = Funs.DB.HJGL_WeldTask.FirstOrDefault(x => x.WeldTaskId == taskList[0].WeldTaskId); + BLL.FastReportService.AddFastreportParameter(new Dictionary + { + { "Code", firstTask?.TaskCode ?? string.Empty }, + { "UnitWorkName", UnitWorkService.getUnitWorkByUnitWorkId(taskList[0].UnitWorkId)?.UnitWorkName ?? string.Empty } + }); + string rootPath = Server.MapPath("~/"); + string initTemplatePath = isInstall ? "File\\Fastreport\\任务单焊口号_安装.frx" : "File\\Fastreport\\任务单焊口号_预制.frx"; + + if (File.Exists(rootPath + initTemplatePath)) + { + PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + } + } + + private string GetJointSpecText(decimal? dia, decimal? thickness) + { + string diaText = dia.HasValue ? dia.Value.ToString("0.##") : string.Empty; + string thicknessText = thickness.HasValue ? thickness.Value.ToString("0.##") : string.Empty; + if (string.IsNullOrEmpty(diaText) && string.IsNullOrEmpty(thicknessText)) + { + return string.Empty; + } + return diaText + "*" + thicknessText; + } #endregion #region 分页排序 @@ -1375,6 +1467,16 @@ namespace FineUIPro.Web.HJGL.WeldingManage } } + protected void btnPrintTaskJointPrefab_Click(object sender, EventArgs e) + { + PrintTaskJoint(false); + } + + protected void btnPrintTaskJointInstall_Click(object sender, EventArgs e) + { + PrintTaskJoint(true); + } + protected void btnPrintTask_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID)) @@ -1397,13 +1499,13 @@ namespace FineUIPro.Web.HJGL.WeldingManage where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == tvControlItem.SelectedNodeID.Split('|')[0] && x.UnitId == tvControlItem.SelectedNodeID.Split('|')[1] - && x.TaskDate.Value.Date == time.Date && x.Tabler != null + && x.TaskDate.Value.Date == time.Date && x.SerialNumber == tvControlItem.SelectedNodeID.Split('|')[3] && x.Tabler != null select x).FirstOrDefault(); var weldTask = (from x in Funs.DB.HJGL_WeldTask where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == tvControlItem.SelectedNodeID.Split('|')[0] && x.UnitId == tvControlItem.SelectedNodeID.Split('|')[1] - && x.TaskDate.Value.Date == time.Date && x.AuditMan != null && + && x.TaskDate.Value.Date == time.Date && x.SerialNumber == tvControlItem.SelectedNodeID.Split('|')[3] && x.AuditMan != null && x.Tabler != null select x).FirstOrDefault(); Model.Tw_PrintMaster printMaster = new Model.Tw_PrintMaster @@ -1420,10 +1522,10 @@ namespace FineUIPro.Web.HJGL.WeldingManage } Dictionary keyValuePairs = new Dictionary(); - keyValuePairs.Add("Code", UnitWorkService.getUnitWorkByUnitWorkId(tvControlItem.SelectedNodeID.Split('|')[0]).UnitWorkCode + string.Format("{0:yyyyMMdd}", taskTime.Value)); + keyValuePairs.Add("Code", weldTask?.TaskCode ?? weldTask_CreateName?.TaskCode ?? string.Empty); keyValuePairs.Add("TaskDate", string.Format("{0:yyyy-MM-dd}", taskTime.Value)); keyValuePairs.Add("UnitName", UnitService.GetUnitNameByUnitId(tvControlItem.SelectedNodeID.Split('|')[1])); - keyValuePairs.Add("UnitWorkName]", UnitWorkService.getUnitWorkByUnitWorkId(tvControlItem.SelectedNodeID.Split('|')[0]).UnitWorkName); + keyValuePairs.Add("UnitWorkName", UnitWorkService.getUnitWorkByUnitWorkId(tvControlItem.SelectedNodeID.Split('|')[0]).UnitWorkName); // 创建一个新的DataTable DataTable dataTable = new DataTable(); dataTable.TableName = "Data"; @@ -1543,4 +1645,4 @@ namespace FineUIPro.Web.HJGL.WeldingManage } } } -} \ No newline at end of file +} diff --git a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs index 361145b9..acaed21f 100644 --- a/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldTask.aspx.designer.cs @@ -212,6 +212,15 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Button btnSearch; + /// + /// lblTotalSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label lblTotalSize; + /// /// btnPassMaster 控件。 /// @@ -302,6 +311,24 @@ namespace FineUIPro.Web.HJGL.WeldingManage /// protected global::FineUIPro.Button btnPrintJoint; + /// + /// btnPrintTaskJointPrefab 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnPrintTaskJointPrefab; + + /// + /// btnPrintTaskJointInstall 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnPrintTaskJointInstall; + /// /// drpJointAttribute 控件。 ///