using System;
using System.Collections.Generic;
using System.Linq;
using BLL;
using System.Data.SqlClient;
using System.Data;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace FineUIPro.Web.WeldingManage
{
public partial class PreWeldReportAudit :PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitTreeMenu();
txtWeldingDate.Text = DateTime.Now.Date.ToString();
}
}
#region 加载树装置-单位-工作区
///
/// 加载树
///
private void InitTreeMenu()
{
this.tvControlItem.Nodes.Clear();
var totalInstallation = from x in Funs.DB.Project_Installation select x;
var totalWorkArea = from x in Funs.DB.Project_WorkArea select x;
var totalUnit = from x in Funs.DB.Project_Unit select x;
////装置
var pInstallation = (from x in totalInstallation where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
////区域
var pWorkArea = (from x in totalWorkArea where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
////单位
var pUnits = (from x in totalUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
this.BindNodes(null, pInstallation, pWorkArea, pUnits);
}
#endregion
#region 绑定树节点
///
/// 绑定树节点
///
///
private void BindNodes(TreeNode node, List pInstallation, List pWorkArea, List pUnits)
{
if (node == null)
{
List installations = pInstallation;
var pUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
if (pUnit != null && !pUnit.UnitType.Contains(Const.UnitType_2) && !pUnit.UnitType.Contains(Const.UnitType_1))
{
installations = (from x in pInstallation
join y in pWorkArea on x.InstallationId equals y.InstallationId
where y.UnitId == this.CurrUser.UnitId
orderby x.InstallationId
select x).Distinct().ToList();
}
foreach (var q in installations)
{
TreeNode newNode = new TreeNode();
newNode.NodeID = q.InstallationId;
newNode.Text = q.InstallationName;
newNode.ToolTip = Resources.Lan.InstallationName;
newNode.Expanded = true;
this.tvControlItem.Nodes.Add(newNode);
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
}
}
else if (node.ToolTip == Resources.Lan.InstallationName)
{
List units = null;
var pUnitDepth = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
if (pUnitDepth == null || pUnitDepth.UnitType.Contains(Const.UnitType_2) || pUnitDepth.UnitType.Contains(Const.UnitType_1))
{
units = (from x in pUnits
join y in pWorkArea on x.UnitId equals y.UnitId
where y.InstallationId == node.NodeID && x.UnitType.Contains(Const.UnitType_5)
select x).ToList();
}
else
{
units = (from x in pUnits
join y in pWorkArea on x.UnitId equals y.UnitId
where y.InstallationId == node.NodeID && x.UnitType.Contains(Const.UnitType_5) && x.UnitId == this.CurrUser.UnitId
select x).ToList();
}
units = units.OrderBy(x => x.InTime).Distinct().ToList();
foreach (var q in units)
{
var unit = BLL.Base_UnitService.GetUnit(q.UnitId);
if (unit != null)
{
TreeNode newNode = new TreeNode();
newNode.Text = unit.UnitName;
newNode.NodeID = q.UnitId + "|" + node.NodeID;
newNode.ToolTip = Resources.Lan.CompanyName;
newNode.EnableClickEvent = true;
node.Nodes.Add(newNode);
this.BindNodes(newNode, pInstallation, pWorkArea, pUnits);
}
}
}
}
#endregion
#region 点击TreeView
///
/// 点击TreeView
///
///
///
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
{
this.BindGrid();
}
#endregion
#region 数据绑定
///
/// 数据绑定
///
private void BindGrid()
{
string strSql = @"SELECT preWeld.PreWeldingDailyId,
preWeld.ProjectId,
preWeld.WeldJointId,
preWeld.WeldingDate,
jot.WeldJointCode,
line.PipelineCode,
jot.JointArea,
preWeld.JointAttribute,
jot.Size,
jot.Dia,
jot.Thickness,
preWeld.AttachUrl,
cellWelder.WelderCode AS CellWelderCode,
backingWelder.WelderCode AS BackingWelderCode,
method.WeldingMethodCode AS WeldMethod,
preWeld.AuditDate,
users.UserName AS AuditManName
FROM dbo.Pipeline_PreWeldingDaily AS preWeld
LEFT JOIN dbo.Pipeline_WeldJoint AS jot ON jot.WeldJointId = preWeld.WeldJointId
LEFT JOIN dbo.Pipeline_Pipeline line ON line.PipelineId = jot.PipelineId
LEFT JOIN dbo.Welder_Welder AS cellWelder ON cellWelder.WelderId=preWeld.CoverWelderId
LEFT JOIN dbo.Welder_Welder AS backingWelder ON backingWelder.WelderId=preWeld.BackingWelderId
LEFT JOIN dbo.Base_WeldingMethod method ON method.WeldingMethodId=jot.WeldingMethodId
LEFT JOIN dbo.Sys_User AS users ON users.UserId = preWeld.AuditMan
WHERE preWeld.ProjectId=@ProjectId";
List listStr = new List();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (!string.IsNullOrEmpty(tvControlItem.SelectedNodeID))
{
strSql += " AND preWeld.UnitId =@UnitId";
listStr.Add(new SqlParameter("@UnitId", tvControlItem.SelectedNode.NodeID.Split('|')[0]));
}
if (!string.IsNullOrEmpty(txtWeldingDate.Text.Trim()))
{
strSql += " AND CONVERT(VARCHAR(100), preWeld.WeldingDate,23) =@WeldingDate";
listStr.Add(new SqlParameter("@WeldingDate", Convert.ToDateTime(txtWeldingDate.Text.Trim())));
}
if (IsAudit.SelectedValue == "0")
{
strSql += " AND preWeld.AuditDate IS NULL ";
}
else
{
strSql += " AND preWeld.AuditDate IS NOT NULL ";
}
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();
for (int i = 0; i < this.Grid1.Rows.Count; i++)
{
string id = Grid1.DataKeys[i][0].ToString();
Model.Pipeline_PreWeldingDaily item = BLL.PreWeldReportService.GetPreWeldingDaily(id);
if (item != null)
{
if (item.AuditDate.HasValue) //未审核
{
this.Grid1.Rows[i].RowSelectable = false;
}
}
}
}
#endregion
protected void IsAudit_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid();
}
protected void WeldingDate_OnTextChanged(object sender, EventArgs e)
{
BindGrid();
}
#region 分页排序
#region 页索引改变事件
///
/// 页索引改变事件
///
///
///
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
{
Grid1.PageIndex = e.NewPageIndex;
BindGrid();
}
#endregion
#region 排序
///
/// 排序
///
///
///
protected void Grid1_Sort(object sender, GridSortEventArgs e)
{
Grid1.SortDirection = e.SortDirection;
Grid1.SortField = e.SortField;
BindGrid();
}
#endregion
#region 分页选择下拉改变事件
///
/// 分页选择下拉改变事件
///
///
///
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
BindGrid();
}
#endregion
#endregion
protected void btnDelete_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PreWeldReportMenuId, Const.BtnDelete))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop(Resources.Lan.SelectLeastOneRecord, MessageBoxIcon.Warning);
return;
}
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string daily = Grid1.DataKeys[rowIndex][0].ToString();
BLL.PreWeldReportService.DeletePreWeldingDaily(daily);
BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PreWeldReportMenuId, Const.BtnDelete, daily);
ShowNotify(Resources.Lan.DeletedSuccessfully, MessageBoxIcon.Success);
}
this.BindGrid();
}
else
{
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
}
}
///
/// 预提交日报审核并提交
///
///
///
protected void btnAudit_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.HJGL_PreWeldReportMenuId, Const.BtnDelete))
{
if (!string.IsNullOrEmpty(txtWeldingDate.Text))
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
ShowNotify("请勾选要审核的记录!", MessageBoxIcon.Warning);
return;
}
string perfix = string.Format("{0:yyyyMMdd}", Convert.ToDateTime(txtWeldingDate.Text)) + "-";
string weldingDailyCode = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "dbo.Pipeline_WeldingDaily", "WeldingDailyCode", this.CurrUser.LoginProjectId, perfix);
Model.Pipeline_WeldingDaily newWeldingDaily = new Model.Pipeline_WeldingDaily();
newWeldingDaily.WeldingDailyCode = weldingDailyCode;
newWeldingDaily.ProjectId = CurrUser.LoginProjectId;
if (tvControlItem.SelectedNodeID != BLL.Const._Null)
{
newWeldingDaily.InstallationId = tvControlItem.SelectedNode.ParentNode.NodeID;
newWeldingDaily.UnitId = tvControlItem.SelectedNodeID.Split('|')[0];
}
DateTime? weldDate = Funs.GetNewDateTime(this.txtWeldingDate.Text);
if (weldDate.HasValue)
{
newWeldingDaily.WeldingDate = weldDate.Value;
}
else
{
newWeldingDaily.WeldingDate = Convert.ToDateTime(txtWeldingDate.Text);
}
newWeldingDaily.Tabler = this.CurrUser.UserId;
newWeldingDaily.TableDate = Funs.GetNewDateTime(this.txtWeldingDate.Text);
newWeldingDaily.Remark = "移动端提交";
string errlog = string.Empty;
string eventArg = string.Empty;
List weldJointList = new List();
int[] selections = Grid1.SelectedRowIndexArray;
foreach (int rowIndex in selections)
{
string weldJointId = Grid1.DataKeys[rowIndex][1].ToString();
string preWeldingDailyId = Grid1.DataKeys[rowIndex][0].ToString();
bool canSave = false;
var jot = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(weldJointId);
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
weldJointList.Add(jot);
var preWeldingDaily = Funs.DB.Pipeline_PreWeldingDaily.FirstOrDefault(x => x.PreWeldingDailyId == preWeldingDailyId);
string weldTypeGroup = joty.Flag;
string weldTypeCode = joty.WeldTypeCode;
string floorWelder = preWeldingDaily.BackingWelderId;
string cellWelder = preWeldingDaily.CoverWelderId;
decimal? dia = jot.Dia;
decimal? sch = jot.Thickness;
string wmeCode = string.Empty;
var wm = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(jot.WeldingMethodId);
if (wm != null)
{
wmeCode = wm.WeldingMethodCode;
}
string[] wmeCodes = wmeCode.Split('+');
string location = "";
if (!string.IsNullOrEmpty(jot.WeldingLocationId))
{
var loc = Base_WeldingLocationServie.GetWeldingLocationById(jot.WeldingLocationId);
location = loc.WeldingLocationCode;
}
string ste = jot.Material1Id;
var projectWelder = BLL.Welder_ProjectWelderService.GetProjectWelderByProjectIdAndWelderId(this.CurrUser.LoginProjectId, floorWelder);
var projectUnit = BLL.Project_UnitService.GetProject_UnitByProjectIdUnitId(this.CurrUser.LoginProjectId, projectWelder.UnitId);
if (projectUnit != null && projectUnit.WelderQueIsUse == true)
{
List floorWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
where x.WelderId == floorWelder && x.WeldingMethodId != null
&& x.WeldingLocationId != null && x.MaterialType != null
&& x.WeldType != null
&& x.ThicknessMax != null && x.SizesMin != null
select x).ToList();
List cellWelderQualifys = (from x in Funs.DB.Welder_WelderQualify
where x.WelderId == cellWelder && x.WeldingMethodId != null
&& x.WeldingLocationId != null && x.MaterialType != null
&& x.WeldType != null
&& x.ThicknessMax != null && x.SizesMin != null
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);
}
}
}
else
{
canSave = true;
}
if (canSave == false)
{
eventArg = eventArg + jot.WeldJointCode + ",";
}
}
// 生成管线的随机数
var romPipe = (from x in weldJointList select x.PipelineId).Distinct();
if (romPipe.Count() > 0)
{
foreach (string pipeId in romPipe)
{
var pipe = Funs.DB.View_Pipeline_Random.FirstOrDefault(x => x.PipelineId == pipeId);
int rate = Convert.ToInt32(pipe.DetectionRateValue);
// RT 随机数
int rtTotalJotNum = Convert.ToInt32(pipe.RTTotalJointCount);
int rtWeldingJotNum = Convert.ToInt32(pipe.RTWeldingCount);
int rtPointNum = Convert.ToInt32(pipe.RtPointCount);
int rtMinValue = rtWeldingJotNum + 1;
int rtMaxValue = rtTotalJotNum;
int rtPointTotalNum = Convert.ToInt32(Math.Ceiling((double)(rtTotalJotNum * rate) / (double)100));
int rtnum = rtPointTotalNum - rtPointNum;
if (rtnum > 0)
{
int[] r = Funs.GetRandomNum(rtnum, rtMinValue, rtMaxValue);
var q = from x in r orderby x select x;
string random = string.Empty;
foreach (int i in q)
{
if (i <= rtMaxValue)
{
random = random + i.ToString() + ",";
}
}
if (random.Length > 0)
{
string randomNum = random.Substring(0, random.Length - 1);
Pipeline_PipelineService.UpdatePipelineRTRandom(pipeId, randomNum);
}
}
// PT 随机数
int ptTotalJotNum = Convert.ToInt32(pipe.PTTotalJointCount);
int ptWeldingJotNum = Convert.ToInt32(pipe.PTWeldingCount);
int ptPointNum = Convert.ToInt32(pipe.PtPointCount);
int ptMinValue = ptWeldingJotNum + 1;
int ptMaxValue = ptTotalJotNum;
int ptPointTotalNum = Convert.ToInt32(Math.Ceiling((double)(ptTotalJotNum * rate) / (double)100));
int ptnum = ptPointTotalNum - ptPointNum;
if (ptnum > 0)
{
int[] r = Funs.GetRandomNum(ptnum, ptMinValue, ptMaxValue);
var q = from x in r orderby x select x;
string random = string.Empty;
foreach (int i in q)
{
if (i <= ptMaxValue)
{
random = random + i.ToString() + ",";
}
}
if (random.Length > 0)
{
string randomNum = random.Substring(0, random.Length - 1);
Pipeline_PipelineService.UpdatePipelinePTRandom(pipeId, randomNum);
}
}
// 固定口(先按40%计算) 随机数
int gdTotalJotNum = Convert.ToInt32(pipe.GDTotalJointCount);
int gdWeldingJotNum = Convert.ToInt32(pipe.GDWeldingCount);
int gdPointNum = Convert.ToInt32(pipe.GDPointCount);
int gdMinValue = gdWeldingJotNum + 1;
int gdMaxValue = gdTotalJotNum;
int gdPointTotalNum = Convert.ToInt32(Math.Ceiling((double)(gdTotalJotNum * 40) / (double)100));
int gdnum = gdPointTotalNum - gdPointNum;
if (gdnum > 0)
{
int[] r = Funs.GetRandomNum(gdnum, gdMinValue, gdMaxValue);
var q = from x in r orderby x select x;
string random = string.Empty;
foreach (int i in q)
{
if (i <= gdMaxValue)
{
random = random + i.ToString() + ",";
}
}
if (random.Length > 0)
{
string randomNum = random.Substring(0, random.Length - 1);
Pipeline_PipelineService.UpdatePipelineGDRandom(pipeId, randomNum);
}
}
}
}
if (eventArg == string.Empty) //焊工焊接的所有焊口资质都符合要求)
{
// 增加日报主表
string weldingDailyId = SQLHelper.GetNewID(typeof(Model.Pipeline_WeldingDaily));
newWeldingDaily.WeldingDailyId = weldingDailyId;
BLL.Pipeline_WeldingDailyService.AddPipeline_WeldingDaily(newWeldingDaily);
foreach (int rowIndex in selections)
{
string weldJointId = Grid1.DataKeys[rowIndex][1].ToString();
string preWeldingDailyId = Grid1.DataKeys[rowIndex][0].ToString();
var updateJoint = BLL.Pipeline_WeldJointService.GetWeldJointByWeldJointId(weldJointId);
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(updateJoint.WeldTypeId);
var pipeline = BLL.Pipeline_PipelineService.GetPipelineByPipelineId(updateJoint.PipelineId);
var preWeldingDaily = Funs.DB.Pipeline_PreWeldingDaily.FirstOrDefault(x => x.PreWeldingDailyId == preWeldingDailyId);
string weldTypeCode = joty.WeldTypeCode;
updateJoint.WeldingDailyId = weldingDailyId;
updateJoint.WeldingDailyCode = weldingDailyCode;
updateJoint.CoverWelderId = preWeldingDaily.CoverWelderId;
updateJoint.BackingWelderId = preWeldingDaily.BackingWelderId;
updateJoint.DoneDin = updateJoint.Size;
updateJoint.WeldingDate = preWeldingDaily.WeldingDate;
// 更新焊口信息
BLL.Pipeline_WeldJointService.UpdateWeldJoint(updateJoint);
// 更新预提交信息
preWeldingDaily.AuditDate = DateTime.Now;
preWeldingDaily.AuditMan = CurrUser.UserId;
Funs.DB.SubmitChanges();
//更新焊口号 修改固定焊口号后 +G
//BLL.Pipeline_WeldJointService.UpdateWeldJointAddG(newWeldJoint.WeldJointId, newWeldJoint.JointAttribute, Const.BtnAdd);
//BLL.Batch_PointBatchItemService.InsertPointBatch(this.CurrUser.LoginProjectId, tvControlItem.SelectedNodeID.Split('|')[0], tvControlItem.SelectedNode.ParentNode.NodeID.Split('|')[0], preWeldingDaily.CoverWelderId, preWeldingDaily.WeldJointId, preWeldingDaily.WeldingDate);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
else
{
Alert.ShowInTop("焊工无资质焊接的焊口:" + eventArg, "提交结果", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请选择焊接日期!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify(Resources.Lan.NoPrivilegePrompt, MessageBoxIcon.Warning);
}
}
#region 资质分析
private bool IsOK(List 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.WeldingMethodId))
{
okNum++;
}
}
else
{
okNum++;
}
if (welderQualify.WeldingLocationId == "ALL") //焊接位置
{
okNum++;
}
else
{
if (!string.IsNullOrEmpty(location))
{
if (welderQualify.WeldingLocationId.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 != "2") // 承插焊
{
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;
}
///
/// 两种焊接方法的资质判断
///
///
///
///
///
///
///
///
///
///
private bool TwoWmeIsOK(List floorWelderQualifys, List 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.WeldingMethodId)
&& (x.WeldingLocationId == "ALL" || (location == null || location == "" || x.WeldingLocationId.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.WeldingMethodId)
&& (x.WeldingLocationId == "ALL" || (location == null || location == "" || x.WeldingLocationId.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 != "2") // 当为角焊缝时,管径和壁厚不限制
{
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
}
}