提交代码

This commit is contained in:
2023-11-26 17:43:05 +08:00
parent 206d2c5c43
commit 560f6d8b7b
7 changed files with 340 additions and 158 deletions
@@ -215,26 +215,26 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
if (pds.Count > 0 && pds != null)
{
var getPipeline = from x in Funs.DB.View_HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x;
var getMedium = from x in Funs.DB.Base_Medium where x.ProjectId == this.CurrUser.LoginProjectId select x;//介质
var getPipeLineClass = from x in Funs.DB.Base_PipingClass where x.ProjectId == this.CurrUser.LoginProjectId select x;//管道等级
var getDetectionRate = from x in Funs.DB.Base_DetectionRate select x;//探伤比例
var getDetectionType = from x in Funs.DB.Base_DetectionType select x;//探伤类型
var getPressurePipingClass = from x in Funs.DB.Base_PressurePipingClass select x;//压力管道级别
var getTestMedium = from x in Funs.DB.Base_TestMedium where x.TestType == "1" select x;//压力试验介质
var getLeakMedium = from x in Funs.DB.Base_TestMedium where x.TestType == "2" select x;//泄露性试验介质
var getPurgeMethod = from x in Funs.DB.Base_PurgeMethod select x;
var getMaterial = from x in Funs.DB.Base_Material select x;
var getWeldType = from x in Funs.DB.Base_WeldType select x;
Model.SGGLDB db = Funs.DB;
var getPipeline = from x in db.View_HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x;
var getMedium = from x in db.Base_Medium where x.ProjectId == this.CurrUser.LoginProjectId select x;//介质
var getPipeLineClass = from x in db.Base_PipingClass where x.ProjectId == this.CurrUser.LoginProjectId select x;//管道等级
var getDetectionRate = from x in db.Base_DetectionRate select x;//探伤比例
var getDetectionType = from x in db.Base_DetectionType select x;//探伤类型
var getPressurePipingClass = from x in db.Base_PressurePipingClass select x;//压力管道级别
var getTestMedium = from x in db.Base_TestMedium where x.TestType == "1" select x;//压力试验介质
var getLeakMedium = from x in db.Base_TestMedium where x.TestType == "2" select x;//泄露性试验介质
var getPurgeMethod = from x in db.Base_PurgeMethod select x;
var getMaterial = from x in db.Base_Material select x;
var getWeldType = from x in db.Base_WeldType select x;
//var getComponents = from x in Funs.DB.Base_Components where x.ProjeceId == this.CurrUser.LoginProjectId select x;
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(Request.Params["UnitWorkId"]);
for (int i = 1; i < pds.Count; i++)
{
Model.View_HJGL_WeldJoint pipeline = new Model.View_HJGL_WeldJoint();
//pipeline.PipelineId = SQLHelper.GetNewID();
Model.WBS_UnitWork unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(Request.Params["UnitWorkId"]);
if (unitWork != null)
{
pipeline.UnitWorkId = Request.Params["UnitWorkId"];
@@ -662,7 +662,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
if (col6.Contains("RT"))
{
Model.Base_DetectionType rt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("RT");
Model.Base_DetectionType rt = getDetectionType.FirstOrDefault(x => x.DetectionTypeCode == "RT");
if (rt != null)
{
pipeline.DetectionTypeId = rt.DetectionTypeId;
@@ -670,7 +670,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
else
{
Model.Base_DetectionType ut = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("UT");
Model.Base_DetectionType ut = getDetectionType.FirstOrDefault(x => x.DetectionTypeCode == "UT");
if (ut != null)
{
pipeline.DetectionTypeId = ut.DetectionTypeId;
@@ -681,7 +681,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
if (col6.Contains("MT"))
{
Model.Base_DetectionType mt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("MT");
Model.Base_DetectionType mt = getDetectionType.FirstOrDefault(x => x.DetectionTypeCode == "MT");
if (mt != null)
{
pipeline.DetectionTypeId = mt.DetectionTypeId;
@@ -689,7 +689,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
else
{
Model.Base_DetectionType pt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("PT");
Model.Base_DetectionType pt = getDetectionType.FirstOrDefault(x => x.DetectionTypeCode == "PT");
if (pt != null)
{
pipeline.DetectionTypeId = pt.DetectionTypeId;
@@ -1017,7 +1017,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
void addHJGL_WeldJoints(List<Model.View_HJGL_WeldJoint> PipelineList, string UnitWorkId)
{
var getpipelines = from y in Funs.DB.HJGL_Pipeline where y.UnitWorkId == UnitWorkId select y;
Model.SGGLDB db = Funs.DB;
var getpipelines = from y in db.HJGL_Pipeline where y.UnitWorkId == UnitWorkId select y;
var allWeldJoints = from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
where y.UnitWorkId == UnitWorkId
select x;
List<Model.HJGL_WeldJoint> weldJoints_add = new List<Model.HJGL_WeldJoint>();
var weldJoints = (from x in PipelineList
@@ -1055,7 +1060,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
temp.IsHotProess
}).ToList();
var weldJointCodes =weldJoints.Select(x=>x.WeldJointCode).Distinct().ToList();
var pipelineCodes = weldJoints.Select(x => x.PipelineCode).Distinct().ToList();
for (int i = 0; i < weldJoints.Count(); i++)
{
@@ -1076,7 +1080,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
weldJoint.ProjectId = weldJoints[i].ProjectId;
weldJoint.IsHotProess = weldJoints[i].IsHotProess;
var isExistJot = WeldJointService.GetWeldJointsByWeldJointCode(weldJoint.PipelineId, weldJoint.WeldJointCode);
var isExistJot = allWeldJoints.FirstOrDefault(x => x.PipelineId == weldJoint.PipelineId && x.WeldJointCode == weldJoint.WeldJointCode);
if (isExistJot != null) // 更新焊口
{
weldJoint.WeldJointId = isExistJot.WeldJointId;
@@ -1086,24 +1090,29 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
weldJoint.WeldJointId = SQLHelper.GetNewID();
weldJoints_add.Add(weldJoint);
//BLL.WeldJointService.AddWeldJoint(weldJoint);
}
}
//db.SubmitChanges();
if (weldJoints_add.Count > 0)
{
BLL.WeldJointService.AddBulkWeldJoint(weldJoints_add);
}
Model.SGGLDB db = Funs.DB;
var q = from x in db.HJGL_WeldJoint
join y in db.HJGL_Pipeline on x.PipelineId equals y.PipelineId
where y.UnitWorkId == Request.Params["UnitWorkId"] && pipelineCodes.Contains(x.PipelineCode) && !weldJointCodes.Contains(x.WeldJointCode)
select x;
if (q.Count() > 0)
Model.SGGLDB db2 = Funs.DB;
List<Model.HJGL_WeldJoint> delJoints = new List<Model.HJGL_WeldJoint>();
var allWeldJoints2 = from x in db2.HJGL_WeldJoint
join y in db2.HJGL_Pipeline on x.PipelineId equals y.PipelineId
where y.UnitWorkId == Request.Params["UnitWorkId"]
select x;
foreach (var pipelineCode in pipelineCodes)
{
db.HJGL_WeldJoint.DeleteAllOnSubmit(q);
db.SubmitChanges();
var pipelineWeldJointCodes = weldJoints.Where(x => x.PipelineCode == pipelineCode).Select(x => x.WeldJointCode).ToList();
var q = allWeldJoints2.Where(x => x.PipelineCode == pipelineCode && !pipelineWeldJointCodes.Contains(x.WeldJointCode)).ToList();
delJoints.AddRange(q);
}
if (delJoints.Count() > 0)
{
db2.HJGL_WeldJoint.DeleteAllOnSubmit(delJoints);
db2.SubmitChanges();
}
}
@@ -1112,7 +1121,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
// string unitworkId = Request.Params["UnitWorkId"];
// var getPipeline = from x in Funs.DB.View_HJGL_WeldJoint where x.UnitWorkId== unitworkId select x;
// List<Model.HJGL_WeldJoint> weldJoints_add = new List<Model.HJGL_WeldJoint>();
// List<Model.HJGL_WeldJoint> weldJoints_add = new List<Model.HJGL_WeldJoint>();
// for (int i = 0; i < PipelineList.Count(); i++)
// {