11
This commit is contained in:
@@ -33,9 +33,12 @@
|
||||
<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"
|
||||
<f:Button ID="btnExtract" Text="匹配可焊焊工" Icon="ChartPie"
|
||||
runat="server" OnClick="BtnExtract_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnBatchExtract" Text="批量匹配可焊焊工"
|
||||
runat="server" OnClick="BatchExtract_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
|
||||
@@ -342,7 +342,28 @@ namespace FineUIPro.Web.PublicInfo.WPQ
|
||||
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;
|
||||
|
||||
string materialStr = string.Empty;
|
||||
|
||||
if (wps.MaterialId1 != null)
|
||||
{
|
||||
string[] matList = wps.MaterialId1.Split('|');
|
||||
|
||||
foreach (var matId in matList)
|
||||
{
|
||||
var mat = from x in Funs.DB.Base_Material where x.MaterialId == matId select x;
|
||||
if (mat.Count() > 0 && !materialStr.Contains(mat.First().MaterialType))
|
||||
{
|
||||
materialStr += mat.First().MaterialType + ",";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (materialStr != null)
|
||||
{
|
||||
materialStr = materialStr.Substring(0, materialStr.Length - 1);
|
||||
}
|
||||
string[] wpsMaterial = materialStr.Split(',');
|
||||
|
||||
if (welderList.Count() > 0)
|
||||
{
|
||||
string testWelder = string.Empty;
|
||||
@@ -354,14 +375,81 @@ namespace FineUIPro.Web.PublicInfo.WPQ
|
||||
{
|
||||
foreach (var t in welderTestList)
|
||||
{
|
||||
if (wps.MaterialId1.Contains(t.MaterialId) && wps.WeldingMethodId != null && wps.WeldingMethodId.Contains(t.WeldMethodId) && t.IsPass == true)
|
||||
if (t.MaterialId != null && wps.WeldingMethodId != null)
|
||||
{
|
||||
testWelder += welder.WelderId+"|";
|
||||
break;
|
||||
string[] testMaterial = t.MaterialId.Split(',');
|
||||
if (wpsMaterial.All(x => testMaterial.Contains(x)) && 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();
|
||||
ShowNotify("该WPS的可焊焊工已匹配!", MessageBoxIcon.Success);
|
||||
BindGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowNotify("没有可匹配的焊工!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void BatchExtract_Click(object sender, EventArgs e)
|
||||
{
|
||||
var wpsList = from x in Funs.DB.WPQ_WPQList where x.ProjectId == CurrUser.LoginProjectId select x;
|
||||
var welderList = from x in Funs.DB.Welder_ProjectWelder where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
foreach (var wps in wpsList)
|
||||
{
|
||||
string testWelder = string.Empty;
|
||||
string materialStr = string.Empty;
|
||||
|
||||
if (wps.MaterialId1 != null)
|
||||
{
|
||||
string[] matList = wps.MaterialId1.Split('|');
|
||||
|
||||
foreach (var matId in matList)
|
||||
{
|
||||
var mat = from x in Funs.DB.Base_Material where x.MaterialId == matId select x;
|
||||
if (mat.Count() > 0 && !materialStr.Contains(mat.First().MaterialType))
|
||||
{
|
||||
materialStr += mat.First().MaterialType + ",";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (materialStr != null)
|
||||
{
|
||||
materialStr = materialStr.Substring(0, materialStr.Length - 1);
|
||||
}
|
||||
string[] wpsMaterial = materialStr.Split(',');
|
||||
|
||||
// 焊工考试情况
|
||||
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 (t.MaterialId != null && wps.WeldingMethodId != null)
|
||||
{
|
||||
string[] testMaterial = t.MaterialId.Split(',');
|
||||
if (wpsMaterial.All(x => testMaterial.Contains(x)) && wps.WeldingMethodId.Contains(t.WeldMethodId) && t.IsPass == true)
|
||||
{
|
||||
testWelder += welder.WelderId + "|";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (testWelder != string.Empty)
|
||||
{
|
||||
@@ -370,6 +458,9 @@ namespace FineUIPro.Web.PublicInfo.WPQ
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
BindGrid();
|
||||
ShowNotify("所有WPS可焊焊工已匹配!", MessageBoxIcon.Success);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -113,6 +113,15 @@ namespace FineUIPro.Web.PublicInfo.WPQ
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnExtract;
|
||||
|
||||
/// <summary>
|
||||
/// btnBatchExtract 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnBatchExtract;
|
||||
|
||||
/// <summary>
|
||||
/// lblNumber 控件。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user