feat(hjgl): 完善焊接日报审核与页面展示
统一 PC 端与接口的待审核查询、状态筛选和分页逻辑,补充日报查询参数及焊接信息展示,并调整试压包和焊口列表页面。
This commit is contained in:
@@ -338,29 +338,27 @@ namespace BLL
|
||||
return new List<Model.WeldingDailyTempDetailItem>();
|
||||
}
|
||||
|
||||
var query = QueryPendingWeldingDailyTempDetails().AsQueryable();
|
||||
query = query.Where(x => x.ProjectId == projectId);
|
||||
if (!string.IsNullOrEmpty(unitWorkId))
|
||||
int totalCount;
|
||||
return GetWeldingDailyTempDetailList(new Model.WeldingDailyTempDetailInput
|
||||
{
|
||||
query = query.Where(x => x.UnitWorkId == unitWorkId);
|
||||
}
|
||||
if (weldingDate.HasValue)
|
||||
{
|
||||
DateTime startDate = weldingDate.Value.Date;
|
||||
DateTime endDate = startDate.AddDays(1);
|
||||
query = query.Where(x => x.WeldingDate >= startDate && x.WeldingDate < endDate);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pipelineCode))
|
||||
{
|
||||
query = query.Where(x => x.PipelineCode != null && x.PipelineCode.Contains(pipelineCode));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(welderCode))
|
||||
{
|
||||
query = query.Where(x => (x.CoverWelderCode != null && x.CoverWelderCode.Contains(welderCode))
|
||||
|| (x.BackingWelderCode != null && x.BackingWelderCode.Contains(welderCode)));
|
||||
}
|
||||
ProjectId = projectId,
|
||||
UnitWorkId = unitWorkId,
|
||||
WeldingDate = weldingDate,
|
||||
PipelineCode = pipelineCode,
|
||||
WelderCode = welderCode
|
||||
}, out totalCount);
|
||||
}
|
||||
|
||||
return query.OrderBy(x => x.PipelineCode).ThenBy(x => x.WeldJointCode).ToList();
|
||||
/// <summary>
|
||||
/// 按查询参数获取焊接日报待审核明细列表。
|
||||
/// </summary>
|
||||
/// <param name="input">查询及分页条件</param>
|
||||
/// <param name="totalCount">分页前总记录数</param>
|
||||
/// <returns>待审核明细列表</returns>
|
||||
public static List<Model.WeldingDailyTempDetailItem> GetWeldingDailyTempDetailList(
|
||||
Model.WeldingDailyTempDetailInput input, out int totalCount)
|
||||
{
|
||||
return QueryPendingWeldingDailyTempDetails(input, out totalCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -375,20 +373,59 @@ namespace BLL
|
||||
return null;
|
||||
}
|
||||
|
||||
return QueryPendingWeldingDailyTempDetails().FirstOrDefault(x => x.TempDetailId == tempDetailId);
|
||||
int totalCount;
|
||||
return QueryPendingWeldingDailyTempDetails(new Model.WeldingDailyTempDetailInput
|
||||
{
|
||||
TempDetailId = tempDetailId,
|
||||
PageIndex = 0,
|
||||
PageSize = 1
|
||||
}, out totalCount).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造待审核查询。PC端列表和接口列表、明细均从这里读取,确保字段映射和待审核状态一致。
|
||||
/// </summary>
|
||||
private static List<Model.WeldingDailyTempDetailItem> QueryPendingWeldingDailyTempDetails()
|
||||
/// <param name="input">查询及分页条件</param>
|
||||
/// <param name="totalCount">分页前总记录数</param>
|
||||
private static List<Model.WeldingDailyTempDetailItem> QueryPendingWeldingDailyTempDetails(
|
||||
Model.WeldingDailyTempDetailInput input, out int totalCount)
|
||||
{
|
||||
input = input ?? new Model.WeldingDailyTempDetailInput();
|
||||
if (input.ProjectId != null && string.IsNullOrWhiteSpace(input.ProjectId))
|
||||
{
|
||||
totalCount = 0;
|
||||
return new List<Model.WeldingDailyTempDetailItem>();
|
||||
}
|
||||
|
||||
List<Model.WeldingDailyTempDetailItem> data;
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
// 查询必须在数据上下文释放前物化,避免返回失效的延迟查询。
|
||||
data = (from temp in db.HJGL_WeldingDailyTempDetail
|
||||
join jotItem in db.View_HJGL_WeldJoint on temp.WeldJointId equals jotItem.WeldJointId into jotItems
|
||||
var tempQuery = db.HJGL_WeldingDailyTempDetail
|
||||
.Where(x => x.AuditState != AuditStateApproved);
|
||||
if (!string.IsNullOrEmpty(input.TempDetailId))
|
||||
{
|
||||
tempQuery = tempQuery.Where(x => x.TempDetailId == input.TempDetailId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.ProjectId))
|
||||
{
|
||||
tempQuery = tempQuery.Where(x => x.ProjectId == input.ProjectId);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.UnitWorkId))
|
||||
{
|
||||
tempQuery = tempQuery.Where(x => x.UnitWorkId == input.UnitWorkId);
|
||||
}
|
||||
if (input.WeldingDate.HasValue)
|
||||
{
|
||||
tempQuery = tempQuery.Where(x => x.WeldingDate == input.WeldingDate);
|
||||
}
|
||||
if (input.AuditState.HasValue)
|
||||
{
|
||||
tempQuery = tempQuery.Where(x => x.AuditState == input.AuditState.Value);
|
||||
}
|
||||
|
||||
// 主表条件先过滤,再执行关联和文本条件,避免无关待审核记录参与联表。
|
||||
var query = from temp in tempQuery
|
||||
join jotItem in db.HJGL_WeldJoint on temp.WeldJointId equals jotItem.WeldJointId into jotItems
|
||||
from jot in jotItems.DefaultIfEmpty()
|
||||
join coverItem in db.SitePerson_Person on temp.CoverWelderId equals coverItem.PersonId into coverItems
|
||||
from coverWelder in coverItems.DefaultIfEmpty()
|
||||
@@ -396,13 +433,13 @@ namespace BLL
|
||||
from backingWelder in backingItems.DefaultIfEmpty()
|
||||
join locationItem in db.Base_WeldingLocation on temp.WeldingLocationId equals locationItem.WeldingLocationId into locationItems
|
||||
from location in locationItems.DefaultIfEmpty()
|
||||
join weldTypeItem in db.Base_WeldType on temp.WeldTypeId equals weldTypeItem.WeldTypeId into weldTypeItems
|
||||
join weldTypeItem in db.Base_WeldType on (temp.WeldTypeId ?? jot.WeldTypeId) equals weldTypeItem.WeldTypeId into weldTypeItems
|
||||
from weldType in weldTypeItems.DefaultIfEmpty()
|
||||
join weldingMethodItem in db.Base_WeldingMethod on temp.WeldingMethodId equals weldingMethodItem.WeldingMethodId into weldingMethodItems
|
||||
join weldingMethodItem in db.Base_WeldingMethod on (temp.WeldingMethodId ?? jot.WeldingMethodId) equals weldingMethodItem.WeldingMethodId into weldingMethodItems
|
||||
from weldingMethod in weldingMethodItems.DefaultIfEmpty()
|
||||
join weldingWireItem in db.Base_Consumables on temp.WeldingWire equals weldingWireItem.ConsumablesId into weldingWireItems
|
||||
join weldingWireItem in db.Base_Consumables on (temp.WeldingWire ?? jot.WeldingWire) equals weldingWireItem.ConsumablesId into weldingWireItems
|
||||
from weldingWire in weldingWireItems.DefaultIfEmpty()
|
||||
join weldingRodItem in db.Base_Consumables on temp.WeldingRod equals weldingRodItem.ConsumablesId into weldingRodItems
|
||||
join weldingRodItem in db.Base_Consumables on (temp.WeldingRod ?? jot.WeldingRod) equals weldingRodItem.ConsumablesId into weldingRodItems
|
||||
from weldingRod in weldingRodItems.DefaultIfEmpty()
|
||||
join submitItem in db.Person_Persons on temp.SubmitPersonId equals submitItem.PersonId into submitItems
|
||||
from submitPerson in submitItems.DefaultIfEmpty()
|
||||
@@ -410,7 +447,6 @@ namespace BLL
|
||||
from teamAuditPerson in teamAuditItems.DefaultIfEmpty()
|
||||
join professionalAuditItem in db.Person_Persons on temp.ProfessionalAuditMan equals professionalAuditItem.PersonId into professionalAuditItems
|
||||
from professionalAuditPerson in professionalAuditItems.DefaultIfEmpty()
|
||||
where temp.AuditState < AuditStateApproved
|
||||
select new Model.WeldingDailyTempDetailItem
|
||||
{
|
||||
TempDetailId = temp.TempDetailId,
|
||||
@@ -430,20 +466,18 @@ namespace BLL
|
||||
WeldingLocationId = temp.WeldingLocationId,
|
||||
WeldingLocationCode = location == null ? null : location.WeldingLocationCode,
|
||||
WeldingMode = temp.WeldingMode,
|
||||
Material1Code = jot == null ? null : jot.Material1Code,
|
||||
Material2Code = jot == null ? null : jot.Material2Code,
|
||||
DNDia = jot == null ? null : jot.DNDia,
|
||||
Size = jot == null ? (decimal?)null : jot.Size,
|
||||
Dia = jot == null ? (decimal?)null : jot.Dia,
|
||||
Thickness = jot == null ? (decimal?)null : jot.Thickness,
|
||||
WeldTypeId = temp.WeldTypeId ?? (jot == null ? null : jot.WeldTypeId),
|
||||
WeldTypeCode = weldType == null ? (jot == null ? null : jot.WeldTypeCode) : weldType.WeldTypeCode,
|
||||
WeldTypeCode = weldType == null ? null : weldType.WeldTypeCode,
|
||||
WeldingMethodId = temp.WeldingMethodId ?? (jot == null ? null : jot.WeldingMethodId),
|
||||
WeldingMethodCode = weldingMethod == null ? (jot == null ? null : jot.WeldingMethodCode) : weldingMethod.WeldingMethodCode,
|
||||
WeldingMethodCode = weldingMethod == null ? null : weldingMethod.WeldingMethodCode,
|
||||
WeldingWire = temp.WeldingWire ?? (jot == null ? null : jot.WeldingWire),
|
||||
WeldingWireCode = weldingWire == null ? (jot == null ? null : jot.WeldingWireCode) : weldingWire.ConsumablesCode,
|
||||
WeldingWireCode = weldingWire == null ? null : weldingWire.ConsumablesCode,
|
||||
WeldingRod = temp.WeldingRod ?? (jot == null ? null : jot.WeldingRod),
|
||||
WeldingRodCode = weldingRod == null ? (jot == null ? null : jot.WeldingRodCode) : weldingRod.ConsumablesCode,
|
||||
WeldingRodCode = weldingRod == null ? null : weldingRod.ConsumablesCode,
|
||||
SubmitPersonId = temp.SubmitPersonId,
|
||||
SubmitPersonName = submitPerson == null ? null : submitPerson.PersonName,
|
||||
SubmitDate = temp.SubmitDate,
|
||||
@@ -459,7 +493,28 @@ namespace BLL
|
||||
ProfessionalAuditManName = professionalAuditPerson == null ? null : professionalAuditPerson.PersonName,
|
||||
ProfessionalAuditDate = temp.ProfessionalAuditDate,
|
||||
AuditStateText = temp.AuditState == AuditStatePendingTeam ? "待班组审核" : "待专工审核"
|
||||
}).ToList();
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(input.PipelineCode))
|
||||
{
|
||||
query = query.Where(x => x.PipelineCode != null && x.PipelineCode.Contains(input.PipelineCode));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.WelderCode))
|
||||
{
|
||||
query = query.Where(x => (x.CoverWelderCode != null && x.CoverWelderCode.Contains(input.WelderCode))
|
||||
|| (x.BackingWelderCode != null && x.BackingWelderCode.Contains(input.WelderCode)));
|
||||
}
|
||||
|
||||
totalCount = query.Count();
|
||||
query = query.OrderBy(x => x.PipelineCode).ThenBy(x => x.WeldJointCode);
|
||||
if (input.PageIndex.HasValue && input.PageIndex.Value >= 0
|
||||
&& input.PageSize.HasValue && input.PageSize.Value > 0)
|
||||
{
|
||||
query = query.Skip(input.PageIndex.Value * input.PageSize.Value).Take(input.PageSize.Value);
|
||||
}
|
||||
|
||||
// 查询必须在数据上下文释放前物化,避免返回失效的延迟查询。
|
||||
data = query.ToList();
|
||||
}
|
||||
SetWeldingDailyTempDetailAttachUrls(data);
|
||||
return data;
|
||||
@@ -1142,8 +1197,8 @@ namespace BLL
|
||||
newWeldJoint.WeldingDailyCode = weldingDaily.WeldingDailyCode;
|
||||
newWeldJoint.CoverWelderId = coverWelderId;
|
||||
newWeldJoint.BackingWelderId = backingWelderId;
|
||||
newWeldJoint.CoverWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, coverWelderId).TeamGroupId;
|
||||
newWeldJoint.BackingWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, backingWelderId).TeamGroupId;
|
||||
newWeldJoint.CoverWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, coverWelderId)?.TeamGroupId;
|
||||
newWeldJoint.BackingWelderTeamGroupId = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(pipeline.ProjectId, backingWelderId)?.TeamGroupId;
|
||||
if (!string.IsNullOrEmpty(weldingLocationId))
|
||||
{
|
||||
newWeldJoint.WeldingLocationId = weldingLocationId;
|
||||
|
||||
Reference in New Issue
Block a user