This commit is contained in:
佘春生 2024-07-03 11:17:42 +08:00
parent 3b3f1934f2
commit 32d04f78d9
4 changed files with 151 additions and 7 deletions

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />

View File

@ -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<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;
}
else
{
jot.IsSuperQueWelding = null;
}
}
Funs.DB.SubmitChanges();
}
private void ExpirePoint()
{
//定义一个定时器,并开启和配置相关属性

View File

@ -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))

View File

@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
</PropertyGroup>
<ProjectExtensions>