2024-09-24 20:38:50 +08:00
|
|
|
|
using Model;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
namespace BLL
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2024-09-24 20:38:50 +08:00
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
public static class PipelineMatService
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///获取管线材料信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static Model.HJGL_PipeLineMat GetPipeLineMat(string pipelineMatId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Funs.DB.HJGL_PipeLineMat.FirstOrDefault(e => e.PipeLineMatId == pipelineMatId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-24 20:38:50 +08:00
|
|
|
|
public static List<Model.HJGL_PipeLineMat> GetPipeLineMatsByPipelineId(string pipelineId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Funs.DB.HJGL_PipeLineMat.Where(e => e.PipelineId == pipelineId).ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-05 16:36:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 增加管线材料
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="PipingClass"></param>
|
|
|
|
|
|
public static void AddPipeLineMat(Model.HJGL_PipeLineMat pipelineMat)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
Model.HJGL_PipeLineMat newPipelineMat = new HJGL_PipeLineMat
|
|
|
|
|
|
{
|
|
|
|
|
|
PipeLineMatId = pipelineMat.PipeLineMatId,
|
|
|
|
|
|
MaterialCode = pipelineMat.MaterialCode,
|
|
|
|
|
|
PipelineId = pipelineMat.PipelineId,
|
|
|
|
|
|
Number = pipelineMat.Number,
|
|
|
|
|
|
PrefabricatedComponents = pipelineMat.PrefabricatedComponents,
|
|
|
|
|
|
};
|
|
|
|
|
|
db.HJGL_PipeLineMat.InsertOnSubmit(newPipelineMat);
|
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 修改管线材料
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pipingClass"></param>
|
|
|
|
|
|
public static void UpdatePipeLineMat(Model.HJGL_PipeLineMat pipelineMat)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
Model.HJGL_PipeLineMat newPipelineMat = db.HJGL_PipeLineMat.FirstOrDefault(e => e.PipeLineMatId == pipelineMat.PipeLineMatId);
|
|
|
|
|
|
if (newPipelineMat != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
newPipelineMat.MaterialCode = pipelineMat.MaterialCode;
|
|
|
|
|
|
newPipelineMat.PipelineId = pipelineMat.PipelineId;
|
|
|
|
|
|
newPipelineMat.Number = pipelineMat.Number;
|
|
|
|
|
|
newPipelineMat.PrefabricatedComponents = pipelineMat.PrefabricatedComponents;
|
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据unitworkid删除焊口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="unitworkId"></param>
|
|
|
|
|
|
public static void DeletePipeLineMatByUnitWorkId(string unitworkId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var oldPipeline = BLL.PipelineService.GetPipelinesByUnitWordId(unitworkId);
|
|
|
|
|
|
if (oldPipeline != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var pipeline in oldPipeline)
|
|
|
|
|
|
{
|
|
|
|
|
|
HJGL_PipelineComponentService.DeletePipelineComponentBypipelineId(pipeline.PipelineId);//删除原有管线对应组件
|
|
|
|
|
|
DeletePipeLineMatBypipelineId(pipeline.PipelineId); //删除原有管线对应材料
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据主键删除管线材料
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pipingClassId"></param>
|
|
|
|
|
|
public static void DeletePipeLineMat(string pipelineMatId)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
Model.HJGL_PipeLineMat delPipelineMat = db.HJGL_PipeLineMat.FirstOrDefault(e => e.PipeLineMatId == pipelineMatId);
|
|
|
|
|
|
HJGL_PipelineComponentService.DeletePipelineComponentByMatId(pipelineMatId);
|
|
|
|
|
|
if (delPipelineMat != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
db.HJGL_PipeLineMat.DeleteOnSubmit(delPipelineMat);
|
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void DeletePipeLineMatBypipelineId(string pipelineId)
|
|
|
|
|
|
{
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
|
var delPipelineMat = db.HJGL_PipeLineMat.Where(e => e.PipelineId == pipelineId);
|
|
|
|
|
|
if (delPipelineMat != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
db.HJGL_PipeLineMat.DeleteAllOnSubmit(delPipelineMat);
|
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|