1559 lines
79 KiB
C#
1559 lines
79 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using BLL;
|
||
using System.Data.SqlClient;
|
||
using System.Data;
|
||
using Newtonsoft.Json.Linq;
|
||
|
||
namespace FineUIPro.Web.HJGL.CheckManage
|
||
{
|
||
public partial class QualityRating : PageBase
|
||
{
|
||
#region 定义量
|
||
private string QualityRatingId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["QualityRatingId"];
|
||
}
|
||
set
|
||
{
|
||
|
||
ViewState["QualityRatingId"] = value;
|
||
}
|
||
}
|
||
|
||
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;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
private static List<string> loadCH_TrustItemIDs;
|
||
|
||
private static List<Model.QualityRatingItem> qualityRatings;
|
||
|
||
#region 加载
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
loadCH_TrustItemIDs = new List<string>();
|
||
qualityRatings = new List<Model.QualityRatingItem>();
|
||
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();
|
||
this.drpJointNo.DataTextField = "JOT_JointNo";
|
||
this.drpJointNo.DataValueField = "CH_TrustItemID";
|
||
|
||
Funs.FineUIPleaseSelect(this.drpEquipment);
|
||
this.btnNew.Hidden = true;
|
||
var cH_TrustItemIDs = from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID select z).Count() == 0
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID;
|
||
var joints = (from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join a in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals a.JOT_ID
|
||
where y.BatchId == BatchId && a.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID select z).Count() == 0
|
||
&& y.CH_NDTMethod == this.NDT
|
||
orderby a.JOT_JointNo
|
||
select new { x.CH_TrustItemID, a.JOT_JointNo }).Distinct();
|
||
this.drpJointNo.DataSource = joints;
|
||
this.drpJointNo.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpJointNo);
|
||
//if (cH_TrustItemIDs.Count() == 1)
|
||
//{
|
||
// this.btnNew.Hidden = false;
|
||
//}
|
||
if (cH_TrustItemIDs.Count() == 0)
|
||
{
|
||
var cH_TrustID = (from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustID).FirstOrDefault();
|
||
var trust1 = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(cH_TrustID);
|
||
if (trust1 != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(trust1.CH_NDTMethod))
|
||
{
|
||
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(trust1.CH_NDTMethod);
|
||
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_TrustItemID in cH_TrustItemIDs)
|
||
{
|
||
//根据类型不同,显示不同的缺陷
|
||
var trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(CH_TrustItemID);
|
||
var qualityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingByTrustDetailId(CH_TrustItemID);
|
||
if (trustItem != null)
|
||
{
|
||
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustItem.JOT_ID);
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
||
if (trust != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
||
{
|
||
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(trust.CH_NDTMethod);
|
||
if (ndt != null)
|
||
{
|
||
loadCH_TrustItemIDs.Add(CH_TrustItemID);
|
||
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 = "超标缺陷部位";
|
||
|
||
if (qualityRating.Count == 0)
|
||
{
|
||
if (jot.JOT_Dia > 100)
|
||
{
|
||
GetDefaultAddRow(6, CH_TrustItemID);
|
||
}
|
||
else
|
||
{
|
||
GetDefaultAddRow(3, CH_TrustItemID);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
BindGrid();
|
||
}
|
||
}
|
||
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;//指示长度
|
||
|
||
this.btnNew.Hidden = true;
|
||
if (qualityRating.Count == 0)
|
||
{
|
||
GetDefaultAddRow(1, CH_TrustItemID);
|
||
}
|
||
else
|
||
{
|
||
BindGrid();
|
||
}
|
||
}
|
||
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;//缺陷尺寸
|
||
this.btnNew.Hidden = true;
|
||
if (qualityRating.Count == 0)
|
||
{
|
||
GetDefaultAddRow(1, CH_TrustItemID);
|
||
}
|
||
else
|
||
{
|
||
BindGrid();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(trustItem.EquipmentId))
|
||
{
|
||
this.drpEquipment.SelectedValue = trustItem.EquipmentId;
|
||
}
|
||
if (!string.IsNullOrEmpty(trustItem.ShootMan))
|
||
{
|
||
this.txtShootMan.Text = trustItem.ShootMan;
|
||
}
|
||
else
|
||
{
|
||
this.txtShootMan.Text = this.CurrUser.UserName;
|
||
}
|
||
if (trustItem.ShootDate != null)
|
||
{
|
||
this.txtShootDate.Text = trustItem.ShootDate.Value.ToString();
|
||
}
|
||
else
|
||
{
|
||
if (trust != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
|
||
{
|
||
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(trust.CH_NDTMethod);
|
||
if (ndt != null)
|
||
{
|
||
if (ndt.NDT_Code.Contains("RT"))
|
||
{
|
||
this.txtShootDate.Text = DateTime.Now.Date.AddDays(-1).ToString();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.txtShootDate.Text = DateTime.Now.Date.ToString();
|
||
}
|
||
}
|
||
}
|
||
|
||
//BindGrid();
|
||
}
|
||
this.Grid1.DataSource = qualityRatings;
|
||
this.Grid1.DataBind();
|
||
//BindGrid();
|
||
cH_TrustItemIDs = from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID;
|
||
if (cH_TrustItemIDs.Count() > 0)
|
||
{
|
||
var r = from x in Funs.DB.HJGL_CH_RepairItemRecord select x;
|
||
var repair = from x in r where cH_TrustItemIDs.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_TrustItemIDs.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 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;
|
||
//lbtnRemakeResult.OnClientClick = GetRemakeReasonScript(this.QualityRatingId);
|
||
//var s = lbtnRemakeResult.
|
||
}
|
||
#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 trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(trustItemID);
|
||
if (trustItem != null)
|
||
{
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
||
if (trust != null)
|
||
{
|
||
Model.Sys_User user = BLL.Sys_UserService.GetUsersByUserId(trust.CH_TrustMan);
|
||
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("../RepairManage/RepairNoticePrint.aspx?repairItemRecordId={0}", repairItemId, "编辑 - ")));
|
||
}
|
||
}
|
||
if (e.CommandName == "Delete")
|
||
{
|
||
if (judgementDelete(repairItemId))
|
||
{
|
||
var repairItemRecord = BLL.HJGL_CH_RepairItemRecordService.GetRepairItemRecordById(repairItemId);
|
||
//Model.HJGL_BS_NDTType ndt = BLL.HJGL_TestingService.GetTestingByTestingId(repairItemRecord.NDT_ID);
|
||
//if (ndt != null)
|
||
//{
|
||
// if (ndt.NDT_Code.Contains("RT"))
|
||
// {
|
||
// //回写焊口一次返修片子及数量
|
||
// BLL.HJGL_PW_JointInfoService.DeleteWriteBackRT1RepairFilmAndNum(repairItemRecord.JOT_ID, repairItemRecord.FilmNum);
|
||
// }
|
||
// else if (ndt.NDT_Code.Contains("PT"))
|
||
// {
|
||
// BLL.HJGL_PW_JointInfoService.WriteBackPTIsRepair1(repairItemRecord.JOT_ID, null);
|
||
// }
|
||
// else if (ndt.NDT_Code.Contains("MT"))
|
||
// {
|
||
// BLL.HJGL_PW_JointInfoService.WriteBackMTIsRepair1(repairItemRecord.JOT_ID, null);
|
||
// }
|
||
// else if (ndt.NDT_Code.Contains("UT"))
|
||
// {
|
||
// if (ndt.NDT_Code == "UT")
|
||
// {
|
||
// BLL.HJGL_PW_JointInfoService.WriteBackUTIsRepair1(repairItemRecord.JOT_ID, null);
|
||
// }
|
||
// else
|
||
// {
|
||
// BLL.HJGL_PW_JointInfoService.WriteBackPAUTIsRepair1(repairItemRecord.JOT_ID, null);
|
||
// }
|
||
// }
|
||
//}
|
||
BLL.HJGL_CH_RepairItemRecordService.DeleteRepairItemRecordById(repairItemId);
|
||
var cH_TrustItemIDs = from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID;
|
||
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_TrustItemIDs.Contains(x.TrustItemID)
|
||
select new { x.RepairItemRecordId, y.JOT_JointNo, x.FilmNum, x.DefectNature, x.TrustItemID };
|
||
|
||
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 = 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_TrustItemIDs = new List<string>();
|
||
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
||
{
|
||
cH_TrustItemIDs = (from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID &&
|
||
((from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID select z).Count() == 0
|
||
|| ((from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID && (z.DefectResult == "" || z.DefectResult == null) select z).Count() > 0)
|
||
|| x.States == "3") && !loadCH_TrustItemIDs.Contains(x.CH_TrustItemID)
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID).Distinct().ToList();
|
||
}
|
||
else if (this.rblIsFilm.SelectedValue == "1") //已拍片
|
||
{
|
||
cH_TrustItemIDs = (from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID select z).Count() > 0
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID).Distinct().ToList();
|
||
}
|
||
else
|
||
{
|
||
cH_TrustItemIDs = (from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID).Distinct().ToList();
|
||
}
|
||
foreach (var cH_TrustItemID in cH_TrustItemIDs)
|
||
{
|
||
ids += cH_TrustItemID + ",";
|
||
}
|
||
if (!string.IsNullOrEmpty(ids))
|
||
{
|
||
ids = ids.Substring(0, ids.LastIndexOf(","));
|
||
}
|
||
if (this.drpJointNo.SelectedValue != BLL.Const._Null)
|
||
{
|
||
if (this.NDT == "20d2cbca-8b3d-434b-b1c1-181796986fa5") //RT拍片,选择焊口时可进行增行
|
||
{
|
||
this.btnNew.Hidden = false;
|
||
}
|
||
ids = this.drpJointNo.SelectedValue;
|
||
//SubmitQualityRating();
|
||
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
||
{
|
||
if (qualityRatings.Count > 0)
|
||
{
|
||
this.Grid1.DataSource = qualityRatings.Where(x => x.JOT_JointNo == this.drpJointNo.SelectedText);
|
||
this.Grid1.DataBind();
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
string strSql = string.Empty;
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
strSql = @"SELECT QualityRating.QualityRatingId,QualityRating.CH_TrustItemID,QualityRating.ISO_ID,
|
||
QualityRating.RMaterial, QualityRating.Remake,QualityRating.RemakeResult,QualityRating.JOT_ID,QualityRating.FilmNum,
|
||
QualityRating.RepairTag, QualityRating.Cack,QualityRating.NotFusion,QualityRating.NotPenetration,
|
||
QualityRating.StripDefects,QualityRating.CircularDefects,QualityRating.DeepHoleDefects,
|
||
QualityRating.RootsConcave,QualityRating.RootsBiteEdge,QualityRating.PseudoDefects,
|
||
QualityRating.DefectLength,QualityRating.DefectResult,QualityRating.SignMan,
|
||
QualityRating.SignDate,QualityRating.Remark,IsoInfo.ISO_IsoNo,JointInfo.JOT_JointNo,
|
||
JointInfo.Sort1,JointInfo.Sort2,JointInfo.Sort3,JointInfo.Sort4,JointInfo.Sort5,
|
||
JointInfo.JOT_QualifiedLevel,trust.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_QualityRating QualityRating
|
||
LEFT JOIN dbo.HJGL_CH_TrustItem AS trustItem ON trustItem.CH_TrustItemID = QualityRating.CH_TrustItemID
|
||
LEFT JOIN dbo.HJGL_CH_Trust AS trust ON trust.CH_TrustID = trustItem.CH_TrustID
|
||
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 = trust.ProjectId
|
||
LEFT JOIN dbo.HJGL_BS_Welder AS Welder ON Welder.WED_ID = JointInfo.JOT_CellWelder
|
||
WHERE CHARINDEX(QualityRating.CH_TrustItemID,@CH_TrustItemIDs)>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.JOT_JointNo=@JOT_JointNo";
|
||
listStr.Add(new SqlParameter("@JOT_JointNo", this.drpJointNo.SelectedText));
|
||
}
|
||
listStr.Add(new SqlParameter("@CH_TrustItemIDs", 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();
|
||
}
|
||
#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_CheckMenuId, 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>("QualityRatingId");
|
||
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()
|
||
{
|
||
int filmNum = 0;
|
||
int rMatNum = 0;
|
||
string changeId = string.Empty;
|
||
bool b = true; //默认合格
|
||
bool needRemake = false; //重拍
|
||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||
{
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
string cH_TrustItemID = values.Value<string>("CH_TrustItemID");
|
||
if (!string.IsNullOrEmpty(values.Value<string>("DefectResult"))) //有评定结果的口再保存记录
|
||
{
|
||
if (changeId != cH_TrustItemID) //循环至新的焊口记录
|
||
{
|
||
Model.HJGL_CH_TrustItem oldTrustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(changeId);
|
||
if (oldTrustItem != null)
|
||
{
|
||
BLL.HJGL_PW_JointInfoService.JointFileNumWriteBack(oldTrustItem.JOT_ID, filmNum);
|
||
BLL.HJGL_PW_JointInfoService.JointRMaterialWriteBack(oldTrustItem.JOT_ID, rMatNum);
|
||
Model.HJGL_CH_Trust trust1 = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(oldTrustItem.CH_TrustID);
|
||
if (trust1.CH_NDTMethod != "20d2cbca-8b3d-434b-b1c1-181796986fa5") //非RT检测,更新焊口检测状态
|
||
{
|
||
if (b)
|
||
{
|
||
if (needRemake)
|
||
{
|
||
oldTrustItem.States = "3"; //待重检
|
||
}
|
||
else
|
||
{
|
||
oldTrustItem.States = "2"; //检测合格
|
||
}
|
||
}
|
||
else
|
||
{
|
||
oldTrustItem.States = "4"; //待返修
|
||
}
|
||
}
|
||
|
||
|
||
oldTrustItem.FeedbackMan = this.CurrUser.UserName;
|
||
oldTrustItem.FeedbackDate = DateTime.Now;
|
||
BLL.HJGL_CH_TrustItemService.UpdateTrustItem(oldTrustItem);
|
||
}
|
||
changeId = cH_TrustItemID;
|
||
b = true;
|
||
needRemake = false;
|
||
|
||
filmNum = 0;
|
||
rMatNum = 0;
|
||
}
|
||
Model.HJGL_CH_TrustItem trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(cH_TrustItemID);
|
||
if (this.drpEquipment.SelectedValue != "null")
|
||
{
|
||
trustItem.EquipmentId = this.drpEquipment.SelectedValue;
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtShootMan.Text))
|
||
{
|
||
trustItem.ShootMan = this.txtShootMan.Text.Trim();
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtShootDate.Text))
|
||
{
|
||
trustItem.ShootDate = Convert.ToDateTime(this.txtShootDate.Text);
|
||
}
|
||
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
||
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustItem.JOT_ID);
|
||
Model.HJGL_BO_QualityRating newQualityRating = new Model.HJGL_BO_QualityRating();
|
||
|
||
|
||
newQualityRating.CH_TrustItemID = cH_TrustItemID;
|
||
if (!string.IsNullOrEmpty(jot.ISO_ID))
|
||
{
|
||
newQualityRating.ISO_ID = jot.ISO_ID;
|
||
}
|
||
if (!string.IsNullOrEmpty(trustItem.JOT_ID))
|
||
{
|
||
newQualityRating.JOT_ID = trustItem.JOT_ID;
|
||
}
|
||
newQualityRating.Remake = Convert.ToBoolean(values.Value<string>("Remake"));
|
||
newQualityRating.RemakeResult = values.Value<string>("RemakeResult");
|
||
if (Grid1.Columns[5].Hidden == true)
|
||
{
|
||
newQualityRating.FilmNum = null;
|
||
}
|
||
else
|
||
{
|
||
newQualityRating.FilmNum = values.Value<string>("FilmNum");
|
||
}
|
||
newQualityRating.RepairTag = values.Value<string>("RepairTag");
|
||
newQualityRating.RMaterial = Convert.ToBoolean(values.Value<string>("RMaterial"));
|
||
newQualityRating.Cack = Convert.ToBoolean(values.Value<string>("Cack"));
|
||
newQualityRating.NotFusion = Convert.ToBoolean(values.Value<string>("NotFusion"));
|
||
newQualityRating.NotPenetration = Convert.ToBoolean(values.Value<string>("NotPenetration"));
|
||
newQualityRating.StripDefects = Convert.ToBoolean(values.Value<string>("StripDefects"));
|
||
newQualityRating.CircularDefects = Convert.ToBoolean(values.Value<string>("CircularDefects"));
|
||
newQualityRating.DeepHoleDefects = Convert.ToBoolean(values.Value<string>("DeepHoleDefects"));
|
||
newQualityRating.RootsConcave = Convert.ToBoolean(values.Value<string>("RootsConcave"));
|
||
newQualityRating.RootsBiteEdge = Convert.ToBoolean(values.Value<string>("RootsBiteEdge"));
|
||
newQualityRating.PseudoDefects = Convert.ToBoolean(values.Value<string>("PseudoDefects"));
|
||
newQualityRating.DefectLength = values.Value<string>("DefectLength");
|
||
newQualityRating.DefectResult = values.Value<string>("DefectResult");
|
||
newQualityRating.DefectRation = values.Value<string>("DefectRation");
|
||
newQualityRating.SignDate = Funs.GetNewDateTime(values.Value<string>("SignDate"));
|
||
newQualityRating.Remark = values.Value<string>("Remark");
|
||
|
||
newQualityRating.DetectLength = Funs.GetNewDecimal(values.Value<string>("DetectLength"));
|
||
newQualityRating.PeakAmplitude = values.Value<string>("PeakAmplitude");
|
||
newQualityRating.DefectLocation = values.Value<string>("DefectLocation");
|
||
newQualityRating.DepthDefect = Funs.GetNewDecimal(values.Value<string>("DepthDefect"));
|
||
newQualityRating.IndicatingLength = Funs.GetNewDecimal(values.Value<string>("IndicatingLength"));
|
||
newQualityRating.DefectHeight = Funs.GetNewDecimal(values.Value<string>("DefectHeight"));
|
||
newQualityRating.DefectsHighSide = Funs.GetNewDecimal(values.Value<string>("DefectsHighSide"));
|
||
newQualityRating.DefectSize = Funs.GetNewDecimal(values.Value<string>("DefectSize"));
|
||
|
||
newQualityRating.DefectNature = values.Value<string>("DefectNature");
|
||
if (values.Value<string>("IsPass") == "不合格")
|
||
{
|
||
b = false;
|
||
}
|
||
if (Convert.ToBoolean(values.Value<string>("Remake")))
|
||
{
|
||
needRemake = true;
|
||
}
|
||
newQualityRating.IsPass = values.Value<string>("IsPass");
|
||
this.QualityRatingId = values.Value<string>("QualityRatingId");
|
||
if (trust.CH_NDTMethod == "20d2cbca-8b3d-434b-b1c1-181796986fa5") //RT检测,评定结果不为空才保存拍片记录
|
||
{
|
||
if (!string.IsNullOrEmpty(newQualityRating.DefectResult))
|
||
{
|
||
filmNum++;
|
||
if (newQualityRating.RMaterial == true)
|
||
{
|
||
rMatNum++;
|
||
}
|
||
var quatlityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingById(this.QualityRatingId);
|
||
if (quatlityRating == null)
|
||
{
|
||
newQualityRating.QualityRatingId = this.QualityRatingId;
|
||
BLL.HJGL_BO_QualityRatingService.AddQualityRating(newQualityRating);
|
||
}
|
||
else
|
||
{
|
||
Model.HJGL_BO_QualityRating oldQualityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingById(this.QualityRatingId);
|
||
if (oldQualityRating != null)
|
||
{
|
||
newQualityRating.RemakeResult = oldQualityRating.RemakeResult;
|
||
}
|
||
newQualityRating.QualityRatingId = this.QualityRatingId;
|
||
BLL.HJGL_BO_QualityRatingService.UpadteQualityRating(newQualityRating);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
var quatlityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingById(this.QualityRatingId);
|
||
if (quatlityRating == null)
|
||
{
|
||
newQualityRating.QualityRatingId = this.QualityRatingId;
|
||
BLL.HJGL_BO_QualityRatingService.AddQualityRating(newQualityRating);
|
||
}
|
||
else
|
||
{
|
||
Model.HJGL_BO_QualityRating oldQualityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingById(this.QualityRatingId);
|
||
if (oldQualityRating != null)
|
||
{
|
||
newQualityRating.RemakeResult = oldQualityRating.RemakeResult;
|
||
}
|
||
newQualityRating.QualityRatingId = this.QualityRatingId;
|
||
BLL.HJGL_BO_QualityRatingService.UpadteQualityRating(newQualityRating);
|
||
}
|
||
}
|
||
BLL.HJGL_CH_TrustItemService.UpdateTrustItem(trustItem);
|
||
|
||
// 有焊口增加的,对应的检测报告打印要变成未打印状态
|
||
var p = from x in Funs.DB.HJGL_CH_TestingReportPrint
|
||
where x.ISO_ID == jot.ISO_ID && x.Specifications == jot.JOT_JointDesc
|
||
&& x.NDT_ID == trust.CH_NDTMethod && x.BatchId == trust.BatchId
|
||
select x;
|
||
if (p.Count() > 0)
|
||
{
|
||
Model.HJGL_CH_TestingReportPrint report = Funs.DB.HJGL_CH_TestingReportPrint.FirstOrDefault(x => x.TestingReportPrintId == p.First().TestingReportPrintId);
|
||
report.Printer = null;
|
||
report.PrintTime = null;
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
}
|
||
}
|
||
//更新列表最后一个口的数据
|
||
if (!string.IsNullOrEmpty(changeId))
|
||
{
|
||
Model.HJGL_CH_TrustItem oldTrustItem1 = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(changeId);
|
||
Model.HJGL_CH_Trust trust1 = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(oldTrustItem1.CH_TrustID);
|
||
if (trust1.CH_NDTMethod != "20d2cbca-8b3d-434b-b1c1-181796986fa5") //非RT检测,更新焊口检测状态
|
||
{
|
||
if (b)
|
||
{
|
||
if (needRemake)
|
||
{
|
||
oldTrustItem1.States = "3"; //待重检
|
||
}
|
||
else
|
||
{
|
||
oldTrustItem1.States = "2"; //检测合格
|
||
}
|
||
}
|
||
else
|
||
{
|
||
oldTrustItem1.States = "4"; //待返修
|
||
}
|
||
}
|
||
oldTrustItem1.FeedbackMan = this.CurrUser.UserName;
|
||
oldTrustItem1.FeedbackDate = DateTime.Now;
|
||
BLL.HJGL_PW_JointInfoService.JointFileNumWriteBack(oldTrustItem1.JOT_ID, filmNum);
|
||
BLL.HJGL_PW_JointInfoService.JointRMaterialWriteBack(oldTrustItem1.JOT_ID, rMatNum);
|
||
BLL.HJGL_PW_JointInfoService.JointCheckStateWriteBack(oldTrustItem1.JOT_ID, trust1.CH_NDTMethod, oldTrustItem1.States);
|
||
BLL.HJGL_CH_TrustItemService.UpdateTrustItem(oldTrustItem1);
|
||
}
|
||
|
||
// 删除现有数据
|
||
List<int> deletedRows = Grid1.GetDeletedList();
|
||
foreach (int rowIndex in deletedRows)
|
||
{
|
||
string qualityRatingId = Grid1.DataKeys[rowIndex][0].ToString();
|
||
BLL.HJGL_BO_QualityRatingService.DeleteQualityRating(qualityRatingId);
|
||
}
|
||
}
|
||
|
||
private void SubmitQualityRating(string qualityRatingId)
|
||
{
|
||
string changeId = string.Empty;
|
||
foreach (JObject mergedRow in Grid1.GetMergedData())
|
||
{
|
||
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
string cH_TrustItemID = values.Value<string>("CH_TrustItemID");
|
||
string qId = values.Value<string>("QualityRatingId");
|
||
if (qId == qualityRatingId)
|
||
{
|
||
Model.HJGL_CH_TrustItem trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(cH_TrustItemID);
|
||
if (this.drpEquipment.SelectedValue != "null")
|
||
{
|
||
trustItem.EquipmentId = this.drpEquipment.SelectedValue;
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtShootMan.Text))
|
||
{
|
||
trustItem.ShootMan = this.txtShootMan.Text.Trim();
|
||
}
|
||
if (!string.IsNullOrEmpty(this.txtShootDate.Text))
|
||
{
|
||
trustItem.ShootDate = Convert.ToDateTime(this.txtShootDate.Text);
|
||
}
|
||
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
||
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustItem.JOT_ID);
|
||
Model.HJGL_BO_QualityRating newQualityRating = new Model.HJGL_BO_QualityRating();
|
||
|
||
newQualityRating.CH_TrustItemID = cH_TrustItemID;
|
||
if (!string.IsNullOrEmpty(jot.ISO_ID))
|
||
{
|
||
newQualityRating.ISO_ID = jot.ISO_ID;
|
||
}
|
||
if (!string.IsNullOrEmpty(trustItem.JOT_ID))
|
||
{
|
||
newQualityRating.JOT_ID = trustItem.JOT_ID;
|
||
}
|
||
newQualityRating.Remake = Convert.ToBoolean(values.Value<string>("Remake"));
|
||
newQualityRating.RemakeResult = values.Value<string>("RemakeResult");
|
||
if (Grid1.Columns[5].Hidden == true)
|
||
{
|
||
newQualityRating.FilmNum = null;
|
||
}
|
||
else
|
||
{
|
||
newQualityRating.FilmNum = values.Value<string>("FilmNum");
|
||
}
|
||
newQualityRating.RepairTag = values.Value<string>("RepairTag");
|
||
newQualityRating.RMaterial = Convert.ToBoolean(values.Value<string>("RMaterial"));
|
||
newQualityRating.Cack = Convert.ToBoolean(values.Value<string>("Cack"));
|
||
newQualityRating.NotFusion = Convert.ToBoolean(values.Value<string>("NotFusion"));
|
||
newQualityRating.NotPenetration = Convert.ToBoolean(values.Value<string>("NotPenetration"));
|
||
newQualityRating.StripDefects = Convert.ToBoolean(values.Value<string>("StripDefects"));
|
||
newQualityRating.CircularDefects = Convert.ToBoolean(values.Value<string>("CircularDefects"));
|
||
newQualityRating.DeepHoleDefects = Convert.ToBoolean(values.Value<string>("DeepHoleDefects"));
|
||
newQualityRating.RootsConcave = Convert.ToBoolean(values.Value<string>("RootsConcave"));
|
||
newQualityRating.RootsBiteEdge = Convert.ToBoolean(values.Value<string>("RootsBiteEdge"));
|
||
newQualityRating.PseudoDefects = Convert.ToBoolean(values.Value<string>("PseudoDefects"));
|
||
newQualityRating.DefectLength = values.Value<string>("DefectLength");
|
||
newQualityRating.DefectResult = values.Value<string>("DefectResult");
|
||
newQualityRating.DefectRation = values.Value<string>("DefectRation");
|
||
newQualityRating.SignDate = Funs.GetNewDateTime(values.Value<string>("SignDate"));
|
||
newQualityRating.Remark = values.Value<string>("Remark");
|
||
|
||
newQualityRating.DetectLength = Funs.GetNewDecimal(values.Value<string>("DetectLength"));
|
||
newQualityRating.PeakAmplitude = values.Value<string>("PeakAmplitude");
|
||
newQualityRating.DefectLocation = values.Value<string>("DefectLocation");
|
||
newQualityRating.DepthDefect = Funs.GetNewDecimal(values.Value<string>("DepthDefect"));
|
||
newQualityRating.IndicatingLength = Funs.GetNewDecimal(values.Value<string>("IndicatingLength"));
|
||
newQualityRating.DefectHeight = Funs.GetNewDecimal(values.Value<string>("DefectHeight"));
|
||
newQualityRating.DefectsHighSide = Funs.GetNewDecimal(values.Value<string>("DefectsHighSide"));
|
||
newQualityRating.DefectSize = Funs.GetNewDecimal(values.Value<string>("DefectSize"));
|
||
|
||
newQualityRating.DefectNature = values.Value<string>("DefectNature");
|
||
newQualityRating.IsPass = values.Value<string>("IsPass");
|
||
this.QualityRatingId = values.Value<string>("QualityRatingId");
|
||
var quatlityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingById(this.QualityRatingId);
|
||
if (quatlityRating == null)
|
||
{
|
||
newQualityRating.QualityRatingId = this.QualityRatingId;
|
||
BLL.HJGL_BO_QualityRatingService.AddQualityRating(newQualityRating);
|
||
}
|
||
else
|
||
{
|
||
Model.HJGL_BO_QualityRating oldQualityRating = BLL.HJGL_BO_QualityRatingService.GetQualityRatingById(this.QualityRatingId);
|
||
if (oldQualityRating != null)
|
||
{
|
||
newQualityRating.RemakeResult = oldQualityRating.RemakeResult;
|
||
}
|
||
newQualityRating.QualityRatingId = this.QualityRatingId;
|
||
BLL.HJGL_BO_QualityRatingService.UpadteQualityRating(newQualityRating);
|
||
}
|
||
break;
|
||
}
|
||
//if (b)
|
||
//{
|
||
// if (needRemake)
|
||
// {
|
||
// trustItem.States = "3"; //待重检
|
||
// }
|
||
// else
|
||
// {
|
||
// trustItem.States = "2"; //检测合格
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
// trustItem.States = "4"; //待返修
|
||
//}
|
||
}
|
||
}
|
||
|
||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_CheckMenuId, Const.BtnSave))
|
||
{
|
||
bool isExitNotOKItem = false; //是否存在不合格项
|
||
List<Model.HJGL_BO_QualityRating> qualityRatingLists = new List<Model.HJGL_BO_QualityRating>();
|
||
var cH_TrustItemIDs = from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join j in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals j.JOT_ID
|
||
where y.BatchId == BatchId && j.ISO_ID == ISO_ID
|
||
&& y.CH_NDTMethod == this.NDT
|
||
select x.CH_TrustItemID;
|
||
foreach (var CH_TrustItemID in cH_TrustItemIDs)
|
||
{
|
||
if (!string.IsNullOrEmpty(CH_TrustItemID))
|
||
{
|
||
var trustItem = BLL.HJGL_CH_TrustItemService.GetTrustItemByID(CH_TrustItemID);
|
||
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustItem.JOT_ID);
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustItem.CH_TrustID);
|
||
Model.HJGL_BS_NDTType ndt = null;
|
||
if (trust.CH_NDTMethod != null)
|
||
{
|
||
ndt = BLL.HJGL_TestingService.GetTestingByTestingId(trust.CH_NDTMethod);
|
||
}
|
||
string defectNatures = string.Empty;
|
||
qualityRatingLists = BLL.HJGL_BO_QualityRatingService.GetQualityRatingByTrustDetailId(CH_TrustItemID);
|
||
qualityRatingLists = qualityRatingLists.Where(x => x.IsPass == "不合格").ToList(); // 获取不合格的项
|
||
if (qualityRatingLists.Count() > 0)
|
||
{
|
||
isExitNotOKItem = true;
|
||
foreach (var item in qualityRatingLists)
|
||
{
|
||
var oldRepairItemRecord = (from x in Funs.DB.HJGL_CH_RepairItemRecord
|
||
where x.JOT_ID == item.JOT_ID && x.TrustItemID == item.CH_TrustItemID && x.FilmNum == item.FilmNum
|
||
select x).FirstOrDefault();
|
||
if (oldRepairItemRecord == null)
|
||
{
|
||
if (ndt != null && ndt.NDT_Code.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(","));
|
||
}
|
||
|
||
Model.HJGL_CH_RepairItemRecord newRepairItemRecord = new Model.HJGL_CH_RepairItemRecord();
|
||
newRepairItemRecord.RepairItemRecordId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_RepairItemRecord));
|
||
newRepairItemRecord.ProjectId = trust.ProjectId;
|
||
newRepairItemRecord.ISO_ID = jot.ISO_ID;
|
||
newRepairItemRecord.JOT_ID = trustItem.JOT_ID;
|
||
newRepairItemRecord.FilmNum = item.FilmNum;
|
||
newRepairItemRecord.DefectNature = defectNatures;
|
||
newRepairItemRecord.TrustItemID = trustItem.CH_TrustItemID;
|
||
newRepairItemRecord.BatchId = trust.BatchId;
|
||
newRepairItemRecord.RepairMark = "R1";
|
||
newRepairItemRecord.FeedbackDate = DateTime.Now;
|
||
newRepairItemRecord.NDT_ID = trust.CH_NDTMethod;
|
||
newRepairItemRecord.SignMan = this.CurrUser.UserName;
|
||
newRepairItemRecord.SignDate = DateTime.Now;
|
||
BLL.HJGL_CH_RepairItemRecordService.AddCH_RepairItemRecord(newRepairItemRecord);
|
||
|
||
defectNatures = string.Empty;
|
||
}
|
||
}
|
||
|
||
trustItem.ReportNoticeDate = DateTime.Now;
|
||
BLL.HJGL_CH_TrustItemService.UpdateTrustItem(trustItem);
|
||
}
|
||
}
|
||
}
|
||
if (isExitNotOKItem)
|
||
{
|
||
Alert.ShowInTop("成功生成返修通知单!", MessageBoxIcon.Success);
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("无不合格的项,请提交!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
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_TrustItemIDs.Contains(x.TrustItemID)
|
||
select new { x.RepairItemRecordId, y.JOT_JointNo, x.TrustItemID, x.FilmNum, x.DefectNature };
|
||
Grid2.DataSource = repairItem;
|
||
Grid2.DataBind();
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
#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 cH_TrustItemID = this.drpJointNo.SelectedValue;
|
||
var trustDetail = BLL.HJGL_TrustManageEditService.GetCH_TrustItemById(cH_TrustItemID);
|
||
|
||
if (trustDetail != null)
|
||
{
|
||
defaultObj.Add("CH_TrustItemID", cH_TrustItemID);
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustDetail.CH_TrustID);
|
||
|
||
if (trust != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(trust.ProjectId))
|
||
{
|
||
var project = BLL.Base_ProjectService.GetProjectByProjectId(trust.ProjectId);
|
||
if (project != null)
|
||
{
|
||
defaultObj.Add("ProjectCode", project.ProjectCode);
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(trustDetail.JOT_ID))
|
||
{
|
||
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustDetail.JOT_ID);
|
||
if (jot != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(jot.ISO_ID))
|
||
{
|
||
var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(jot.ISO_ID);
|
||
if (iso != null)
|
||
{
|
||
defaultObj.Add("ISO_IsoNo", iso.ISO_IsoNo);
|
||
}
|
||
}
|
||
|
||
defaultObj.Add("JOT_JointNo", jot.JOT_JointNo);
|
||
defaultObj.Add("JOT_QualifiedLevel", jot.JOT_QualifiedLevel);
|
||
|
||
if (!string.IsNullOrEmpty(jot.JOT_CellWelder))
|
||
{
|
||
var welder = BLL.HJGL_PersonManageService.GetWelderByWenId(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 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(Model.HJGL_BO_QualityRating));
|
||
defaultObj.Add("QualityRatingId", this.QualityRatingId);
|
||
defaultObj.Add("Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)));
|
||
|
||
string remakeReasonScript = GetRemakeReasonScript(this.QualityRatingId);
|
||
defaultObj.Add("RemakeResultEdit", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", remakeReasonScript, IconHelper.GetResolvedIconUrl(Icon.Pencil)));
|
||
|
||
// 在第一行新增一条数据
|
||
Grid1.AddNewRecord(defaultObj, true);
|
||
}
|
||
|
||
private void GetDefaultAddRow(int rowNum, string cH_TrustItemID)
|
||
{
|
||
string deleteScript = GetDeleteScript();
|
||
var trustDetail = BLL.HJGL_TrustManageEditService.GetCH_TrustItemById(cH_TrustItemID);
|
||
string projectCode = string.Empty;
|
||
string isoNo = string.Empty;
|
||
string jointNo = string.Empty;
|
||
string qualifiedLevel = string.Empty;
|
||
string wedCode = string.Empty;
|
||
string ndtCode = string.Empty;
|
||
if (trustDetail != null)
|
||
{
|
||
var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustDetail.CH_TrustID);
|
||
if (trust != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(trust.ProjectId))
|
||
{
|
||
var project = BLL.Base_ProjectService.GetProjectByProjectId(trust.ProjectId);
|
||
if (project != null)
|
||
{
|
||
projectCode = project.ProjectCode;
|
||
}
|
||
}
|
||
var ndt = BLL.HJGL_TestingService.GetTestingByTestingId(trust.CH_NDTMethod);
|
||
if (ndt != null)
|
||
{
|
||
ndtCode = ndt.NDT_Code;
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(trustDetail.JOT_ID))
|
||
{
|
||
var jot = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(trustDetail.JOT_ID);
|
||
if (jot != null)
|
||
{
|
||
if (!string.IsNullOrEmpty(jot.ISO_ID))
|
||
{
|
||
var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(jot.ISO_ID);
|
||
if (iso != null)
|
||
{
|
||
isoNo = iso.ISO_IsoNo;
|
||
}
|
||
}
|
||
jointNo = jot.JOT_JointNo;
|
||
qualifiedLevel = jot.JOT_QualifiedLevel;
|
||
|
||
if (!string.IsNullOrEmpty(jot.JOT_CellWelder))
|
||
{
|
||
var welder = BLL.HJGL_PersonManageService.GetWelderByWenId(jot.JOT_CellWelder);
|
||
if (welder != null)
|
||
{
|
||
wedCode = welder.WED_Code;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
for (int i = 0; i < rowNum; i++)
|
||
{
|
||
string nextFilmNum = string.Empty;
|
||
if (i == 0)
|
||
{
|
||
nextFilmNum = "A";
|
||
}
|
||
if (i == 1)
|
||
{
|
||
nextFilmNum = "B";
|
||
}
|
||
if (i == 2)
|
||
{
|
||
nextFilmNum = "C";
|
||
}
|
||
if (i == 3)
|
||
{
|
||
nextFilmNum = "D";
|
||
}
|
||
if (i == 4)
|
||
{
|
||
nextFilmNum = "E";
|
||
}
|
||
if (i == 5)
|
||
{
|
||
nextFilmNum = "F";
|
||
}
|
||
Model.QualityRatingItem qualityRating = new Model.QualityRatingItem();
|
||
qualityRating.ProjectCode = projectCode;
|
||
qualityRating.ISO_IsoNo = isoNo;
|
||
qualityRating.JOT_QualifiedLevel = qualifiedLevel;
|
||
qualityRating.JOT_JointNo = jointNo;
|
||
qualityRating.WED_Code = wedCode;
|
||
if (NDT == "PAUT")
|
||
{
|
||
qualityRating.FilmNum = null;
|
||
}
|
||
else
|
||
{
|
||
qualityRating.FilmNum = nextFilmNum;
|
||
}
|
||
qualityRating.SignMan = this.CurrUser.UserName;
|
||
qualityRating.SignDate = DateTime.Now;
|
||
if (rowNum > 1) //RT
|
||
{
|
||
qualityRating.IsPass = string.Empty;
|
||
}
|
||
else //非RT
|
||
{
|
||
if (ndtCode == "PAUT")
|
||
{
|
||
qualityRating.IsPass = null;
|
||
}
|
||
else
|
||
{
|
||
qualityRating.IsPass = "合格";
|
||
}
|
||
}
|
||
if (rowNum == 1)
|
||
{
|
||
if (ndtCode == "PAUT")
|
||
{
|
||
qualityRating.DefectResult = null;
|
||
}
|
||
else
|
||
{
|
||
qualityRating.DefectResult = "I";
|
||
}
|
||
}
|
||
qualityRating.CH_TrustItemID = cH_TrustItemID;
|
||
qualityRating.QualityRatingId = SQLHelper.GetNewID(typeof(Model.HJGL_BO_QualityRating));
|
||
qualityRatings.Add(qualityRating);
|
||
|
||
|
||
//defaultObj.Add("ProjectCode", projectCode);
|
||
//defaultObj.Add("ISO_IsoNo", isoNo);
|
||
//defaultObj.Add("JOT_JointNo", jointNo);
|
||
//defaultObj.Add("WED_Code", wedCode);
|
||
//defaultObj.Add("FilmNum", nextFilmNum);
|
||
//defaultObj.Add("SignMan", this.CurrUser.UserName);
|
||
//defaultObj.Add("SignDate", DateTime.Now);
|
||
//defaultObj.Add("IsPass", "合格");
|
||
//defaultObj.Add("CH_TrustItemID", cH_TrustItemID);
|
||
//this.QualityRatingId = SQLHelper.GetNewID(typeof(Model.HJGL_BO_QualityRating));
|
||
//defaultObj.Add("QualityRatingId", this.QualityRatingId);
|
||
|
||
//defaultObj.Add("Delete", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", deleteScript, IconHelper.GetResolvedIconUrl(Icon.Delete)));
|
||
|
||
//string remakeReasonScript = GetRemakeReasonScript(this.QualityRatingId);
|
||
//defaultObj.Add("RemakeResultEdit", String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>", remakeReasonScript, IconHelper.GetResolvedIconUrl(Icon.Pencil)));
|
||
|
||
//Model.HJGL_BO_QualityRating qr = new Model.HJGL_BO_QualityRating();
|
||
//qr.CH_TrustItemID = cH_TrustItemID;
|
||
//var trust = BLL.HJGL_TrustManageEditService.GetCH_TrustByID(trustDetail.CH_TrustID);
|
||
//if (trust != null)
|
||
//{
|
||
// qr.ISO_ID = trust.ISO_ID;
|
||
//}
|
||
//qr.JOT_ID = trustDetail.JOT_ID;
|
||
//qr.QualityRatingId = this.QualityRatingId;
|
||
//qr.FilmNum = nextFilmNum;
|
||
//qr.SignMan = this.CurrUser.UserName;
|
||
//qr.SignDate = DateTime.Now;
|
||
//BLL.HJGL_BO_QualityRatingService.AddQualityRating(qr);
|
||
|
||
//// 在第一行新增一条数据
|
||
//Grid1.AddNewRecord(defaultObj, true);
|
||
}
|
||
}
|
||
#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>
|
||
/// <returns></returns>
|
||
private string GetRemakeReasonScript(string id)
|
||
{
|
||
return Window2.GetShowReference(String.Format("RemakeReasonEdit.aspx?qualityRatingId={0}&shootMan={1}", id, this.txtShootMan.Text, "编辑 - "));
|
||
}
|
||
#endregion
|
||
|
||
#region Grid行点击事件
|
||
/// <summary>
|
||
/// Grid行点击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||
{
|
||
string qualityRatingId = Grid1.DataKeys[e.RowIndex][0].ToString();
|
||
if (e.CommandName == "edit")
|
||
{
|
||
SubmitQualityRating(qualityRatingId);
|
||
|
||
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("RemakeReasonEdit.aspx?QualityRatingId={0}", qualityRatingId, "编辑 - ")));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (this.rblIsFilm.SelectedValue == "0") //未拍片
|
||
{
|
||
var joints = (from x in Funs.DB.HJGL_CH_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join a in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals a.JOT_ID
|
||
where y.BatchId == BatchId && a.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID select z).Count() == 0
|
||
&& y.CH_NDTMethod == this.NDT
|
||
orderby a.JOT_JointNo
|
||
select new { x.CH_TrustItemID, 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_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join a in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals a.JOT_ID
|
||
where y.BatchId == BatchId && a.ISO_ID == ISO_ID && (from z in Funs.DB.HJGL_BO_QualityRating where z.CH_TrustItemID == x.CH_TrustItemID select z).Count() > 0
|
||
&& y.CH_NDTMethod == this.NDT
|
||
orderby a.JOT_JointNo
|
||
select new { x.CH_TrustItemID, 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_TrustItem
|
||
join y in Funs.DB.HJGL_CH_Trust on x.CH_TrustID equals y.CH_TrustID
|
||
join a in Funs.DB.HJGL_PW_JointInfo on x.JOT_ID equals a.JOT_ID
|
||
where y.BatchId == BatchId && a.ISO_ID == ISO_ID
|
||
&& y.CH_NDTMethod == this.NDT
|
||
orderby a.JOT_JointNo
|
||
select new { x.CH_TrustItemID, a.JOT_JointNo }).Distinct();
|
||
this.drpJointNo.DataSource = joints;
|
||
this.drpJointNo.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpJointNo);
|
||
}
|
||
this.drpJointNo.SelectedValue = BLL.Const._Null;
|
||
this.btnNew.Hidden = true;
|
||
this.BindGrid();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void TextBox2_TextChanged(object sender, EventArgs e)
|
||
{
|
||
this.btnNew.Hidden = true;
|
||
this.BindGrid();
|
||
}
|
||
|
||
/// <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 + Funs.GetRepariMark(repairItemRecord.RepairMark);
|
||
return joint.JOT_JointNo + repairItemRecord.FilmNum + repairItemRecord.RepairMark;
|
||
}
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
}
|
||
} |