修改进度模块
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
|
||||
<f:Panel ID="Panel1" CssClass="blockpanel" Margin="5px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||||
<Items>
|
||||
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true" EnableCollapse="true" Layout="Fit"
|
||||
@@ -47,6 +47,18 @@
|
||||
SortField="ControlItemAndCycleCode" SortDirection="ASC" AllowCellEditing="true" ClicksToEdit="1" ForceFit="true"
|
||||
ShowSelectedCell="true" DataIDField="ControlItemAndCycleId" AllowPaging="true" IsDatabasePaging="true"
|
||||
PageSize="100" OnPageIndexChange="Grid1_PageIndexChange" AllowFilters="true" OnFilterChange="Grid1_FilterChange">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Right">
|
||||
<Items>
|
||||
<f:Button ID="btnFile" ToolTip="生成项目WBS编码规则说明" Icon="Help" runat="server" Text=""
|
||||
OnClick="btnFile_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnCreateCode" ToolTip="生成项目WBS编码" Icon="Book" runat="server" Text=""
|
||||
OnClick="btnCreateCode_Click">
|
||||
</f:Button>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Columns>
|
||||
<f:RenderField Width="70px" ColumnID="ControlItemContent" DataField="ControlItemContent" FieldType="String"
|
||||
HeaderText="工作包" HeaderTextAlign="Center" TextAlign="Center">
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
@@ -557,5 +558,103 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成项目WBS编码
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnCreateCode_Click(object sender, EventArgs e)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string projectCode = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId);
|
||||
var unitWorks = from x in db.WBS_UnitWork where x.ProjectId == this.CurrUser.LoginProjectId orderby x.UnitWorkCode select x;
|
||||
var workPackages = (from x in db.WBS_WorkPackage where x.ProjectId == this.CurrUser.LoginProjectId && x.IsApprove == true select x).ToList();
|
||||
var controlItemAndCycles = (from x in db.WBS_ControlItemAndCycle where x.ProjectId == this.CurrUser.LoginProjectId && x.IsApprove == true select x).ToList();
|
||||
foreach (var unitWork in unitWorks)
|
||||
{
|
||||
unitWork.WBSCode = projectCode + unitWork.UnitWorkCode;
|
||||
var workPackage1s = workPackages.Where(x => x.UnitWorkId == unitWork.UnitWorkId && x.SuperWorkPack == null).OrderBy(x => x.WorkPackageCode);
|
||||
foreach (var workPackage1 in workPackage1s)
|
||||
{
|
||||
if (!workPackage1.PackageContent.Contains("-"))
|
||||
{
|
||||
workPackage1.WBSCode = projectCode + unitWork.UnitWorkCode + unitWork.ProjectType + workPackage1.PackageCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
workPackage1.WBSCode = projectCode + unitWork.UnitWorkCode + unitWork.ProjectType + workPackage1.PackageCode + workPackage1.WorkPackageCode.Substring(workPackage1.WorkPackageCode.Length - 2, 2);
|
||||
}
|
||||
UpdateWBSCode(db, workPackages, workPackage1.WorkPackageId, workPackage1.WBSCode, controlItemAndCycles);
|
||||
}
|
||||
}
|
||||
db.SubmitChanges();
|
||||
ShowNotify("生成成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
private void UpdateWBSCode(Model.SGGLDB db, List<Model.WBS_WorkPackage> workPackages, string workPackageId, string wbsCode, List<Model.WBS_ControlItemAndCycle> controlItemAndCycles)
|
||||
{
|
||||
var childWorkPackages = workPackages.Where(x => x.SuperWorkPackageId == workPackageId);
|
||||
if (childWorkPackages.Count() > 0)
|
||||
{
|
||||
foreach (var childWorkPackage in childWorkPackages)
|
||||
{
|
||||
if (!childWorkPackage.PackageContent.Contains("-"))
|
||||
{
|
||||
childWorkPackage.WBSCode = wbsCode + childWorkPackage.PackageCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
childWorkPackage.WBSCode = wbsCode + childWorkPackage.PackageCode + childWorkPackage.WorkPackageCode.Substring(childWorkPackage.WorkPackageCode.Length - 2, 2);
|
||||
}
|
||||
UpdateWBSCode(db, workPackages, childWorkPackage.WorkPackageId, childWorkPackage.WBSCode, controlItemAndCycles);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var controlItemAndCycleItems = controlItemAndCycles.Where(x => x.WorkPackageId == workPackageId);
|
||||
foreach (var controlItemAndCycleItem in controlItemAndCycleItems)
|
||||
{
|
||||
controlItemAndCycleItem.WBSCode = wbsCode + controlItemAndCycleItem.InitControlItemCode.Substring(controlItemAndCycleItem.InitControlItemCode.Length - 2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region 下载WBS编码规则文件
|
||||
/// <summary>
|
||||
/// 下载WBS编码规则文件按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载WBS编码规则文件吗?", String.Empty, MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
|
||||
{
|
||||
if (e.EventArgument == "Confirm_OK")
|
||||
{
|
||||
string rootPath = Server.MapPath("~/");
|
||||
string filePath = Const.WBSCodeTemplateUrl;
|
||||
string uploadfilepath = rootPath + filePath;
|
||||
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();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,33 @@ namespace FineUIPro.Web.CQMS.WBS {
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid Grid1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar1;
|
||||
|
||||
/// <summary>
|
||||
/// btnFile 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnFile;
|
||||
|
||||
/// <summary>
|
||||
/// btnCreateCode 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnCreateCode;
|
||||
|
||||
/// <summary>
|
||||
/// Label3 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -558,7 +558,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.PackageContent = workPackageProject.PackageContent + name;
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.IsChild = workPackageProject.IsChild;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
newWorkPackage.SubItemType = GetSubItemTypeId(values.Value<string>("SubItemType"));
|
||||
@@ -661,7 +661,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.PackageContent = workPackageProject.PackageContent + name;
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.IsChild = workPackageProject.IsChild;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.IsApprove = true;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
@@ -732,7 +732,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.PackageContent = workPackageProject.PackageContent + name;
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.IsChild = workPackageProject.IsChild;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
newWorkPackage.SubItemType = GetSubItemTypeId(values.Value<string>("SubItemType"));
|
||||
|
||||
@@ -590,7 +590,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.SuperWorkPackageId = WorkPackageId;
|
||||
newWorkPackage.IsChild = workPackageProject.IsChild;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
newWorkPackage.SubItemType = GetSubItemTypeId(values.Value<string>("SubItemType"));
|
||||
@@ -690,7 +690,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.SuperWorkPackageId = WorkPackageId;
|
||||
newWorkPackage.IsChild = workPackageProject.IsChild;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.IsApprove = true;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
@@ -762,7 +762,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.SuperWorkPackageId = WorkPackageId;
|
||||
newWorkPackage.IsChild = workPackageProject.IsChild;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
newWorkPackage.SubItemType = GetSubItemTypeId(values.Value<string>("SubItemType"));
|
||||
|
||||
@@ -519,7 +519,7 @@ namespace FineUIPro.Web.CQMS.WBS
|
||||
newWorkPackage.PackageContent = workPackageProject.PackageContent + "-" + txtName;
|
||||
newWorkPackage.SuperWorkPack = workPackageProject.SuperWorkPack;
|
||||
newWorkPackage.SuperWorkPackageId = WorkPackageId;
|
||||
newWorkPackage.PackageCode = code;
|
||||
newWorkPackage.PackageCode = workPackageProject.PackageCode;
|
||||
newWorkPackage.ProjectType = workPackageProject.ProjectType;
|
||||
newWorkPackage.InitWorkPackageCode = workPackageProject.WorkPackageCode;
|
||||
newWorkPackage.IsApprove = true;
|
||||
|
||||
Reference in New Issue
Block a user