ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGL/CheckManage/RTReportEdit.aspx.cs

768 lines
37 KiB
C#
Raw Normal View History

2024-05-08 17:17:11 +08:00
using System;
using System.Collections.Generic;
using BLL;
using System.Linq;
using System.Data.SqlClient;
using System.Data;
using System.Web;
namespace FineUIPro.Web.HJGL.CheckManage
{
public partial class RTReportEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string TestingReportPrintId
{
get
{
return (string)ViewState["TestingReportPrintId"];
}
set
{
ViewState["TestingReportPrintId"] = value;
}
}
/// <summary>
/// 检测报告Id
/// </summary>
private string ReportPrintId
{
get
{
return (string)ViewState["ReportPrintId"];
}
set
{
ViewState["ReportPrintId"] = value;
}
}
/// <summary>
/// 管线ID
/// </summary>
private string ISO_ID
{
get
{
return (string)ViewState["ISO_ID"];
}
set
{
ViewState["ISO_ID"] = value;
}
}
/// <summary>
/// 规格
/// </summary>
private string Specifications
{
get
{
return (string)ViewState["Specifications"];
}
set
{
ViewState["Specifications"] = value;
}
}
/// <summary>
/// 检测类型主键
/// </summary>
private string NDT_ID
{
get
{
return (string)ViewState["NDT_ID"];
}
set
{
ViewState["NDT_ID"] = value;
}
}
/// <summary>
/// 批主键
/// </summary>
private string BatchId
{
get
{
return (string)ViewState["BatchId"];
}
set
{
ViewState["BatchId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
#region
//检测时机
this.drpTestingTime.DataValueField = "ConstValue";
this.drpTestingTime.DataTextField = "ConstText";
this.drpTestingTime.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_TestingTime);
this.drpTestingTime.DataBind();
Funs.FineUIPleaseSelect(this.drpTestingTime);
//热处理状态
this.drpHotProessState.DataValueField = "ConstValue";
this.drpHotProessState.DataTextField = "ConstText";
this.drpHotProessState.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_HotProessState);
this.drpHotProessState.DataBind();
Funs.FineUIPleaseSelect(this.drpHotProessState);
//透照方式
this.drpTransilluminationMode.DataValueField = "ConstValue";
this.drpTransilluminationMode.DataTextField = "ConstText";
this.drpTransilluminationMode.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_TransilluminationMode);
this.drpTransilluminationMode.DataBind();
Funs.FineUIPleaseSelect(this.drpTransilluminationMode);
//设备型号
this.drpEquipmentCode.DataValueField = "EquipmentId";
this.drpEquipmentCode.DataTextField = "EquipmentName";
this.drpEquipmentCode.DataSource = BLL.HJGL_EquipmentService.GetEquipmentList();
this.drpEquipmentCode.DataBind();
Funs.FineUIPleaseSelect(this.drpEquipmentCode);
//焦点尺寸
//this.drpFocalSize.DataValueField = "ConstValue";
//this.drpFocalSize.DataTextField = "ConstText";
//this.drpFocalSize.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_FocalSize);
//this.drpFocalSize.DataBind();
//Funs.FineUIPleaseSelect(this.drpFocalSize);
////胶片牌号
//this.drpFilmModel.DataValueField = "ConstValue";
//this.drpFilmModel.DataTextField = "ConstText";
//this.drpFilmModel.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_FilmModel);
//this.drpFilmModel.DataBind();
//Funs.FineUIPleaseSelect(this.drpFilmModel);
////增感屏
//this.drpIntensifyingWay.DataValueField = "ConstValue";
//this.drpIntensifyingWay.DataTextField = "ConstText";
//this.drpIntensifyingWay.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_IntensifyingWay);
//this.drpIntensifyingWay.DataBind();
//Funs.FineUIPleaseSelect(this.drpIntensifyingWay);
//γ源种类
this.drpSourceType.DataValueField = "ConstValue";
this.drpSourceType.DataTextField = "ConstText";
this.drpSourceType.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_SourceType);
this.drpSourceType.DataBind();
Funs.FineUIPleaseSelect(this.drpSourceType);
//像质计型号
this.drpImageQualityModel.DataValueField = "ConstValue";
this.drpImageQualityModel.DataTextField = "ConstText";
this.drpImageQualityModel.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_ImageQualityModel);
this.drpImageQualityModel.DataBind();
Funs.FineUIPleaseSelect(this.drpImageQualityModel);
//底片黑度
this.drpFilmDensity.DataValueField = "ConstValue";
this.drpFilmDensity.DataTextField = "ConstText";
this.drpFilmDensity.DataSource = BLL.ConstValue.drpConstItemList(BLL.ConstValue.Group_FilmDensity);
this.drpFilmDensity.DataBind();
Funs.FineUIPleaseSelect(this.drpFilmDensity);
#endregion
this.ReportPrintId = HttpUtility.UrlDecode(Request.Params["reportPrintId"]);
if (!string.IsNullOrEmpty(this.ReportPrintId))
{
this.drpFilmDensity.Text = "2.04.5";
this.txtDeveloperTemperature.Text = "18℃22℃";
this.txtDeveloperTime.Text = "48min";
this.drpTubeCurrent.Text = " mA";
ISO_ID = ReportPrintId.Split('|')[0];
Specifications = ReportPrintId.Split('|')[1];
NDT_ID = ReportPrintId.Split('|')[2];
BatchId = ReportPrintId.Split('|')[3];
string[] jointNos = (ReportPrintId.Split('|')[4]).Split(',');
Model.HJGL_PW_IsoInfo iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(ISO_ID);
Model.HJGL_BO_Batch batch = BLL.HJGL_BO_BatchService.GetBatchById(BatchId);
var trust = from x in Funs.DB.HJGL_CH_Trust where x.BatchId == BatchId && x.CH_NDTMethod == NDT_ID select x;
var hardReport = from x in Funs.DB.HJGL_CH_HardTestReport where x.ISO_ID == ISO_ID select x;
var pro = BLL.Base_ProjectService.GetProjectByProjectId(iso.ProjectId);
this.txtCH_TrustUnit.Text = "镇海石化建安工程有限公司";
if (iso != null)
{
this.txtIsoNo.Text = iso.ISO_IsoNo;
Model.Base_Unit unit = BLL.Base_UnitService.GetUnit(iso.BSU_ID);
if (unit != null)
{
this.txtContractUnit.Text = unit.UnitName;
}
var jot = (from x in Funs.DB.HJGL_PW_JointInfo
join y in Funs.DB.HJGL_BO_BatchDetail
on x.JOT_ID equals y.JOT_ID
where x.ISO_ID == ISO_ID && x.JOT_JointDesc == Specifications && y.BatchId == BatchId && y.NDT.Contains(NDT_ID)
select x).FirstOrDefault();
if (jot != null)
{
var ste = BLL.HJGL_MaterialService.GetSteelBySteID(jot.STE_ID);
if (ste != null)
{
this.txtSteelCode.Text = ste.STE_Code;
}
}
var checkParm = from x in Funs.DB.HJGL_WeldingManage_TestingParameters where x.WeldSpecification == Specifications && x.STE_ID == iso.STE_ID select x;
if (checkParm.Count() > 0)
{
this.drpTestingTime.Text = checkParm.First().TestingTime;
this.drpTransilluminationMode.Text = checkParm.First().TransilluminationMode;
this.txtTubeVoltage.Text = checkParm.First().TubeVoltage;
this.txtWireDiameterCode.Text = checkParm.First().WireDiameterCode;
}
}
if (batch != null)
{
var ndtr = BLL.HJGL_DetectionService.GetNDTRateByNDTRID(batch.NDTR_ID);
if (ndtr != null)
{
this.txtNDTR_Name.Text = ndtr.NDTR_Name;
}
}
if (trust.Count() > 0)
{
var wme = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(trust.First().CH_WeldMethod);
if (wme != null)
{
this.txtWME_Name.Text = wme.WME_Name;
}
this.txtCH_NDTCriteria.Text = trust.First().CH_NDTCriteria;
//if (trust.First().CH_AcceptGrade == "1")
//{
// this.txtCH_AcceptGrade.Text = "";
//}
//if (trust.First().CH_AcceptGrade == "2")
//{
// this.txtCH_AcceptGrade.Text = "Ⅱ";
//}
//if (trust.First().CH_AcceptGrade == "3")
//{
// this.txtCH_AcceptGrade.Text = "Ⅲ";
//}
//if (trust.First().CH_AcceptGrade == "4")
//{
// this.txtCH_AcceptGrade.Text = "Ⅳ";
//}
//if (trust.First().CH_AcceptGrade == "5")
//{
// this.txtCH_AcceptGrade.Text = "";
//}
this.txtCH_AcceptGrade.Text = (from x in Funs.DB.HJGL_PW_JointInfo
join y in Funs.DB.HJGL_CH_TrustItem on x.JOT_ID equals y.JOT_ID
where y.CH_TrustID == trust.First().CH_TrustID
select x.JOT_QualifiedLevel).FirstOrDefault();
}
if (hardReport.Count() > 0)
{
var eq = BLL.HJGL_EquipmentService.GetEquipmentById(hardReport.First().EquipmentId);
if (eq != null)
{
this.drpEquipmentCode.Text = eq.EquipmentCode;
}
}
this.txtSpecifications.Text = Specifications;
this.drpHotProessState.Text = "消应力";//热处理状态
this.drpTestingTime.Text = "焊后";
this.txtTechnicalGrade.Text = "AB";
this.txtFilmModel.Text = "AGFA C";
this.txtIntensifyingWay.Text = "Pb(0.1/0.1)";
this.txtSourceActivity.Text = " Ci";
this.drpImageQualityModel.Text = "FE JB";
this.txtFocalLength.Text = " mm";
this.txtExposureTime.Text = " min";
this.txtEffectiveLength.Text = " mm";
string jotyName = string.Empty;
foreach (var jointNo in jointNos)
{
var jointId = (from x in Funs.DB.HJGL_PW_JointInfo
where x.ISO_ID == ISO_ID && x.JOT_JointNo == jointNo
select x.JOT_ID).FirstOrDefault();
if (jointId != null)
{
if (string.IsNullOrEmpty(jotyName)) //获取检件名称
{
Model.HJGL_PW_JointInfo joint = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(jointId);
if (joint != null)
{
Model.HJGL_BS_JointType jointType = BLL.HJGL_WeldService.GetJointTypeByID(joint.JOTY_ID);
if (jointType != null && !string.IsNullOrEmpty(jointType.JOTY_Name))
{
jotyName = jointType.JOTY_Name;
}
}
}
var trustItem = (from x in Funs.DB.HJGL_CH_TrustItem
join y in Funs.DB.HJGL_CH_Trust
on x.CH_TrustID equals y.CH_TrustID
where x.JOT_ID == jointId && y.CH_NDTMethod == NDT_ID && y.BatchId == BatchId
select x).FirstOrDefault();
if (trustItem != null)
{
Model.HJGL_BS_Equipment equipment = BLL.HJGL_EquipmentService.GetEquipmentById(trustItem.EquipmentId);
if (equipment != null)
{
this.drpSourceType.Text = equipment.EquipmentName;
break;
}
}
}
}
this.txtIso_No.Text = jotyName;
var rtReport = BLL.HJGL_TestingReportPrintService.GetTestingReportPrint(ISO_ID, Specifications, NDT_ID, BatchId, Request.Params["STE_ID"], Request.Params["STE_ID2"], Request.Params["WME_ID"]);
if (rtReport != null)
{
this.TestingReportPrintId = rtReport.TestingReportPrintId;
if (!string.IsNullOrEmpty(rtReport.ReportCode) && rtReport.ReportCode.Length > 3)
{
this.txtRTReportCode.Text = rtReport.ReportCode.Substring(3);
}
else
{
this.txtRTReportCode.Text = rtReport.ReportCode;
}
this.hdReportCode.Text = rtReport.ReportCode;
this.txtTechnicalGrade.Text = rtReport.RT_TechnicalGrade;
//this.drpFocalSize.Text = rtReport.RT_FocalSize;
this.drpTubeCurrent.Text = rtReport.RT_TubeCurrent;
this.drpSourceType.Text = rtReport.RT_SourceType;
this.drpFilmDensity.Text = rtReport.RT_FilmDensity;
this.txtDeveloperTemperature.Text = rtReport.RT_DeveloperTemperature;
this.txtDeveloperTime.Text = rtReport.RT_DeveloperTime;
this.txtPrinter.Text = rtReport.Printer;
this.txtPrintTime.Text = string.Format("{0:yyyy-MM-dd}", rtReport.PrintTime);
this.drpTestingTime.Text = rtReport.TestingTime;
this.drpTransilluminationMode.Text = rtReport.TransilluminationMode;
//this.drpFilmModel.Text = rtReport.FilmModel;
//this.drpIntensifyingWay.Text = rtReport.IntensifyingWay;
this.txtTubeVoltage.Text = rtReport.TubeVoltage;
this.txtSourceActivity.Text = rtReport.SourceActivity;
this.drpImageQualityModel.Text = rtReport.ImageQualityModel;
this.txtWireDiameterCode.Text = rtReport.WireDiameterCode;
this.txtFocalLength.Text = rtReport.FocalLength;
this.txtExposureTime.Text = rtReport.ExposureTime;
this.txtEffectiveLength.Text = rtReport.EffectiveLength;
if (!string.IsNullOrEmpty(rtReport.EquipmentCode))
{
this.drpEquipmentCode.SelectedValue = rtReport.EquipmentCode;
var equipment = BLL.HJGL_EquipmentService.GetEquipmentById(this.drpEquipmentCode.SelectedValue);
if (equipment != null)
{
this.txtFocalSize.Text = equipment.FocalSize;
this.txtFilmModel.Text = equipment.FilmModel;
this.txtIntensifyingWay.Text = equipment.IntensifyingWay;
this.txtLineEnergy.Text = equipment.LineEnergy;
}
}
if (!string.IsNullOrEmpty(this.txtPrinter.Text.Trim()) && !string.IsNullOrEmpty(this.txtPrintTime.Text.Trim()))
{
this.cbIsPrint.Checked = true;
}
this.drpHotProessState.Text = rtReport.HotProessState;
}
else
{
int maxCode = 0;
string prefix = "RT-" + pro.TestEngineeringCode + "-";
int prefixLeng = prefix.Length + 1;
string sqlstr = "SELECT MAX(CONVERT(INT, SUBSTRING(ReportCode,@prefixLeng,LEN(ReportCode)))) FROM HJGL_CH_TestingReportPrint WHERE ProjectId=@ProjectId AND ReportCode LIKE @prefix";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@prefixLeng", prefixLeng));
listStr.Add(new SqlParameter("@ProjectId", iso.ProjectId));
listStr.Add(new SqlParameter("@prefix", "%" + prefix + "%"));
SqlParameter[] parameter = listStr.ToArray();
string numStr = BLL.SQLHelper.getStr(sqlstr, parameter);
if (numStr != "")
{
maxCode = Convert.ToInt32(numStr);
}
if (maxCode < 999)
{
this.hdReportCode.Text = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCodeByProjectId3", "HJGL_CH_TestingReportPrint", "ReportCode", iso.ProjectId, "RT-" + pro.TestEngineeringCode + "-");
}
else
{
this.hdReportCode.Text = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCodeThreeToFour", "HJGL_CH_TestingReportPrint", "ReportCode", iso.ProjectId, "RT-" + pro.TestEngineeringCode + "-");
}
this.txtRTReportCode.Text = this.hdReportCode.Text.Substring(3);
this.txtTubeVoltage.Text = " kv";
}
BindGrid();
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
var p = BLL.HJGL_BO_BatchService.GetBatchById(this.BatchId);
Model.HJGL_CH_TestingReportPrint newRTReport = new Model.HJGL_CH_TestingReportPrint();
newRTReport.ISO_ID = this.ISO_ID;
if (p != null)
{
newRTReport.ProjectId = p.ProjectId;
}
newRTReport.Specifications = this.Specifications;
newRTReport.JotyName = this.txtIso_No.Text;
newRTReport.NDT_ID = this.NDT_ID;
newRTReport.BatchId = this.BatchId;
newRTReport.ReportCode = this.hdReportCode.Text.Trim();
newRTReport.ContractUnitId = this.txtContractUnit.Text.Trim();
newRTReport.RT_TechnicalGrade = this.txtTechnicalGrade.Text.Trim();
//if (this.drpFocalSize.SelectedValue != BLL.Const._Null)
//{
// if (!string.IsNullOrEmpty(this.drpFocalSize.Text.Trim()))
// {
// newRTReport.RT_FocalSize = this.drpFocalSize.Text.Trim();
// }
// else
// {
// newRTReport.RT_FocalSize = this.drpFocalSize.SelectedValue;
// }
//}
if (this.drpTubeCurrent.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpTubeCurrent.Text.Trim()))
{
newRTReport.RT_TubeCurrent = this.drpTubeCurrent.Text.Trim();
}
else
{
newRTReport.RT_TubeCurrent = this.drpTubeCurrent.SelectedValue;
}
}
if (this.drpSourceType.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpSourceType.Text.Trim()))
{
newRTReport.RT_SourceType = this.drpSourceType.Text.Trim();
}
else
{
newRTReport.RT_SourceType = this.drpSourceType.SelectedValue;
}
}
if (this.drpFilmDensity.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpFilmDensity.Text))
{
newRTReport.RT_FilmDensity = this.drpFilmDensity.Text.Trim();
}
else
{
newRTReport.RT_FilmDensity = this.drpFilmDensity.SelectedValue;
}
}
newRTReport.RT_DeveloperTemperature = this.txtDeveloperTemperature.Text.Trim();
newRTReport.RT_DeveloperTime = this.txtDeveloperTime.Text.Trim();
newRTReport.Printer = this.txtPrinter.Text.Trim();
newRTReport.PrintTime = Funs.GetNewDateTime(this.txtPrintTime.Text.Trim());
if (this.drpTestingTime.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpTestingTime.Text.Trim()))
{
newRTReport.TestingTime = this.drpTestingTime.Text.Trim();
}
else
{
newRTReport.TestingTime = this.drpTestingTime.SelectedValue;
}
}
if (this.drpTransilluminationMode.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpTransilluminationMode.Text.Trim()))
{
newRTReport.TransilluminationMode = this.drpTransilluminationMode.Text.Trim();
}
else
{
newRTReport.TransilluminationMode = this.drpTransilluminationMode.SelectedValue;
}
}
//if (this.drpFilmModel.SelectedValue != BLL.Const._Null)
//{
// if (!string.IsNullOrEmpty(this.drpFilmModel.Text.Trim()))
// {
// newRTReport.FilmModel = this.drpFilmModel.Text.Trim();
// }
// else
// {
// newRTReport.FilmModel = this.drpFilmModel.SelectedValue;
// }
//}
//if (this.drpIntensifyingWay.SelectedValue != BLL.Const._Null)
//{
// if (!string.IsNullOrEmpty(this.drpIntensifyingWay.Text.Trim()))
// {
// newRTReport.IntensifyingWay = this.drpIntensifyingWay.Text.Trim();
// }
// else
// {
// newRTReport.IntensifyingWay = this.drpIntensifyingWay.SelectedValue;
// }
//}
newRTReport.TubeVoltage = this.txtTubeVoltage.Text.Trim();
newRTReport.SourceActivity = this.txtSourceActivity.Text.Trim();
if (this.drpImageQualityModel.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpImageQualityModel.Text))
{
newRTReport.ImageQualityModel = this.drpImageQualityModel.Text.Trim();
}
else
{
newRTReport.ImageQualityModel = this.drpImageQualityModel.SelectedValue;
}
}
newRTReport.WireDiameterCode = this.txtWireDiameterCode.Text.Trim();
newRTReport.FocalLength = this.txtFocalLength.Text.Trim();
newRTReport.ExposureTime = this.txtExposureTime.Text.Trim();
newRTReport.EffectiveLength = this.txtEffectiveLength.Text.Trim();
if (this.drpEquipmentCode.SelectedValue != BLL.Const._Null)
{
//if (!string.IsNullOrEmpty(this.drpEquipmentCode.Text.Trim()))
//{
// newRTReport.EquipmentCode = this.drpEquipmentCode.Text.Trim();
// newRTReport.EquipmentName = this.drpEquipmentCode.Text.Trim();
//}
//else
//{
// newRTReport.EquipmentCode = this.drpEquipmentCode.SelectedValue;
// newRTReport.EquipmentName = this.drpEquipmentCode.SelectedValue;
//}
newRTReport.EquipmentCode = this.drpEquipmentCode.SelectedValue;
newRTReport.EquipmentName = this.drpEquipmentCode.SelectedValue;
var equipment = BLL.HJGL_EquipmentService.GetEquipmentById(this.drpEquipmentCode.SelectedValue);
if (equipment != null)
{
newRTReport.RT_FocalSize = equipment.FocalSize;
newRTReport.FilmModel = equipment.FilmModel;
newRTReport.IntensifyingWay = equipment.IntensifyingWay;
}
}
if (this.drpHotProessState.SelectedValue != BLL.Const._Null)
{
if (!string.IsNullOrEmpty(this.drpHotProessState.Text.Trim()))
{
newRTReport.HotProessState = this.drpHotProessState.Text.Trim();
}
else
{
newRTReport.HotProessState = this.drpHotProessState.SelectedValue;
}
}
newRTReport.STE_ID = Request.Params["STE_ID"];
newRTReport.STE_ID2 = Request.Params["STE_ID2"];
newRTReport.WME_ID = Request.Params["WME_ID"];
if (string.IsNullOrEmpty(this.TestingReportPrintId))
{
newRTReport.Type = "RT";
this.TestingReportPrintId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_TestingReportPrint));
newRTReport.TestingReportPrintId = this.TestingReportPrintId;
BLL.HJGL_TestingReportPrintService.AddTestingReportPrint(newRTReport);
BLL.Sys_LogService.AddLog(Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加射线检测报告");
}
else
{
newRTReport.TestingReportPrintId = this.TestingReportPrintId;
BLL.HJGL_TestingReportPrintService.UpdateTestingReportPrint(newRTReport);
BLL.Sys_LogService.AddLog(Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改射线检测报告");
}
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideReference());
}
#endregion
#region
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
string strSql = @"SELECT v.* FROM
(SELECT ROW_NUMBER() OVER(ORDER BY report.JOT_JointNo,report.FilmNum) AS Number,report.*
FROM
(SELECT v1.* FROM
(SELECT QualityRating.QualityRatingId,
JointInfo.JOT_JointDesc,JointInfo.JOT_JointNo+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
QualityRating.FilmNum,Welder.WED_Code,
QualityRating.DefectNature,QualityRating.DefectRation as DefectSize,
QualityRating.DefectResult,QualityRating.Remark
FROM dbo.HJGL_BO_QualityRating AS QualityRating
LEFT JOIN DBO.HJGL_CH_TrustItem AS TrustItem ON TrustItem.CH_TrustItemID = QualityRating.CH_TrustItemID
LEFT JOIN dbo.HJGL_CH_Trust trust ON trust.CH_TrustID = TrustItem.CH_TrustID
LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=QualityRating.JOT_ID
LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = QualityRating.JOT_ID
LEFT JOIN DBO.HJGL_BS_Welder AS Welder ON Welder.WED_ID =JointInfo.JOT_CellWelder
WHERE QualityRating.ISO_ID=@ISO_ID
AND JointInfo.JOT_JointDesc=@JOT_JointDesc AND JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
AND trust.CH_NDTMethod=@NDT
AND trust.BatchId=@BatchId
) v1
UNION all
SELECT v2.* from
(SELECT qualityRatingRepair.QualityRatingRepairId AS QualityRatingId,
JointInfo.JOT_JointDesc,JointInfo.JOT_JointNo+(case batchDetail.PointType when '2' then 'K' else '' end) as JOT_JointNo,
(qualityRatingRepair.FilmNum+record.RepairMark) AS FilmNum,
Welder.WED_Code,qualityRatingRepair.DefectNature,
qualityRatingRepair.DefectRation as DefectSize,qualityRatingRepair.DefectResult,
qualityRatingRepair.Remark
FROM dbo.HJGL_BO_QualityRatingRepair AS qualityRatingRepair
LEFT JOIN dbo.HJGL_CH_RepairItem AS repairItem ON repairItem.CH_RepairItemId = qualityRatingRepair.CH_RepairItemId
LEFT JOIN dbo.HJGL_CH_Repair repair ON repair.CH_RepairID = repairItem.CH_RepairID
LEFT JOIN DBO.HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID=qualityRatingRepair.JOT_ID
LEFT JOIN dbo.HJGL_BO_BatchDetail batchDetail ON batchDetail.JOT_ID = qualityRatingRepair.JOT_ID
LEFT JOIN dbo.HJGL_CH_RepairItemRecord record ON record.RepairItemRecordId = repairItem.RepairItemRecordId
LEFT JOIN DBO.HJGL_BS_Welder AS Welder ON Welder.WED_ID =record.JOT_CellWelder
WHERE qualityRatingRepair.ISO_ID=@ISO_ID
AND JointInfo.JOT_JointDesc=@JOT_JointDesc AND JointInfo.STE_ID=@STE_ID AND (JointInfo.STE_ID2=@STE_ID2 or @STE_ID2='') AND JointInfo.WME_ID=@WME_ID
AND repair.NDT_ID=@NDT
AND repair.BatchId=@BatchId
) v2)
report) v";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ISO_ID", this.ISO_ID));
listStr.Add(new SqlParameter("@JOT_JointDesc", this.Specifications));
listStr.Add(new SqlParameter("@NDT", this.NDT_ID));
listStr.Add(new SqlParameter("@BatchId", this.BatchId));
listStr.Add(new SqlParameter("@STE_ID", Request.Params["STE_ID"]));
listStr.Add(new SqlParameter("@STE_ID2", Request.Params["STE_ID2"]));
listStr.Add(new SqlParameter("@WME_ID", Request.Params["WME_ID"]));
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
#region
/// <summary>
/// 页索引改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
BindGrid();
}
#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 ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
#endregion
#endregion
#region
/// <summary>
/// 是否打印点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void cbIsPrint_CheckedChanged(object sender, CheckedEventArgs e)
{
if (this.cbIsPrint.Checked == false)
{
this.txtPrinter.Text = string.Empty;
this.txtPrintTime.Text = string.Empty;
}
}
#endregion
#region DropDownList下拉选择事件
/// <summary>
/// 设备型号下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpEquipmentCode_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpEquipmentCode.SelectedValue != BLL.Const._Null)
{
var equipment = BLL.HJGL_EquipmentService.GetEquipmentById(this.drpEquipmentCode.SelectedValue);
if (equipment != null)
{
this.txtFocalSize.Text = equipment.FocalSize;
this.txtFilmModel.Text = equipment.FilmModel;
this.txtIntensifyingWay.Text = equipment.IntensifyingWay;
this.txtLineEnergy.Text = equipment.LineEnergy;
}
else
{
this.txtFocalSize.Text = string.Empty;
this.txtFilmModel.Text = string.Empty;
this.txtIntensifyingWay.Text = string.Empty;
this.txtLineEnergy.Text = string.Empty;
}
}
else
{
this.txtFocalSize.Text = string.Empty;
this.txtFilmModel.Text = string.Empty;
this.txtIntensifyingWay.Text = string.Empty;
this.txtLineEnergy.Text = string.Empty;
}
}
#endregion
}
}