SGGL_SHJ/SGGL/FineUIPro.Web/HJGL/WeldingManage/WeldJointEdit.aspx.cs

881 lines
40 KiB
C#
Raw Normal View History

2022-09-05 16:36:31 +08:00
using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.HJGL.WeldingManage
{
public partial class WeldJointEdit : PageBase
{
/// <summary>
/// 管线主键
/// </summary>
public string PipelineId
{
get
{
return (string)ViewState["PipelineId"];
}
set
{
ViewState["PipelineId"] = value;
}
}
2023-10-09 12:00:54 +08:00
public string WeldJointId
{
get
{
return (string)ViewState["WeldJointId"];
}
set
{
ViewState["WeldJointId"] = value;
}
}
2023-11-24 18:29:30 +08:00
2022-09-05 16:36:31 +08:00
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Base_PipingClassService.InitPipingClassDropDownList(this.drpPipingClass, this.CurrUser.LoginProjectId, true, "请选择");//管线等级
Base_DetectionRateService.InitDetectionRateDropDownList(drpDetectionRate, true);
BLL.Base_MaterialService.InitMaterialDropDownList(this.drpMaterial1, true, "请选择");//材质1
BLL.Base_MaterialService.InitMaterialDropDownList(this.drpMaterial2, true, "请选择");//材质2
BLL.Base_WeldTypeService.InitWeldTypeDropDownList(this.drpWeldTypeCode, "请选择", true);//焊缝类型
BLL.Base_GrooveTypeService.InitGrooveTypeDropDownList(this.drpGrooveType, true, "请选择");//坡口类型
BLL.Base_WeldingMethodService.InitWeldingMethodDropDownList(this.drpWeldingMethodId, true, "请选择");//焊接方法
BLL.Base_ConsumablesService.InitConsumablesDropDownList(this.drpWeldingRod, true, "2", "请选择");//焊丝类型
BLL.Base_ConsumablesService.InitConsumablesDropDownList(this.drpWeldingWire, true, "1", "请选择");//焊条类型
Funs.FineUIPleaseSelect(DropTwoJointType, "请选择");
2022-09-05 16:36:31 +08:00
2022-12-18 22:40:49 +08:00
//焊口属性
this.drpJointAttribute.DataTextField = "Text";
this.drpJointAttribute.DataValueField = "Value";
this.drpJointAttribute.DataSource = BLL.DropListService.HJGL_JointAttribute();
this.drpJointAttribute.DataBind();
2022-09-05 16:36:31 +08:00
//BLL.Base_ComponentsService.InitComponentsDropDownList(this.drpComponent1, this.CurrUser.LoginProjectId, true, "请选择");//组件1
//BLL.Base_ComponentsService.InitComponentsDropDownList(this.drpComponent2, this.CurrUser.LoginProjectId, true, "请选择");//组件2
this.drpDetectionTypeId.DataValueField = "DetectionTypeId";
this.drpDetectionTypeId.DataTextField = "DetectionTypeCode";
//Funs.FineUIPleaseSelect(this.drpDetectionTypeId);
string flag = Request.Params["flag"];
2023-10-09 12:00:54 +08:00
WeldJointId = Request.Params["WeldJointId"];
2022-09-05 16:36:31 +08:00
string isTwoJoint = Request.Params["IsTwoJoint"];
if (flag == "2")
{
GroupPanel2.Hidden = false;
2023-10-27 14:02:52 +08:00
IsReadOnly(false);
2022-09-05 16:36:31 +08:00
}
else
{
GroupPanel2.Hidden = true;
IsReadOnly(false);
}
2023-10-09 12:00:54 +08:00
if (!string.IsNullOrEmpty(WeldJointId))
2022-09-05 16:36:31 +08:00
{
2023-10-09 12:00:54 +08:00
Model.HJGL_WeldJoint joint = BLL.WeldJointService.GetWeldJointByWeldJointId(WeldJointId);
2022-09-05 16:36:31 +08:00
Model.WPQ_WPQList list = BLL.WPQListServiceService.GetWPQById(joint.WPQId);
this.txtWpqId.Text = joint.WPQId;
if (joint != null)
{
this.PipelineId = joint.PipelineId;
if (list != null)
{
this.txtWPQCode.Text = list.WPQCode;
this.txtWpqId.Text = list.WPQId;
}
if (Request.Params["Type"] == "add") //插入焊口
{
2023-10-09 12:00:54 +08:00
var baseWeldJoints = BLL.WeldJointService.GetBaseWeldJointsByWeldJointId(WeldJointId);
2022-09-05 16:36:31 +08:00
this.txtWeldJointCode.Text = joint.WeldJointCode + "Z-" + (baseWeldJoints.Count + 1).ToString();
}
else
{
this.txtWeldJointCode.Text = joint.WeldJointCode;
}
if (!string.IsNullOrEmpty(joint.Material1Id))
{
this.drpMaterial1.SelectedValue = joint.Material1Id;
}
if (!string.IsNullOrEmpty(joint.Material2Id))
{
this.drpMaterial2.SelectedValue = joint.Material2Id;
}
this.txtSize.Text = Convert.ToString(joint.Size);
this.txtDia.Text = Convert.ToString(joint.Dia);
2022-12-18 22:40:49 +08:00
this.txtDNDia.Text = joint.DNDia;
2022-09-05 16:36:31 +08:00
this.txtThickness.Text = Convert.ToString(joint.Thickness);
if (!string.IsNullOrEmpty(joint.WeldingMethodId))
{
drpWeldingMethodId.SelectedValue = joint.WeldingMethodId;
hdWeldingMethodId.Text = joint.WeldingMethodId;
}
if (!string.IsNullOrEmpty(joint.WeldingRod))
{
drpWeldingRod.SelectedValue = joint.WeldingRod;
}
if (!string.IsNullOrEmpty(joint.WeldingWire))
{
drpWeldingWire.SelectedValue = joint.WeldingWire;
}
if (!string.IsNullOrEmpty(joint.GrooveTypeId))
{
drpGrooveType.SelectedValue = joint.GrooveTypeId;
hdGrooveType.Text = joint.GrooveTypeId;
}
if (!string.IsNullOrEmpty(joint.WeldTypeId))
{
drpWeldTypeCode.SelectedValue = joint.WeldTypeId;
}
if (!string.IsNullOrEmpty(joint.TwoJointType))
{
DropTwoJointType.SelectedValue = joint.TwoJointType;
}
2022-09-05 16:36:31 +08:00
if (!string.IsNullOrEmpty(joint.DetectionTypeId))
{
List<Model.Base_DetectionType> dList = new List<Model.Base_DetectionType>();
if (drpWeldTypeCode.SelectedItem.Text.Contains("B"))
{
Model.Base_DetectionType rt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("RT");
Model.Base_DetectionType ut = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("UT");
dList.Add(rt);
dList.Add(ut);
}
else
{
Model.Base_DetectionType mt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("MT");
Model.Base_DetectionType pt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("PT");
dList.Add(mt);
dList.Add(pt);
}
this.drpDetectionTypeId.DataSource = dList;
this.drpDetectionTypeId.DataBind();
this.drpDetectionTypeId.SelectedValue = joint.DetectionTypeId;
}
2022-12-18 22:40:49 +08:00
if (!string.IsNullOrEmpty(joint.JointAttribute))
{
drpJointAttribute.SelectedValue = joint.JointAttribute;
}
2022-09-05 16:36:31 +08:00
//if (!string.IsNullOrEmpty(joint.Components1Id))
//{
// drpComponent1.SelectedValue = joint.Components1Id;
//}
//if (!string.IsNullOrEmpty(joint.Components2Id))
//{
// drpComponent2.SelectedValue = joint.Components2Id;
//}
this.txtPreTemperature.Text = joint.PreTemperature;
this.txtSpecification.Text = joint.Specification;
txtRemark.Text = joint.Remark;
if (joint.IsHotProess != null)
{
drpIsHotProess.SelectedValue = joint.IsHotProess.Value.ToString();
}
//if (!string.IsNullOrEmpty(joint.DesignIsHotProess.ToString()))
//{
// drpDesignIsHotProess.SelectedValue = joint.DesignIsHotProess.Value.ToString();
//}
}
}
else
{
if (!string.IsNullOrEmpty(Request.Params["PipelineId"]))
{
this.PipelineId = Request.Params["PipelineId"];
}
}
Model.View_HJGL_Pipeline pipeline = BLL.PipelineService.GetViewPipelineByPipelineId(this.PipelineId);
if (pipeline != null)
{
if (!string.IsNullOrEmpty(pipeline.PipingClassId))
{
this.drpPipingClass.SelectedValue = pipeline.PipingClassId;
}
if (!string.IsNullOrEmpty(pipeline.DetectionRateId))
{
this.drpDetectionRate.SelectedValue = pipeline.DetectionRateId;
}
if (!string.IsNullOrEmpty(pipeline.DetectionType))
{
string[] dtype = pipeline.DetectionType.Split('|');
string DetectionTypestr = "";
for (int i = 0; i < dtype.Length; i++)
{
var DetectionType = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(dtype[i].ToString());
if (i == 0)
{
DetectionTypestr = DetectionType.DetectionTypeCode;
}
else
{
DetectionTypestr += "," + DetectionType.DetectionTypeCode;
}
}
this.txtDetectionType.Text = DetectionTypestr;
}
this.txtPipelineCode.Text = pipeline.PipelineCode;
}
if (!string.IsNullOrEmpty(isTwoJoint))
{
2023-01-05 11:44:15 +08:00
//string perfix = txtPipelineCode.Text + "/Z-";
string perfix = txtPipelineCode.Text + "/";
this.txtWeldJointCode.Text = perfix;
2022-09-05 16:36:31 +08:00
2023-11-24 18:29:30 +08:00
// txtWeldJointCode.Text = BLL.SQLHelper.RunProcNewIdByProjectId("SpGetNewCode4ByProjectId", "dbo.HJGL_WeldJoint", "WeldJointCode", this.CurrUser.LoginProjectId, perfix);
// txtWeldJointCode.Text = txtWeldJointCode.Text.Replace(perfix, "");
2022-09-05 16:36:31 +08:00
}
}
}
private void IsReadOnly(bool isReadOnly)
{
drpMaterial1.Readonly = isReadOnly;
drpMaterial2.Readonly = isReadOnly;
txtDia.Readonly = isReadOnly;
txtSize.Readonly = isReadOnly;
txtThickness.Readonly = isReadOnly;
drpWeldTypeCode.Readonly = isReadOnly;
}
protected void search_Click(object sender, EventArgs e)
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.HJGL_WeldJointMenuId, BLL.Const.BtnModify))
{
if (this.drpPipingClass.SelectedValue == BLL.Const._Null || this.drpMaterial1.SelectedValue == BLL.Const._Null || this.drpMaterial2.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("材质1、材质2不能为空", MessageBoxIcon.Warning);
return;
}
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.PipelineId);
//PageContext.RegisterStartupScript(Window1.GetSaveStateReference(txtWpqId.ClientID, txtWPQCode.ClientID, drpWeldingRod.ClientID, drpWeldingWire.ClientID, drpWeldingMethodId.ClientID, drpGrooveType.ClientID, txtPreTemperature.ClientID, drpMaterial1.ClientID,drpMaterial2.ClientID,txtIsHotProess.ClientID)
// + Window1.GetShowReference(String.Format("SelectWPS.aspx?Material1={0}&Material2={1}&Dia={2}&Thickness={3}&UnitId={4}&WeldingMethod={5}&WeldType={6}", this.drpMaterial1.SelectedValue, this.drpMaterial2.SelectedValue, this.txtDia.Text, this.txtThickness.Text,pipeline.UnitId,this.drpWeldingMethodId.SelectedText,this.drpWeldTypeCode.SelectedText, "维护 - ")));
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(txtWpqId.ClientID, txtWPQCode.ClientID, drpWeldingRod.ClientID, drpWeldingWire.ClientID, drpWeldingMethodId.ClientID, hdWeldingMethodId.ClientID, drpGrooveType.ClientID, hdGrooveType.ClientID, txtPreTemperature.ClientID, txtIsHotProess.ClientID)
+ Window1.GetShowReference(String.Format("SelectWPS.aspx?Material1={0}&Material2={1}&Dia={2}&Thickness={3}&UnitId={4}&WeldingMethod={5}&WeldType={6}", this.drpMaterial1.SelectedValue, this.drpMaterial2.SelectedValue, this.txtDia.Text, this.txtThickness.Text, pipeline.UnitId, this.drpWeldingMethodId.SelectedText, this.drpWeldTypeCode.SelectedText, "维护 - ")));
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
2023-11-27 16:06:24 +08:00
string weldJointCode = string.Empty;
2022-09-05 16:36:31 +08:00
2023-11-27 16:06:24 +08:00
int joint = Funs.GetNewIntOrZero(this.txtWeldJointCode.Text.Trim());
2022-09-05 16:36:31 +08:00
2023-11-27 16:06:24 +08:00
if (joint != 0)
{
if (joint < 10)
2022-09-05 16:36:31 +08:00
{
2023-11-27 16:06:24 +08:00
weldJointCode = "0" + Convert.ToString(joint);
2022-09-05 16:36:31 +08:00
}
else
{
2023-11-27 16:06:24 +08:00
weldJointCode = Convert.ToString(joint);
2022-09-05 16:36:31 +08:00
}
}
else
{
2023-11-27 16:06:24 +08:00
weldJointCode = this.txtWeldJointCode.Text;
2022-09-05 16:36:31 +08:00
}
2023-11-27 16:06:24 +08:00
if (BLL.WeldJointService.IsExistWeldJointCode(weldJointCode, this.PipelineId, WeldJointId))
{
Alert.ShowInTop("该管线焊口已存在!", MessageBoxIcon.Warning);
return;
}
else
{
2023-11-29 10:46:42 +08:00
SaveData(true);
2023-11-27 16:06:24 +08:00
}
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 提交数据
/// </summary>
2023-11-29 10:46:42 +08:00
private void SaveData(bool isClosed)
2022-09-05 16:36:31 +08:00
{
2023-11-24 18:29:30 +08:00
// if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()) || this.drpPipingClass.SelectedValue == BLL.Const._Null || this.drpMaterial1.SelectedValue == BLL.Const._Null || this.drpMaterial2.SelectedValue == BLL.Const._Null || this.drpWeldTypeCode.SelectedValue == BLL.Const._Null || string.IsNullOrEmpty(this.hdWeldingMethodId.Text) || string.IsNullOrEmpty(this.txtWpqId.Text.Trim()))
2022-09-05 16:36:31 +08:00
if (string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()) || this.drpPipingClass.SelectedValue == BLL.Const._Null || this.drpMaterial1.SelectedValue == BLL.Const._Null || this.drpMaterial2.SelectedValue == BLL.Const._Null || this.drpWeldTypeCode.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("页面必填项不能为空", MessageBoxIcon.Warning);
Alert.ShowInTop("请完善必填项!", MessageBoxIcon.Warning);
return;
}
Model.HJGL_WeldJoint joint = new Model.HJGL_WeldJoint();
2023-10-09 12:00:54 +08:00
string weldJointId = WeldJointId;
2022-09-05 16:36:31 +08:00
joint.PipelineId = this.PipelineId;
joint.PipelineCode = txtPipelineCode.Text.Trim();
joint.ProjectId = this.CurrUser.LoginProjectId;
2022-10-19 15:49:56 +08:00
//if (!this.txtWeldJointCode.Text.Contains("G"))
//{
2023-11-24 18:29:30 +08:00
int jointCode = Funs.GetNewIntOrZero(this.txtWeldJointCode.Text.Trim());
if (jointCode != 0)
{
if (jointCode < 10)
2022-09-05 16:36:31 +08:00
{
2023-11-24 18:29:30 +08:00
joint.WeldJointCode = "0" + Convert.ToString(jointCode);
2022-09-05 16:36:31 +08:00
}
else
{
2023-11-24 18:29:30 +08:00
joint.WeldJointCode = Convert.ToString(jointCode);
2022-09-05 16:36:31 +08:00
}
2023-11-24 18:29:30 +08:00
}
else
{
joint.WeldJointCode = this.txtWeldJointCode.Text;
}
2022-10-19 15:49:56 +08:00
//}
//else
//{
// Alert.ShowInTop("焊口编号不能包含G", MessageBoxIcon.Warning);
// return;
//}
2022-09-05 16:36:31 +08:00
if (this.drpMaterial1.SelectedValue != BLL.Const._Null)
{
joint.Material1Id = this.drpMaterial1.SelectedValue;
}
if (this.drpMaterial2.SelectedValue != BLL.Const._Null)
{
joint.Material2Id = this.drpMaterial2.SelectedValue;
}
joint.Size = Funs.GetNewDecimal(this.txtSize.Text.Trim());
joint.Dia = Funs.GetNewDecimal(this.txtDia.Text.Trim());
2023-11-24 18:29:30 +08:00
joint.DNDia = txtDNDia.Text.Trim();
2022-09-05 16:36:31 +08:00
joint.Thickness = Funs.GetNewDecimal(this.txtThickness.Text.Trim());
//if (this.drpComponent1.SelectedValue != BLL.Const._Null)
//{
// joint.Components1Id = this.drpComponent1.SelectedValue;
//}
//if (this.drpComponent2.SelectedValue != BLL.Const._Null)
//{
// joint.Components2Id = this.drpComponent2.SelectedValue;
//}
2022-12-18 22:40:49 +08:00
joint.JointAttribute = drpJointAttribute.SelectedValue;
2022-09-05 16:36:31 +08:00
if (!string.IsNullOrEmpty(this.hdWeldingMethodId.Text.Trim()))
{
joint.WeldingMethodId = this.hdWeldingMethodId.Text.Trim();
}
if (this.drpWeldingRod.SelectedValue != BLL.Const._Null)
{
joint.WeldingRod = drpWeldingRod.SelectedValue;
}
if (this.drpWeldingWire.SelectedValue != BLL.Const._Null)
{
joint.WeldingWire = drpWeldingWire.SelectedValue;
}
if (!string.IsNullOrEmpty(this.hdGrooveType.Text.Trim()))
{
joint.GrooveTypeId = this.hdGrooveType.Text.Trim();
}
if (this.drpWeldTypeCode.SelectedValue != BLL.Const._Null)
{
joint.WeldTypeId = drpWeldTypeCode.SelectedValue;
}
if (this.DropTwoJointType.SelectedValue != BLL.Const._Null)
{
joint.TwoJointType = DropTwoJointType.SelectedValue;
}
2022-09-05 16:36:31 +08:00
joint.PreTemperature = this.txtPreTemperature.Text;
joint.Specification = this.txtSpecification.Text;
//var DetectionType = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode(this.txtDetectionTypeId.Text.Trim());
if (this.drpDetectionTypeId.SelectedValue != null)
{
joint.DetectionTypeId = this.drpDetectionTypeId.SelectedValue;
}
//bool flag = false;
//if (Convert.ToBoolean(drpDesignIsHotProess.SelectedValue))
//{
// flag = true;
//}
//if (flag)
//{
// joint.IsHotProess = true;
//}
//else
//{
// joint.IsHotProess = false;
//}
2023-07-07 16:19:46 +08:00
joint.IsHotProess = Convert.ToBoolean(drpIsHotProess.SelectedValue);
2022-09-05 16:36:31 +08:00
//joint.DesignIsHotProess = Convert.ToBoolean(drpDesignIsHotProess.SelectedValue);
joint.Remark = txtRemark.Text.Trim();
joint.SubmitMan = CurrUser.PersonId;
if (this.txtWpqId.Text != "")
{
joint.WPQId = this.txtWpqId.Text;
}
if (!string.IsNullOrEmpty(weldJointId))
{
if (string.IsNullOrEmpty(Request.Params["Type"])) //非插入焊口
{
joint.WeldJointId = weldJointId;
BLL.WeldJointService.UpdateWeldJoint(joint);
}
else //插入焊口
{
string newId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldJoint));
joint.WeldJointId = newId;
joint.BaseWeldJointId = weldJointId;
2023-10-09 12:00:54 +08:00
WeldJointId = joint.WeldJointId;
2022-09-05 16:36:31 +08:00
BLL.WeldJointService.AddWeldJoint(joint);
}
}
else
{
string newId = SQLHelper.GetNewID(typeof(Model.HJGL_WeldJoint));
joint.WeldJointId = newId;
2023-10-09 12:00:54 +08:00
WeldJointId = joint.WeldJointId;
2022-09-05 16:36:31 +08:00
if (Request.Params["IsTwoJoint"] == "1")
{
joint.IsTwoJoint = true;
}
else
{
joint.IsTwoJoint = null;
}
BLL.WeldJointService.AddWeldJoint(joint);
}
2023-11-29 10:46:42 +08:00
if (isClosed)
{
ShowNotify("提交成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
2022-09-05 16:36:31 +08:00
}
/// <summary>
/// 根据焊缝类型获取探伤类型
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpWeldTypeCode_SelectedIndexChanged(object sender, EventArgs e)
{
this.drpDetectionTypeId.Items.Clear();
if (this.drpWeldTypeCode.SelectedValue != Const._Null)
{
List<Model.Base_DetectionType> dList = new List<Model.Base_DetectionType>();
if (drpWeldTypeCode.SelectedItem.Text.Contains("B"))
{
Model.Base_DetectionType rt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("RT");
Model.Base_DetectionType ut = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("UT");
dList.Add(rt);
dList.Add(ut);
this.drpDetectionTypeId.DataSource = dList;
this.drpDetectionTypeId.DataBind();
this.drpDetectionTypeId.SelectedValue = rt.DetectionTypeId;
}
else
{
Model.Base_DetectionType mt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("MT");
Model.Base_DetectionType pt = BLL.Base_DetectionTypeService.GetDetectionTypeIdByDetectionTypeCode("PT");
dList.Add(mt);
dList.Add(pt);
this.drpDetectionTypeId.DataSource = dList;
this.drpDetectionTypeId.DataBind();
this.drpDetectionTypeId.SelectedValue = pt.DetectionTypeId;
}
#region
//if (string.IsNullOrEmpty(Request.Params["Type"])) //非插入焊口
//{
// //根据焊缝类型生成焊口号
// var joints = BLL.WeldJointService.GetViewWeldJointsByPipelineId(this.PipelineId);
// if (this.drpWeldTypeCode.SelectedItem.Text.Contains("B")) //对接焊缝
// {
// var jointsB = joints.Where(x => x.WeldTypeCode.Contains("B")).OrderByDescending(x => x.WeldJointCode);
// Model.Project_Sys_Set jointB = BLL.Project_SysSetService.GetSysSetBySetId("6", this.CurrUser.LoginProjectId);
// if (jointB != null && jointB.IsAuto == true) //加B前缀
// {
// if (jointsB.Count() > 0)
// {
// var joint = jointsB.First();
// int code = 0;
// try
// {
// code = Convert.ToInt32(joint.WeldJointCode.Substring(1));
// }
// catch (Exception)
// {
// }
// this.txtWeldJointCode.Text = "B" + (code + 1).ToString();
// }
// else
// {
// this.txtWeldJointCode.Text = "B1";
// }
// }
// else
// {
// if (jointsB.Count() > 0)
// {
// var joint = jointsB.First();
// int code = 0;
// try
// {
// code = Convert.ToInt32(joint.WeldJointCode);
// }
// catch (Exception)
// {
// }
// this.txtWeldJointCode.Text = (code + 1).ToString();
// }
// else
// {
// this.txtWeldJointCode.Text = "1";
// }
// }
// }
// else if (this.drpWeldTypeCode.SelectedItem.Text == "D")
// {
// var jointsD = joints.Where(x => x.WeldTypeCode == "D").OrderByDescending(x => x.WeldJointCode);
// if (jointsD.Count() > 0)
// {
// var joint = jointsD.First();
// int code = 0;
// try
// {
// code = Convert.ToInt32(joint.WeldJointCode.Substring(1));
// }
// catch (Exception)
// {
// }
// this.txtWeldJointCode.Text = "D" + (code + 1).ToString();
// }
// else
// {
// this.txtWeldJointCode.Text = "D1";
// }
// }
// else if (this.drpWeldTypeCode.SelectedItem.Text == "C")
// {
// var jointsC = joints.Where(x => x.WeldTypeCode == "C").OrderByDescending(x => x.WeldJointCode);
// if (jointsC.Count() > 0)
// {
// var joint = jointsC.First();
// int code = 0;
// try
// {
// code = Convert.ToInt32(joint.WeldJointCode.Substring(1));
// }
// catch (Exception)
// {
// }
// this.txtWeldJointCode.Text = "C" + (code + 1).ToString();
// }
// else
// {
// this.txtWeldJointCode.Text = "C1";
// }
// }
// else if (this.drpWeldTypeCode.SelectedItem.Text == "E")
// {
// var jointsE = joints.Where(x => x.WeldTypeCode == "E").OrderByDescending(x => x.WeldJointCode);
// if (jointsE.Count() > 0)
// {
// var joint = jointsE.First();
// int code = 0;
// try
// {
// code = Convert.ToInt32(joint.WeldJointCode.Substring(1));
// }
// catch (Exception)
// {
// }
// this.txtWeldJointCode.Text = "E" + (code + 1).ToString();
// }
// else
// {
// this.txtWeldJointCode.Text = "E1";
// }
// }
//}
#endregion
}
}
/// <summary>
/// 焊丝
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpWeldingRod_SelectedIndexChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtWpqId.Text))
{
var wps = BLL.WPQListServiceService.GetWPQById(txtWpqId.Text.Trim());
if (drpMaterial1.SelectedValue != Const._Null)
{
var mat = BLL.Base_MaterialService.GetMaterialByMaterialId(drpMaterial1.SelectedValue);
string matClass = mat.MaterialClass;
if (matClass == "Fe-1" || matClass == "Fe-3")
{
var wpsRod = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(wps.WeldingRod);
var matRod = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(drpWeldingRod.SelectedValue);
2023-11-24 18:29:30 +08:00
if (wpsRod != null && matRod != null && IsCoverClass(wpsRod.SteelType, matRod.SteelType))
2022-09-05 16:36:31 +08:00
{
}
else
{
Alert.ShowInTop("焊口焊材强度需大于等于WPS焊材强度", MessageBoxIcon.Warning);
drpWeldingWire.SelectedValue = wps.WeldingRod;
}
}
}
else
{
drpWeldingWire.SelectedValue = wps.WeldingRod;
}
}
}
/// <summary>
/// 焊条
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpWeldingWire_SelectedIndexChanged(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(txtWpqId.Text))
{
var wps = BLL.WPQListServiceService.GetWPQById(txtWpqId.Text.Trim());
if (drpMaterial1.SelectedValue != Const._Null)
{
var mat = BLL.Base_MaterialService.GetMaterialByMaterialId(drpMaterial1.SelectedValue);
string matClass = mat.MaterialClass;
if (matClass == "Fe-1" || matClass == "Fe-3")
{
var wpsWire = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(wps.WeldingWire);
var matWire = BLL.Base_ConsumablesService.GetConsumablesByConsumablesId(drpWeldingWire.SelectedValue);
2023-11-24 18:29:30 +08:00
if (wpsWire != null && matWire != null && IsCoverClass(wpsWire.SteelType, matWire.SteelType))
2022-09-05 16:36:31 +08:00
{
}
else
{
Alert.ShowInTop("焊口焊材强度需大于等于WPS焊材强度", MessageBoxIcon.Warning);
drpWeldingWire.SelectedValue = wps.WeldingWire;
}
}
}
else
{
drpWeldingWire.SelectedValue = wps.WeldingWire;
}
}
}
/// <summary>
/// 判断耗材强度是否大于WPS耗材强度如是为true,否则为false
/// </summary>
/// <param name="wpsClass"></param>
/// <param name="matClass"></param>
/// <returns></returns>
private bool IsCoverClass(string wpsClass, string matClass)
{
bool isCover = false;
int wpsSn = 0;
int matSn = 0;
string wpsPre = wpsClass.Substring(0, wpsClass.Length - 2);
string matPre = matClass.Substring(0, matClass.Length - 2);
string wps = wpsClass.Substring(wpsClass.Length - 1, 1);
wpsSn = Funs.GetNewInt(wps).HasValue ? Funs.GetNewInt(wps).Value : 0;
string mat = matClass.Substring(matClass.Length - 1, 1);
matSn = Funs.GetNewInt(mat).HasValue ? Funs.GetNewInt(mat).Value : 0;
if (wpsPre == matPre && matSn >= wpsSn)
{
return true;
}
return isCover;
}
#region
/// <summary>
/// 选择外径和壁厚自动获取规格
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtText_TextChanged(object sender, EventArgs e)
{
string dn = string.Empty;
string s = string.Empty;
2023-11-27 16:06:24 +08:00
//this.txtSize.Text = string.Empty;
2022-09-05 16:36:31 +08:00
this.txtSpecification.Text = string.Empty;
if (!string.IsNullOrEmpty(this.txtDia.Text.Trim()))
{
dn = this.txtDia.Text.Trim();
decimal dia = Funs.GetNewDecimalOrZero(this.txtDia.Text.Trim());
var inch = BLL.Base_DNCompareService.GetSizeByDia(dia);
if (inch != null)
{
this.txtSize.Text = Convert.ToString(inch);
}
if (!string.IsNullOrEmpty(this.txtThickness.Text.Trim()))
{
decimal thickness = Funs.GetNewDecimalOrZero(this.txtThickness.Text.Trim());
//是否根据壁厚计算达因
Model.Project_Sys_Set thicknessSet = BLL.Project_SysSetService.GetSysSetBySetId("7", this.CurrUser.LoginProjectId);
if (thicknessSet != null && thicknessSet.IsAuto == true)
{
if (inch != null)
{
this.txtSize.Text = BLL.WeldJointService.GetSizeByThickness(inch, thickness).ToString();
}
}
this.txtSpecification.Text = "Φ" + dn + "*" + this.txtThickness.Text.Trim();
}
}
2023-11-27 16:06:24 +08:00
if (!string.IsNullOrEmpty(this.txtDNDia.Text.Trim()))
{
dn = this.txtDNDia.Text.Trim();
if (!string.IsNullOrEmpty(this.txtThickness.Text.Trim()))
{
this.txtSpecification.Text = dn + "*" + this.txtThickness.Text.Trim();
}
}
2022-09-05 16:36:31 +08:00
}
#endregion
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
var IsHotProess = this.txtIsHotProess.Text;
if (IsHotProess == "True")
{
this.drpIsHotProess.SelectedValue = "True";
}
else
{
this.drpIsHotProess.SelectedValue = "False";
//if (!Convert.ToBoolean(drpDesignIsHotProess.SelectedValue))
//{
// this.drpIsHotProess.SelectedValue = "False";
//}
}
//获取可替代焊丝焊条
var weldingRods = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "2" select x;
var weldingWires = from x in Funs.DB.Base_Consumables where x.ConsumablesType == "1" select x;
List<Model.Base_Consumables> weldingRodList = new List<Model.Base_Consumables>();
List<Model.Base_Consumables> weldingWireList = new List<Model.Base_Consumables>();
string weldingRodId = this.drpWeldingRod.SelectedValue;
var mat = BLL.Base_MaterialService.GetMaterialByMaterialId(this.drpMaterial1.SelectedValue);
string matClass = mat.MaterialClass;
var matRod = weldingRods.FirstOrDefault(x => x.ConsumablesId == weldingRodId);
if (matRod != null)
{
foreach (var item in weldingRods)
{
if (matClass == "Fe-1" || matClass == "Fe-3")
{
if (IsCoverClass(matRod.SteelType, item.SteelType))
{
weldingRodList.Add(item);
}
}
else
{
if (matRod.SteelType == item.SteelType)
{
weldingRodList.Add(item);
}
}
}
weldingRodList.Add(matRod);
weldingRodList = weldingRodList.Distinct().ToList();
this.drpWeldingRod.DataSource = weldingRodList;
this.drpWeldingRod.DataBind();
Funs.FineUIPleaseSelect(this.drpWeldingRod);
this.drpWeldingRod.SelectedValue = weldingRodId;
}
string weldingWireId = this.drpWeldingWire.SelectedValue;
var matWire = weldingWires.FirstOrDefault(x => x.ConsumablesId == weldingWireId);
if (matWire != null)
{
foreach (var item in weldingWires)
{
if (matClass == "Fe-1" || matClass == "Fe-3")
{
if (IsCoverClass(matWire.SteelType, item.SteelType))
{
weldingWireList.Add(item);
}
}
else
{
if (matWire.SteelType == item.SteelType)
{
weldingWireList.Add(item);
}
}
}
weldingWireList.Add(matWire);
weldingWireList = weldingWireList.Distinct().ToList();
this.drpWeldingWire.DataSource = weldingWireList;
this.drpWeldingWire.DataBind();
Funs.FineUIPleaseSelect(this.drpWeldingWire);
this.drpWeldingWire.SelectedValue = weldingWireId;
}
}
//protected void drpDesignIsHotProess_SelectedIndexChanged(object sender, EventArgs e)
//{
// if (drpDesignIsHotProess.SelectedValue != BLL.Const._Null)
// {
// if (Convert.ToBoolean(drpDesignIsHotProess.SelectedValue))
// {
// this.drpIsHotProess.SelectedValue = "True";
// }
// else
// {
// if (this.txtIsHotProess.Text == "False")
// {
// this.drpIsHotProess.SelectedValue = "False";
// }
// }
// }
//}
2023-10-09 12:00:54 +08:00
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.WeldJointId))
{
2023-11-29 10:46:42 +08:00
SaveData(false);
2023-10-09 12:00:54 +08:00
}
2023-11-29 18:02:03 +08:00
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/WeldJoint&menuId={1}", WeldJointId, BLL.Const.HJGL_JotTwoDesignMenuId)));
2023-10-09 12:00:54 +08:00
}
2022-09-05 16:36:31 +08:00
}
}