2023-10-27

This commit is contained in:
2023-10-27 14:02:52 +08:00
parent bc4d37f37f
commit e46a7ad179
9 changed files with 486 additions and 421 deletions
@@ -295,6 +295,56 @@ namespace BLL
db.SubmitChanges();
}
}
/// <summary>
/// 日报明细删除
/// </summary>
/// <param name="weldJointId"></param>
/// <returns></returns>
public static string DeleteWeldingDailyItemByweldJointId(string weldJointId)
{
string errlog = string.Empty;
var newWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
var pipeline = BLL.PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
if (newWeldJoint != null && !string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
{
var isTrust = from x in Funs.DB.HJGL_Batch_BatchTrustItem
where x.WeldJointId == weldJointId
select x; ;
if (isTrust.Count() == 0)
{
var updateWeldJoint = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId);
if (updateWeldJoint != null)
{
updateWeldJoint.WeldingDailyId = null;
updateWeldJoint.WeldingDailyCode = null;
updateWeldJoint.CoverWelderId = null;
updateWeldJoint.BackingWelderId = null;
BLL.WeldJointService.UpdateWeldJoint(updateWeldJoint);
var pointBatchItems = from x in Funs.DB.HJGL_Batch_PointBatchItem where x.WeldJointId == weldJointId select x;
string pointBatchId = pointBatchItems.FirstOrDefault().PointBatchId;
// 删除焊口所在批明细信息
BLL.PointBatchDetailService.DeleteBatchDetail(weldJointId);
// 删除批信息
var batch = from x in Funs.DB.HJGL_Batch_PointBatchItem where x.PointBatchId == pointBatchId select x;
if (pointBatchId != null && batch.Count() == 0)
{
BLL.PointBatchService.DeleteBatch(pointBatchId);
}
}
}
else
{
errlog += "焊口【" + newWeldJoint.WeldJointCode + "】已进委托单了,不能删除。";
}
}
return errlog;
}
/// <summary>
/// 按类型获取焊接日报项