增加焊接任务单打印
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BLL;
|
||||
using FineUIPro.Web.HJGL.HotProcessHard;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -1332,5 +1333,84 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
ShowNotify("请选择焊口", MessageBoxIcon.Question);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnPrintTask_Click(object sender, EventArgs e)
|
||||
{
|
||||
DateTime? taskTime = Funs.GetNewDateTime(tvControlItem.SelectedNodeID.Split('|')[2]);
|
||||
if (taskTime != null)
|
||||
{
|
||||
var weldTaskList = BLL.WeldTaskService.GetWeldingTaskList(this.CurrUser.LoginProjectId, tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNodeID.Split('|')[1], Convert.ToDateTime(taskTime), this.rbIsAudit.SelectedValue);
|
||||
var pipelines = weldTaskList.Select(x => x.PipelineId).Distinct().ToList();
|
||||
|
||||
if (pipelines.Any())
|
||||
{
|
||||
BLL.FastReportService.ResetData();
|
||||
|
||||
//var result = HJGL_PipelineComponentService.GetPrintModelByPipelineComponentIds(null, pipelines.ToArray(), true);
|
||||
//var PipelineComponentIds = result.Select(x => x.PipelineComponentId).ToArray();
|
||||
//var tb = LINQToDataTable(result);
|
||||
//if (tb != null && tb.Rows.Count > 0)
|
||||
//{
|
||||
// tb.TableName = "Table1";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ShowNotify("该管线已打印完成", MessageBoxIcon.Question);
|
||||
// return;
|
||||
//}
|
||||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
keyValuePairs.Add("Code", UnitWorkService.getUnitWorkByUnitWorkId(tvControlItem.SelectedNodeID.Split('|')[0]).UnitWorkCode+ string.Format("{0:yyyyMMdd}", taskTime.Value));
|
||||
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);
|
||||
// 创建一个新的DataTable
|
||||
DataTable dataTable = new DataTable();
|
||||
dataTable.TableName = "Data";
|
||||
// 添加列
|
||||
dataTable.Columns.Add("PipelineCode", typeof(string));
|
||||
dataTable.Columns.Add("FlowingSection", typeof(string));
|
||||
dataTable.Columns.Add("MaterialCode", typeof(string));
|
||||
dataTable.Columns.Add("MaterialSpec", typeof(string));
|
||||
dataTable.Columns.Add("MatchRate", typeof(string));
|
||||
|
||||
foreach (string pipeline in pipelines)
|
||||
{
|
||||
DataRow dr = dataTable.NewRow();
|
||||
var pipelineModel = PipelineService.GetPipelineByPipelineId(pipeline);
|
||||
List<string > list=new List<string> { pipeline };
|
||||
|
||||
dr["PipelineCode"] = pipelineModel.PipelineCode;
|
||||
dr["FlowingSection"] = pipelineModel.FlowingSection;
|
||||
dr["MaterialCode"] = Base_MaterialService.GetMaterialByMaterialId(pipelineModel.MaterialId).MaterialCode ;
|
||||
dr["MaterialSpec"] = string.Join(",", weldTaskList.Select(x => x.Specification).Distinct().ToList()) ;
|
||||
dr["MatchRate"] = Math.Round((decimal)TwArrivalStatisticsService.GetPipeMatch(pipeline) * 100, 2).ToString() + "%" ;
|
||||
dataTable.Rows.Add(dr);
|
||||
}
|
||||
BLL.FastReportService.AddFastreportTable(dataTable);
|
||||
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
string initTemplatePath = "";
|
||||
string rootPath = Server.MapPath("~/");
|
||||
initTemplatePath = "File\\Fastreport\\管道焊接任务单.frx";
|
||||
|
||||
if (File.Exists(rootPath + initTemplatePath))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("~/Controls/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("无关联管线", MessageBoxIcon.Question);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("请选择任务单", MessageBoxIcon.Question);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user