Compare commits
3 Commits
e79d7d1bf1
...
d1a6bb49da
Author | SHA1 | Date |
---|---|---|
|
d1a6bb49da | |
|
9b5124c4e2 | |
|
b3c86d48a5 |
|
@ -1,7 +1,10 @@
|
|||
delete Sys_Menu where MenuId='17E206A1-E06B-40C0-8DCB-E3AAA2E3B339'
|
||||
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Icon,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)VALUES('17E206A1-E06B-40C0-8DCB-E3AAA2E3B339','单位分部分项工程(新)',null,'CQMS/WBS/Control/DivisionSubProjects.aspx',1,'3B322232-38A1-4291-9832-CD4A01C2A975','Menu_CQMS',0,1,1)
|
||||
--cd C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools
|
||||
--SqlMetal /views /server:小帆科技 /database:SGGLDB_WH /code:C:\Model.cs /namespace:Model
|
||||
|
||||
--==WBS单位分部分项工程划分
|
||||
delete Sys_Menu where MenuId='17E206A1-E06B-40C0-8DCB-E3AAA2E3B339'
|
||||
INSERT INTO dbo.Sys_Menu(MenuId,MenuName,Icon,Url,SortIndex,SuperMenu,MenuType,IsOffice,IsEnd,IsUsed)VALUES('17E206A1-E06B-40C0-8DCB-E3AAA2E3B339','分部分项工程(新)',null,'CQMS/WBS/Control/DivisionSubProjects.aspx',1,'3B322232-38A1-4291-9832-CD4A01C2A975','Menu_CQMS',0,1,1)
|
||||
|
||||
--==WBS分部分项工程划分
|
||||
if object_id(N'Division_SubProjects',N'U') is not null
|
||||
drop table dbo.Division_SubProjects
|
||||
CREATE TABLE dbo.Division_SubProjects(
|
||||
|
@ -9,20 +12,17 @@ CREATE TABLE dbo.Division_SubProjects(
|
|||
ProjectId varchar(50) NULL,--项目主键
|
||||
ParentId varchar (50) NULL,--上级主键
|
||||
DivisionLevel int NULL,--级别
|
||||
EngineeringCode varchar(50) NULL,--单位工程编码
|
||||
EngineeringName varchar(50) NULL,--单位工程名称
|
||||
SubEngineeringCode varchar(50) NULL,--子单位工程编码
|
||||
SubEngineeringName varchar(50) NULL,--子单位工程名称
|
||||
BranchEngineeringCode varchar(50) NULL,--分部工程编号
|
||||
BranchEngineeringName varchar(50) NULL,--分部工程名称
|
||||
SubBranchEngineeringName varchar(50) NULL,--子分部工程名称
|
||||
BranchEngineeringName varchar(1000) NULL,--分部工程名称
|
||||
SubBranchEngineeringName varchar(1000) NULL,--子分部工程名称
|
||||
ProEngineeringCode varchar(50) NULL,--分项工程编号
|
||||
ProEngineeringName varchar(50) NULL,--分项工程名称
|
||||
ProEngineeringName varchar(1000) NULL,--分项工程名称
|
||||
ProEngineeringNum varchar(50) NULL,--分部分项码
|
||||
Remark nvarchar(150) NULL,--备注
|
||||
Remark varchar(500) NULL,--备注
|
||||
Status int NULL,--类型0:内置数据1:项目数据
|
||||
AddUser varchar(50) NULL,--添加人
|
||||
OperateTime datetime NULL,--操作日期
|
||||
Sort int NULL,--排序
|
||||
Sort int NULL--排序
|
||||
CONSTRAINT [PK_Division_SubProjects] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[DivisionId] ASC
|
||||
|
|
|
@ -6,27 +6,27 @@
|
|||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
<style type="text/css">
|
||||
.f-grid-cell[data-yc=yc] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server"/>
|
||||
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false" ShowHeader="false" Layout="VBox" AutoScroll="true" BoxConfigAlign="Stretch">
|
||||
<Items>
|
||||
<f:Grid ID="Grid1" IsFluid="true" ShowBorder="true" ShowHeader="true" Title="单位分部分项工程划分"
|
||||
runat="server" EnableCollapse="true" DataKeyNames="Division,ParentId,DivisionLevel" EnableTree="true"
|
||||
TreeColumn="EngineeringName" DataIDField="Division" AllowPaging="true" DataParentIDField="ParentId" OnRowDataBound="Grid1_RowDataBound"
|
||||
<f:Grid ID="Grid1" IsFluid="true" ShowBorder="true" ShowHeader="true" Title="分部分项工程划分"
|
||||
runat="server" EnableCollapse="true" DataKeyNames="DivisionId,ParentId,DivisionLevel,Status" EnableTree="true"
|
||||
TreeColumn="BranchEngineeringCode" DataIDField="DivisionId" AllowPaging="true" DataParentIDField="ParentId" OnRowDataBound="Grid1_RowDataBound"
|
||||
AllowCellEditing="false" ClicksToEdit="1" OnRowCommand="Grid1_RowCommand"
|
||||
EnableMultiSelect="false" EnableCheckBoxSelect="true" ExpandAllTreeNodes="true">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" runat="server">
|
||||
<Items>
|
||||
<f:TextBox runat="server" ID="sEngineeringName"></f:TextBox>
|
||||
<f:Button ID="btnSearch" Icon="SystemSearch" ToolTip="搜索" EnablePostBack="true" runat="server" OnClick="btnSearch_Click"></f:Button>
|
||||
<f:FileUpload runat="server" ID="fileData" EmptyText="请选择Excel文件" Label="附件" LabelAlign="Right" Required="true" ButtonIcon="Add" ShowRedStar="true">
|
||||
</f:FileUpload>
|
||||
<f:Button ID="btnImport" runat="server" OnClick="btnImport_Click" Text="导入"></f:Button>
|
||||
<f:ToolbarFill runat="server"></f:ToolbarFill>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" Text="下载模板" ToolTip="下载模板" OnClick="btnDownLoad_Click"></f:Button>
|
||||
<f:Button ID="btnAdd" Icon="Add" ToolTip="新增" Text="新增" runat="server" OnClick="btnAdd_Click"></f:Button>
|
||||
<f:Button ID="btnParentAdd" Icon="Add" ToolTip="新增子级别" Text="新增子级别" runat="server" OnClick="btnParentAdd_Click"></f:Button>
|
||||
<f:Button ID="btnEdit" Icon="BulletEdit" ToolTip="编辑" Text="编辑" runat="server" OnClick="btnEdit_Click"></f:Button>
|
||||
|
@ -35,19 +35,10 @@
|
|||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RowNumberField />
|
||||
<f:RenderField ColumnID="EngineeringName" ExpandUnusedSpace="true" Width="150px" DataField="EngineeringName" HeaderText="单位工程名称">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="EngineeringCode" ExpandUnusedSpace="true" Width="80px" DataField="EngineeringCode" HeaderText="单位工程编码">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="SubEngineeringName" ExpandUnusedSpace="true" Width="150px" DataField="SubEngineeringName" HeaderText="子单位工程名称">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="SubEngineeringCode" ExpandUnusedSpace="true" Width="80px" DataField="SubEngineeringCode" HeaderText="子单位工程编码">
|
||||
<f:RenderField ColumnID="BranchEngineeringCode" ExpandUnusedSpace="true" Width="80px" DataField="BranchEngineeringCode" HeaderText="分部工程编号">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="BranchEngineeringName" ExpandUnusedSpace="true" Width="150px" DataField="BranchEngineeringName" HeaderText="分部工程名称">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="BranchEngineeringCode" ExpandUnusedSpace="true" Width="80px" DataField="BranchEngineeringCode" HeaderText="分部工程编号">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="SubBranchEngineeringName" ExpandUnusedSpace="true" Width="150px" DataField="SubBranchEngineeringName" HeaderText="子分部工程名称">
|
||||
</f:RenderField>
|
||||
<f:RenderField ColumnID="ProEngineeringName" ExpandUnusedSpace="true" Width="150px" DataField="ProEngineeringName" HeaderText="分项工程名称">
|
||||
|
|
|
@ -29,16 +29,13 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
/// </summary>
|
||||
public void DataBrid()
|
||||
{
|
||||
string strSql = @"select a.Division,a.ProjectId,a.ParentId,a.DivisionLevel,a.EngineeringCode,a.EngineeringName,a.SubEngineeringCode,a.SubEngineeringName,a.BranchEngineeringCode,a.BranchEngineeringName,a.SubBranchEngineeringName,a.ProEngineeringCode,a.ProEngineeringName,a.ProEngineeringNum,a.Remark,a.AddUser,a.OperateTime,a.Sort from Division_SubProjects as a inner join Base_Project as b on a.ProjectId=b.ProjectId where a.ProjectId=@ProjectId order by a.Sort,a.DivisionLevel asc";
|
||||
string strSql = @"select * from(select a.DivisionId,a.ProjectId,a.ParentId,a.DivisionLevel,a.BranchEngineeringCode,a.BranchEngineeringName,a.SubBranchEngineeringName,a.ProEngineeringCode,a.ProEngineeringName,a.ProEngineeringNum,a.Remark,a.AddUser,a.OperateTime,a.Sort,a.Status from Division_SubProjects as a where isnull(a.ProjectId,'')='' ";
|
||||
string strSql1 = @"select a.DivisionId,a.ProjectId,a.ParentId,a.DivisionLevel,a.BranchEngineeringCode,a.BranchEngineeringName,a.SubBranchEngineeringName,a.ProEngineeringCode,a.ProEngineeringName,a.ProEngineeringNum,a.Remark,a.AddUser,a.OperateTime,a.Sort,a.Status from Division_SubProjects as a inner join Base_Project as b on a.ProjectId=b.ProjectId where a.ProjectId=@ProjectId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
if (!string.IsNullOrEmpty(sEngineeringName.Text.Trim()))
|
||||
{
|
||||
strSql += " and a.EngineeringName=@EngineeringName";
|
||||
listStr.Add(new SqlParameter("@EngineeringName", this.sEngineeringName.Text.Trim()));
|
||||
}
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
var zxsql = strSql + " union all " + strSql1 + " ) as t order by t.Sort,t.DivisionLevel asc";
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(zxsql, parameter);
|
||||
Grid1.DataSource = tb;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
@ -62,7 +59,12 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
/// </summary>
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
|
||||
var states = int.Parse(Grid1.DataKeys[e.RowIndex][3].ToString());
|
||||
GridColumn isDelete = Grid1.FindColumn("Delete");
|
||||
if (states == 0)
|
||||
{
|
||||
e.CellAttributes[isDelete.ColumnIndex]["data-yc"] = "yc";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -119,12 +121,12 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
var rowIndex = Grid1.SelectedRowIndex;
|
||||
var rowId = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var runLevel = Grid1.DataKeys[rowIndex][2] != null ? Convert.ToInt32(Grid1.DataKeys[rowIndex][2]) : 1;
|
||||
if (runLevel > 5)
|
||||
if (runLevel > 3)
|
||||
{
|
||||
ShowNotify("最小节点无子节点!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference($"DivisionSubProjectsEdit.aspx?RunId=&ParentId={rowId}", "添加子级"));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference($"DivisionSubProjectsEdit.aspx?DivisionId=&ParentId={rowId}", "添加子级"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -141,7 +143,7 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
var rowIndex = Grid1.SelectedRowIndex;
|
||||
var rowId = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
var parentId = Grid1.DataKeys[rowIndex][1] != null ? Grid1.DataKeys[rowIndex][1].ToString() : string.Empty;
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference($"DivisionSubProjectsEdit.aspx?RunId={rowId}&ParentId={parentId}", "编辑"));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference($"DivisionSubProjectsEdit.aspx?DivisionId={rowId}&ParentId={parentId}", "编辑"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -152,475 +154,6 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
DataBrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (this.fileData.HasFile == false)
|
||||
{
|
||||
ShowNotify("请选择excel文件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string IsXls = Path.GetExtension(this.fileData.FileName).ToString().Trim().ToLower();
|
||||
if (IsXls != ".xls" && IsXls != ".xlsx")
|
||||
{
|
||||
this.fileData.Reset();
|
||||
ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string initFullPath = rootPath + Const.ExcelUrl;
|
||||
if (!Directory.Exists(initFullPath))
|
||||
{
|
||||
Directory.CreateDirectory(initFullPath);
|
||||
}
|
||||
//指定上传文件名称
|
||||
string fileUrl = BLL.Funs.GetNewFileName() + IsXls;
|
||||
//上传文件路径
|
||||
string filePath = initFullPath + fileUrl;
|
||||
//文件上传服务器
|
||||
this.fileData.PostedFile.SaveAs(filePath);
|
||||
//文件上传服务器后的名称
|
||||
string fileName = rootPath + Const.ExcelUrl + fileUrl;
|
||||
//读取Excel
|
||||
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
|
||||
if (ds == null)
|
||||
{
|
||||
this.fileData.Reset();
|
||||
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
ShowNotify(message, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
if (ds.Tables[0].Rows.Count > 1)
|
||||
{
|
||||
var fileVerify = VerifyFile(ds);
|
||||
if (!fileVerify)
|
||||
{
|
||||
this.fileData.Reset();
|
||||
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 1;
|
||||
List<DivisionSubProjectsDto> list = new List<DivisionSubProjectsDto>();
|
||||
DivisionSubProjectsDto previousModel = new DivisionSubProjectsDto();
|
||||
foreach (DataRow item in ds.Tables[0].Rows)
|
||||
{
|
||||
DivisionSubProjectsDto model = new DivisionSubProjectsDto();
|
||||
if (index == 1)
|
||||
{
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
if (StrIsNumm(item[10]))
|
||||
{
|
||||
this.fileData.Reset();
|
||||
ShowNotify($"{index}级别为空!", MessageBoxIcon.Warning);
|
||||
break;
|
||||
}
|
||||
|
||||
previousModel.Level = int.Parse(item[10].ToString());
|
||||
previousModel.EngineeringCode = item[0].ToString();
|
||||
previousModel.EngineeringName = item[1].ToString();
|
||||
previousModel.SubEngineeringCode = item[2].ToString();
|
||||
previousModel.SubEngineeringName = item[3].ToString();
|
||||
previousModel.BranchEngineeringCode = item[4].ToString();
|
||||
previousModel.BranchEngineeringName = item[5].ToString();
|
||||
previousModel.SubBranchEngineeringName = item[6].ToString();
|
||||
previousModel.ProEngineeringCode = item[7].ToString();
|
||||
previousModel.ProEngineeringName = item[8].ToString();
|
||||
previousModel.ProEngineeringNum = item[9].ToString();
|
||||
previousModel.ParentId = "";
|
||||
|
||||
|
||||
|
||||
|
||||
////判断是否为装置
|
||||
//if (!StrIsNumm(item[0]) && !StrIsNumm(item[1]) && StrIsNumm(item[2]) && StrIsNumm(item[3]) && StrIsNumm(item[4]) && StrIsNumm(item[5]) && StrIsNumm(item[6]) && StrIsNumm(item[7]))
|
||||
//{
|
||||
// model.InstallationCode = item[0].ToString();
|
||||
// model.InstallationName = item[1].ToString();
|
||||
// model.Level = 1;
|
||||
//}
|
||||
////判断是否为工序
|
||||
//else if (!StrIsNumm(item[0]) && !StrIsNumm(item[1]) && !StrIsNumm(item[2]) && !StrIsNumm(item[3]) && StrIsNumm(item[4]) && StrIsNumm(item[5]) && StrIsNumm(item[6]) && StrIsNumm(item[7]))
|
||||
//{
|
||||
// model.InstallationCode = item[0].ToString();
|
||||
// model.InstallationName = item[1].ToString();
|
||||
// model.ProcessesCode = item[2].ToString();
|
||||
// model.ProcessesName = item[3].ToString();
|
||||
// model.Level = 2;
|
||||
//}
|
||||
////判断是否为系统
|
||||
//else if (!StrIsNumm(item[0]) && !StrIsNumm(item[1]) && !StrIsNumm(item[2]) && !StrIsNumm(item[3]) && !StrIsNumm(item[4]) && !StrIsNumm(item[5]) && StrIsNumm(item[6]) && StrIsNumm(item[7]))
|
||||
//{
|
||||
// model.InstallationCode = item[0].ToString();
|
||||
// model.InstallationName = item[1].ToString();
|
||||
// model.ProcessesCode = item[2].ToString();
|
||||
// model.ProcessesName = item[3].ToString();
|
||||
// model.SystemCode = item[4].ToString();
|
||||
// model.SystemName = item[5].ToString();
|
||||
// model.Level = 3;
|
||||
//}
|
||||
////判断是否为子系统
|
||||
//else if (!StrIsNumm(item[0]) && !StrIsNumm(item[1]) && !StrIsNumm(item[2]) && !StrIsNumm(item[3]) && !StrIsNumm(item[4]) && !StrIsNumm(item[5]) && !StrIsNumm(item[6]) && !StrIsNumm(item[7]))
|
||||
//{
|
||||
// model.InstallationCode = item[0].ToString();
|
||||
// model.InstallationName = item[1].ToString();
|
||||
// model.ProcessesCode = item[2].ToString();
|
||||
// model.ProcessesName = item[3].ToString();
|
||||
// model.SystemCode = item[4].ToString();
|
||||
// model.SystemName = item[5].ToString();
|
||||
// model.SubsystemCode = item[6].ToString();
|
||||
// model.SubsystemName = item[7].ToString();
|
||||
// model.Level = 4;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"{index}行数据存在错误,数据格式具体见模板说明为空!", MessageBoxIcon.Warning);
|
||||
// break;
|
||||
//}
|
||||
list.Add(model);
|
||||
index++;
|
||||
previousModel = new DivisionSubProjectsDto();
|
||||
}
|
||||
|
||||
#region 数据验证
|
||||
|
||||
////验证装置编码
|
||||
//if (list.Count(x => x.Level == 1) > 0)
|
||||
//{
|
||||
// var installationCodes = list.Where(x => x.Level == 1).Select(a => a.InstallationCode);
|
||||
// var importCodes = installationCodes.GroupBy(x => x).Where(x => x.Count() > 1).Select(x => x.Key).ToList();
|
||||
// if (importCodes.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"EXCEL中装置编码{string.Join(",", importCodes)}重复,请调整模板数据!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// installationCodes = installationCodes.Distinct();
|
||||
// if (installationCodes.Count() > 0)
|
||||
// {
|
||||
// var existInstallations = Funs.DB.PreRun_SysDevice.Where(a => installationCodes.Contains(a.PreRunCode) && a.PreRunLevel == 1 && a.ProjectId == this.CurrUser.LoginProjectId).ToList();
|
||||
// if (existInstallations.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"装置编码({string.Join(",", existInstallations.ConvertAll(s => s.PreRunCode))})已存在!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
//}
|
||||
////验证工序编码
|
||||
//if (list.Count(x => x.Level == 2) > 0)
|
||||
//{
|
||||
// var processesCodes = list.Where(x => x.Level == 2).Select(a => a.ProcessesCode);
|
||||
// var importCodes = processesCodes.GroupBy(x => x).Where(x => x.Count() > 1).Select(x => x.Key).ToList();
|
||||
// if (importCodes.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"EXCEL中工序编码{string.Join(",", importCodes)}重复,请调整模板数据!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// processesCodes = processesCodes.Distinct();
|
||||
// if (processesCodes.Count() > 0)
|
||||
// {
|
||||
// var existProcessess = Funs.DB.PreRun_SysDevice.Where(a => processesCodes.Contains(a.PreRunCode) && a.PreRunLevel == 2 && a.ProjectId == this.CurrUser.LoginProjectId).ToList();
|
||||
// if (existProcessess.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"工序编码({string.Join(",", existProcessess.ConvertAll(s => s.PreRunCode))})已存在!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
////验证系统编码
|
||||
//if (list.Count(x => x.Level == 3) > 0)
|
||||
//{
|
||||
// var systemCodes = list.Where(x => x.Level == 3).Select(a => a.SystemCode);
|
||||
// var importCodes = systemCodes.GroupBy(x => x).Where(x => x.Count() > 1).Select(x => x.Key).ToList();
|
||||
// if (importCodes.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"EXCEL中系统编码{string.Join(",", importCodes)}重复,请调整模板数据!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// systemCodes = systemCodes.Distinct().ToList();
|
||||
// if (systemCodes.Count() > 0)
|
||||
// {
|
||||
// var existSystems = Funs.DB.PreRun_SysDevice.Where(a => systemCodes.Contains(a.PreRunCode) && a.PreRunLevel == 3 && a.ProjectId == this.CurrUser.LoginProjectId).ToList();
|
||||
// if (existSystems.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"系统编码({string.Join(",", existSystems.ConvertAll(s => s.PreRunCode))})已存在!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
////验证子系统编码
|
||||
//if (list.Count(x => x.Level == 4) > 0)
|
||||
//{
|
||||
// var subsystemCodes = list.Where(x => x.Level == 4).Select(a => a.SubsystemCode);
|
||||
// var importCodes = subsystemCodes.GroupBy(x => x).Where(x => x.Count() > 1).Select(x => x.Key).ToList();
|
||||
// if (importCodes.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"EXCEL中子系统编码{string.Join(",", importCodes)}重复,请调整模板数据!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// subsystemCodes = subsystemCodes.Distinct().ToList();
|
||||
// if (subsystemCodes.Count() > 0)
|
||||
// {
|
||||
// var existSubsystems = Funs.DB.PreRun_SysDevice.Where(a => subsystemCodes.Contains(a.PreRunCode) && a.PreRunLevel == 4 && a.ProjectId == this.CurrUser.LoginProjectId).ToList();
|
||||
// if (existSubsystems.Count > 0)
|
||||
// {
|
||||
// this.fileData.Reset();
|
||||
// ShowNotify($"子系统编码({string.Join(",", existSubsystems.ConvertAll(s => s.PreRunCode))})已存在!", MessageBoxIcon.Warning);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据处理
|
||||
|
||||
//var installationData = new List<PreRun_SysDevice>();
|
||||
//var processesData = new List<PreRun_SysDevice>();
|
||||
//var systemData = new List<PreRun_SysDevice>();
|
||||
|
||||
////处理装置
|
||||
//if (list.Count(x => x.Level == 1) > 0)
|
||||
//{
|
||||
// list.Where(x => x.Level == 1).ToList().ForEach(a =>
|
||||
// {
|
||||
// a.InstallationId = Guid.NewGuid().ToString();
|
||||
// });
|
||||
//}
|
||||
////处理工序
|
||||
//if (list.Count(x => x.Level == 2) > 0)
|
||||
//{
|
||||
// var codes = list.ConvertAll(a => a.InstallationCode).Distinct();
|
||||
// installationData = Funs.DB.PreRun_SysDevice.Where(x => x.PreRunLevel == 1 && codes.Contains(x.PreRunCode)).ToList();
|
||||
// list.Where(x => x.Level == 2).ToList().ForEach(a =>
|
||||
// {
|
||||
// //装置
|
||||
// if (list.Count(p => p.InstallationCode == a.InstallationCode && p.Level == 1) > 0)
|
||||
// {
|
||||
// a.InstallationId = list.FirstOrDefault(p => p.InstallationCode == a.InstallationCode && p.Level == 1).InstallationId;
|
||||
// }
|
||||
// else if (installationData.Count(p => p.PreRunCode == a.InstallationCode) > 0)
|
||||
// {
|
||||
// a.InstallationId = installationData.FirstOrDefault(p => p.PreRunCode == a.InstallationCode).PreRunId;
|
||||
// }
|
||||
// //上级编码
|
||||
// a.ParentId = a.InstallationId;
|
||||
// //工序
|
||||
// a.ProcessesId = Guid.NewGuid().ToString();
|
||||
// });
|
||||
//}
|
||||
////处理系统
|
||||
//if (list.Count(x => x.Level == 3) > 0)
|
||||
//{
|
||||
// var codes = list.ConvertAll(a => a.ProcessesCode).Distinct();
|
||||
// processesData = Funs.DB.PreRun_SysDevice.Where(x => x.PreRunLevel == 2 && codes.Contains(x.PreRunCode)).ToList();
|
||||
// list.Where(x => x.Level == 3).ToList().ForEach(a =>
|
||||
// {
|
||||
// //装置
|
||||
// if (list.Count(p => p.InstallationCode == a.InstallationCode && p.Level == 1) > 0)
|
||||
// {
|
||||
// a.InstallationId = list.FirstOrDefault(p => p.InstallationCode == a.InstallationCode && p.Level == 1).InstallationId;
|
||||
// }
|
||||
// else if (installationData.Count(p => p.PreRunCode == a.InstallationCode) > 0)
|
||||
// {
|
||||
// a.InstallationId = installationData.FirstOrDefault(p => p.PreRunCode == a.InstallationCode).PreRunId;
|
||||
// }
|
||||
// //工序
|
||||
// if (list.Count(p => p.ProcessesCode == a.ProcessesCode && p.Level == 2) > 0)
|
||||
// {
|
||||
// a.ProcessesId = list.FirstOrDefault(p => p.ProcessesCode == a.ProcessesCode && p.Level == 2).ProcessesId;
|
||||
// }
|
||||
// else if (processesData.Count(p => p.PreRunCode == a.ProcessesCode) > 0)
|
||||
// {
|
||||
// a.ProcessesId = processesData.FirstOrDefault(p => p.PreRunCode == a.ProcessesCode).PreRunId;
|
||||
// }
|
||||
// //上级编码
|
||||
// a.ParentId = a.ProcessesId;
|
||||
// //系统
|
||||
// a.SystemId = Guid.NewGuid().ToString();
|
||||
// });
|
||||
//}
|
||||
////处理子系统
|
||||
//if (list.Count(x => x.Level == 4) > 0)
|
||||
//{
|
||||
// var codes = list.ConvertAll(a => a.SystemCode).Distinct();
|
||||
// systemData = Funs.DB.PreRun_SysDevice.Where(x => x.PreRunLevel == 3 && codes.Contains(x.PreRunCode)).ToList();
|
||||
// list.Where(x => x.Level == 4).ToList().ForEach(a =>
|
||||
// {
|
||||
// //装置
|
||||
// if (list.Count(p => p.InstallationCode == a.InstallationCode && p.Level == 1) > 0)
|
||||
// {
|
||||
// a.InstallationId = list.FirstOrDefault(p => p.InstallationCode == a.InstallationCode && p.Level == 1).InstallationId;
|
||||
// }
|
||||
// else if (installationData.Count(p => p.PreRunCode == a.InstallationCode) > 0)
|
||||
// {
|
||||
// a.InstallationId = installationData.FirstOrDefault(p => p.PreRunCode == a.InstallationCode).PreRunId;
|
||||
// }
|
||||
// //工序
|
||||
// if (list.Count(p => p.ProcessesCode == a.ProcessesCode && p.Level == 2) > 0)
|
||||
// {
|
||||
// a.ProcessesId = list.FirstOrDefault(p => p.ProcessesCode == a.ProcessesCode && p.Level == 2).ProcessesId;
|
||||
// }
|
||||
// else if (processesData.Count(p => p.PreRunCode == a.ProcessesCode) > 0)
|
||||
// {
|
||||
// a.ProcessesId = processesData.FirstOrDefault(p => p.PreRunCode == a.ProcessesCode).PreRunId;
|
||||
// }
|
||||
// //系统
|
||||
// if (list.Count(p => p.SystemCode == a.SystemCode && p.Level == 3) > 0)
|
||||
// {
|
||||
// a.SystemId = list.FirstOrDefault(p => p.SystemCode == a.SystemCode && p.Level == 3).SystemId;
|
||||
// }
|
||||
// else if (systemData.Count(p => p.PreRunCode == a.SystemCode) > 0)
|
||||
// {
|
||||
// a.SystemId = systemData.FirstOrDefault(p => p.PreRunCode == a.SystemCode).PreRunId;
|
||||
// }
|
||||
// //上级编码
|
||||
// a.ParentId = a.SystemId;
|
||||
// //子系统
|
||||
// a.SubsystemId = Guid.NewGuid().ToString();
|
||||
// });
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据入库
|
||||
|
||||
//var listData = new List<PreRun_SysDevice>();
|
||||
//int oneIndex = 1;
|
||||
//int twoIndex = 1;
|
||||
//int threeIndex = 1;
|
||||
//int fourIndex = 1;
|
||||
//foreach (var itemData in list)
|
||||
//{
|
||||
// var model = new PreRun_SysDevice();
|
||||
// model.ProjectId = this.CurrUser.LoginProjectId;
|
||||
// model.PreRunLevel = itemData.Level;
|
||||
// if (itemData.Level == 1)
|
||||
// {
|
||||
// model.PreRunId = itemData.InstallationId;
|
||||
// model.PreRunCode = itemData.InstallationCode;
|
||||
// model.PreRunName = itemData.InstallationName;
|
||||
// model.ParentId = itemData.ParentId;
|
||||
// model.AddUser = CurrUser.Account;
|
||||
// model.OperateTime = DateTime.Now;
|
||||
// model.Sort = Funs.DB.PreRun_SysDevice.Count(p => p.ProjectId == CurrUser.LoginProjectId) + oneIndex;
|
||||
// oneIndex++;
|
||||
// }
|
||||
// if (itemData.Level == 2)
|
||||
// {
|
||||
// model.PreRunId = itemData.ProcessesId;
|
||||
// model.ProcessesId = itemData.ProcessesId;
|
||||
// model.PreRunCode = itemData.ProcessesCode;
|
||||
// model.PreRunName = itemData.ProcessesName;
|
||||
// model.InstallationId = itemData.InstallationId;
|
||||
// model.ParentId = itemData.ParentId;
|
||||
// model.AddUser = CurrUser.Account;
|
||||
// model.OperateTime = DateTime.Now;
|
||||
// model.Sort = Funs.DB.PreRun_SysDevice.Count(p => p.ProjectId == CurrUser.LoginProjectId) + twoIndex;
|
||||
// twoIndex++;
|
||||
// }
|
||||
// if (itemData.Level == 3)
|
||||
// {
|
||||
// model.PreRunId = itemData.SystemId;
|
||||
// model.SystemId = itemData.SystemId;
|
||||
// model.PreRunCode = itemData.SystemCode;
|
||||
// model.PreRunName = itemData.SystemName;
|
||||
// model.InstallationId = itemData.InstallationId;
|
||||
// model.ProcessesId = itemData.ProcessesId;
|
||||
// model.ParentId = itemData.ParentId;
|
||||
// model.AddUser = CurrUser.Account;
|
||||
// model.OperateTime = DateTime.Now;
|
||||
// model.Sort = Funs.DB.PreRun_SysDevice.Count(p => p.ProjectId == CurrUser.LoginProjectId) + threeIndex;
|
||||
// threeIndex++;
|
||||
// }
|
||||
// if (itemData.Level == 4)
|
||||
// {
|
||||
// model.PreRunId = itemData.SubsystemId;
|
||||
// model.SubsystemId = itemData.SubsystemId;
|
||||
// model.PreRunCode = itemData.SubsystemCode;
|
||||
// model.PreRunName = itemData.SubsystemName;
|
||||
// model.InstallationId = itemData.InstallationId;
|
||||
// model.ProcessesId = itemData.ProcessesId;
|
||||
// model.SystemId = itemData.SystemId;
|
||||
// model.ParentId = itemData.ParentId;
|
||||
// model.AddUser = CurrUser.Account;
|
||||
// model.OperateTime = DateTime.Now;
|
||||
// model.Sort = Funs.DB.PreRun_SysDevice.Count(p => p.ProjectId == CurrUser.LoginProjectId) + fourIndex;
|
||||
// fourIndex++;
|
||||
// }
|
||||
// listData.Add(model);
|
||||
//}
|
||||
|
||||
//Funs.DB.PreRun_SysDevice.InsertAllOnSubmit(listData);
|
||||
//Funs.DB.SubmitChanges();
|
||||
//ShowNotify("导入成功!", MessageBoxIcon.Success);
|
||||
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
this.fileData.Reset();
|
||||
ShowNotify("文件无数据!", MessageBoxIcon.Warning);
|
||||
}
|
||||
DataBrid();
|
||||
this.fileData.Reset();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.fileData.Reset();
|
||||
ShowNotify(ex.Message, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载模板
|
||||
/// </summary>
|
||||
protected void btnDownLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("是否确认下载模板?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
|
||||
{
|
||||
if (e.EventArgument == "Confirm_OK")
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string uploadfilepath = rootPath + Const.WBSDivisionUrl;
|
||||
string filePath = Const.WBSDivisionUrl;
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
FileInfo info = new FileInfo(uploadfilepath);
|
||||
long fileSize = info.Length;
|
||||
Response.ClearContent();
|
||||
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
|
||||
Response.ContentType = "excel/plain";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
Response.AddHeader("Content-Length", fileSize.ToString().Trim());
|
||||
Response.TransmitFile(uploadfilepath, 0, fileSize);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 右击修改
|
||||
/// </summary>
|
||||
|
@ -668,54 +201,6 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证单位分部分项工程划分模板是否正确
|
||||
/// </summary>
|
||||
/// <param name="ds"></param>
|
||||
/// <returns></returns>
|
||||
private bool VerifyFile(DataSet ds)
|
||||
{
|
||||
var result = true;
|
||||
if (ds.Tables[0].Rows[1][0].ToString().Contains("单位工程名称")) result = false;
|
||||
if (ds.Tables[0].Rows[1][1].ToString().Contains("子单位工程编码")) result = false;
|
||||
if (ds.Tables[0].Rows[1][2].ToString().Contains("子单位工程名称")) result = false;
|
||||
if (ds.Tables[0].Rows[1][3].ToString().Contains("分部工程编号")) result = false;
|
||||
if (ds.Tables[0].Rows[1][4].ToString().Contains("分部工程名称")) result = false;
|
||||
if (ds.Tables[0].Rows[1][5].ToString().Contains("子分部工程名称")) result = false;
|
||||
if (ds.Tables[0].Rows[1][6].ToString().Contains("分项工程编号")) result = false;
|
||||
if (ds.Tables[0].Rows[1][7].ToString().Contains("分项工程名称")) result = false;
|
||||
if (ds.Tables[0].Rows[1][7].ToString().Contains("分部分项码")) result = false;
|
||||
if (ds.Tables[0].Rows[1][7].ToString().Contains("级别")) result = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证datatable某列是否存在重复
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool HasRepeatData(DataTable dt, string[] colName)
|
||||
{
|
||||
bool flag = false;
|
||||
DataView myDataView = new DataView(dt);
|
||||
if (myDataView.ToTable(true, colName).Rows.Count < dt.Rows.Count)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取某一列的所有值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">列数据类型</typeparam>
|
||||
/// <param name="dtSource">数据表</param>
|
||||
/// <param name="filedName">列名</param>
|
||||
/// <returns></returns>
|
||||
public static List<T> GetColumnValues<T>(DataTable dtSource, string filedName)
|
||||
{
|
||||
return (from r in dtSource.AsEnumerable() select r.Field<T>(filedName)).ToList<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否为空
|
||||
/// </summary>
|
||||
|
@ -728,61 +213,6 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单位分部分项工程划分信息
|
||||
/// </summary>
|
||||
public class DivisionSubProjectsDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 上级主键
|
||||
/// </summary>
|
||||
public string ParentId { get; set; }
|
||||
/// <summary>
|
||||
/// 级别
|
||||
/// </summary>
|
||||
public int Level { get; set; }
|
||||
/// <summary>
|
||||
/// 单位工程编码
|
||||
/// </summary>
|
||||
public string EngineeringCode { get; set; }
|
||||
/// <summary>
|
||||
/// 单位工程名称
|
||||
/// </summary>
|
||||
public string EngineeringName { get; set; }
|
||||
/// <summary>
|
||||
/// 子单位工程编码
|
||||
/// </summary>
|
||||
public string SubEngineeringCode { get; set; }
|
||||
/// <summary>
|
||||
/// 子单位工程名称
|
||||
/// </summary>
|
||||
public string SubEngineeringName { get; set; }
|
||||
/// <summary>
|
||||
/// 分部工程编号
|
||||
/// </summary>
|
||||
public string BranchEngineeringCode { get; set; }
|
||||
/// <summary>
|
||||
/// 分部工程名称
|
||||
/// </summary>
|
||||
public string BranchEngineeringName { get; set; }
|
||||
/// <summary>
|
||||
/// 子分部工程名称
|
||||
/// </summary>
|
||||
public string SubBranchEngineeringName { get; set; }
|
||||
/// <summary>
|
||||
/// 分项工程编号
|
||||
/// </summary>
|
||||
public string ProEngineeringCode { get; set; }
|
||||
/// <summary>
|
||||
/// 分项工程名称
|
||||
/// </summary>
|
||||
public string ProEngineeringName { get; set; }
|
||||
/// <summary>
|
||||
/// 分部分项码
|
||||
/// </summary>
|
||||
public string ProEngineeringNum { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -59,15 +59,6 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// sEngineeringName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox sEngineeringName;
|
||||
|
||||
/// <summary>
|
||||
/// btnSearch 控件。
|
||||
/// </summary>
|
||||
|
@ -77,33 +68,6 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSearch;
|
||||
|
||||
/// <summary>
|
||||
/// fileData 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fileData;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// btnAdd 控件。
|
||||
/// </summary>
|
||||
|
|
|
@ -4,13 +4,83 @@
|
|||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>编辑</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<div>
|
||||
</div>
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<f:Button ID="btnSave" OnClick="btnSave_Click" Icon="SystemSave" runat="server" ToolTip="保存" ValidateForms="SimpleForm1">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:ContentPanel ID="ContentPanel2" ShowBorder="true"
|
||||
BodyPadding="10px" EnableCollapse="true" ShowHeader="false" AutoScroll="true"
|
||||
runat="server">
|
||||
<f:Form ID="Form2" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Rows>
|
||||
|
||||
<f:FormRow runat="server" ID="one" Hidden="true">
|
||||
<Items>
|
||||
<f:TextBox ID="txtBranchEngineeringCode" runat="server" Label="分部工程编号" LabelAlign="Right" Required="true" LabelWidth="200px">
|
||||
</f:TextBox>
|
||||
<f:TextBox ID="txtBranchEngineeringName" runat="server" Label="分部工程名称" LabelAlign="Right" Required="true" LabelWidth="200px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow runat="server" ID="two" Hidden="true">
|
||||
<Items>
|
||||
<f:TextBox ID="txtSubBranchEngineeringName" runat="server" Label="子分部工程名称" LabelAlign="Right" Required="true" LabelWidth="200px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtProEngineeringCode" runat="server" Label="分项工程编号" LabelAlign="Right" Required="true" LabelWidth="200px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtProEngineeringName" runat="server" Label="分项工程名称" LabelAlign="Right" LabelWidth="200px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextBox ID="txtProEngineeringNum" runat="server" Label="分部分项码" LabelAlign="Right" LabelWidth="200px">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:TextArea runat="server" ID="txtRemark" Label="备注" LabelAlign="Right" LabelWidth="200px"></f:TextArea>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:NumberBox runat="server" Label="排序" ID="txtSort" LabelAlign="Right" Required="true" LabelWidth="150"></f:NumberBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</f:ContentPanel>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
@ -7,11 +9,214 @@ using System.Web.UI.WebControls;
|
|||
|
||||
namespace FineUIPro.Web.CQMS.WBS.Control
|
||||
{
|
||||
public partial class DivisionSubProjectsEdit : System.Web.UI.Page
|
||||
public partial class DivisionSubProjectsEdit : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 上级主键
|
||||
/// </summary>
|
||||
public string ParentId
|
||||
{
|
||||
get { return (string)ViewState["ParentId"]; }
|
||||
set { ViewState["ParentId"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string DivisionId
|
||||
{
|
||||
get { return (string)ViewState["DivisionId"]; }
|
||||
set { ViewState["DivisionId"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.DivisionId = Request.Params["DivisionId"];
|
||||
this.ParentId = Request.Params["ParentId"];
|
||||
//绑定数据
|
||||
PageIn();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
/// <param name="runId">主键</param>
|
||||
/// <param name="parentId">上级主键</param>
|
||||
public void PageIn()
|
||||
{
|
||||
var num = 0;
|
||||
if (!string.IsNullOrWhiteSpace(this.ParentId))
|
||||
{
|
||||
var parenLs = GetAllCropping(this.ParentId);
|
||||
if (parenLs.Count > 0)
|
||||
{
|
||||
var itemModel = parenLs.FirstOrDefault(p => p.DivisionId == this.ParentId);
|
||||
if (itemModel != null)
|
||||
{
|
||||
if (itemModel.DivisionLevel == 1)
|
||||
{
|
||||
one.Hidden = false;
|
||||
var oneModel = parenLs.FirstOrDefault(p => p.DivisionLevel == 1);
|
||||
if (oneModel != null)
|
||||
{
|
||||
txtBranchEngineeringCode.Text = oneModel.BranchEngineeringCode;
|
||||
txtBranchEngineeringName.Text = oneModel.BranchEngineeringName;
|
||||
if (string.IsNullOrWhiteSpace(this.DivisionId))
|
||||
{
|
||||
num = Funs.DB.Division_SubProjects.Count() + 1;
|
||||
txtSort.Text = num.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (itemModel.DivisionLevel == 2)
|
||||
{
|
||||
one.Hidden = false;
|
||||
two.Hidden = false;
|
||||
var oneModel = parenLs.FirstOrDefault(p => p.DivisionLevel == 1);
|
||||
if (oneModel != null)
|
||||
{
|
||||
txtBranchEngineeringCode.Text = oneModel.BranchEngineeringCode;
|
||||
txtBranchEngineeringName.Text = oneModel.BranchEngineeringName;
|
||||
}
|
||||
var twoModel = parenLs.FirstOrDefault(p => p.DivisionLevel == 2);
|
||||
if (twoModel != null)
|
||||
{
|
||||
txtSubBranchEngineeringName.Text = twoModel.SubBranchEngineeringName;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(this.DivisionId))
|
||||
{
|
||||
num = Funs.DB.Division_SubProjects.Count() + 1;
|
||||
txtSort.Text = num.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(this.DivisionId))
|
||||
{
|
||||
num = Funs.DB.Division_SubProjects.Count() + 1;
|
||||
txtSort.Text = num.ToString();
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(this.DivisionId))
|
||||
{
|
||||
var itemModel = Funs.DB.Division_SubProjects.FirstOrDefault(p => p.DivisionId == this.DivisionId);
|
||||
if (itemModel != null)
|
||||
{
|
||||
txtRemark.Text = itemModel.Remark;
|
||||
txtSort.Text = itemModel.Sort.ToString();
|
||||
txtBranchEngineeringCode.Text = itemModel.BranchEngineeringCode;
|
||||
txtBranchEngineeringName.Text = itemModel.BranchEngineeringName;
|
||||
txtSubBranchEngineeringName.Text = itemModel.SubBranchEngineeringName;
|
||||
txtProEngineeringCode.Text = itemModel.ProEngineeringCode;
|
||||
txtProEngineeringName.Text = itemModel.ProEngineeringName;
|
||||
txtProEngineeringNum.Text = itemModel.ProEngineeringNum;
|
||||
txtRemark.Text = itemModel.Remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存
|
||||
/// </summary>
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
var model = new Division_SubProjects();
|
||||
model.DivisionId = Guid.NewGuid().ToString();
|
||||
var oneDivisionId = string.Empty;
|
||||
var twoDivisionId = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(this.DivisionId))
|
||||
{
|
||||
model = Funs.DB.Division_SubProjects.FirstOrDefault(p => p.DivisionId == this.DivisionId);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Status = 1;
|
||||
model.ProjectId = CurrUser.LoginProjectId;
|
||||
}
|
||||
if (model == null)
|
||||
{
|
||||
ShowNotify("传递参数错误!", MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(this.ParentId))
|
||||
{
|
||||
var parenLs = GetAllCropping(this.ParentId);
|
||||
if (parenLs.Count > 0)
|
||||
{
|
||||
var oneModel = parenLs.FirstOrDefault(p => p.DivisionLevel == 1);
|
||||
if (oneModel != null)
|
||||
{
|
||||
model.ParentId = oneModel.DivisionId;
|
||||
model.DivisionLevel = 2;
|
||||
}
|
||||
var twoModel = parenLs.FirstOrDefault(p => p.DivisionLevel == 2);
|
||||
if (twoModel != null)
|
||||
{
|
||||
model.ParentId = twoModel.DivisionId;
|
||||
model.DivisionLevel = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
model.DivisionLevel = 1;
|
||||
}
|
||||
model.AddUser = this.CurrUser.UserId;
|
||||
model.OperateTime = DateTime.Now;
|
||||
model.Sort = !string.IsNullOrEmpty(txtSort.Text) ? int.Parse(txtSort.Text) : Funs.DB.Division_SubProjects.Count() + 1;
|
||||
model.BranchEngineeringCode = txtBranchEngineeringCode.Text;
|
||||
model.BranchEngineeringName = txtBranchEngineeringName.Text;
|
||||
model.SubBranchEngineeringName = txtSubBranchEngineeringName.Text;
|
||||
model.ProEngineeringCode = txtProEngineeringCode.Text;
|
||||
model.ProEngineeringName = txtProEngineeringName.Text;
|
||||
model.ProEngineeringNum = txtProEngineeringNum.Text;
|
||||
model.Remark = txtRemark.Text;
|
||||
if (string.IsNullOrWhiteSpace(this.DivisionId)) Funs.DB.Division_SubProjects.InsertOnSubmit(model);
|
||||
Funs.DB.SubmitChanges();
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取所有节点
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Division_SubProjects> GetAllCropping(string parentId)
|
||||
{
|
||||
var result = new List<Division_SubProjects>();
|
||||
|
||||
var ids = new List<string>();
|
||||
var itemSubPro = Funs.DB.Division_SubProjects.FirstOrDefault(p => p.DivisionId == parentId);
|
||||
if (itemSubPro != null)
|
||||
{
|
||||
ids.Add(itemSubPro.DivisionId);
|
||||
if (itemSubPro.DivisionLevel == 2)
|
||||
{
|
||||
ids.Add(itemSubPro.ParentId);
|
||||
}
|
||||
if (itemSubPro.DivisionLevel == 3)
|
||||
{
|
||||
ids.Add(itemSubPro.ParentId);
|
||||
var twoSubPro = Funs.DB.Division_SubProjects.FirstOrDefault(p => p.DivisionId == itemSubPro.ParentId);
|
||||
if (twoSubPro != null)
|
||||
{
|
||||
ids.Add(twoSubPro.ParentId);
|
||||
}
|
||||
}
|
||||
result = Funs.DB.Division_SubProjects.Where(p => ids.Contains(p.DivisionId)).ToList();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码是由工具生成的。
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.CQMS.WBS.Control
|
||||
|
@ -22,5 +22,158 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ToolbarFill ToolbarFill1;
|
||||
|
||||
/// <summary>
|
||||
/// btnSave 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnSave;
|
||||
|
||||
/// <summary>
|
||||
/// ContentPanel2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.ContentPanel ContentPanel2;
|
||||
|
||||
/// <summary>
|
||||
/// Form2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form Form2;
|
||||
|
||||
/// <summary>
|
||||
/// one 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow one;
|
||||
|
||||
/// <summary>
|
||||
/// txtBranchEngineeringCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtBranchEngineeringCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtBranchEngineeringName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtBranchEngineeringName;
|
||||
|
||||
/// <summary>
|
||||
/// two 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FormRow two;
|
||||
|
||||
/// <summary>
|
||||
/// txtSubBranchEngineeringName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtSubBranchEngineeringName;
|
||||
|
||||
/// <summary>
|
||||
/// txtProEngineeringCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtProEngineeringCode;
|
||||
|
||||
/// <summary>
|
||||
/// txtProEngineeringName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtProEngineeringName;
|
||||
|
||||
/// <summary>
|
||||
/// txtProEngineeringNum 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtProEngineeringNum;
|
||||
|
||||
/// <summary>
|
||||
/// txtRemark 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextArea txtRemark;
|
||||
|
||||
/// <summary>
|
||||
/// txtSort 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.NumberBox txtSort;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,13 +47,9 @@
|
|||
</f:RenderField>
|
||||
<f:RenderField ColumnID="ControlCode" Width="100px" DataField="ControlCode" HeaderText="编码">
|
||||
</f:RenderField>
|
||||
|
||||
|
||||
<f:LinkButtonField Width="100px" ConfirmText="删除当前选中数据和所有子节点数据?" ColumnID="Delete" ToolTip="删除" ConfirmTarget="Top"
|
||||
CommandName="Delete" Icon="Delete" />
|
||||
<f:LinkButtonField Width="100px" CommandName="fileView" ToolTip="附件" ConfirmTarget="Top" Icon="TableCell" />
|
||||
|
||||
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
|
|
|
@ -70,10 +70,6 @@ namespace FineUIPro.Web.CQMS.WBS.Control
|
|||
/// </summary>
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
if (Grid1.DataKeys[e.RowIndex][0].ToString() == "595fd674-ca2b-4557-a7c7-1be1096c3825")
|
||||
{
|
||||
|
||||
}
|
||||
var states = int.Parse(Grid1.DataKeys[e.RowIndex][3].ToString());
|
||||
GridColumn isDelete = Grid1.FindColumn("Delete");
|
||||
if (states == 0)
|
||||
|
|
Loading…
Reference in New Issue