feat(hjgl)焊前准备,日报管理增加附件
This commit is contained in:
@@ -41,10 +41,58 @@ namespace BLL
|
||||
Misalignment = x.Misalignment
|
||||
};
|
||||
|
||||
return query.FirstOrDefault();
|
||||
var item = query.FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
SetInspectionAttachUrl(db, item);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回填下料、组对抽检附件路径
|
||||
/// </summary>
|
||||
/// <param name="db">数据库上下文</param>
|
||||
/// <param name="item">焊前抽检基础信息</param>
|
||||
private static void SetInspectionAttachUrl(Model.SGGLDB db, Model.PreWeldJointItem item)
|
||||
{
|
||||
var cuttingCheckId = db.HJGL_PreWeldCuttingCheck
|
||||
.Where(x => x.WeldJointId == item.WeldJointId)
|
||||
.Select(x => x.CuttingCheckId)
|
||||
.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(cuttingCheckId))
|
||||
{
|
||||
item.CuttingAttachUrl1 = GetAttachUrl(db, Const.HJGL_PreWeldCuttingCheckMenuId, cuttingCheckId);
|
||||
}
|
||||
|
||||
var fitupCheckId = db.HJGL_PreWeldFitupCheck
|
||||
.Where(x => x.WeldJointId == item.WeldJointId)
|
||||
.Select(x => x.FitupCheckId)
|
||||
.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(fitupCheckId))
|
||||
{
|
||||
item.FitupAttachUrl1 = GetAttachUrl(db, Const.HJGL_PreWeldFitupCheckMenuId, fitupCheckId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按菜单和业务ID获取附件路径
|
||||
/// </summary>
|
||||
/// <param name="db">数据库上下文</param>
|
||||
/// <param name="menuId">菜单ID</param>
|
||||
/// <param name="toKeyId">业务ID</param>
|
||||
/// <returns>附件路径</returns>
|
||||
private static string GetAttachUrl(Model.SGGLDB db, string menuId, string toKeyId)
|
||||
{
|
||||
var attachUrl = db.AttachFile
|
||||
.Where(x => x.MenuId == menuId && x.ToKeyId == toKeyId)
|
||||
.Select(x => x.AttachUrl)
|
||||
.FirstOrDefault();
|
||||
return string.IsNullOrEmpty(attachUrl) ? attachUrl : attachUrl.Replace('\\', '/');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存下料抽检,已存在同一焊口记录时更新原记录
|
||||
/// </summary>
|
||||
@@ -92,6 +140,8 @@ namespace BLL
|
||||
check.Remark = item.Remark;
|
||||
|
||||
db.SubmitChanges();
|
||||
|
||||
SaveInspectionAttachUrl(item.AttachUrl1, Const.HJGL_PreWeldCuttingCheckMenuId, check.CuttingCheckId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +208,32 @@ namespace BLL
|
||||
weldJoint.Misalignment = item.Misalignment;
|
||||
|
||||
db.SubmitChanges();
|
||||
|
||||
SaveInspectionAttachUrl(item.AttachUrl1, Const.HJGL_PreWeldFitupCheckMenuId, check.FitupCheckId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存焊前抽检附件,空附件时清理原附件。
|
||||
/// </summary>
|
||||
/// <param name="attachUrl">附件路径</param>
|
||||
/// <param name="menuId">菜单ID</param>
|
||||
/// <param name="dataId">业务数据ID</param>
|
||||
private static void SaveInspectionAttachUrl(string attachUrl, string menuId, string dataId)
|
||||
{
|
||||
// AttachUrl1 为 null 表示旧调用方未传附件参数,避免误删已有附件;空字符串表示明确清空附件。
|
||||
if (attachUrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(attachUrl))
|
||||
{
|
||||
UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, dataId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CommonService.DeleteAttachFileById(menuId, dataId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user