ZHJA_HJGL/HJGL_ZH/BLL/HJGL/HotProessManage/HJGL_CH_HotProessResultServ...

117 lines
5.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.UI.WebControls;
namespace BLL
{
public class HJGL_CH_HotProessResultService
{
/// <summary>
/// 根据热处理Id获取用于热处理结果反馈
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HotProessResult GetHotProessResultByID(string HotProessResultId)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HotProessResult.FirstOrDefault(e => e.HotProessResultId == HotProessResultId);
return view;
}
/// <summary>
/// 根据热处理委托Id和焊口id获取用于热处理结果反馈
/// </summary>
/// <param name="jot_id"></param>
/// <returns></returns>
public static Model.HJGL_CH_HotProessResult GetHotProessResultByHotTrustIDAndJotID(string hotProessTrustId, string jot_id)
{
Model.SGGLDB db = Funs.DB;
var view = db.HJGL_CH_HotProessResult.FirstOrDefault(e => e.HotProessTrustId == hotProessTrustId && e.JOT_ID == jot_id);
return view;
}
/// <summary>
/// 增加热处理结果反馈
/// </summary>
/// <param name="hotProess">热处理实体</param>
public static void AddHotProessResult(Model.HJGL_CH_HotProessResult hotProess)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HotProessResult newTestPackage = new Model.HJGL_CH_HotProessResult();
newTestPackage.HotProessResultId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HotProessResult));
newTestPackage.HotProessTrustId = hotProess.HotProessTrustId;
newTestPackage.ProessTypes = hotProess.ProessTypes;
newTestPackage.JOT_ID = hotProess.JOT_ID;
newTestPackage.HotProessCurveNo = hotProess.HotProessCurveNo;
newTestPackage.IsOK = hotProess.IsOK;
newTestPackage.IsNeedHardTest = hotProess.IsNeedHardTest;
Model.HJGL_CH_HotProessTrustItem hotProessTrustItem = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustItemByHotProessTrustIdAndJotId(hotProess.HotProessTrustId, hotProess.JOT_ID);
if (hotProessTrustItem != null) //如果热处理委托明细存在,则插入数据
{
db.HJGL_CH_HotProessResult.InsertOnSubmit(newTestPackage);
db.SubmitChanges();
}
}
/// <summary>
/// 修改热处理结果反馈
/// </summary>
/// <param name="weldReport">热处理实体</param>
public static void UpdateHotProessResult(Model.HJGL_CH_HotProessResult hotProess)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HotProessResult newTestPackage = db.HJGL_CH_HotProessResult.FirstOrDefault(e => e.HotProessResultId == hotProess.HotProessResultId);
if (newTestPackage != null)
{
newTestPackage.HotProessResultId = hotProess.HotProessResultId;
newTestPackage.HotProessTrustId = hotProess.HotProessTrustId;
newTestPackage.JOT_ID = hotProess.JOT_ID;
newTestPackage.HotProessCurveNo = hotProess.HotProessCurveNo;
newTestPackage.IsOK = hotProess.IsOK;
newTestPackage.ResultDate = hotProess.ResultDate;
newTestPackage.IsNeedHardTest = hotProess.IsNeedHardTest;
newTestPackage.Remark = hotProess.Remark;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除热处理结果反馈
/// </summary>
/// <param name="hotProessID">热处理主键</param>
public static void DeleteHotProessResultByHotProessResultID(string hotProessResultId)
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_CH_HotProessResult hotProess = db.HJGL_CH_HotProessResult.FirstOrDefault(e => e.HotProessResultId == hotProessResultId);
if (hotProess != null)
{
db.HJGL_CH_HotProessResult.DeleteOnSubmit(hotProess);
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除热处理结果反馈明细
/// </summary>
/// <param name="hotProessID">热处理主键</param>
public static void DeleteHotProessResultsyHotProessTrustId(string HotProessTrustId)
{
Model.SGGLDB db = Funs.DB;
var items = from x in db.HJGL_CH_HotProessResult where x.HotProessTrustId == HotProessTrustId select x;
if (items != null)
{
foreach (var item in items)
{
//回写热处理合格及反馈时间
BLL.HJGL_PW_JointInfoService.WriteBackHotProessResultOKAndDate(item.JOT_ID, null);
}
db.HJGL_CH_HotProessResult.DeleteAllOnSubmit(items);
db.SubmitChanges();
}
}
}
}