111
This commit is contained in:
@@ -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>
|
||||
/// 改变索引事件
|
||||
|
||||
Reference in New Issue
Block a user