601 lines
34 KiB
C#
601 lines
34 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BLL;
|
|
using System.Windows.Forms;
|
|
using Newtonsoft.Json.Linq;
|
|
using AspNet = System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.HJGL.HotHardManage
|
|
{
|
|
public partial class HotHardSet : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 选择集合
|
|
/// </summary>
|
|
public List<string> SelectList
|
|
{
|
|
get
|
|
{
|
|
return (List<string>)ViewState["SelectList"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["SelectList"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
SelectList = new List<string>();
|
|
this.drpProjectId.DataTextField = "ProjectCode";
|
|
this.drpProjectId.DataValueField = "ProjectId";
|
|
this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
this.drpProjectId.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpProjectId);
|
|
//this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId;
|
|
|
|
//var projects = BLL.Base_ProjectService.GetProjectListByUserIdAndState(this.CurrUser.UserId, this.drpIsProjectClosed.SelectedValue);
|
|
//RadioButtonList1.DataTextField = "ProjectCode";
|
|
//RadioButtonList1.DataValueField = "ProjectId";
|
|
//RadioButtonList1.DataSource = projects;
|
|
//RadioButtonList1.DataBind();
|
|
|
|
this.drpIsoNo.DataTextField = "ISO_IsoNo";
|
|
this.drpIsoNo.DataValueField = "ISO_ID";
|
|
Funs.FineUIPleaseSelect(this.drpIsoNo);
|
|
|
|
//this.txtPointDate.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
|
//CheckBoxField cbVI = Grid1.FindColumn("IsVI") as CheckBoxField;
|
|
//cbVI.HeaderText = "<i class=\"ui-icon f-grid-checkbox myheadercheckbox\"></i> 外观检验";
|
|
|
|
this.InitTreeMenu();//加载树
|
|
}
|
|
}
|
|
|
|
#region 加载树项目
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = "项目";
|
|
rootNode.ToolTip = "项目";
|
|
rootNode.NodeID = "0";
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
|
|
|
|
List<Model.Base_Project> projects = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1");
|
|
if (this.drpProjectId.SelectedValueArray.Length > 1 || (this.drpProjectId.SelectedValueArray.Length == 1 && this.drpProjectId.SelectedValue != "null"))
|
|
{
|
|
projects = projects.Where(x => this.drpProjectId.SelectedValueArray.Contains(x.ProjectId)).ToList();
|
|
}
|
|
Model.SGGLDB db = Funs.DB;
|
|
var noTrustProjectIds = (from x in db.HJGL_HotProessItem
|
|
join y in db.HJGL_PW_JointInfo on x.JOT_ID equals y.JOT_ID
|
|
where x.RecordChartNo != null && x.RecordChartNo != "" && x.ProessTypes == "4"
|
|
&& (from z in db.HJGL_CH_HardTestReportItem where z.JOT_ID == x.JOT_ID && z.HotProessTrustId == x.HotProessTrustId select z).Count() == 0
|
|
select y.ProjectId).Distinct().ToList();
|
|
foreach (var item in projects)
|
|
{
|
|
TreeNode rootProjectNode = new TreeNode();//定义根节点
|
|
if (noTrustProjectIds.Contains(item.ProjectId))
|
|
{
|
|
rootProjectNode.Text = "<font color='#FF7575'>" + item.ProjectCode + "</font>";
|
|
}
|
|
else
|
|
{
|
|
rootProjectNode.Text = item.ProjectCode;
|
|
}
|
|
rootProjectNode.NodeID = item.ProjectId;
|
|
rootProjectNode.ToolTip = item.ProjectName;
|
|
rootProjectNode.CommandName = "项目名称";
|
|
rootProjectNode.EnableClickEvent = true;
|
|
rootNode.Nodes.Add(rootProjectNode);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
|
|
#region 生成委托单
|
|
/// <summary>
|
|
/// 生成委托单
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnGenerating_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_HotHardSetMenuId, Const.BtnGenerate))
|
|
{
|
|
int[] selections = Grid1.SelectedRowIndexArray;
|
|
foreach (int rowIndex in selections)
|
|
{
|
|
SelectList.Add(Grid1.DataKeys[rowIndex][0] + "," + Grid1.DataKeys[rowIndex][1]);
|
|
}
|
|
SelectList = SelectList.Distinct().ToList();
|
|
int i = 0; //检验数量
|
|
string jot_id = string.Empty, hotProessTrustId = string.Empty, hardTestReportId = string.Empty, isoidLog = string.Empty;
|
|
foreach (var item in SelectList)
|
|
{
|
|
string[] ids = item.Split(',');
|
|
jot_id = ids[0];
|
|
hotProessTrustId = ids[1];
|
|
Model.HJGL_CH_HardTestReportItem oldHardTestReportItem = BLL.HJGL_CH_HardTestReportService.GetHardTestReportItemByJotIDAndHotProessTrustId(jot_id, hotProessTrustId);
|
|
if (oldHardTestReportItem == null) //该焊口尚未生成硬度检验报告记录
|
|
{
|
|
Model.HJGL_PW_JointInfo joint = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(jot_id);
|
|
Model.HJGL_PW_IsoInfo iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(joint.ISO_ID);
|
|
Model.HJGL_BS_ExecStandard exd = BLL.HJGL_ExecStandardService.GetExecStandardById(iso.ISO_Executive);
|
|
bool isNeedMat = false; //是否需要录入母材
|
|
bool isNoSameMat = false; //材质1和材质2是否不同
|
|
|
|
if (exd != null && exd.ExecStandardName.Contains("DL"))
|
|
{
|
|
isNeedMat = true;
|
|
}
|
|
if (!string.IsNullOrEmpty(joint.STE_ID2) && joint.STE_ID != joint.STE_ID2) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
isNoSameMat = true;
|
|
}
|
|
|
|
if (isoidLog != joint.ISO_ID) //新管线的记录
|
|
{
|
|
Model.HJGL_CH_HardTestReport oldHardTestReport = BLL.HJGL_CH_HardTestReportService.GetCH_HardTestReportByID(hardTestReportId);
|
|
if (oldHardTestReport != null) //更新之前硬度检验报告的热处理状态和检验数量
|
|
{
|
|
oldHardTestReport.HotProessState = "消应力热处理";
|
|
oldHardTestReport.TestCount = i;
|
|
BLL.HJGL_CH_HardTestReportService.UpdateCH_HardTestReport(oldHardTestReport);
|
|
}
|
|
|
|
i = 0; //检验数量清零
|
|
i++; //检验数量+1
|
|
isoidLog = joint.ISO_ID;
|
|
hardTestReportId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReport));
|
|
//生成硬度委托及硬度检验报告记录
|
|
Model.HJGL_CH_HardTestReport hardTestReport = new Model.HJGL_CH_HardTestReport();
|
|
hardTestReport.HardTestReportId = hardTestReportId;
|
|
hardTestReport.HotHardCode = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCodeByProjectId", "dbo.HJGL_CH_HardTestReport", "HotHardCode", joint.ProjectId, BLL.Base_ProjectService.GetProjectCode(joint.ProjectId) + "-" + iso.ISO_IsoNo + "-");
|
|
hardTestReport.ProjectId = joint.ProjectId;
|
|
hardTestReport.ISO_ID = iso.ISO_ID;
|
|
var date = (from x in Funs.DB.HJGL_CH_HotProessTrustItem
|
|
where x.JOT_ID == joint.JOT_ID
|
|
orderby x.TrustDate descending
|
|
select x.TrustDate).FirstOrDefault();
|
|
hardTestReport.TestDate = date;
|
|
hardTestReport.TrustUnitId = iso.BSU_ID;
|
|
hardTestReport.TestStandard = "GB/T17394.1-2014";
|
|
hardTestReport.STE_ID = iso.STE_ID;
|
|
Model.Project_Sys_Set equipment = BLL.Project_SysSetService.GetSysSetBySetId("6", joint.ProjectId);
|
|
if (equipment != null)
|
|
{
|
|
hardTestReport.EquipmentId = equipment.SetValue;
|
|
Model.HJGL_BS_Equipment eq = BLL.HJGL_EquipmentService.GetEquipmentById(equipment.SetValue);
|
|
if (eq != null)
|
|
{
|
|
hardTestReport.InstrumentType = eq.EquipmentName;
|
|
}
|
|
}
|
|
//项目承包单位信息
|
|
hardTestReport.ContractUnit = "镇海石化建安工程有限公司";
|
|
hardTestReport.TestMethod = "里氏硬度";
|
|
hardTestReport.FileType = "T"; //硬度检测记录
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReport(hardTestReport);
|
|
//回写焊口硬度委托时间
|
|
BLL.HJGL_PW_JointInfoService.WriteBackHardTrustDate(jot_id, hardTestReport.TestDate);
|
|
|
|
}
|
|
else
|
|
{
|
|
i++; //检验数量+1
|
|
//回写焊口硬度委托时间
|
|
BLL.HJGL_PW_JointInfoService.WriteBackHardTrustDate(jot_id, DateTime.Now);
|
|
}
|
|
//增加硬度委托明细信息
|
|
Model.HJGL_CH_HardTestReportItem newItemT11 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItemT11.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItemT11.HardTestReportId = hardTestReportId;
|
|
newItemT11.JOT_ID = jot_id;
|
|
newItemT11.TestPart = "焊缝";
|
|
newItemT11.SortIndex = 1;
|
|
newItemT11.IsShow = true;
|
|
newItemT11.HotProessTrustId = hotProessTrustId;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItemT11);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItemT21 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItemT21.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItemT21.HardTestReportId = hardTestReportId;
|
|
newItemT21.JOT_ID = jot_id;
|
|
newItemT21.TestPart = "热影响区";
|
|
newItemT21.SortIndex = 2;
|
|
newItemT21.IsShow = true;
|
|
newItemT21.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItemT21.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItemT21);
|
|
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
Model.HJGL_CH_HardTestReportItem newItemT51 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItemT51.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItemT51.HardTestReportId = hardTestReportId;
|
|
newItemT51.JOT_ID = jot_id;
|
|
newItemT51.TestPart = "热影响区";
|
|
newItemT51.SortIndex = 5;
|
|
newItemT51.IsShow = true;
|
|
newItemT51.HotProessTrustId = hotProessTrustId;
|
|
newItemT51.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItemT51);
|
|
}
|
|
|
|
|
|
|
|
if (isNeedMat)
|
|
{
|
|
Model.HJGL_CH_HardTestReportItem newItemT61 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItemT61.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItemT61.HardTestReportId = hardTestReportId;
|
|
newItemT61.JOT_ID = jot_id;
|
|
newItemT61.TestPart = "母材";
|
|
newItemT61.SortIndex = 6;
|
|
newItemT61.IsShow = true;
|
|
newItemT61.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItemT61.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItemT61);
|
|
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
Model.HJGL_CH_HardTestReportItem newItemT71 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItemT71.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItemT71.HardTestReportId = hardTestReportId;
|
|
newItemT71.JOT_ID = jot_id;
|
|
newItemT71.TestPart = "母材";
|
|
newItemT71.SortIndex = 7;
|
|
newItemT71.IsShow = true;
|
|
newItemT71.HotProessTrustId = hotProessTrustId;
|
|
newItemT71.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItemT71);
|
|
}
|
|
}
|
|
|
|
|
|
//增加硬度检验报告明细信息
|
|
Model.HJGL_CH_HardTestReportItem newItem11 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem11.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem11.JOT_ID = jot_id;
|
|
newItem11.TestPart = "焊缝";
|
|
newItem11.SortIndex = 1;
|
|
newItem11.IsShow = true;
|
|
newItem11.HotProessTrustId = hotProessTrustId;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem11);
|
|
Model.HJGL_CH_HardTestReportItem newItem12 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem12.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem12.JOT_ID = jot_id;
|
|
newItem12.TestPart = "焊缝";
|
|
newItem12.SortIndex = 1;
|
|
newItem12.IsShow = false;
|
|
newItem12.HotProessTrustId = hotProessTrustId;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem12);
|
|
Model.HJGL_CH_HardTestReportItem newItem13 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem13.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem13.JOT_ID = jot_id;
|
|
newItem13.TestPart = "焊缝";
|
|
newItem13.SortIndex = 1;
|
|
newItem13.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem13.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem13);
|
|
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem21 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem21.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem21.JOT_ID = jot_id;
|
|
newItem21.TestPart = "热影响区";
|
|
newItem21.SortIndex = 2;
|
|
newItem21.IsShow = true;
|
|
newItem21.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem21.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem21);
|
|
Model.HJGL_CH_HardTestReportItem newItem22 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem22.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem22.JOT_ID = jot_id;
|
|
newItem22.TestPart = "热影响区";
|
|
newItem22.SortIndex = 2;
|
|
newItem22.IsShow = false;
|
|
newItem22.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem22.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem22);
|
|
Model.HJGL_CH_HardTestReportItem newItem23 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem23.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem23.JOT_ID = jot_id;
|
|
newItem23.TestPart = "热影响区";
|
|
newItem23.SortIndex = 2;
|
|
newItem23.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem23.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem23);
|
|
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
Model.HJGL_CH_HardTestReportItem newItem51 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem51.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem51.JOT_ID = jot_id;
|
|
newItem51.TestPart = "热影响区";
|
|
newItem51.SortIndex = 5;
|
|
newItem51.IsShow = true;
|
|
newItem51.HotProessTrustId = hotProessTrustId;
|
|
newItem51.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem51);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem52 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem52.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem52.JOT_ID = jot_id;
|
|
newItem52.TestPart = "热影响区";
|
|
newItem52.SortIndex = 5;
|
|
newItem52.IsShow = false;
|
|
newItem52.HotProessTrustId = hotProessTrustId;
|
|
newItem52.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem52);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem53 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem53.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem53.JOT_ID = jot_id;
|
|
newItem53.TestPart = "热影响区";
|
|
newItem53.SortIndex = 5;
|
|
newItem53.HotProessTrustId = hotProessTrustId;
|
|
newItem53.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem53);
|
|
}
|
|
|
|
if (isNeedMat)
|
|
{
|
|
Model.HJGL_CH_HardTestReportItem newItem61 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem61.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem61.JOT_ID = jot_id;
|
|
newItem61.TestPart = "母材";
|
|
newItem61.SortIndex = 6;
|
|
newItem61.IsShow = true;
|
|
newItem61.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem61.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem61);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem62 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem62.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem62.JOT_ID = jot_id;
|
|
newItem62.TestPart = "母材";
|
|
newItem62.SortIndex = 6;
|
|
newItem62.IsShow = false;
|
|
newItem62.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem62.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem62);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem63 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem63.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem63.JOT_ID = jot_id;
|
|
newItem63.TestPart = "母材";
|
|
newItem63.SortIndex = 6;
|
|
newItem63.HotProessTrustId = hotProessTrustId;
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
newItem63.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID).STE_Code;
|
|
}
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem63);
|
|
|
|
if (isNoSameMat) //材质2不为空,且材质1与材质2不同
|
|
{
|
|
Model.HJGL_CH_HardTestReportItem newItem71 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem71.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem71.JOT_ID = jot_id;
|
|
newItem71.TestPart = "母材";
|
|
newItem71.SortIndex = 7;
|
|
newItem71.IsShow = true;
|
|
newItem71.HotProessTrustId = hotProessTrustId;
|
|
newItem71.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem71);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem72 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem72.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem72.JOT_ID = jot_id;
|
|
newItem72.TestPart = "母材";
|
|
newItem72.SortIndex = 7;
|
|
newItem72.IsShow = false;
|
|
newItem72.HotProessTrustId = hotProessTrustId;
|
|
newItem72.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem72);
|
|
|
|
Model.HJGL_CH_HardTestReportItem newItem73 = new Model.HJGL_CH_HardTestReportItem();
|
|
newItem73.HardTestReportItemId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HardTestReportItem));
|
|
newItem73.JOT_ID = jot_id;
|
|
newItem73.TestPart = "母材";
|
|
newItem73.SortIndex = 7;
|
|
newItem73.HotProessTrustId = hotProessTrustId;
|
|
newItem73.Remark = BLL.HJGL_MaterialService.GetSteelBySteID(joint.STE_ID2).STE_Code;
|
|
BLL.HJGL_CH_HardTestReportService.AddCH_HardTestReportItem(newItem73);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//更新之前硬度检验报告的热处理状态和检验数量
|
|
Model.HJGL_CH_HardTestReport oldHardTestReport2 = BLL.HJGL_CH_HardTestReportService.GetCH_HardTestReportByID(hardTestReportId);
|
|
if (oldHardTestReport2 != null)
|
|
{
|
|
oldHardTestReport2.HotProessState = "消应力热处理";
|
|
oldHardTestReport2.TestCount = i;
|
|
BLL.HJGL_CH_HardTestReportService.UpdateCH_HardTestReport(oldHardTestReport2);
|
|
}
|
|
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "生成硬度检测记录!");
|
|
ShowNotify("成功生成硬度检测记录!", MessageBoxIcon.Success);
|
|
BindGrid();
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 点击TreeView
|
|
/// <summary>
|
|
/// 点击TreeView
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
var isoList = (from x in Funs.DB.HJGL_PW_IsoInfo
|
|
where x.ProjectId == this.tvControlItem.SelectedNodeID
|
|
select new { x.ISO_ID, x.ISO_IsoNo }).Distinct();
|
|
this.drpIsoNo.Items.Clear();
|
|
this.drpIsoNo.DataSource = isoList;
|
|
this.drpIsoNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpIsoNo);
|
|
this.drpIsoNo.SelectedValue = BLL.Const._Null;
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
|
|
#region 数据绑定
|
|
|
|
#region 加载明细表信息
|
|
/// <summary>
|
|
/// 数据绑定
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
int[] selections = Grid1.SelectedRowIndexArray;
|
|
foreach (int rowIndex in selections)
|
|
{
|
|
SelectList.Add(Grid1.DataKeys[rowIndex][0] + "," + Grid1.DataKeys[rowIndex][1]);
|
|
}
|
|
string strSql = @"select distinct ISO_IsoNo,JointInfo.JOT_JointNo+
|
|
ISNULL((SELECT TOP 1 RepairMark FROM dbo.HJGL_CH_HotProessTrustItem TrustItem
|
|
LEFT JOIN dbo.HJGL_CH_RepairItemRecord AS record ON record.RepairItemRecordId=TrustItem.TrustItemID
|
|
WHERE TrustItem.JOT_ID=Item.JOT_ID AND TrustItem.HotProessTrustId=Item.HotProessTrustId),'')+
|
|
ISNULL(hti.HardRepairMark,'') AS JOT_JointNo,Item.JOT_ID,Item.HotProessTrustId,JOT_Dia,JOT_Sch,JOT_WeldDate,JOT_JointAttribute,WME_Name,JOT_Location,
|
|
(CASE WHEN JointInfo.JOT_CellWelder!=JointInfo.JOT_FloorWelder THEN Welder1.WED_Code+'/'+Welder2.WED_Code ELSE Welder1.WED_Code END) AS WED_Code,
|
|
(CASE WHEN Steel.STE_Code IS NOT NULL AND Steel2.STE_Code IS NOT NULL and Steel.STE_Code!=Steel2.STE_Code
|
|
THEN Steel.STE_Code + '/' + Steel2.STE_Code
|
|
WHEN Steel.STE_Code IS NOT NULL THEN Steel.STE_Code
|
|
ELSE ISNULL(Steel2.STE_Code,'') END) AS STE_Code --材质
|
|
from dbo.HJGL_HotProessItem Item
|
|
LEFT JOIN HJGL_PW_JointInfo AS JointInfo ON JointInfo.JOT_ID = Item.JOT_ID
|
|
LEFT JOIN HJGL_CH_HotProessTrustItem AS hti ON hti.JOT_ID = Item.JOT_ID
|
|
LEFT JOIN HJGL_BS_Steel AS Steel ON Steel.STE_ID=JointInfo.STE_ID
|
|
LEFT JOIN HJGL_BS_Steel AS Steel2 ON Steel2.STE_ID=JointInfo.STE_ID2
|
|
left join HJGL_BS_WeldMethod AS WeldMethod on WeldMethod.WME_ID=JointInfo.WME_ID
|
|
LEFT JOIN HJGL_PW_IsoInfo AS iso ON JointInfo.ISO_ID = iso.ISO_ID
|
|
LEFT JOIN HJGL_BS_IsoClass AS IsoClass ON IsoClass.ISC_ID =iso.ISC_ID
|
|
LEFT JOIN HJGL_BS_Service AS Ser ON Ser.SER_ID = iso.SER_ID
|
|
LEFT JOIN HJGL_BS_Welder AS Welder1 ON Welder1.WED_ID = JointInfo.JOT_CellWelder
|
|
LEFT JOIN HJGL_BS_Welder AS Welder2 ON Welder2.WED_ID = JointInfo.JOT_FloorWelder
|
|
LEFT JOIN HJGL_BO_WeldReportMain AS WeldReportMain on WeldReportMain.DReportID=JointInfo.DReportID
|
|
where JointInfo.ProjectId=@ProjectId and RecordChartNo is not null and RecordChartNo!='' and Item.ProessTypes='4'
|
|
and (select count(*) from HJGL_CH_HardTestReportItem rItem where rItem.JOT_ID=Item.JOT_ID and rItem.HotProessTrustId=Item.HotProessTrustId)=0";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID));
|
|
if (this.drpIsoNo.SelectedValue != BLL.Const._Null)
|
|
{
|
|
strSql += " AND JointInfo.ISO_ID = @IsoId";
|
|
listStr.Add(new SqlParameter("@IsoId", this.drpIsoNo.SelectedValue));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
// 2.获取当前排序(如不分页要调用这个排序方法)
|
|
//var table = this.GetSortTable(Grid1, tb);
|
|
// 2.获取当前分页数据
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
#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 ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 排序
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
//Grid1.SortDirection = e.SortDirection;
|
|
//Grid1.SortField = e.SortField;
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |