1299 lines
67 KiB
C#
1299 lines
67 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using Newtonsoft.Json.Linq;
|
|
using BLL;
|
|
using System.Linq;
|
|
using System.Collections;
|
|
|
|
namespace FineUIPro.Web.HJGL.RepairManage
|
|
{
|
|
public partial class QualityRating : PageBase
|
|
{
|
|
#region 定义量
|
|
private string BatchId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["BatchId"];
|
|
}
|
|
set
|
|
{
|
|
|
|
ViewState["BatchId"] = value;
|
|
}
|
|
}
|
|
|
|
private string ISO_ID
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ISO_ID"];
|
|
}
|
|
set
|
|
{
|
|
|
|
ViewState["ISO_ID"] = value;
|
|
}
|
|
}
|
|
|
|
private string NDT
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["NDT"];
|
|
}
|
|
set
|
|
{
|
|
|
|
ViewState["NDT"] = value;
|
|
}
|
|
}
|
|
|
|
private static List<string> IDs;
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
IDs = new List<string>();
|
|
this.BatchId = Request.Params["BatchId"];
|
|
this.ISO_ID = Request.Params["ISO_ID"];
|
|
this.NDT = Request.Params["NDT"];
|
|
this.drpEquipment.DataTextField = "EquipmentName";
|
|
this.drpEquipment.DataValueField = "EquipmentId";
|
|
this.drpEquipment.DataSource = BLL.HJGL_EquipmentService.GetEquipmentList();
|
|
this.drpEquipment.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpEquipment);
|
|
|
|
this.drpJointNo.DataTextField = "JOT_JointNo";
|
|
this.drpJointNo.DataValueField = "JOT_ID";
|
|
var cH_RepairItemIds = from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId && (z.IsPass != null && z.IsPass != "") select z).Count() == 0
|
|
//&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId select z).Count() == 0
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId;
|
|
IDs = cH_RepairItemIds.ToList();
|
|
|
|
var joints = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
join a in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals a.JOT_ID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId && (z.IsPass != null && z.IsPass == "") select z).Count() == 0
|
|
&& y.NDT_ID == this.NDT
|
|
orderby a.JOT_JointNo
|
|
select new { x.JOT_ID, a.JOT_JointNo }).Distinct();
|
|
this.drpJointNo.DataSource = joints;
|
|
this.drpJointNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|
|
|
if (cH_RepairItemIds.Count() == 0)
|
|
{
|
|
var cH_RepairID = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairID).FirstOrDefault();
|
|
var repair1 = BLL.HJGL_RepairService.GetCH_RepairByID(cH_RepairID);
|
|
if (repair1 != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(repair1.NDT_ID))
|
|
{
|
|
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(repair1.NDT_ID);
|
|
if (ndt != null)
|
|
{
|
|
if (ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
Grid1.Columns[7].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[17].Hidden = false;//根部咬边
|
|
//Grid1.Columns[20].Hidden = false;//缺陷性质
|
|
Grid1.Columns[22].Hidden = false;//缺陷定量
|
|
Grid1.Columns[23].Hidden = false;//缺陷位置(定量)
|
|
Grid1.Columns[23].HeaderText = "超标缺陷部位";
|
|
}
|
|
else if (ndt.NDT_Code.Contains("UT"))
|
|
{
|
|
if (ndt.NDT_Code.Contains("PAUT"))
|
|
{
|
|
Grid1.Columns[5].Hidden = true;
|
|
}
|
|
Grid2.Columns[2].Hidden = true;
|
|
Grid1.Columns[4].Hidden = true;
|
|
Grid1.Columns[18].Hidden = false;//检测长度
|
|
Grid1.Columns[19].Hidden = false;//峰值波幅
|
|
Grid1.Columns[22].Hidden = false;//缺陷位置
|
|
Grid1.Columns[25].Hidden = false;//缺陷深度
|
|
Grid1.Columns[28].Hidden = false;//指示长度
|
|
}
|
|
else if (ndt.NDT_Code.Contains("MT") || ndt.NDT_Code.Contains("PT"))
|
|
{
|
|
Grid2.Columns[2].Hidden = true;
|
|
Grid1.Columns[4].Hidden = true;
|
|
Grid1.Columns[20].Hidden = false;//缺陷性质
|
|
Grid1.Columns[22].Hidden = false;//缺陷位置
|
|
Grid1.Columns[23].Hidden = false;//缺陷尺寸
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
foreach (var cH_RepairItemId in cH_RepairItemIds)
|
|
{
|
|
//根据类型不同,显示不同的缺陷
|
|
var repairItem = BLL.HJGL_RepairItemService.GetRepairItemByID(cH_RepairItemId);
|
|
var repair = BLL.HJGL_RepairService.GetCH_RepairByID(repairItem.CH_RepairID);
|
|
if (repairItem != null)
|
|
{
|
|
if (repair != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(repair.NDT_ID))
|
|
{
|
|
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(repair.NDT_ID);
|
|
if (ndt != null)
|
|
{
|
|
if (ndt.NDT_Code == "RT")
|
|
{
|
|
Grid1.Columns[7].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[17].Hidden = false;//根部咬边
|
|
//Grid1.Columns[20].Hidden = false;//缺陷性质
|
|
Grid1.Columns[22].Hidden = false;//缺陷定量
|
|
Grid1.Columns[23].Hidden = false;//缺陷位置(定量)
|
|
Grid1.Columns[23].HeaderText = "超标缺陷部位";
|
|
}
|
|
else if (ndt.NDT_Code == "UT")
|
|
{
|
|
if (ndt.NDT_Code.Contains("PAUT"))
|
|
{
|
|
Grid1.Columns[5].Hidden = true;
|
|
}
|
|
Grid2.Columns[2].Hidden = true;
|
|
Grid1.Columns[4].Hidden = true;
|
|
Grid1.Columns[18].Hidden = false;//检测长度
|
|
Grid1.Columns[19].Hidden = false;//峰值波幅
|
|
Grid1.Columns[22].Hidden = false;//缺陷位置
|
|
Grid1.Columns[25].Hidden = false;//缺陷深度
|
|
Grid1.Columns[28].Hidden = false;//指示长度
|
|
}
|
|
else if (ndt.NDT_Code == "MT" || ndt.NDT_Code == "PT")
|
|
{
|
|
Grid2.Columns[2].Hidden = true;
|
|
Grid1.Columns[4].Hidden = true;
|
|
Grid1.Columns[20].Hidden = false;//缺陷性质
|
|
Grid1.Columns[22].Hidden = false;//缺陷位置
|
|
Grid1.Columns[23].Hidden = false;//缺陷尺寸
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(repairItem.EquipmentId))
|
|
{
|
|
this.drpEquipment.SelectedValue = repairItem.EquipmentId;
|
|
}
|
|
if (!string.IsNullOrEmpty(repairItem.ShootMan))
|
|
{
|
|
this.txtShootMan.Text = repairItem.ShootMan;
|
|
}
|
|
else
|
|
{
|
|
this.txtShootMan.Text = this.CurrUser.UserName;
|
|
}
|
|
if (repairItem.ShootDate != null)
|
|
{
|
|
this.txtShootDate.Text = repairItem.ShootDate.Value.ToString();
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(cH_RepairItemId))
|
|
{
|
|
if (repair != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(repair.NDT_ID))
|
|
{
|
|
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(repair.NDT_ID);
|
|
if (ndt != null)
|
|
{
|
|
if (ndt.NDT_Code == "RT")
|
|
{
|
|
this.txtShootDate.Text = DateTime.Now.Date.AddDays(-1).ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.txtShootDate.Text = DateTime.Now.Date.ToString();
|
|
}
|
|
}
|
|
|
|
if (BLL.HJGL_BO_QualityRatingRepairService.GetQualityRatingRepairByRepairItemId(cH_RepairItemId) == null)
|
|
{
|
|
//尚未生成质量评定记录,自动新增一条
|
|
Model.HJGL_BO_QualityRatingRepair newQualityRatingRepair = new Model.HJGL_BO_QualityRatingRepair();
|
|
newQualityRatingRepair.QualityRatingRepairId = SQLHelper.GetNewID(typeof(Model.HJGL_BO_QualityRatingRepair));
|
|
newQualityRatingRepair.CH_RepairItemId = cH_RepairItemId;
|
|
newQualityRatingRepair.ISO_ID = repair.ISO_ID;
|
|
newQualityRatingRepair.JOT_ID = repairItem.JOT_ID;
|
|
newQualityRatingRepair.FilmNum = repairItem.FilmNum;
|
|
newQualityRatingRepair.IsPass = string.Empty;
|
|
newQualityRatingRepair.DefectResult = string.Empty;
|
|
BLL.HJGL_BO_QualityRatingRepairService.AddQualityRatingRepair(newQualityRatingRepair);
|
|
}
|
|
}
|
|
BindGrid();
|
|
cH_RepairItemIds = from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId;
|
|
if (cH_RepairItemIds.Count() > 0)
|
|
{
|
|
var r = from x in Funs.DB.HJGL_CH_RepairItemRecord select x;
|
|
var repair = from x in r where cH_RepairItemIds.Contains(x.TrustItemID) select x;
|
|
if (repair.Count() != 0)
|
|
{
|
|
var repairItem = from x in Funs.DB.HJGL_CH_RepairItemRecord
|
|
join y in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals y.JOT_ID
|
|
where cH_RepairItemIds.Contains(x.TrustItemID)
|
|
select new { x.RepairItemRecordId, y.JOT_JointNo, x.FilmNum, x.DefectNature, x.TrustItemID };
|
|
Grid2.DataSource = repairItem;
|
|
Grid2.DataBind();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 删除选中行的脚本
|
|
private string GetDeleteScript()
|
|
{
|
|
return Confirm.GetShowReference("确定移除选中行吗?", String.Empty, MessageBoxIcon.Question, Grid1.GetDeleteSelectedRowsReference(), String.Empty);
|
|
}
|
|
#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 trustItemID = 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 = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordById(repairItemId);
|
|
if (repairItemRecord != null)
|
|
{
|
|
//repairItemRecord.SignMan = "";
|
|
//repairItemRecord.SignDate = DateTime.Now;
|
|
string receiveMan = this.CurrUser.UserName;
|
|
var repairItem = BLL.HJGL_RepairItemService.GetRepairItemByID(trustItemID);
|
|
|
|
if (repairItem != null)
|
|
{
|
|
var repair = BLL.HJGL_RepairService.GetCH_RepairByID(repairItem.CH_RepairID);
|
|
if (repair != null)
|
|
{
|
|
Model.Sys_User user = BLL.Sys_UserService.GetUsersByUserId(repair.CH_Tabler);
|
|
if (user != null)
|
|
{
|
|
receiveMan = user.UserName;
|
|
}
|
|
}
|
|
}
|
|
repairItemRecord.ReceiveMan = receiveMan;
|
|
if (repairItemRecord.ReceiveDate == null)
|
|
{
|
|
repairItemRecord.ReceiveDate = DateTime.Now;
|
|
}
|
|
BLL.HJGL_CH_RepairItemRecordService.UpdateCH_RepairItemRecord(repairItemRecord);
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("RepairNoticePrint.aspx?repairItemRecordId={0}", repairItemId, "编辑 - ")));
|
|
}
|
|
}
|
|
if (e.CommandName == "Delete")
|
|
{
|
|
if (judgementDelete(repairItemId))
|
|
{
|
|
var oldRepairItemRecord = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordById(repairItemId);
|
|
Model.HJGL_BS_NDTType ndt = BLL.HJGL_TestingService.GetTestingByTestingId(oldRepairItemRecord.NDT_ID);
|
|
if (ndt != null)
|
|
{
|
|
if (oldRepairItemRecord.RepairMark == "R2")
|
|
{
|
|
if (ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
//回写焊口二次返修片子及数量
|
|
BLL.HJGL_PW_JointInfoService.DeleteWriteBackRT2RepairFilmAndNum(oldRepairItemRecord.JOT_ID, oldRepairItemRecord.FilmNum);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("PT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPTIsRepair2(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("MT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackMTIsRepair2(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("UT"))
|
|
{
|
|
if (ndt.NDT_Code == "UT")
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackUTIsRepair2(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
else
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPAUTIsRepair2(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
}
|
|
}
|
|
else if (oldRepairItemRecord.RepairMark == "R3")
|
|
{
|
|
if (ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
//回写焊口三次返修片子及数量
|
|
BLL.HJGL_PW_JointInfoService.DeleteWriteBackRT3RepairFilmAndNum(oldRepairItemRecord.JOT_ID, oldRepairItemRecord.FilmNum);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("PT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPTIsRepair3(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("MT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackMTIsRepair3(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("UT"))
|
|
{
|
|
if (ndt.NDT_Code == "UT")
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackUTIsRepair3(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
else
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPAUTIsRepair3(oldRepairItemRecord.JOT_ID, null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
BLL.HJGL_CH_RepairItemRecordService.DeleteRepairItemRecordById(repairItemId);
|
|
var cH_RepairItemIds = from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId;
|
|
var repairItemRecord = from x in Funs.DB.HJGL_CH_RepairItemRecord
|
|
join y in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals y.JOT_ID
|
|
where cH_RepairItemIds.Contains(x.TrustItemID)
|
|
select new { x.RepairItemRecordId, y.JOT_JointNo, x.FilmNum, x.DefectNature, x.TrustItemID };
|
|
|
|
Grid2.DataSource = repairItemRecord;
|
|
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 judgementDelete2(string cH_RepairItemId, string filmNum)
|
|
{
|
|
string content = "";
|
|
var repairItemRecord = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordByCH_RepairItemIdAndFilmNum(cH_RepairItemId, filmNum);
|
|
if (repairItemRecord != null)
|
|
{
|
|
content = "返修焊接记录已存在,无法删除";
|
|
}
|
|
if (content == "")
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
ShowNotify(content);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否可以删除
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private bool judgementDelete(string repairItemId)
|
|
{
|
|
string content = "";
|
|
var repairItemRecord = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordById(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> cH_RepairItemIds = new List<string>();
|
|
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
|
{
|
|
if (IDs.Count > 0)
|
|
{
|
|
cH_RepairItemIds = IDs;
|
|
}
|
|
else
|
|
{
|
|
cH_RepairItemIds = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId && (z.IsPass != null && z.IsPass != "") select z).Count() == 0
|
|
//&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId select z).Count() == 0
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId).Distinct().ToList();
|
|
}
|
|
}
|
|
else if (this.rblIsFilm.SelectedValue == "1") //已拍片
|
|
{
|
|
cH_RepairItemIds = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId && (z.IsPass != null && z.IsPass != "") select z).Count() > 0
|
|
//&& (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId select z).Count() > 0
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId).Distinct().ToList();
|
|
}
|
|
else
|
|
{
|
|
cH_RepairItemIds = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId).Distinct().ToList();
|
|
}
|
|
foreach (var cH_RepairItemId in cH_RepairItemIds)
|
|
{
|
|
ids += cH_RepairItemId + ",";
|
|
}
|
|
if (!string.IsNullOrEmpty(ids))
|
|
{
|
|
ids = ids.Substring(0, ids.LastIndexOf(","));
|
|
}
|
|
if (this.drpJointNo.SelectedValue != BLL.Const._Null)
|
|
{
|
|
var list = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
join z in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals z.JOT_ID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
select new { x.CH_RepairItemId, x.JOT_ID }).Distinct().ToList();
|
|
ids = string.Empty;
|
|
foreach (var item in list)
|
|
{
|
|
if (item.JOT_ID == this.drpJointNo.SelectedValue)
|
|
{
|
|
ids += item.CH_RepairItemId + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(ids))
|
|
{
|
|
ids = ids.Substring(0, ids.LastIndexOf(","));
|
|
}
|
|
SubmitQualityRating();
|
|
}
|
|
string strSql = string.Empty;
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
strSql = @"SELECT QualityRating.QualityRatingRepairId,QualityRating.CH_RepairItemId,QualityRating.ISO_ID,
|
|
QualityRating.RMaterial, QualityRating.Remake,QualityRating.RemakeResult,QualityRating.JOT_ID,QualityRating.FilmNum,
|
|
RepairItemRecord.RepairMark, QualityRating.Cack,QualityRating.NotFusion,QualityRating.NotPenetration,
|
|
QualityRating.StripDefects,QualityRating.CircularDefects,QualityRating.DeepHoleDefects,
|
|
QualityRating.RootsConcave,QualityRating.RootsBiteEdge,QualityRating.PseudoDefects,
|
|
QualityRating.DefectLength,case QualityRating.DefectResult when null then '' else QualityRating.DefectResult end as DefectResult,QualityRating.SignMan,
|
|
QualityRating.SignDate,QualityRating.Remark,IsoInfo.ISO_IsoNo,JointInfo.JOT_JointNo,
|
|
JointInfo.Sort1,JointInfo.Sort2,JointInfo.Sort3,JointInfo.Sort4,JointInfo.Sort5,
|
|
JointInfo.JOT_QualifiedLevel,repair.ProjectId,Project.ProjectCode,Welder.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.HJGL_BO_QualityRatingRepair QualityRating
|
|
LEFT JOIN dbo.HJGL_CH_RepairItem AS repairItem ON repairItem.CH_RepairItemId = QualityRating.CH_RepairItemId
|
|
LEFT JOIN dbo.HJGL_CH_Repair AS repair ON repair.CH_RepairID = repairItem.CH_RepairID
|
|
LEFT JOIN dbo.HJGL_PW_IsoInfo AS IsoInfo ON IsoInfo.ISO_ID = QualityRating.ISO_ID
|
|
LEFT JOIN dbo.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID = QualityRating.JOT_ID
|
|
LEFT JOIN dbo.Base_Project AS Project ON Project.ProjectId = repair.ProjectId
|
|
LEFT JOIN dbo.HJGL_CH_RepairItemRecord AS RepairItemRecord ON RepairItemRecord.RepairItemRecordId = repairItem.RepairItemRecordId
|
|
LEFT JOIN dbo.HJGL_BS_Welder AS Welder ON Welder.WED_ID = RepairItemRecord.JOT_CellWelder
|
|
WHERE CHARINDEX(QualityRating.CH_RepairItemId,@CH_RepairItemId)>0";
|
|
listStr.Add(new SqlParameter("@CH_RepairItemId", ids));
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
IDs.Clear();
|
|
}
|
|
#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)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_CheckAuditMenuId, Const.BtnSave))
|
|
{
|
|
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>("QualityRatingRepairId");
|
|
var remakeReason = Funs.DB.HJGL_BO_RemakeReason.FirstOrDefault(x => x.QualityRatingId == qualityRatingId);
|
|
if (remakeReason == null)
|
|
{
|
|
ShowNotify("重拍口需先编辑重拍记录才可提交!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void SubmitQualityRating()
|
|
{
|
|
foreach (JObject mergedRow in Grid1.GetMergedData())
|
|
{
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
string cH_RepairItemId = values.Value<string>("CH_RepairItemId");
|
|
Model.HJGL_CH_RepairItem repairItem = BLL.HJGL_RepairItemService.GetRepairItemByID(cH_RepairItemId);
|
|
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 = Funs.GetNewDateTime(this.txtShootDate.Text.Trim());
|
|
}
|
|
var repair = BLL.HJGL_RepairService.GetCH_RepairByID(repairItem.CH_RepairID);
|
|
bool? b = true; //默认合格
|
|
bool needRemake = false; //重拍
|
|
string qualityRatingRepairId = values.Value<string>("QualityRatingRepairId");
|
|
Model.HJGL_BO_QualityRatingRepair newQualityRatingRepair = BLL.HJGL_BO_QualityRatingRepairService.GetQualityRatingRepairById(qualityRatingRepairId);
|
|
newQualityRatingRepair.CH_RepairItemId = cH_RepairItemId;
|
|
if (!string.IsNullOrEmpty(repair.ISO_ID))
|
|
{
|
|
newQualityRatingRepair.ISO_ID = repair.ISO_ID;
|
|
}
|
|
if (!string.IsNullOrEmpty(repairItem.JOT_ID))
|
|
{
|
|
newQualityRatingRepair.JOT_ID = repairItem.JOT_ID;
|
|
}
|
|
newQualityRatingRepair.Remake = Convert.ToBoolean(values.Value<string>("Remake"));
|
|
if (Grid1.Columns[5].Hidden == true)
|
|
{
|
|
newQualityRatingRepair.FilmNum = null;
|
|
}
|
|
else
|
|
{
|
|
newQualityRatingRepair.FilmNum = values.Value<string>("FilmNum");
|
|
}
|
|
newQualityRatingRepair.RepairTag = values.Value<string>("RepairMark");
|
|
newQualityRatingRepair.RMaterial = Convert.ToBoolean(values.Value<string>("RMaterial"));
|
|
newQualityRatingRepair.DefectRation = values.Value<string>("DefectRation");
|
|
newQualityRatingRepair.Cack = Convert.ToBoolean(values.Value<string>("Cack"));
|
|
newQualityRatingRepair.NotFusion = Convert.ToBoolean(values.Value<string>("NotFusion"));
|
|
newQualityRatingRepair.NotPenetration = Convert.ToBoolean(values.Value<string>("NotPenetration"));
|
|
newQualityRatingRepair.StripDefects = Convert.ToBoolean(values.Value<string>("StripDefects"));
|
|
newQualityRatingRepair.CircularDefects = Convert.ToBoolean(values.Value<string>("CircularDefects"));
|
|
newQualityRatingRepair.DeepHoleDefects = Convert.ToBoolean(values.Value<string>("DeepHoleDefects"));
|
|
newQualityRatingRepair.RootsConcave = Convert.ToBoolean(values.Value<string>("RootsConcave"));
|
|
newQualityRatingRepair.RootsBiteEdge = Convert.ToBoolean(values.Value<string>("RootsBiteEdge"));
|
|
newQualityRatingRepair.PseudoDefects = Convert.ToBoolean(values.Value<string>("PseudoDefects"));
|
|
newQualityRatingRepair.DefectLength = values.Value<string>("DefectLength");
|
|
if (!string.IsNullOrEmpty(values.Value<string>("DefectResult")))
|
|
{
|
|
newQualityRatingRepair.DefectResult = values.Value<string>("DefectResult");
|
|
}
|
|
//newQualityRating.SignMan = values.Value<string>("SignMan");
|
|
newQualityRatingRepair.SignDate = Funs.GetNewDateTime(values.Value<string>("SignDate"));
|
|
newQualityRatingRepair.Remark = values.Value<string>("Remark");
|
|
|
|
newQualityRatingRepair.DetectLength = Funs.GetNewDecimal(values.Value<string>("DetectLength"));
|
|
newQualityRatingRepair.PeakAmplitude = values.Value<string>("PeakAmplitude");
|
|
newQualityRatingRepair.DefectLocation = values.Value<string>("DefectLocation");
|
|
newQualityRatingRepair.DepthDefect = Funs.GetNewDecimal(values.Value<string>("DepthDefect"));
|
|
newQualityRatingRepair.IndicatingLength = Funs.GetNewDecimal(values.Value<string>("IndicatingLength"));
|
|
newQualityRatingRepair.DefectHeight = Funs.GetNewDecimal(values.Value<string>("DefectHeight"));
|
|
newQualityRatingRepair.DefectsHighSide = Funs.GetNewDecimal(values.Value<string>("DefectsHighSide"));
|
|
newQualityRatingRepair.DefectSize = Funs.GetNewDecimal(values.Value<string>("DefectSize"));
|
|
|
|
newQualityRatingRepair.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;
|
|
}
|
|
newQualityRatingRepair.IsPass = values.Value<string>("IsPass");
|
|
BLL.HJGL_BO_QualityRatingRepairService.UpadteQualityRatingRepair(newQualityRatingRepair);
|
|
if (needRemake)
|
|
{
|
|
repairItem.States = "3"; //待重检
|
|
}
|
|
else
|
|
{
|
|
if (b == true)
|
|
{
|
|
repairItem.States = "2"; //检测合格
|
|
BLL.HJGL_RepairItemService.UpdateAllStates(repairItem.RepairItemRecordId); //更新之前所有检测单记录的状态,关联
|
|
Model.HJGL_CH_RepairItemRecord record = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordById(repairItem.RepairItemRecordId);
|
|
BLL.HJGL_PW_JointInfoService.JointCheckStateWriteBack(repairItem.JOT_ID, record.NDT_ID, repairItem.States);
|
|
|
|
}
|
|
else
|
|
{
|
|
repairItem.States = "4"; //待返修
|
|
}
|
|
}
|
|
|
|
repairItem.FeedbackMan = this.CurrUser.UserName;
|
|
repairItem.FeedbackDate = DateTime.Now;
|
|
Model.HJGL_BS_NDTType ndt = null;
|
|
if (repair.NDT_ID != null)
|
|
{
|
|
ndt = BLL.HJGL_TestingService.GetTestingByTestingId(repair.NDT_ID);
|
|
}
|
|
string defectNatures = string.Empty;
|
|
if (ndt != null && ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
if (newQualityRatingRepair.Cack == true)
|
|
{
|
|
defectNatures += "裂纹,";
|
|
}
|
|
if (newQualityRatingRepair.NotFusion == true)
|
|
{
|
|
defectNatures += "未熔合,";
|
|
}
|
|
if (newQualityRatingRepair.NotPenetration == true)
|
|
{
|
|
defectNatures += "未焊透,";
|
|
}
|
|
if (newQualityRatingRepair.StripDefects == true)
|
|
{
|
|
defectNatures += "条状缺陷,";
|
|
}
|
|
if (newQualityRatingRepair.CircularDefects == true)
|
|
{
|
|
defectNatures += "圆形缺陷,";
|
|
}
|
|
if (newQualityRatingRepair.DeepHoleDefects == true)
|
|
{
|
|
defectNatures += "深孔缺陷,";
|
|
}
|
|
if (newQualityRatingRepair.RootsConcave == true)
|
|
{
|
|
defectNatures += "根部内凹,";
|
|
}
|
|
if (newQualityRatingRepair.RootsBiteEdge == true)
|
|
{
|
|
defectNatures += "根部咬边,";
|
|
}
|
|
if (newQualityRatingRepair.PseudoDefects == true)
|
|
{
|
|
defectNatures += "伪缺陷,";
|
|
}
|
|
if (!string.IsNullOrEmpty(defectNatures))
|
|
{
|
|
defectNatures = defectNatures.Substring(0, defectNatures.LastIndexOf(","));
|
|
}
|
|
repairItem.DefectNature = defectNatures;
|
|
}
|
|
BLL.HJGL_RepairItemService.UpdateCH_TrustItem(repairItem);
|
|
//回写返修片子情况
|
|
if (!string.IsNullOrEmpty(newQualityRatingRepair.DefectResult))
|
|
{
|
|
if (newQualityRatingRepair.RepairTag == "R1")
|
|
{
|
|
if (ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
//回写焊口一次返修片子及数量
|
|
BLL.HJGL_PW_JointInfoService.WriteBackRT1RepairFilmAndNum(repairItem.JOT_ID, newQualityRatingRepair.FilmNum);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("PT") || ndt.NDT_Code.Contains("PAUT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPTIsRepair1(repairItem.JOT_ID, true);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("MT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackMTIsRepair1(repairItem.JOT_ID, true);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("UT"))
|
|
{
|
|
if (ndt.NDT_Code == "UT")
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackUTIsRepair1(repairItem.JOT_ID, true);
|
|
}
|
|
else
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPAUTIsRepair1(repairItem.JOT_ID, true);
|
|
}
|
|
}
|
|
}
|
|
else if (newQualityRatingRepair.RepairTag == "R2")
|
|
{
|
|
if (ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
//回写焊口二次返修片子及数量
|
|
BLL.HJGL_PW_JointInfoService.WriteBackRT2RepairFilmAndNum(repairItem.JOT_ID, newQualityRatingRepair.FilmNum);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("PT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPTIsRepair2(repairItem.JOT_ID, true);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("MT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackMTIsRepair2(repairItem.JOT_ID, true);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("UT"))
|
|
{
|
|
if (ndt.NDT_Code == "UT")
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackUTIsRepair2(repairItem.JOT_ID, true);
|
|
}
|
|
else
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPAUTIsRepair2(repairItem.JOT_ID, true);
|
|
}
|
|
}
|
|
}
|
|
else if (newQualityRatingRepair.RepairTag == "R3")
|
|
{
|
|
if (ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
//回写焊口三次返修片子及数量
|
|
BLL.HJGL_PW_JointInfoService.WriteBackRT3RepairFilmAndNum(repairItem.JOT_ID, newQualityRatingRepair.FilmNum);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("PT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPTIsRepair3(repairItem.JOT_ID, true);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("MT"))
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackMTIsRepair3(repairItem.JOT_ID, true);
|
|
}
|
|
else if (ndt.NDT_Code.Contains("UT"))
|
|
{
|
|
if (ndt.NDT_Code == "UT")
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackUTIsRepair3(repairItem.JOT_ID, true);
|
|
}
|
|
else
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.WriteBackPAUTIsRepair3(repairItem.JOT_ID, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (newQualityRatingRepair.RMaterial == true)
|
|
{
|
|
BLL.HJGL_PW_JointInfoService.JointRMaterialWriteBack(repairItem.JOT_ID, 1);
|
|
}
|
|
}
|
|
|
|
//ShowNotify("提交成功!", MessageBoxIcon.Success);
|
|
//PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
}
|
|
#endregion
|
|
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_CheckAuditMenuId, Const.BtnSave))
|
|
{
|
|
bool isExitNotOKItem = false; //是否存在不合格项
|
|
List<Model.HJGL_BO_QualityRatingRepair> qualityRatingLists = new List<Model.HJGL_BO_QualityRatingRepair>();
|
|
var cH_RepairItemIds = from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
select x.CH_RepairItemId;
|
|
Model.HJGL_BO_QualityRatingRepair qualityRatingRepair = new Model.HJGL_BO_QualityRatingRepair();
|
|
foreach (var cH_RepairItemId in cH_RepairItemIds)
|
|
{
|
|
if (!string.IsNullOrEmpty(cH_RepairItemId))
|
|
{
|
|
var repairItem = BLL.HJGL_RepairItemService.GetRepairItemByID(cH_RepairItemId);
|
|
var repair = BLL.HJGL_RepairService.GetCH_RepairByID(repairItem.CH_RepairID);
|
|
var repairItemRecord = from x in Funs.DB.HJGL_CH_RepairItemRecord where x.TrustItemID == cH_RepairItemId select x;
|
|
if (repairItemRecord.Count() == 0)
|
|
{
|
|
Model.HJGL_BS_NDTType ndt = null;
|
|
if (repair.NDT_ID != null)
|
|
{
|
|
ndt = BLL.HJGL_TestingService.GetTestingByTestingId(repair.NDT_ID);
|
|
}
|
|
string defectNatures = string.Empty;
|
|
qualityRatingRepair = BLL.HJGL_BO_QualityRatingRepairService.GetQualityRatingRepairByRepairItemId(cH_RepairItemId);
|
|
if (qualityRatingRepair != null && qualityRatingRepair.IsPass == "不合格")
|
|
{
|
|
isExitNotOKItem = true;
|
|
if (ndt != null && ndt.NDT_Code.Contains("RT"))
|
|
{
|
|
if (qualityRatingRepair.RMaterial == true)
|
|
{
|
|
defectNatures += "R母材,";
|
|
}
|
|
|
|
if (qualityRatingRepair.Cack == true)
|
|
{
|
|
defectNatures += "裂纹,";
|
|
}
|
|
if (qualityRatingRepair.NotFusion == true)
|
|
{
|
|
defectNatures += "未熔合,";
|
|
}
|
|
if (qualityRatingRepair.NotPenetration == true)
|
|
{
|
|
defectNatures += "未焊透,";
|
|
}
|
|
if (qualityRatingRepair.StripDefects == true)
|
|
{
|
|
defectNatures += "条状缺陷,";
|
|
}
|
|
if (qualityRatingRepair.CircularDefects == true)
|
|
{
|
|
defectNatures += "圆形缺陷,";
|
|
}
|
|
if (qualityRatingRepair.DeepHoleDefects == true)
|
|
{
|
|
defectNatures += "深孔缺陷,";
|
|
}
|
|
if (qualityRatingRepair.RootsConcave == true)
|
|
{
|
|
defectNatures += "根部内凹,";
|
|
}
|
|
if (qualityRatingRepair.RootsBiteEdge == true)
|
|
{
|
|
defectNatures += "根部咬边,";
|
|
}
|
|
if (qualityRatingRepair.PseudoDefects == true)
|
|
{
|
|
defectNatures += "伪缺陷,";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(qualityRatingRepair.DefectNature))
|
|
{
|
|
defectNatures = "缺陷性质:" + qualityRatingRepair.DefectNature + ",";
|
|
}
|
|
if (qualityRatingRepair.DefectLocation != null)
|
|
{
|
|
defectNatures = defectNatures + "缺陷位置:" + qualityRatingRepair.DefectLocation + ",";
|
|
}
|
|
if (qualityRatingRepair.DefectSize != null)
|
|
{
|
|
defectNatures = defectNatures + "缺陷尺寸:" + qualityRatingRepair.DefectSize + ",";
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(defectNatures))
|
|
{
|
|
defectNatures = defectNatures.Substring(0, defectNatures.LastIndexOf(","));
|
|
}
|
|
Model.HJGL_CH_RepairItemRecord oldRepairItemRecord = (from x in Funs.DB.HJGL_CH_RepairItemRecord
|
|
where x.RepairItemRecordId == repairItem.RepairItemRecordId
|
|
select x).FirstOrDefault();
|
|
Model.HJGL_CH_RepairItemRecord newRepairItemRecord = new Model.HJGL_CH_RepairItemRecord();
|
|
newRepairItemRecord.RepairItemRecordId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_RepairItemRecord));
|
|
newRepairItemRecord.ProjectId = repair.ProjectId;
|
|
newRepairItemRecord.ISO_ID = repair.ISO_ID;
|
|
newRepairItemRecord.JOT_ID = repairItem.JOT_ID;
|
|
newRepairItemRecord.FilmNum = qualityRatingRepair.FilmNum;
|
|
newRepairItemRecord.DefectNature = defectNatures;
|
|
newRepairItemRecord.TrustItemID = repairItem.CH_RepairItemId;
|
|
newRepairItemRecord.BatchId = repair.BatchId;
|
|
if (oldRepairItemRecord.RepairMark == "R1")
|
|
{
|
|
newRepairItemRecord.RepairMark = "R2";
|
|
|
|
}
|
|
else if (oldRepairItemRecord.RepairMark == "R2")
|
|
{
|
|
newRepairItemRecord.RepairMark = "R3";
|
|
|
|
}
|
|
newRepairItemRecord.FeedbackDate = DateTime.Now;
|
|
newRepairItemRecord.NDT_ID = repair.NDT_ID;
|
|
newRepairItemRecord.SignMan = this.CurrUser.UserName;
|
|
newRepairItemRecord.SignDate = DateTime.Now;
|
|
BLL.HJGL_CH_RepairItemRecordService.AddCH_RepairItemRecord(newRepairItemRecord);
|
|
|
|
defectNatures = string.Empty;
|
|
|
|
repairItem.ReportNoticeDate = DateTime.Now;
|
|
BLL.HJGL_RepairItemService.UpdateCH_TrustItem(repairItem);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
if (isExitNotOKItem)
|
|
{
|
|
Alert.ShowInTop("成功生成返修通知单!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("无不合格的项,请提交!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
var repairItemRecords = from x in Funs.DB.HJGL_CH_RepairItemRecord
|
|
join y in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals y.JOT_ID
|
|
where cH_RepairItemIds.Contains(x.TrustItemID)
|
|
select new { x.RepairItemRecordId, y.JOT_JointNo, x.FilmNum, x.DefectNature, x.TrustItemID };
|
|
|
|
Grid2.DataSource = repairItemRecords;
|
|
Grid2.DataBind();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
|
|
#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")
|
|
{
|
|
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("RemakeReasonEdit.aspx?QualityRatingId={0}", qualityRatingId, "编辑 - ")));
|
|
}
|
|
if (e.CommandName == "Delete")
|
|
{
|
|
var qualityRating = HJGL_BO_QualityRatingRepairService.GetQualityRatingRepairById(qualityRatingId);
|
|
if (judgementDelete2(qualityRating.CH_RepairItemId, qualityRating.FilmNum))
|
|
{
|
|
BLL.HJGL_BO_QualityRatingRepairService.DeleteQualityRatingRepairByQualityRatingRepairId(qualityRatingId);
|
|
BindGrid();
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除返修质量评定信息");
|
|
ShowNotify("删除数据成功!(表格数据已重新绑定)");
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 关闭窗口
|
|
/// <summary>
|
|
/// 关闭窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, EventArgs e)
|
|
{
|
|
//BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
//#region 增行
|
|
///// <summary>
|
|
///// 增行按钮
|
|
///// </summary>
|
|
///// <param name="sender"></param>
|
|
///// <param name="e"></param>
|
|
//protected void btnNew_Click(object sender, EventArgs e)
|
|
//{
|
|
// string deleteScript = GetDeleteScript();
|
|
|
|
// //// 新增数据初始值
|
|
// JObject defaultObj = new JObject();
|
|
// var repairDetail = BLL.HJGL_RepairService.cs.GetCH_TrustItemById(this.CH_RepairItemId);
|
|
// if (repairDetail != null)
|
|
// {
|
|
// var repair = BLL.HJGL_RepairService.cs.GetCH_TrustByID(repairDetail.CH_TrustID);
|
|
// if (repair != null)
|
|
// {
|
|
// if (!string.IsNullOrEmpty(repair.ProjectId))
|
|
// {
|
|
// var project = BLL.Base_ProjectService.GetProjectByProjectId(repair.ProjectId);
|
|
// if (project != null)
|
|
// {
|
|
// defaultObj.Add("ProjectCode", project.ProjectCode);
|
|
// }
|
|
// if (!string.IsNullOrEmpty(repair.ISO_ID))
|
|
// {
|
|
// var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(repair.ISO_ID);
|
|
// if (iso != null)
|
|
// {
|
|
// defaultObj.Add("ISO_IsoNo", iso.ISO_IsoNo);
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// if (!string.IsNullOrEmpty(repairDetail.JOT_ID))
|
|
// {
|
|
// var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(repairDetail.JOT_ID);
|
|
// if (jot != null)
|
|
// {
|
|
// defaultObj.Add("JOT_JointNo", jot.JOT_JointNo);
|
|
// if (!string.IsNullOrEmpty(jot.JOT_CellWelder))
|
|
// {
|
|
// var welder = BLL.HJGL_WelderService.GetWelderById(jot.JOT_CellWelder);
|
|
// if (welder != null)
|
|
// {
|
|
// defaultObj.Add("WED_Code", welder.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;
|
|
// }
|
|
// string nextFilmNum = Convert.ToChar(Convert.ToInt16(fileNum.ToCharArray()[0]) + 1).ToString();
|
|
// defaultObj.Add("FilmNum", nextFilmNum);
|
|
// }
|
|
// else
|
|
// {
|
|
// defaultObj.Add("FilmNum", "A");
|
|
// }
|
|
// //如果有缺陷默认返修R1
|
|
// 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 (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", "合格");
|
|
|
|
// defaultObj.Add("Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)));
|
|
|
|
// // 在第一行新增一条数据
|
|
// Grid1.AddNewRecord(defaultObj, true);
|
|
//}
|
|
//#endregion
|
|
|
|
/// <summary>
|
|
/// 获取焊口号
|
|
/// </summary>
|
|
/// <param name="welderId"></param>
|
|
protected string ConvertJOT_JointNo(object RepairItemRecordId)
|
|
{
|
|
if (RepairItemRecordId != null)
|
|
{
|
|
var repairItemRecord = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordById(RepairItemRecordId.ToString());
|
|
if (repairItemRecord != null)
|
|
{
|
|
var joint = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(repairItemRecord.JOT_ID);
|
|
if (joint != null)
|
|
{
|
|
//return joint.JOT_JointNo + repairItemRecord.FilmNum + Funs.GetRepariMark(repairItemRecord.RepairMark);
|
|
return joint.JOT_JointNo + repairItemRecord.FilmNum + repairItemRecord.RepairMark;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// <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.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
join a in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals a.JOT_ID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId select z).Count() == 0
|
|
&& y.NDT_ID == this.NDT
|
|
orderby a.JOT_JointNo
|
|
select new { x.JOT_ID, a.JOT_JointNo }).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.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
join a in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals a.JOT_ID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRatingRepair where z.CH_RepairItemId == x.CH_RepairItemId select z).Count() > 0
|
|
&& y.NDT_ID == this.NDT
|
|
orderby a.JOT_JointNo
|
|
select new { x.JOT_ID, a.JOT_JointNo }).Distinct();
|
|
this.drpJointNo.DataSource = joints;
|
|
this.drpJointNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpJointNo);
|
|
}
|
|
else
|
|
{
|
|
var joints = (from x in Funs.DB.HJGL_CH_RepairItem
|
|
join y in Funs.DB.HJGL_CH_Repair
|
|
on x.CH_RepairID equals y.CH_RepairID
|
|
join a in Funs.DB.HJGL_PW_JointInfo
|
|
on x.JOT_ID equals a.JOT_ID
|
|
where y.BatchId == BatchId && y.ISO_ID == ISO_ID
|
|
&& y.NDT_ID == this.NDT
|
|
orderby a.JOT_JointNo
|
|
select new { x.JOT_ID, a.JOT_JointNo }).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();
|
|
}
|
|
}
|
|
} |