diff --git a/HJGL/.vs/HJGL/v17/.suo b/HJGL/.vs/HJGL/v17/.suo index f4eb68f..1a22606 100644 Binary files a/HJGL/.vs/HJGL/v17/.suo and b/HJGL/.vs/HJGL/v17/.suo differ diff --git a/HJGL/BLL/WelderManage/WelderQualifiedService.cs b/HJGL/BLL/WelderManage/WelderQualifiedService.cs index e2f6e45..87bc350 100644 --- a/HJGL/BLL/WelderManage/WelderQualifiedService.cs +++ b/HJGL/BLL/WelderManage/WelderQualifiedService.cs @@ -117,5 +117,201 @@ namespace BLL db.SubmitChanges(); } } + + #region 资质分析 + public static 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; + } + + /// + /// 两种焊接方法的资质判断 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static 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 + } } diff --git a/HJGL/FineUIPro.Web/Global.asax.cs b/HJGL/FineUIPro.Web/Global.asax.cs index a99c92b..4e22262 100644 --- a/HJGL/FineUIPro.Web/Global.asax.cs +++ b/HJGL/FineUIPro.Web/Global.asax.cs @@ -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() @@ -146,8 +148,128 @@ } } - - + + 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 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 = 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) { Session.Timeout = 36000; diff --git a/HJGL/FineUIPro.Web/PublicInfo/BaseInfo/MaterialEdit.aspx b/HJGL/FineUIPro.Web/PublicInfo/BaseInfo/MaterialEdit.aspx index 0b3c521..9a97264 100644 --- a/HJGL/FineUIPro.Web/PublicInfo/BaseInfo/MaterialEdit.aspx +++ b/HJGL/FineUIPro.Web/PublicInfo/BaseInfo/MaterialEdit.aspx @@ -22,7 +22,7 @@ - diff --git a/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx b/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx index f28741e..b38e1dc 100644 --- a/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx +++ b/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx @@ -33,6 +33,9 @@ + + diff --git a/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.cs b/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.cs index de9508f..ff1df69 100644 --- a/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.cs +++ b/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.cs @@ -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 格式化字符串 diff --git a/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.designer.cs b/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.designer.cs index 6a7eba5..2085aec 100644 --- a/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.designer.cs +++ b/HJGL/FineUIPro.Web/PublicInfo/WPQ/WPQList.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.PublicInfo.WPQ { - - - public partial class WPQList { - +namespace FineUIPro.Web.PublicInfo.WPQ +{ + + + public partial class WPQList + { + /// /// form1 控件。 /// @@ -20,7 +22,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -29,7 +31,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// Panel1 控件。 /// @@ -38,7 +40,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Panel Panel1; - + /// /// Grid1 控件。 /// @@ -47,7 +49,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid Grid1; - + /// /// Toolbar2 控件。 /// @@ -56,7 +58,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar2; - + /// /// txtWeldingProcedureCode 控件。 /// @@ -65,7 +67,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.TextBox txtWeldingProcedureCode; - + /// /// ToolbarFill1 控件。 /// @@ -74,7 +76,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnNew 控件。 /// @@ -83,7 +85,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnNew; - + /// /// btnImport 控件。 /// @@ -92,7 +94,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnImport; - + /// /// btnExport 控件。 /// @@ -101,7 +103,16 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnExport; - + + /// + /// btnExtract 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnExtract; + /// /// lblNumber 控件。 /// @@ -110,7 +121,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label lblNumber; - + /// /// Label1 控件。 /// @@ -119,7 +130,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label Label1; - + /// /// Label2 控件。 /// @@ -128,7 +139,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label Label2; - + /// /// Label3 控件。 /// @@ -137,7 +148,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label Label3; - + /// /// lbWelderName 控件。 /// @@ -146,7 +157,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label lbWelderName; - + /// /// ToolbarSeparator1 控件。 /// @@ -155,7 +166,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; - + /// /// ToolbarText1 控件。 /// @@ -164,7 +175,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarText ToolbarText1; - + /// /// ddlPageSize 控件。 /// @@ -173,7 +184,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList ddlPageSize; - + /// /// Window1 控件。 /// @@ -182,7 +193,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window1; - + /// /// Window2 控件。 /// @@ -191,7 +202,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window2; - + /// /// Menu1 控件。 /// @@ -200,7 +211,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Menu Menu1; - + /// /// btnMenuEdit 控件。 /// @@ -209,7 +220,7 @@ namespace FineUIPro.Web.PublicInfo.WPQ { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.MenuButton btnMenuEdit; - + /// /// btnMenuDelete 控件。 /// diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx index 41e2dc5..bdd1972 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx @@ -4,14 +4,16 @@ - 超资质焊接预警 +
@@ -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"> @@ -46,7 +48,7 @@ - @@ -71,6 +73,10 @@ DataField="WeldJointCode" SortField="WeldJointCode" FieldType="String" HeaderTextAlign="Center" Width="120px"> + + @@ -87,8 +93,8 @@ DataField="WeldingLocationCode" FieldType="String" HeaderTextAlign="Center" Width="100px"> - - diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs index cab0877..1270f6c 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/SuperQueWelding.aspx.cs @@ -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 /// 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 listStr = new List(); @@ -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 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 = 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 /// /// 改变索引事件 diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs index cf77ec9..b0f1878 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReport.aspx.cs @@ -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 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 - #region 关闭弹出窗口及刷新页面 /// /// 关闭弹出窗口 diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs index 79c24c6..a5bc38c 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/WeldReportEdit.aspx.cs @@ -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 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 - #region 查找 /// /// 查找未焊接焊口