2066 lines
98 KiB
C#
2066 lines
98 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 ReworkQualityRating : 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 RepairItemRecordId
|
|
{
|
|
get { return (string)ViewState["RepairItemRecordId"]; }
|
|
set { ViewState["RepairItemRecordId"] = 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>
|
|
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.RepairItemRecordId = Request.Params["RepairItemRecordId"];
|
|
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 = "ReworkId";
|
|
Funs.FineUIPleaseSelect(this.drpEquipment);
|
|
this.btnNew.Hidden = true;
|
|
|
|
var weldingCodes = (from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join z in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals z.RepairItemRecordId
|
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|
where y.EntrustCode == EntrustCode && z.RepairItemRecordId == this.RepairItemRecordId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId select z).Count() == 0
|
|
&& y.NdtId == this.NdtId
|
|
orderby a.WeldingCode
|
|
select new { x.ReworkId, a.WeldingCode }).Distinct();
|
|
this.drpJointNo.DataSource = weldingCodes;
|
|
this.drpJointNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|
|
|
var reworkIds = from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId select z).Count() == 0
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId;
|
|
|
|
if (reworkIds.Count() == 0)
|
|
{
|
|
var entrustId = (from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId
|
|
&& 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 itemReworkId in reworkIds)
|
|
{
|
|
//根据类型不同,显示不同的缺陷
|
|
var itemMethod = Funs.DB.PV_ReworkManagementMethod.FirstOrDefault(p => p.ReworkId == itemReworkId);
|
|
var qualityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(p => p.MethodId == itemReworkId);
|
|
var qualityRecord = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == itemMethod.RepairItemRecordId);
|
|
if (itemMethod != null)
|
|
{
|
|
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(itemReworkId);
|
|
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 = "超标缺陷部位";
|
|
|
|
//返修默认1张底片
|
|
if (qualityRating == null)
|
|
{
|
|
GetDefaultAddRow(itemReworkId, qualityRecord);
|
|
}
|
|
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;//指示长度
|
|
|
|
if (qualityRating == null)
|
|
{
|
|
GetDefaultAddRow(itemReworkId, qualityRecord);
|
|
}
|
|
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;//缺陷尺寸
|
|
if (qualityRating == null)
|
|
{
|
|
GetDefaultAddRow(itemReworkId, qualityRecord);
|
|
}
|
|
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();
|
|
|
|
reworkIds = from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId;
|
|
if (reworkIds.Count() > 0)
|
|
{
|
|
var r = from x in Funs.DB.PV_CH_RepairItemRecord select x;
|
|
var repair = from x in r where reworkIds.Contains(x.MethodId) select x;
|
|
if (repair.Count() != 0)
|
|
{
|
|
var repairItem = from x in Funs.DB.PV_CH_RepairItemRecord
|
|
join z in Funs.DB.PV_WeldInformation on x.WeldingId equals z.WeldingId
|
|
where reworkIds.Contains(x.MethodId)
|
|
select new { x.RepairItemRecordId, z.WeldingCode, x.FilmNum, x.DefectNature, x.MethodId, x.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();
|
|
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_ReworkManagementMethod.FirstOrDefault(p => p.RepairItemRecordId == repairItemId);
|
|
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);
|
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == repairItemRecord.NdtId);
|
|
if (ndt != null)
|
|
{
|
|
if (repairItemRecord.RepairMark == "R2")
|
|
{
|
|
if (ndt.Ndt_NdtCode.Contains("RT"))
|
|
{
|
|
//回写焊口二次返修片子及数量
|
|
DeleteWriteBackRT2RepairFilmAndNum(repairItemRecord.WeldingId, repairItemRecord.FilmNum);
|
|
}
|
|
else if (ndt.Ndt_NdtCode.Contains("PT"))
|
|
{
|
|
WriteBackPTIsRepair2(repairItemRecord.WeldingId, null);
|
|
}
|
|
else if (ndt.Ndt_NdtCode.Contains("MT"))
|
|
{
|
|
WriteBackMTIsRepair2(repairItemRecord.WeldingId, null);
|
|
}
|
|
else if (ndt.Ndt_NdtCode.Contains("UT"))
|
|
{
|
|
if (ndt.Ndt_NdtCode == "UT")
|
|
{
|
|
WriteBackUTIsRepair2(repairItemRecord.WeldingId, null);
|
|
}
|
|
else
|
|
{
|
|
WriteBackPAUTIsRepair2(repairItemRecord.WeldingId, null);
|
|
}
|
|
}
|
|
}
|
|
else if (repairItemRecord.RepairMark == "R3")
|
|
{
|
|
if (ndt.Ndt_NdtCode.Contains("RT"))
|
|
{
|
|
//回写焊口三次返修片子及数量
|
|
DeleteWriteBackRT3RepairFilmAndNum(repairItemRecord.WeldingId, repairItemRecord.FilmNum);
|
|
}
|
|
else if (ndt.Ndt_NdtCode.Contains("PT"))
|
|
{
|
|
WriteBackPTIsRepair3(repairItemRecord.WeldingId, null);
|
|
}
|
|
else if (ndt.Ndt_NdtCode.Contains("MT"))
|
|
{
|
|
WriteBackMTIsRepair3(repairItemRecord.WeldingId, null);
|
|
}
|
|
else if (ndt.Ndt_NdtCode.Contains("UT"))
|
|
{
|
|
if (ndt.Ndt_NdtCode == "UT")
|
|
{
|
|
WriteBackUTIsRepair3(repairItemRecord.WeldingId, null);
|
|
}
|
|
else
|
|
{
|
|
WriteBackPAUTIsRepair3(repairItemRecord.WeldingId, null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (repairItemRecord != null)
|
|
{
|
|
Funs.DB.PV_CH_RepairItemRecord.DeleteOnSubmit(repairItemRecord);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
var deleteReworkId = from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId;
|
|
|
|
|
|
var repairItem = from x in Funs.DB.PV_CH_RepairItemRecord
|
|
join z in Funs.DB.PV_WeldInformation on x.WeldingId equals z.WeldingId
|
|
where deleteReworkId.Contains(x.MethodId)
|
|
select new { x.RepairItemRecordId, z.WeldingCode, x.FilmNum, x.DefectNature, x.MethodId, x.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> reworkIds = new List<string>();
|
|
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
|
{
|
|
reworkIds = (from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId &&
|
|
((from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId select z).Count() == 0
|
|
|| ((from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId && (z.DefectResult == "" || z.DefectResult == null) select z).Count() > 0)
|
|
|| x.DetectionStatus == 3) && !loadCH_TrustItemIDs.Contains(x.ReworkId)
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId).Distinct().ToList();
|
|
}
|
|
else if (this.rblIsFilm.SelectedValue == "1") //已拍片
|
|
{
|
|
reworkIds = (from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId select z).Count() > 0
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId).Distinct().ToList();
|
|
}
|
|
else
|
|
{
|
|
reworkIds = (from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId).Distinct().ToList();
|
|
}
|
|
ids = string.Join(",", reworkIds);
|
|
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,qua.RepairMark,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(qua.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_ReworkManagementMethod AS trustItem ON trustItem.ReworkId = QualityRating.MethodId LEFT JOIN dbo.PV_EntrustRecord AS trust ON trust.Id = trustItem.EntrustId LEFT JOIN PV_CH_RepairItemRecord AS qua on qua.RepairItemRecordId=trustItem.RepairItemRecordId LEFT JOIN dbo.PV_WeldInformation AS JointInfo ON JointInfo.WeldingId = trustItem.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 and (QualityRating.DefectResult='' or QualityRating.DefectResult is null or QualityRating.Remake=1) WHERE CHARINDEX(QualityRating.MethodId,@reworkIds)>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("@reworkIds", 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()
|
|
{
|
|
bool? b = true; //默认合格
|
|
bool needRemake = false; //重拍
|
|
|
|
var firstRepair = new PV_CH_RepairItemRecord();
|
|
var repair = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == this.RepairItemRecordId);
|
|
if (repair != null)
|
|
{
|
|
firstRepair = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == repair.FirstRepairItemRecordId);
|
|
}
|
|
|
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|
{
|
|
bool isAdd = true;
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
string methodId = values.Value<string>("MethodId");
|
|
var repairItem = Funs.DB.PV_ReworkManagementMethod.FirstOrDefault(s => s.ReworkId == methodId);
|
|
if (this.drpEquipment.SelectedValue != "null")
|
|
{
|
|
repairItem.EquipmentId = this.drpEquipment.SelectedValue;
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtShootMan.Text))
|
|
{
|
|
repairItem.ShootMan = this.txtShootMan.Text.Trim();
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtShootDate.Text))
|
|
{
|
|
repairItem.ShootDate = Convert.ToDateTime(this.txtShootDate.Text);
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
string qualityRatingId = values.Value<string>("QualityRatingId");
|
|
var newQualityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(e => e.QualityRatingId == qualityRatingId);
|
|
if (newQualityRating == null)
|
|
{
|
|
newQualityRating = new PV_BO_QualityRating();
|
|
newQualityRating.QualityRatingId = qualityRatingId;
|
|
}
|
|
else
|
|
{
|
|
isAdd = false;
|
|
}
|
|
newQualityRating.MethodId = methodId;
|
|
if (!string.IsNullOrEmpty(repairItem.WeldingId))
|
|
{
|
|
newQualityRating.WeldingId = repairItem.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");
|
|
}
|
|
if (firstRepair != null)
|
|
{
|
|
newQualityRating.FirstMethodId = firstRepair.MethodId;
|
|
}
|
|
newQualityRating.RepairTag = values.Value<string>("RepairMark");
|
|
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;
|
|
}
|
|
else if (values.Value<string>("IsPass") == "合格")
|
|
{
|
|
b = true;
|
|
}
|
|
else
|
|
{
|
|
b = null;
|
|
}
|
|
if (Convert.ToBoolean(values.Value<string>("Remake")))
|
|
{
|
|
needRemake = true;
|
|
}
|
|
newQualityRating.IsPass = values.Value<string>("IsPass");
|
|
|
|
if (isAdd) Funs.DB.PV_BO_QualityRating.InsertOnSubmit(newQualityRating);
|
|
Funs.DB.SubmitChanges();
|
|
|
|
if (needRemake)
|
|
{
|
|
//待重检
|
|
repairItem.DetectionStatus = 3;
|
|
}
|
|
else
|
|
{
|
|
if (b == true)
|
|
{
|
|
//检测合格
|
|
repairItem.DetectionStatus = 2;
|
|
//更新之前所有检测单记录的状态,关联
|
|
UpdateAllStates(repairItem.ReworkId, repairItem.RepairItemRecordId);
|
|
var record = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(e => e.RepairItemRecordId == repairItem.RepairItemRecordId);
|
|
JointCheckStateWriteBack(repairItem.WeldingId, record.NdtId, repairItem.DetectionStatus.Value);
|
|
|
|
}
|
|
else
|
|
{
|
|
repairItem.DetectionStatus = 4; //待返修
|
|
}
|
|
}
|
|
|
|
repairItem.FeedbackPeople = this.CurrUser.UserName;
|
|
repairItem.FeedbackData = DateTime.Now;
|
|
|
|
var ndtModel = Funs.DB.PV_TestMethod.FirstOrDefault(s => s.Ndt_Id == repair.NdtId);
|
|
string defectNatures = string.Empty;
|
|
if (ndtModel != null && ndtModel.Ndt_NdtCode.Contains("RT"))
|
|
{
|
|
if (newQualityRating.Cack == true)
|
|
{
|
|
defectNatures += "裂纹,";
|
|
}
|
|
if (newQualityRating.NotFusion == true)
|
|
{
|
|
defectNatures += "未熔合,";
|
|
}
|
|
if (newQualityRating.NotPenetration == true)
|
|
{
|
|
defectNatures += "未焊透,";
|
|
}
|
|
if (newQualityRating.StripDefects == true)
|
|
{
|
|
defectNatures += "条状缺陷,";
|
|
}
|
|
if (newQualityRating.CircularDefects == true)
|
|
{
|
|
defectNatures += "圆形缺陷,";
|
|
}
|
|
if (newQualityRating.DeepHoleDefects == true)
|
|
{
|
|
defectNatures += "深孔缺陷,";
|
|
}
|
|
if (newQualityRating.RootsConcave == true)
|
|
{
|
|
defectNatures += "根部内凹,";
|
|
}
|
|
if (newQualityRating.RootsBiteEdge == true)
|
|
{
|
|
defectNatures += "根部咬边,";
|
|
}
|
|
if (newQualityRating.PseudoDefects == true)
|
|
{
|
|
defectNatures += "伪缺陷,";
|
|
}
|
|
if (!string.IsNullOrEmpty(defectNatures))
|
|
{
|
|
defectNatures = defectNatures.Substring(0, defectNatures.LastIndexOf(","));
|
|
}
|
|
repairItem.DefectNature = defectNatures;
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
//回写返修片子情况
|
|
if (!string.IsNullOrEmpty(newQualityRating.DefectResult))
|
|
{
|
|
if (newQualityRating.RepairTag == "R1")
|
|
{
|
|
if (ndtModel.Ndt_NdtCode.Contains("RT"))
|
|
{
|
|
//回写焊口一次返修片子及数量
|
|
WriteBackRT1RepairFilmAndNum(repairItem.WeldingId, newQualityRating.FilmNum);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("PT") || ndtModel.Ndt_NdtCode.Contains("PAUT"))
|
|
{
|
|
WriteBackPTIsRepair1(repairItem.WeldingId, true);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("MT"))
|
|
{
|
|
WriteBackMTIsRepair1(repairItem.WeldingId, true);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("UT"))
|
|
{
|
|
if (ndtModel.Ndt_NdtCode == "UT")
|
|
{
|
|
WriteBackUTIsRepair1(repairItem.WeldingId, true);
|
|
}
|
|
else
|
|
{
|
|
WriteBackPAUTIsRepair1(repairItem.WeldingId, true);
|
|
}
|
|
}
|
|
}
|
|
else if (newQualityRating.RepairTag == "R2")
|
|
{
|
|
if (ndtModel.Ndt_NdtCode.Contains("RT"))
|
|
{
|
|
//回写焊口二次返修片子及数量
|
|
WriteBackRT2RepairFilmAndNum(repairItem.WeldingId, newQualityRating.FilmNum);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("PT"))
|
|
{
|
|
WriteBackPTIsRepair2(repairItem.WeldingId, true);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("MT"))
|
|
{
|
|
WriteBackMTIsRepair2(repairItem.WeldingId, true);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("UT"))
|
|
{
|
|
if (ndtModel.Ndt_NdtCode == "UT")
|
|
{
|
|
WriteBackUTIsRepair2(repairItem.WeldingId, true);
|
|
}
|
|
else
|
|
{
|
|
WriteBackPAUTIsRepair2(repairItem.WeldingId, true);
|
|
}
|
|
}
|
|
}
|
|
else if (newQualityRating.RepairTag == "R3")
|
|
{
|
|
if (ndtModel.Ndt_NdtCode.Contains("RT"))
|
|
{
|
|
WriteBackRT3RepairFilmAndNum(repairItem.WeldingId, newQualityRating.FilmNum);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("PT"))
|
|
{
|
|
WriteBackPTIsRepair3(repairItem.WeldingId, true);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("MT"))
|
|
{
|
|
WriteBackMTIsRepair3(repairItem.WeldingId, true);
|
|
}
|
|
else if (ndtModel.Ndt_NdtCode.Contains("UT"))
|
|
{
|
|
if (ndtModel.Ndt_NdtCode == "UT")
|
|
{
|
|
WriteBackUTIsRepair3(repairItem.WeldingId, true);
|
|
}
|
|
else
|
|
{
|
|
WriteBackPAUTIsRepair3(repairItem.WeldingId, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (newQualityRating.RMaterial == true)
|
|
{
|
|
JointRMaterialWriteBack(repairItem.WeldingId, 1);
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新底片
|
|
/// </summary>
|
|
public static void UpdateAllStates(string reworkId, string repairItemRecordId)
|
|
{
|
|
var repairItem = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == repairItemRecordId);
|
|
if (repairItem != null)
|
|
{
|
|
var reworksPassNum = Funs.DB.PV_ReworkManagementMethod.Count(p => p.RepairItemRecordId == repairItemRecordId && p.ReworkId != reworkId && p.DetectionStatus != 2);
|
|
if (reworksPassNum == 0)
|
|
{
|
|
if (!string.IsNullOrEmpty(repairItem.OldRepairItemRecordId))
|
|
{
|
|
var nextRepairItem = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == repairItem.OldRepairItemRecordId);
|
|
if (nextRepairItem != null)
|
|
{
|
|
var nextRework = Funs.DB.PV_ReworkManagementMethod.FirstOrDefault(p => p.RepairItemRecordId == nextRepairItem.RepairItemRecordId && p.ReworkId == repairItem.MethodId);
|
|
if (nextRework != null)
|
|
{
|
|
nextRework.DetectionStatus = 2;
|
|
Funs.DB.SubmitChanges();
|
|
UpdateAllStates(nextRework.ReworkId, nextRework.RepairItemRecordId);
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
var nextRepairItem = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == repairItem.FirstRepairItemRecordId);
|
|
if (nextRepairItem != null)
|
|
{
|
|
var lastRework = Funs.DB.PV_ManagementMethod.FirstOrDefault(p => p.WeldingId == nextRepairItem.WeldingId && p.MethodId == nextRepairItem.MethodId);
|
|
if (lastRework != null)
|
|
{
|
|
lastRework.DetectionStatus = 2;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检测状态回写
|
|
/// </summary>
|
|
public static void JointCheckStateWriteBack(string weldingId, string ndtid, int states)
|
|
{
|
|
var newJointInfo = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldingId);
|
|
if (newJointInfo != null)
|
|
{
|
|
var ndt = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == ndtid);
|
|
string checkState = string.Empty;
|
|
if (states == 1)
|
|
{
|
|
checkState = "待检测";
|
|
}
|
|
if (states == 2)
|
|
{
|
|
checkState = "检测合格";
|
|
}
|
|
if (states == 3)
|
|
{
|
|
checkState = "待重检";
|
|
}
|
|
if (states == 4)
|
|
{
|
|
checkState = "待返修";
|
|
}
|
|
|
|
if (ndt.Ndt_NdtName == "射线检测")
|
|
{
|
|
newJointInfo.RT_States = checkState;
|
|
}
|
|
if (ndt.Ndt_NdtName == "渗透检测")
|
|
{
|
|
newJointInfo.PT_States = checkState;
|
|
}
|
|
if (ndt.Ndt_NdtName == "磁粉检测")
|
|
{
|
|
newJointInfo.MT_States = checkState;
|
|
}
|
|
if (ndt.Ndt_NdtName == "超声波检测")
|
|
{
|
|
newJointInfo.UT_States = checkState;
|
|
}
|
|
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 生成返修通知单
|
|
/// </summary>
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
bool isExitNotOKItem = false; //是否存在不合格项
|
|
var qualityRatingLists = new List<PV_BO_QualityRating>();
|
|
var reworkIds = from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join j in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals j.RepairItemRecordId
|
|
where y.EntrustCode == this.EntrustCode && j.RepairItemRecordId == this.RepairItemRecordId
|
|
&& y.NdtId == this.NdtId
|
|
select x.ReworkId;
|
|
|
|
//添加返修通知单信息
|
|
foreach (var itemReworkId in reworkIds)
|
|
{
|
|
if (!string.IsNullOrEmpty(itemReworkId))
|
|
{
|
|
var trustItem = Funs.DB.PV_ReworkManagementMethod.FirstOrDefault(p => p.ReworkId == itemReworkId);
|
|
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 == itemReworkId && 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();
|
|
|
|
var lastRepairItemRecord = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == this.RepairItemRecordId);
|
|
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;
|
|
if (lastRepairItemRecord != null)
|
|
{
|
|
newRepairItemRecord.OldRepairItemRecordId = lastRepairItemRecord.RepairItemRecordId;
|
|
newRepairItemRecord.RepairNum = lastRepairItemRecord.RepairNum + 1;
|
|
newRepairItemRecord.FirstRepairItemRecordId = lastRepairItemRecord.FirstRepairItemRecordId;
|
|
newRepairItemRecord.RepairMark = $"R{newRepairItemRecord.RepairNum}";
|
|
}
|
|
newRepairItemRecord.ProjectId = trust.ProjectId;
|
|
newRepairItemRecord.WeldingId = trustItem.WeldingId;
|
|
newRepairItemRecord.FilmNum = item.FilmNum;
|
|
newRepairItemRecord.DefectNature = defectNatures;
|
|
newRepairItemRecord.DefectResult = item.DefectResult;
|
|
newRepairItemRecord.MethodId = trustItem.ReworkId;
|
|
newRepairItemRecord.EntrustId = trust.Id;
|
|
newRepairItemRecord.EntrustCode = trust.EntrustCode;
|
|
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;
|
|
|
|
#region 注释
|
|
////回写焊缝信息表信息
|
|
//var weldModel = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == trustItem.WeldingId);
|
|
//if (weldModel != null)
|
|
//{
|
|
// if (ndt.Ndt_NdtCode.Contains("RT"))
|
|
// {
|
|
// if (weldModel.RT1_RepairFilmNum == null)
|
|
// {
|
|
// weldModel.RT1_RepairFilmNum = qualityRatingLists.Count;
|
|
// weldModel.RT1_RepairFilm = string.Join(",", qualityRatingLists.ConvertAll(p => p.QualityRatingId));
|
|
// }
|
|
// else
|
|
// {
|
|
// if (weldModel.RT2_RepairFilmNum == null)
|
|
// {
|
|
// weldModel.RT2_RepairFilmNum = qualityRatingLists.Count;
|
|
// weldModel.RT2_RepairFilm = string.Join(",", qualityRatingLists.ConvertAll(p => p.QualityRatingId));
|
|
// }
|
|
// else
|
|
// {
|
|
// weldModel.RT3_RepairFilmNum = qualityRatingLists.Count;
|
|
// weldModel.RT3_RepairFilm = string.Join(",", qualityRatingLists.ConvertAll(p => p.QualityRatingId));
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (ndt.Ndt_NdtCode.Contains("PT"))
|
|
// {
|
|
// if (weldModel.PTIsRepair1 == null)
|
|
// {
|
|
// weldModel.PTIsRepair1 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// if (weldModel.PTIsRepair2 == null)
|
|
// {
|
|
// weldModel.PTIsRepair2 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// weldModel.PTIsRepair3 = true;
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (ndt.Ndt_NdtCode.Contains("UT"))
|
|
// {
|
|
// if (weldModel.UTIsRepair1 == null)
|
|
// {
|
|
// weldModel.UTIsRepair1 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// if (weldModel.UTIsRepair2 == null)
|
|
// {
|
|
// weldModel.UTIsRepair2 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// weldModel.UTIsRepair3 = true;
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (ndt.Ndt_NdtCode.Contains("MT"))
|
|
// {
|
|
// if (weldModel.MTIsRepair1 == null)
|
|
// {
|
|
// weldModel.MTIsRepair1 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// if (weldModel.MTIsRepair2 == null)
|
|
// {
|
|
// weldModel.MTIsRepair2 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// weldModel.MTIsRepair3 = true;
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (ndt.Ndt_NdtCode.Contains("PAUT"))
|
|
// {
|
|
// if (weldModel.PAUTIsRepair1 == null)
|
|
// {
|
|
// weldModel.PAUTIsRepair1 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// if (weldModel.PAUTIsRepair2 == null)
|
|
// {
|
|
// weldModel.PAUTIsRepair2 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// weldModel.PAUTIsRepair3 = true;
|
|
// }
|
|
// }
|
|
// }
|
|
// else if (ndt.Ndt_NdtCode.Contains("TOFD"))
|
|
// {
|
|
// if (weldModel.TOFDIsRepair1 == null)
|
|
// {
|
|
// weldModel.TOFDIsRepair1 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// if (weldModel.TOFDIsRepair2 == null)
|
|
// {
|
|
// weldModel.TOFDIsRepair2 = true;
|
|
// }
|
|
// else
|
|
// {
|
|
// weldModel.TOFDIsRepair3 = true;
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
#endregion
|
|
|
|
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 z in Funs.DB.PV_WeldInformation on x.WeldingId equals z.WeldingId
|
|
where reworkIds.Contains(x.MethodId)
|
|
select new { x.RepairItemRecordId, z.WeldingCode, x.MethodId, x.FilmNum, x.DefectNature, z.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 reworkId = this.drpJointNo.SelectedValue;
|
|
var trustDetail = Funs.DB.PV_ReworkManagementMethod.FirstOrDefault(p => p.ReworkId == reworkId);
|
|
|
|
if (trustDetail != null)
|
|
{
|
|
defaultObj.Add("MethodId", reworkId);
|
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == trustDetail.EntrustId);
|
|
|
|
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();
|
|
}
|
|
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));
|
|
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(string methodId, PV_CH_RepairItemRecord record)
|
|
{
|
|
//检测方法是选择的 Method_NdtrId 是选择的检测方法,并非压力容器的检测方法主键
|
|
var ndtModel = Funs.DB.PV_TestMethod.FirstOrDefault(p => p.Ndt_Id == this.NdtId);
|
|
|
|
string deleteScript = GetDeleteScript();
|
|
var trustDetail = Funs.DB.PV_ReworkManagementMethod.FirstOrDefault(p => p.ReworkId == methodId);
|
|
string projectCode = string.Empty;
|
|
string jointNo = string.Empty;
|
|
string qualifiedLevel = string.Empty;
|
|
string wedCode = string.Empty;
|
|
string ndtCode = string.Empty;
|
|
string repairMark = string.Empty;
|
|
if (trustDetail != null)
|
|
{
|
|
var trust = Funs.DB.PV_EntrustRecord.FirstOrDefault(p => p.Id == trustDetail.EntrustId);
|
|
|
|
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);
|
|
if (ndt != null)
|
|
{
|
|
ndtCode = ndt.Ndt_NdtCode;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(trustDetail.WeldingId))
|
|
{
|
|
var jot = Funs.DB.PV_WeldInformation.FirstOrDefault(p => p.WeldingId == trustDetail.WeldingId);
|
|
if (jot != null)
|
|
{
|
|
jointNo = jot.WeldingCode;
|
|
qualifiedLevel = ndt.Ndt_Level;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(trustDetail.RepairItemRecordId))
|
|
{
|
|
var repair = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(p => p.RepairItemRecordId == trustDetail.RepairItemRecordId);
|
|
if (repair != null)
|
|
{
|
|
repairMark = repair.RepairMark;
|
|
if (!string.IsNullOrEmpty(repair.BackingWelderId))
|
|
{
|
|
List<string> wedIds = repair.BackingWelderId.Split(',').ToList();
|
|
var welder = Funs.DB.HJGL_BS_Welder.Where(p => wedIds.Contains(p.WED_ID)).ToList();
|
|
if (welder.Count > 0)
|
|
{
|
|
wedCode = string.Join(",", welder.ConvertAll(p => p.WED_Code));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
PV_QualityRatingItem qualityRating = new PV_QualityRatingItem();
|
|
qualityRating.ProjectCode = projectCode;
|
|
qualityRating.MethodLevel = qualifiedLevel;
|
|
qualityRating.WeldingCode = jointNo;
|
|
qualityRating.WedCode = wedCode;
|
|
if (ndtModel.Ndt_NdtCode == "PAUT" || ndtModel.Ndt_NdtCode == "TOFD")
|
|
{
|
|
qualityRating.FilmNum = null;
|
|
}
|
|
else
|
|
{
|
|
qualityRating.FilmNum = record.FilmNum;
|
|
}
|
|
qualityRating.SignMan = this.CurrUser.UserName;
|
|
qualityRating.SignDate = DateTime.Now;
|
|
qualityRating.IsPass = string.Empty;
|
|
qualityRating.IsPass = null;
|
|
qualityRating.MethodId = methodId;
|
|
qualityRating.RepairMark = repairMark;
|
|
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, "编辑 - ")));
|
|
}
|
|
if (e.CommandName == "Delete")
|
|
{
|
|
var qualityRating = Funs.DB.PV_BO_QualityRating.FirstOrDefault(s => s.QualityRatingId == qualityRatingId);
|
|
if (judgementDelete(qualityRating.QualityRatingId, qualityRating.FilmNum))
|
|
{
|
|
Funs.DB.PV_BO_QualityRating.DeleteOnSubmit(qualityRating);
|
|
Funs.DB.SubmitChanges();
|
|
BindGrid();
|
|
ShowNotify("删除数据成功!(表格数据已重新绑定)");
|
|
}
|
|
}
|
|
}
|
|
#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_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join z in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals z.RepairItemRecordId
|
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|
where y.EntrustCode == EntrustCode && z.RepairItemRecordId == this.RepairItemRecordId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId select z).Count() == 0
|
|
&& y.NdtId == this.NdtId
|
|
orderby a.WeldingCode
|
|
select new { x.ReworkId, 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_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join z in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals z.RepairItemRecordId
|
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|
where y.EntrustCode == this.EntrustCode && z.RepairItemRecordId == this.RepairItemRecordId && (from z in Funs.DB.PV_BO_QualityRating where z.MethodId == x.ReworkId select z).Count() > 0
|
|
&& y.NdtId == this.NdtId
|
|
orderby a.WeldingCode
|
|
select new { x.ReworkId, a.WeldingCode }).Distinct();
|
|
this.drpJointNo.DataSource = joints;
|
|
this.drpJointNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|
}
|
|
else
|
|
{
|
|
var joints = (from x in Funs.DB.PV_ReworkManagementMethod
|
|
join y in Funs.DB.PV_EntrustRecord on x.EntrustId equals y.Id
|
|
join z in Funs.DB.PV_CH_RepairItemRecord on x.RepairItemRecordId equals z.RepairItemRecordId
|
|
join a in Funs.DB.PV_WeldInformation on x.WeldingId equals a.WeldingId
|
|
where y.EntrustCode == this.EntrustCode && z.RepairItemRecordId == this.RepairItemRecordId
|
|
&& y.NdtId == this.NdtId
|
|
orderby a.WeldingCode
|
|
select new { x.ReworkId, a.WeldingCode }).Distinct();
|
|
this.drpJointNo.DataSource = joints;
|
|
this.drpJointNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|
}
|
|
this.drpJointNo.SelectedValue = BLL.Const._Null;
|
|
this.BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox2_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
#region 私有方法
|
|
|
|
/// <summary>
|
|
/// 判断是否可以删除
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool judgementDelete(string qualityRatingId, string filmNum)
|
|
{
|
|
var repairItemRecord = Funs.DB.PV_CH_RepairItemRecord.FirstOrDefault(e => e.QualityRatingId == qualityRatingId && e.FilmNum == filmNum);
|
|
if (repairItemRecord != null)
|
|
{
|
|
ShowNotify("返修焊接记录已存在,无法删除");
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/// <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();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口一次返修片子及数量
|
|
/// </summary>
|
|
public static void WriteBackRT1RepairFilmAndNum(string weldid, string filmNum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.RT1_RepairFilmNum == null)
|
|
{
|
|
weld.RT1_RepairFilmNum = 1;
|
|
}
|
|
else
|
|
{
|
|
weld.RT1_RepairFilmNum = weld.RT1_RepairFilmNum + 1;
|
|
}
|
|
if (string.IsNullOrEmpty(weld.RT1_RepairFilm))
|
|
{
|
|
weld.RT1_RepairFilm = filmNum;
|
|
}
|
|
else
|
|
{
|
|
weld.RT1_RepairFilm = weld.RT1_RepairFilm + "," + filmNum;
|
|
}
|
|
weld.HardResultDate = DateTime.Now;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除返修通知单回写焊口一次返修片子及数量
|
|
/// </summary>
|
|
public static void DeleteWriteBackRT1RepairFilmAndNum(string weldid, string filmNum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.RT1_RepairFilmNum == 1)
|
|
{
|
|
weld.RT1_RepairFilmNum = null;
|
|
}
|
|
else
|
|
{
|
|
weld.RT1_RepairFilmNum = weld.RT1_RepairFilmNum - 1;
|
|
}
|
|
string[] strs = weld.RT1_RepairFilm.Split(',');
|
|
if (strs.Length == 1)
|
|
{
|
|
weld.RT1_RepairFilm = null;
|
|
}
|
|
else
|
|
{
|
|
string str = string.Empty;
|
|
foreach (var item in strs)
|
|
{
|
|
if (item != filmNum)
|
|
{
|
|
str += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(str))
|
|
{
|
|
str = str.Substring(0, str.LastIndexOf(","));
|
|
}
|
|
weld.RT1_RepairFilm = str;
|
|
}
|
|
weld.HardResultDate = DateTime.Now;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口二次返修片子及数量
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackRT2RepairFilmAndNum(string weldid, string filmNum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.RT2_RepairFilmNum == null)
|
|
{
|
|
weld.RT2_RepairFilmNum = 1;
|
|
}
|
|
else
|
|
{
|
|
weld.RT2_RepairFilmNum = weld.RT2_RepairFilmNum + 1;
|
|
}
|
|
if (string.IsNullOrEmpty(weld.RT2_RepairFilm))
|
|
{
|
|
weld.RT2_RepairFilm = filmNum;
|
|
}
|
|
else
|
|
{
|
|
weld.RT2_RepairFilm = weld.RT2_RepairFilm + "," + filmNum;
|
|
}
|
|
weld.HardResultDate = DateTime.Now;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除返修通知单回写焊口二次返修片子及数量
|
|
/// </summary>
|
|
public static void DeleteWriteBackRT2RepairFilmAndNum(string weldid, string filmNum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.RT2_RepairFilmNum == 1)
|
|
{
|
|
weld.RT2_RepairFilmNum = null;
|
|
}
|
|
else
|
|
{
|
|
weld.RT2_RepairFilmNum = weld.RT2_RepairFilmNum - 1;
|
|
}
|
|
string[] strs = weld.RT2_RepairFilm.Split(',');
|
|
if (strs.Length == 1)
|
|
{
|
|
weld.RT2_RepairFilm = null;
|
|
}
|
|
else
|
|
{
|
|
string str = string.Empty;
|
|
foreach (var item in strs)
|
|
{
|
|
if (item != filmNum)
|
|
{
|
|
str += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(str))
|
|
{
|
|
str = str.Substring(0, str.LastIndexOf(","));
|
|
}
|
|
weld.RT2_RepairFilm = str;
|
|
}
|
|
weld.HardResultDate = DateTime.Now;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口三次返修片子及数量
|
|
/// </summary>
|
|
public static void WriteBackRT3RepairFilmAndNum(string weldid, string filmNum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.RT3_RepairFilmNum == null)
|
|
{
|
|
weld.RT3_RepairFilmNum = 1;
|
|
}
|
|
else
|
|
{
|
|
weld.RT3_RepairFilmNum = weld.RT3_RepairFilmNum + 1;
|
|
}
|
|
if (string.IsNullOrEmpty(weld.RT3_RepairFilm))
|
|
{
|
|
weld.RT3_RepairFilm = filmNum;
|
|
}
|
|
else
|
|
{
|
|
weld.RT3_RepairFilm = weld.RT3_RepairFilm + "," + filmNum;
|
|
}
|
|
weld.HardResultDate = DateTime.Now;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除返修通知单回写焊口三次返修片子及数量
|
|
/// </summary>
|
|
public static void DeleteWriteBackRT3RepairFilmAndNum(string weldid, string filmNum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.RT3_RepairFilmNum == 1)
|
|
{
|
|
weld.RT3_RepairFilmNum = null;
|
|
}
|
|
else
|
|
{
|
|
weld.RT3_RepairFilmNum = weld.RT3_RepairFilmNum - 1;
|
|
}
|
|
string[] strs = weld.RT3_RepairFilm.Split(',');
|
|
if (strs.Length == 1)
|
|
{
|
|
weld.RT3_RepairFilm = null;
|
|
}
|
|
else
|
|
{
|
|
string str = string.Empty;
|
|
foreach (var item in strs)
|
|
{
|
|
if (item != filmNum)
|
|
{
|
|
str += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(str))
|
|
{
|
|
str = str.Substring(0, str.LastIndexOf(","));
|
|
}
|
|
weld.RT3_RepairFilm = str;
|
|
}
|
|
weld.HardResultDate = DateTime.Now;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口PT是否一次返修
|
|
/// </summary>
|
|
public static void WriteBackPTIsRepair1(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.PTIsRepair1 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口PT是否二次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackPTIsRepair2(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.PTIsRepair2 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口PT是否三次返修
|
|
/// </summary>
|
|
public static void WriteBackPTIsRepair3(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.PTIsRepair3 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口MT是否一次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackMTIsRepair1(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.MTIsRepair1 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口MT是否二次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackMTIsRepair2(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.MTIsRepair2 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口MT是否三次返修
|
|
/// </summary>
|
|
public static void WriteBackMTIsRepair3(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.MTIsRepair3 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口UT是否一次返修
|
|
/// </summary>
|
|
public static void WriteBackUTIsRepair1(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.UTIsRepair1 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口UT是否二次返修
|
|
/// </summary>
|
|
public static void WriteBackUTIsRepair2(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.UTIsRepair2 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口UT是否三次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackUTIsRepair3(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.UTIsRepair3 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口PAUT是否一次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackPAUTIsRepair1(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.PAUTIsRepair1 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口PAUT是否二次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackPAUTIsRepair2(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.PAUTIsRepair2 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写焊口PAUT是否三次返修
|
|
/// </summary>
|
|
/// <param name="jointInfo"></param>
|
|
public static void WriteBackPAUTIsRepair3(string weldid, bool? b)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
weld.PAUTIsRepair3 = b;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 回写R母材数量
|
|
/// </summary>
|
|
public static void JointRMaterialWriteBack(string weldid, int rnum)
|
|
{
|
|
var weld = Funs.DB.PV_WeldInformation.FirstOrDefault(e => e.WeldingId == weldid);
|
|
if (weld != null)
|
|
{
|
|
if (weld.R_Material == null)
|
|
{
|
|
weld.R_Material = rnum;
|
|
}
|
|
else
|
|
{
|
|
weld.R_Material = weld.R_Material + rnum;
|
|
}
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
} |