Files
HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/TeamWeldingInspection.aspx.cs
T

856 lines
36 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
using Model;
using Newtonsoft.Json.Linq;
namespace FineUIPro.Web.JGZL
{
public partial class TeamWeldingInspection : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string TeamWeldingInspectionItemId
{
get
{
return (string)ViewState["TeamWeldingInspectionItemId"];
}
set
{
ViewState["TeamWeldingInspectionItemId"] = value;
}
}
/// <summary>
/// 项目Id
/// </summary>
private string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
/// <summary>
/// 外键—TeamWeldingInspectionId
/// </summary>
public string TeamWeldingInspectionId
{
get
{
return (string)ViewState["TeamWeldingInspectionId"];
}
set
{
ViewState["TeamWeldingInspectionId"] = value;
}
}
/// <summary>
/// 定义集合
/// </summary>
private static List<Model.JGZL_TeamWeldingInspectionItem> itemLists = new List<JGZL_TeamWeldingInspectionItem>();
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
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;
this.InitTreeMenu();//加载树
this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue;
this.ProjectId = this.tvControlItem.SelectedNodeID;
var project = BLL.Base_ProjectService.GetProjectByProjectId(this.ProjectId);
if (project != null)
{
this.txtProjectName.Text = project.ProjectName;
this.txtProjectCode.Text = project.ProjectCode;
}
var teamWeldingInspection = BLL.TeamWeldingInspectionService.GetTeamWeldingInspectionByProjectId(this.ProjectId);
if (teamWeldingInspection != null)
{
this.TeamWeldingInspectionId = teamWeldingInspection.TeamWeldingInspectionId;
txtUsingUnitTeam.Text = teamWeldingInspection.UsingUnitTeam;
txtInstallationArea.Text = teamWeldingInspection.InstallationArea;
}
//管线下拉选择
var isoLists = (from x in Funs.DB.JGZL_TeamWeldingInspectionItem
where x.TeamWeldingInspectionId == this.TeamWeldingInspectionId
select x.PipelineNo).Distinct().ToList();
this.drpIsoNoS.Items.Clear();
this.drpIsoNoS.DataTextField = "PipelineNo";
this.drpIsoNoS.DataValueField = "PipelineNo";
this.drpIsoNoS.DataSource = isoLists;
this.drpIsoNoS.DataBind();
Funs.FineUIPleaseSelect(this.drpIsoNoS);
this.drpIsoNoS.SelectedIndex = 0;
DataInfo();
}
}
private void EmptyText()
{
this.TeamWeldingInspectionId = string.Empty;
this.txtUsingUnitTeam.Text = string.Empty;
this.txtInstallationArea.Text = string.Empty;
this.txtProjectCode.Text = string.Empty;
this.txtProjectName.Text = string.Empty;
//itemLists.Clear();
//this.Grid1.DataSource = itemLists;
//this.Grid1.DataBind();
}
private void DataInfo()
{
EmptyText();
itemLists.Clear();
if (!string.IsNullOrEmpty(this.ProjectId))
{
var teamWeldingInspection = BLL.TeamWeldingInspectionService.GetTeamWeldingInspectionByProjectId(this.ProjectId);
if (teamWeldingInspection != null)
{
this.TeamWeldingInspectionId = teamWeldingInspection.TeamWeldingInspectionId;
this.txtUsingUnitTeam.Text = teamWeldingInspection.UsingUnitTeam;
this.txtInstallationArea.Text = teamWeldingInspection.InstallationArea;
var pro = BLL.Base_ProjectService.GetProjectByProjectId(teamWeldingInspection.ProjectId);
if (pro != null)
{
this.txtProjectCode.Text = pro.ProjectCode;
this.txtProjectName.Text = pro.ProjectName;
}
itemLists = BLL.TeamWeldingInspectionItemService.GetTeamWeldingInspectionItemList(this.TeamWeldingInspectionId);
}
else
{
var pro = BLL.Base_ProjectService.GetProjectByProjectId(this.ProjectId);
if (pro != null)
{
this.txtProjectCode.Text = pro.ProjectCode;
this.txtProjectName.Text = pro.ProjectName;
}
}
var jointInfo = BLL.HJGL_PW_JointInfoService.GetJointInfoByProjectId(this.ProjectId);
foreach (var item in jointInfo)
{
string ISO_IsoNo = string.Empty;
if (!string.IsNullOrEmpty(item.ISO_ID))
{
var iso = BLL.HJGL_PW_IsoInfoService.GetIsoInfoByIsoInfoId(item.ISO_ID);
if (iso != null)
{
ISO_IsoNo = iso.ISO_IsoNo;//管道编号
}
}
var teamWeldingInspectionItem = BLL.TeamWeldingInspectionItemService.GetTeamWeldingInspectionItemByIsoNoAndJointNo(ISO_IsoNo, item.JOT_JointNo);
if (teamWeldingInspectionItem != null)
{
//itemLists.Add(teamWeldingInspectionItem);
}
else
{
Model.JGZL_TeamWeldingInspectionItem newItem = new JGZL_TeamWeldingInspectionItem();
newItem.TeamWeldingInspectionItemId = SQLHelper.GetNewID(typeof(Model.JGZL_TeamWeldingInspectionItem));
if (!string.IsNullOrEmpty(item.DReportID))
{
var dreort = BLL.HJGL_WeldReportService.GetWeldReportByDReportID(item.DReportID);
if (dreort != null)
{
newItem.CheckDate = dreort.JOT_WeldDate;//检查日期
}
}
if (!string.IsNullOrEmpty(item.STE_ID))
{
var ste = BLL.HJGL_MaterialService.GetSteelBySteID(item.STE_ID);
if (ste != null)
{
newItem.Material = ste.STE_Code;//材质
}
}
newItem.PipelineNo = ISO_IsoNo; //管道编号
newItem.WeldingJointNo = item.JOT_JointNo; //焊口编号
if (!string.IsNullOrEmpty(item.JOT_WeldSilk))
{
var silk = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(item.JOT_WeldSilk);
if (silk != null)
{
newItem.WeldingWire = silk.WMT_MatCode;//所用焊丝牌号
}
}
if (!string.IsNullOrEmpty(item.JOT_WeldMat))
{
var weldMat = BLL.HJGL_ConsumablesService.getConsumablesByConsumablesId(item.JOT_WeldMat);
if (weldMat != null)
{
newItem.WeldingRod = weldMat.WMT_MatCode;//所用焊条牌号
}
}
itemLists.Add(newItem);
}
}
if (!string.IsNullOrEmpty(this.drpIsoNoS.SelectedValue) && this.drpIsoNoS.SelectedValue != BLL.Const._Null)
{
itemLists = itemLists.Where(e => e.PipelineNo.Contains(this.drpIsoNoS.SelectedValue)).ToList(); ;
}
}
this.Grid1.DataSource = itemLists;
this.Grid1.DataBind();
}
#endregion
#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.SelectedValue != BLL.Const._Null)
{
projects = projects.Where(e => e.ProjectId == this.drpProjectId.SelectedValue).ToList();
}
foreach (var item in projects)
{
TreeNode rootProjectNode = new TreeNode();//定义根节点
rootProjectNode.Text = item.ProjectCode;
rootProjectNode.NodeID = item.ProjectId;
rootProjectNode.EnableClickEvent = true;
rootProjectNode.Expanded = true;
rootProjectNode.ToolTip = item.ProjectName;
rootProjectNode.CommandName = "项目名称";
rootNode.Nodes.Add(rootProjectNode);
}
}
#endregion
#region TreeView
/// <summary>
/// 点击TreeView
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
if (this.tvControlItem.SelectedNodeID != "0")
{
//this.BindGrid();
this.ProjectId = this.tvControlItem.SelectedNodeID;
DataInfo();
}
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
//private void BindGrid()
//{
//string strSql = @"select *
// from JGZL_TeamWeldingInspectionItem i
// left join JGZL_TeamWeldingInspection t on t.TeamWeldingInspectionId = i.TeamWeldingInspectionId where 1=1";
//List<SqlParameter> listStr = new List<SqlParameter>();
//if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
//{
// strSql += " AND t.ProjectId = @ProjectId";
// listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID));
//}
//SqlParameter[] parameter = listStr.ToArray();
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// 2.获取当前分页数据
//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 drpProjectId_SelectedIndexChanged(object sender, EventArgs e)
{
this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue;
this.ProjectId = this.tvControlItem.SelectedNodeID;
this.InitTreeMenu();
//this.BindGrid();
DataInfo();
}
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void TextBox_TextChanged(object sender, EventArgs e)
//{
// this.BindGrid();
//}
#endregion
#region
/// <summary>
/// 打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnPrint_Click(object sender, EventArgs e)
{
string projectId = this.tvControlItem.SelectedNodeID;
if (projectId != null)
{
string initTemplatePath = "";
string rootPath = Server.MapPath("~/");
BLL.Common.FastReportService.ResetData();
string strSql = @"select i.TeamWeldingInspectionItemId,
i.TeamWeldingInspectionId,
i.CheckDate,
t.UsingUnitTeam,
t.InstallationArea,
i.PipelineNo,
i.WeldingJointNo,
t.ProjectId,
i.Material,
(case when i.InstallationMethod='安放式' then '√' else '' end) as InstallationMethod,
(case when i.InstallationMethod='插入式' then '√' else '' end) as InstallationMethod2,
i.WeldingWire,
i.WeldingRod,
i.TeamGap,
i.TeamPlumber,
i.TeamWelder,
i.TeamInspector,
i.GTAWWelder,
i.GTAWInspector,
i.SMAWWelder,
i.VTInspector
from JGZL_TeamWeldingInspectionItem i
left join JGZL_TeamWeldingInspection t on t.TeamWeldingInspectionId = i.TeamWeldingInspectionId
where t.ProjectId=@ProjectId ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", projectId));
if (!string.IsNullOrEmpty(this.drpIsoNoS.SelectedValue) && this.drpIsoNoS.SelectedValue != BLL.Const._Null)
{
strSql += " and i.PipelineNo=@pipelineNo";
listStr.Add(new SqlParameter("@pipelineNo", this.drpIsoNoS.SelectedValue));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
if (tb.Rows.Count == itemLists.Count)
{
DataTable dt = new DataTable();
dt.TableName = "Data";
dt.Columns.Add("Num");
dt.Columns.Add("CheckDate");
dt.Columns.Add("ISO_IsoNo");
dt.Columns.Add("JOT_JointNo");
dt.Columns.Add("Material");
dt.Columns.Add("InstallationMethod");
dt.Columns.Add("InstallationMethod2");
dt.Columns.Add("WeldingWire");
dt.Columns.Add("WeldingRod");
dt.Columns.Add("TeamGap");
dt.Columns.Add("TeamPlumber");
dt.Columns.Add("TeamWelder");
dt.Columns.Add("TeamInspector");
dt.Columns.Add("GTAWWelder");
dt.Columns.Add("GTAWInspector");
dt.Columns.Add("SMAWWelder");
dt.Columns.Add("VTInspector");
DataView dv = tb.DefaultView;//获取表视图
dv.Sort = "PipelineNo,WeldingJointNo ASC";//按照ID倒序排序
tb = dv.ToTable();//转为表
DataRow[] rows = tb.DefaultView.ToTable().Select();
int i = 0;
foreach (var row in rows)
{
var newRow = dt.NewRow();
newRow["Num"] = (i + 1).ToString();
string CheckDate = string.Format("{0:yyyy-MM-dd}", row["CheckDate"]);
newRow["CheckDate"] = CheckDate;
newRow["ISO_IsoNo"] = row["PipelineNo"].ToString();
newRow["JOT_JointNo"] = row["WeldingJointNo"].ToString();
newRow["Material"] = row["Material"].ToString();
newRow["InstallationMethod"] = row["InstallationMethod"].ToString();
newRow["InstallationMethod2"] = row["InstallationMethod2"].ToString();
newRow["WeldingWire"] = row["WeldingWire"].ToString();
newRow["WeldingRod"] = row["WeldingRod"].ToString();
newRow["TeamGap"] = row["TeamGap"].ToString();
newRow["TeamPlumber"] = row["TeamPlumber"].ToString();
newRow["TeamWelder"] = row["TeamWelder"].ToString();
newRow["TeamInspector"] = row["TeamInspector"].ToString();
newRow["GTAWWelder"] = row["GTAWWelder"].ToString();
newRow["GTAWInspector"] = row["GTAWInspector"].ToString();
newRow["SMAWWelder"] = row["SMAWWelder"].ToString();
newRow["VTInspector"] = row["VTInspector"].ToString();
dt.Rows.Add(newRow);
i++;
}
BLL.Common.FastReportService.AddFastreportTable(dt);
Dictionary<string, string> keyValuePairs = new Dictionary<string, string>();
keyValuePairs.Add("ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName);
keyValuePairs.Add("ProjectCode", BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectCode);
keyValuePairs.Add("UsingUnitTeam", this.txtUsingUnitTeam.Text);
keyValuePairs.Add("InstallationArea", this.txtInstallationArea.Text);
BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs);
initTemplatePath = "File\\Fastreport\\JGZL\\支管连接焊接接头、角焊接头组对焊接检查记录.frx";
if (File.Exists(rootPath + initTemplatePath))
{
PageContext.RegisterStartupScript(WindowPrint.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath)));
}
}
else
{
Alert.ShowInTop("请先保存数据!", MessageBoxIcon.Warning);
return;
}
}
else
{
Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
return;
}
}
#endregion
#region
/// <summary>
/// 增加
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAdd_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
{
JArray teamGroupData = Grid1.GetMergedData();
List<JObject> list = new List<JObject>();
foreach (JObject teamGroupRow in teamGroupData)
{
JObject values = teamGroupRow.Value<JObject>("values");
list.Add(values);
}
JObject defaultObj = new JObject
{
{ "TeamWeldingInspectionItemId", Guid.NewGuid() },
{ "TeamWeldingInspectionId", this.TeamWeldingInspectionId },
{ "CheckDate", "" },
{ "Material", "" },
{ "PipelineNo", "" },
{ "WeldingJointNo", "" },
{ "InstallationMethod", "" },
{ "WeldingWire", "" },
{ "WeldingRod", "" },
{ "TeamGap", "" },
{ "TeamPlumber", "" },
{ "TeamWelder", "" },
{ "TeamInspector", "" },
{ "GTAWWelder", "" },
{ "GTAWInspector", "" },
{ "SMAWWelder", "" },
{ "VTInspector", "" },
{
"Delete3",
String.Format("<a href=\"javascript:;\" onclick=\"{0}\"><img src=\"{1}\"/></a>",
GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete))
}
};
list.Add(defaultObj);
Grid1.DataSource = list;
Grid1.DataBind();
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TeamWeldingInspectionEdit.aspx?projectId={0}", this.tvControlItem.SelectedNodeID, "新增 - ")));
}
else
{
Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
return;
}
}
protected void Grid1_PreDataBound(object sender, EventArgs e)
{
// 设置LinkButtonField的点击客户端事件
LinkButtonField deleteField = Grid1.FindColumn("Delete3") as LinkButtonField;
deleteField.OnClientClick = GetDeleteScriptGrid1();
}
/// <summary>
/// 删除提示
/// </summary>
/// <returns></returns>
private string GetDeleteScriptGrid1()
{
return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question,
Grid1.GetDeleteSelectedRowsReference(), String.Empty);
}
/// <summary>
/// 双击编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
//{
// if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_TeamWeldingInspectionMenuId, BLL.Const.BtnModify))
// {
// if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
// {
// if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
// {
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TeamWeldingInspectionEdit.aspx?teamWeldingInspectionItemId={0}", this.Grid1.SelectedRowID, "编辑 - ")));
// }
// else
// {
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
// return;
// }
// }
// else
// {
// Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning);
// return;
// }
// }
// else
// {
// ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
// }
//}
/// <summary>
/// 右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void btnMenuEdit_Click(object sender, EventArgs e)
//{
// if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_TeamWeldingInspectionMenuId, BLL.Const.BtnModify))
// {
// if (Grid1.SelectedRowIndexArray.Length == 0)
// {
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
// return;
// }
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TeamWeldingInspectionEdit.aspx?teamWeldingInspectionItemId={0}", Grid1.SelectedRowID, "维护 - ")));
// }
// else
// {
// Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
// }
//}
/// <summary>
/// 右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void btnMenuDelete_Click(object sender, EventArgs e)
//{
// if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_TeamWeldingInspectionMenuId, Const.BtnDelete))
// {
// if (Grid1.SelectedRowIndexArray.Length == 0)
// {
// Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
// return;
// }
// bool isShow = true;
// if (Grid1.SelectedRowIndexArray.Length > 1)
// {
// isShow = false;
// }
// bool isDelete = false;
// foreach (int rowIndex in Grid1.SelectedRowIndexArray)
// {
// string rowID = Grid1.DataKeys[rowIndex][0].ToString();
// var item = BLL.TeamWeldingInspectionItemService.GetTeamWeldingInspectionItemById(rowID);
// if (item != null)
// {
// if (judgementDelete(rowID, isShow))
// {
// string id = item.TeamWeldingInspectionId;
// isDelete = true;
// BLL.TeamWeldingInspectionItemService.DeleteTeamWeldingInspectionItemById(rowID);
// var lists = BLL.TeamWeldingInspectionItemService.GetTeamWeldingInspectionItemList(id);
// if (lists.Count == 0)
// {
// BLL.TeamWeldingInspectionService.DeleteTeamWeldingInspectionById(id);
// }
// BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除支管连接焊接接头、角焊接头组对焊接检查记录");
// }
// }
// }
// if (isDelete)
// {
// ShowNotify("删除成功!", MessageBoxIcon.Success);
// }
// this.BindGrid();
// }
// else
// {
// Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
// }
//}
#region
/// <summary>
/// 判断是否可以删除
/// </summary>
/// <returns></returns>
//private bool judgementDelete(string id, bool isShow)
//{
// string content = string.Empty;
// if (string.IsNullOrEmpty(content))
// {
// return true;
// }
// else
// {
// if (isShow)
// {
// Alert.ShowInTop(content, MessageBoxIcon.Error);
// }
// return false;
// }
//}
#endregion
#endregion
#region
/// <summary>
/// 关闭弹出窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void Window1_Close(object sender, WindowCloseEventArgs e)
//{
// this.InitTreeMenu();//加载树
// this.BindGrid();
// this.drpUsingUnitTeam.Items.Clear();
// this.drpUsingUnitTeam.DataTextField = "UsingUnitTeam";
// this.drpUsingUnitTeam.DataValueField = "UsingUnitTeam";
// this.drpUsingUnitTeam.DataSource = (from x in Funs.DB.JGZL_TeamWeldingInspection
// where x.ProjectId == this.tvControlItem.SelectedNodeID
// select x.UsingUnitTeam).Distinct().ToList();
// this.drpUsingUnitTeam.DataBind();
// Funs.FineUIPleaseSelect(this.drpUsingUnitTeam);
// this.drpUsingUnitTeam.SelectedIndex = 0;
// this.drpInstallationArea.Items.Clear();
// this.drpInstallationArea.DataTextField = "InstallationArea";
// this.drpInstallationArea.DataValueField = "InstallationArea";
// this.drpInstallationArea.DataSource = (from x in Funs.DB.JGZL_TeamWeldingInspection
// where x.ProjectId == this.tvControlItem.SelectedNodeID
// select x.InstallationArea).Distinct().ToList();
// this.drpInstallationArea.DataBind();
// Funs.FineUIPleaseSelect(this.drpInstallationArea);
//}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void drpUsingUnitTeam_SelectedIndexChanged(object sender, EventArgs e)
//{
// BindGrid();
//}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId,
Const.JGZL_TeamWeldingInspectionMenuId, Const.BtnSave))
{
Model.JGZL_TeamWeldingInspection newTeamWeldingInspection = new JGZL_TeamWeldingInspection();
newTeamWeldingInspection.UsingUnitTeam = this.txtUsingUnitTeam.Text;
newTeamWeldingInspection.InstallationArea = this.txtInstallationArea.Text;
if (!string.IsNullOrEmpty(this.TeamWeldingInspectionId))
{
newTeamWeldingInspection.TeamWeldingInspectionId = this.TeamWeldingInspectionId;
BLL.TeamWeldingInspectionService.UpdateTeamWeldingInspection(newTeamWeldingInspection);
}
else
{
newTeamWeldingInspection.ProjectId = this.tvControlItem.SelectedNodeID;
newTeamWeldingInspection.CompileMan = this.CurrUser.UserId;
newTeamWeldingInspection.CompileDate = DateTime.Now;
newTeamWeldingInspection.TeamWeldingInspectionId = SQLHelper.GetNewID(typeof(Model.JGZL_TeamWeldingInspection));
this.TeamWeldingInspectionId = newTeamWeldingInspection.TeamWeldingInspectionId;
BLL.TeamWeldingInspectionService.AddTeamWeldingInspection(newTeamWeldingInspection);
}
saveItem();
//管线下拉选择
var isoLists = (from x in Funs.DB.JGZL_TeamWeldingInspectionItem
where x.TeamWeldingInspectionId == this.TeamWeldingInspectionId
select x.PipelineNo).Distinct().ToList();
this.drpIsoNoS.Items.Clear();
this.drpIsoNoS.DataTextField = "PipelineNo";
this.drpIsoNoS.DataValueField = "PipelineNo";
this.drpIsoNoS.DataSource = isoLists;
this.drpIsoNoS.DataBind();
Funs.FineUIPleaseSelect(this.drpIsoNoS);
this.drpIsoNoS.SelectedIndex = 0;
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
void saveItem()
{
BLL.TeamWeldingInspectionItemService.DeleteTeamWeldingInspectionItem(this.TeamWeldingInspectionId);
itemLists.Clear();
JArray teamGroupData = Grid1.GetMergedData();
foreach (JObject teamGroupRow in teamGroupData)
{
JObject values = teamGroupRow.Value<JObject>("values");
int rowIndex = teamGroupRow.Value<int>("index");
Model.JGZL_TeamWeldingInspectionItem newDetail = new Model.JGZL_TeamWeldingInspectionItem
{
TeamWeldingInspectionItemId = values.Value<string>("TeamWeldingInspectionItemId"),
TeamWeldingInspectionId = this.TeamWeldingInspectionId,
CheckDate =Funs.GetNewDateTime( values.Value<string>("CheckDate")),
Material = values.Value<string>("Material"),
PipelineNo = values.Value<string>("PipelineNo"),
WeldingJointNo = values.Value<string>("WeldingJointNo"),
InstallationMethod = values.Value<string>("InstallationMethod"),
WeldingWire = values.Value<string>("WeldingWire"),
WeldingRod = values.Value<string>("WeldingRod"),
TeamGap = values.Value<string>("TeamGap"),
TeamPlumber = values.Value<string>("TeamPlumber"),
TeamWelder = values.Value<string>("TeamWelder"),
TeamInspector = values.Value<string>("TeamInspector"),
GTAWWelder = values.Value<string>("GTAWWelder"),
GTAWInspector = values.Value<string>("GTAWInspector"),
SMAWWelder = values.Value<string>("SMAWWelder"),
VTInspector = values.Value<string>("VTInspector"),
};
itemLists.Add(newDetail);
}
try
{
if (itemLists.Count > 0)
{
Funs.DB.JGZL_TeamWeldingInspectionItem.InsertAllOnSubmit(itemLists);
}
Funs.DB.SubmitChanges();
}
catch (Exception)
{
return;
}
}
#endregion
protected void txtIsoNoS_TextChanged(object sender, EventArgs e)
{
DataInfo();
}
}
}