提交代码

This commit is contained in:
2023-12-20 15:48:05 +08:00
parent 2516cfbe69
commit f49eba5e5f
58 changed files with 8868 additions and 1411 deletions
@@ -85,7 +85,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
newNode.Text = itemWork.Key.WorkPackName;
newNode.NodeID = itemWork.Key.WorkPackId + "|" + itemTwo.Key.PreRunId;
newNode.ToolTip = itemWork.Key.WorkPackName;
newNode.CommandName = "dianji";
newNode.CommandName = "";
newNode.Expanded = true;
newNode.EnableClickEvent = true;
newNode.EnableExpandEvent = true;
@@ -159,28 +159,29 @@ namespace FineUIPro.Web.TestRun.TestRunManage
var result = new List<TestRun_SubInspectTermItemData>();
if (ulist != null)
{
var groups = ulist.GroupBy(x => new { x.GroupId, x.GroupName, x.GroupSort }).OrderBy(a => a.Key.GroupSort);
#region
var groups = ulist.GroupBy(x => x.GroupName);
int gnum = 1;
foreach (var itemGroup in groups)
{
//添加一级节点
var firstModel = new TestRun_SubInspectTermItemData();
firstModel.TermItemId = itemGroup.Key.GroupId;
firstModel.GroupId = itemGroup.Key.GroupId;
firstModel.GroupName = itemGroup.Key.GroupName;
firstModel.Sort = itemGroup.Key.GroupSort;
firstModel.GroupSort = itemGroup.Key.GroupSort;
firstModel.TermItemId = itemGroup.Key;
firstModel.GroupName = itemGroup.Key;
firstModel.Sort = gnum;
firstModel.GroupSort = gnum;
firstModel.Level = 1;
result.Add(firstModel);
gnum++;
//获取此分组的检查项
var groupTermItems = ulist.Where(x => x.GroupId == itemGroup.Key.GroupId);
var groupTermItems = ulist.Where(x => x.GroupName == itemGroup.Key);
foreach (var itemTerm in groupTermItems)
{
var model = new TestRun_SubInspectTermItemData();
model.TermItemId = itemTerm.TermItemId;
model.ParentId = itemGroup.Key.GroupId;
model.ParentId = itemGroup.Key;
model.ProjectId = this.CurrUser.LoginProjectId;
model.WorkPackId = itemTerm.WorkPackId;
model.WorkInspectId = itemTerm.WorkInspectId;
@@ -192,7 +193,6 @@ namespace FineUIPro.Web.TestRun.TestRunManage
model.AllUserInspectionPass = itemTerm.AllUserInspectionPass;
model.UserInspectionResults = itemTerm.UserInspectionResults;
model.InspectionIllustrate = itemTerm.InspectionIllustrate;
model.GroupId = itemTerm.GroupId;
model.GroupName = itemTerm.GroupName;
model.Sort = itemTerm.Sort;
model.GroupSort = itemTerm.GroupSort;
@@ -200,6 +200,8 @@ namespace FineUIPro.Web.TestRun.TestRunManage
result.Add(model);
}
}
#endregion
}
else
{
@@ -207,53 +209,52 @@ namespace FineUIPro.Web.TestRun.TestRunManage
var systemId = this.tvControlItem.SelectedNodeID.Split('|')[1];
var subSysModel = Funs.DB.PreRun_SysDevice.FirstOrDefault(x => x.PreRunId == systemId);
var list = from a in Funs.DB.TestRun_SubInspectTermItem
join b in Funs.DB.TestRun_TemplateItemGroup on a.GroupId equals b.GroupId
where a.SystemId == systemId && a.WorkPackId == workPackId
orderby a.Sort ascending
select new { a, b };
select a;
if (list.Count() > 0)
{
var itemids = list.Select(p => p.a.TermItemId);
var itemids = list.Select(p => p.TermItemId);
var termitemusers = from a in Funs.DB.TestRun_TermItemInspectedUser
join b in Funs.DB.Sys_User on a.InspectedUser equals b.UserId
where itemids.Contains(a.TermItemId)
select new { a.TermItemId, a.InspectedUser, a.InspectionIllustrate, InspectionResultsName = a.InspectionResults == 1 ? "通过" : "未通过", b.UserName };
var groups = list.GroupBy(x => new { x.b.GroupId, x.b.GroupName, x.b.Sort }).OrderBy(a => a.Key.Sort);
var groups = list.GroupBy(x => new { x.GroupName });
int firstnum = 1;
foreach (var itemGroup in groups)
{
//添加一级节点
var firstModel = new TestRun_SubInspectTermItemData();
firstModel.TermItemId = itemGroup.Key.GroupId;
firstModel.GroupId = itemGroup.Key.GroupId;
firstModel.TermItemId = itemGroup.Key.GroupName;
firstModel.GroupName = itemGroup.Key.GroupName;
firstModel.Sort = itemGroup.Key.Sort.Value;
firstModel.GroupSort = itemGroup.Key.Sort.Value;
firstModel.Sort = firstnum;
firstModel.GroupSort = firstnum;
firstModel.Level = 1;
result.Add(firstModel);
firstnum++;
//获取此分组的检查项
var groupTermItems = list.Where(x => x.b.GroupId == itemGroup.Key.GroupId);
var groupTermItems = list.Where(x => x.GroupName == itemGroup.Key.GroupName);
foreach (var itemTerm in groupTermItems)
{
var model = new TestRun_SubInspectTermItemData();
model.TermItemId = itemTerm.a.TermItemId;
model.ParentId = itemGroup.Key.GroupId;
model.ProjectId = itemTerm.a.ProjectId;
model.WorkPackId = itemTerm.a.WorkPackId;
model.WorkInspectId = itemTerm.a.WorkInspectId;
model.WorkInspectName = itemTerm.a.WorkInspectName;
model.TermItemId = itemTerm.TermItemId;
model.ParentId = itemGroup.Key.GroupName;
model.ProjectId = itemTerm.ProjectId;
model.WorkPackId = itemTerm.WorkPackId;
model.WorkInspectId = itemTerm.WorkInspectId;
model.WorkInspectName = itemTerm.WorkInspectName;
model.InstallationId = subSysModel.InstallationId;
model.ProcessesId = subSysModel.ProcessesId;
model.SystemId = subSysModel.SystemId;
model.InspectedUser = itemTerm.a.InspectedUser;
model.AllUserInspectionPass = itemTerm.a.AllUserInspectionPass;
model.GroupId = itemTerm.a.GroupId;
model.GroupName = itemTerm.b.GroupName;
model.Sort = itemTerm.a.Sort.Value;
model.GroupSort = itemTerm.b.Sort.Value;
if (termitemusers.Count(a => a.TermItemId == itemTerm.a.TermItemId) > 0)
model.InspectedUser = itemTerm.InspectedUser;
model.AllUserInspectionPass = itemTerm.AllUserInspectionPass;
model.GroupName = itemTerm.GroupName;
model.Sort = itemTerm.Sort.Value;
model.GroupSort = itemTerm.Sort.Value;
if (termitemusers.Count(a => a.TermItemId == itemTerm.TermItemId) > 0)
{
foreach (var itemU in termitemusers.Where(a => a.TermItemId == itemTerm.a.TermItemId))
foreach (var itemU in termitemusers.Where(a => a.TermItemId == itemTerm.TermItemId))
{
model.UserInspectionResults += string.IsNullOrWhiteSpace(model.UserInspectionResults) ? $"{itemU.UserName}{itemU.InspectionResultsName}" : "</br>" + $"{itemU.UserName}{itemU.InspectionResultsName}";
if (!string.IsNullOrWhiteSpace(itemU.InspectionIllustrate))
@@ -268,10 +269,10 @@ namespace FineUIPro.Web.TestRun.TestRunManage
}
var itemModel = list.FirstOrDefault();
ddlfbs.SelectedValue = itemModel.a.Subcontractor;
ddlcbs.SelectedValue = itemModel.a.Contractor;
ddljl.SelectedValue = itemModel.a.Supervision;
ddlyz.SelectedValue = itemModel.a.Owner;
ddlfbs.SelectedValue = itemModel.Subcontractor;
ddlcbs.SelectedValue = itemModel.Contractor;
ddljl.SelectedValue = itemModel.Supervision;
ddlyz.SelectedValue = itemModel.Owner;
}
else
{
@@ -280,42 +281,40 @@ namespace FineUIPro.Web.TestRun.TestRunManage
ddljl.SelectedValue = "";
ddlyz.SelectedValue = "";
var defaultDatas = from a in Funs.DB.TestRun_WorkInspectTemplate
join b in Funs.DB.TestRun_TemplateItemGroup on a.GroupId equals b.GroupId
where a.WorkPackId == workPackId
select new { a, b };
select a;
if (defaultDatas.Count() > 0)
{
var groups = defaultDatas.GroupBy(x => new { x.b.GroupId, x.b.GroupName, x.b.Sort }).OrderBy(a => a.Key.Sort);
var groups = defaultDatas.GroupBy(x => new { x.GroupName});
int firstnum = 1;
foreach (var itemGroup in groups)
{
//添加一级节点
var firstModel = new TestRun_SubInspectTermItemData();
firstModel.TermItemId = itemGroup.Key.GroupId;
firstModel.GroupId = itemGroup.Key.GroupId;
firstModel.TermItemId = itemGroup.Key.GroupName;
firstModel.GroupName = itemGroup.Key.GroupName;
firstModel.Sort = itemGroup.Key.Sort.Value;
firstModel.GroupSort = itemGroup.Key.Sort.Value;
firstModel.Sort = firstnum;
firstModel.GroupSort = firstnum;
firstModel.Level = 1;
result.Add(firstModel);
firstnum++;
//获取此分组的检查项
var groupTermItems = defaultDatas.Where(x => x.b.GroupId == itemGroup.Key.GroupId);
var groupTermItems = defaultDatas.Where(x => x.GroupName == itemGroup.Key.GroupName);
foreach (var itemTerm in groupTermItems)
{
var model = new TestRun_SubInspectTermItemData();
model.TermItemId = Guid.NewGuid().ToString();
model.ParentId = itemGroup.Key.GroupId;
model.ParentId = itemGroup.Key.GroupName;
model.ProjectId = this.CurrUser.LoginProjectId;
model.WorkPackId = itemTerm.a.WorkPackId;
model.WorkInspectId = itemTerm.a.WorkInspectId;
model.WorkInspectName = itemTerm.a.WorkInspectName;
model.WorkPackId = itemTerm.WorkPackId;
model.WorkInspectId = itemTerm.WorkInspectId;
model.WorkInspectName = itemTerm.WorkInspectName;
model.InstallationId = subSysModel.InstallationId;
model.ProcessesId = subSysModel.ProcessesId;
model.SystemId = subSysModel.SystemId;
model.GroupId = itemTerm.a.GroupId;
model.GroupName = itemTerm.b.GroupName;
model.Sort = itemTerm.a.Sort.Value;
model.GroupSort = itemTerm.b.Sort.Value;
model.GroupName = itemTerm.GroupName;
model.Sort = itemTerm.Sort.Value;
model.GroupSort = itemTerm.Sort.Value;
model.Level = 2;
result.Add(model);
}
@@ -351,11 +350,11 @@ namespace FineUIPro.Web.TestRun.TestRunManage
if (e.CommandName == "Delete")
{
string rowID = e.RowID;
var groupId = this.Grid1.Rows[e.RowIndex].DataKeys[7].ToString();
var level = int.Parse(this.Grid1.Rows[e.RowIndex].DataKeys[9].ToString());
var level = int.Parse(this.Grid1.Rows[e.RowIndex].DataKeys[8].ToString());
if (level == 1)
{
var deletelist = Funs.DB.TestRun_SubInspectTermItem.Where(p => p.GroupId == groupId);
var groupName = this.Grid1.Rows[e.RowIndex].DataKeys[7].ToString();
var deletelist = Funs.DB.TestRun_SubInspectTermItem.Where(p => p.GroupName == groupName);
if (deletelist.Count() > 0)
{
Funs.DB.TestRun_SubInspectTermItem.DeleteAllOnSubmit(deletelist);
@@ -367,7 +366,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
{
var list = gvList();
list.RemoveAll(x => x.GroupId == groupId);
list.RemoveAll(x => x.GroupName == groupName);
Grid1.DataSource = list;
Grid1.DataBind();
ShowNotify("删除成功!");
@@ -450,8 +449,8 @@ namespace FineUIPro.Web.TestRun.TestRunManage
int i = mergedRow.Value<int>("index");
var termItemId = this.Grid1.Rows[i].DataKeys[0].ToString();
var workInspectId = this.Grid1.Rows[i].DataKeys[1] != null ? this.Grid1.Rows[i].DataKeys[1].ToString() : string.Empty;
var groupId = this.Grid1.Rows[i].DataKeys[7].ToString();
var level = this.Grid1.Rows[i].DataKeys[9].ToString();
var groupName = this.Grid1.Rows[i].DataKeys[7].ToString();
var level = this.Grid1.Rows[i].DataKeys[8].ToString();
if (level == "1") continue;
//获取系统信息
@@ -500,7 +499,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
model.ProcessesId = sysModel.ProcessesId;
model.SystemId = sysModel.PreRunId;
model.InspectedUser = values.Value<string>("InspectedUser");
model.GroupId = groupId;
model.GroupName = groupName;
model.Subcontractor = ddlfbs.SelectedValue;
model.Contractor = ddlcbs.SelectedValue;
model.Supervision = ddljl.SelectedValue;
@@ -513,7 +512,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
}
else
{
model.GroupId = groupId;
model.GroupName = groupName;
model.InspectedUser = !string.IsNullOrWhiteSpace(values.Value<string>("InspectedUser")) ? values.Value<string>("InspectedUser") : string.Empty;
model.WorkInspectName = values.Value<string>("WorkInspectName");
//删除检查项检查人表
@@ -534,7 +533,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
userModel.TermItemId = termItemId;
userModel.SubInspectId = subTrem.SubInspectId;
userModel.WorkPackId = workPackId;
userModel.GroupId = groupId;
userModel.GroupName = groupName;
userModel.ProjectId = this.CurrUser.LoginProjectId;
userModel.InspectedUser = itemUser;
userModel.AddUser = this.CurrUser.UserId;
@@ -592,7 +591,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
Alert.ShowInTop("只可选择一条记录!", MessageBoxIcon.Warning);
return;
}
var level = int.Parse(this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[9].ToString());
var level = int.Parse(this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[8].ToString());
if (level == 1)
{
Alert.ShowInTop("一级节点无法修改!", MessageBoxIcon.Warning);
@@ -601,10 +600,10 @@ namespace FineUIPro.Web.TestRun.TestRunManage
var workPackId = this.tvControlItem.SelectedNodeID.Split('|')[0];
var systemId = this.tvControlItem.SelectedNodeID.Split('|')[1];
var workInspectId = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[1] != null ? this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[1].ToString() : string.Empty;
var groupId = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[7] != null ? this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[7].ToString() : string.Empty;
var workInspectName = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[11] != null ? this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[11].ToString() : string.Empty;
var groupName = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[7] != null ? this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[7].ToString() : string.Empty;
var workInspectName = this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[10] != null ? this.Grid1.Rows[Grid1.SelectedRowIndex].DataKeys[10].ToString() : string.Empty;
this.hidRequestNodeID.Text = string.Empty;
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hidRequestNodeID.ClientID) + Window1.GetShowReference($"SubInspectTermEdit.aspx?TermItemId={Grid1.SelectedRowID}&WorkInspectId={workInspectId}&WorkPackId={workPackId}&SystemId={systemId}&GroupId={groupId}&WorkInspectName={workInspectName}", "编辑"));
PageContext.RegisterStartupScript(Window1.GetSaveStateReference(hidRequestNodeID.ClientID) + Window1.GetShowReference($"SubInspectTermEdit.aspx?TermItemId={Grid1.SelectedRowID}&WorkInspectId={workInspectId}&WorkPackId={workPackId}&SystemId={systemId}&GroupName={groupName}&WorkInspectName={workInspectName}", "编辑"));
}
/// <summary>
@@ -642,13 +641,12 @@ namespace FineUIPro.Web.TestRun.TestRunManage
var installationId = this.Grid1.Rows[i].DataKeys[4] != null ? this.Grid1.Rows[i].DataKeys[4].ToString() : string.Empty;
var processesId = this.Grid1.Rows[i].DataKeys[5] != null ? this.Grid1.Rows[i].DataKeys[5].ToString() : string.Empty;
var systemId = this.Grid1.Rows[i].DataKeys[6] != null ? this.Grid1.Rows[i].DataKeys[6].ToString() : string.Empty;
var groupId = this.Grid1.Rows[i].DataKeys[7] != null ? this.Grid1.Rows[i].DataKeys[7].ToString() : string.Empty;
var groupName = this.Grid1.Rows[i].DataKeys[8] != null ? this.Grid1.Rows[i].DataKeys[8].ToString() : string.Empty;
var level = this.Grid1.Rows[i].DataKeys[9] != null ? this.Grid1.Rows[i].DataKeys[9].ToString() : string.Empty;
var parentId = this.Grid1.Rows[i].DataKeys[10] != null ? this.Grid1.Rows[i].DataKeys[10].ToString() : string.Empty;
var groupSort = this.Grid1.Rows[i].DataKeys[12] != null ? this.Grid1.Rows[i].DataKeys[12].ToString() : string.Empty;
var userInspectionResults = this.Grid1.Rows[i].DataKeys[13] != null ? this.Grid1.Rows[i].DataKeys[13].ToString() : string.Empty;
var inspectionIllustrate = this.Grid1.Rows[i].DataKeys[14] != null ? this.Grid1.Rows[i].DataKeys[14].ToString() : string.Empty;
var groupName = this.Grid1.Rows[i].DataKeys[7] != null ? this.Grid1.Rows[i].DataKeys[7].ToString() : string.Empty;
var level = this.Grid1.Rows[i].DataKeys[8] != null ? this.Grid1.Rows[i].DataKeys[8].ToString() : string.Empty;
var parentId = this.Grid1.Rows[i].DataKeys[9] != null ? this.Grid1.Rows[i].DataKeys[9].ToString() : string.Empty;
var groupSort = this.Grid1.Rows[i].DataKeys[11] != null ? this.Grid1.Rows[i].DataKeys[11].ToString() : string.Empty;
var userInspectionResults = this.Grid1.Rows[i].DataKeys[12] != null ? this.Grid1.Rows[i].DataKeys[12].ToString() : string.Empty;
var inspectionIllustrate = this.Grid1.Rows[i].DataKeys[13] != null ? this.Grid1.Rows[i].DataKeys[13].ToString() : string.Empty;
var model = new TestRun_SubInspectTermItemData();
model.TermItemId = termItemId;
model.SubInspectId = subInspectId;
@@ -659,7 +657,6 @@ namespace FineUIPro.Web.TestRun.TestRunManage
model.InstallationId = installationId;
model.ProcessesId = processesId;
model.SystemId = systemId;
model.GroupId = groupId;
model.GroupName = groupName;
model.GroupSort = !string.IsNullOrWhiteSpace(groupSort) ? int.Parse(groupSort) : 0;
model.Level = int.Parse(level);
@@ -709,10 +706,6 @@ namespace FineUIPro.Web.TestRun.TestRunManage
/// </summary>
public string ParentId { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string GroupName { get; set; }
/// <summary>
/// 分组排序
/// </summary>
public int GroupSort { get; set; }
@@ -738,17 +731,16 @@ namespace FineUIPro.Web.TestRun.TestRunManage
if (!string.IsNullOrWhiteSpace(hidRequestNodeID.Text))
{
var list = gvList();
string termItemId = hidRequestNodeID.Text.Split('|')[0];
string workPackId = hidRequestNodeID.Text.Split('|')[1];
string systemId = hidRequestNodeID.Text.Split('|')[2];
string workInspectName = hidRequestNodeID.Text.Split('|')[3];
string groupId = hidRequestNodeID.Text.Split('|')[4];
string groupName = hidRequestNodeID.Text.Split('|')[5];
int groupSort = int.Parse(hidRequestNodeID.Text.Split('|')[6]);
string groupName = hidRequestNodeID.Text.Split('|')[4];
var subSysModel = Funs.DB.PreRun_SysDevice.FirstOrDefault(x => x.PreRunId == systemId);
var model = new TestRun_SubInspectTermItemData();
model.TermItemId = Guid.NewGuid().ToString();
model.ParentId = groupId;
model.ParentId = groupName;
model.ProjectId = this.CurrUser.LoginProjectId;
model.WorkPackId = workPackId;
model.WorkInspectId = string.Empty;
@@ -756,9 +748,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
model.InstallationId = subSysModel.InstallationId;
model.ProcessesId = subSysModel.ProcessesId;
model.SystemId = systemId;
model.GroupId = groupId;
model.GroupName = groupName;
model.GroupSort = groupSort;
model.Sort = list.Count + 1;
model.Level = 2;
list.Add(model);
@@ -773,7 +763,7 @@ namespace FineUIPro.Web.TestRun.TestRunManage
/// </summary>
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
var level = int.Parse(this.Grid1.Rows[e.RowIndex].DataKeys[9].ToString());
var level = int.Parse(this.Grid1.Rows[e.RowIndex].DataKeys[8].ToString());
RenderField InspectedUser = Grid1.FindColumn("InspectedUser") as RenderField;
if (level == 1)
{