This commit is contained in:
gaofei 2022-05-22 10:13:35 +08:00
parent 54fc77e7c1
commit 16110c1501
14 changed files with 751 additions and 585 deletions

View File

@ -2542,5 +2542,161 @@ namespace BLL
AddDetail(newList, oldList, item.Id);
}
}
private static void AddDetailOut(List<Model.View_WBS_CostControlDetailStatistics> newList, List<Model.View_WBS_CostControlDetailStatistics> oldList, string id, string prefix)
{
var items = oldList.Where(x => x.SupId == id).OrderBy(x => x.Code);
foreach (var item in items)
{
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetailOut(newList, oldList, item.Id, prefix + "....");
}
}
/// <summary>
/// 获取模拟树表格
/// </summary>
/// <returns></returns>
public static DataTable GetAllTreeDataTable(string projectId, string IsOut)
{
List<Model.View_WBS_CostControlDetailStatistics> CostControlDetailStatisticsList = new List<Model.View_WBS_CostControlDetailStatistics>();
DataTable table = new DataTable();
var installation = Funs.DB.Project_Installation.FirstOrDefault(x => x.SuperInstallationId == "0" && x.ProjectId == projectId);
if (installation != null)
{
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
if (installation.StartDate != null && installation.EndDate != null)
{
startDate = Convert.ToDateTime(installation.StartDate);
endDate = Convert.ToDateTime(installation.EndDate);
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
table.Columns.Add(new DataColumn("Id", typeof(String)));
table.Columns.Add(new DataColumn("SupId", typeof(String)));
table.Columns.Add(new DataColumn("Name", typeof(String)));
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
table.Columns.Add(new DataColumn("Unit", typeof(String)));
table.Columns.Add(new DataColumn("TotalNum", typeof(String)));
table.Columns.Add(new DataColumn("RealPrice", typeof(String)));
table.Columns.Add(new DataColumn("PlanPrice", typeof(String)));
for (int i = 0; i < months.Count; i++)
{
table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String)));
table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String)));
}
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
Model.SGGLDB db = Funs.DB;
var costControls = from x in db.WBS_CostControl where x.ProjectId == projectId select x;
var details = from x in db.View_WBS_CostControlDetail where x.ProjectId == projectId select x;
var parentDetails = from x in db.View_WBS_CostControlParentDetail select x;
var wbsSets = from x in db.Wbs_WbsSet where x.ProjectId == projectId select x;
var wbsSetInits = from x in db.WBS_WbsSetInit select x;
var unitProjects = from x in db.Wbs_UnitProject where x.ProjectId == projectId select x;
var unitProjectInits = from x in db.Wbs_UnitProjectInit select x;
var cnProfessions = from x in db.WBS_CnProfession where x.ProjectId == projectId select x;
var cnProfessionInits = from x in db.WBS_CnProfessionInit select x;
var installations = from x in db.Project_Installation where x.ProjectId == projectId select x;
CostControlDetailStatisticsList = (from x in db.View_WBS_CostControlDetailStatistics where x.ProjectId == projectId select x).Distinct().ToList();
List<Model.View_WBS_CostControlDetailStatistics> newList = new List<Model.View_WBS_CostControlDetailStatistics>();
var installationList = CostControlDetailStatisticsList.Where(x => x.WBSType == "Installation" && x.SupId == "0");
foreach (var item in installationList)
{
newList.Add(item);
if (string.IsNullOrEmpty(IsOut))
{
AddDetail(newList, CostControlDetailStatisticsList, item.Id);
}
else
{
AddDetailOut(newList, CostControlDetailStatisticsList, item.Id, string.Empty);
}
}
DataRow row;
foreach (Model.View_WBS_CostControlDetailStatistics item in newList)
{
row = table.NewRow();
row[0] = item.Id;
row[1] = item.SupId;
row[2] = item.Name;
row[3] = item.ProjectId;
Model.WBS_CostControl costControl = costControls.FirstOrDefault(x => x.CostControlId == item.Id);
if (costControl != null)
{
row[4] = costControl.Unit;//单位
if (costControl.TotalNum != null)
{
row[5] = decimal.Round(Convert.ToDecimal(costControl.TotalNum), 2);//合同工作量
}
if (costControl.RealPrice != null)
{
row[6] = decimal.Round(Convert.ToDecimal(costControl.RealPrice), 2);//成本单价
}
if (costControl.PlanPrice != null)
{
row[7] = decimal.Round(Convert.ToDecimal(costControl.PlanPrice), 2);//控制预算单价
}
for (int i = 0; i < months.Count; i++)
{
Model.View_WBS_CostControlDetail detail = details.FirstOrDefault(x => x.CostControlId == item.Id && x.Months == months[i]);
if (detail != null)
{
if (detail.PlanNum != 0)
{
row[8 + i * 2] = decimal.Round(Convert.ToDecimal(detail.PlanNum), 2);
}
if (detail.ThisNum != 0)
{
row[9 + i * 2] = decimal.Round(Convert.ToDecimal(detail.ThisNum), 2);
}
}
}
row[10 + (months.Count-1) * 2] = item.Id;
//row[10] = decimal.Round(Convert.ToDecimal(detail.ThisRealCost), 2);//本月实际成本
//row[11] = decimal.Round(Convert.ToDecimal(detail.ThisPlanValue), 2);//本月计划完成预算
//row[12] = decimal.Round(Convert.ToDecimal(detail.ThisPlanCost), 2);//本月完成预算
//row[13] = decimal.Round(Convert.ToDecimal(detail.TotalPlanNum), 2);//累计计划完成量
//row[14] = decimal.Round(Convert.ToDecimal(detail.TotalThisNum), 2);//累计完成量
//row[15] = decimal.Round(Convert.ToDecimal(detail.TotalRealCost), 2);//累计完成成本
//row[16] = decimal.Round(Convert.ToDecimal(detail.TotalPlanValue), 2);//累计计划完成预算
//row[17] = decimal.Round(Convert.ToDecimal(detail.TotalPlanCost), 2);//累计完成预算
}
else
{
//Model.View_WBS_CostControlParentDetail parentDetail = parentDetails.FirstOrDefault(x => x.ParentId == item.Id && x.Months == months);
//if (parentDetail != null)
//{
// row[10] = decimal.Round(Convert.ToDecimal(parentDetail.ThisRealCost), 2);//本月实际成本
// row[11] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanValue), 2);//本月计划完成预算
// row[12] = decimal.Round(Convert.ToDecimal(parentDetail.ThisPlanCost), 2);//本月完成预算
// row[15] = decimal.Round(Convert.ToDecimal(parentDetail.TotalRealCost), 2);//累计完成成本
// row[16] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanValue), 2);//累计计划完成预算
// row[17] = decimal.Round(Convert.ToDecimal(parentDetail.TotalPlanCost), 2);//累计完成预算
//}
//else
//{
// Model.View_WBS_CostControlParentDetail parentLastDetail = parentDetails.OrderByDescending(x => x.Months).FirstOrDefault(x => x.ParentId == item.Id);
// if (parentLastDetail != null && parentLastDetail.Months <= months)
// {
// row[15] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalRealCost), 2);//累计完成成本
// row[16] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanValue), 2);//累计计划完成预算
// row[17] = decimal.Round(Convert.ToDecimal(parentLastDetail.TotalPlanCost), 2);//累计完成预算
// }
//}
}
table.Rows.Add(row);
}
}
return table;
}
}
}

