218 lines
8.8 KiB
C#
218 lines
8.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 热处理管理
|
|
/// </summary>
|
|
public class HotProessManageEditService
|
|
{
|
|
/// <summary>
|
|
/// 根据热处理Id获取用于热处理信息
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HotProess GetHotProessByID(string HotProessId)
|
|
{
|
|
var view = Funs.DB.HotProess.FirstOrDefault(e => e.HotProessId == HotProessId);
|
|
return view;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据热处理Id获取用于热处理信息明细
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.View_HotProessItem> GetHotProessItemByID(string HotProessId)
|
|
{
|
|
var view = (from x in Funs.DB.View_HotProessItem where x.HotProessId == HotProessId select x).ToList();
|
|
return view;
|
|
}
|
|
public static List<Model.View_HotProessItem> GetHotProessItemByJOTID(string JOT_ID)
|
|
{
|
|
var view = (from x in Funs.DB.View_HotProessItem where x.JOT_ID == JOT_ID select x).ToList();
|
|
return view;
|
|
}
|
|
public static List<Model.HotHardItem> GetHotProessByJOTID(string JOT_ID)
|
|
{
|
|
var view = (from x in Funs.DB.HotHardItem where x.JOT_ID == JOT_ID select x).ToList();
|
|
return view;
|
|
}
|
|
/// <summary>
|
|
/// 增加热处理信息
|
|
/// </summary>
|
|
/// <param name="hotProess">热处理实体</param>
|
|
public static void AddHotProess(Model.HotProess hotProess)
|
|
{
|
|
Model.HotProess newTestPackage = new Model.HotProess();
|
|
newTestPackage.HotProessId = hotProess.HotProessId;
|
|
newTestPackage.HotProessNo = hotProess.HotProessNo;
|
|
newTestPackage.ProessDate = hotProess.ProessDate;
|
|
newTestPackage.ProjectId = hotProess.ProjectId;
|
|
newTestPackage.InstallationId = hotProess.InstallationId;
|
|
newTestPackage.UnitId = hotProess.UnitId;
|
|
newTestPackage.Tabler = hotProess.Tabler;
|
|
newTestPackage.Remark = hotProess.Remark;
|
|
newTestPackage.ProessMethod = hotProess.ProessMethod;
|
|
newTestPackage.ProessEquipment = hotProess.ProessEquipment;
|
|
newTestPackage.HotType = hotProess.HotType;
|
|
Funs.DB.HotProess.InsertOnSubmit(newTestPackage);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改热处理信息
|
|
/// </summary>
|
|
/// <param name="weldReport">热处理实体</param>
|
|
public static void UpdateHotProess(Model.HotProess hotProess)
|
|
{
|
|
Model.HotProess newTestPackage = Funs.DB.HotProess.FirstOrDefault(e => e.HotProessId == hotProess.HotProessId);
|
|
if (newTestPackage != null)
|
|
{
|
|
//newTestPackage.HotProessId = hotProess.HotProessId;
|
|
newTestPackage.HotProessNo = hotProess.HotProessNo;
|
|
newTestPackage.ProessDate = hotProess.ProessDate;
|
|
newTestPackage.ProjectId = hotProess.ProjectId;
|
|
newTestPackage.InstallationId = hotProess.InstallationId;
|
|
newTestPackage.UnitId = hotProess.UnitId;
|
|
newTestPackage.Tabler = hotProess.Tabler;
|
|
newTestPackage.Remark = hotProess.Remark;
|
|
newTestPackage.ProessMethod = hotProess.ProessMethod;
|
|
newTestPackage.ProessEquipment = hotProess.ProessEquipment;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除热处理信息
|
|
/// </summary>
|
|
/// <param name="hotProessID">热处理主键</param>
|
|
public static void DeleteHotProessByHotProessID(string hotProessID)
|
|
{
|
|
Model.HotProess hotProess = Funs.DB.HotProess.FirstOrDefault(e => e.HotProessId == hotProessID);
|
|
if (hotProess != null)
|
|
{
|
|
Funs.DB.HotProess.DeleteOnSubmit(hotProess);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除热处理信息明细
|
|
/// </summary>
|
|
/// <param name="hotProessID">热处理主键</param>
|
|
public static void DeleteHotProessItemByHotProessId(string HotProessId)
|
|
{
|
|
var items = from x in Funs.DB.HotProessItem where x.HotProessId == HotProessId select x;
|
|
if (items != null)
|
|
{
|
|
foreach (var item in items)
|
|
{
|
|
Model.PW_JointInfo info = new Model.PW_JointInfo();
|
|
info.JOT_ID = item.JOT_ID;
|
|
info.JOT_ProessDate = null;
|
|
info.JOT_HotRpt = null;
|
|
UpdateJointInfo(info);
|
|
}
|
|
Funs.DB.HotProessItem.DeleteAllOnSubmit(items);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加热处理信息明细
|
|
/// </summary>
|
|
/// <param name="HotProessItem">热处理明细实体</param>
|
|
public static void AddHotProessItem(Model.HotProessItem HotProessItem, string HotProessNo, string date)
|
|
{
|
|
Model.HotProessItem newHotProessItem = new Model.HotProessItem();
|
|
string itemId = SQLHelper.GetNewID(typeof(Model.HotProessItem));
|
|
newHotProessItem.HotProessItemId = itemId;
|
|
newHotProessItem.HotProessId = HotProessItem.HotProessId;
|
|
newHotProessItem.JOT_ID = HotProessItem.JOT_ID;
|
|
newHotProessItem.PointCount = HotProessItem.PointCount;
|
|
newHotProessItem.RequiredT = HotProessItem.RequiredT;
|
|
newHotProessItem.ActualT = HotProessItem.ActualT;
|
|
newHotProessItem.RequestTime = HotProessItem.RequestTime;
|
|
newHotProessItem.ActualTime = HotProessItem.ActualTime;
|
|
newHotProessItem.RecordChartNo = HotProessItem.RecordChartNo;
|
|
newHotProessItem.HardnessReportNo = HotProessItem.HardnessReportNo;
|
|
|
|
Funs.DB.HotProessItem.InsertOnSubmit(newHotProessItem);
|
|
Funs.DB.SubmitChanges();
|
|
////更新焊口信息
|
|
Model.PW_JointInfo info = new Model.PW_JointInfo();
|
|
info.JOT_ID = HotProessItem.JOT_ID;
|
|
info.JOT_HotRpt = HotProessNo;
|
|
if (!String.IsNullOrEmpty(date))
|
|
{
|
|
info.JOT_ProessDate = DateTime.Parse(date);
|
|
}
|
|
UpdateJointInfo(info);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void UpdateJointInfo(Model.PW_JointInfo jointInfo)
|
|
{
|
|
Model.PW_JointInfo newJointInfo = Funs.DB.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jointInfo.JOT_ID);
|
|
if (newJointInfo != null)
|
|
{
|
|
newJointInfo.JOT_HotRpt = jointInfo.JOT_HotRpt;
|
|
newJointInfo.JOT_ProessDate = jointInfo.JOT_ProessDate;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据管线Id获取热处理
|
|
/// </summary>
|
|
/// <param name="isoId"></param>
|
|
/// <returns></returns>
|
|
public static Model.View_HotProessItem GetViewHotProessByIsoId(string isoId)
|
|
{
|
|
return Funs.DB.View_HotProessItem.FirstOrDefault(e => e.ISO_ID == isoId && e.HotProessId != null && e.IS_Proess == "1");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据管线Id获取热处理列表
|
|
/// </summary>
|
|
/// <param name="isoId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.View_HotProessItem> GetHotProessListByIsoId(string isoId)
|
|
{
|
|
return (from x in Funs.DB.View_HotProessItem where x.ISO_ID == isoId && x.HotProessId != null && x.IS_Proess == "1" orderby x.JOT_JointNo select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据管线Id删除热处理
|
|
/// </summary>
|
|
/// <param name="isoId"></param>
|
|
public static void DeleteHotProessItemByIsoId(string isoId)
|
|
{
|
|
var items = from x in Funs.DB.View_HotProessItem
|
|
where x.ISO_ID == isoId && x.HotProessId != null && x.IS_Proess == "1"
|
|
select x;
|
|
if (items != null)
|
|
{
|
|
foreach (var item in items)
|
|
{
|
|
Model.PW_JointInfo info = new Model.PW_JointInfo();
|
|
info.JOT_ID = item.JOT_ID;
|
|
info.JOT_ProessDate = null;
|
|
info.JOT_HotRpt = null;
|
|
UpdateJointInfo(info);
|
|
}
|
|
Funs.DB.View_HotProessItem.DeleteAllOnSubmit(items);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|