提交代码

This commit is contained in:
2024-05-05 17:12:18 +08:00
parent ae9728039b
commit b096b54df5
15 changed files with 589 additions and 281 deletions
@@ -17,19 +17,22 @@
<f:Grid ID="Grid1" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="工程量清单设置" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="QuantityCompletionId,QuantityListId" AllowCellEditing="true" ForceFit="true"
ClicksToEdit="1" DataIDField="QuantityCompletionId" AllowSorting="true" SortField="SortIndex,Name"
SortDirection="ASC" EnableColumnLines="true"
SortDirection="ASC" EnableColumnLines="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
AllowPaging="true" IsDatabasePaging="true" PageSize="1000"
AllowFilters="true" EnableTextSelection="True">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:DatePicker runat="server" ID="txtMonths" DateFormatString="yyyy-MM" AutoPostBack="true"
Label="月份" LabelWidth="50px" Width="150px" OnTextChanged="txtMonths_TextChanged" Hidden="true">
<f:DatePicker runat="server" ID="txtMonths" DateFormatString="yyyy-MM" AutoPostBack="true" DisplayType="Month"
Label="月份" LabelWidth="50px" Width="150px" OnTextChanged="txtMonths_TextChanged">
</f:DatePicker>
<f:Button ID="btnSave" Icon="SystemSave" runat="server" ToolTip="保存" Hidden="true"
OnClick="btnSave_Click">
</f:Button>
<f:ToolbarFill runat="server"></f:ToolbarFill>
<f:Button ID="btnNew" ToolTip="新增" Icon="Add" EnablePostBack="false" runat="server"
Hidden="true">
</f:Button>
<f:Button ID="btnImport" ToolTip="导入" Icon="ApplicationGet" runat="server"
OnClick="btnImport_Click">
</f:Button>
@@ -67,6 +70,10 @@
<f:RenderField Width="100px" ColumnID="Rate" DataField="Rate"
FieldType="String" HeaderText="完成率" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="90px" ColumnID="NextNum" DataField="NextNum"
FieldType="Float" HeaderText="下月计划" HeaderTextAlign="Center" TextAlign="Left"
EnableColumnEdit="true">
</f:RenderField>
</Columns>
</f:GroupField>
<f:GroupField EnableLock="true" HeaderText="累计" TextAlign="Center">
@@ -18,6 +18,8 @@ namespace FineUIPro.Web.JDGL.Check
if (!IsPostBack)
{
GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("QuantityCompletionEdit.aspx") + "return false;";
this.txtMonths.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
BindGrid();
}
}
@@ -39,6 +41,7 @@ namespace FineUIPro.Web.JDGL.Check
{
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.btnNew.Hidden = false;
this.btnMenuModify.Hidden = false;
this.btnMenuDel.Hidden = false;
}
@@ -46,6 +49,18 @@ namespace FineUIPro.Web.JDGL.Check
}
#endregion
#region Grid双击事件
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuModify_Click(null, null);
}
#endregion
protected void btnMenuModify_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
@@ -90,11 +105,35 @@ namespace FineUIPro.Web.JDGL.Check
private void BindGrid()
{
//GetQuantityCompletion();
string strSql = @"select *
from dbo.View_JDGL_QuantityCompletion qc
where qc.ProjectId=@ProjectId order by qc.SortIndex, qc.Name";
string strSql = @"select qc.*,ql.DesignNum,ql.Name,ql.Unit,ql.SortIndex,
CONVERT(FLOAT, (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month)) as TotalPlanNum,
CONVERT(FLOAT, (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month)) as TotalRealNum,
CONVERT(NVARCHAR(10), ((CAST(CASE ISNULL(qc.PlanNum, 0) WHEN 0 THEN 0
ELSE 100 * ISNULL(qc.RealNum, 0) / (1.0 * qc.PlanNum) END AS DECIMAL(9, 2))))) + '%'
AS Rate,
CONVERT(NVARCHAR(10), ((CAST(CASE(select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month) WHEN 0 THEN 0
ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month) / (1.0 * (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month)) END AS DECIMAL(9, 2)))))+'%'
AS TotalRate,
CONVERT(NVARCHAR(10), ((CAST(CASE ISNULL(ql.DesignNum, 0) WHEN 0 THEN 0
ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and EndDate <= @month) / (1.0 * ql.DesignNum) END AS DECIMAL(9, 2)))))+'%'
AS SumRate,
CONVERT(FLOAT, (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months < qc.Months)) as LastTotalPlanNum,
CONVERT(FLOAT, (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months < qc.Months)) as LastTotalRealNum
from[dbo].JDGL_QuantityList ql
left join dbo.[JDGL_QuantityCompletion] qc on ql.QuantityListId=qc.QuantityListId
where qc.QuantityCompletionId=(select top 1 QuantityCompletionId from[JDGL_QuantityCompletion] q where q.QuantityListId=qc.QuantityListId and q.EndDate<=@month order by q.EndDate desc) and qc.ProjectId=@ProjectId order by ql.SortIndex, ql.Name";
//string strSql = @"select *
// from dbo.View_JDGL_QuantityCompletion qc
// where qc.ProjectId=@ProjectId order by qc.SortIndex, qc.Name";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
listStr.Add(new SqlParameter("@month", string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01").AddMonths(1))));
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
@@ -163,8 +202,8 @@ namespace FineUIPro.Web.JDGL.Check
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][1].ToString();
BLL.QuantityCompletionService.DeleteQuantityCompletionById(rowID);
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
BLL.QuantityCompletionService.DeleteQuantityCompletionByQuantityCompletionId(rowID);
}
BindGrid();
@@ -75,6 +75,15 @@ namespace FineUIPro.Web.JDGL.Check {
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnNew 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnNew;
/// <summary>
/// btnImport 控件。
/// </summary>
@@ -13,6 +13,31 @@
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
<Rows>
<f:FormRow>
<Items>
<f:DatePicker ID="txtStartDate" runat="server" ShowRedStar="true" Required="true" Label="开始日期" LabelAlign="Right" LabelWidth="150px"
EnableEdit="true" >
</f:DatePicker>
<f:DatePicker ID="txtEndDate" runat="server" ShowRedStar="true" Required="true" Label="结束日期" LabelAlign="Right"
EnableEdit="true" >
</f:DatePicker>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:TextBox ID="txtName" runat="server" Label="类型" LabelAlign="Right" LabelWidth="150px" ShowRedStar="true" Required="true"
MaxLength="50">
</f:TextBox>
<f:TextBox ID="txtUnit" runat="server" Label="单位" LabelAlign="Right" ShowRedStar="true" Required="true"
MaxLength="50">
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:NumberBox runat="server" ID="txtDesignNum" Required="true" ShowRedStar="true" Label="设计数量" LabelWidth="150px" NoDecimal="false" NoNegative="true"></f:NumberBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:NumberBox runat="server" ID="txtPlanNum" Required="true" ShowRedStar="true" Label="计划完成" LabelWidth="150px" NoDecimal="false" NoNegative="true"></f:NumberBox>
@@ -23,6 +48,11 @@
<f:NumberBox runat="server" ID="txtRealNum" Required="true" ShowRedStar="true" Label="实际完成" LabelWidth="150px" NoDecimal="false" NoNegative="true"></f:NumberBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:NumberBox runat="server" ID="txtNextNum" Label="下月计划" LabelWidth="150px" NoDecimal="false" NoNegative="true"></f:NumberBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
@@ -52,6 +52,24 @@ namespace FineUIPro.Web.JDGL.Check
if (QuantityCompletion != null)
{
this.ProjectId = QuantityCompletion.ProjectId;
if (QuantityCompletion.StartDate != null)
{
this.txtStartDate.Text = string.Format("{0:yyyy-MM-dd}", QuantityCompletion.StartDate);
}
if (QuantityCompletion.EndDate != null)
{
this.txtEndDate.Text = string.Format("{0:yyyy-MM-dd}", QuantityCompletion.EndDate);
}
Model.JDGL_QuantityList list = BLL.QuantityListService.GetQuantityListById(QuantityCompletion.QuantityListId);
if (list != null)
{
this.txtName.Text = list.Name;
this.txtUnit.Text = list.Unit;
if (list.DesignNum != null)
{
this.txtDesignNum.Text = list.DesignNum.ToString();
}
}
if (QuantityCompletion.PlanNum != null)
{
this.txtPlanNum.Text = QuantityCompletion.PlanNum.ToString();
@@ -60,6 +78,10 @@ namespace FineUIPro.Web.JDGL.Check
{
this.txtRealNum.Text = QuantityCompletion.RealNum.ToString();
}
if (QuantityCompletion.NextNum != null)
{
this.txtNextNum.Text = QuantityCompletion.NextNum.ToString();
}
}
}
}
@@ -73,6 +95,26 @@ namespace FineUIPro.Web.JDGL.Check
private void SaveData(bool bl)
{
string QuantityCompletionId = Request.Params["QuantityCompletionId"];
string quantityListId = string.Empty;
var oldQuantityList = Funs.DB.JDGL_QuantityList.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.Name == this.txtName.Text.Trim());
if (oldQuantityList == null)
{
Model.JDGL_QuantityList newQuantityList = new Model.JDGL_QuantityList();
quantityListId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityList));
newQuantityList.QuantityListId = quantityListId;
newQuantityList.ProjectId = this.CurrUser.LoginProjectId;
newQuantityList.Name = this.txtName.Text.Trim();
newQuantityList.Unit = this.txtUnit.Text.Trim();
newQuantityList.DesignNum = Convert.ToDecimal(this.txtDesignNum.Text.Trim());
BLL.QuantityListService.AddQuantityList(newQuantityList);
}
else
{
quantityListId = oldQuantityList.QuantityListId;
oldQuantityList.Unit = this.txtUnit.Text.Trim();
oldQuantityList.DesignNum = Convert.ToDecimal(this.txtDesignNum.Text.Trim());
BLL.QuantityListService.UpdateQuantityList(oldQuantityList);
}
Model.JDGL_QuantityCompletion QuantityCompletion = new Model.JDGL_QuantityCompletion();
if (!string.IsNullOrEmpty(this.txtPlanNum.Text.Trim()))
{
@@ -82,6 +124,15 @@ namespace FineUIPro.Web.JDGL.Check
{
QuantityCompletion.RealNum = Convert.ToDecimal(this.txtRealNum.Text.Trim());
}
if (!string.IsNullOrEmpty(this.txtNextNum.Text.Trim()))
{
QuantityCompletion.NextNum = Convert.ToDecimal(this.txtNextNum.Text.Trim());
}
QuantityCompletion.QuantityListId = quantityListId;
QuantityCompletion.CompileMan = this.CurrUser.UserId;
QuantityCompletion.CompileDate = DateTime.Now;
QuantityCompletion.StartDate = Convert.ToDateTime(this.txtStartDate.Text.Trim());
QuantityCompletion.EndDate = Convert.ToDateTime(this.txtEndDate.Text.Trim());
if (!string.IsNullOrEmpty(QuantityCompletionId))
{
QuantityCompletion.QuantityCompletionId = QuantityCompletionId;
@@ -90,6 +141,7 @@ namespace FineUIPro.Web.JDGL.Check
else
{
QuantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion));
QuantityCompletion.ProjectId = this.CurrUser.LoginProjectId;
BLL.QuantityCompletionService.AddQuantityCompletion(QuantityCompletion);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
@@ -39,6 +39,51 @@ namespace FineUIPro.Web.JDGL.Check {
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtStartDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtStartDate;
/// <summary>
/// txtEndDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtEndDate;
/// <summary>
/// txtName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtName;
/// <summary>
/// txtUnit 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtUnit;
/// <summary>
/// txtDesignNum 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtDesignNum;
/// <summary>
/// txtPlanNum 控件。
/// </summary>
@@ -57,6 +102,15 @@ namespace FineUIPro.Web.JDGL.Check {
/// </remarks>
protected global::FineUIPro.NumberBox txtRealNum;
/// <summary>
/// txtNextNum 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtNextNum;
/// <summary>
/// Toolbar1 控件。
/// </summary>
@@ -49,7 +49,7 @@
<f:FormRow>
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" EnableCollapse="true" runat="server" ForceFit="true"
EnableColumnLines="true" BoxFlex="1" DataKeyNames="Name" DataIDField="Name"
EnableColumnLines="true" BoxFlex="1" DataKeyNames="Name" DataIDField="Name"
AllowSorting="true" SortField="Name" PageSize="500" Height="400px">
<Columns>
<f:TemplateField Width="55px" HeaderText="序号">
@@ -74,6 +74,9 @@
<f:RenderField Width="100px" ColumnID="RealNum" DataField="RealNum" SortField="RealNum"
FieldType="String" HeaderText="实际完成" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="NextNum" DataField="NextNum" SortField="NextNum"
FieldType="String" HeaderText="下月计划" HeaderTextAlign="Center" TextAlign="Center">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
@@ -150,7 +150,7 @@ namespace FineUIPro.Web.JDGL.Check
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL(ds.Tables[0], 5);
AddDatasetToSQL(ds.Tables[0], 6);
}
catch (Exception ex)
{
@@ -242,6 +242,19 @@ namespace FineUIPro.Web.JDGL.Check
{
result += "第" + (i + 2).ToString() + "行," + "实际完成" + "," + "此项为必填项!" + "|";
}
string col5 = pds.Rows[i][5].ToString().Trim();
if (!string.IsNullOrEmpty(col5))
{
try
{
decimal dec = Convert.ToDecimal(col5);
}
catch (Exception)
{
result += "第" + (i + 2).ToString() + "行," + "下月计划" + "," + "[" + col5 + "]错误!" + "|";
}
}
}
if (!string.IsNullOrEmpty(result))
{
@@ -334,7 +347,7 @@ namespace FineUIPro.Web.JDGL.Check
oleDBConn.Close();
oleDBConn.Dispose();
AddDatasetToSQL2(ds.Tables[0], 5);
AddDatasetToSQL2(ds.Tables[0], 6);
}
catch (Exception ex)
{
@@ -371,6 +384,7 @@ namespace FineUIPro.Web.JDGL.Check
string col2 = pds.Rows[i][2].ToString().Trim();
string col3 = pds.Rows[i][3].ToString().Trim();
string col4 = pds.Rows[i][4].ToString().Trim();
string col5 = pds.Rows[i][5].ToString().Trim();
if (!string.IsNullOrEmpty(col0))//类型
{
quantityCompletion.Name = col0;
@@ -387,10 +401,14 @@ namespace FineUIPro.Web.JDGL.Check
{
quantityCompletion.PlanNum = Funs.GetNewDecimalOrZero(col3);
}
if (!string.IsNullOrEmpty(col4))//计划完成
if (!string.IsNullOrEmpty(col4))//实际完成
{
quantityCompletion.RealNum = Funs.GetNewDecimalOrZero(col4);
}
if (!string.IsNullOrEmpty(col5))//下月计划
{
quantityCompletion.NextNum = Funs.GetNewDecimalOrZero(col5);
}
quantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion));
quantityCompletions.Add(quantityCompletion);
}
@@ -461,6 +479,7 @@ namespace FineUIPro.Web.JDGL.Check
newQuantityCompletion.QuantityListId = quantityListId;
newQuantityCompletion.PlanNum = quantityCompletions[i].PlanNum;
newQuantityCompletion.RealNum = quantityCompletions[i].RealNum;
newQuantityCompletion.NextNum = quantityCompletions[i].NextNum;
newQuantityCompletion.CompileMan = this.CurrUser.UserId;
newQuantityCompletion.CompileDate = DateTime.Now;
newQuantityCompletion.StartDate = startDate;
@@ -471,6 +490,7 @@ namespace FineUIPro.Web.JDGL.Check
{
oldQuantityCompletion.PlanNum= quantityCompletions[i].PlanNum;
oldQuantityCompletion.RealNum= quantityCompletions[i].RealNum;
oldQuantityCompletion.NextNum = quantityCompletions[i].NextNum;
BLL.QuantityCompletionService.UpdateQuantityCompletion(oldQuantityCompletion);
}
}