feat: 完善材料条码与焊接业务功能
This commit is contained in:
@@ -631,6 +631,15 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||
dt.Columns.Add("CH_NDTMethod", typeof(String));
|
||||
dt.Columns.Add("CH_SlopeType", typeof(String));
|
||||
dt.Columns.Add("CH_NDTRate", typeof(String));
|
||||
dt.Columns.Add("CH_DetectionType", typeof(String));
|
||||
dt.Columns.Add("CH_WorkName", typeof(String));
|
||||
dt.Columns.Add("CH_WorkType", typeof(String));
|
||||
dt.Columns.Add("CH_Material", typeof(String));
|
||||
dt.Columns.Add("CH_MediumGrade", typeof(String));
|
||||
dt.Columns.Add("CH_DetectionTiming", typeof(String));
|
||||
dt.Columns.Add("CH_ProjectPipelineCode", typeof(String));
|
||||
dt.Columns.Add("CH_HeatTreatmentStatus", typeof(String));
|
||||
dt.Columns.Add("CH_ExecutionStandard", typeof(String));
|
||||
|
||||
|
||||
|
||||
@@ -649,20 +658,39 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||
Alert.ShowInTop("请选择要打印的委托单!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var CH_WeldMethod = (from batch in Funs.DB.View_Batch_BatchTrustItem
|
||||
join joint in Funs.DB.View_HJGL_WeldJoint on batch.WeldJointId equals joint.WeldJointId
|
||||
where batch.TrustBatchId == trust.TrustBatchId
|
||||
select joint.WeldingMethodCode).Distinct().ToList();
|
||||
var CH_SlopeType = (from batch in Funs.DB.View_Batch_BatchTrustItem
|
||||
var printDetails = (from batch in Funs.DB.View_Batch_BatchTrustItem
|
||||
join joint in Funs.DB.View_HJGL_WeldJoint on batch.WeldJointId equals joint.WeldJointId
|
||||
where batch.TrustBatchId == trust.TrustBatchId
|
||||
select joint.GrooveTypeCode).Distinct().ToList();
|
||||
orderby batch.PipelineCode, batch.WeldJointCode
|
||||
select new
|
||||
{
|
||||
batch.PipelineCode,
|
||||
batch.WeldJointCode,
|
||||
batch.WelderCode,
|
||||
joint.Specification,
|
||||
joint.MaterialCode,
|
||||
joint.Remark,
|
||||
joint.WeldingMethodCode,
|
||||
joint.GrooveTypeCode,
|
||||
batch.PipingClassCode
|
||||
}).ToList();
|
||||
var CH_WeldMethod = printDetails.Select(x => x.WeldingMethodCode).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
||||
var CH_SlopeType = printDetails.Select(x => x.GrooveTypeCode).Where(x => !string.IsNullOrEmpty(x)).Distinct().ToList();
|
||||
if (trust != null)
|
||||
{
|
||||
string varValue = string.Empty;
|
||||
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
|
||||
|
||||
dr["ProjectName"] = projectName;
|
||||
dr["CH_TrustUnit"] = BLL.UnitService.GetUnitNameByUnitId(this.CurrUser.UnitId);
|
||||
dr["CH_DetectionType"] = "委托检测";
|
||||
dr["CH_WorkName"] = "工艺管道";
|
||||
dr["CH_WorkType"] = "对接焊缝";
|
||||
dr["CH_DetectionTiming"] = "焊后";
|
||||
dr["CH_HeatTreatmentStatus"] = "/";
|
||||
dr["CH_ProjectPipelineCode"] = string.Join(",", printDetails.Select(x => x.PipelineCode).Where(x => !string.IsNullOrEmpty(x)).Distinct());
|
||||
dr["CH_Material"] = string.Join("/", printDetails.Select(x => x.MaterialCode).Where(x => !string.IsNullOrEmpty(x)).Distinct());
|
||||
dr["CH_MediumGrade"] = string.Join(",", printDetails.Select(x => x.PipingClassCode).Where(x => !string.IsNullOrEmpty(x)).Distinct());
|
||||
if (!string.IsNullOrEmpty(trust.NDEUnit))
|
||||
{
|
||||
dr["CH_CheckUnit"] = BLL.UnitService.GetUnitNameByUnitId(trust.NDEUnit).ToString();
|
||||
@@ -715,6 +743,54 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||
}
|
||||
dt.Rows.Add(dr);
|
||||
|
||||
DataTable detailTable = new DataTable("Detail");
|
||||
detailTable.Columns.Add("Sequence", typeof(int));
|
||||
detailTable.Columns.Add("PipelineCode", typeof(string));
|
||||
detailTable.Columns.Add("WeldJointCode", typeof(string));
|
||||
detailTable.Columns.Add("Specification", typeof(string));
|
||||
detailTable.Columns.Add("GrooveType", typeof(string));
|
||||
detailTable.Columns.Add("WeldingMethod", typeof(string));
|
||||
detailTable.Columns.Add("WelderCode", typeof(string));
|
||||
detailTable.Columns.Add("MaterialCode", typeof(string));
|
||||
detailTable.Columns.Add("Remark", typeof(string));
|
||||
|
||||
int sequence = 1;
|
||||
foreach (var item in printDetails)
|
||||
{
|
||||
DataRow detailRow = detailTable.NewRow();
|
||||
detailRow["Sequence"] = sequence++;
|
||||
detailRow["PipelineCode"] = item.PipelineCode ?? string.Empty;
|
||||
detailRow["WeldJointCode"] = item.WeldJointCode ?? string.Empty;
|
||||
detailRow["Specification"] = item.Specification ?? string.Empty;
|
||||
detailRow["GrooveType"] = item.GrooveTypeCode ?? string.Empty;
|
||||
detailRow["WeldingMethod"] = item.WeldingMethodCode ?? string.Empty;
|
||||
detailRow["WelderCode"] = item.WelderCode ?? string.Empty;
|
||||
detailRow["MaterialCode"] = item.MaterialCode ?? string.Empty;
|
||||
detailRow["Remark"] = item.Remark ?? string.Empty;
|
||||
detailTable.Rows.Add(detailRow);
|
||||
}
|
||||
|
||||
bool isAttachment6 = (ViewState["TrustPrintTemplate"] as string) == "附件6";
|
||||
DataTable mainDetails = detailTable.Clone();
|
||||
mainDetails.TableName = isAttachment6 ? "Detail6Main" : "Detail4";
|
||||
int mainRowCount = isAttachment6 ? Math.Min(13, detailTable.Rows.Count) : detailTable.Rows.Count;
|
||||
for (int i = 0; i < mainRowCount; i++)
|
||||
{
|
||||
mainDetails.ImportRow(detailTable.Rows[i]);
|
||||
}
|
||||
PadPrintDetailRows(mainDetails, 13);
|
||||
|
||||
DataTable extraDetails = detailTable.Clone();
|
||||
extraDetails.TableName = "Detail6Extra";
|
||||
if (isAttachment6)
|
||||
{
|
||||
for (int i = 13; i < detailTable.Rows.Count; i++)
|
||||
{
|
||||
extraDetails.ImportRow(detailTable.Rows[i]);
|
||||
}
|
||||
PadPrintDetailRows(extraDetails, 15);
|
||||
}
|
||||
|
||||
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
|
||||
keyValuePairs.Add("TrustBatchId", trust.TrustBatchId);
|
||||
keyValuePairs.Add("totalUnit", "赛鼎工程有限公司");
|
||||
@@ -737,13 +813,18 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||
|
||||
BLL.FastReportService.ResetData();
|
||||
BLL.FastReportService.AddFastreportTable(dt);
|
||||
BLL.FastReportService.AddFastreportTable(mainDetails);
|
||||
if (isAttachment6)
|
||||
{
|
||||
BLL.FastReportService.AddFastreportTable(extraDetails);
|
||||
}
|
||||
BLL.FastReportService.AddFastreportParameter(keyValuePairs);
|
||||
|
||||
// Session["Table"] = dt;
|
||||
// Session["CH_TrustID"] = reportId;
|
||||
string initTemplatePath = "";
|
||||
string rootPath = Server.MapPath("~/");
|
||||
initTemplatePath = (ViewState["TrustPrintTemplate"] as string) == "附件6"
|
||||
initTemplatePath = isAttachment6
|
||||
? "File\\Fastreport\\无损检测委托单_附件6.frx"
|
||||
: "File\\Fastreport\\管道焊口检测委托单_附件4.frx";
|
||||
|
||||
@@ -1011,6 +1092,21 @@ namespace FineUIPro.Web.HJGL.PointTrust
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按打印模板的固定行数补空行;附页超过一页时补齐到整页,确保页脚位置不随数据量漂移。
|
||||
/// </summary>
|
||||
private static void PadPrintDetailRows(DataTable table, int pageSize)
|
||||
{
|
||||
int targetRowCount = Math.Max(pageSize, ((table.Rows.Count + pageSize - 1) / pageSize) * pageSize);
|
||||
while (table.Rows.Count < targetRowCount)
|
||||
{
|
||||
DataRow row = table.NewRow();
|
||||
// FastReport 2017 会忽略所有字段均为 DBNull 的记录,设置隐藏序号保证空白表格行正常输出。
|
||||
row["Sequence"] = 0;
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
#region 判断是否可删除
|
||||
/// <summary>
|
||||
/// 判断是否可以删除
|
||||
|
||||
Reference in New Issue
Block a user