View File

@ -109,6 +109,9 @@
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
Hidden="true">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
</Items>
</f:Toolbar>
@ -154,19 +157,19 @@
<f:TemplateField ColumnID="State" Width="100px" HeaderText="审批状态" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# ConvertState(Eval("State")) %>'></asp:Label>
<asp:Label ID="lblState" runat="server" Text='<%# ConvertState(Eval("State")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:TemplateField ColumnID="AuditMan" Width="80px" HeaderText="办理人" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="Label41" runat="server" Text='<%# ConvertMan(Eval("CheckControlCode")) %>'></asp:Label>
<asp:Label ID="lblAuditMan" runat="server" Text='<%# ConvertMan(Eval("CheckControlCode")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:TemplateField ColumnID="State2" Width="80px" HeaderText="整改状态" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="False">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Convertstatus(Eval("CheckControlCode")) %>'></asp:Label>
<asp:Label ID="lblState2" runat="server" Text='<%# Convertstatus(Eval("CheckControlCode")) %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
</Columns>

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FineUIPro.Web.CQMS.Check
@ -567,5 +568,24 @@ namespace FineUIPro.Web.CQMS.Check
txtEndTime.Text = "";
BindGrid();
}
#region
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = Funs.GetNewFileName();
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("质量巡检" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = Encoding.UTF8;
this.Grid1.PageSize = Grid1.RecordCount;
this.BindGrid();
Response.Write(GetGridTableHtml2(Grid1));
Response.End();
}
#endregion
}
}

View File

@ -156,6 +156,15 @@ namespace FineUIPro.Web.CQMS.Check {
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// lblPageIndex 控件。
/// </summary>
@ -166,31 +175,31 @@ namespace FineUIPro.Web.CQMS.Check {
protected global::System.Web.UI.WebControls.Label lblPageIndex;
/// <summary>
/// Label1 控件。
/// lblState 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label1;
protected global::System.Web.UI.WebControls.Label lblState;
/// <summary>
/// Label41 控件。
/// lblAuditMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label41;
protected global::System.Web.UI.WebControls.Label lblAuditMan;
/// <summary>
/// Label2 控件。
/// lblState2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label Label2;
protected global::System.Web.UI.WebControls.Label lblState2;
/// <summary>
/// ToolbarSeparator1 控件。

View File

@ -74,8 +74,8 @@
</f:DatePicker>
<%--<f:DropDownList ID="drpWeek" runat="server" Label="周" LabelAlign="right" AutoPostBack="true" OnSelectedIndexChanged="drpWeek_SelectedIndexChanged"></f:DropDownList>--%>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<%--<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" Hidden="true" OnClick="btnSave_Click">
</f:Button>--%>
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" Hidden="true" OnClick="btnImport_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
@ -133,6 +133,10 @@
Target="Self" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
Width="1400px" Height="650px">
</f:Window>
<f:Window ID="Window2" Title="项目情况" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Self" EnableResize="true" runat="server" OnClose="Window1_Close" IsModal="true"
Width="1400px" Height="650px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<f:MenuButton ID="btnMenuEdit" OnClick="btnMenuEdit_Click" EnablePostBack="true" Icon="Pencil"
runat="server" Text="录入" Hidden="true">

View File

@ -960,6 +960,7 @@ namespace FineUIPro.Web.JDGL.WBS
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnMenuEdit.Hidden = false;
this.btnImport.Hidden = false;
}
}
}
@ -1009,5 +1010,17 @@ namespace FineUIPro.Web.JDGL.WBS
{
BindGrid();
}
#region
/// <summary>
/// 导入按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("WorkloadInputIn.aspx?ProjectId={0}", this.CurrUser.LoginProjectId, "导入 - ")));
}
#endregion
}
}

View File

