1524 lines
79 KiB
C#
1524 lines
79 KiB
C#
|
using BLL;
|
|||
|
using Model;
|
|||
|
using Newtonsoft.Json.Linq;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.YLRQ.TestDataManagement
|
|||
|
{
|
|||
|
public partial class QualityRating : PageBase
|
|||
|
{
|
|||
|
private string QualityRatingId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["QualityRatingId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
|
|||
|
ViewState["QualityRatingId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 委托单号
|
|||
|
/// </summary>
|
|||
|
private string EntrustCode
|
|||
|
{
|
|||
|
get { return (string)ViewState["EntrustCode"]; }
|
|||
|
set { ViewState["EntrustCode"] = value; }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 焊缝主键
|
|||
|
/// </summary>
|
|||
|
private string WeldingId
|
|||
|
{
|
|||
|
get { return (string)ViewState["WeldingId"]; }
|
|||
|
set { ViewState["WeldingId"] = value; }
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 检测方法主键
|
|||
|
/// </summary>
|
|||
|
private string NdtId
|
|||
|
{
|
|||
|
get { return (string)ViewState["NdtId"]; }
|
|||
|
set { ViewState["NdtId"] = value; }
|
|||
|
}
|
|||
|
|
|||
|
private static List<string> loadCH_TrustItemIDs;
|
|||
|
|
|||
|
private static List<PV_QualityRatingItem> qualityRatings;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 首次加载
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
loadCH_TrustItemIDs = new List<string>();
|
|||
|
qualityRatings = new List<PV_QualityRatingItem>();
|
|||
|
this.EntrustCode = Request.Params["EntrustCode"];
|
|||
|
this.WeldingId = Request.Params["WeldingId"];
|
|||
|
this.NdtId = Request.Params["NdtId"];
|
|||
|
|
|||
|
this.drpEquipment.DataTextField = "EquipmentName";
|
|||
|
this.drpEquipment.DataValueField = "EquipmentId";
|
|||
|
this.drpEquipment.DataSource = BLL.HJGL_EquipmentService.GetEquipmentList();
|
|||
|
this.drpEquipment.DataBind();
|
|||
|
this.drpJointNo.DataTextField = "WeldingCode";
|
|||
|
this.drpJointNo.DataValueField = "MethodId";
|
|||
|
Funs.FineUIPleaseSelect(this.drpEquipment);
|
|||
|
this.btnNew.Hidden = true;
|
|||
|
|
|||
|
var weldingCodes = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|||
|
where y.EntrustCode == EntrustCode && a.WeldingId == WeldingId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId select z).Count() == 0
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
orderby a.WeldingCode
|
|||
|
select new { x.MethodId, a.WeldingCode }).Distinct();
|
|||
|
this.drpJointNo.DataSource = weldingCodes;
|
|||
|
this.drpJointNo.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|||
|
|
|||
|
var methodIds = from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == WeldingId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId select z).Count() == 0
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId;
|
|||
|
|
|||
|
if (methodIds.Count() == 0)
|
|||
|
{
|
|||
|
var entrustId = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == EntrustCode && j.WeldingId == WeldingId
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.EntrustId).FirstOrDefault();
|
|||
|
var entrustModel = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == entrustId);
|
|||
|
|
|||
|
if (entrustModel != null)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(entrustModel.NdtId))
|
|||
|
{
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == entrustModel.NdtId);
|
|||
|
if (ndt != null)
|
|||
|
{
|
|||
|
if (ndt.Ndt_NdtCode.Contains("RT"))
|
|||
|
{
|
|||
|
Grid1.Columns[6].Hidden = false;//裂纹
|
|||
|
Grid1.Columns[9].Hidden = false;//裂纹
|
|||
|
Grid1.Columns[10].Hidden = false;//未熔合
|
|||
|
Grid1.Columns[11].Hidden = false;//未焊透
|
|||
|
Grid1.Columns[12].Hidden = false;//条状缺陷
|
|||
|
Grid1.Columns[13].Hidden = false;//圆形缺陷
|
|||
|
Grid1.Columns[14].Hidden = false;//深孔缺陷
|
|||
|
Grid1.Columns[15].Hidden = false;//根部内凹
|
|||
|
Grid1.Columns[16].Hidden = false;//根部咬边
|
|||
|
//Grid1.Columns[19].Hidden = false;//缺陷性质
|
|||
|
Grid1.Columns[21].Hidden = false;//缺陷定量
|
|||
|
Grid1.Columns[22].Hidden = false;//缺陷位置(定量)
|
|||
|
Grid1.Columns[22].HeaderText = "超标缺陷部位";
|
|||
|
}
|
|||
|
else if (ndt.Ndt_NdtCode.Contains("UT") || ndt.Ndt_NdtCode.Contains("TOFD"))
|
|||
|
{
|
|||
|
if (ndt.Ndt_NdtCode.Contains("PAUT") || ndt.Ndt_NdtCode.Contains("TOFD"))
|
|||
|
{
|
|||
|
Grid1.Columns[4].Hidden = true;
|
|||
|
}
|
|||
|
Grid2.Columns[2].Hidden = true;
|
|||
|
Grid1.Columns[3].Hidden = true;
|
|||
|
Grid1.Columns[17].Hidden = false;//检测长度
|
|||
|
Grid1.Columns[18].Hidden = false;//峰值波幅
|
|||
|
Grid1.Columns[21].Hidden = false;//缺陷位置
|
|||
|
Grid1.Columns[24].Hidden = false;//缺陷深度
|
|||
|
Grid1.Columns[27].Hidden = false;//指示长度
|
|||
|
}
|
|||
|
else if (ndt.Ndt_NdtCode.Contains("MT") || ndt.Ndt_NdtCode.Contains("PT"))
|
|||
|
{
|
|||
|
Grid2.Columns[2].Hidden = true;
|
|||
|
Grid1.Columns[3].Hidden = true;
|
|||
|
Grid1.Columns[19].Hidden = false;//缺陷性质
|
|||
|
Grid1.Columns[21].Hidden = false;//缺陷位置
|
|||
|
Grid1.Columns[22].Hidden = false;//缺陷尺寸
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
foreach (var itemMethodId in methodIds)
|
|||
|
{
|
|||
|
//根据类型不同,显示不同的缺陷
|
|||
|
var itemMethod = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.MethodId == itemMethodId);
|
|||
|
var qualityRating = Funs.DB.PV_BO_QualityRating.Where(p => p.MethodId == itemMethodId).ToList();
|
|||
|
if (itemMethod != null)
|
|||
|
{
|
|||
|
var itemWeldInfo = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == itemMethod.WeldingId);
|
|||
|
var itemEntrust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == itemMethod.EntrustId);
|
|||
|
if (itemEntrust != null)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(itemEntrust.NdtId))
|
|||
|
{
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == itemEntrust.NdtId);
|
|||
|
if (ndt != null)
|
|||
|
{
|
|||
|
loadCH_TrustItemIDs.Add(itemMethodId);
|
|||
|
if (ndt.Ndt_NdtCode.Contains("RT"))
|
|||
|
{
|
|||
|
Grid1.Columns[6].Hidden = false;//裂纹
|
|||
|
Grid1.Columns[9].Hidden = false;//裂纹
|
|||
|
Grid1.Columns[10].Hidden = false;//未熔合
|
|||
|
Grid1.Columns[11].Hidden = false;//未焊透
|
|||
|
Grid1.Columns[12].Hidden = false;//条状缺陷
|
|||
|
Grid1.Columns[13].Hidden = false;//圆形缺陷
|
|||
|
Grid1.Columns[14].Hidden = false;//深孔缺陷
|
|||
|
Grid1.Columns[15].Hidden = false;//根部内凹
|
|||
|
Grid1.Columns[16].Hidden = false;//根部咬边
|
|||
|
//Grid1.Columns[19].Hidden = false;//缺陷性质
|
|||
|
Grid1.Columns[21].Hidden = false;//缺陷定量
|
|||
|
Grid1.Columns[22].Hidden = false;//缺陷位置(定量)
|
|||
|
Grid1.Columns[22].HeaderText = "超标缺陷部位";
|
|||
|
|
|||
|
if (qualityRating.Count == 0)
|
|||
|
{
|
|||
|
//1:长度2:直径
|
|||
|
if (itemWeldInfo.WeldUnit == 1)
|
|||
|
{
|
|||
|
//长度
|
|||
|
var rowNum = Math.Ceiling(float.Parse(itemWeldInfo.WeldLength.Replace("φ","")) / 250);
|
|||
|
if (rowNum == 0) rowNum = 1;
|
|||
|
GetDefaultAddRow(int.Parse(rowNum.ToString()), itemMethodId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//直径
|
|||
|
if (int.Parse(itemWeldInfo.WeldLength.Replace("φ", "")) > 100)
|
|||
|
{
|
|||
|
GetDefaultAddRow(6, itemMethodId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
GetDefaultAddRow(3, itemMethodId);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
else if (ndt.Ndt_NdtCode.Contains("UT") || ndt.Ndt_NdtCode.Contains("TOFD"))
|
|||
|
{
|
|||
|
if (ndt.Ndt_NdtCode.Contains("PAUT") || ndt.Ndt_NdtCode.Contains("TOFD"))
|
|||
|
{
|
|||
|
Grid1.Columns[4].Hidden = true;
|
|||
|
}
|
|||
|
Grid2.Columns[2].Hidden = true;
|
|||
|
Grid1.Columns[3].Hidden = true;
|
|||
|
Grid1.Columns[17].Hidden = false;//检测长度
|
|||
|
Grid1.Columns[18].Hidden = false;//峰值波幅
|
|||
|
Grid1.Columns[21].Hidden = false;//缺陷位置
|
|||
|
Grid1.Columns[24].Hidden = false;//缺陷深度
|
|||
|
Grid1.Columns[27].Hidden = false;//指示长度
|
|||
|
|
|||
|
//this.btnNew.Hidden = true;
|
|||
|
if (qualityRating.Count == 0)
|
|||
|
{
|
|||
|
GetDefaultAddRow(1, itemMethodId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
else if (ndt.Ndt_NdtCode.Contains("MT") || ndt.Ndt_NdtCode.Contains("PT"))
|
|||
|
{
|
|||
|
Grid2.Columns[2].Hidden = true;
|
|||
|
Grid1.Columns[3].Hidden = true;
|
|||
|
Grid1.Columns[19].Hidden = false;//缺陷性质
|
|||
|
Grid1.Columns[21].Hidden = false;//缺陷位置
|
|||
|
Grid1.Columns[22].Hidden = false;//缺陷尺寸
|
|||
|
//this.btnNew.Hidden = true;
|
|||
|
if (qualityRating.Count == 0)
|
|||
|
{
|
|||
|
GetDefaultAddRow(1, itemMethodId);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
//检测设备
|
|||
|
if (!string.IsNullOrEmpty(itemMethod.EquipmentId))
|
|||
|
{
|
|||
|
this.drpEquipment.SelectedValue = itemMethod.EquipmentId;
|
|||
|
}
|
|||
|
//拍片人员
|
|||
|
this.txtShootMan.Text = !string.IsNullOrEmpty(itemMethod.ShootMan) ? itemMethod.ShootMan : this.CurrUser.UserName;
|
|||
|
//拍片日期
|
|||
|
if (itemMethod.ShootDate != null)
|
|||
|
{
|
|||
|
this.txtShootDate.Text = itemMethod.ShootDate.Value.ToString();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (itemEntrust != null)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(itemEntrust.NdtId))
|
|||
|
{
|
|||
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == itemEntrust.NdtId);
|
|||
|
if (ndt != null)
|
|||
|
{
|
|||
|
if (ndt.Ndt_NdtCode.Contains("RT"))
|
|||
|
{
|
|||
|
this.txtShootDate.Text = DateTime.Now.Date.AddDays(-1).ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.txtShootDate.Text = DateTime.Now.Date.ToString();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
this.Grid1.DataSource = qualityRatings;
|
|||
|
this.Grid1.DataBind();
|
|||
|
|
|||
|
methodIds = from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == this.WeldingId
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId;
|
|||
|
if (methodIds.Count() > 0)
|
|||
|
{
|
|||
|
var r = from x in Funs.DB.PV_CH_RepairItemRecord select x;
|
|||
|
var repair = from x in r where methodIds.Contains(x.MethodId) select x;
|
|||
|
if (repair.Count() != 0)
|
|||
|
{
|
|||
|
var repairItem = from x in Funs.DB.PV_CH_RepairItemRecord
|
|||
|
join y in Funs.DB.PV_WeldInformation on x.WeldingId equals y.WeldingId
|
|||
|
where methodIds.Contains(x.MethodId)
|
|||
|
select new { x.RepairItemRecordId, y.WeldingCode, x.FilmNum, x.DefectNature, x.MethodId, y.WeldingId };
|
|||
|
Grid2.DataSource = repairItem;
|
|||
|
Grid2.DataBind();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除选中行的脚本
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private string GetDeleteScript()
|
|||
|
{
|
|||
|
return Confirm.GetShowReference("确定移除选中行吗?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty);
|
|||
|
}
|
|||
|
|
|||
|
#region Grid1绑定前事件
|
|||
|
/// <summary>
|
|||
|
/// Grid1绑定前事件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_PreDataBound(object sender, EventArgs e)
|
|||
|
{
|
|||
|
// 设置LinkButtonField的点击客户端事件
|
|||
|
LinkButtonField deleteField = Grid1.FindColumn("Delete") as LinkButtonField;
|
|||
|
deleteField.OnClientClick = GetDeleteScript();
|
|||
|
LinkButtonField lbtnRemakeResult = Grid1.FindColumn("RemakeResult") as LinkButtonField;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 行点击事件
|
|||
|
/// <summary>
|
|||
|
/// Grid行点击事件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid2_RowCommand(object sender, GridCommandEventArgs e)
|
|||
|
{
|
|||
|
string repairItemId = Grid2.DataKeys[e.RowIndex][0].ToString();
|
|||
|
string methodId = Grid2.DataKeys[e.RowIndex][1].ToString();
|
|||
|
if (e.CommandName == "attchUrl")
|
|||
|
{
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGL/RepairNotice&menuId={1}&edit=1", repairItemId, BLL.Const.HJGL_RepairManageEditMenuId)));
|
|||
|
}
|
|||
|
if (e.CommandName == "print")
|
|||
|
{
|
|||
|
var repairItemRecord = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(s => s.RepairItemRecordId == repairItemId);
|
|||
|
if (repairItemRecord != null)
|
|||
|
{
|
|||
|
string receiveMan = this.CurrUser.UserName;
|
|||
|
var trustItem = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.MethodId == methodId);
|
|||
|
if (trustItem != null)
|
|||
|
{
|
|||
|
Sys_User user = BLL.Sys_UserService.GetUsersByUserId(trustItem.EntrustPeople);
|
|||
|
if (user != null)
|
|||
|
{
|
|||
|
receiveMan = user.UserName;
|
|||
|
}
|
|||
|
}
|
|||
|
repairItemRecord.ReceiveMan = receiveMan;
|
|||
|
repairItemRecord.ReceiveDate = repairItemRecord.ReceiveDate == null ? DateTime.Now : repairItemRecord.ReceiveDate;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../RepairManage/RepairNoticePrint.aspx?repairItemRecordId={0}", repairItemId, "编辑 - ")));
|
|||
|
}
|
|||
|
}
|
|||
|
if (e.CommandName == "Delete")
|
|||
|
{
|
|||
|
if (judgementDelete(repairItemId))
|
|||
|
{
|
|||
|
var repairItemRecord = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(s => s.RepairItemRecordId == repairItemId);
|
|||
|
if (repairItemRecord != null)
|
|||
|
{
|
|||
|
Funs.DB.PV_CH_RepairItemRecord.DeleteOnSubmit(repairItemRecord);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
var deleteMethodId = from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == this.WeldingId
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId;
|
|||
|
var repairItem = from x in Funs.DB.PV_CH_RepairItemRecord
|
|||
|
join y in Funs.DB.PV_WeldInformation on x.WeldingId equals y.WeldingId
|
|||
|
where deleteMethodId.Contains(x.MethodId)
|
|||
|
select new { x.RepairItemRecordId, y.WeldingCode, x.FilmNum, x.DefectNature, x.MethodId, y.WeldingId };
|
|||
|
|
|||
|
//删除返修通知单时判断是否需要重新热处理记录表
|
|||
|
if (repairItem.Count() == 0)
|
|||
|
{
|
|||
|
var deleteAgain = Funs.DB.PV_CH_AgainHotInfo.Where(p => p.WeldingId == repairItemRecord.WeldingId && p.TrustType == 2 && p.IsHotProessTrust == false);
|
|||
|
if (deleteAgain.Count() > 0)
|
|||
|
{
|
|||
|
Funs.DB.PV_CH_AgainHotInfo.DeleteAllOnSubmit(deleteAgain);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
Grid2.DataSource = repairItem;
|
|||
|
Grid2.DataBind();
|
|||
|
BLL.Sys_LogService.AddLog(BLL.Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除返修通知单信息");
|
|||
|
ShowNotify("删除数据成功!(表格数据已重新绑定)");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 判断是否可删除
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 判断是否可以删除
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private bool judgementDelete(string repairItemId)
|
|||
|
{
|
|||
|
string content = "";
|
|||
|
var repairItemRecord = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(e => e.RepairItemRecordId == repairItemId);
|
|||
|
if (repairItemRecord.IsPrint == true)
|
|||
|
{
|
|||
|
content = "返修焊接记录已打印,无法删除";
|
|||
|
}
|
|||
|
if (content == "")
|
|||
|
{
|
|||
|
return true;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ShowNotify(content);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 数据绑定
|
|||
|
/// <summary>
|
|||
|
/// 数据绑定
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
string ids = string.Empty;
|
|||
|
List<string> methodIds = new List<string>();
|
|||
|
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
|||
|
{
|
|||
|
methodIds = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == this.WeldingId &&
|
|||
|
((from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId select z).Count() == 0
|
|||
|
|| ((from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId && (z.DefectResult == "" || z.DefectResult == null) select z).Count() > 0)
|
|||
|
|| x.DetectionStatus == 3) && !loadCH_TrustItemIDs.Contains(x.MethodId)
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId).Distinct().ToList();
|
|||
|
}
|
|||
|
else if (this.rblIsFilm.SelectedValue == "1") //已拍片
|
|||
|
{
|
|||
|
methodIds = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == WeldingId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId select z).Count() > 0
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId).Distinct().ToList();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
methodIds = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == this.WeldingId
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId).Distinct().ToList();
|
|||
|
}
|
|||
|
ids = string.Join(",", methodIds);
|
|||
|
if (this.drpJointNo.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == this.NdtId);
|
|||
|
this.btnNew.Hidden = false;
|
|||
|
ids = this.drpJointNo.SelectedValue;
|
|||
|
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
|||
|
{
|
|||
|
if (qualityRatings.Count > 0)
|
|||
|
{
|
|||
|
this.Grid1.DataSource = qualityRatings.Where(x => x.WeldingCode == this.drpJointNo.SelectedText);
|
|||
|
this.Grid1.DataBind();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
string strSql = string.Empty;
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
strSql = @"SELECT QualityRating.QualityRatingId,QualityRating.MethodId,QualityRating.RMaterial, QualityRating.Remake,QualityRating.RemakeResult,QualityRating.WeldingId,QualityRating.FilmNum,QualityRating.RepairTag, QualityRating.Cack,QualityRating.NotFusion,QualityRating.NotPenetration,QualityRating.StripDefects,QualityRating.CircularDefects,QualityRating.DeepHoleDefects,QualityRating.RootsConcave,QualityRating.RootsBiteEdge,QualityRating.PseudoDefects,QualityRating.DefectLength,QualityRating.DefectResult,QualityRating.SignMan,QualityRating.SignDate,QualityRating.Remark,JointInfo.WeldingCode,PvTest.ndt_Level,trust.ProjectId,Project.ProjectCode,(select a.pkidStr from (SELECT STUFF(( SELECT ',' +convert(VARCHAR, WED_Code) FROM (select WED_Code from HJGL_BS_Welder as Welder where Welder.WED_ID in (select Id from StrToTable(JointInfo.BackingWelderId)))t FOR XML PATH('')), 1, 1, '') AS pkidStr) a) as WED_Code,QualityRating.DetectLength,QualityRating.PeakAmplitude,QualityRating.DefectLocation,QualityRating.DefectRation,QualityRating.DepthDefect,QualityRating.IndicatingLength,QualityRating.DefectHeight,QualityRating.DefectsHighSide,QualityRating.DefectSize,QualityRating.DefectNature,QualityRating.IsPass FROM dbo.PV_BO_QualityRating QualityRating LEFT JOIN dbo.PV_ManagementMethod AS trustItem ON trustItem.MethodId = QualityRating.MethodId LEFT JOIN dbo.PV_EntrustRecord AS trust ON trust.Id = trustItem.EntrustId LEFT JOIN dbo.PV_WeldInformation AS JointInfo ON JointInfo.WeldingId = QualityRating.WeldingId LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = trust.ProjectId LEFT JOIN dbo.PV_TestMethod as PvTest on PvTest.ndt_Id=trustItem.NdtId WHERE CHARINDEX(QualityRating.MethodId,@MethodIds)>0 ";
|
|||
|
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
|||
|
{
|
|||
|
strSql += " and (QualityRating.DefectResult='' or QualityRating.DefectResult is null or QualityRating.Remake=1)";
|
|||
|
}
|
|||
|
if (this.drpJointNo.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
strSql += " and JointInfo.WeldingCode=@JOT_JointNo";
|
|||
|
listStr.Add(new SqlParameter("@JOT_JointNo", this.drpJointNo.SelectedText));
|
|||
|
}
|
|||
|
listStr.Add(new SqlParameter("@MethodIds", ids));
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
// 2.获取当前分页数据
|
|||
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 排序
|
|||
|
/// <summary>
|
|||
|
/// 排序
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 提交
|
|||
|
/// <summary>
|
|||
|
/// 提交
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
SubmitQualityRating();
|
|||
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|||
|
{
|
|||
|
JObject values = mergedRow.Value<JObject>("values");
|
|||
|
if (Convert.ToBoolean(values.Value<string>("Remake")))
|
|||
|
{
|
|||
|
string qualityRatingId = values.Value<string>("QualityRatingId");
|
|||
|
var remakeReason = Funs.DB.PV_BO_RemakeReason.FirstOrDefault(x => x.QualityRatingId == qualityRatingId);
|
|||
|
if (remakeReason == null)
|
|||
|
{
|
|||
|
ShowNotify("重拍口需先编辑重拍记录才可提交!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 提交检测
|
|||
|
/// </summary>
|
|||
|
private void SubmitQualityRating()
|
|||
|
{
|
|||
|
int filmNum = 0;
|
|||
|
int rMatNum = 0;
|
|||
|
string changeId = string.Empty;
|
|||
|
bool b = true; //默认合格
|
|||
|
bool needRemake = false; //重拍
|
|||
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|||
|
{
|
|||
|
JObject values = mergedRow.Value<JObject>("values");
|
|||
|
string methodId = values.Value<string>("MethodId");
|
|||
|
|
|||
|
if (changeId != methodId) //循环至新的焊口记录
|
|||
|
{
|
|||
|
var oldTrustItem = Funs.DB.PV_ManagementMethod.FirstOrDefault(e => e.MethodId == changeId);
|
|||
|
if (oldTrustItem != null)
|
|||
|
{
|
|||
|
var weldtion = Funs.DB.PV_WeldInformation.FirstOrDefault(s => s.WeldingId == oldTrustItem.WeldingId);
|
|||
|
if (weldtion != null)
|
|||
|
{
|
|||
|
weldtion.RT_FilmNum = filmNum;
|
|||
|
weldtion.R_Material = weldtion.R_Material == null ? rMatNum : weldtion.R_Material + rMatNum;
|
|||
|
}
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var trust1 = Funs.DB.PV_TestMethod.FirstOrDefault(s => s.Ndt_Id == oldTrustItem.NdtId);
|
|||
|
if (b)
|
|||
|
{
|
|||
|
//1:待检测 2:检测合格 3:待重检 4:待返修
|
|||
|
oldTrustItem.DetectionStatus = needRemake ? 3 : 2;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//待返修
|
|||
|
oldTrustItem.DetectionStatus = 4;
|
|||
|
}
|
|||
|
oldTrustItem.FeedbackPeople = this.CurrUser.UserName;
|
|||
|
oldTrustItem.FeedbackData = DateTime.Now;
|
|||
|
}
|
|||
|
changeId = methodId;
|
|||
|
b = true;
|
|||
|
needRemake = false;
|
|||
|
|
|||
|
filmNum = 0;
|
|||
|
rMatNum = 0;
|
|||
|
}
|
|||
|
|
|||
|
var trustItem = Funs.DB.PV_ManagementMethod.FirstOrDefault(s => s.MethodId == methodId);
|
|||
|
if (this.drpEquipment.SelectedValue != "null")
|
|||
|
{
|
|||
|
trustItem.EquipmentId = this.drpEquipment.SelectedValue;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtShootMan.Text))
|
|||
|
{
|
|||
|
trustItem.ShootMan = this.txtShootMan.Text.Trim();
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtShootDate.Text))
|
|||
|
{
|
|||
|
trustItem.ShootDate = Convert.ToDateTime(this.txtShootDate.Text);
|
|||
|
}
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(s => s.Id == trustItem.EntrustId);
|
|||
|
|
|||
|
var jot = Funs.DB.PV_WeldInformation.FirstOrDefault(s => s.WeldingId == trustItem.WeldingId);
|
|||
|
var newQualityRating = new PV_BO_QualityRating();
|
|||
|
newQualityRating.MethodId = methodId;
|
|||
|
newQualityRating.FirstMethodId = methodId;
|
|||
|
if (!string.IsNullOrEmpty(trustItem.WeldingId))
|
|||
|
{
|
|||
|
newQualityRating.WeldingId = trustItem.WeldingId;
|
|||
|
}
|
|||
|
newQualityRating.Remake = Convert.ToBoolean(values.Value<string>("Remake"));
|
|||
|
newQualityRating.RemakeResult = values.Value<string>("RemakeResult");
|
|||
|
if (Grid1.Columns[4].Hidden == true)
|
|||
|
{
|
|||
|
newQualityRating.FilmNum = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newQualityRating.FilmNum = values.Value<string>("FilmNum");
|
|||
|
}
|
|||
|
newQualityRating.RepairTag = values.Value<string>("RepairTag");
|
|||
|
newQualityRating.RMaterial = Convert.ToBoolean(values.Value<string>("RMaterial"));
|
|||
|
newQualityRating.Cack = Convert.ToBoolean(values.Value<string>("Cack"));
|
|||
|
newQualityRating.NotFusion = Convert.ToBoolean(values.Value<string>("NotFusion"));
|
|||
|
newQualityRating.NotPenetration = Convert.ToBoolean(values.Value<string>("NotPenetration"));
|
|||
|
newQualityRating.StripDefects = Convert.ToBoolean(values.Value<string>("StripDefects"));
|
|||
|
newQualityRating.CircularDefects = Convert.ToBoolean(values.Value<string>("CircularDefects"));
|
|||
|
newQualityRating.DeepHoleDefects = Convert.ToBoolean(values.Value<string>("DeepHoleDefects"));
|
|||
|
newQualityRating.RootsConcave = Convert.ToBoolean(values.Value<string>("RootsConcave"));
|
|||
|
newQualityRating.RootsBiteEdge = Convert.ToBoolean(values.Value<string>("RootsBiteEdge"));
|
|||
|
newQualityRating.PseudoDefects = Convert.ToBoolean(values.Value<string>("PseudoDefects"));
|
|||
|
newQualityRating.DefectLength = values.Value<string>("DefectLength");
|
|||
|
newQualityRating.DefectResult = values.Value<string>("DefectResult");
|
|||
|
newQualityRating.DefectRation = values.Value<string>("DefectRation");
|
|||
|
newQualityRating.SignDate = Funs.GetNewDateTime(values.Value<string>("SignDate"));
|
|||
|
newQualityRating.Remark = values.Value<string>("Remark");
|
|||
|
newQualityRating.DetectLength = Funs.GetNewDecimal(values.Value<string>("DetectLength"));
|
|||
|
newQualityRating.PeakAmplitude = values.Value<string>("PeakAmplitude");
|
|||
|
newQualityRating.DefectLocation = values.Value<string>("DefectLocation");
|
|||
|
newQualityRating.DepthDefect = Funs.GetNewDecimal(values.Value<string>("DepthDefect"));
|
|||
|
newQualityRating.IndicatingLength = Funs.GetNewDecimal(values.Value<string>("IndicatingLength"));
|
|||
|
newQualityRating.DefectHeight = Funs.GetNewDecimal(values.Value<string>("DefectHeight"));
|
|||
|
newQualityRating.DefectsHighSide = Funs.GetNewDecimal(values.Value<string>("DefectsHighSide"));
|
|||
|
newQualityRating.DefectSize = Funs.GetNewDecimal(values.Value<string>("DefectSize"));
|
|||
|
|
|||
|
newQualityRating.DefectNature = values.Value<string>("DefectNature");
|
|||
|
if (values.Value<string>("IsPass") == "不合格")
|
|||
|
{
|
|||
|
b = false;
|
|||
|
}
|
|||
|
if (Convert.ToBoolean(values.Value<string>("Remake")))
|
|||
|
{
|
|||
|
needRemake = true;
|
|||
|
}
|
|||
|
newQualityRating.IsPass = values.Value<string>("IsPass");
|
|||
|
this.QualityRatingId = values.Value<string>("QualityRatingId");
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndtModel = Funs.DB.PV_TestMethod.FirstOrDefault(s => s.Ndt_Id == trust.NdtId);
|
|||
|
|
|||
|
if (ndtModel.Ndt_NdtCode.Contains("RT"))//RT检测,评定结果不为空才保存拍片记录
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(newQualityRating.DefectResult))
|
|||
|
{
|
|||
|
filmNum++;
|
|||
|
if (newQualityRating.RMaterial == true)
|
|||
|
{
|
|||
|
rMatNum++;
|
|||
|
}
|
|||
|
var quatlityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(s => s.QualityRatingId == this.QualityRatingId);
|
|||
|
if (quatlityRating == null)
|
|||
|
{
|
|||
|
newQualityRating.QualityRatingId = this.QualityRatingId;
|
|||
|
Funs.DB.PV_BO_QualityRating.InsertOnSubmit(newQualityRating);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newQualityRating.RemakeResult = quatlityRating.RemakeResult;
|
|||
|
newQualityRating.QualityRatingId = this.QualityRatingId;
|
|||
|
UpadteQualityRating(newQualityRating);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var quatlityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(s => s.QualityRatingId == this.QualityRatingId);
|
|||
|
if (quatlityRating == null)
|
|||
|
{
|
|||
|
newQualityRating.QualityRatingId = this.QualityRatingId;
|
|||
|
Funs.DB.PV_BO_QualityRating.InsertOnSubmit(newQualityRating);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newQualityRating.RemakeResult = quatlityRating.RemakeResult;
|
|||
|
newQualityRating.QualityRatingId = this.QualityRatingId;
|
|||
|
UpadteQualityRating(newQualityRating);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 有焊口增加的,对应的检测报告打印要变成未打印状态
|
|||
|
var p = from x in Funs.DB.PV_CH_TestingReportPrint
|
|||
|
where x.WeldingId == jot.WeldingId
|
|||
|
&& x.NdtId == trust.NdtId && x.EntrustId == trust.Id
|
|||
|
select x;
|
|||
|
if (p.Count() > 0)
|
|||
|
{
|
|||
|
var report = Funs.DB.PV_CH_TestingReportPrint.FirstOrDefault(x => x.TestingReportPrintId == p.First().TestingReportPrintId);
|
|||
|
report.Printer = null;
|
|||
|
report.PrintTime = null;
|
|||
|
}
|
|||
|
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
//更新列表最后一个口的数据
|
|||
|
if (!string.IsNullOrEmpty(changeId))
|
|||
|
{
|
|||
|
var oldTrustItem1 = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.MethodId == changeId);
|
|||
|
var trust1 = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == oldTrustItem1.EntrustId);
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndtModel = Funs.DB.PV_TestMethod.FirstOrDefault(s => s.Ndt_Id == trust1.NdtId);
|
|||
|
if (b)
|
|||
|
{
|
|||
|
//1:待检测 2:检测合格 3:待重检 4:待返修
|
|||
|
oldTrustItem1.DetectionStatus = needRemake ? 3 : 2;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
oldTrustItem1.DetectionStatus = 4; //待返修
|
|||
|
}
|
|||
|
oldTrustItem1.FeedbackPeople = this.CurrUser.UserName;
|
|||
|
oldTrustItem1.FeedbackData = DateTime.Now;
|
|||
|
|
|||
|
//回写返修信息表
|
|||
|
var weldtion = Funs.DB.PV_WeldInformation.FirstOrDefault(s => s.WeldingId == oldTrustItem1.WeldingId);
|
|||
|
if (weldtion != null)
|
|||
|
{
|
|||
|
weldtion.R_Material = weldtion.R_Material == null ? rMatNum : weldtion.R_Material + rMatNum;
|
|||
|
var detectionStatusName = oldTrustItem1.DetectionStatus == 1 ? "待检测" : oldTrustItem1.DetectionStatus == 2 ? "检测合格" : oldTrustItem1.DetectionStatus == 3 ? "待重检" : oldTrustItem1.DetectionStatus == 4 ? "待返修" : "";
|
|||
|
if (ndtModel.Ndt_NdtCode == "RT")
|
|||
|
{
|
|||
|
weldtion.RT_TrustDate = oldTrustItem1.EntrustData;
|
|||
|
weldtion.RT_States = detectionStatusName;
|
|||
|
weldtion.RT_TrustCode = oldTrustItem1.EntrustCode;
|
|||
|
weldtion.RTFeedbackDate = DateTime.Now;
|
|||
|
weldtion.RT_FilmNum = filmNum;
|
|||
|
}
|
|||
|
if (ndtModel.Ndt_NdtCode == "PT")
|
|||
|
{
|
|||
|
weldtion.PT_TrustCode = oldTrustItem1.EntrustCode;
|
|||
|
weldtion.PT_TrustDate = oldTrustItem1.EntrustData;
|
|||
|
weldtion.PT_States = detectionStatusName;
|
|||
|
}
|
|||
|
if (ndtModel.Ndt_NdtCode == "UT")
|
|||
|
{
|
|||
|
weldtion.UT_TrustCode = oldTrustItem1.EntrustCode;
|
|||
|
weldtion.UT_TrustDate = oldTrustItem1.EntrustData;
|
|||
|
weldtion.UT_States = detectionStatusName;
|
|||
|
}
|
|||
|
if (ndtModel.Ndt_NdtCode == "PAUT")
|
|||
|
{
|
|||
|
weldtion.PAUT_TrustCode = oldTrustItem1.EntrustCode;
|
|||
|
weldtion.PAUT_TrustDate = oldTrustItem1.EntrustData;
|
|||
|
weldtion.PAUT_States = detectionStatusName;
|
|||
|
}
|
|||
|
if (ndtModel.Ndt_NdtCode == "TOFD")
|
|||
|
{
|
|||
|
weldtion.TOFD_TrustCode = oldTrustItem1.EntrustCode;
|
|||
|
weldtion.TOFD_TrustDate = oldTrustItem1.EntrustData;
|
|||
|
weldtion.TOFD_States = detectionStatusName;
|
|||
|
}
|
|||
|
if (ndtModel.Ndt_NdtCode == "MT")
|
|||
|
{
|
|||
|
weldtion.MT_TrustCode = oldTrustItem1.EntrustCode;
|
|||
|
weldtion.MT_TrustDate = oldTrustItem1.EntrustData;
|
|||
|
weldtion.MT_States = detectionStatusName;
|
|||
|
}
|
|||
|
}
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
// 删除现有数据
|
|||
|
List<int> deletedRows = Grid1.GetDeletedList();
|
|||
|
foreach (int rowIndex in deletedRows)
|
|||
|
{
|
|||
|
string qualityRatingId = Grid1.DataKeys[rowIndex][0].ToString();
|
|||
|
var delQualityModel = Funs.DB.PV_BO_QualityRating.FirstOrDefault(e => e.QualityRatingId == qualityRatingId);
|
|||
|
Funs.DB.PV_BO_QualityRating.DeleteOnSubmit(delQualityModel);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改检测
|
|||
|
/// </summary>
|
|||
|
private void SubmitQualityRating(string qualityRatingId)
|
|||
|
{
|
|||
|
string changeId = string.Empty;
|
|||
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|||
|
{
|
|||
|
|
|||
|
JObject values = mergedRow.Value<JObject>("values");
|
|||
|
string MethodId = values.Value<string>("MethodId");
|
|||
|
string qId = values.Value<string>("QualityRatingId");
|
|||
|
if (qId == qualityRatingId)
|
|||
|
{
|
|||
|
var trustItem = Funs.DB.PV_ManagementMethod.FirstOrDefault(e => e.MethodId == MethodId);
|
|||
|
if (this.drpEquipment.SelectedValue != "null")
|
|||
|
{
|
|||
|
trustItem.EquipmentId = this.drpEquipment.SelectedValue;
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtShootMan.Text))
|
|||
|
{
|
|||
|
trustItem.ShootMan = this.txtShootMan.Text.Trim();
|
|||
|
}
|
|||
|
if (!string.IsNullOrEmpty(this.txtShootDate.Text))
|
|||
|
{
|
|||
|
trustItem.ShootDate = Convert.ToDateTime(this.txtShootDate.Text);
|
|||
|
}
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
|
|||
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == trustItem.EntrustId);
|
|||
|
var newQualityRating = new Model.PV_BO_QualityRating();
|
|||
|
|
|||
|
newQualityRating.MethodId = MethodId;
|
|||
|
if (!string.IsNullOrEmpty(trustItem.WeldingId))
|
|||
|
{
|
|||
|
newQualityRating.WeldingId = trustItem.WeldingId;
|
|||
|
}
|
|||
|
newQualityRating.Remake = Convert.ToBoolean(values.Value<string>("Remake"));
|
|||
|
newQualityRating.RemakeResult = values.Value<string>("RemakeResult");
|
|||
|
if (Grid1.Columns[4].Hidden == true)
|
|||
|
{
|
|||
|
newQualityRating.FilmNum = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
newQualityRating.FilmNum = values.Value<string>("FilmNum");
|
|||
|
}
|
|||
|
newQualityRating.RepairTag = values.Value<string>("RepairTag");
|
|||
|
newQualityRating.RMaterial = Convert.ToBoolean(values.Value<string>("RMaterial"));
|
|||
|
newQualityRating.Cack = Convert.ToBoolean(values.Value<string>("Cack"));
|
|||
|
newQualityRating.NotFusion = Convert.ToBoolean(values.Value<string>("NotFusion"));
|
|||
|
newQualityRating.NotPenetration = Convert.ToBoolean(values.Value<string>("NotPenetration"));
|
|||
|
newQualityRating.StripDefects = Convert.ToBoolean(values.Value<string>("StripDefects"));
|
|||
|
newQualityRating.CircularDefects = Convert.ToBoolean(values.Value<string>("CircularDefects"));
|
|||
|
newQualityRating.DeepHoleDefects = Convert.ToBoolean(values.Value<string>("DeepHoleDefects"));
|
|||
|
newQualityRating.RootsConcave = Convert.ToBoolean(values.Value<string>("RootsConcave"));
|
|||
|
newQualityRating.RootsBiteEdge = Convert.ToBoolean(values.Value<string>("RootsBiteEdge"));
|
|||
|
newQualityRating.PseudoDefects = Convert.ToBoolean(values.Value<string>("PseudoDefects"));
|
|||
|
newQualityRating.DefectLength = values.Value<string>("DefectLength");
|
|||
|
newQualityRating.DefectResult = values.Value<string>("DefectResult");
|
|||
|
newQualityRating.DefectRation = values.Value<string>("DefectRation");
|
|||
|
newQualityRating.SignDate = Funs.GetNewDateTime(values.Value<string>("SignDate"));
|
|||
|
newQualityRating.Remark = values.Value<string>("Remark");
|
|||
|
|
|||
|
newQualityRating.DetectLength = Funs.GetNewDecimal(values.Value<string>("DetectLength"));
|
|||
|
newQualityRating.PeakAmplitude = values.Value<string>("PeakAmplitude");
|
|||
|
newQualityRating.DefectLocation = values.Value<string>("DefectLocation");
|
|||
|
newQualityRating.DepthDefect = Funs.GetNewDecimal(values.Value<string>("DepthDefect"));
|
|||
|
newQualityRating.IndicatingLength = Funs.GetNewDecimal(values.Value<string>("IndicatingLength"));
|
|||
|
newQualityRating.DefectHeight = Funs.GetNewDecimal(values.Value<string>("DefectHeight"));
|
|||
|
newQualityRating.DefectsHighSide = Funs.GetNewDecimal(values.Value<string>("DefectsHighSide"));
|
|||
|
newQualityRating.DefectSize = Funs.GetNewDecimal(values.Value<string>("DefectSize"));
|
|||
|
|
|||
|
newQualityRating.DefectNature = values.Value<string>("DefectNature");
|
|||
|
newQualityRating.IsPass = values.Value<string>("IsPass");
|
|||
|
this.QualityRatingId = values.Value<string>("QualityRatingId");
|
|||
|
|
|||
|
|
|||
|
|
|||
|
var quatlityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(e => e.QualityRatingId == qualityRatingId);
|
|||
|
if (quatlityRating == null)
|
|||
|
{
|
|||
|
newQualityRating.QualityRatingId = this.QualityRatingId;
|
|||
|
Funs.DB.PV_BO_QualityRating.InsertOnSubmit(newQualityRating);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var oldQualityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(e => e.QualityRatingId == this.QualityRatingId);
|
|||
|
if (oldQualityRating != null)
|
|||
|
{
|
|||
|
newQualityRating.RemakeResult = oldQualityRating.RemakeResult;
|
|||
|
}
|
|||
|
newQualityRating.QualityRatingId = this.QualityRatingId;
|
|||
|
}
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 生成返修通知单
|
|||
|
/// </summary>
|
|||
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
bool isExitNotOKItem = false; //是否存在不合格项
|
|||
|
var qualityRatingLists = new List<PV_BO_QualityRating>();
|
|||
|
var methodIds = from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join j in Funs.DB.PV_WeldInformation on x.WeldingId equals j.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && j.WeldingId == this.WeldingId
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
select x.MethodId;
|
|||
|
|
|||
|
//添加返修通知单信息
|
|||
|
foreach (var itemMethodId in methodIds)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(itemMethodId))
|
|||
|
{
|
|||
|
var trustItem = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.MethodId == itemMethodId);
|
|||
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == trustItem.EntrustId);
|
|||
|
//检测方法是选择的 Ndt_Id 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == trust.NdtId);
|
|||
|
|
|||
|
string defectNatures = string.Empty;
|
|||
|
qualityRatingLists = Funs.DB.PV_BO_QualityRating.Where(p => p.MethodId == itemMethodId && p.IsPass == "不合格").ToList();
|
|||
|
if (qualityRatingLists.Count > 0)
|
|||
|
{
|
|||
|
//添加返修通知单信息
|
|||
|
isExitNotOKItem = true;
|
|||
|
foreach (var item in qualityRatingLists)
|
|||
|
{
|
|||
|
var oldRepairItemRecord = (from x in Funs.DB.PV_CH_RepairItemRecord
|
|||
|
where x.WeldingId == item.WeldingId && x.MethodId == item.MethodId && x.FilmNum == item.FilmNum
|
|||
|
select x).FirstOrDefault();
|
|||
|
if (oldRepairItemRecord == null)
|
|||
|
{
|
|||
|
if (ndt != null && ndt.Ndt_NdtCode.Contains("RT"))
|
|||
|
{
|
|||
|
if (item.RMaterial == true)
|
|||
|
{
|
|||
|
defectNatures += "R母材,";
|
|||
|
}
|
|||
|
if (item.Cack == true)
|
|||
|
{
|
|||
|
defectNatures += "裂纹,";
|
|||
|
}
|
|||
|
if (item.NotFusion == true)
|
|||
|
{
|
|||
|
defectNatures += "未熔合,";
|
|||
|
}
|
|||
|
if (item.NotPenetration == true)
|
|||
|
{
|
|||
|
defectNatures += "未焊透,";
|
|||
|
}
|
|||
|
if (item.StripDefects == true)
|
|||
|
{
|
|||
|
defectNatures += "条状缺陷,";
|
|||
|
}
|
|||
|
if (item.CircularDefects == true)
|
|||
|
{
|
|||
|
defectNatures += "圆形缺陷,";
|
|||
|
}
|
|||
|
if (item.DeepHoleDefects == true)
|
|||
|
{
|
|||
|
defectNatures += "深孔缺陷,";
|
|||
|
}
|
|||
|
if (item.RootsConcave == true)
|
|||
|
{
|
|||
|
defectNatures += "根部内凹,";
|
|||
|
}
|
|||
|
if (item.RootsBiteEdge == true)
|
|||
|
{
|
|||
|
defectNatures += "根部咬边,";
|
|||
|
}
|
|||
|
if (item.PseudoDefects == true)
|
|||
|
{
|
|||
|
defectNatures += "伪缺陷,";
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(item.DefectNature))
|
|||
|
{
|
|||
|
defectNatures = "缺陷性质:" + item.DefectNature + ",";
|
|||
|
}
|
|||
|
if (item.DefectLocation != null)
|
|||
|
{
|
|||
|
defectNatures = defectNatures + "缺陷位置:" + item.DefectLocation + ",";
|
|||
|
}
|
|||
|
if (item.DefectSize != null)
|
|||
|
{
|
|||
|
defectNatures = defectNatures + "缺陷尺寸:" + item.DefectSize + ",";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(defectNatures))
|
|||
|
{
|
|||
|
defectNatures = defectNatures.Substring(0, defectNatures.LastIndexOf(","));
|
|||
|
}
|
|||
|
|
|||
|
PV_CH_RepairItemRecord newRepairItemRecord = new PV_CH_RepairItemRecord();
|
|||
|
newRepairItemRecord.RepairItemRecordId = SQLHelper.GetNewID(typeof(PV_CH_RepairItemRecord));
|
|||
|
newRepairItemRecord.QualityRatingId = item.QualityRatingId;
|
|||
|
newRepairItemRecord.RepairNum = 1;
|
|||
|
newRepairItemRecord.FirstRepairItemRecordId = newRepairItemRecord.RepairItemRecordId;
|
|||
|
newRepairItemRecord.ProjectId = trust.ProjectId;
|
|||
|
newRepairItemRecord.WeldingId = trustItem.WeldingId;
|
|||
|
newRepairItemRecord.FilmNum = item.FilmNum;
|
|||
|
newRepairItemRecord.DefectNature = defectNatures;
|
|||
|
newRepairItemRecord.DefectResult = item.DefectResult;
|
|||
|
newRepairItemRecord.MethodId = trustItem.MethodId;
|
|||
|
newRepairItemRecord.EntrustId = trust.Id;
|
|||
|
newRepairItemRecord.EntrustCode = trust.EntrustCode;
|
|||
|
newRepairItemRecord.RepairMark = "R1";
|
|||
|
newRepairItemRecord.FeedbackDate = DateTime.Now;
|
|||
|
newRepairItemRecord.NdtId = trust.NdtId;
|
|||
|
newRepairItemRecord.SignMan = this.CurrUser.UserName;
|
|||
|
newRepairItemRecord.SignDate = DateTime.Now;
|
|||
|
Funs.DB.PV_CH_RepairItemRecord.InsertOnSubmit(newRepairItemRecord);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
defectNatures = string.Empty;
|
|||
|
}
|
|||
|
}
|
|||
|
trustItem.ReportNoticeDate = DateTime.Now;
|
|||
|
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (isExitNotOKItem)
|
|||
|
{
|
|||
|
if (qualityRatingLists.Count > 0)
|
|||
|
{
|
|||
|
var quality = qualityRatingLists.FirstOrDefault();
|
|||
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == quality.WeldingId);
|
|||
|
if (weld != null)
|
|||
|
{
|
|||
|
//添加热处理不合格信息
|
|||
|
if (Funs.DB.PV_CH_AgainHotInfo.Count(p => p.WeldingId == quality.WeldingId && p.IsHotProessTrust == false) == 0)
|
|||
|
{
|
|||
|
var again = new PV_CH_AgainHotInfo();
|
|||
|
again.AgainId = Guid.NewGuid().ToString();
|
|||
|
again.ProjectId = weld.ProjectId;
|
|||
|
again.WeldingId = weld.WeldingId;
|
|||
|
again.TrustType = 2;
|
|||
|
again.RepairNum = Funs.DB.PV_CH_AgainHotInfo.Count(p => p.WeldingId == quality.WeldingId) + 1;
|
|||
|
again.IsHotProessTrust = false;
|
|||
|
Funs.DB.PV_CH_AgainHotInfo.InsertOnSubmit(again);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
Alert.ShowInTop("成功生成返修通知单!", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("无不合格的项,请提交!", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
var repairItem = from x in Funs.DB.PV_CH_RepairItemRecord
|
|||
|
join y in Funs.DB.PV_WeldInformation on x.WeldingId equals y.WeldingId
|
|||
|
where methodIds.Contains(x.MethodId)
|
|||
|
select new { x.RepairItemRecordId, y.WeldingCode, x.MethodId, x.FilmNum, x.DefectNature, y.WeldingId };
|
|||
|
Grid2.DataSource = repairItem;
|
|||
|
Grid2.DataBind();
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 增行
|
|||
|
/// <summary>
|
|||
|
/// 增行按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnNew_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
GetAddRow();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 增行方法
|
|||
|
/// </summary>
|
|||
|
private void GetAddRow()
|
|||
|
{
|
|||
|
string deleteScript = GetDeleteScript();
|
|||
|
|
|||
|
//// 新增数据初始值
|
|||
|
JObject defaultObj = new JObject();
|
|||
|
string MethodId = this.drpJointNo.SelectedValue;
|
|||
|
var trustDetail = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.MethodId == MethodId);//BLL.HJGL_TrustManageEditService.GetCH_TrustItemById(cH_TrustItemID);
|
|||
|
|
|||
|
if (trustDetail != null)
|
|||
|
{
|
|||
|
defaultObj.Add("MethodId", MethodId);
|
|||
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == trustDetail.EntrustId); //BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustDetail.CH_TrustID);
|
|||
|
|
|||
|
if (trust != null)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(trust.ProjectId))
|
|||
|
{
|
|||
|
var project = BLL.Base_ProjectService.GetProjectByProjectId(trust.ProjectId);
|
|||
|
if (project != null)
|
|||
|
{
|
|||
|
defaultObj.Add("ProjectCode", project.ProjectCode);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(trustDetail.WeldingId))
|
|||
|
{
|
|||
|
var jot = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == trustDetail.WeldingId);
|
|||
|
if (jot != null)
|
|||
|
{
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == trustDetail.NdtId);
|
|||
|
defaultObj.Add("WeldingCode", jot.WeldingCode);
|
|||
|
defaultObj.Add("MethodLevel", ndt.Ndt_Level);
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(jot.BackingWelderId) || !string.IsNullOrEmpty(jot.CoverWelderId))
|
|||
|
{
|
|||
|
var welderIds = string.Format("{0},{1}", jot.BackingWelderId, jot.CoverWelderId).Split(',').ToList();
|
|||
|
welderIds.Remove("");
|
|||
|
var welders = Funs.DB.HJGL_BS_Welder.Where(x => welderIds.Contains(x.WED_ID)).ToList();
|
|||
|
if (welders.Count > 0)
|
|||
|
{
|
|||
|
defaultObj.Add("WedCode", string.Join(",", welders.ConvertAll(p => p.WED_Code)));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//底片编号按ABC自增长
|
|||
|
if (Grid1.GetMergedData().Count > 0)
|
|||
|
{
|
|||
|
string fileNum = string.Empty;
|
|||
|
List<string> flimNums = new List<string>();
|
|||
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|||
|
{
|
|||
|
string fn = string.Empty;
|
|||
|
JObject values = mergedRow.Value<JObject>("values");
|
|||
|
fn = values.Value<string>("FilmNum");
|
|||
|
flimNums.Add(fn);
|
|||
|
flimNums.Sort();
|
|||
|
}
|
|||
|
//foreach (var item in flimNums)
|
|||
|
//{
|
|||
|
// fileNum = item;
|
|||
|
//}
|
|||
|
fileNum = flimNums.LastOrDefault();
|
|||
|
if (!string.IsNullOrEmpty(fileNum))
|
|||
|
{
|
|||
|
string nextFilmNum = Convert.ToChar(Convert.ToInt16(fileNum.ToCharArray()[0]) + 1).ToString();
|
|||
|
defaultObj.Add("FilmNum", nextFilmNum);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
defaultObj.Add("FilmNum", "A");
|
|||
|
}
|
|||
|
//如果有缺陷默认返修R1
|
|||
|
bool rMaterial = Convert.ToBoolean(defaultObj.Value<string>("RMaterial"));
|
|||
|
bool cack = Convert.ToBoolean(defaultObj.Value<string>("Cack"));
|
|||
|
bool notFusion = Convert.ToBoolean(defaultObj.Value<string>("NotFusion"));
|
|||
|
bool notPenetration = Convert.ToBoolean(defaultObj.Value<string>("NotPenetration"));
|
|||
|
bool stripDefects = Convert.ToBoolean(defaultObj.Value<string>("StripDefects"));
|
|||
|
bool circularDefects = Convert.ToBoolean(defaultObj.Value<string>("CircularDefects"));
|
|||
|
bool depHoleDefects = Convert.ToBoolean(defaultObj.Value<string>("DeepHoleDefects"));
|
|||
|
bool rootsConcave = Convert.ToBoolean(defaultObj.Value<string>("RootsConcave"));
|
|||
|
bool rootsBiteEdge = Convert.ToBoolean(defaultObj.Value<string>("RootsBiteEdge"));
|
|||
|
bool pseudoDefects = Convert.ToBoolean(defaultObj.Value<string>("PseudoDefects"));
|
|||
|
if (rMaterial || cack || notFusion || notPenetration || stripDefects || circularDefects || depHoleDefects || rootsConcave || rootsBiteEdge || pseudoDefects)
|
|||
|
{
|
|||
|
defaultObj.Add("RepairTag", "R1");
|
|||
|
}
|
|||
|
|
|||
|
defaultObj.Add("SignMan", this.CurrUser.UserName);
|
|||
|
defaultObj.Add("SignDate", DateTime.Now);
|
|||
|
defaultObj.Add("IsPass", "合格");
|
|||
|
this.QualityRatingId = SQLHelper.GetNewID(typeof(PV_BO_QualityRating));//SQLHelper.GetNewID(typeof(Model.HJGL_BO_QualityRating));
|
|||
|
defaultObj.Add("QualityRatingId", this.QualityRatingId);
|
|||
|
defaultObj.Add("Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)));
|
|||
|
|
|||
|
string remakeReasonScript = GetRemakeReasonScript(this.QualityRatingId);
|
|||
|
defaultObj.Add("RemakeResultEdit", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", remakeReasonScript, IconHelper.GetResolvedIconUrl(Icon.Pencil)));
|
|||
|
|
|||
|
// 在第一行新增一条数据
|
|||
|
Grid1.AddNewRecord(defaultObj, true);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 默认加载底片方法
|
|||
|
/// </summary>
|
|||
|
private void GetDefaultAddRow(int rowNum, string methodId)
|
|||
|
{
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
var ndtModel = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == this.NdtId);
|
|||
|
|
|||
|
string deleteScript = GetDeleteScript();
|
|||
|
var trustDetail = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.MethodId == methodId);//BLL.HJGL_TrustManageEditService.GetCH_TrustItemById(cH_TrustItemID);
|
|||
|
string projectCode = string.Empty;
|
|||
|
string isoNo = string.Empty;
|
|||
|
string jointNo = string.Empty;
|
|||
|
string qualifiedLevel = string.Empty;
|
|||
|
string wedCode = string.Empty;
|
|||
|
string ndtCode = string.Empty;
|
|||
|
if (trustDetail != null)
|
|||
|
{
|
|||
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == trustDetail.EntrustId);//BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustDetail.CH_TrustID);
|
|||
|
|
|||
|
var ndt = new PV_TestMethod();
|
|||
|
|
|||
|
if (trust != null)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(trust.ProjectId))
|
|||
|
{
|
|||
|
var project = BLL.Base_ProjectService.GetProjectByProjectId(trust.ProjectId);
|
|||
|
if (project != null)
|
|||
|
{
|
|||
|
projectCode = project.ProjectCode;
|
|||
|
}
|
|||
|
}
|
|||
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|||
|
ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == trust.NdtId);//BLL.HJGL_TestingService.GetTestingByTestingId(trust.CH_NDTMethod);
|
|||
|
if (ndt != null)
|
|||
|
{
|
|||
|
ndtCode = ndt.Ndt_NdtCode;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(trustDetail.WeldingId))
|
|||
|
{
|
|||
|
var jot = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == trustDetail.WeldingId); //BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustDetail.JOT_ID);
|
|||
|
if (jot != null)
|
|||
|
{
|
|||
|
//if (!string.IsNullOrEmpty(jot.ISO_ID))
|
|||
|
//{
|
|||
|
// var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(jot.ISO_ID);
|
|||
|
// if (iso != null)
|
|||
|
// {
|
|||
|
// isoNo = iso.ISO_IsoNo;
|
|||
|
// }
|
|||
|
//}//管线号不需要了
|
|||
|
|
|||
|
jointNo = jot.WeldingCode;
|
|||
|
qualifiedLevel = ndt.Ndt_Level;
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(jot.BackingWelderId))
|
|||
|
{
|
|||
|
List<string> wedIds = jot.BackingWelderId.Split(',').ToList();
|
|||
|
var welder = Funs.DB.HJGL_BS_Welder.Where(p => wedIds.Contains(p.WED_ID)).ToList(); //BLL.HJGL_PersonManageService.GetWelderByWenId(jot.JOT_CellWelder);
|
|||
|
if (welder.Count > 0)
|
|||
|
{
|
|||
|
wedCode = string.Join(",", welder.ConvertAll(p => p.WED_Code));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
for (int i = 0; i < rowNum; i++)
|
|||
|
{
|
|||
|
string nextFilmNum = string.Empty;
|
|||
|
if (i == 0)
|
|||
|
{
|
|||
|
nextFilmNum = "A";
|
|||
|
}
|
|||
|
if (i == 1)
|
|||
|
{
|
|||
|
nextFilmNum = "B";
|
|||
|
}
|
|||
|
if (i == 2)
|
|||
|
{
|
|||
|
nextFilmNum = "C";
|
|||
|
}
|
|||
|
if (i == 3)
|
|||
|
{
|
|||
|
nextFilmNum = "D";
|
|||
|
}
|
|||
|
if (i == 4)
|
|||
|
{
|
|||
|
nextFilmNum = "E";
|
|||
|
}
|
|||
|
if (i == 5)
|
|||
|
{
|
|||
|
nextFilmNum = "F";
|
|||
|
}
|
|||
|
PV_QualityRatingItem qualityRating = new PV_QualityRatingItem();
|
|||
|
qualityRating.ProjectCode = projectCode;
|
|||
|
//qualityRating.ISO_IsoNo = isoNo;
|
|||
|
qualityRating.MethodLevel = qualifiedLevel;
|
|||
|
qualityRating.WeldingCode = jointNo;
|
|||
|
qualityRating.WedCode = wedCode;
|
|||
|
if (ndtModel.Ndt_NdtCode == "PAUT" || ndtModel.Ndt_NdtCode == "TOFD")
|
|||
|
{
|
|||
|
qualityRating.FilmNum = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
qualityRating.FilmNum = nextFilmNum;
|
|||
|
}
|
|||
|
qualityRating.SignMan = this.CurrUser.UserName;
|
|||
|
qualityRating.SignDate = DateTime.Now;
|
|||
|
if (rowNum > 1) //RT
|
|||
|
{
|
|||
|
qualityRating.IsPass = string.Empty;
|
|||
|
}
|
|||
|
else //非RT
|
|||
|
{
|
|||
|
if (ndtCode == "PAUT" || ndtCode == "TOFD")
|
|||
|
{
|
|||
|
qualityRating.IsPass = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
qualityRating.IsPass = "合格";
|
|||
|
}
|
|||
|
}
|
|||
|
if (rowNum == 1)
|
|||
|
{
|
|||
|
if (ndtCode == "PAUT" || ndtCode == "TOFD")
|
|||
|
{
|
|||
|
qualityRating.DefectResult = null;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
qualityRating.DefectResult = "I";
|
|||
|
}
|
|||
|
}
|
|||
|
qualityRating.MethodId = methodId;
|
|||
|
qualityRating.QualityRatingId = SQLHelper.GetNewID(typeof(PV_BO_QualityRating));
|
|||
|
qualityRatings.Add(qualityRating);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 关闭窗口
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 关闭窗口
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Window1_Close(object sender, EventArgs e)
|
|||
|
{
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 弹出重拍编辑页面
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 弹出重拍编辑页面
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
private string GetRemakeReasonScript(string id)
|
|||
|
{
|
|||
|
return Window2.GetShowReference(String.Format("RemakeReasonEdit.aspx?qualityRatingId={0}&shootMan={1}", id, this.txtShootMan.Text, "编辑 - "));
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
#region Grid行点击事件
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Grid行点击事件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|||
|
{
|
|||
|
string qualityRatingId = Grid1.DataKeys[e.RowIndex][0].ToString();
|
|||
|
if (e.CommandName == "edit")
|
|||
|
{
|
|||
|
SubmitQualityRating(qualityRatingId);
|
|||
|
|
|||
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("RemakeReasonEdit.aspx?QualityRatingId={0}", qualityRatingId, "编辑 - ")));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 查询
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
|||
|
{
|
|||
|
var joints = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && a.WeldingId == this.WeldingId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId select z).Count() == 0
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
orderby a.WeldingCode
|
|||
|
select new { x.MethodId, a.WeldingCode }).Distinct();
|
|||
|
this.drpJointNo.DataSource = joints;
|
|||
|
this.drpJointNo.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|||
|
}
|
|||
|
else if (this.rblIsFilm.SelectedValue == "1") //已拍片
|
|||
|
{
|
|||
|
var joints = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && a.WeldingId == this.WeldingId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.MethodId select z).Count() > 0
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
orderby a.WeldingCode
|
|||
|
select new { x.MethodId, a.WeldingCode }).Distinct();
|
|||
|
this.drpJointNo.DataSource = joints;
|
|||
|
this.drpJointNo.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var joints = (from x in Funs.DB.PV_ManagementMethod
|
|||
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|||
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|||
|
where y.EntrustCode == this.EntrustCode && a.WeldingId == WeldingId
|
|||
|
&& y.NdtId == this.NdtId
|
|||
|
orderby a.WeldingCode
|
|||
|
select new { x.MethodId, a.WeldingCode }).Distinct();
|
|||
|
this.drpJointNo.DataSource = joints;
|
|||
|
this.drpJointNo.DataBind();
|
|||
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|||
|
}
|
|||
|
this.drpJointNo.SelectedValue = BLL.Const._Null;
|
|||
|
//this.btnNew.Hidden = true;
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 查询
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void TextBox2_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//this.btnNew.Hidden = true;
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
#region 私有方法
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改质量等级评定
|
|||
|
/// </summary>
|
|||
|
/// <param name="qualityRating"></param>
|
|||
|
public static void UpadteQualityRating(Model.PV_BO_QualityRating qualityRating)
|
|||
|
{
|
|||
|
var newQualityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(e => e.QualityRatingId == qualityRating.QualityRatingId);
|
|||
|
if (newQualityRating != null)
|
|||
|
{
|
|||
|
newQualityRating.MethodId = qualityRating.MethodId;
|
|||
|
newQualityRating.RMaterial = qualityRating.RMaterial;
|
|||
|
newQualityRating.Remake = qualityRating.Remake;
|
|||
|
newQualityRating.RemakeResult = qualityRating.RemakeResult;
|
|||
|
newQualityRating.WeldingId = qualityRating.WeldingId;
|
|||
|
newQualityRating.FilmNum = qualityRating.FilmNum;
|
|||
|
newQualityRating.RepairTag = qualityRating.RepairTag;
|
|||
|
newQualityRating.Cack = qualityRating.Cack;
|
|||
|
newQualityRating.NotFusion = qualityRating.NotFusion;
|
|||
|
newQualityRating.NotPenetration = qualityRating.NotPenetration;
|
|||
|
newQualityRating.StripDefects = qualityRating.StripDefects;
|
|||
|
newQualityRating.CircularDefects = qualityRating.CircularDefects;
|
|||
|
newQualityRating.DeepHoleDefects = qualityRating.DeepHoleDefects;
|
|||
|
newQualityRating.RootsConcave = qualityRating.RootsConcave;
|
|||
|
newQualityRating.RootsBiteEdge = qualityRating.RootsBiteEdge;
|
|||
|
newQualityRating.PseudoDefects = qualityRating.PseudoDefects;
|
|||
|
newQualityRating.DefectLength = qualityRating.DefectLength;
|
|||
|
newQualityRating.DefectResult = qualityRating.DefectResult;
|
|||
|
newQualityRating.SignMan = qualityRating.SignMan;
|
|||
|
newQualityRating.SignDate = qualityRating.SignDate;
|
|||
|
newQualityRating.Remark = qualityRating.Remark;
|
|||
|
newQualityRating.DetectLength = qualityRating.DetectLength;
|
|||
|
newQualityRating.PeakAmplitude = qualityRating.PeakAmplitude;
|
|||
|
newQualityRating.DefectLocation = qualityRating.DefectLocation;
|
|||
|
newQualityRating.DepthDefect = qualityRating.DepthDefect;
|
|||
|
newQualityRating.IndicatingLength = qualityRating.IndicatingLength;
|
|||
|
newQualityRating.DefectHeight = qualityRating.DefectHeight;
|
|||
|
newQualityRating.DefectsHighSide = qualityRating.DefectsHighSide;
|
|||
|
newQualityRating.DefectSize = qualityRating.DefectSize;
|
|||
|
newQualityRating.DefectNature = qualityRating.DefectNature;
|
|||
|
newQualityRating.DefectRation = qualityRating.DefectRation;
|
|||
|
newQualityRating.IsPass = qualityRating.IsPass;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|
|||
|
}
|