diff --git a/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user b/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user index fe476a8..be04f2f 100644 --- a/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user +++ b/HJGL/FineUIPro.Web/FineUIPro.Web.csproj.user @@ -2,7 +2,7 @@ ProjectFiles - Release|Any CPU + Debug|Any CPU true diff --git a/HJGL/FineUIPro.Web/Global.asax.cs b/HJGL/FineUIPro.Web/Global.asax.cs index 618cce5..3187516 100644 --- a/HJGL/FineUIPro.Web/Global.asax.cs +++ b/HJGL/FineUIPro.Web/Global.asax.cs @@ -14,6 +14,7 @@ using System.Data; using System.Data.SqlClient; using BLL; + using FineUIPro.Web.WeldingProcess.WeldingManage; public class Global : System.Web.HttpApplication { @@ -44,11 +45,146 @@ AppDomain.Unload(AppDomain.CurrentDomain); } + // 开启超焊信息提取 + System.Threading.Thread LoadServiceSuperQue = new System.Threading.Thread(new System.Threading.ThreadStart(SuperQueWelding)); + LoadServiceSuperQue.Start(); + // 开启线程 System.Threading.Thread LoadServiceData = new System.Threading.Thread(new System.Threading.ThreadStart(ExpirePoint)); LoadServiceData.Start(); } + + 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) + { + 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; + + bool canWPS = true; + 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 = string.Empty; + if (loc != null) + { + 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; + } + else + { + jot.IsSuperQueWelding = null; + } + } + Funs.DB.SubmitChanges(); + } + + private void ExpirePoint() { //定义一个定时器,并开启和配置相关属性 diff --git a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/MaterialCoode.aspx.cs b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/MaterialCoode.aspx.cs index 586a519..62a8567 100644 --- a/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/MaterialCoode.aspx.cs +++ b/HJGL/FineUIPro.Web/WeldingProcess/WeldingManage/MaterialCoode.aspx.cs @@ -368,12 +368,20 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage coodeList.Add(d); } - var coodeGroup = coodeList.GroupBy(x => new { x.Coode, x.HeartNo }).Select(g => new { Coode = g.Key.Coode, HeartNo = g.Key.HeartNo }); - if (coodeList.Count() != coodeGroup.Count()) - { - errorInfos += "Coode对应的炉批号有重复!"; + var coodeGroup = coodeList.GroupBy(x => new { x.Coode, x.HeartNo }).Select(g => new { Coode = g.Key.Coode, HeartNo = g.Key.HeartNo }).Distinct(); + foreach (var c in coodeGroup) + { + var coodeNum=from x in coodeList where x.Coode==c.Coode && x.HeartNo==c.HeartNo select x; + if (coodeNum.Count() > 1) + { + errorInfos += "coode码:"+c.Coode+"炉批号:"+c.HeartNo+"有重复!"; + } } - + + //if (coodeList.Count() != coodeGroup.Count()) + //{ + // errorInfos += "Coode对应的炉批号有重复!"; + //} // 数据验证错误,返回 if (!string.IsNullOrEmpty(errorInfos)) diff --git a/HJGL/WebApi/WebApi.csproj.user b/HJGL/WebApi/WebApi.csproj.user index 33091aa..6db81e9 100644 --- a/HJGL/WebApi/WebApi.csproj.user +++ b/HJGL/WebApi/WebApi.csproj.user @@ -8,7 +8,7 @@ - Release|Any CPU + Debug|Any CPU FolderProfile