1
This commit is contained in:
@@ -279,6 +279,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
||||
|
||||
private void BindGrid(List<Model.View_HJGL_WeldingTask> 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<Model.View_HJGL_WeldingTask> weldingTask)
|
||||
{
|
||||
decimal totalSize = 0;
|
||||
if (weldingTask != null && weldingTask.Count > 0)
|
||||
{
|
||||
totalSize = weldingTask.Sum(x => x.Size ?? 0);
|
||||
}
|
||||
lblTotalSize.Text = "总达因数:" + totalSize.ToString("0.##");
|
||||
}
|
||||
|
||||
private List<Model.View_HJGL_WeldingTask> 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<string, string>
|
||||
{
|
||||
{ "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<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("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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user