565 lines
28 KiB
C#
565 lines
28 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Data.SqlClient;
|
||
using System.Linq;
|
||
using BLL;
|
||
using Newtonsoft.Json.Linq;
|
||
|
||
namespace FineUIPro.Web.HJGL.HotProessManage
|
||
{
|
||
public partial class HotProessTrustEdit : PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 热处理委托主键
|
||
/// </summary>
|
||
public string HotProessTrustId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["HotProessTrustId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["HotProessTrustId"] = value;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 项目主键
|
||
/// </summary>
|
||
public string ProjectId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["ProjectId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["ProjectId"] = value;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
this.HotProessTrustId = Request.Params["HotProessTrustId"];
|
||
this.ProjectId = Request.Params["ProjectId"];
|
||
var trust = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustByID(this.HotProessTrustId);
|
||
if (trust != null)
|
||
{
|
||
this.ProjectId = trust.ProjectId;
|
||
}
|
||
|
||
var pUnit = BLL.Base_UnitService.GetUnitsByProjectUnitType(this.ProjectId, BLL.Const.UnitType_4);
|
||
if (pUnit != null)
|
||
{
|
||
this.drpUnit.DataTextField = "UnitName";
|
||
this.drpUnit.DataValueField = "UnitId";
|
||
this.drpUnit.DataSource = pUnit;
|
||
this.drpUnit.DataBind();
|
||
}
|
||
|
||
///委托人
|
||
this.drpTrustMan.DataTextField = "UserName";
|
||
this.drpTrustMan.DataValueField = "UserId";
|
||
this.drpTrustMan.DataSource = BLL.Sys_UserService.GetUserListByProjectId(this.ProjectId);
|
||
this.drpTrustMan.DataBind();
|
||
Funs.FineUIPleaseSelect(this.drpTrustMan);
|
||
this.drpTrustMan.SelectedValue = this.CurrUser.UserId;
|
||
this.PageInfoLoad(); ///加载页面
|
||
|
||
|
||
List<Model.HJGL_View_CH_HotProessTrustItem> lists = BLL.HJGL_CH_HotProessTrustService.GetHotProessTrustItem(this.ProjectId, this.HotProessTrustId);
|
||
this.BindGrid(lists); ////初始化页面
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面输入提交信息
|
||
/// <summary>
|
||
/// 加载页面输入提交信息
|
||
/// </summary>
|
||
private void PageInfoLoad()
|
||
{
|
||
var trust = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustByID(this.HotProessTrustId);
|
||
if (trust != null)
|
||
{
|
||
this.ProjectId = trust.ProjectId;
|
||
this.txtProjectName.Text = trust.ProjectName;
|
||
this.txtHotProessTrustCode.Text = trust.HotProessTrustCode;
|
||
if (!string.IsNullOrEmpty(trust.TrustUnitId))
|
||
{
|
||
this.drpUnit.SelectedValue = trust.TrustUnitId;
|
||
}
|
||
this.txtConstructionNo.Text = trust.ConstructionNo;
|
||
if (!string.IsNullOrEmpty(trust.TrstManId))
|
||
{
|
||
this.drpTrustMan.SelectedValue = trust.TrstManId;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
this.SimpleForm1.Reset(); ///重置所有字段
|
||
//委托单号自动生成,规则:施工号-日期(1127)-两位流水
|
||
this.txtHotProessTrustCode.Text = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode2ByProjectIdNoR", "dbo.HJGL_CH_HotProessTrust", "HotProessTrustCode", this.ProjectId, BLL.Base_ProjectService.GetProjectCode(this.ProjectId) + "-" + string.Format("{0:MMdd}", DateTime.Now) + "-");
|
||
Model.Base_Project project = BLL.Base_ProjectService.GetProjectByProjectId(this.ProjectId);
|
||
if (project != null)
|
||
{
|
||
this.txtProjectName.Text = project.ProjectName;
|
||
this.txtConstructionNo.Text = project.ProjectCode;
|
||
}
|
||
if (this.CurrUser.UserId != Const.GlyId)
|
||
{
|
||
this.drpTrustMan.SelectedValue = this.CurrUser.UserId;
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 数据绑定
|
||
/// <summary>
|
||
/// 数据绑定
|
||
/// </summary>
|
||
private void BindGrid(List<Model.HJGL_View_CH_HotProessTrustItem> lists)
|
||
{
|
||
DataTable tb = this.LINQToDataTable(lists);
|
||
// 2.获取当前分页数据
|
||
//var table = this.GetPagedDataTable(GridNewDynamic, tb1);
|
||
Grid1.RecordCount = tb.Rows.Count;
|
||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||
var table = this.GetPagedDataTable(Grid1, tb);
|
||
|
||
Grid1.DataSource = table;
|
||
Grid1.DataBind();
|
||
var totalItems = from x in Funs.DB.HJGL_CH_HotProessTrustItem select x;
|
||
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
||
{
|
||
//this.Grid1.Rows[i].RowCssClass = "green";
|
||
System.Web.UI.WebControls.CheckBoxList cblProessTypes = (System.Web.UI.WebControls.CheckBoxList)(this.Grid1.Rows[i].FindControl("cblProessTypes"));
|
||
string jot_id = this.Grid1.Rows[i].DataKeys[0].ToString();
|
||
string hotProessTrustItemId = this.Grid1.Rows[i].DataKeys[1].ToString();
|
||
string trustItemID = this.Grid1.Rows[i].Values[9].ToString();
|
||
string hardTestResultId = this.Grid1.Rows[i].Values[10].ToString();
|
||
List<Model.HJGL_CH_HotProessTrustItem> items = new List<Model.HJGL_CH_HotProessTrustItem>();
|
||
if (!string.IsNullOrEmpty(trustItemID)) //返修口
|
||
{
|
||
items = (from x in totalItems where x.JOT_ID == jot_id && x.HotProessTrustId != this.HotProessTrustId && x.TrustItemID == trustItemID select x).ToList();
|
||
}
|
||
else if (!string.IsNullOrEmpty(hardTestResultId)) //硬度不合格重新热处理口
|
||
{
|
||
items = (from x in totalItems where x.JOT_ID == jot_id && x.HotProessTrustId != this.HotProessTrustId && x.HardTestResultId == hardTestResultId select x).ToList();
|
||
}
|
||
else //非返修口及硬度不合格重新热处理口
|
||
{
|
||
//获取对应焊口已存在的热处理委托明细
|
||
items = (from x in totalItems where x.JOT_ID == jot_id && x.HotProessTrustId != this.HotProessTrustId select x).ToList();
|
||
}
|
||
//已处理的热处理类型集合
|
||
List<string> list = new List<string>();
|
||
foreach (var item in items)
|
||
{
|
||
//获取结果反馈信息
|
||
if (!string.IsNullOrEmpty(item.ProessTypes))
|
||
{
|
||
var hotProessResult = (from x in Funs.DB.HJGL_CH_HotProessResult where x.JOT_ID == item.JOT_ID && x.ProessTypes == item.ProessTypes && x.HotProessTrustId == item.HotProessTrustId select x).FirstOrDefault();
|
||
if (hotProessResult != null && (hotProessResult.IsOK == true || hotProessResult.IsOK == null)) //反馈记录合格或尚未进行反馈均视为已处理类型
|
||
{
|
||
string[] strs = item.ProessTypes.Split('|');
|
||
foreach (var str in strs)
|
||
{
|
||
if (!string.IsNullOrEmpty(str))
|
||
{
|
||
list.Add(str);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
Model.HJGL_PW_JointInfo joint = BLL.HJGL_PW_JointInfoService.GetJointInfoByJotID(jot_id);
|
||
cblProessTypes.DataSource = BLL.HJGL_CH_HotProessTrustService.GetNeedProessTypes(joint.ProessTypes, list, this.HotProessTrustId, jot_id, hotProessTrustItemId);
|
||
cblProessTypes.DataBind();
|
||
for (int j = 0; j < cblProessTypes.Items.Count; j++)
|
||
{
|
||
if (string.IsNullOrEmpty(joint.DReportID)) //焊前只可选预热和加氢
|
||
{
|
||
if (cblProessTypes.Items[j].Text == "后热" || cblProessTypes.Items[j].Text == "消应力热处理" || cblProessTypes.Items[j].Text == "稳定化处理")
|
||
{
|
||
cblProessTypes.Items[j].Enabled = false;
|
||
}
|
||
}
|
||
else //焊后只可选后热、消应力处理和稳定化处理
|
||
{
|
||
if (cblProessTypes.Items[j].Text == "预热" || cblProessTypes.Items[j].Text == "消氢")
|
||
{
|
||
cblProessTypes.Items[j].Enabled = false;
|
||
}
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(this.HotProessTrustId)) //修改记录
|
||
{
|
||
List<string> list2 = new List<string>();
|
||
var items2 = (from x in totalItems where x.JOT_ID == jot_id && x.HotProessTrustItemId == hotProessTrustItemId select x).FirstOrDefault();
|
||
//获取已处理的热处理类型
|
||
if (!string.IsNullOrEmpty(items2.ProessTypes))
|
||
{
|
||
//var hotProessResult = (from x in Funs.DB.HJGL_CH_HotProessResult where x.JOT_ID == item.JOT_ID && x.HotProessTrustId == item.HotProessTrustId select x).FirstOrDefault();
|
||
//if (hotProessResult == null || (hotProessResult != null && hotProessResult.IsOK == true)) //还没有结果反馈记录或结果反馈记录合格则视为已处理类型
|
||
//{
|
||
string[] strs = items2.ProessTypes.Split('|');
|
||
foreach (var str in strs)
|
||
{
|
||
if (!string.IsNullOrEmpty(str))
|
||
{
|
||
list2.Add(str);
|
||
}
|
||
}
|
||
//}
|
||
}
|
||
for (int j = 0; j < cblProessTypes.Items.Count; j++)
|
||
{
|
||
foreach (var item in list2)
|
||
{
|
||
if (BLL.HJGL_CH_HotProessTrustService.GetProessTypesId(cblProessTypes.Items[j].Value) == item)
|
||
{
|
||
cblProessTypes.Items[j].Selected = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 热处理委托 提交事件
|
||
/// <summary>
|
||
/// 编辑热处理委托
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_HotProessTrustMenuId, Const.BtnSave))
|
||
{
|
||
if (BLL.HJGL_CH_HotProessTrustService.IsExistTrustCode(this.txtHotProessTrustCode.Text, this.HotProessTrustId, this.ProjectId))
|
||
{
|
||
ShowNotify("委托单号已存在,请重新录入!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
int count = 0;
|
||
for (int i = 0; i < this.Grid1.Rows.Count; i++)
|
||
{
|
||
System.Web.UI.WebControls.CheckBoxList cblProessTypes = (System.Web.UI.WebControls.CheckBoxList)(this.Grid1.Rows[i].FindControl("cblProessTypes"));
|
||
for (int j = 0; j < cblProessTypes.Items.Count; j++)
|
||
{
|
||
if (cblProessTypes.Items[j].Selected)
|
||
{
|
||
count += 1;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (count < this.Grid1.Rows.Count)
|
||
{
|
||
ShowNotify("请选择热处理类型!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
Model.HJGL_CH_HotProessTrust newHotProessTrust = new Model.HJGL_CH_HotProessTrust();
|
||
newHotProessTrust.ProjectId = this.ProjectId;
|
||
newHotProessTrust.HotProessTrustCode = this.txtHotProessTrustCode.Text.Trim();
|
||
if (this.drpUnit.SelectedValue != BLL.Const._Null)
|
||
{
|
||
newHotProessTrust.TrustUnitId = this.drpUnit.SelectedValue;
|
||
}
|
||
newHotProessTrust.ProjectName = this.txtProjectName.Text.Trim();
|
||
newHotProessTrust.ConstructionNo = this.txtConstructionNo.Text.Trim();
|
||
if (this.drpTrustMan.SelectedValue != BLL.Const._Null)
|
||
{
|
||
newHotProessTrust.TrstManId = this.drpTrustMan.SelectedValue;
|
||
}
|
||
if (!string.IsNullOrEmpty(this.HotProessTrustId))
|
||
{
|
||
newHotProessTrust.HotProessTrustId = this.HotProessTrustId;
|
||
BLL.HJGL_CH_HotProessTrustService.UpdateCH_HotProessTrust(newHotProessTrust);
|
||
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.ProjectId, this.CurrUser.UserId, "修改热处理委托信息");
|
||
}
|
||
else
|
||
{
|
||
this.HotProessTrustId = SQLHelper.GetNewID(typeof(Model.HJGL_CH_HotProessTrust));
|
||
newHotProessTrust.HotProessTrustId = this.HotProessTrustId;
|
||
newHotProessTrust.TrustType = "1"; //正常口
|
||
BLL.HJGL_CH_HotProessTrustService.AddCH_HotProessTrust(newHotProessTrust);
|
||
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.ProjectId, this.CurrUser.UserId, "添加热处理委托信息");
|
||
}
|
||
BLL.HJGL_CH_HotProessTrustService.DeleteCH_HotProessTrustItemByCH_HotProessTrustID(this.HotProessTrustId);
|
||
this.CollectGridJointInfo();
|
||
ShowNotify("提交成功!", MessageBoxIcon.Success);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(newHotProessTrust.HotProessTrustId)
|
||
+ ActiveWindow.GetHidePostBackReference());
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 收集Grid页面信息,提交明细
|
||
/// <summary>
|
||
/// 收集Grid页面信息,提交明细
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private void CollectGridJointInfo()
|
||
{
|
||
//List<Model.HJGL_View_CH_HotProessTrustItem> GetHotProessTrustItem = null;
|
||
//List<Model.HJGL_View_CH_HotProessTrustItem> getNewHotProessTrustItem = new List<Model.HJGL_View_CH_HotProessTrustItem>();
|
||
//if (!string.IsNullOrEmpty(this.hdItemsString.Text))
|
||
//{
|
||
// GetHotProessTrustItem = BLL.HJGL_HotProessTrustService.GetHotProessTrustAddItem(this.hdItemsString.Text);
|
||
//}
|
||
//else if (string.IsNullOrEmpty(this.hdItemsString.Text) && this.HotProessTrustId != null)
|
||
//{
|
||
// GetHotProessTrustItem = BLL.HJGL_HotProessTrustService.GetHotProessTrustItem(this.DReportID);
|
||
//}
|
||
|
||
|
||
JArray mergedData = Grid1.GetMergedData();
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
int rowIndex = mergedRow.Value<int>("index");
|
||
|
||
System.Web.UI.WebControls.CheckBoxList cblProessTypes = (System.Web.UI.WebControls.CheckBoxList)(this.Grid1.Rows[rowIndex].FindControl("cblProessTypes"));
|
||
string str = string.Empty;
|
||
//bool needComplete = false;
|
||
for (int i = 0; i < cblProessTypes.Items.Count; i++)
|
||
{
|
||
if (cblProessTypes.Items[i].Selected)
|
||
{
|
||
Model.HJGL_CH_HotProessTrustItem item = new Model.HJGL_CH_HotProessTrustItem();
|
||
item.HotProessTrustId = this.HotProessTrustId;
|
||
item.JOT_ID = values.Value<string>("JOT_ID").ToString();
|
||
item.ProessTypes = BLL.HJGL_CH_HotProessTrustService.GetProessTypesId(cblProessTypes.Items[i].Value);
|
||
//item.TrustDate = Funs.GetNewDateTime(values.Value<string>("TrustDate").ToString());
|
||
item.TrustDate = Funs.GetNewDateTime(values.Value<string>("TrustDate").ToString());
|
||
item.Remark = values.Value<string>("Remark").ToString();
|
||
if (!string.IsNullOrEmpty(values.Value<string>("HardTestResultId").ToString()))
|
||
{
|
||
item.HardTestResultId = values.Value<string>("HardTestResultId").ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("HardRepairMark").ToString()))
|
||
{
|
||
item.HardRepairMark = values.Value<string>("HardRepairMark").ToString();
|
||
}
|
||
string trustItemID = values.Value<string>("TrustItemID").ToString();
|
||
if (!string.IsNullOrEmpty(trustItemID))
|
||
{
|
||
item.TrustItemID = trustItemID;
|
||
}
|
||
BLL.HJGL_CH_HotProessTrustService.AddCH_HotProessTrustItem(item);
|
||
if (item.ProessTypes.Contains("4") || item.ProessTypes.Contains("5")) //需要进入热处理报告的记录
|
||
{
|
||
Model.HJGL_HotProessItem oldHotProessItem = (from x in Funs.DB.HJGL_HotProessItem where x.JOT_ID == item.JOT_ID && x.ProessTypes == item.ProessTypes && x.HotProessTrustId == this.HotProessTrustId select x).FirstOrDefault();
|
||
if (oldHotProessItem == null)
|
||
{
|
||
Model.HJGL_HotProessItem hotProessItem = new Model.HJGL_HotProessItem();
|
||
hotProessItem.HotProessItemId = SQLHelper.GetNewID(typeof(Model.HJGL_HotProessItem));
|
||
hotProessItem.JOT_ID = item.JOT_ID;
|
||
hotProessItem.HotProessTrustId = this.HotProessTrustId;
|
||
hotProessItem.ProessTypes = item.ProessTypes;
|
||
hotProessItem.SortIndex = BLL.HJGL_HotProessManageEditService.GetSortIndex(this.HotProessTrustId, item.JOT_ID, item.ProessTypes);
|
||
Model.HJGL_CH_HotProessTrustItem hotProessTrustItem = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustItemByHotProessTrustIdAndJotId(this.HotProessTrustId, item.JOT_ID);
|
||
if (hotProessTrustItem != null)
|
||
{
|
||
BLL.HJGL_HotProessManageEditService.AddHotProessItem(hotProessItem, "", null);
|
||
}
|
||
}
|
||
//回写焊口热处理委托时间
|
||
BLL.HJGL_PW_JointInfoService.WriteBackHotProessTrustDate(item.JOT_ID,item.TrustDate);
|
||
}
|
||
//进入热处理结果反馈
|
||
Model.HJGL_CH_HotProessResult oldHotProessResult = (from x in Funs.DB.HJGL_CH_HotProessResult where x.JOT_ID == item.JOT_ID && x.ProessTypes == item.ProessTypes && x.HotProessTrustId == this.HotProessTrustId select x).FirstOrDefault();
|
||
if (oldHotProessResult == null)
|
||
{
|
||
Model.HJGL_CH_HotProessResult hotProessResult = new Model.HJGL_CH_HotProessResult();
|
||
hotProessResult.JOT_ID = item.JOT_ID;
|
||
hotProessResult.HotProessTrustId = this.HotProessTrustId;
|
||
hotProessResult.ProessTypes = item.ProessTypes;
|
||
Model.HJGL_CH_HotProessTrustItem hotProessTrustItem = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustItemByHotProessTrustIdAndJotId(this.HotProessTrustId, item.JOT_ID);
|
||
if (hotProessTrustItem != null)
|
||
{
|
||
BLL.HJGL_CH_HotProessResultService.AddHotProessResult(hotProessResult);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region Grid 关闭弹出窗口事件
|
||
/// <summary>
|
||
/// 关闭弹出窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||
{
|
||
List<string> list = Funs.GetStrListByStr(hdItemsString.Text, '|');
|
||
List<Model.HJGL_View_CH_HotProessTrustItem> lists = BLL.HJGL_CH_HotProessTrustService.GetHotProessTrustAddItem(this.hdItemsString.Text);
|
||
this.BindGrid(lists);
|
||
//this.hdItemsString.Text = string.Empty;
|
||
}
|
||
#endregion
|
||
|
||
#region 右键删除事件
|
||
/// <summary>
|
||
/// 右键删除事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||
{
|
||
var trust = BLL.HJGL_CH_HotProessTrustService.GetCH_HotProessTrustByID(this.HotProessTrustId);
|
||
if (trust != null && trust.IsPrint == true)
|
||
{
|
||
ShowNotify("热处理委托已打印,无法删除!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||
{
|
||
//this.CollectGridJointInfo();
|
||
List<Model.HJGL_View_CH_HotProessTrustItem> GetHotProessTrustItem = new List<Model.HJGL_View_CH_HotProessTrustItem>();
|
||
if (!string.IsNullOrEmpty(this.hdItemsString.Text))
|
||
{
|
||
GetHotProessTrustItem = BLL.HJGL_CH_HotProessTrustService.GetHotProessTrustAddItem(this.hdItemsString.Text);
|
||
}
|
||
else if (string.IsNullOrEmpty(this.hdItemsString.Text) && this.HotProessTrustId != null)
|
||
{
|
||
GetHotProessTrustItem = BLL.HJGL_CH_HotProessTrustService.GetHotProessTrustItem(this.ProjectId, this.HotProessTrustId);
|
||
}
|
||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||
{
|
||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||
var item = GetHotProessTrustItem.FirstOrDefault(x => x.JOT_ID == rowID);
|
||
if (item != null)
|
||
{
|
||
if (string.IsNullOrEmpty(this.HotProessTrustId)) //新增记录可直接删除
|
||
{
|
||
GetHotProessTrustItem.Remove(item);
|
||
this.hdItemsString.Text = this.hdItemsString.Text.Replace(rowID,"");
|
||
}
|
||
else //修改记录时只能删除未处理的热处理记录
|
||
{
|
||
var result = (from x in Funs.DB.HJGL_CH_HotProessResult where x.HotProessTrustId == item.HotProessTrustId && x.JOT_ID == item.JOT_ID && item.ProessTypes == x.ProessTypes select x).FirstOrDefault();
|
||
if (result != null)
|
||
{
|
||
if (result.IsOK == null)
|
||
{
|
||
GetHotProessTrustItem.Remove(item);
|
||
this.hdItemsString.Text = this.hdItemsString.Text.Replace(rowID, "");
|
||
}
|
||
else
|
||
{
|
||
ShowNotify("热处理结果已反馈,无法删除!", MessageBoxIcon.Warning);
|
||
}
|
||
Model.SGGLDB db = Funs.DB;
|
||
//删除热处理录入明细
|
||
var hotProessItem = (from x in db.HJGL_HotProessItem where x.HotProessTrustId == item.HotProessTrustId && x.JOT_ID == item.JOT_ID && item.ProessTypes == x.ProessTypes select x).FirstOrDefault();
|
||
if (hotProessItem != null)
|
||
{
|
||
db.HJGL_HotProessItem.DeleteOnSubmit(hotProessItem);
|
||
db.SubmitChanges();
|
||
}
|
||
//删除热处理反馈明细
|
||
db.HJGL_CH_HotProessResult.DeleteOnSubmit(result);
|
||
db.SubmitChanges();
|
||
}
|
||
else
|
||
{
|
||
GetHotProessTrustItem.Remove(item);
|
||
this.hdItemsString.Text = this.hdItemsString.Text.Replace(rowID, "");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
BindGrid(GetHotProessTrustItem);
|
||
ShowNotify("操作完成!", MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 查找未焊接焊口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ckSelect_Click(object sender, EventArgs e)
|
||
{
|
||
//this.CollectGridJointInfo();
|
||
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != BLL.Const._Null)
|
||
{
|
||
string jotIds = string.Empty;
|
||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||
{
|
||
string jotId = Grid1.DataKeys[i][0].ToString();
|
||
string hardTestResultId = Grid1.Rows[i].Values[10].ToString();
|
||
string hardRepairMark = Grid1.Rows[i].Values[11].ToString();
|
||
string ids = jotId;
|
||
if (!string.IsNullOrEmpty(hardTestResultId))
|
||
{
|
||
ids += "," + hardTestResultId;
|
||
}
|
||
if (!string.IsNullOrEmpty(hardRepairMark))
|
||
{
|
||
ids += "," + hardRepairMark;
|
||
}
|
||
jotIds += ids + "|";
|
||
}
|
||
|
||
if (jotIds != string.Empty)
|
||
{
|
||
jotIds = jotIds.Substring(0, jotIds.Length - 1);
|
||
}
|
||
string strList = this.drpUnit.SelectedValue + "|" + this.HotProessTrustId + "|" + this.ProjectId;
|
||
string window = String.Format("HotProessTrustItemEdit.aspx?strList={0}&jotIds={1}", strList, jotIds, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdItemsString.ClientID) + Window1.GetShowReference(window));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("请选择单位!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 是否返修口
|
||
/// </summary>
|
||
/// <param name="bigType"></param>
|
||
/// <returns></returns>
|
||
protected string ConvertIsRepair(object TrustItemID)
|
||
{
|
||
string state = string.Empty;
|
||
if (TrustItemID != null)
|
||
{
|
||
string trustItemID = TrustItemID.ToString();
|
||
if (!string.IsNullOrEmpty(trustItemID))
|
||
{
|
||
state = "是";
|
||
}
|
||
}
|
||
return state;
|
||
}
|
||
}
|
||
} |