@ -102,6 +102,15 @@ namespace FineUIPro.Web.JDGL.WBS {
/// </remarks>
protected global::FineUIPro.DatePicker txtMonths;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// ToolbarSeparator1 控件。
/// </summary>
@ -138,6 +147,15 @@ namespace FineUIPro.Web.JDGL.WBS {
/// </remarks>
protected global::FineUIPro.Window Window1;
/// <summary>
/// Window2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window Window2;
/// <summary>
/// Menu1 控件。
/// </summary>

View File

@ -8,67 +8,54 @@
</head>
<body>
<form id="form1" runat="server">
<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="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
<Items>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
<f:Button ID="btnAudit" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
</Items>
</f:Toolbar>
</Toolbars>
<Rows>
<f:FormRow>
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" runat="server" Margin="5px" BodyPadding="5px" ShowBorder="false"
ShowHeader="false" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="项目情况" BoxFlex="1" AllowColumnLocking="true"
runat="server" EnableCollapse="true" DataKeyNames="Id,Name" EnableTree="true" EnableColumnLines="true"
TreeColumn="Name" DataIDField="Id" DataParentIDField="SupId" ExpandAllTreeNodes="true" >
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server">
<Items>
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
LabelWidth="150px">
</f:FileUpload>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1"
OnClick="btnAudit_Click">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" runat="server"
OnClick="btnImport_Click">
</f:Button>
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" ToolTip="导出" Icon="FolderUp"
EnableAjax="false" DisableControlBeforePostBack="false">
</f:Button>
<f:HiddenField ID="hdCheckResult" runat="server">
</f:HiddenField>
<f:HiddenField ID="hdFileName" runat="server">
</f:HiddenField>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="管线信息"
EnableCollapse="true" runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true"
AllowColumnLocking="true" EnableColumnLines="true" ClicksToEdit="2" DataIDField="Id"
AllowSorting="true" SortField="Id" SortDirection="ASC"
AllowPaging="true" IsDatabasePaging="true" PageSize="1000"
EnableTextSelection="True">
<Columns>
<f:TemplateField ColumnID="tfPageIndex" Width="55px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
EnableLock="true" Locked="true">
<ItemTemplate>
<asp:Label ID="lblPageIndex" runat="server" Text='<%# Grid1.PageIndex * Grid1.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
</ItemTemplate>
</f:TemplateField>
<f:RenderField Width="150px" ColumnID="Name1" DataField="Name1" FieldType="String" EnableLock="true" Locked="true"
HeaderText="分部" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="Name2" DataField="Name2" FieldType="String" EnableLock="true" Locked="true"
HeaderText="分项" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="200px" ColumnID="Name3" DataField="Name3" FieldType="String" EnableLock="true" Locked="true"
HeaderText="费控项内容" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="TotalNum" DataField="TotalNum" FieldType="Double" EnableLock="true" Locked="true"
HeaderText="合同工作量" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="PlanPrice" DataField="PlanPrice" FieldType="Double" EnableLock="true" Locked="true"
HeaderText="预算单价" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="RealPrice" DataField="RealPrice" FieldType="Double" EnableLock="true" Locked="true"
HeaderText="实际单价" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:FormRow>
</Rows>
</f:Form>
</f:Toolbar>
</Toolbars>
<Columns>
<%--<f:RowNumberField HeaderText="序号"/>--%>
<f:BoundField Width="350px" ColumnID="Name" DataField="Name" HeaderTextAlign="Center" EnableLock="true" Locked="true"
HeaderText="工作内容" />
<f:BoundField Width="100px" DataField="Unit" HeaderText="单位" TextAlign="Center" EnableLock="true" Locked="true"/>
<f:RenderField Width="100px" ColumnID="TotalNum" DataField="TotalNum" FieldType="Double" EnableLock="true" Locked="true"
HeaderText="合同工作量" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="PlanPrice" DataField="PlanPrice" FieldType="Double" EnableLock="true" Locked="true"
HeaderText="预算单价" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="RealPrice" DataField="RealPrice" FieldType="Double" EnableLock="true" Locked="true"
HeaderText="实际单价" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:Panel>
</form>
</body>
</html>

View File

@ -4,6 +4,7 @@ using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
@ -13,36 +14,36 @@ namespace FineUIPro.Web.JDGL.WBS
{
public partial class WorkloadInputIn : PageBase
{
#region
/// <summary>
/// 控制项主键
/// 列数量
/// </summary>
public string Id
public int ColumnNum
{
get
{
return (string)ViewState["Id"];
return (int)ViewState["ColumnNum"];
}
set
{
ViewState["Id"] = value;
ViewState["ColumnNum"] = value;
}
}
#region
/// <summary>
/// 上传预设的虚拟路径
/// </summary>
private string initPath = Const.ExcelUrl;
/// <summary>
/// 安装组件集合
/// </summary>
public static List<Model.View_HJGL_Pipeline> PipelineList = new List<Model.View_HJGL_Pipeline>();
/// <summary>
/// 错误集合
/// </summary>
public static string errorInfos = string.Empty;
/// <summary>
/// 月份集合
/// </summary>
public static List<DateTime> months = new List<DateTime>();
#endregion
/// <summary>
@ -59,47 +60,62 @@ namespace FineUIPro.Web.JDGL.WBS
/// </summary>
private void InitGrid()
{
this.Id = Request.Params["Id"];
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(Id);
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
if (wbsSet != null && wbsSet.StartDate != null && wbsSet.EndDate != null)
ColumnNum = 0;
months.Clear();
var installation = Funs.DB.Project_Installation.FirstOrDefault(x => x.SuperInstallationId == "0" && x.ProjectId == this.CurrUser.LoginProjectId);
if (installation != null)
{
startDate = Convert.ToDateTime(wbsSet.StartDate);
endDate = Convert.ToDateTime(wbsSet.EndDate);
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
DateTime startDate, endDate, startMonth, endMonth;
if (installation.StartDate != null && installation.EndDate != null)
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
for (int i = 0; i < months.Count; i++)
{
//GroupField gd = new GroupField();
//gd.HeaderText = string.Format("{0:yyyy-MM}", months[i]);
//gd.HeaderTextAlign = TextAlign.Center;
startDate = Convert.ToDateTime(installation.StartDate);
endDate = Convert.ToDateTime(installation.EndDate);
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
for (int i = 0; i < months.Count; i++)
{
RenderField rdPlan = new RenderField();
rdPlan.ColumnID = string.Format("{0:yyyy-MM}", months[i]) + "Plan";
rdPlan.Width = Unit.Pixel(100);
rdPlan.DataField = "PlanNum" + (i + 1).ToString();
rdPlan.FieldType = FieldType.Double;
rdPlan.HeaderText = string.Format("{0:yyyy年MM月}", months[i]) + "<br/>计划量";
rdPlan.HeaderTextAlign = TextAlign.Center;
NumberBox numPlan = new NumberBox();
numPlan.NoNegative = true;
numPlan.NoDecimal = false;
rdPlan.Editor.Add(numPlan);
Grid1.Columns.Add(rdPlan);
RenderField rdPlan = new RenderField();
rdPlan.ColumnID = string.Format("{0:yyyy-MM}", months[i]) + "Plan";
rdPlan.Width = Unit.Pixel(100);
rdPlan.DataField = "PlanNum" + (i + 1).ToString();
rdPlan.FieldType = FieldType.Double;
rdPlan.HeaderText = string.Format("{0:yyyy年MM月}", months[i]) + "<br/>计划量";
rdPlan.HeaderTextAlign = TextAlign.Center;
Grid1.Columns.Add(rdPlan);
RenderField rdThis = new RenderField();
rdThis.ColumnID = string.Format("{0:yyyy-MM}", months[i]) + "This";
rdThis.Width = Unit.Pixel(100);
rdThis.DataField = "ThisNum" + (i + 1).ToString();
rdThis.FieldType = FieldType.Double;
rdThis.HeaderText = string.Format("{0:yyyy年MM月}", months[i]) + "<br/>完成量";
rdThis.HeaderTextAlign = TextAlign.Center;
Grid1.Columns.Add(rdThis);
//Grid1.Columns.Add(gd);
RenderField rdThis = new RenderField();
rdThis.ColumnID = string.Format("{0:yyyy-MM}", months[i]) + "This";
rdThis.Width = Unit.Pixel(100);
rdThis.DataField = "ThisNum" + (i + 1).ToString();
rdThis.FieldType = FieldType.Double;
rdThis.HeaderText = string.Format("{0:yyyy年MM月}", months[i]) + "<br/>完成量";
rdThis.HeaderTextAlign = TextAlign.Center;
NumberBox numReal = new NumberBox();
numReal.NoNegative = true;
numReal.NoDecimal = false;
rdThis.Editor.Add(numReal);
Grid1.Columns.Add(rdThis);
}
RenderField rdId = new RenderField();
rdId.ColumnID = "ShowId";
rdId.Width = Unit.Pixel(350);
rdId.DataField = "ShowId";
rdId.FieldType = FieldType.String;
rdId.HeaderText = "ShowId";
rdId.HeaderTextAlign = TextAlign.Center;
Grid1.Columns.Add(rdId);
rdId.Hidden = true;
ColumnNum = 5 + months.Count * 2 + 1;
}
}
#endregion
@ -114,20 +130,45 @@ namespace FineUIPro.Web.JDGL.WBS
{
if (!IsPostBack)
{
this.hdFileName.Text = string.Empty;
this.Id = Request.Params["Id"];
if (PipelineList != null)
{
PipelineList.Clear();
}
errorInfos = string.Empty;
this.hdFileName.Text = string.Empty;
this.hdCheckResult.Text = string.Empty;
DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty);
Grid1.DataSource = table;
Grid1.DataBind();
}
}
#endregion
#region
#region
/// 导出按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
string filename = Funs.GetNewFileName();
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("项目进度情况" + filename, System.Text.Encoding.UTF8) + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = Encoding.UTF8;
this.Grid1.Columns[ColumnNum - 1].Hidden = false;
DataTable tableOut = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, "Out");
Grid1.DataSource = tableOut;
Grid1.DataBind();
this.Grid1.PageSize = Grid1.RecordCount;
Response.Write(GetGridTableHtml2(Grid1));
Response.End();
this.Grid1.Columns[ColumnNum - 1].Hidden = true;
DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty);
Grid1.DataSource = table;
Grid1.DataBind();
}
#endregion
#region
/// <summary>
/// 导入
/// 审核
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@ -146,14 +187,6 @@ namespace FineUIPro.Web.JDGL.WBS
ShowNotify("只可以选择Excel文件", MessageBoxIcon.Warning);
return;
}
if (PipelineList != null)
{
PipelineList.Clear();
}
if (!string.IsNullOrEmpty(errorInfos))
{
errorInfos = string.Empty;
}
string rootPath = Server.MapPath("~/");
string initFullPath = rootPath + initPath;
if (!Directory.Exists(initFullPath))
@ -208,28 +241,12 @@ namespace FineUIPro.Web.JDGL.WBS
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(Id);
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
if (wbsSet != null && wbsSet.StartDate != null && wbsSet.EndDate != null)
{
startDate = Convert.ToDateTime(wbsSet.StartDate);
endDate = Convert.ToDateTime(wbsSet.EndDate);
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
AddDatasetToSQL(ds.Tables[0], 7 + months.Count * 2);
hdCheckResult.Text = "1";
AddDatasetToSQL(ds.Tables[0], ColumnNum);
}
catch (Exception exc)
{
Response.Write(exc);
//return null;
// return dt;
}
}
#endregion
@ -246,231 +263,56 @@ namespace FineUIPro.Web.JDGL.WBS
string result = string.Empty;
int ic, ir;
ic = pds.Columns.Count;
ir = pds.Rows.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
return false;
}
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
Model.Wbs_WbsSet wbsSet1 = BLL.WbsSetService.GetWbsSetByWbsSetId(Id);
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
if (wbsSet1 != null && wbsSet1.StartDate != null && wbsSet1.EndDate != null)
{
startDate = Convert.ToDateTime(wbsSet1.StartDate);
endDate = Convert.ToDateTime(wbsSet1.EndDate);
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
Dictionary<int, string> editRows = new Dictionary<int, string>();
int a = 0;
var childWbsSets = BLL.WbsSetService.GetApproveWbsSetsBySuperWbsSetId(Id);
foreach (var childWbsSet in childWbsSets)
{
a++;
var costControls = BLL.CostControlService.GetSelectedCostControlsByWbsSetId(childWbsSet.WbsSetId);
foreach (var costControl in costControls)
{
a++;
editRows.Add(a, costControl.CostControlId);
}
}
var oldViewInfos = from x in Funs.DB.WBS_CostControl
where x.ProjectId == this.CurrUser.LoginProjectId
select x;
var units = from x in Funs.DB.Base_Unit
select x;
for (int i = 0; i < ir; i++)
{
if (editRows.ContainsKey(i))
Model.WBS_CostControl oldViewInfo = oldViewInfos.FirstOrDefault(x => x.CostControlId == pds.Rows[i][Cols - 1].ToString());
if (oldViewInfo != null)
{
string totalNum = pds.Rows[i][4].ToString();
string planPrice = pds.Rows[i][5].ToString();
string realPrice = pds.Rows[i][6].ToString();
if (!string.IsNullOrEmpty(totalNum))
for (int j = 2; j < Cols - 1; j++)
{
try
{
decimal d = Convert.ToDecimal(totalNum);
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + "合同工作量格式输入有误" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "合同工作量" + "," + "此项为必填项!" + "|";
}
if (!string.IsNullOrEmpty(planPrice))
{
try
{
decimal d = Convert.ToDecimal(planPrice);
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + "预算单价格式输入有误" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "预算单价" + "," + "此项为必填项!" + "|";
}
if (!string.IsNullOrEmpty(realPrice))
{
try
{
decimal d = Convert.ToDecimal(realPrice);
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + "实际单价格式输入有误" + "|";
}
}
else
{
result += "第" + (i + 2).ToString() + "行," + "实际单价" + "," + "此项为必填项!" + "|";
}
for (int j = 0; j < months.Count; j++)
{
string planNum = pds.Rows[i][7 + j * 2].ToString();
string thisNum = pds.Rows[i][8 + j * 2].ToString();
if (!string.IsNullOrEmpty(planNum))
string row = pds.Rows[i][j].ToString();
if (!string.IsNullOrEmpty(row))
{
try
{
decimal d = Convert.ToDecimal(planNum);
decimal d = Convert.ToDecimal(row.Trim());
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + string.Format("{0:yyyy年MM月}", months[j]) + "计划量格式输入有误" + "|";
}
}
if (!string.IsNullOrEmpty(thisNum))
{
try
{
decimal d = Convert.ToDecimal(thisNum);
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + string.Format("{0:yyyy年MM月}", months[j]) + "完成量格式输入有误" + "|";
}
}
}
}
}
decimal changeThisPlanValue = 0, changeThisRealCost = 0, changeThisPlanCost = 0, //当月总变化完成成本、完成预算
oldThisPlanValue = 0, oldThisRealCost = 0, oldThisPlanCost = 0,
thisPlanValue = 0, thisRealCost = 0, thisPlanCost = 0;
if (string.IsNullOrEmpty(result))
{
for (int i = 0; i < ir; i++)
{
if (editRows.ContainsKey(i))
{
string costControlId = editRows.First(x => x.Key == i).Value;
Model.WBS_CostControl costControl = BLL.CostControlService.GetCostControlByCostControlId(costControlId);
if (costControl != null)
{
string totalNum = pds.Rows[i][4].ToString();
string planPrice = pds.Rows[i][5].ToString();
string realPrice = pds.Rows[i][6].ToString();
costControl.TotalNum = Funs.GetNewDecimal(totalNum);
costControl.PlanPrice = Funs.GetNewDecimal(planPrice);
costControl.RealPrice = Funs.GetNewDecimal(realPrice);
BLL.CostControlService.UpdateCostControl(costControl);
for (int j = 0; j < months.Count; j++)
{
oldThisPlanValue = 0;
oldThisRealCost = 0;
oldThisPlanCost = 0;
changeThisPlanValue = 0;
changeThisRealCost = 0;
changeThisPlanCost = 0;
string planNum = pds.Rows[i][7 + j * 2].ToString();
string thisNum = pds.Rows[i][8 + j * 2].ToString();
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(costControlId, months[j]);
if (costControlDetail != null)
if (j == 2)
{
oldThisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(thisNum);
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.UpdateCostControlDetail(costControlDetail);
result += "第" + (i + 2).ToString() + "行," + "合同工作量" + "," + "[" + row + "]格式错误!" + "|";
}
else if (j == 3)
{
result += "第" + (i + 2).ToString() + "行," + "预算单价" + "," + "[" + row + "]格式错误!" + "|";
}
else if (j == 4)
{
result += "第" + (i + 2).ToString() + "行," + "实际单价" + "," + "[" + row + "]格式错误!" + "|";
}
else if (j % 2 == 1) //奇数列
{
result += "第" + (i + 2).ToString() + "行," + string.Format("{0:yyyy-MM}", months[j - 5]) + "计划量" + "," + "[" + row + "]格式错误!" + "|";
}
else
{
costControlDetail = new Model.WBS_CostControlDetail();
costControlDetail.CostControlDetailId = SQLHelper.GetNewID();
costControlDetail.CostControlId = costControlId;
costControlDetail.Months = months[j];
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(thisNum);
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
result += "第" + (i + 2).ToString() + "行," + string.Format("{0:yyyy-MM}", months[j - 5]) + "完成量" + "," + "[" + row + "]格式错误!" + "|";
}
//累加变化值,计算总的变化值
changeThisPlanValue += thisPlanValue - oldThisPlanValue;
changeThisRealCost += thisRealCost - oldThisRealCost;
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
//更新工作包、工作项
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(costControl.WbsSetId);
UpdateWbsSetDetail(costControl.WbsSetId, months[j], changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//更新分部
Model.WBS_CostControlParentDetail unitProjectDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.UnitProjectId, months[j]);
if (unitProjectDetail != null)
{
unitProjectDetail.ThisPlanValue += changeThisPlanValue;
unitProjectDetail.ThisRealCost += changeThisRealCost;
unitProjectDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(unitProjectDetail);
}
else
{
unitProjectDetail = new Model.WBS_CostControlParentDetail();
unitProjectDetail.CostControlParentDetailId = SQLHelper.GetNewID();
unitProjectDetail.ParentId = wbsSet.UnitProjectId;
unitProjectDetail.Months = months[j];
unitProjectDetail.ThisPlanValue = changeThisPlanValue;
unitProjectDetail.ThisRealCost = changeThisRealCost;
unitProjectDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(unitProjectDetail);
}
//更新专业
if (!string.IsNullOrEmpty(wbsSet.CnProfessionId))
{
Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.CnProfessionId, months[j]);
if (cnProfessionDetail != null)
{
cnProfessionDetail.ThisPlanValue += changeThisPlanValue;
cnProfessionDetail.ThisRealCost += changeThisRealCost;
cnProfessionDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(cnProfessionDetail);
}
else
{
cnProfessionDetail = new Model.WBS_CostControlParentDetail();
cnProfessionDetail.CostControlParentDetailId = SQLHelper.GetNewID();
cnProfessionDetail.ParentId = wbsSet.CnProfessionId;
cnProfessionDetail.Months = months[j];
cnProfessionDetail.ThisPlanValue = changeThisPlanValue;
cnProfessionDetail.ThisRealCost = changeThisRealCost;
cnProfessionDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(cnProfessionDetail);
}
}
//更新装置
UpdateInstallationDetail(wbsSet.InstallationId, months[j], changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
}
}
}
@ -478,172 +320,233 @@ namespace FineUIPro.Web.JDGL.WBS
}
if (!string.IsNullOrEmpty(result))
{
PipelineList.Clear();
result = result.Substring(0, result.LastIndexOf("|"));
errorInfos = result;
Alert alert = new Alert();
alert.Message = result;
alert.Target = Target.Self;
Alert alert = new Alert
{
Message = result,
Target = Target.Self
};
alert.Show();
}
else
{
errorInfos = string.Empty;
ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
}
}
else
{
ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
}
return true;
}
#endregion
#endregion
#region
/// <summary>
/// 导入
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnImport_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(hdCheckResult.Text))
{
if (string.IsNullOrEmpty(errorInfos))
{
string rootPath = Server.MapPath("~/");
ImportXlsToData2(rootPath + initPath + this.hdFileName.Text);
hdCheckResult.Text = string.Empty;
ShowNotify("导入成功!", MessageBoxIcon.Success);
List<Model.CostControlDetailItem> itemList = new List<Model.CostControlDetailItem>();
Model.CostControlDetailItem item1 = new Model.CostControlDetailItem();
item1.Id = Id;
item1.Name1 = wbsSet1.WbsSetName;
itemList.Add(item1);
var childWbsSets1 = BLL.WbsSetService.GetApproveWbsSetsBySuperWbsSetId(Id);
foreach (var childWbsSet in childWbsSets1)
DataTable table = BLL.WorkloadStatisticsService.GetAllTreeDataTable(this.CurrUser.LoginProjectId, string.Empty);
Grid1.DataSource = table;
Grid1.DataBind();
}
else
{
ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
}
}
else
{
ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
}
}
#region Excel提取数据
/// <summary>
/// 从Excel提取数据--》Dataset
/// </summary>
/// <param name="filename">Excel文件路径名</param>
private void ImportXlsToData2(string fileName)
{
try
{
string oleDBConnString = String.Empty;
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
DataSet ds = new DataSet();
oleDBConn = new OleDbConnection(oleDBConnString);
oleDBConn.Open();
m_tableName = oleDBConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
if (m_tableName != null && m_tableName.Rows.Count > 0)
{
m_tableName.TableName = m_tableName.Rows[0]["TABLE_NAME"].ToString().Trim();
}
string sqlMaster;
sqlMaster = " SELECT * FROM [" + m_tableName.TableName + "]";
oleAdMaster = new OleDbDataAdapter(sqlMaster, oleDBConn);
oleAdMaster.Fill(ds, "m_tableName");
oleAdMaster.Dispose();
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], ColumnNum);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Dataset的数据导入数据库
/// <summary>
/// 将Dataset的数据导入数据库
/// </summary>
/// <param name="pds">数据集</param>
/// <param name="Cols">数据集列数</param>
/// <returns></returns>
private bool AddDatasetToSQL2(DataTable pds, int Cols)
{
int ic, ir;
ic = pds.Columns.Count;
if (ic < Cols)
{
ShowNotify("导入Excel格式错误Excel只有" + ic.ToString().Trim() + "列", MessageBoxIcon.Warning);
}
string result = string.Empty;
ir = pds.Rows.Count;
if (pds != null && ir > 0)
{
var oldViewInfos = from x in Funs.DB.WBS_CostControl
where x.ProjectId == this.CurrUser.LoginProjectId
select x;
decimal changeThisPlanValue = 0, changeThisRealCost = 0, changeThisPlanCost = 0, //当月总变化完成成本、完成预算
oldThisPlanValue = 0, oldThisRealCost = 0, oldThisPlanCost = 0,
thisPlanValue = 0, thisRealCost = 0, thisPlanCost = 0;
for (int i = 0; i < ir; i++)
{
Model.WBS_CostControl costControl = oldViewInfos.FirstOrDefault(x => x.CostControlId == pds.Rows[i][Cols - 1].ToString());
if (costControl != null)
{
Model.CostControlDetailItem item2 = new Model.CostControlDetailItem();
item2.Id = childWbsSet.WbsSetId;
item2.Name2 = childWbsSet.WbsSetName;
itemList.Add(item2);
var costControls = BLL.CostControlService.GetSelectedCostControlsByWbsSetId(childWbsSet.WbsSetId);
foreach (var costControl in costControls)
costControl.TotalNum = Funs.GetNewDecimal(pds.Rows[i][2].ToString().Trim());
costControl.PlanPrice = Funs.GetNewDecimal(pds.Rows[i][3].ToString().Trim());
costControl.RealPrice = Funs.GetNewDecimal(pds.Rows[i][4].ToString().Trim());
BLL.CostControlService.UpdateCostControl(costControl);
for (int j = 0; j < months.Count; j++)
{
Model.CostControlDetailItem item3 = new Model.CostControlDetailItem();
item3.Id = costControl.CostControlId;
item3.Name3 = costControl.CostControlName;
item3.TotalNum = costControl.TotalNum;
item3.PlanPrice = costControl.PlanPrice;
item3.RealPrice = costControl.RealPrice;
for (int j = 0; j < months.Count; j++)
oldThisPlanValue = 0;
oldThisRealCost = 0;
oldThisPlanCost = 0;
changeThisPlanValue = 0;
changeThisRealCost = 0;
changeThisPlanCost = 0;
string planNum = pds.Rows[i][5 + j * 2].ToString().Trim();
string thisNum = pds.Rows[i][6 + j * 2].ToString().Trim();
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(costControl.CostControlId, months[j]);
if (costControlDetail != null)
{
Model.WBS_CostControlDetail costControlDetail = BLL.CostControlDetailService.GetCostControlDetailByCostControlIdAndMonths(costControl.CostControlId, months[j]);
if (costControlDetail != null)
oldThisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
oldThisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
oldThisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(thisNum);
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.UpdateCostControlDetail(costControlDetail);
}
else
{
costControlDetail = new Model.WBS_CostControlDetail();
costControlDetail.CostControlDetailId = SQLHelper.GetNewID();
costControlDetail.CostControlId = costControl.CostControlId;
costControlDetail.Months = months[j];
costControlDetail.PlanNum = Funs.GetNewDecimalOrZero(planNum);
costControlDetail.ThisNum = Funs.GetNewDecimalOrZero(thisNum);
thisPlanValue = (costControlDetail.PlanNum ?? 0) * (costControl.PlanPrice ?? 0);
thisRealCost = (costControlDetail.ThisNum ?? 0) * (costControl.RealPrice ?? 0);
thisPlanCost = (costControlDetail.ThisNum ?? 0) * (costControl.PlanPrice ?? 0);
BLL.CostControlDetailService.AddCostControlDetail(costControlDetail);
}
//累加变化值,计算总的变化值
changeThisPlanValue += thisPlanValue - oldThisPlanValue;
changeThisRealCost += thisRealCost - oldThisRealCost;
changeThisPlanCost += thisPlanCost - oldThisPlanCost;
//更新工作包、工作项
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(costControl.WbsSetId);
UpdateWbsSetDetail(costControl.WbsSetId, months[j], changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
//更新分部
Model.WBS_CostControlParentDetail unitProjectDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.UnitProjectId, months[j]);
if (unitProjectDetail != null)
{
unitProjectDetail.ThisPlanValue += changeThisPlanValue;
unitProjectDetail.ThisRealCost += changeThisRealCost;
unitProjectDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(unitProjectDetail);
}
else
{
unitProjectDetail = new Model.WBS_CostControlParentDetail();
unitProjectDetail.CostControlParentDetailId = SQLHelper.GetNewID();
unitProjectDetail.ParentId = wbsSet.UnitProjectId;
unitProjectDetail.Months = months[j];
unitProjectDetail.ThisPlanValue = changeThisPlanValue;
unitProjectDetail.ThisRealCost = changeThisRealCost;
unitProjectDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(unitProjectDetail);
}
//更新专业
if (!string.IsNullOrEmpty(wbsSet.CnProfessionId))
{
Model.WBS_CostControlParentDetail cnProfessionDetail = BLL.CostControlParentDetailService.GetCostControlParentDetailByParentIdAndMonths(wbsSet.CnProfessionId, months[j]);
if (cnProfessionDetail != null)
{
if (j == 0)
{
item3.PlanNum1 = costControlDetail.PlanNum;
item3.ThisNum1 = costControlDetail.ThisNum;
}
else if (j == 1)
{
item3.PlanNum2 = costControlDetail.PlanNum;
item3.ThisNum2 = costControlDetail.ThisNum;
}
else if (j == 2)
{
item3.PlanNum3 = costControlDetail.PlanNum;
item3.ThisNum3 = costControlDetail.ThisNum;
}
else if (j == 3)
{
item3.PlanNum4 = costControlDetail.PlanNum;
item3.ThisNum4 = costControlDetail.ThisNum;
}
else if (j == 4)
{
item3.PlanNum5 = costControlDetail.PlanNum;
item3.ThisNum5 = costControlDetail.ThisNum;
}
else if (j == 5)
{
item3.PlanNum6 = costControlDetail.PlanNum;
item3.ThisNum6 = costControlDetail.ThisNum;
}
else if (j == 6)
{
item3.PlanNum7 = costControlDetail.PlanNum;
item3.ThisNum7 = costControlDetail.ThisNum;
}
else if (j == 7)
{
item3.PlanNum8 = costControlDetail.PlanNum;
item3.ThisNum8 = costControlDetail.ThisNum;
}
else if (j == 8)
{
item3.PlanNum9 = costControlDetail.PlanNum;
item3.ThisNum9 = costControlDetail.ThisNum;
}
else if (j == 9)
{
item3.PlanNum10 = costControlDetail.PlanNum;
item3.ThisNum10 = costControlDetail.ThisNum;
}
else if (j == 10)
{
item3.PlanNum11 = costControlDetail.PlanNum;
item3.ThisNum11 = costControlDetail.ThisNum;
}
else if (j == 11)
{
item3.PlanNum12 = costControlDetail.PlanNum;
item3.ThisNum12 = costControlDetail.ThisNum;
}
else if (j == 12)
{
item3.PlanNum13 = costControlDetail.PlanNum;
item3.ThisNum13 = costControlDetail.ThisNum;
}
else if (j == 13)
{
item3.PlanNum14 = costControlDetail.PlanNum;
item3.ThisNum14 = costControlDetail.ThisNum;
}
else if (j == 14)
{
item3.PlanNum15 = costControlDetail.PlanNum;
item3.ThisNum15 = costControlDetail.ThisNum;
}
else if (j == 15)
{
item3.PlanNum16 = costControlDetail.PlanNum;
item3.ThisNum16 = costControlDetail.ThisNum;
}
else if (j == 16)
{
item3.PlanNum17 = costControlDetail.PlanNum;
item3.ThisNum17 = costControlDetail.ThisNum;
}
else if (j == 17)
{
item3.PlanNum18 = costControlDetail.PlanNum;
item3.ThisNum18 = costControlDetail.ThisNum;
}
else if (j == 18)
{
item3.PlanNum19 = costControlDetail.PlanNum;
item3.ThisNum19 = costControlDetail.ThisNum;
}
else if (j == 19)
{
item3.PlanNum20 = costControlDetail.PlanNum;
item3.ThisNum20 = costControlDetail.ThisNum;
}
else if (j == 20)
{
item3.PlanNum21 = costControlDetail.PlanNum;
item3.ThisNum21 = costControlDetail.ThisNum;
}
else if (j == 21)
{
item3.PlanNum22 = costControlDetail.PlanNum;
item3.ThisNum22 = costControlDetail.ThisNum;
}
else if (j == 22)
{
item3.PlanNum23 = costControlDetail.PlanNum;
item3.ThisNum23 = costControlDetail.ThisNum;
}
else if (j == 23)
{
item3.PlanNum24 = costControlDetail.PlanNum;
item3.ThisNum24 = costControlDetail.ThisNum;
}
cnProfessionDetail.ThisPlanValue += changeThisPlanValue;
cnProfessionDetail.ThisRealCost += changeThisRealCost;
cnProfessionDetail.ThisPlanCost += changeThisPlanCost;
BLL.CostControlParentDetailService.UpdateCostControlParentDetail(cnProfessionDetail);
}
else
{
cnProfessionDetail = new Model.WBS_CostControlParentDetail();
cnProfessionDetail.CostControlParentDetailId = SQLHelper.GetNewID();
cnProfessionDetail.ParentId = wbsSet.CnProfessionId;
cnProfessionDetail.Months = months[j];
cnProfessionDetail.ThisPlanValue = changeThisPlanValue;
cnProfessionDetail.ThisRealCost = changeThisRealCost;
cnProfessionDetail.ThisPlanCost = changeThisPlanCost;
BLL.CostControlParentDetailService.AddCostControlParentDetail(cnProfessionDetail);
}
}
itemList.Add(item3);
//更新装置
UpdateInstallationDetail(wbsSet.InstallationId, months[j], changeThisPlanValue, changeThisRealCost, changeThisPlanCost);
}
}
this.Grid1.DataSource = itemList;
this.Grid1.DataBind();
}
ShowNotify("导入成功!", MessageBoxIcon.Success);
}
else
{

View File

@ -31,49 +31,13 @@ namespace FineUIPro.Web.JDGL.WBS {
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// Panel1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
protected global::FineUIPro.Panel Panel1;
/// <summary>
/// Grid1 控件。
@ -85,12 +49,66 @@ namespace FineUIPro.Web.JDGL.WBS {
protected global::FineUIPro.Grid Grid1;
/// <summary>
/// lblPageIndex 控件。
/// Toolbar2 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblPageIndex;
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// fuAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.FileUpload fuAttachUrl;
/// <summary>
/// btnAudit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAudit;
/// <summary>
/// btnImport 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnImport;
/// <summary>
/// btnOut 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnOut;
/// <summary>
/// hdCheckResult 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCheckResult;
/// <summary>
/// hdFileName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdFileName;
}
}

View File

@ -1010,6 +1010,18 @@ namespace FineUIPro.Web
{
html = (row.FindControl("lbCheckManNames") as AspNet.Label).Text;
}
if (column.ColumnID == "State" && (row.FindControl("lblState") as AspNet.Label) != null)
{
html = (row.FindControl("lblState") as AspNet.Label).Text;
}
if (column.ColumnID == "AuditMan" && (row.FindControl("lblAuditMan") as AspNet.Label) != null)
{
html = (row.FindControl("lblAuditMan") as AspNet.Label).Text;
}
if (column.ColumnID == "State2" && (row.FindControl("lblState2") as AspNet.Label) != null)
{
html = (row.FindControl("lblState2") as AspNet.Label).Text;
}
// 处理CheckBox
if (html.Contains("f-grid-static-checkbox"))
{
@ -1022,7 +1034,18 @@ namespace FineUIPro.Web
html = "√";
}
}
sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@;width:140px;'>{0}</td>", html);
if (column.ColumnID == "Name")
{
sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@;width:640px;'>{0}</td>", html);
}
else if (column.ColumnID == "ShowId")
{
sb.AppendFormat("<td width:400px;'>{0}</td>", html);
}
else
{
sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@;width:140px;'>{0}</td>", html);
}
// sb.AppendFormat("<td>{0}</td>", html);
}
}

View File

@ -924,17 +924,9 @@
}
else if (value == 2) {
if (index == 0) {
//alert($('#hdContractQuantitySheets')[0].value);
$('#divGZL').html($('#hdContractQuantitySheets')[0].value);
//alert(swiper_One);
//$('#divGZL').html("1");
} else if (index == 2) {
//alert($('#hdMaterialRecords')[0].value);
$('#divGZL').html($('#hdMaterialRecords')[0].value);
//$('#divGZL').html("无");
//$('#divGZL').reload();
//$('#divGZL').html($('#hdMaterialRecords').value);
//$('#divGZL').html("2");
} else if (index == 4) {
} else if (index == 6) {

View File

@ -16,7 +16,17 @@ namespace FineUIPro.Web.common
if (!IsPostBack)
{
string roleCNs = Request.Params["roleCNs"];
string roleCNNames = string.Empty;
List<string> cns = Funs.GetStrListByStr(roleCNs, ',');
List<string> cnNames = new List<string>();
foreach (var cn in cns)
{
var c = BLL.CNProfessionalService.GetCNProfessional(cn);
if (c != null && !cnNames.Contains(c.ProfessionalName))
{
cnNames.Add(c.ProfessionalName);
}
}
Model.SGGLDB db = Funs.DB;
//未遂事故
//var wsAccidentList1 = from x in db.Accident_AccidentPersonRecord
@ -66,7 +76,7 @@ namespace FineUIPro.Web.common
//材料到货情况
string contractQuantitySheetsStr = string.Empty;
long projectId = BLL.ProjectService.GetCLProjectCodeByProjectId(this.CurrUser.LoginProjectId);
var contractQuantitySheets = from x in Funs.DB.CLGL_ContractQuantitySheet where x.ProjectId == projectId.ToString() select x;
var contractQuantitySheets = from x in Funs.DB.CLGL_ContractQuantitySheet where x.ProjectId == projectId.ToString() && cnNames.Contains(x.Major) select x;
if (contractQuantitySheets.Count() > 0)
{
contractQuantitySheetsStr = "<div class='jd-item'><div class='item jd-title'>序号</div><div class='item jd-title'>材料用途</div><div class='item jd-title'>合同号</div><div class='item jd-title'>专业</div><div class='item jd-title'>材料编码</div><div class='item jd-title'>位号</div><div class='item jd-title'>采购量</div><div class='item jd-title'>装置号</div><div class='item jd-title'>主项号</div><div class='item jd-title'>企业中文名称</div><div class='item jd-title'>备注</div></div>";
@ -92,7 +102,7 @@ namespace FineUIPro.Web.common
this.hdContractQuantitySheets.Value = contractQuantitySheetsStr;
//材料出库情况
string materialRecordsStr = string.Empty;
var materialRecords= from x in db.CLGL_PickMaterialRecord where x.ProjectId == projectId.ToString() select x;
var materialRecords= from x in db.CLGL_PickMaterialRecord where x.ProjectId == projectId.ToString() && cnNames.Contains(x.Major) select x;
if (contractQuantitySheets.Count() > 0)
{
materialRecordsStr = "<div class='jd-item'><div class='item jd-title'>序号</div><div class='item jd-title'>领料单号</div><div class='item jd-title'>领料时间</div><div class='item jd-title'>领料单位</div><div class='item jd-title'>领料截止时间</div><div class='item jd-title'>专业</div><div class='item jd-title'>材料编码</div><div class='item jd-title'>位号</div><div class='item jd-title'>申领量</div><div class='item jd-title'>批准量</div><div class='item jd-title'>实发量</div><div class='item jd-title'>装置号</div><div class='item jd-title'>主项号</div><div class='item jd-title'>发料备注</div></div>";
@ -121,38 +131,6 @@ namespace FineUIPro.Web.common
}
}
protected string swiper_One1
{
get
{
string contractQuantitySheetsStr = string.Empty;
long projectId = BLL.ProjectService.GetCLProjectCodeByProjectId(this.CurrUser.LoginProjectId);
var contractQuantitySheets = from x in Funs.DB.CLGL_ContractQuantitySheet where x.ProjectId == projectId.ToString() select x;
if (contractQuantitySheets.Count() > 0)
{
contractQuantitySheetsStr = "<div class='jd-item'><div class='item jd-title'>序号</div><div class='item jd-title'>材料用途</div><div class='item jd-title'>合同号</div><div class='item jd-title'>专业</div><div class='item jd-title'>材料编码</div><div class='item jd-title'>位号</div><div class='item jd-title'>采购量</div><div class='item jd-title'>装置号</div><div class='item jd-title'>主项号</div><div class='item jd-title'>企业中文名称</div><div class='item jd-title'>备注</div></div>";
int i = 1;
foreach (var item in contractQuantitySheets)
{
contractQuantitySheetsStr += "<div class='jd-item'><div class='item'>"
+ i + "</div><div class='item'>"
+ item.MaterialUse + "</div><div class='item'>"
+ item.ContractCode + "</div><div class='item'>"
+ item.Major + "</div><div class='item'>"
+ item.MaterialCode + "</div><div class='item'>"
+ item.TagNo + "</div><div class='item'>"
+ item.BuyQuantity + "</div><div class='item'>"
+ item.DeviceCode + "</div><div class='item'>"
+ item.MainItemCode + "</div><div class='item'>"
+ item.UnitName + "</div><div class='item'>"
+ item.Remark + "</div></div>";
i++;
}
}
return contractQuantitySheetsStr;
}
}
#region 线
protected string Two
{

View File

@ -161831,6 +161831,8 @@ namespace Model
private System.Nullable<decimal> _DesignNum;
private System.Nullable<int> _SortIndex;
private EntitySet<JDGL_QuantityCompletion> _JDGL_QuantityCompletion;
private EntityRef<Base_CNProfessional> _Base_CNProfessional;
@ -161853,6 +161855,8 @@ namespace Model
partial void OnUnitChanged();
partial void OnDesignNumChanging(System.Nullable<decimal> value);
partial void OnDesignNumChanged();
partial void OnSortIndexChanging(System.Nullable<int> value);
partial void OnSortIndexChanged();
#endregion
public JDGL_QuantityList()
@ -161991,6 +161995,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SortIndex", DbType="Int")]
public System.Nullable<int> SortIndex
{
get
{
return this._SortIndex;
}
set
{
if ((this._SortIndex != value))
{
this.OnSortIndexChanging(value);
this.SendPropertyChanging();
this._SortIndex = value;
this.SendPropertyChanged("SortIndex");
this.OnSortIndexChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_JDGL_QuantityCompletion_JDGL_QuantityList", Storage="_JDGL_QuantityCompletion", ThisKey="QuantityListId", OtherKey="QuantityListId", DeleteRule="NO ACTION")]
public EntitySet<JDGL_QuantityCompletion> JDGL_QuantityCompletion
{
@ -327273,6 +327297,8 @@ namespace Model
private string _Unit;
private System.Nullable<int> _SortIndex;
private System.Nullable<double> _TotalPlanNum;
private System.Nullable<double> _TotalRealNum;
@ -327499,6 +327525,22 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SortIndex", DbType="Int")]
public System.Nullable<int> SortIndex
{
get
{
return this._SortIndex;
}
set
{
if ((this._SortIndex != value))
{
this._SortIndex = value;
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TotalPlanNum", DbType="Float")]
public System.Nullable<double> TotalPlanNum
{