ChengDa_English/SGGL/FineUIPro.Web/HJGL/CheckManage/CheckManage.aspx.cs

1808 lines
88 KiB
C#
Raw Normal View History

2022-03-15 17:36:38 +08:00
using BLL;
2022-12-20 09:32:32 +08:00
using Newtonsoft.Json.Linq;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
2022-03-15 17:36:38 +08:00
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
2022-12-20 09:32:32 +08:00
using System.Linq;
2022-03-15 17:36:38 +08:00
namespace FineUIPro.Web.HJGL.CheckManage
{
public partial class CheckManage : PageBase
{
#region
/// <summary>
/// 检测主键
/// </summary>
public string CHT_CheckID
{
get
{
return (string)ViewState["CHT_CheckID"];
}
set
{
ViewState["CHT_CheckID"] = value;
}
}
/// <summary>
/// 委托单号
/// </summary>
public string CH_TrustID
{
get
{
return (string)ViewState["CH_TrustID"];
}
set
{
ViewState["CH_TrustID"] = value;
}
}
/// <summary>
/// 焊口信息
/// </summary>
public string[] jointInfo
{
get
{
return (string[])ViewState["jointInfo"];
}
set
{
ViewState["jointInfo"] = value;
}
}
/// <summary>
/// 检测类型
/// </summary>
public string NDTTypeCode
{
get
{
return (string)ViewState["NDTTypeCode"];
}
set
{
ViewState["NDTTypeCode"] = value;
}
}
/// <summary>
/// 检测单细表集合
/// </summary>
public static List<Model.View_CH_CheckItem> checkItems = new List<Model.View_CH_CheckItem>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
2022-12-20 09:32:32 +08:00
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpCheckUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_5, true);
//报表类型
this.drpPrintType.DataTextField = "Text";
this.drpPrintType.DataValueField = "Value";
this.drpPrintType.DataSource = BLL.DropListService.NDTCheckSelectPrint();
this.drpPrintType.DataBind();
//查询检测单位
//施工单位、装置
//if (BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId) == null || BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId).UnitTypeId == BLL.Const.ProjectUnitType_1 || BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId).UnitTypeId == BLL.Const.ProjectUnitType_5)
//{
// BLL.UnitService.InitUnitNameByUnitTypeDropDownList(this.drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
// BLL.Project_InstallationService.InitInstallationDropDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, true);
//}
//else
//{
// BLL.UnitService.InitSubUnitNameDownList(this.drpUnit, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
// BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.CurrUser.UnitId, true);
//}
2022-03-15 17:36:38 +08:00
var pUnit = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2);
if (pUnit != null)
{
this.drpUnit.DataTextField = "UnitName";
this.drpUnit.DataValueField = "UnitId";
this.drpUnit.DataSource = pUnit;
this.drpUnit.DataBind();
this.drpUnit.SelectedValue = this.CurrUser.UnitId;
if(this.CurrUser.UnitId !=Const.UnitId_CD && this.CurrUser.UserId != Const.hfnbdId)
{
this.drpUnit.Enabled = false;
}
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
this.drpInstallationId.SelectedIndex = 0;
}
BLL.UserService.InitUserDropDownList(this.drpTabler, this.CurrUser.LoginProjectId, true);//制单人
BLL.UserService.InitUserDropDownList(this.ddlAuditMan, this.CurrUser.LoginProjectId, true);//审核人
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpContractualUnits, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_5, true);//检测单位
if (drpContractualUnits.Items.Count > 1)
{
drpContractualUnits.SelectedIndex = 1;
BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.ddlCheckMan, this.CurrUser.LoginProjectId, drpContractualUnits.SelectedValue, true);//检测人
if (ddlCheckMan.Items.Count > 1)
{
ddlCheckMan.SelectedIndex = 1;
}
}
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.drpTabler.SelectedValue = this.CurrUser.UserId;
this.txtCheckType.Text = "C1";
this.txtCheckTime.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
this.InitTreeMenu();//加载树
}
}
#endregion
#region --
/// <summary>
/// 加载树
/// </summary>
private void InitTreeMenu()
{
if (!string.IsNullOrEmpty(this.txtCheckTime.Text.Trim()))
{
DateTime? startTime = Funs.GetNewDateTime(this.txtCheckTime.Text.Trim());
DateTime? endTime = startTime.HasValue ? startTime.Value.AddMonths(1) : System.DateTime.Now;
this.tvControlItem.Nodes.Clear();
TreeNode rootNode = new TreeNode();
rootNode.Text = "单位-装置-月份";
rootNode.NodeID = "0";
rootNode.Expanded = true;
this.tvControlItem.Nodes.Add(rootNode);
List<Model.Base_Unit> units = null;
var unit = BLL.ProjectUnitService.GetProjectUnitByUnitIdProjectId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId);
if (unit == null || unit.UnitType == BLL.Const.ProjectUnitType_1 || unit.UnitType == BLL.Const.ProjectUnitType_5 || unit.UnitType == BLL.Const.ProjectUnitType_3)
{
if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
{
units = (from x in Funs.DB.Base_Unit
join y in Funs.DB.ProjectData_WorkArea on x.UnitId equals y.UnitId
where (x.UnitId == this.CurrUser.UnitId || y.SupervisorUnitId == this.CurrUser.UnitId) && y.ProjectId == this.CurrUser.LoginProjectId
select x).Distinct().ToList();
}
else
{
units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, "2");
}
}
else
{
units = (from x in Funs.DB.Base_Unit where x.UnitId == this.CurrUser.UnitId select x).ToList();
}
List<Model.CH_Check> checkLists = new List<Model.CH_Check>(); ///检测单
if (!this.txtCheckTime.Hidden)
{
checkLists = (from x in Funs.DB.CH_Check
2022-12-20 09:32:32 +08:00
where x.ProjectId == this.CurrUser.LoginProjectId && x.CHT_CheckDate >= startTime && x.CHT_CheckDate < endTime
2022-03-15 17:36:38 +08:00
select x).ToList();
}
else
{
checkLists = (from x in Funs.DB.CH_Check
where x.ProjectId == this.CurrUser.LoginProjectId && x.CHT_CheckCode.Contains(this.txtSearchCode.Text.Trim())
select x).ToList();
}
if (this.drpCheckUnit.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpCheckUnit.SelectedValue))
{
checkLists = (from x in Funs.DB.CH_Check
where x.ProjectId == this.CurrUser.LoginProjectId && x.ContractualUnits == this.drpCheckUnit.SelectedValue
select x).ToList();
}
if (units != null)
{
foreach (var item in units)
{
TreeNode rootUnitNode = new TreeNode();//定义根节点
rootUnitNode.Text = item.UnitName;
rootUnitNode.NodeID = item.UnitId;
rootUnitNode.Expanded = true;
rootUnitNode.ToolTip = "施工单位";
rootNode.Nodes.Add(rootUnitNode);
2022-12-20 09:32:32 +08:00
if (this.CurrUser.UnitId != Const.UnitId_CD && this.CurrUser.UserId != Const.hfnbdId)
{
if (!string.IsNullOrEmpty(txtTrust.Text))
{
var TrustList = Funs.DB.CH_Trust.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.CH_TrustCode.Contains(txtTrust.Text)).Select(x => x.CH_TrustID).ToList();
var checkList = checkLists.Where(x => x.UnitId == item.UnitId && x.UnitId == this.CurrUser.UnitId&& TrustList.Contains(x.CH_TrustID)).ToList();
this.BindNodes(rootUnitNode, checkList);
}
else
{
var checkList = checkLists.Where(x => x.UnitId == item.UnitId && x.UnitId == this.CurrUser.UnitId).ToList();
this.BindNodes(rootUnitNode, checkList);
}
}
else
{
if (!string.IsNullOrEmpty(txtTrust.Text))
{
var TrustList = Funs.DB.CH_Trust.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.CH_TrustCode.Contains(txtTrust.Text)).Select(x => x.CH_TrustID).ToList();
var checkList = checkLists.Where(x => x.UnitId == item.UnitId && TrustList.Contains(x.CH_TrustID)).ToList();
this.BindNodes(rootUnitNode, checkList);
}
else
{
var checkList = checkLists.Where(x => x.UnitId == item.UnitId).ToList();
this.BindNodes(rootUnitNode, checkList);
}
}
2022-03-15 17:36:38 +08:00
}
}
else
{
Alert.ShowInTop("请先增加施工单位!", MessageBoxIcon.Warning);
return;
}
}
else
{
Alert.ShowInTop("请选择检测报告月份!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 绑定树节点
/// </summary>
/// <param name="node"></param>
private void BindNodes(TreeNode node, List<Model.CH_Check> checkList)
{
if (node.ToolTip == "施工单位")
{
var installId = (from x in checkList select x.InstallationId).Distinct();
if (installId.Count() > 0)
{
var install = from x in Funs.DB.Project_Installation where installId.Contains(x.InstallationId) orderby x.InstallationCode select x;
foreach (var q in install)
{
TreeNode newNode = new TreeNode();
newNode.Text = q.InstallationName;
newNode.NodeID = q.InstallationId + "|" + node.NodeID; ;
newNode.ToolTip = "装置";
newNode.Expanded = true;
node.Nodes.Add(newNode);
this.BindNodes(newNode, checkList);
}
}
}
else if (node.ToolTip == "装置")
{
string installationId = Funs.GetStrListByStr(node.NodeID, '|')[0];
var pointListMonth = (from x in checkList
where x.InstallationId == installationId && x.UnitId == node.ParentNode.NodeID
select string.Format("{0:yyyy-MM}", x.CHT_CheckDate)).Distinct();
foreach (var item in pointListMonth)
{
TreeNode newNode = new TreeNode();
newNode.Text = item;
newNode.NodeID = item + "|" + node.NodeID; ;
newNode.ToolTip = "月份";
node.Nodes.Add(newNode);
this.BindNodes(newNode, checkList);
}
}
else if (node.ToolTip == "月份")
{
string installationId = Funs.GetStrListByStr(node.ParentNode.NodeID, '|')[0];
var days = (from x in checkList
where x.InstallationId == installationId && x.UnitId == node.ParentNode.ParentNode.NodeID
orderby x.CHT_CheckDate descending
select x.CHT_CheckDate).Distinct();
foreach (var item in days)
{
TreeNode newNode = new TreeNode();
newNode.Text = string.Format("{0:yyyy-MM-dd}", item);
newNode.NodeID = item.ToString() + "|" + node.NodeID; ;
newNode.ToolTip = "日期";
node.Nodes.Add(newNode);
this.BindNodes(newNode, checkList);
}
}
else if (node.ToolTip == "日期")
{
string installationId = Funs.GetStrListByStr(node.ParentNode.ParentNode.NodeID, '|')[0];
var dReports = from x in checkList
where x.InstallationId == installationId && x.UnitId == node.ParentNode.ParentNode.ParentNode.NodeID
&& x.CHT_CheckDate == Funs.GetNewDateTime(node.Text)
orderby x.CHT_CheckCode descending
select x;
foreach (var item in dReports)
{
TreeNode newNode = new TreeNode();
if (!string.IsNullOrEmpty(item.CHT_CheckCode))
{
newNode.Text = item.CHT_CheckCode;
}
else
{
newNode.Text = "未知";
}
if (!item.CHT_AuditDate.HasValue || string.IsNullOrEmpty(item.CHT_AuditMan))
{
newNode.Text = "<font color='#FF7575'>" + newNode.Text + "</font>";
node.Text = "<font color='#FF7575'>" + node.Text + "</font>";
node.ParentNode.Text = "<font color='#FF7575'>" + node.ParentNode.Text + "</font>";
}
newNode.NodeID = item.CHT_CheckID;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
}
}
}
#endregion
#region Tree
/// <summary>
/// 按日期、单号查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ckFind_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.ckFind.SelectedValue == "0")
{
this.txtCheckTime.Hidden = false;
this.txtSearchCode.Hidden = true;
if (string.IsNullOrEmpty(this.txtCheckTime.Text))
{
this.txtCheckTime.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
}
}
else
{
this.txtCheckTime.Hidden = true;
this.txtSearchCode.Hidden = false;
}
this.InitTreeMenu();
}
protected void Tree_TextChanged(object sender, EventArgs e)
{
this.InitTreeMenu();
}
#endregion
#region Tree点击事件
/// <summary>
/// Tree点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2022-12-20 09:32:32 +08:00
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
2022-03-15 17:36:38 +08:00
{
checkItems = new List<Model.View_CH_CheckItem>();
this.CHT_CheckID = this.tvControlItem.SelectedNodeID;
if (!string.IsNullOrEmpty(this.CHT_CheckID))
{
Model.CH_Check check = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
if (check != null)
{
2022-12-20 09:32:32 +08:00
this.CH_TrustID = check.CH_TrustID;
2022-03-15 17:36:38 +08:00
if (BLL.TrustManageEditService.GetCH_TrustByID(CH_TrustID) != null)
{
this.lbtnToTrust.Text = BLL.TrustManageEditService.GetCH_TrustByID(CH_TrustID).CH_TrustCode;
}
this.txtCheckCode.Text = check.CHT_CheckCode;
if (!string.IsNullOrEmpty(check.UnitId))
{
this.drpUnit.SelectedValue = check.UnitId;
this.drpInstallationId.Items.Clear();
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
this.drpInstallationId.SelectedIndex = 0;
}
if (!string.IsNullOrEmpty(check.InstallationId))
{
this.drpInstallationId.SelectedValue = check.InstallationId;
}
this.txtCheckType.Text = check.CHT_CheckType;
if (!string.IsNullOrEmpty(check.CHT_Tabler))
{
this.drpTabler.SelectedValue = check.CHT_Tabler;
}
this.txtTableDate.Text = check.CHT_TableDate.HasValue ? string.Format("{0:yyyy-MM-dd}", check.CHT_TableDate) : "";
this.txtCheckDate.Text = check.CHT_CheckDate.HasValue ? string.Format("{0:yyyy-MM-dd}", check.CHT_CheckDate) : "";
if (!string.IsNullOrEmpty(check.CHT_AuditMan))
{
this.ddlAuditMan.SelectedValue = check.CHT_AuditMan;
}
this.txtAuditDate.Text = check.CHT_AuditDate.HasValue ? string.Format("{0:yyyy-MM-dd}", check.CHT_AuditDate) : "";
if (!string.IsNullOrEmpty(check.CHT_CheckMan))
{
this.ddlCheckMan.SelectedValue = check.CHT_CheckMan;
}
if (!string.IsNullOrEmpty(check.ContractualUnits))
{
this.drpContractualUnits.SelectedValue = check.ContractualUnits;
}
this.txtRemark.Text = check.CHT_Remark;
List<Model.CH_CheckItem> items = BLL.CheckItemManageService.GetTrustItemByCheck(CHT_CheckID);
foreach (var t in items)
{
var checkItem = BLL.CheckItemManageService.GetTrustItemByCheckItem(t.CHT_CheckItemID);
if (checkItem != null)
{
#region
if (!string.IsNullOrEmpty(t.CH_TrustItemID))
{
var trustId = (from x in Funs.DB.CH_TrustItem where x.CH_TrustItemID == t.CH_TrustItemID select x.CH_TrustID).FirstOrDefault();
if (!string.IsNullOrEmpty(trustId))
{
var trust = BLL.TrustManageEditService.GetCH_TrustByID(trustId);
if (trust != null)
{
if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
{
var ndtt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
if (ndtt != null)
{
this.NDTTypeCode = ndtt.DetectionTypeCode;
}
}
}
}
}
#endregion
checkItems.Add(checkItem);
}
}
2022-12-20 09:32:32 +08:00
if (this.NDTTypeCode == "RT")
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
this.Grid1.Hidden = false;
this.Grid2.Hidden = true;
this.Grid1.DataSource = checkItems;
this.Grid1.DataBind();
}
else
{
this.Grid1.Hidden = true;
this.Grid2.Hidden = false;
this.Grid2.DataSource = checkItems;
this.Grid2.DataBind();
2022-03-15 17:36:38 +08:00
}
2022-12-20 09:32:32 +08:00
2022-03-15 17:36:38 +08:00
}
}
else
{
this.CHT_CheckID = string.Empty;
this.Grid1.Hidden = true;
this.Grid2.Hidden = true;
}
}
#endregion
#region
/// <summary>
/// 增加按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAdd_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnAdd))
{
this.CH_TrustID = string.Empty;
this.CHT_CheckID = string.Empty;
this.txtCheckCode.Text = string.Empty;
//this.drpUnit.SelectedIndex = 0;
this.drpInstallationId.SelectedIndex = 0;
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.drpTabler.SelectedValue = this.CurrUser.UserId;
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.txtCheckType.Text = "C1";
this.ddlAuditMan.Text = string.Empty;
this.txtAuditDate.Text = string.Empty;
this.ddlCheckMan.Text = string.Empty;
this.txtRemark.Text = string.Empty;
this.txtCheckTime.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
this.lbtnToTrust.Text = string.Empty;
checkItems.Clear();
checkItems = new List<Model.View_CH_CheckItem>();
this.Grid1.DataSource = null;
this.Grid1.DataBind();
this.Grid2.DataSource = null;
this.Grid2.DataBind();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 查询按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
if (GetButtonPower(BLL.Const.BtnSave))
{
if (this.drpUnit.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpUnit.SelectedValue))
{
Alert.ShowInTop("请选择施工单位!", MessageBoxIcon.Warning);
return;
}
else if (this.drpInstallationId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpInstallationId.SelectedValue))
{
Alert.ShowInTop("请选择装置!", MessageBoxIcon.Warning);
return;
}
else
{
string window = String.Format("ShowTrust.aspx?unitId={0}&&installationId={1}&&ch_TrustID={2}", this.drpUnit.SelectedValue, this.drpInstallationId.SelectedValue, this.CH_TrustID, "编辑 - ");
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(this.hdJOTID.ClientID)
+ Window1.GetShowReference(window));
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
checkItems = new List<Model.View_CH_CheckItem>();
List<string> stringRes = Funs.GetStrListByStr(hdJOTID.Text, '|');
List<string> infos = Funs.GetStrListByStr(stringRes[0], ',');
2022-12-20 09:32:32 +08:00
if (stringRes.Count > 1)
{
this.CH_TrustID = stringRes[1];
}
2022-03-15 17:36:38 +08:00
#region
// 由于删除和其他原因造成委托标志没改变这里处理下02表示一次委托已审核
foreach (var jotId in infos)
{
Model.PW_JointInfo jot = Funs.DB.PW_JointInfo.FirstOrDefault(x => x.JOT_ID == jotId);
if (jot != null)
{
if (jot.JOT_TrustFlag == "00")
{
jot.JOT_TrustFlag = "02";
Funs.DB.SubmitChanges();
}
}
}
#endregion
if (string.IsNullOrEmpty( CHT_CheckID ) )
{
foreach (var item in infos)
{
Model.View_CH_CheckItem info = Funs.DB.View_CH_CheckItem.FirstOrDefault(x => x.JOT_ID == item && x.CH_TrustID == stringRes[1]);
if (info != null)
{
this.NDTTypeCode = info.DetectionTypeCode;
checkItems.Add(info);
}
}
if (stringRes.Count() > 1)
{
var trust = Funs.DB.CH_Trust.FirstOrDefault(x => x.CH_TrustID == stringRes[1]);
if (trust != null)
{
this.CH_TrustID = stringRes[1];
lbtnToTrust.Text = trust.CH_TrustCode;
}
}
}
else
{
var viewCheckItems = BLL.CheckItemManageService.GetViewCheckItemByCheckId(this.CHT_CheckID);
foreach (var item in viewCheckItems)
{
checkItems.Add(item);
}
foreach (var jotid in infos)
{
2022-12-20 09:32:32 +08:00
Model.CH_CheckItem item = BLL.CheckItemManageService.GetCheckItemByJotId(jotid, this.CHT_CheckID);
2022-03-15 17:36:38 +08:00
if (item == null)
{
2022-12-20 09:32:32 +08:00
if (stringRes.Count() > 1)
{
Model.View_CH_CheckItem info = BLL.CheckItemManageService.GetNoCheckViewCheckItemByJOTID(jotid, stringRes[1]);
this.NDTTypeCode = info.DetectionTypeCode;
checkItems.Add(info);
}
else
{
Model.View_CH_CheckItem info = BLL.CheckItemManageService.GetNoCheckViewCheckItemByJOTID(jotid);
this.NDTTypeCode = info.DetectionTypeCode;
checkItems.Add(info);
}
2022-03-15 17:36:38 +08:00
}
}
}
if (checkItems.Count > 0)
{
checkItems = checkItems.OrderBy(x => x.JOT_JointNo).ToList();
if (this.NDTTypeCode == "RT")
{
this.Grid1.Hidden = false;
this.Grid2.Hidden = true;
this.Grid1.DataSource = checkItems;
this.Grid1.DataBind();
}
else
{
this.Grid1.Hidden = true;
this.Grid2.Hidden = false;
this.Grid2.DataSource = checkItems;
this.Grid2.DataBind();
}
}
}
#endregion
#region
/// <summary>
/// 右键删除RT检测单明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnDelete))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
return;
}
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var check = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
if (check != null && check.CHT_AuditDate.HasValue)
{
Alert.ShowInTop("此检测单已审核不能删除!", MessageBoxIcon.Warning);
return;
}
else
{
var item = checkItems.FirstOrDefault(x => x.JOT_ID == rowID);
if (item != null)
{
checkItems.Remove(item);
}
}
}
Grid1.DataSource = checkItems;
Grid1.DataBind();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 右键删除非RT检测单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete2_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnDelete))
{
if (Grid2.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
return;
}
foreach (int rowIndex in Grid2.SelectedRowIndexArray)
{
string rowID = Grid2.DataKeys[rowIndex][0].ToString();
var check = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
if (check != null && check.CHT_AuditDate.HasValue)
{
Alert.ShowInTop("此委托单已审核不能删除!", MessageBoxIcon.Warning);
return;
}
else
{
//getCheckItems();
var item = checkItems.FirstOrDefault(x => x.JOT_ID == rowID);
if (item != null)
{
checkItems.Remove(item);
}
}
}
Grid2.DataSource = checkItems;
Grid2.DataBind();
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 删除按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnDelete_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnDelete))
{
this.CHT_CheckID = this.tvControlItem.SelectedNodeID;
if (!string.IsNullOrEmpty(this.CHT_CheckID))
{
var check = BLL.CheckManageService.GetCheckByCHT_CheckID(CHT_CheckID);
if (check != null && !check.CHT_AuditDate.HasValue)
{
BLL.CheckItemManageService.DeleteCheckItemByCheckId(CHT_CheckID);
BLL.CheckManageService.DeleteCheck(CHT_CheckID);
if (checkItems != null)
{
foreach (var j in checkItems)
{
BLL.CheckItemManageService.UpdateJointCheckFlag(j.JOT_ID, "2");
}
}
checkItems.Clear();
this.CHT_CheckID = null;
this.Grid1.DataSource = null;
this.Grid1.DataBind();
this.Grid2.DataSource = null;
this.Grid2.DataBind();
ShowNotify("删除成功!", MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop("此检测单已审核不能删除", MessageBoxIcon.Warning);
return;
}
}
else
{
Alert.ShowInTop("请选择要删除的检测单!", MessageBoxIcon.Warning);
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.GetButtonPower(BLL.Const.BtnSave))
{
var updateCheck = BLL.CheckManageService.GetCheckByCHT_CheckID(CHT_CheckID);
if (updateCheck != null && updateCheck.CHT_AuditDate.HasValue)
{
Alert.ShowInTop("此检测单已审核不能修改!", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.txtCheckCode.Text))
{
Alert.ShowInTop("请输入探伤单号!", MessageBoxIcon.Warning);
return;
}
if (this.drpUnit.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpUnit.SelectedValue))
{
Alert.ShowInTop("请选择施工单位!", MessageBoxIcon.Warning);
return;
}
if (this.drpInstallationId.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.drpInstallationId.SelectedValue))
{
Alert.ShowInTop("请选择装置!", MessageBoxIcon.Warning);
return;
}
if (this.NDTTypeCode == "RT")
{
JArray mergedData = Grid1.GetMergedData();
foreach (JObject mergedRow in mergedData)
{
string status = mergedRow.Value<string>("status");
JObject values = mergedRow.Value<JObject>("values");
string rowID = values.Value<string>("JOT_ID").ToString();
2022-12-20 09:32:32 +08:00
var item = checkItems.FirstOrDefault(x => x.JOT_ID == rowID&&x.CH_TrustID==this.CH_TrustID);
2022-03-15 17:36:38 +08:00
if (item != null)
{
item.CHT_FilmDate = Funs.GetNewDateTime(values.Value<string>("CHT_FilmDate"));
item.CHT_ReportDate = Funs.GetNewDateTime(values.Value<string>("CHT_ReportDate"));
item.CHT_RepairLocation = values.Value<string>("CHT_RepairLocation");
item.CHT_TotalFilm = Funs.GetNewInt(values.Value<string>("CHT_TotalFilm"));
item.CHT_PassFilm = Funs.GetNewInt(values.Value<string>("CHT_PassFilm"));
item.CHT_CheckResult = values.Value<string>("CHT_CheckResult");
item.FilmSpecifications = values.Value<string>("FilmSpecifications");
item.CHT_CheckNo = values.Value<string>("CHT_CheckNo");
item.CHT_Remark = values.Value<string>("CHT_Remark");
2022-12-20 09:32:32 +08:00
item.Defects_Definition = values.Value<string>("Defects_Definition");
2022-03-15 17:36:38 +08:00
}
}
}
else
{
JArray mergedData = Grid2.GetMergedData();
foreach (JObject mergedRow in mergedData)
{
string status = mergedRow.Value<string>("status");
JObject values = mergedRow.Value<JObject>("values");
string rowID = values.Value<string>("JOT_ID").ToString();
2022-12-20 09:32:32 +08:00
var item = checkItems.FirstOrDefault(x => x.JOT_ID == rowID && x.CH_TrustID == this.CH_TrustID);
2022-03-15 17:36:38 +08:00
if (item != null)
{
item.CHT_FilmDate = Funs.GetNewDateTime(values.Value<string>("CHT_FilmDate"));
item.CHT_ReportDate = Funs.GetNewDateTime(values.Value<string>("CHT_ReportDate"));
item.JointCount = values.Value<string>("JointCount");
2022-12-20 09:32:32 +08:00
item.CHT_RepairLocation = values.Value<string>("CHT_RepairLocation");
2022-03-15 17:36:38 +08:00
item.DefectLength = Funs.GetNewDecimal(values.Value<string>("DefectLength"));
2022-12-20 09:32:32 +08:00
item.DefectHeight = Funs.GetNewDecimal(values.Value<string>("DefectHeight"));
item.DefectDepth = Funs.GetNewDecimal(values.Value<string>("DefectDepth"));
2022-03-15 17:36:38 +08:00
item.CHT_CheckResult = values.Value<string>("CHT_CheckResult");
item.ExtendingRice = Funs.GetNewDecimal(values.Value<string>("ExtendingRice"));
item.CHT_CheckNo = values.Value<string>("CHT_CheckNo");
2022-12-20 09:32:32 +08:00
item.Defects_Definition = values.Value<string>("Defects_Definition");
2022-03-15 17:36:38 +08:00
}
}
}
if (checkItems.Count > 0)
{
foreach (var item in checkItems)
{
if (this.NDTTypeCode == "RT")
{
if (item.CHT_FilmDate == null)
{
Alert.ShowInTop("拍片日期不能为空!", MessageBoxIcon.Warning);
return;
}
if (item.CHT_TotalFilm == null || item.CHT_PassFilm == null)
{
Alert.ShowInTop("拍片总数和拍片数不能为空!", MessageBoxIcon.Warning);
return;
}
if (item.CHT_TotalFilm < item.CHT_PassFilm)
{
Alert.ShowInTop("合格片数不能大于拍片总数!", MessageBoxIcon.Warning);
return;
}
}
else
{
if (item.CHT_FilmDate == null)
{
Alert.ShowInTop("探伤日期不能为空!", MessageBoxIcon.Warning);
return;
}
}
}
#region
Model.CH_Check check = new Model.CH_Check();
check.ProjectId = this.CurrUser.LoginProjectId;
check.CHT_CheckCode = this.txtCheckCode.Text.Trim();
//if (checkItems.Count() > 0)
//{
// var q = from x in Funs.DB.CH_TrustItem where x.CH_TrustItemID == checkItems.First().CH_TrustItemID select x;
// check.CH_TrustID = q.First().CH_TrustID;
//}
check.CH_TrustID = this.CH_TrustID;
check.UnitId = this.drpUnit.SelectedValue;
check.InstallationId = this.drpInstallationId.SelectedValue;
check.CHT_CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text);
check.CHT_CheckType = this.txtCheckType.Text.Trim();
if (this.drpTabler.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpTabler.SelectedValue))
{
check.CHT_Tabler = this.drpTabler.SelectedValue;
}
check.CHT_TableDate = Funs.GetNewDateTime(this.txtTableDate.Text);
if (this.ddlAuditMan.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.ddlAuditMan.SelectedValue))
{
check.CHT_AuditMan = this.ddlAuditMan.SelectedValue;
}
check.CHT_AuditDate = Funs.GetNewDateTime(this.txtAuditDate.Text);
if (this.ddlCheckMan.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.ddlCheckMan.SelectedValue))
{
check.CHT_CheckMan = this.ddlCheckMan.SelectedValue;
}
check.CHT_Remark = this.txtRemark.Text.Trim();
if (this.drpContractualUnits.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpContractualUnits.SelectedValue))
{
check.ContractualUnits = this.drpContractualUnits.SelectedValue;
}
if (updateCheck != null && !string.IsNullOrEmpty(CHT_CheckID))
{
if (updateCheck.CHT_CheckCode != this.txtCheckCode.Text.Trim())
{
if (BLL.CheckManageService.IsExistCheckCode(this.CurrUser.LoginProjectId, this.txtCheckCode.Text.Trim()))
{
Alert.ShowInTop("此检测单号已经存在!", MessageBoxIcon.Warning);
return;
}
}
check.CHT_CheckID = CHT_CheckID;
BLL.CheckManageService.UpdateCheck(check);
if (jointInfo != null)
{
foreach (var j in jointInfo)
{
var chckItem = BLL.CheckItemManageService.GetTrustItemByCheckAndJotId(check.CHT_CheckID, j);
if (chckItem != null)
{
BLL.CheckItemManageService.UpdateJointCheckFlag(j, "2");
}
}
}
BLL.CheckItemManageService.DeleteCheckItemByCheckId(CHT_CheckID);
//BLL.LogService.AddLog(this.CurrUser.UserId, "修改检测单信息!");
}
else
{
if (BLL.CheckManageService.IsExistCheckCode(this.CurrUser.LoginProjectId, this.txtCheckCode.Text.Trim()))
{
Alert.ShowInTop("此检测单号已经存在!", MessageBoxIcon.Warning);
return;
}
check.CHT_CheckID = SQLHelper.GetNewID(typeof(Model.CH_Check));
BLL.CheckManageService.AddCheck(check);
//BLL.LogService.AddLog(this.CurrUser.UserId, "添加检测单信息!");
}
#endregion
#region
foreach (var item in checkItems)
{
Model.CH_CheckItem checkitem = new Model.CH_CheckItem();
checkitem.CHT_CheckID = check.CHT_CheckID;
checkitem.JOT_ID = item.JOT_ID;
checkitem.CH_TrustItemID = item.CH_TrustItemID;
checkitem.CHT_CheckMethod = item.CH_NDTMethod;
checkitem.CHT_RequestDate = item.CHT_RequestDate;
checkitem.CHT_RepairLocation = item.CHT_RepairLocation;
checkitem.CHT_TotalFilm = item.CHT_TotalFilm;
checkitem.CHT_PassFilm = item.CHT_PassFilm;
checkitem.CHT_CheckResult = item.CHT_CheckResult;
checkitem.CHT_CheckNo = item.CHT_CheckNo;
checkitem.CHT_FilmDate = item.CHT_FilmDate;
checkitem.CHT_ReportDate = item.CHT_ReportDate;
checkitem.CHT_Remark = item.CHT_Remark;
checkitem.FilmSpecifications = item.FilmSpecifications;
checkitem.DefectLength = item.DefectLength;
2022-12-20 09:32:32 +08:00
checkitem.DefectDepth = item.DefectDepth;
checkitem.DefectHeight = item.DefectHeight;
2022-03-15 17:36:38 +08:00
checkitem.ExtendingRice = item.ExtendingRice;
2022-12-20 09:32:32 +08:00
checkitem.Defects_Definition = item.Defects_Definition;
2022-03-15 17:36:38 +08:00
BLL.CheckItemManageService.AddCheckItem(checkitem);
BLL.CheckItemManageService.UpdateJointCheckFlag(checkitem.JOT_ID, "1");
}
#endregion
ShowNotify("保存成功!", MessageBoxIcon.Success);
checkItems.Clear();
InitTreeMenu();
}
else
{
Alert.ShowInTop("检测单信息不能为空!", MessageBoxIcon.Warning);
return;
}
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
#region DropDownList下拉选择事件
protected void drpContractualUnits_SelectedIndexChanged(object sender, EventArgs e)
{
ddlCheckMan.Items.Clear();
ddlCheckMan.DataBind();
BLL.UserService.InitUserProjectIdUnitIdDropDownList(this.ddlCheckMan, this.CurrUser.LoginProjectId, drpContractualUnits.SelectedValue, true);//检测人
if (ddlCheckMan.Items.Count > 1)
{
ddlCheckMan.SelectedIndex = 1;
}
}
/// <summary>
/// 施工单位下拉选择事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
{
this.drpInstallationId.Items.Clear();
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != BLL.Const._Null)
{
//if (BLL.WorkAreaService.IsSupervisor(this.CurrUser.UnitId, this.CurrUser.LoginProjectId))
//{
// BLL.Project_InstallationService.InitInstallationBySupervisorUnitIdListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, this.CurrUser.UnitId, true);
// this.drpInstallationId.SelectedIndex = 0;
//}
//else
//{
// BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
// this.drpInstallationId.SelectedIndex = 0;
//}
BLL.Project_InstallationService.InitInstallationListDownList(this.drpInstallationId, this.CurrUser.LoginProjectId, this.drpUnit.SelectedValue, true);
this.drpInstallationId.SelectedIndex = 0;
}
else
{
Funs.FineUIPleaseSelect(this.drpInstallationId);
}
}
#endregion
#region
/// <summary>
/// 对应委托单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtnToTrust_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(this.CH_TrustID))
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../TrustManage/ShowTrustItem.aspx?CH_TrustID={0}", this.CH_TrustID, "编辑 - ")));
}
else
{
Alert.ShowInTop("没有对应的委托单号!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="button"></param>
/// <returns></returns>
private bool GetButtonPower(string button)
{
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_CheckManageMenuId, button);
}
#endregion
#region
/// <summary>
/// 打印按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrint_Click(object sender, EventArgs e)
{
2022-12-20 09:32:32 +08:00
string reportId = string.Empty;
if (this.tvControlItem.SelectedNode != null)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
reportId = this.tvControlItem.SelectedNode.NodeID;
if (drpPrintType.SelectedValue == BLL.Const.CheckReport1Id || drpPrintType.SelectedValue == BLL.Const.CheckReport2Id)
{
if (!string.IsNullOrEmpty(reportId))
{
var q = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
var installationName = BLL.Project_InstallationService.GetInstallationByInstallationId(q.InstallationId).InstallationName;
var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
BLL.Common.FastReport.ResetData();
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("projectName", projectName);
keyValuePairs.Add("installationName", installationName);
keyValuePairs.Add("unitName", unitName);
keyValuePairs.Add("NDTTypeCode", this.NDTTypeCode);
keyValuePairs.Add("CHT_CheckCode", q.CHT_CheckCode);
BLL.Common.FastReport.AddFastreportParameter(keyValuePairs);
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
string strSql = @"select CH_TrustCode,CHT_CheckCode,checkItem.ISO_IsoNumber,checkItem.JOT_JointNo,checkItem.WelderCode,checkItem.CHT_CheckResult,checkItem.CHT_RepairLocation,DefectLength,DefectHeight,DefectDepth
from View_CH_CheckItem checkItem left join CH_Check chcheck on checkItem.CHT_CheckID=chcheck.CHT_CheckID
where checkItem.CHT_CheckID =@CHT_CheckID order by dbo.Fun_GetParseInt(JOT_JointNo)";
List<SqlParameter> listpar = new List<SqlParameter>
{
new SqlParameter("@CHT_CheckID", this.CHT_CheckID)
};
SqlParameter[] parameter = listpar.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
if (dt != null)
{
dt.TableName = "Table1";
}
BLL.Common.FastReport.AddFastreportTable(dt);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
if (drpPrintType.SelectedValue == BLL.Const.CheckReport1Id)
{
initTemplatePath = "File\\Fastreport\\管道焊口无损检测结果通知单.frx";
}
if (drpPrintType.SelectedValue == BLL.Const.CheckReport2Id)
{
initTemplatePath = "File\\Fastreport\\设备焊口无损检测结果通知单.frx";
}
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
////varValue = installationName + "|" + unitName + "|" + projectName + "|" + q.PW_PointDate.Value.ToString("yyyy-MM-dd") + "|" + q.PW_PointNo;
////if (!string.IsNullOrEmpty(varValue))
////{
//// varValue = Microsoft.JScript.GlobalObject.escape(varValue.Replace("/", ","));
////}
////PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.CheckReportId, reportId, varValue, this.CurrUser.LoginProjectId)));
//string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
////模板文件
//string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/管道焊口无损检测结果通知单.xlsx";
////导出文件
//string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
//if (!Directory.Exists(filePath))
//{
// Directory.CreateDirectory(filePath);
//}
//string ReportFileName = filePath + "out.xlsx";
//FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
//XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
//ICellStyle styleCenter = hssfworkbook.CreateCellStyle();
//styleCenter.VerticalAlignment = VerticalAlignment.Center;
//styleCenter.Alignment = HorizontalAlignment.Center;
//styleCenter.BorderLeft = BorderStyle.Thin;
//styleCenter.BorderTop = BorderStyle.Thin;
//styleCenter.BorderRight = BorderStyle.Thin;
//styleCenter.BorderBottom = BorderStyle.Thin;
//styleCenter.WrapText = true;
//XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊口无损检测结果通知单");
//// recordSheet.AddMergedRegion(new CellRangeAddress(0, 0, 8, 9));
//recordSheet.GetRow(0).CreateCell(7).SetCellValue(projectName.ToString());
//recordSheet.GetRow(0).GetCell(7).CellStyle = styleCenter;
//recordSheet.GetRow(1).CreateCell(7).SetCellValue(installationName);
//recordSheet.GetRow(1).GetCell(7).CellStyle = styleCenter;
//recordSheet.GetRow(2).CreateCell(1).SetCellValue(unitName);
//recordSheet.GetRow(2).GetCell(1).CellStyle = styleCenter;
//recordSheet.GetRow(2).CreateCell(4).SetCellValue(this.NDTTypeCode);
//recordSheet.GetRow(2).GetCell(4).CellStyle = styleCenter;
//recordSheet.GetRow(2).CreateCell(7).SetCellValue(q.CHT_CheckCode);
//recordSheet.GetRow(2).GetCell(7).CellStyle = styleCenter;
//int i = 0;
//List<Model.CH_CheckItem> items = BLL.CheckItemManageService.GetTrustItemByCheck(CHT_CheckID);
//if (items.Count > 12)
//{
// recordSheet.ShiftRows(8, 27, items.Count - 12);
// for (int j = 0; j < items.Count - 12; j++)
// {
// recordSheet.CopyRow(4 + j, 5 + j);
// }
//}
//foreach (var t in items)
//{
// var checkItem = BLL.CheckItemManageService.GetTrustItemByCheckItem(t.CHT_CheckItemID);
// if (checkItem != null)
// {
// #region 查找委托中的检测类型并赋给检测类型变量
// if (!string.IsNullOrEmpty(t.CH_TrustItemID))
// {
// var trustId = (from x in Funs.DB.CH_TrustItem where x.CH_TrustItemID == t.CH_TrustItemID select x.CH_TrustID).FirstOrDefault();
// if (!string.IsNullOrEmpty(trustId))
// {
// var trust = BLL.TrustManageEditService.GetCH_TrustByID(trustId);
// if (trust != null)
// {
// if (!string.IsNullOrEmpty(trust.CH_NDTMethod))
// {
// var ndtt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.CH_NDTMethod);
// }
// recordSheet.GetRow(i + 4).CreateCell(0).SetCellValue(trust.CH_TrustCode);
// recordSheet.GetRow(i + 4).GetCell(0).CellStyle = styleCenter;
// }
// }
// }
// #endregion
// // checkItems.Add(checkItem);
// recordSheet.GetRow(i + 4).CreateCell(1).SetCellValue(q.CHT_CheckCode);
// recordSheet.GetRow(i + 4).GetCell(1).CellStyle = styleCenter;
// recordSheet.GetRow(i + 4).CreateCell(2).SetCellValue(checkItem.ISO_IsoNumber);
// recordSheet.GetRow(i + 4).GetCell(2).CellStyle = styleCenter;
// recordSheet.GetRow(i + 4).CreateCell(4).SetCellValue(checkItem.JOT_JointNo);
// recordSheet.GetRow(i + 4).GetCell(4).CellStyle = styleCenter;
// recordSheet.GetRow(i + 4).CreateCell(5).SetCellValue(checkItem.WelderCode);
// recordSheet.GetRow(i + 4).GetCell(5).CellStyle = styleCenter;
// recordSheet.GetRow(i + 4).CreateCell(6).SetCellValue(checkItem.CHT_CheckResult);
// recordSheet.GetRow(i + 4).GetCell(6).CellStyle = styleCenter;
// recordSheet.GetRow(i + 4).CreateCell(7).SetCellValue(checkItem.CHT_RepairLocation);
// recordSheet.GetRow(i + 4).GetCell(7).CellStyle = styleCenter;
// i++;
// }
//}
//using (FileStream filess = File.OpenWrite(ReportFileName))
//{
// hssfworkbook.Write(filess);
//}
////PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
//FileInfo filet = new FileInfo(ReportFileName);
//Response.Clear();
//Response.Charset = "GB2312";
//Response.ContentEncoding = System.Text.Encoding.UTF8;
//// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
//Response.AddHeader("Content-Disposition", "attachment; filename=管道焊口无损检测结果通知单_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
//// 添加头信息,指定文件大小,让浏览器能够显示下载进度
//Response.AddHeader("Content-Length", filet.Length.ToString());
//// 指定返回的是一个不能被客户端读取的流,必须被下载
//Response.ContentType = "application/ms-excel";
//// 把文件流发送到客户端
//Response.WriteFile(filet.FullName);
//// 停止页面的执行
//Response.End();
}
2022-03-15 17:36:38 +08:00
}
2022-12-20 09:32:32 +08:00
else if (drpPrintType.SelectedValue == BLL.Const.WeldJointCheckReportId)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
var q = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
var installationName = BLL.Project_InstallationService.GetInstallationByInstallationId(q.InstallationId).InstallationName;
var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
//varValue = installationName + "|" + unitName + "|" + projectName + "|" + q.PW_PointDate.Value.ToString("yyyy-MM-dd") + "|" + q.PW_PointNo;
//if (!string.IsNullOrEmpty(varValue))
//{
// varValue = Microsoft.JScript.GlobalObject.escape(varValue.Replace("/", ","));
//}
//PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.CheckReportId, reportId, varValue, this.CurrUser.LoginProjectId)));
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//模板文件
string TempletFileName = Server.MapPath("~/") + "File/Excel/HJGL_DataOut/管道焊接接头报检检查记录.xlsx";
//导出文件
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
if (!Directory.Exists(filePath))
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
Directory.CreateDirectory(filePath);
2022-03-15 17:36:38 +08:00
}
2022-12-20 09:32:32 +08:00
string ReportFileName = filePath + "out.xlsx";
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
ICellStyle styleCenter = hssfworkbook.CreateCellStyle();
styleCenter.VerticalAlignment = VerticalAlignment.Center;
styleCenter.Alignment = HorizontalAlignment.Center;
styleCenter.BorderLeft = BorderStyle.Thin;
styleCenter.BorderTop = BorderStyle.Thin;
styleCenter.BorderRight = BorderStyle.Thin;
styleCenter.BorderBottom = BorderStyle.Thin;
styleCenter.WrapText = true;
IFont font = styleCenter.GetFont(hssfworkbook);
// font.Color = 10;//颜色
font.FontHeightInPoints = 10;//字体高度与excel中的字号一致
styleCenter.SetFont(font);
XSSFSheet recordSheet = (XSSFSheet)hssfworkbook.GetSheet("管道焊接接头报检检查记录");
// recordSheet.AddMergedRegion(new CellRangeAddress(0, 0, 8, 9));
recordSheet.GetRow(0).CreateCell(14).SetCellValue(projectName.ToString());
recordSheet.GetRow(0).GetCell(14).CellStyle = styleCenter;
recordSheet.GetRow(2).CreateCell(14).SetCellValue(installationName);
recordSheet.GetRow(2).GetCell(14).CellStyle = styleCenter;
recordSheet.GetRow(2).CreateCell(1).SetCellValue(unitName);
recordSheet.GetRow(2).GetCell(1).CellStyle = styleCenter;
recordSheet.GetRow(3).CreateCell(8).SetCellValue(this.NDTTypeCode);
recordSheet.GetRow(3).GetCell(8).CellStyle = styleCenter;
recordSheet.GetRow(2).CreateCell(7).SetCellValue(q.CHT_CheckCode);
recordSheet.GetRow(2).GetCell(7).CellStyle = styleCenter;
int i = 0;
List<Model.CH_CheckItem> items = BLL.CheckItemManageService.GetTrustItemByCheck(CHT_CheckID);
recordSheet.GetRow(3).CreateCell(14).SetCellValue(items.Count + "个");
recordSheet.GetRow(3).GetCell(14).CellStyle = styleCenter;
if (items.Count > 12)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
recordSheet.ShiftRows(8, 27, items.Count - 12);
for (int j = 0; j < items.Count - 12; j++)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
recordSheet.CopyRow(4 + j, 5 + j);
}
}
foreach (var t in items)
{
var checkItem = BLL.CheckItemManageService.GetTrustItemByCheckItem(t.CHT_CheckItemID);
if (checkItem != null)
{
if (i == 0)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
var iso = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(checkItem.ISO_ID);
if (iso != null)
{
var dDetectionRate = Funs.DB.Base_DetectionRate.FirstOrDefault(x => x.DetectionRateId == iso.DetectionRateId);
if (dDetectionRate != null)
{
recordSheet.GetRow(3).CreateCell(18).SetCellValue(dDetectionRate.DetectionRateValue + "%");
recordSheet.GetRow(3).GetCell(18).CellStyle = styleCenter;
}
}
}
recordSheet.GetRow(i + 6).CreateCell(0).SetCellValue((i + 1) + "");
recordSheet.GetRow(i + 6).GetCell(0).CellStyle = styleCenter;
recordSheet.GetRow(i + 6).CreateCell(1).SetCellValue(checkItem.ISO_IsoNo);
recordSheet.GetRow(i + 6).GetCell(1).CellStyle = styleCenter;
recordSheet.GetRow(i + 6).CreateCell(3).SetCellValue(checkItem.JOT_JointNo);
recordSheet.GetRow(i + 6).GetCell(3).CellStyle = styleCenter;
recordSheet.GetRow(i + 6).CreateCell(4).SetCellValue(checkItem.WelderCode);
recordSheet.GetRow(i + 6).GetCell(4).CellStyle = styleCenter;
#region
if (!string.IsNullOrEmpty(t.CH_TrustItemID))
{
var trust = (from x in Funs.DB.View_JointInfo where x.JOT_ID == t.JOT_ID select x).FirstOrDefault();
2022-03-15 17:36:38 +08:00
if (trust != null)
{
2022-12-20 09:32:32 +08:00
recordSheet.GetRow(i + 6).CreateCell(6).SetCellValue(trust.JOT_JointDesc);
recordSheet.GetRow(i + 6).GetCell(6).CellStyle = styleCenter;
recordSheet.GetRow(i + 6).CreateCell(7).SetCellValue(trust.STE_Name1);
recordSheet.GetRow(i + 6).GetCell(7).CellStyle = styleCenter;
recordSheet.GetRow(i + 6).CreateCell(11).SetCellValue(trust.WeldingMethodName);
recordSheet.GetRow(i + 6).GetCell(11).CellStyle = styleCenter;
if (trust.JOT_PrepareTemp.HasValue)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
recordSheet.GetRow(i + 6).CreateCell(14).SetCellValue(trust.JOT_PrepareTemp.Value.ToString("##.#"));
recordSheet.GetRow(i + 6).GetCell(14).CellStyle = styleCenter;
2022-03-15 17:36:38 +08:00
}
}
2022-12-20 09:32:32 +08:00
2022-03-15 17:36:38 +08:00
}
2022-12-20 09:32:32 +08:00
#endregion
// checkItems.Add(checkItem);
i++;
2022-03-15 17:36:38 +08:00
}
2022-12-20 09:32:32 +08:00
}
using (FileStream filess = File.OpenWrite(ReportFileName))
{
hssfworkbook.Write(filess);
}
//PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("../../ReportPrint/ExReportPrint.aspx?ispop=1&reportId={0}&replaceParameter={1}&varValue={2}&projectId={3}", BLL.Const.HJGL_JointInfoReportId, isoId, varValue, this.CurrUser.LoginProjectId)));
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
FileInfo filet = new FileInfo(ReportFileName);
Response.Clear();
Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF8;
// 添加头信息,为"文件下载/另存为"对话框指定默认文件名
Response.AddHeader("Content-Disposition", "attachment; filename=管道焊接接头报检检查记录_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
// 添加头信息,指定文件大小,让浏览器能够显示下载进度
Response.AddHeader("Content-Length", filet.Length.ToString());
// 指定返回的是一个不能被客户端读取的流,必须被下载
Response.ContentType = "application/ms-excel";
// 把文件流发送到客户端
Response.WriteFile(filet.FullName);
// 停止页面的执行
Response.End();
}
else if (drpPrintType.SelectedValue == BLL.Const.CheckReport3Id)
{
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
var q = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
var installationName = BLL.Project_InstallationService.GetInstallationByInstallationId(q.InstallationId).InstallationName;
var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("projectName", projectName);
keyValuePairs.Add("installationName", installationName);
keyValuePairs.Add("conUnit", unitName);
var supUnitList = UnitService.GetUnitByProjectIdUnitTypeList(q.ProjectId, Const.ProjectUnitType_3);
string supUnitName = "";
foreach(var unit in supUnitList)
{
supUnitName += unit.UnitName +",";
}
keyValuePairs.Add("supUnit", supUnitName);
var trust = TrustManageEditService.GetCH_TrustByID(q.CH_TrustID);
keyValuePairs.Add("checkStandard", trust.CH_NDTCriteria);
BLL.Common.FastReport.ResetData();
BLL.Common.FastReport.AddFastreportParameter(keyValuePairs);
string strSql = @"select ISO_ID ,CH_TrustCode,CHT_CheckCode,checkItem.ISO_IsoNumber,checkItem.JOT_JointNo,checkItem.WelderCode,checkItem.CHT_CheckResult,checkItem.CHT_RepairLocation
from View_CH_CheckItem checkItem left join CH_Check chcheck on checkItem.CHT_CheckID=chcheck.CHT_CheckID
where checkItem.CHT_CheckID =@CHT_CheckID order by dbo.Fun_GetParseInt(JOT_JointNo)";
List<SqlParameter> listpar = new List<SqlParameter>
{
new SqlParameter("@CHT_CheckID", this.CHT_CheckID)
};
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
SqlParameter[] parameter = listpar.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
if (dt != null)
{
dt.TableName = "Table1";
}
BLL.Common.FastReport.AddFastreportTable(dt);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\管道无损检测结果汇总表.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
2022-03-15 17:36:38 +08:00
}
}
2022-12-20 09:32:32 +08:00
else if (drpPrintType.SelectedValue == BLL.Const.CheckReport4Id)
2022-03-15 17:36:38 +08:00
{
2022-12-20 09:32:32 +08:00
var q = BLL.CheckManageService.GetCheckByCHT_CheckID(this.CHT_CheckID);
string varValue = string.Empty;
var projectName = BLL.ProjectService.GetProjectNameByProjectId(this.CurrUser.LoginProjectId);
var installation = BLL.Project_InstallationService.GetInstallationByInstallationId(q.InstallationId);
var unitName = BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
var workarea = WorkAreaService.GetWorkAreaByProjectIdAndInstalltionIdAndUnitId(this.CurrUser.LoginProjectId, q.InstallationId, q.UnitId);
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("projectName", projectName);
keyValuePairs.Add("install", installation!=null?installation.InstallationName:"");
keyValuePairs.Add("conUnit", unitName);
keyValuePairs.Add("workarea", workarea!=null?workarea.WorkAreaName:"");
var trust = TrustManageEditService.GetCH_TrustByID(q.CH_TrustID);
if (trust != null)
{
keyValuePairs.Add("CH_NDTCriteria", trust.CH_NDTCriteria);//检测标志着
}
var supUnitList = UnitService.GetUnitByProjectIdUnitTypeList(q.ProjectId, Const.ProjectUnitType_3);
string supUnitName = "";
foreach (var unit in supUnitList)
{
supUnitName += unit.UnitName + ",";
}
keyValuePairs.Add("supUnit", supUnitName);
2022-03-15 17:36:38 +08:00
2022-12-20 09:32:32 +08:00
BLL.Common.FastReport.ResetData();
BLL.Common.FastReport.AddFastreportParameter(keyValuePairs);
string strSql = @"select distinct ISO_IsoNo
from View_CH_CheckItem checkItem left join CH_Check chcheck on checkItem.CHT_CheckID=chcheck.CHT_CheckID
where checkItem.CHT_CheckID =@CHT_CheckID ";
List<SqlParameter> listpar = new List<SqlParameter>
{
new SqlParameter("@CHT_CheckID", this.CHT_CheckID)
};
SqlParameter[] parameter = listpar.ToArray();
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
if (dt != null)
{
dt.TableName = "Table1";
}
BLL.Common.FastReport.AddFastreportTable(dt);
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
initTemplatePath = "File\\Fastreport\\管道无损检测数量统计表.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(Window3.GetShowReference(String.Format("../TrustManage/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
2022-03-15 17:36:38 +08:00
}
else
{
Alert.ShowInTop("请选择要打印的无损检测单!", MessageBoxIcon.Warning);
return;
}
}
2022-12-20 09:32:32 +08:00
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
string sortField = Grid1.SortField;
string sortDirection = Grid1.SortDirection;
if (sortDirection == "ASC")
{
switch (sortField)
{
case "WelderCode":
Grid1.DataSource = checkItems.OrderBy(x => x.WelderCode);
break;
case "JOT_JointNo":
Grid1.DataSource = checkItems.OrderBy(x => x.JOT_JointNo);
break;
case "DetectionTypeName":
Grid1.DataSource = checkItems.OrderBy(x => x.DetectionTypeName);
break;
case "JOT_JointDesc":
Grid1.DataSource = checkItems.OrderBy(x => x.JOT_JointDesc);
break;
case "CHT_FilmDate":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_FilmDate);
break;
case "CHT_ReportDate":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_ReportDate);
break;
case "CHT_RepairLocation":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_RepairLocation);
break;
case "CHT_TotalFilm":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_TotalFilm);
break;
case "CHT_PassFilm":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_PassFilm);
break;
case "CHT_CheckResult":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_CheckResult);
break;
case "Defects_Definition":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_CheckResult);
break;
case "FilmSpecifications":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_CheckResult);
break;
case "ExtendingRice":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_CheckResult);
break;
case "CHT_CheckNo":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_CheckResult);
break;
case "CHT_Remark":
Grid1.DataSource = checkItems.OrderBy(x => x.CHT_CheckResult);
break;
}
}
else
{
switch (sortField)
{
case "WelderCode":
Grid1.DataSource = checkItems.OrderByDescending(x => x.WelderCode);
break;
case "JOT_JointNo":
Grid1.DataSource = checkItems.OrderByDescending(x => x.JOT_JointNo);
break;
case "DetectionTypeName":
Grid1.DataSource = checkItems.OrderByDescending(x => x.DetectionTypeName);
break;
case "JOT_JointDesc":
Grid1.DataSource = checkItems.OrderByDescending(x => x.JOT_JointDesc);
break;
case "CHT_FilmDate":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_FilmDate);
break;
case "CHT_ReportDate":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_ReportDate);
break;
case "CHT_RepairLocation":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_RepairLocation);
break;
case "CHT_TotalFilm":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_TotalFilm);
break;
case "CHT_PassFilm":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_PassFilm);
break;
case "CHT_CheckResult":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_CheckResult);
break;
case "Defects_Definition":
Grid1.DataSource = checkItems.OrderByDescending(x => x.Defects_Definition);
break;
case "FilmSpecifications":
Grid1.DataSource = checkItems.OrderByDescending(x => x.FilmSpecifications);
break;
case "ExtendingRice":
Grid1.DataSource = checkItems.OrderByDescending(x => x.ExtendingRice);
break;
case "CHT_CheckNo":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_CheckNo);
break;
case "CHT_Remark":
Grid1.DataSource = checkItems.OrderByDescending(x => x.CHT_Remark);
break;
}
}
Grid1.DataBind();
}
protected void Grid2_Sort(object sender, GridSortEventArgs e)
{
string sortField = Grid2.SortField;
string sortDirection = Grid2.SortDirection;
if (sortDirection == "ASC")
{
switch (sortField)
{
case "ISO_IsoNo":
Grid2.DataSource = checkItems.OrderBy(x => x.ISO_IsoNo);
break;
case "WelderCode":
Grid2.DataSource = checkItems.OrderBy(x => x.WelderCode);
break;
case "JOT_JointNo":
Grid2.DataSource = checkItems.OrderBy(x => x.JOT_JointNo);
break;
case "DetectionTypeName":
Grid2.DataSource = checkItems.OrderBy(x => x.DetectionTypeName);
break;
case "JOT_JointDesc":
Grid2.DataSource = checkItems.OrderBy(x => x.JOT_JointDesc);
break;
case "CHT_FilmDate":
Grid2.DataSource = checkItems.OrderBy(x => x.CHT_FilmDate);
break;
case "CHT_ReportDate":
Grid2.DataSource = checkItems.OrderBy(x => x.CHT_ReportDate);
break;
case "JointCount":
Grid2.DataSource = checkItems.OrderBy(x => x.JointCount);
break;
case "DefectLength":
Grid2.DataSource = checkItems.OrderBy(x => x.DefectLength);
break;
case "Defects_Definition":
Grid2.DataSource = checkItems.OrderBy(x => x.Defects_Definition);
break;
case "ExtendingRice":
Grid2.DataSource = checkItems.OrderBy(x => x.ExtendingRice);
break;
case "CHT_CheckNo":
Grid2.DataSource = checkItems.OrderBy(x => x.CHT_CheckNo);
break;
}
}
else
{
switch (sortField)
{
case "ISO_IsoNo":
Grid2.DataSource = checkItems.OrderByDescending(x => x.ISO_IsoNo);
break;
case "WelderCode":
Grid2.DataSource = checkItems.OrderByDescending(x => x.WelderCode);
break;
case "JOT_JointNo":
Grid2.DataSource = checkItems.OrderByDescending(x => x.JOT_JointNo);
break;
case "DetectionTypeName":
Grid2.DataSource = checkItems.OrderByDescending(x => x.DetectionTypeName);
break;
case "JOT_JointDesc":
Grid2.DataSource = checkItems.OrderByDescending(x => x.JOT_JointDesc);
break;
case "CHT_FilmDate":
Grid2.DataSource = checkItems.OrderByDescending(x => x.CHT_FilmDate);
break;
case "CHT_ReportDate":
Grid2.DataSource = checkItems.OrderByDescending(x => x.CHT_ReportDate);
break;
case "JointCount":
Grid2.DataSource = checkItems.OrderByDescending(x => x.JointCount);
break;
case "DefectLength":
Grid2.DataSource = checkItems.OrderByDescending(x => x.DefectLength);
break;
case "Defects_Definition":
Grid2.DataSource = checkItems.OrderByDescending(x => x.Defects_Definition);
break;
case "ExtendingRice":
Grid2.DataSource = checkItems.OrderByDescending(x => x.ExtendingRice);
break;
case "CHT_CheckNo":
Grid2.DataSource = checkItems.OrderByDescending(x => x.CHT_CheckNo);
break;
}
}
Grid2.DataBind();
}
2022-03-15 17:36:38 +08:00
#endregion
}
}