1154 lines
56 KiB
C#
1154 lines
56 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using BLL;
|
||
using Newtonsoft.Json.Linq;
|
||
|
||
namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||
{
|
||
public partial class WeldReportEdit : PageBase
|
||
{
|
||
|
||
#region 加载页面
|
||
/// <summary>
|
||
/// 加载页面
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
//this.ProjectId = Request.Params["ProjectId"];
|
||
//this.WeldingDailyId = Request.Params["WeldingDailyId"];
|
||
#region 不用了
|
||
///焊缝类型
|
||
//Base_WeldTypeService.InitWeldTypeDropDownList(this.drpWeldType, Resources.Lan.PleaseSelect, false);
|
||
//this.drpWeldType.DataTextField = "WeldTypeCode";
|
||
//this.drpWeldType.DataValueField = "WeldTypeCode";
|
||
//this.drpWeldType.DataSource = from x in Funs.DB.Base_WeldType orderby x.WeldTypeCode select x;
|
||
//this.drpWeldType.DataBind();
|
||
#endregion
|
||
///焊接位置
|
||
this.drpWeldingLocation.DataTextField = "WeldingLocationCode";
|
||
this.drpWeldingLocation.DataValueField = "WeldingLocationCode";
|
||
this.drpWeldingLocation.DataSource = from x in Funs.DB.Base_WeldingLocation orderby x.WeldingLocationCode select x;
|
||
this.drpWeldingLocation.DataBind();
|
||
this.drpWeldingLocation.SelectedIndex = 0;
|
||
// 焊接属性
|
||
this.drpJointAttribute.DataTextField = "Text";
|
||
this.drpJointAttribute.DataValueField = "Value";
|
||
this.drpJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttributeItem();
|
||
this.drpJointAttribute.DataBind();
|
||
// 焊接方法
|
||
this.drpWeldingMethod.DataTextField = "WeldingMethodCode";
|
||
this.drpWeldingMethod.DataValueField = "WeldingMethodCode";
|
||
this.drpWeldingMethod.DataSource = from x in Funs.DB.Base_WeldingMethod orderby x.WeldingMethodCode select x;
|
||
this.drpWeldingMethod.DataBind();
|
||
|
||
if (!string.IsNullOrEmpty(Request.Params["WeldingDailyId"]))
|
||
{
|
||
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = BLL.Pipeline_WeldingDailyService.GetWeldingDailyItem(Request.Params["WeldingDailyId"]);
|
||
this.BindGrid(GetWeldingDailyItem); // 初始化页面
|
||
this.CalculationAmount();
|
||
}
|
||
|
||
this.PageInfoLoad(); // 加载页面
|
||
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 超量焊工提示
|
||
/// <summary>
|
||
/// 超量焊工提示
|
||
/// </summary>
|
||
private void CalculationAmount()
|
||
{
|
||
this.lbAmount.Hidden = true;
|
||
this.lbAmount.Text = string.Empty;
|
||
DateTime? date = Funs.GetNewDateTime(this.txtWeldingDate.Text);
|
||
string txtValue = string.Empty;
|
||
if (date.HasValue)
|
||
{
|
||
var weldJoints = BLL.Pipeline_WeldJointService.GetWeldlinesByWeldingDailyId(Request.Params["WeldingDailyId"]);
|
||
foreach (var item in weldJoints)
|
||
{
|
||
bool cWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(Request.Params["WeldingDailyId"], item.CoverWelderId, date.Value);
|
||
bool bWelder = cWelder;
|
||
if (item.BackingWelderId != item.CoverWelderId)
|
||
{
|
||
bWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(Request.Params["WeldingDailyId"], item.BackingWelderId, date.Value);
|
||
}
|
||
if (cWelder || bWelder)
|
||
{
|
||
if (cWelder)
|
||
{
|
||
var coverWelder = BLL.WelderService.GetWelderById(item.CoverWelderId);
|
||
if (coverWelder != null)
|
||
{
|
||
string txt = coverWelder.WelderCode + ";";
|
||
if (!txtValue.Contains(txt))
|
||
{
|
||
txtValue += txt;
|
||
}
|
||
}
|
||
}
|
||
if (bWelder)
|
||
{
|
||
var floorWelder = BLL.WelderService.GetWelderById(item.BackingWelderId);
|
||
if (floorWelder != null)
|
||
{
|
||
string txt = floorWelder.WelderCode + ";";
|
||
if (!txtValue.Contains(txt))
|
||
{
|
||
txtValue += txt;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (!string.IsNullOrEmpty(txtValue))
|
||
{
|
||
this.lbAmount.Text = txtValue;
|
||
this.lbAmount.Hidden = false;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 加载页面输入提交信息
|
||
/// <summary>
|
||
/// 加载页面输入提交信息
|
||
/// </summary>
|
||
private void PageInfoLoad()
|
||
{
|
||
var report = BLL.Pipeline_WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(Request.Params["WeldingDailyId"]);
|
||
if (report != null)
|
||
{
|
||
BLL.Base_UnitService.InitProjectUnitDropDownList(this.drpUnit, true, report.ProjectId, BLL.Const.UnitType_5, Resources.Lan.PleaseSelect);
|
||
BLL.Project_InstallationService.InitInstallationDropDownList(this.drpInstallation, true, report.ProjectId, Resources.Lan.PleaseSelect);
|
||
this.txtWeldingDailyCode.Text = report.WeldingDailyCode;
|
||
if (!string.IsNullOrEmpty(report.UnitId))
|
||
{
|
||
this.drpUnit.SelectedValue = report.UnitId;
|
||
//BLL.WelderService.InitProjectWelderCodeDropDownList(this.drpCoverWelderId, false, this.ProjectId, this.drpUnit.SelectedValue, Resources.Lan.PleaseSelect);
|
||
//BLL.WelderService.InitProjectWelderCodeDropDownList(this.drpBackingWelderId, false, this.ProjectId, this.drpUnit.SelectedValue, Resources.Lan.PleaseSelect);
|
||
}
|
||
if (!string.IsNullOrEmpty(report.InstallationId))
|
||
{
|
||
this.drpInstallation.SelectedValue = report.InstallationId;
|
||
}
|
||
this.txtWeldingDate.Text = string.Format("{0:yyyy-MM-dd}", report.WeldingDate);
|
||
this.hdTablerId.Text = report.Tabler;
|
||
Model.Sys_User tabler = BLL.Sys_UserService.GetUsersByUserId(report.Tabler);
|
||
if (tabler != null)
|
||
{
|
||
this.txtTabler.Text = tabler.UserName;
|
||
}
|
||
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", report.TableDate);
|
||
this.txtRemark.Text = report.Remark;
|
||
}
|
||
else
|
||
{
|
||
BLL.Base_UnitService.InitProjectUnitDropDownList(this.drpUnit, true, CurrUser.LoginProjectId, BLL.Const.UnitType_5, Resources.Lan.PleaseSelect);
|
||
BLL.Project_InstallationService.InitInstallationDropDownList(this.drpInstallation, true, CurrUser.LoginProjectId, Resources.Lan.PleaseSelect);
|
||
this.SimpleForm1.Reset(); ///重置所有字段
|
||
this.txtTabler.Text = this.CurrUser.UserName;
|
||
this.hdTablerId.Text = this.CurrUser.UserId;
|
||
this.txtWeldingDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
|
||
this.txtTableDate.Text = string.Format("{0:yyyy-MM-dd}", System.DateTime.Now);
|
||
string perfix = string.Format("{0:yyyyMMdd}", System.DateTime.Now) + "-";
|
||
this.txtWeldingDailyCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.Pipeline_WeldingDaily", "WeldingDailyCode", this.CurrUser.LoginProjectId, perfix);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 单位下拉框变化加载对应的焊工信息,不用了
|
||
/// <summary>
|
||
/// 单位下拉框变化加载对应的焊工信息
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void drpUnit_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
//this.drpCoverWelderId.Items.Clear();
|
||
//this.drpBackingWelderId.Items.Clear();
|
||
//if (this.drpUnit.SelectedValue != BLL.Const._Null)
|
||
//{
|
||
// BLL.WelderService.InitProjectWelderCodeDropDownList(this.drpCoverWelderId, false, this.ProjectId, this.drpUnit.SelectedValue, Resources.Lan.PleaseSelect);
|
||
// BLL.WelderService.InitProjectWelderCodeDropDownList(this.drpBackingWelderId, false, this.ProjectId, this.drpUnit.SelectedValue, Resources.Lan.PleaseSelect);
|
||
//}
|
||
}
|
||
#endregion
|
||
|
||
#region 数据绑定
|
||
/// <summary>
|
||
/// 数据绑定
|
||
/// </summary>
|
||
private void BindGrid(List<Model.SpWeldingDailyItem> GetWeldingDailyItem)
|
||
{
|
||
DataTable tb = this.LINQToDataTable(GetWeldingDailyItem);
|
||
// 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();
|
||
}
|
||
#endregion
|
||
|
||
#region 排序
|
||
/// <summary>
|
||
/// 排序
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||
{
|
||
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = this.CollectGridJointInfo(Request.Params["WeldingDailyId"]);
|
||
this.BindGrid(GetWeldingDailyItem);
|
||
}
|
||
#endregion
|
||
|
||
|
||
#region 资质分析
|
||
private bool IsOK(List<Model.Welder_WelderQualify> welderQualifys, string wmeCode, string location, string weldTypeGroup, string ste, decimal? dia, decimal? sch)
|
||
{
|
||
bool isok = false;
|
||
foreach (var welderQualify in welderQualifys)
|
||
{
|
||
int okNum = 0;
|
||
|
||
if (!string.IsNullOrEmpty(wmeCode)) //焊接方法
|
||
{
|
||
if (wmeCode.Contains(welderQualify.WeldingMethod))
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
okNum++;
|
||
}
|
||
|
||
if (welderQualify.WeldingLocation == "ALL") //焊接位置
|
||
{
|
||
okNum++;
|
||
}
|
||
else
|
||
{
|
||
if (!string.IsNullOrEmpty(location))
|
||
{
|
||
if (welderQualify.WeldingLocation.Contains(location))
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(weldTypeGroup))
|
||
{
|
||
if (welderQualify.WeldType.Contains(weldTypeGroup))
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
okNum++;
|
||
}
|
||
|
||
var steel = BLL.Base_MaterialService.GetMaterialByMaterialId(ste);
|
||
if (steel != null) //钢材类型
|
||
{
|
||
if (welderQualify.MaterialType.Contains(steel.MaterialType ?? ""))
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
okNum++;
|
||
}
|
||
|
||
|
||
if (weldTypeGroup != "角焊缝")
|
||
{
|
||
if (welderQualify.SizesMin == 0) // 0表示不限
|
||
{
|
||
okNum++;
|
||
}
|
||
else //最小寸径
|
||
{
|
||
if (dia != null)
|
||
{
|
||
if (dia >= welderQualify.SizesMin)
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
|
||
if (welderQualify.ThicknessMax == 0) // 0表示不限
|
||
{
|
||
okNum++;
|
||
}
|
||
else
|
||
{
|
||
if (sch != null) //最大壁厚
|
||
{
|
||
if (sch <= welderQualify.ThicknessMax)
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
okNum++;
|
||
}
|
||
}
|
||
}
|
||
else // 当为角焊缝时,管径和壁厚不限制
|
||
{
|
||
okNum++;
|
||
okNum++;
|
||
}
|
||
|
||
|
||
if (okNum == 6) //全部条件符合
|
||
{
|
||
isok = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
return isok;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 两种焊接方法的资质判断
|
||
/// </summary>
|
||
/// <param name="floorWelderQualifys"></param>
|
||
/// <param name="cellWelderQualifys"></param>
|
||
/// <param name="wmeCode1"></param>
|
||
/// <param name="wmeCode2"></param>
|
||
/// <param name="location"></param>
|
||
/// <param name="ste"></param>
|
||
/// <param name="dia"></param>
|
||
/// <param name="sch"></param>
|
||
/// <returns></returns>
|
||
private bool TwoWmeIsOK(List<Model.Welder_WelderQualify> floorWelderQualifys, List<Model.Welder_WelderQualify> cellWelderQualifys, string wmeCode1, string wmeCode2, string location, string weldTypeGroup, string ste, decimal? dia, decimal? sch)
|
||
{
|
||
bool isok = false;
|
||
|
||
decimal? fThicknessMax = 0;
|
||
decimal? cThicknessMax = 0;
|
||
|
||
var steel = BLL.Base_MaterialService.GetMaterialByMaterialId(ste);
|
||
var floorQ = from x in floorWelderQualifys
|
||
where wmeCode1.Contains(x.WeldingMethod)
|
||
&& (x.WeldingLocation == "ALL" || (location == null || location == "" || x.WeldingLocation.Contains(location)))
|
||
&& (steel == null || x.MaterialType.Contains(steel.MaterialType ?? ""))
|
||
&& (weldTypeGroup==null || x.WeldType.Contains(weldTypeGroup))
|
||
// && (dia == null || x.SizesMin<=dia)
|
||
select x;
|
||
var cellQ = from x in cellWelderQualifys
|
||
where wmeCode2.Contains(x.WeldingMethod)
|
||
&& (x.WeldingLocation == "ALL" || (location == null || location == "" || x.WeldingLocation.Contains(location)))
|
||
&& (steel == null || x.MaterialType.Contains(steel.MaterialType ?? ""))
|
||
&& (weldTypeGroup == null || x.WeldType.Contains(weldTypeGroup))
|
||
// && (dia == null || x.SizesMin <= dia)
|
||
select x;
|
||
if (floorQ.Count() > 0 && cellQ.Count() > 0)
|
||
{
|
||
if (weldTypeGroup != "角焊缝") // 当为角焊缝时,管径和壁厚不限制
|
||
{
|
||
var floorDiaQ = floorQ.Where(x => x.SizesMin <= dia);
|
||
var cellDiaQ = cellQ.Where(x => x.SizesMin <= dia);
|
||
|
||
if (floorDiaQ.Count() > 0 && cellDiaQ.Count() > 0)
|
||
{
|
||
var fThick = floorDiaQ.Where(x => x.ThicknessMax == 0);
|
||
var cThick = cellDiaQ.Where(x => x.ThicknessMax == 0);
|
||
|
||
// 只要有一个不限(为0)就通过
|
||
if (fThick.Count() > 0 || cThick.Count() > 0)
|
||
{
|
||
isok = true;
|
||
}
|
||
|
||
else
|
||
{
|
||
fThicknessMax = floorQ.Max(x => x.ThicknessMax);
|
||
cThicknessMax = cellQ.Max(x => x.ThicknessMax);
|
||
|
||
if ((fThicknessMax + cThicknessMax) >= sch)
|
||
{
|
||
isok = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
isok = true;
|
||
}
|
||
}
|
||
|
||
return isok;
|
||
}
|
||
#endregion
|
||
|
||
//private static bool canSave; //是否可以保存
|
||
|
||
#region 焊接日报 提交事件
|
||
/// <summary>
|
||
/// 编辑焊接日报
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSave_Click(object sender, EventArgs e)
|
||
{
|
||
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldReportMenuId, Const.BtnSave))
|
||
{
|
||
string dayReportId = Request.Params["WeldingDailyId"];
|
||
if (BLL.Pipeline_WeldingDailyService.IsExistWeldingDailyCode(this.txtWeldingDailyCode.Text, !string.IsNullOrEmpty(dayReportId) ? dayReportId : "", CurrUser.LoginProjectId))
|
||
{
|
||
ShowNotify(Resources.Lan.WeldingReportExists, MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(this.txtWeldingDate.Text) || string.IsNullOrEmpty(this.txtWeldingDailyCode.Text.Trim()))
|
||
{
|
||
ShowNotify(Resources.Lan.WeldingNumDateIsNotNull, MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
|
||
string eventArg = string.Empty;
|
||
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = this.CollectGridJointInfo(dayReportId);
|
||
foreach (var item in GetWeldingDailyItem)
|
||
{
|
||
bool canSave = false;
|
||
var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
|
||
var isoNo = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(jot.PipelineId);
|
||
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
|
||
string weldTypeGroup = joty.WeldTypeGroup;
|
||
string weldTypeCode = joty.WeldTypeCode;
|
||
string floorWelder = item.BackingWelderId;
|
||
string cellWelder = item.CoverWelderId;
|
||
decimal? dia = item.Dia;
|
||
decimal? sch = item.Thickness;
|
||
string wme = item.WeldingMethodCode;
|
||
//string wmeCode = string.Empty;
|
||
//var wm = BLL.HJGL_WeldingMethodService.GetWeldMethodByWMEID(item.WME_ID);
|
||
//if (wm != null)
|
||
//{
|
||
// wmeCode = wm.WME_Code;
|
||
//}
|
||
|
||
string[] wmeCodes = item.WeldingMethodCode.Split('+');
|
||
string location = item.WeldingLocationCode;
|
||
string ste = jot.Material1Id;
|
||
if (weldTypeCode == "SOB")
|
||
{
|
||
canSave = true;
|
||
}
|
||
else
|
||
{
|
||
List<Model.Welder_WelderQualify> floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
|
||
where x.WelderId == floorWelder && x.WeldingMethod != null
|
||
&& x.WeldingLocation != null && x.MaterialType != null
|
||
&& x.WeldType != null && x.ThicknessMax != null && x.SizesMin != null
|
||
&& x.LimitDate >= DateTime.Now
|
||
select x).ToList();
|
||
|
||
List<Model.Welder_WelderQualify> cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
|
||
where x.WelderId == cellWelder && x.WeldingMethod != null
|
||
&& x.WeldingLocation != null && x.MaterialType != null
|
||
&& x.WeldType != null && x.ThicknessMax != null && x.SizesMin != null
|
||
&& x.LimitDate >= DateTime.Now
|
||
select x).ToList();
|
||
// 打底和盖面同一焊工
|
||
if (floorWelder == cellWelder)
|
||
{
|
||
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
|
||
{
|
||
if (wmeCodes.Count() <= 1) // 一种焊接方法
|
||
{
|
||
canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
|
||
}
|
||
else // 大于一种焊接方法,如氩电联焊
|
||
{
|
||
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
|
||
}
|
||
}
|
||
}
|
||
// 打底和盖面焊工不同
|
||
else
|
||
{
|
||
bool isok1 = false;
|
||
bool isok2 = false;
|
||
|
||
if (wmeCodes.Count() <= 1) // 一种焊接方法
|
||
{
|
||
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
|
||
{
|
||
isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
|
||
}
|
||
if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
|
||
{
|
||
isok2 = IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
|
||
}
|
||
if (isok1 && isok2)
|
||
{
|
||
canSave = true;
|
||
}
|
||
}
|
||
|
||
else
|
||
{
|
||
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (canSave == false)
|
||
{
|
||
eventArg = eventArg + isoNo.PipelineCode+":"+jot.WeldJointCode + ",";
|
||
}
|
||
}
|
||
|
||
// 焊工资质都符合条件
|
||
if (eventArg == string.Empty)
|
||
{
|
||
Model.Pipeline_WeldingDaily newWeldingDaily = new Model.Pipeline_WeldingDaily();
|
||
newWeldingDaily.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
|
||
newWeldingDaily.ProjectId = CurrUser.LoginProjectId;
|
||
if (this.drpInstallation.SelectedValue != BLL.Const._Null)
|
||
{
|
||
newWeldingDaily.InstallationId = this.drpInstallation.SelectedValue;
|
||
}
|
||
newWeldingDaily.UnitId = this.drpUnit.SelectedValue;
|
||
DateTime? weldDate = Funs.GetNewDateTime(this.txtWeldingDate.Text);
|
||
if (weldDate.HasValue)
|
||
{
|
||
newWeldingDaily.WeldingDate = weldDate.Value;
|
||
}
|
||
else
|
||
{
|
||
newWeldingDaily.WeldingDate = System.DateTime.Now;
|
||
}
|
||
newWeldingDaily.Tabler = this.hdTablerId.Text;
|
||
newWeldingDaily.TableDate = Funs.GetNewDateTime(this.txtTableDate.Text);
|
||
newWeldingDaily.Remark = this.txtRemark.Text.Trim();
|
||
|
||
// 插入主表信息
|
||
if (!string.IsNullOrEmpty(dayReportId))
|
||
{
|
||
newWeldingDaily.WeldingDailyId = dayReportId;
|
||
BLL.Pipeline_WeldingDailyService.UpdatePipeline_WeldingDaily(newWeldingDaily);
|
||
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldReportMenuId, Const.BtnModify, dayReportId);
|
||
}
|
||
else
|
||
{
|
||
dayReportId = SQLHelper.GetNewID(typeof(Model.Pipeline_WeldingDaily));
|
||
newWeldingDaily.WeldingDailyId = dayReportId;
|
||
BLL.Pipeline_WeldingDailyService.AddPipeline_WeldingDaily(newWeldingDaily);
|
||
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldReportMenuId, Const.BtnAdd, dayReportId);
|
||
}
|
||
|
||
// 更新焊口表,并按条件组批
|
||
foreach (var item in GetWeldingDailyItem)
|
||
{
|
||
var newWeldJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
|
||
var pipeline = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
|
||
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(item.WeldTypeId);
|
||
string weldTypeCode = joty.WeldTypeCode;
|
||
|
||
newWeldJoint.WeldingDailyId = dayReportId;
|
||
newWeldJoint.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
|
||
newWeldJoint.CoverWelderId = item.CoverWelderId;
|
||
newWeldJoint.BackingWelderId = item.BackingWelderId;
|
||
newWeldJoint.Size = item.Size;
|
||
newWeldJoint.DoneDin = item.Size;
|
||
newWeldJoint.Dia = item.Dia;
|
||
newWeldJoint.Thickness = item.Thickness;
|
||
newWeldJoint.JointAttribute = item.JointAttribute;
|
||
newWeldJoint.JointArea = item.JointArea;
|
||
newWeldJoint.WeldingLocationId = item.WeldingLocationId;
|
||
newWeldJoint.WeldingMethodId = item.WeldingMethodId;
|
||
BLL.Pipeline_WeldJointService.UpdateWeldJoint(newWeldJoint);
|
||
|
||
//更新焊口号 修改固定焊口号后 +G
|
||
//BLL.Pipeline_WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
|
||
|
||
// 焊缝类型非SOB进批,未取消的焊口
|
||
if (weldTypeCode != "SOB" && (newWeldJoint.IsCancel == false || newWeldJoint.IsCancel == null))
|
||
{
|
||
BLL.Batch_PointBatchItemService.InsertPointBatch(CurrUser.LoginProjectId, item.BackingWelderId, item.WeldJointId, newWeldingDaily.WeldingDate);
|
||
}
|
||
}
|
||
ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop(Resources.Lan.NoQualification + "【" + eventArg + "】" + Resources.Lan.WeldingConditions, Resources.Lan.SubmitResults, MessageBoxIcon.Warning);
|
||
}
|
||
|
||
#region (暂不用)
|
||
//List<Model.SpWeldingDailyItem> GetWeldingDailyItem = this.CollectGridJointInfo();
|
||
//string errlog = string.Empty;
|
||
//var weldlines = BLL.Pipeline_WeldJointService.GetWeldlinesByWeldingDailyId(this.WeldingDailyId);
|
||
//canSave = false;
|
||
|
||
//// 新建日报
|
||
//if (weldlines.Count() == 0)
|
||
//{
|
||
// foreach (var item in GetWeldingDailyItem)
|
||
// {
|
||
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, false);
|
||
// }
|
||
//}
|
||
//// 日报已存在的情况
|
||
//else
|
||
//{
|
||
// var weldJoints = from x in weldlines select x.WeldJointId;
|
||
// foreach (var item in GetWeldingDailyItem)
|
||
// {
|
||
// // 如日报明细存在则只更新焊口信息,如进批条件改变,则只有删除后再重新增加
|
||
// if (weldJoints.Contains(item.WeldJointId))
|
||
// {
|
||
// }
|
||
// else
|
||
// {
|
||
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, false);
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
//if (canSave) //可以保存(至少有一个焊口的对应焊工资质符合要求)
|
||
//{
|
||
// if (!string.IsNullOrEmpty(this.WeldingDailyId))
|
||
// {
|
||
// newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
|
||
// BLL.Pipeline_WeldingDailyService.UpdatePipeline_WeldingDaily(newWeldingDaily);
|
||
// BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldReportMenuId, Const.BtnModify, this.WeldingDailyId);
|
||
// }
|
||
// else
|
||
// {
|
||
// this.WeldingDailyId = SQLHelper.GetNewID(typeof(Model.Pipeline_WeldingDaily));
|
||
// newWeldingDaily.WeldingDailyId = this.WeldingDailyId;
|
||
// BLL.Pipeline_WeldingDailyService.AddPipeline_WeldingDaily(newWeldingDaily);
|
||
// BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_WeldReportMenuId, Const.BtnAdd, this.WeldingDailyId);
|
||
// }
|
||
|
||
// // 新建日报
|
||
// if (weldlines.Count() == 0)
|
||
// {
|
||
// foreach (var item in GetWeldingDailyItem)
|
||
// {
|
||
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, true);
|
||
// }
|
||
// }
|
||
|
||
// // 日报已存在的情况
|
||
// else
|
||
// {
|
||
// var weldJoints = from x in weldlines select x.WeldJointId;
|
||
// foreach (var item in GetWeldingDailyItem)
|
||
// {
|
||
// // 如日报明细存在则只更新焊口信息,如进批条件改变,则只有删除后再重新增加
|
||
// if (weldJoints.Contains(item.WeldJointId))
|
||
// {
|
||
// var newWeldJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
|
||
// newWeldJoint.WeldingDailyId = this.WeldingDailyId;
|
||
// newWeldJoint.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
|
||
// //newWeldJoint.CoverWelderId = item.CoverWelderId;
|
||
// //newWeldJoint.BackingWelderId = item.BackingWelderId;
|
||
// newWeldJoint.WeldTypeId = item.WeldTypeId;
|
||
// //newWeldJoint.JointArea = item.JointArea;
|
||
// newWeldJoint.DoneDin = item.DoneDin;
|
||
// if (!string.IsNullOrEmpty(item.JointAttribute))
|
||
// {
|
||
// newWeldJoint.JointAttribute = item.JointAttribute;
|
||
// if (item.JointAttribute == "活动S")
|
||
// {
|
||
// newWeldJoint.JointArea = "S";
|
||
// }
|
||
// else
|
||
// {
|
||
// newWeldJoint.JointArea = "F";
|
||
// }
|
||
// }
|
||
|
||
|
||
// newWeldJoint.WeldingLocationId = item.WeldingLocationId;
|
||
// BLL.Pipeline_WeldJointService.UpdateWeldJoint(newWeldJoint);
|
||
// //更新焊口号 修改固定焊口号后 +G
|
||
// //BLL.Pipeline_WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// errlog += InsertWeldingDailyItem(item, newWeldingDaily.WeldingDate, true);
|
||
// }
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
|
||
// 焊工每天超过60达因的提示(暂不用)
|
||
//foreach (var item in GetWeldingDailyItem)
|
||
//{
|
||
// if (!string.IsNullOrEmpty(item.CoverWelderId) && !string.IsNullOrEmpty(item.BackingWelderId))
|
||
// {
|
||
// bool cWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(this.ProjectId, item.CoverWelderId, newWeldingDaily.WeldingDate.Value);
|
||
// bool bWelder = cWelder;
|
||
// if (item.CoverWelderId != item.BackingWelderId)
|
||
// {
|
||
// bWelder = BLL.Pipeline_WeldJointService.GetWelderLimitDN(this.ProjectId, item.BackingWelderId, newWeldingDaily.WeldingDate.Value);
|
||
// }
|
||
|
||
// if (cWelder || bWelder)
|
||
// {
|
||
// if (cWelder)
|
||
// {
|
||
// var coverWelder = BLL.WelderService.GetWelderById(item.CoverWelderId);
|
||
// if (coverWelder != null)
|
||
// {
|
||
// string txt = Resources.Lan.WelderCode + coverWelder.WelderCode + Resources.Lan.WeldingDiameter;
|
||
// if (!errlog.Contains(txt))
|
||
// {
|
||
// errlog += txt;
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// if (bWelder)
|
||
// {
|
||
// var backingWelder = BLL.WelderService.GetWelderById(item.BackingWelderId);
|
||
// if (backingWelder != null)
|
||
// {
|
||
// string txt = Resources.Lan.WelderCode + backingWelder.WelderCode + Resources.Lan.WeldingDiameter;
|
||
// if (!errlog.Contains(txt))
|
||
// {
|
||
// errlog += txt;
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
|
||
|
||
//if (string.IsNullOrEmpty(errlog))
|
||
//{
|
||
// ShowNotify(Resources.Lan.SaveSuccessfully, MessageBoxIcon.Success);
|
||
// PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||
//}
|
||
//else
|
||
//{
|
||
// // string okj = ActiveWindow.GetWriteBackValueReference(newWeldReportMain.WeldingDailyId) + ActiveWindow.GetHidePostBackReference();
|
||
// Alert.ShowInTop(Resources.Lan.SaveSuccessfully + Resources.Lan.WeldingDetails + errlog, Resources.Lan.SubmitResults, MessageBoxIcon.Warning);
|
||
// // ShowAlert("焊接明细中" + errlog, MessageBoxIcon.Warning);
|
||
//}
|
||
|
||
#endregion
|
||
}
|
||
else
|
||
{
|
||
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 日报明细插入(更新焊口信息),组批等,不用了
|
||
/// <summary>
|
||
/// 日报明细插入(更新焊口信息),组批等
|
||
/// </summary>
|
||
/// <param name="item"></param>
|
||
/// <param name="weldingDailyId"></param>
|
||
/// <returns></returns>
|
||
//private string InsertWeldingDailyItem(Model.SpWeldingDailyItem item, DateTime? weldingDate, bool isSave)
|
||
//{
|
||
// string errlog = string.Empty;
|
||
// var newWeldJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
|
||
// var pipeline = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(newWeldJoint.PipelineId);
|
||
|
||
// if (newWeldJoint != null && string.IsNullOrEmpty(newWeldJoint.WeldingDailyId))
|
||
// {
|
||
// if (!string.IsNullOrEmpty(item.CoverWelderId) && !string.IsNullOrEmpty(item.BackingWelderId))
|
||
// {
|
||
// Model.Base_Material material = BLL.Base_MaterialService.GetMaterialByMaterialId(newWeldJoint.Material1Id);
|
||
// string steelType = material.SteelType; //钢材类型
|
||
// var welderQualifys = BLL.WelderQualifyService.GetWelderQualifysByWelderId(item.CoverWelderId);
|
||
|
||
// if (welderQualifys.Count() == 0)
|
||
// {
|
||
// errlog = Resources.Lan.NoQualification + "【" + newWeldJoint.WeldJointCode + "】" + Resources.Lan.WeldingConditions;
|
||
// }
|
||
// foreach (var welderQualify in welderQualifys)
|
||
// {
|
||
// int okNum = 0;
|
||
// var loc = from x in Funs.DB.Base_WeldingLocation
|
||
// where x.WeldingLocationId == welderQualify.WeldingLocationId
|
||
// select x;
|
||
// if (!string.IsNullOrEmpty(welderQualify.WeldingMethodId)) //焊接方法
|
||
// {
|
||
// if (newWeldJoint.WeldingMethodId == welderQualify.WeldingMethodId)
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// if (loc.Count() > 0 && loc.First().WeldingLocationCode != "ALL" && !string.IsNullOrEmpty(item.WeldingLocationId)) //焊接位置
|
||
// {
|
||
// if (item.WeldingLocationId == welderQualify.WeldingLocationId)
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// if (!string.IsNullOrEmpty(welderQualify.MaterialId)) //钢材类型
|
||
// {
|
||
// if (steelType == welderQualify.MaterialId)
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// if (welderQualify.SizesMin != null) //最小寸径
|
||
// {
|
||
// if (newWeldJoint.Dia >= welderQualify.SizesMin)
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
|
||
// if (welderQualify.ThicknessMax != null) //最大壁厚
|
||
// {
|
||
// if (newWeldJoint.Thickness <= welderQualify.ThicknessMax)
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// okNum++;
|
||
// }
|
||
|
||
// if (okNum == 5) //全部条件符合
|
||
// {
|
||
// canSave = true;
|
||
// break;
|
||
// }
|
||
|
||
// }
|
||
|
||
// if (canSave ==true) //全部条件符合
|
||
// {
|
||
// if (isSave)
|
||
// {
|
||
// newWeldJoint.WeldingDailyId = this.WeldingDailyId;
|
||
// newWeldJoint.WeldingDailyCode = this.txtWeldingDailyCode.Text.Trim();
|
||
// newWeldJoint.CoverWelderId = item.CoverWelderId;
|
||
// newWeldJoint.BackingWelderId = item.BackingWelderId;
|
||
// //newWeldJoint.WeldTypeId = item.WeldTypeId;
|
||
// //newWeldJoint.JointArea = item.JointArea;
|
||
// newWeldJoint.DoneDin = item.Size;
|
||
// //newWeldJoint.JointAttribute = item.JointAttribute;
|
||
// //newWeldJoint.WeldingLocationId = item.WeldingLocationId;
|
||
// BLL.Pipeline_WeldJointService.UpdateWeldJoint(newWeldJoint);
|
||
// //更新焊口号 修改固定焊口号后 +G
|
||
// //BLL.Pipeline_WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
|
||
|
||
// // 进批
|
||
// BLL.Batch_PointBatchItemService.InsertPointBatch(this.ProjectId, this.drpUnit.SelectedValue, this.drpInstallation.SelectedValue, item.CoverWelderId, item.WeldJointId, weldingDate);
|
||
// }
|
||
// }
|
||
// else
|
||
// {
|
||
// errlog = Resources.Lan.NoQualification + "【" + newWeldJoint.WeldJointCode + "】" + Resources.Lan.WeldingConditions;
|
||
// }
|
||
|
||
|
||
// }
|
||
// else
|
||
// {
|
||
// errlog = Resources.Lan.WeldingJoint + "【" + newWeldJoint.WeldJointCode + "】" + Resources.Lan.NoWelderSelected;
|
||
// }
|
||
// }
|
||
|
||
// return errlog;
|
||
//}
|
||
#endregion
|
||
|
||
#region 收集Grid页面信息
|
||
/// <summary>
|
||
/// 收集Grid页面信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private List<Model.SpWeldingDailyItem> CollectGridJointInfo(string dayReportId)
|
||
{
|
||
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = null;
|
||
List<Model.SpWeldingDailyItem> getNewWeldReportItem = new List<Model.SpWeldingDailyItem>();
|
||
if (!string.IsNullOrEmpty(this.hdItemsString.Text))
|
||
{
|
||
GetWeldingDailyItem = BLL.Pipeline_WeldingDailyService.GetWeldReportAddItem(this.hdItemsString.Text);
|
||
}
|
||
else if (string.IsNullOrEmpty(this.hdItemsString.Text) && !string.IsNullOrEmpty(dayReportId))
|
||
{
|
||
GetWeldingDailyItem = BLL.Pipeline_WeldingDailyService.GetWeldingDailyItem(dayReportId);
|
||
}
|
||
|
||
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>("WeldJointId").ToString();
|
||
var item = GetWeldingDailyItem.FirstOrDefault(x => x.WeldJointId == rowID);
|
||
if (item != null)
|
||
{
|
||
//var coverWelderCode = (from x in Funs.DB.Welder_Welder
|
||
// join y in Funs.DB.Welder_ProjectWelder
|
||
// on x.WelderId equals y.WelderId
|
||
// where y.ProjectId == this.ProjectId && x.WelderCode == values.Value<string>("CoverWelderId")
|
||
// select x).FirstOrDefault();
|
||
//if (coverWelderCode != null)
|
||
//{
|
||
// item.CoverWelderCode = coverWelderCode.WelderCode;
|
||
// item.CoverWelderId = coverWelderCode.WelderId;
|
||
//}
|
||
//var backingWelderCode = (from x in Funs.DB.Welder_Welder
|
||
// join y in Funs.DB.Welder_ProjectWelder
|
||
// on x.WelderId equals y.WelderId
|
||
// where y.ProjectId == this.ProjectId && x.WelderCode == values.Value<string>("BackingWelderId")
|
||
// select x).FirstOrDefault();
|
||
//if (backingWelderCode != null)
|
||
//{
|
||
// item.BackingWelderCode = backingWelderCode.WelderCode;
|
||
// item.BackingWelderId = backingWelderCode.WelderId;
|
||
//}
|
||
//var weldType = (from x in Funs.DB.Base_WeldType
|
||
// where x.WeldTypeCode == values.Value<string>("WeldTypeId")
|
||
// select x).FirstOrDefault();
|
||
//if (weldType != null)
|
||
//{
|
||
// item.WeldTypeId = weldType.WeldTypeId;
|
||
//}
|
||
//item.JointArea = values.Value<string>("JointArea").ToString();
|
||
if (!string.IsNullOrEmpty(values.Value<string>("JointAttribute")))
|
||
{
|
||
item.JointAttribute = values.Value<string>("JointAttribute").ToString();
|
||
if (item.JointAttribute == "活动S")
|
||
{
|
||
item.JointArea = "S";
|
||
}
|
||
else
|
||
{
|
||
item.JointArea = "F";
|
||
}
|
||
}
|
||
var weldingLocation = (from x in Funs.DB.Base_WeldingLocation
|
||
where x.WeldingLocationCode == values.Value<string>("WeldingLocationCode")
|
||
select x).FirstOrDefault();
|
||
if (weldingLocation != null)
|
||
{
|
||
item.WeldingLocationId = weldingLocation.WeldingLocationId;
|
||
}
|
||
item.Size = Funs.GetNewDecimalOrZero(values.Value<string>("Size").ToString());
|
||
item.Dia = Funs.GetNewDecimalOrZero(values.Value<string>("Dia").ToString());
|
||
item.Thickness = Funs.GetNewDecimalOrZero(values.Value<string>("Thickness").ToString());
|
||
|
||
item.WeldingMethodCode = values.Value<string>("WeldingMethodCode");
|
||
var weldingMethodCode = (from x in Funs.DB.Base_WeldingMethod
|
||
where x.WeldingMethodCode == values.Value<string>("WeldingMethodCode")
|
||
select x).FirstOrDefault();
|
||
if (weldingMethodCode != null)
|
||
{
|
||
item.WeldingMethodId = weldingMethodCode.WeldingMethodId;
|
||
}
|
||
|
||
getNewWeldReportItem.Add(item);
|
||
}
|
||
|
||
}
|
||
return getNewWeldReportItem;
|
||
}
|
||
#endregion
|
||
|
||
#region Grid 关闭弹出窗口事件
|
||
/// <summary>
|
||
/// 关闭弹出窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||
{
|
||
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = BLL.Pipeline_WeldingDailyService.GetWeldReportAddItem(this.hdItemsString.Text);
|
||
this.BindGrid(GetWeldingDailyItem);
|
||
//SetDrpByDrpUnitChange();
|
||
//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)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||
{
|
||
List<Model.SpWeldingDailyItem> GetWeldingDailyItem = this.CollectGridJointInfo(Request.Params["WeldingDailyId"]);
|
||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||
{
|
||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||
var item = GetWeldingDailyItem.FirstOrDefault(x => x.WeldJointId == rowID);
|
||
if (item != null && !BLL.Batch_NDEItemService.IsCheckedByWeldJoint(rowID))
|
||
{
|
||
GetWeldingDailyItem.Remove(item);
|
||
// 删除焊口所在批和委托检测里信息
|
||
BLL.Batch_NDEItemService.DeleteAllNDEInfoToWeldJoint(item.WeldJointId);
|
||
|
||
// 更新焊口信息
|
||
var updateWeldJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(item.WeldJointId);
|
||
if (updateWeldJoint != null)
|
||
{
|
||
updateWeldJoint.WeldingDailyId = null;
|
||
updateWeldJoint.WeldingDailyCode = null;
|
||
updateWeldJoint.CoverWelderId = null;
|
||
updateWeldJoint.BackingWelderId = null;
|
||
BLL.Pipeline_WeldJointService.UpdateWeldJoint(updateWeldJoint);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop("不能删除,已检测并审核!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
|
||
BindGrid(GetWeldingDailyItem);
|
||
ShowNotify(Resources.Lan.DeletedSuccessfully, MessageBoxIcon.Success);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 查找
|
||
/// <summary>
|
||
/// 查找未焊接焊口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void ckSelect_Click(object sender, EventArgs e)
|
||
{
|
||
CacheMove("weldreportEdit" + CurrUser.UserId);
|
||
string weldJoints = string.Empty;
|
||
JArray mergedData = Grid1.GetMergedData();
|
||
int i = 0;
|
||
foreach (JObject mergedRow in mergedData)
|
||
{
|
||
string weldJointId = Grid1.DataKeys[i][0].ToString();
|
||
|
||
string coverWelderId = "null"; // 14列
|
||
string backingWelderId = "null"; // 15列
|
||
string jointAttribute = "null"; //7列
|
||
string weldingLocationCode = "null"; //8列
|
||
string size = "null"; //9列
|
||
string dia = "null"; //10列
|
||
string thickness = "null"; //11列
|
||
string weldingMethodCode = "null"; //12列
|
||
|
||
string status = mergedRow.Value<string>("status");
|
||
JObject values = mergedRow.Value<JObject>("values");
|
||
|
||
if (Grid1.Rows[i].Values[14] != null)
|
||
{
|
||
coverWelderId = Grid1.Rows[i].Values[14].ToString();
|
||
}
|
||
if (Grid1.Rows[i].Values[15] != null)
|
||
{
|
||
backingWelderId = Grid1.Rows[i].Values[15].ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("JointAttribute")))
|
||
{
|
||
jointAttribute = values.Value<string>("JointAttribute").ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("WeldingLocationCode")))
|
||
{
|
||
weldingLocationCode = values.Value<string>("WeldingLocationCode").ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("Size")))
|
||
{
|
||
size = values.Value<string>("Size").ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("Dia")))
|
||
{
|
||
dia = values.Value<string>("Dia").ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("Thickness")))
|
||
{
|
||
thickness = values.Value<string>("Thickness").ToString();
|
||
}
|
||
if (!string.IsNullOrEmpty(values.Value<string>("WeldingMethodCode")))
|
||
{
|
||
weldingMethodCode = values.Value<string>("WeldingMethodCode").ToString();
|
||
}
|
||
weldJoints = weldJoints + weldJointId + "|" + coverWelderId + "|" + backingWelderId + "|" + jointAttribute + "|" + weldingLocationCode + "|" + size + "|" + dia + "|" + thickness + "|" + weldingMethodCode + "@";
|
||
|
||
i++;
|
||
}
|
||
|
||
if (weldJoints != string.Empty)
|
||
{
|
||
//weldJoints = HttpUtility.UrlEncodeUnicode(weldJoints.Substring(0, weldJoints.Length - 1));
|
||
weldJoints = weldJoints.Substring(0, weldJoints.Length - 1);
|
||
CacheSet("weldreportEdit"+CurrUser.UserId, weldJoints, 600);
|
||
}
|
||
|
||
if (!string.IsNullOrEmpty(this.drpUnit.SelectedValue) && this.drpUnit.SelectedValue != BLL.Const._Null && !string.IsNullOrEmpty(this.drpInstallation.SelectedValue) && this.drpInstallation.SelectedValue != BLL.Const._Null)
|
||
{
|
||
string strList = this.drpInstallation.SelectedValue + "|" + this.drpUnit.SelectedValue + "|" + Request.Params["WeldingDailyId"];
|
||
string window = String.Format("WeldReportItemEdit.aspx?strList={0}", strList, "编辑 - ");
|
||
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hdItemsString.ClientID) + Window1.GetShowReference(window));
|
||
}
|
||
else
|
||
{
|
||
Alert.ShowInTop(Resources.Lan.PleaseUnitAndInstallation, MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |