This commit is contained in:
jackchenyang 2024-06-13 14:29:29 +08:00
commit 74a2cd0399
10 changed files with 567 additions and 450 deletions

View File

@ -117,5 +117,201 @@ namespace BLL
db.SubmitChanges();
}
}
#region
public static 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.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;
}
/// <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>
public static 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.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
}
}

View File

@ -50,7 +50,9 @@
System.Threading.Thread LoadServiceData = new System.Threading.Thread(new System.Threading.ThreadStart(ExpirePoint));
LoadServiceData.Start();
// 开启超焊信息提取
System.Threading.Thread LoadServiceSuperQue = new System.Threading.Thread(new System.Threading.ThreadStart(SuperQueWelding));
LoadServiceData.Start();
}
private void ExpirePoint()
@ -147,6 +149,126 @@
}
private void SuperQueWelding()
{
//定义一个定时器,并开启和配置相关属性
System.Timers.Timer ExpirePoint = new System.Timers.Timer();
//执行任务的周期 ,3小时
ExpirePoint.Interval = 1000 * 60 * 60 * 3;
ExpirePoint.Enabled = true;
ExpirePoint.Start();
ExpirePoint.Elapsed += new System.Timers.ElapsedEventHandler(SuperQueWelding_Elapsed);
}
void SuperQueWelding_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
bool canWPS = true;
var jotList = (from x in Funs.DB.Pipeline_WeldJoint where x.WeldingDailyId != null && x.WeldingMethodId != null select x).ToList();
foreach (var jot in jotList)
{
var wps = BLL.WPQListServiceService.GetWPQById(jot.WPQId);
string floorWelder = jot.BackingWelderId;
string cellWelder = jot.CoverWelderId;
if (wps != null)
{
// 验证焊工WPS资质
if (floorWelder == cellWelder)
{
if (!wps.WelderIds.Contains(floorWelder))
{
canWPS = false;
}
}
else
{
if (!wps.WelderIds.Contains(floorWelder))
{
canWPS = false;
}
if (!wps.WelderIds.Contains(cellWelder))
{
canWPS = false;
}
}
}
// 验证焊工合格项目资质
bool canSave = false;
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
var mat = BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(jot.WeldingMethodId);
var loc = BLL.Base_WeldingLocationServie.GetWeldingLocationById(jot.WeldingLocationId);
string weldTypeGroup = joty.Flag;
string weldTypeCode = joty.WeldTypeCode;
decimal? dia = jot.Dia;
decimal? sch = jot.Thickness;
string[] wmeCodes = mat.WeldingMethodCode.Split('+');
string location = loc.WeldingLocationCode;
string ste = jot.Material1Id;
List<Model.Welder_WelderQualify> 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<Model.Welder_WelderQualify> 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 = BLL.WelderQualifiedService.IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
else // 大于一种焊接方法,如氩电联焊
{
canSave = BLL.WelderQualifiedService.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 = BLL.WelderQualifiedService.IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
{
isok2 = BLL.WelderQualifiedService.IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (isok1 && isok2)
{
canSave = true;
}
}
else
{
canSave = BLL.WelderQualifiedService.TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
if (canWPS == false || canSave == false)
{
jot.IsSuperQueWelding = true;
Funs.DB.SubmitChanges();
}
}
}
protected void Session_Start(object sender, EventArgs e)
{

View File

@ -22,7 +22,7 @@
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownList ID="drpMaterialType" Label="<%$ Resources:Lan,SteelMaterialType %>"
<f:DropDownList ID="drpMaterialType" Label="<%$ Resources:Lan,MaterialSpecificationType %>"
runat="server" LabelAlign="right" LabelWidth="200px">
</f:DropDownList>
</Items>

View File

@ -33,6 +33,9 @@
<f:Button ID="btnExport" OnClick="btnExport_Click" runat="server" Text="导出" ToolTip="导出"
Icon="NoteGo" EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
<f:Button ID="btnExtract" Text="提取可焊焊工" Icon="ChartPie"
runat="server" OnClick="BtnExtract_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>

View File

@ -4,6 +4,7 @@ using System.Data.SqlClient;
using BLL;
using System.Data;
using System.Text;
using System.Linq;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.PublicInfo.WPQ
@ -330,6 +331,48 @@ namespace FineUIPro.Web.PublicInfo.WPQ
}
#endregion
#region
protected void BtnExtract_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
string wpsId = Grid1.SelectedRowID;
var wps=BLL.WPQListServiceService.GetWPQById(wpsId);
var welderList = from x in Funs.DB.Welder_ProjectWelder where x.ProjectId == this.CurrUser.LoginProjectId select x;
if (welderList.Count() > 0)
{
string testWelder = string.Empty;
// 焊工考试情况
foreach (var welder in welderList)
{
var welderTestList = from x in Funs.DB.Welder_TestInfo where x.WelderId == welder.WelderId select x;
if (welderTestList.Count() > 0)
{
foreach (var t in welderTestList)
{
if (wps.MaterialId1.Contains(t.MaterialId) && wps.WeldingMethodId != null && wps.WeldingMethodId.Contains(t.WeldMethodId) && t.IsPass == true)
{
testWelder += welder.WelderId+"|";
break;
}
}
}
}
if (testWelder != string.Empty)
{
testWelder = testWelder.Substring(0, testWelder.Length - 1);
wps.WelderIds = testWelder;
Funs.DB.SubmitChanges();
}
}
}
#endregion
#region

View File

@ -7,10 +7,12 @@
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web.PublicInfo.WPQ {
namespace FineUIPro.Web.PublicInfo.WPQ
{
public partial class WPQList {
public partial class WPQList
{
/// <summary>
/// form1 控件。
@ -102,6 +104,15 @@ namespace FineUIPro.Web.PublicInfo.WPQ {
/// </remarks>
protected global::FineUIPro.Button btnExport;
/// <summary>
/// btnExtract 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnExtract;
/// <summary>
/// lblNumber 控件。
/// </summary>

View File

@ -4,14 +4,16 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style>
.f-grid-row-summary .f-grid-cell-inner {
font-weight: bold;
color: red;
}
</style>
<title>超资质焊接预警</title>
<link href="../../res/css/common.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.f-grid-row.color1,
.f-grid-row.color1 .f-icon,
.f-grid-row.color1 a {
background-color: red;
color: #fff;
}
</style>
</head>
<body>
<form id="form1" runat="server">
@ -23,7 +25,7 @@
EnableCollapse="true" runat="server" BoxFlex="1" EnableColumnLines="true"
AllowSorting="true" SortField="PipelineCode,WeldJointCode" OnSort="Grid1_Sort"
AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange"
EnableTextSelection="True" EnableSummary="true" SummaryPosition="Flow">
EnableTextSelection="True" OnRowDataBound="Grid1_RowDataBound">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
@ -46,7 +48,7 @@
<f:Button ID="BtnAnalyse" Text="查询" Icon="ChartPie"
runat="server" OnClick="BtnAnalyse_Click">
</f:Button>
<f:Button ID="btnExtract" Text="提取数据" Icon="ChartPie"
<f:Button ID="btnExtract" Text="提取超焊信息" Icon="ChartPie"
runat="server" OnClick="BtnExtract_Click">
</f:Button>
</Items>
@ -71,6 +73,10 @@
DataField="WeldJointCode" SortField="WeldJointCode" FieldType="String" HeaderTextAlign="Center"
Width="120px">
</f:RenderField>
<f:RenderField HeaderText="WPS" ColumnID="WPQCode"
DataField="WPQCode" SortField="WPQCode" FieldType="String" HeaderTextAlign="Center"
Width="120px">
</f:RenderField>
<f:RenderField HeaderText="材质1" ColumnID="MaterialCode1"
DataField="MaterialCode1" SortField="MaterialCode1" FieldType="String"
HeaderTextAlign="Center" Width="150px">
@ -87,8 +93,8 @@
DataField="WeldingLocationCode" FieldType="String" HeaderTextAlign="Center"
Width="100px">
</f:RenderField>
<f:RenderField HeaderText="焊接方法<br>Weld Process" ColumnID="WeldingMethodName"
DataField="WeldingMethodName" SortField="WeldingMethodName" FieldType="String"
<f:RenderField HeaderText="焊接方法" ColumnID="WeldingMethodCode"
DataField="WeldingMethodCode" SortField="WeldingMethodCode" FieldType="String"
HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField HeaderText="寸径" ColumnID="Size" DataField="Size"
@ -105,7 +111,7 @@
DataField="CoverWelderCode" SortField="CoverWelderCode" FieldType="String"
HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField HeaderText="焊接日期<br>Welding Date" ColumnID="WeldingDate"
<f:RenderField HeaderText="焊接日期" ColumnID="WeldingDate"
DataField="WeldingDate" SortField="WeldingDate" FieldType="String" HeaderTextAlign="Center"
Width="170px">
</f:RenderField>

View File

@ -10,6 +10,7 @@ using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
using BorderStyle = NPOI.SS.UserModel.BorderStyle;
using System.Diagnostics;
namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
@ -38,13 +39,12 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
/// </summary>
private DataTable GetDataTable()
{
string strSql = @"SELECT weldJoint.WeldJointId,weldJoint.ProjectId,WorkArea.WorkAreaId,
string strSql = @"SELECT weldJoint.WeldJointId,weldJoint.ProjectId,WorkArea.WorkAreaId,wps.WPQCode,
WorkArea.WorkAreaCode,pipeline.SingleNumber,pipeline.PipelineCode,weldJoint.WeldJointCode,
weldType.WeldTypeCode,wl.WeldingLocationCode,weldJoint.Size,weldJoint.Thickness,
weldJoint.Specification,mat1.MaterialCode AS MaterialCode1,mat2.MaterialCode AS MaterialCode2,
WeldMethod.WeldingMethodName,cw.WelderCode AS CoverWelderCode,fw.WelderCode AS BackingWelderCode,
weldJoint.BackingWelderId,weldJoint.CoverWelderId,weldingDaily.WeldingDate,
weldJoint.IsSuperQueWelding
WeldMethod.WeldingMethodCode,cw.WelderCode AS CoverWelderCode,fw.WelderCode AS BackingWelderCode,
weldingDaily.WeldingDate, weldJoint.IsSuperQueWelding
FROM Pipeline_WeldJoint AS weldJoint
LEFT JOIN Pipeline_Pipeline AS pipeline ON pipeline.PipelineId = weldJoint.PipelineId
LEFT JOIN Project_WorkArea AS WorkArea ON WorkArea.WorkAreaId = pipeline.WorkAreaId
@ -54,8 +54,9 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
LEFT JOIN dbo.Base_WeldType weldType ON weldType.WeldTypeId = weldJoint.WeldTypeId
LEFT JOIN dbo.Base_WeldingLocation wl ON wl.WeldingLocationId = weldJoint.WeldingLocationId
LEFT JOIN Pipeline_WeldingDaily AS weldingDaily ON weldingDaily.WeldingDailyId = weldJoint.WeldingDailyId
left join Welder_Welder AS fw on weldJoint.BackingWelderId = fw.WelderId
left join Welder_Welder AS cw on weldJoint.CoverWelderId = cw.WelderId
LEFT JOIN Welder_Welder AS fw on weldJoint.BackingWelderId = fw.WelderId
LEFT JOIN Welder_Welder AS cw on weldJoint.CoverWelderId = cw.WelderId
LEFT JOIN dbo.WPQ_WPQList wps ON wps.WPQId = weldJoint.WPQId
WHERE weldJoint.WeldingDailyId IS NOT NULL AND weldJoint.ProjectId=@projectId";
List<SqlParameter> listStr = new List<SqlParameter>();
@ -98,13 +99,138 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
BindGrid();
}
protected void BtnExtract_Click(object sender, EventArgs e)
{
DataTable dt = GetDataTable();
bool canWPS = true;
var jotList = (from x in Funs.DB.Pipeline_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId && x.WeldingDailyId != null && x.WeldingMethodId != null select x).ToList();
foreach (var jot in jotList)
{
var wps = BLL.WPQListServiceService.GetWPQById(jot.WPQId);
string floorWelder = jot.BackingWelderId;
string cellWelder = jot.CoverWelderId;
if (wps != null)
{
// 验证焊工WPS资质
if (floorWelder == cellWelder)
{
if (!wps.WelderIds.Contains(floorWelder))
{
canWPS = false;
}
}
else
{
if (!wps.WelderIds.Contains(floorWelder))
{
canWPS = false;
}
if (!wps.WelderIds.Contains(cellWelder))
{
canWPS = false;
}
}
}
// 验证焊工合格项目资质
bool canSave = false;
var joty = BLL.Base_WeldTypeService.GetWeldTypeByWeldTypeId(jot.WeldTypeId);
var mat=BLL.Base_WeldingMethodService.GetWeldingMethodByWeldingMethodId(jot.WeldingMethodId);
var loc=BLL.Base_WeldingLocationServie.GetWeldingLocationById(jot.WeldingLocationId);
string weldTypeGroup = joty.Flag;
string weldTypeCode = joty.WeldTypeCode;
decimal? dia = jot.Dia;
decimal? sch = jot.Thickness;
string[] wmeCodes = mat.WeldingMethodCode.Split('+');
string location = loc.WeldingLocationCode;
string ste = jot.Material1Id;
List<Model.Welder_WelderQualify> 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<Model.Welder_WelderQualify> 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 = BLL.WelderQualifiedService.IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
else // 大于一种焊接方法,如氩电联焊
{
canSave = BLL.WelderQualifiedService.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 = BLL.WelderQualifiedService.IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (cellWelderQualifys != null && cellWelderQualifys.Count() > 0)
{
isok2 = BLL.WelderQualifiedService.IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (isok1 && isok2)
{
canSave = true;
}
}
else
{
canSave = BLL.WelderQualifiedService.TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
if (canWPS==false || canSave == false)
{
jot.IsSuperQueWelding = true;
Funs.DB.SubmitChanges();
}
}
ShowNotify("提取完成");
return;
}
#endregion
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
DataRowView row = e.DataItem as DataRowView;
if (row["IsSuperQueWelding"].ToString() != "")
{
Boolean isSup = Convert.ToBoolean(row["IsSuperQueWelding"]);
if (isSup==true)
{
e.RowCssClass = "color1";
}
}
}
#region
/// <summary>
/// 改变索引事件

View File

@ -1307,11 +1307,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
if (wmeCodes.Count() <= 1) // 一种焊接方法
{
canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
canSave = BLL.WelderQualifiedService.IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
else // 大于一种焊接方法,如氩电联焊
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
canSave = BLL.WelderQualifiedService.TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
}
@ -1325,11 +1325,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
{
isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
isok1 = BLL.WelderQualifiedService.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);
isok2 = BLL.WelderQualifiedService.IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (isok1 && isok2)
{
@ -1338,7 +1338,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
else
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
canSave = BLL.WelderQualifiedService.TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
@ -1650,201 +1650,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
#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.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;
}
/// <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.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
#region
/// <summary>
/// 关闭弹出窗口

View File

@ -471,11 +471,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
if (wmeCodes.Count() <= 1) // 一种焊接方法
{
canSave = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
canSave = BLL.WelderQualifiedService.IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
else // 大于一种焊接方法,如氩电联焊
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
canSave = BLL.WelderQualifiedService.TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
}
@ -489,11 +489,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
{
if (floorWelderQualifys != null && floorWelderQualifys.Count() > 0)
{
isok1 = IsOK(floorWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
isok1 = BLL.WelderQualifiedService.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);
isok2 = BLL.WelderQualifiedService.IsOK(cellWelderQualifys, wmeCodes[0], location, weldTypeGroup, ste, dia, sch);
}
if (isok1 && isok2)
{
@ -502,7 +502,7 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
else
{
canSave = TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
canSave = BLL.WelderQualifiedService.TwoWmeIsOK(floorWelderQualifys, cellWelderQualifys, wmeCodes[0], wmeCodes[1], location, weldTypeGroup, ste, dia, sch);
}
}
}
@ -1412,201 +1412,6 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
}
#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.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;
}
/// <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.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
#region
/// <summary>
/// 查找未焊接焊口