From 90f61fc20d1bad2be0103271729104c0054e3402 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Mon, 6 May 2024 15:57:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../版本日志/SGGLDB_WH_2024-05-06-gaofei.sql | 350 ++++++++++++++++++ .../JDGL/Check/QuantityCompletion.aspx | 10 +- .../JDGL/Check/QuantityCompletion.aspx.cs | 41 +- .../Check/QuantityCompletion.aspx.designer.cs | 18 +- .../JDGL/Check/QuantityCompletionEdit.aspx | 96 ++++- .../JDGL/Check/QuantityCompletionEdit.aspx.cs | 252 ++++++++----- .../QuantityCompletionEdit.aspx.designer.cs | 102 ++--- .../JDGL/Check/QuantityCompletionIn.aspx | 5 +- .../JDGL/Check/QuantityCompletionIn.aspx.cs | 12 +- .../QuantityCompletionIn.aspx.designer.cs | 13 +- SGGL/FineUIPro.Web/Web.config | 2 +- 11 files changed, 685 insertions(+), 216 deletions(-) create mode 100644 DataBase/版本日志/SGGLDB_WH_2024-05-06-gaofei.sql diff --git a/DataBase/版本日志/SGGLDB_WH_2024-05-06-gaofei.sql b/DataBase/版本日志/SGGLDB_WH_2024-05-06-gaofei.sql new file mode 100644 index 00000000..93322c6b --- /dev/null +++ b/DataBase/版本日志/SGGLDB_WH_2024-05-06-gaofei.sql @@ -0,0 +1,350 @@ + +--ȡǰ˴ +ALTER PROCEDURE [dbo].[Sp_Project_GetToDoItems] + @projectId NVARCHAR(50)=NULL, + @userId NVARCHAR(200)=NULL +AS +/*ȡǰ˴*/ +BEGIN +SELECT HazardRegisterId AS DataId + ,'B6BE5FE0-CB84-47FF-A6C3-5AD9E1CCE079' AS MenuId + ,'ȫѲ' AS MenuName + ,register.RegisterDef AS Content + ,UserId + ,users.UserName + ,register.RegisterDate AS DataTime + ,CONVERT(varchar(100),register.RegisterDate, 23) AS DataTimeStr + ,'../HSSE/HiddenInspection/HiddenRectificationRectify.aspx?HazardRegisterId='+register.HazardRegisterId AS PCUrl +FROM HSSE_Hazard_HazardRegister AS register +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE register.ProjectId=@projectId AND +((register.states = '1' AND (register.ResponsibleMan =@userId OR register.CCManIds LIKE ('%'+@userId+'%') )) +) +UNION ALL + +SELECT HazardRegisterId AS DataId + ,'B6BE5FE0-CB84-47FF-A6C3-5AD9E1CCE079' AS MenuId + ,'ȫѲȷ' AS MenuName + ,register.RegisterDef AS Content + ,UserId + ,users.UserName + ,register.RegisterDate AS DataTime + ,CONVERT(varchar(100),register.RegisterDate, 23) AS DataTimeStr + ,'../HSSE/HiddenInspection/HiddenRectificationConfirm.aspx?HazardRegisterId='+register.HazardRegisterId AS PCUrl +FROM HSSE_Hazard_HazardRegister AS register +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE register.ProjectId=@projectId AND +register.states = '2' AND register.CheckManId =@userId + +UNION ALL +SELECT CheckControlCode AS DataId + ,'B3E99BD9-FDC7-4F15-8C3C-A7821AC9E306' AS MenuId + ,'Ѳ' AS MenuName + ,checkControl.QuestionDef AS Content + ,UserId + ,users.UserName + ,checkControl.CheckDate AS DataTime + ,CONVERT(varchar(100),checkControl.CheckDate, 23) AS DataTimeStr + ,'../CQMS/Check/ChecklistEdit.aspx?ToDo=ToDo&CheckControlCode='+checkControl.CheckControlCode AS PCUrl +FROM Check_CheckControl AS checkControl +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE checkControl.ProjectId=@projectId AND +checkControl.State != '7' AND checkControl.CheckControlCode in (select CheckControlCode from Check_CheckControlApprove approve where approve.ApproveType!='S' and approve.ApproveMan=@userId and approve.ApproveDate is null ) + +UNION ALL +SELECT GJSXID AS DataId + ,'0BEA2126-7A48-40EB-8E21-99148E91A22B' AS MenuId + ,'ؼ' AS MenuName + ,GJSX.Detail AS Content + ,users.UserId + ,users.UserName + ,GJSX.CreateDate AS DataTime + ,CONVERT(varchar(100),GJSX.CreateDate, 23) AS DataTimeStr + ,'../PZHGL/GJSX/GJSXListEdit.aspx?ToDo=ToDo&EditType=Edit&ID='+GJSXID AS PCUrl +FROM GJSX +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE GJSX.ProjectId=@projectId AND +GJSX.State != 0 AND (((select count(*) from GJSX_detail detail where detail.Progress_user=@userId and detail.GJSXID=GJSX.GJSXID)=0 +and (select count(*) from GJSX_Process process where process.UserId=@userId and process.GJSXID=GJSX.GJSXID)>0) +or (GJSX.User_Acceptance like '%'+@userId+'%' and (select count(*) from GJSX_detail detail where detail.GJSXID=GJSX.GJSXID)=(select count(*) from GJSX_Process process where process.GJSXID=GJSX.GJSXID)) +) + +UNION ALL +SELECT InspectionEquipmentId AS DataId + ,'6c2c1e5e-1812-4e1c-a683-7125518e28c7' AS MenuId + ,'豸ϱȷ' AS MenuName + ,Equipment.InspectionName AS Content + ,UserId + ,users.UserName + ,Equipment.InspectionDate AS DataTime + ,CONVERT(varchar(100),Equipment.InspectionDate, 23) AS DataTimeStr + ,'../CQMS/Comprehensive/InspectionEquipmentEdit.aspx?ToDo=ToDo&InspectionEquipmentId='+Equipment.InspectionEquipmentId AS PCUrl +FROM Comprehensive_InspectionEquipment AS Equipment +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Equipment.ProjectId=@projectId and +Equipment.Status!='3' AND Equipment.InspectionEquipmentId in (select InspectionEquipmentId from Comprehensive_InspectionEquipmentApprove approve where approve.ApproveType!='S' and approve.ApproveMan=@userId and approve.ApproveDate is null ) +UNION ALL +SELECT InspectionPersonId AS DataId + ,'8ed133de-5899-4687-878a-20b1f5280f18' AS MenuId + ,'Աȷ' AS MenuName + ,Person.PersonName AS Content + ,UserId + ,users.UserName + ,Person.CompileDate AS DataTime + ,CONVERT(varchar(100),Person.CompileDate, 23) AS DataTimeStr + ,'../CQMS/Comprehensive/InspectionPersonEdit.aspx?ToDo=ToDo&InspectionPersonId='+Person.InspectionPersonId AS PCUrl +FROM Comprehensive_InspectionPerson AS Person +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Person.ProjectId=@projectId and +Person.Status!='3' AND Person.InspectionPersonId in (select InspectionPersonId from Comprehensive_InspectionPersonApprove approve where approve.ApproveType!='S' and approve.ApproveMan=@userId and approve.ApproveDate is null ) +UNION ALL +SELECT InspectionMachineId AS DataId + ,'aa55fad1-6c51-43f5-8c99-3c6aaae79118' AS MenuId + ,'߱ȷ' AS MenuName + ,Machine.InspectionMachineName AS Content + ,UserId + ,users.UserName + ,Machine.CompileDate AS DataTime + ,CONVERT(varchar(100),Machine.CompileDate, 23) AS DataTimeStr + ,'../CQMS/Comprehensive/InspectionMachineEdit.aspx?ToDo=ToDo&InspectionMachineId='+Machine.InspectionMachineId AS PCUrl +FROM Comprehensive_InspectionMachine AS Machine +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Machine.ProjectId=@projectId and +Machine.Status!='3' AND Machine.InspectionMachineId in (select InspectionMachineId from Comprehensive_InspectionMachineApprove approve where approve.ApproveType!='S' and approve.ApproveMan=@userId and approve.ApproveDate is null ) +UNION ALL +SELECT ConstructSolutionId AS DataId + ,'91C4BFDB-0A51-4992-99CC-EB4EC185593D' AS MenuId + ,'ʩ' AS MenuName + ,Solution.SolutionName AS Content + ,UserId + ,users.UserName + ,Solution.CompileDate AS DataTime + ,CONVERT(varchar(100),Solution.CompileDate, 23) AS DataTimeStr + ,'../CQMS/Solution/EditConstructSolution.aspx?ToDo=ToDo&ConstructSolutionId='+Solution.ConstructSolutionId AS PCUrl +FROM Solution_CQMSConstructSolution AS Solution +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Solution.ProjectId=@projectId and +Solution.State!='3' +AND Solution.ConstructSolutionId in +(select top 1 ConstructSolutionId from ( +SELECT Solution_CQMSConstructSolutionApprove.* +FROM Solution_CQMSConstructSolutionApprove, +(SELECT MIN([order]) AS [order],ConstructSolutionId FROM Solution_CQMSConstructSolutionApprove where ApproveType!='S' and ApproveDate is null GROUP BY ConstructSolutionId )b +WHERE Solution_CQMSConstructSolutionApprove.[order] = b.[order] and Solution_CQMSConstructSolutionApprove.ConstructSolutionId = b.ConstructSolutionId + ) approve +where approve.ApproveMan=@userId ) + +UNION ALL +SELECT InspectionId AS DataId + ,'4781f467-35bf-4cf2-aaa4-7960a175eb61' AS MenuId + ,'֪ͨ' AS MenuName + ,InspectionManagement.AcceptanceSite AS Content + ,UserId + ,users.UserName + ,InspectionManagement.CompileDate AS DataTime + ,CONVERT(varchar(100),InspectionManagement.CompileDate, 23) AS DataTimeStr + ,'../CQMS/ProcessControl/InspectionNoticeEdit.aspx?View=View&InspectionId='+InspectionManagement.InspectionId AS PCUrl +FROM ProcessControl_InspectionManagement AS InspectionManagement +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE InspectionManagement.ProjectId=@projectId and +dateadd(day,3,InspectionManagement.CompileDate)>getdate() and InspectionManagement.AcceptanceCheckMan like '%'+@userId+'%' +UNION ALL +SELECT CheckSpecialId AS DataId + ,'1B08048F-93ED-4E84-AE65-DB7917EA2DFB' AS MenuId + ,'ר' AS MenuName + ,CheckItemSet.CheckItemName AS Content + ,UserId + ,users.UserName + ,CheckSpecial.CheckTime AS DataTime + ,CONVERT(varchar(100),CheckSpecial.CheckTime, 23) AS DataTimeStr + ,'../HSSE/Check/CheckSpecialView.aspx?CheckSpecialId='+CheckSpecial.CheckSpecialId AS PCUrl +FROM Check_CheckSpecial AS CheckSpecial +LEFT JOIN Sys_User AS users ON users.UserId =@userId +LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId =CheckSpecial.CheckItemSetId +WHERE CheckSpecial.ProjectId=@projectId and +dateadd(day,3,CheckSpecial.CheckTime)>getdate() and CheckSpecial.PartInPersonIds like '%'+@userId+'%' +UNION ALL +SELECT CheckColligationId AS DataId + ,'C198EBA8-9E23-4654-92E1-09C61105C522' AS MenuId + ,'ۺϼ' AS MenuName + ,case CheckType when '0' then 'ܼ' when '1' then '¼' else '' end AS Content + ,users.UserId + ,users.UserName + ,CheckColligation.CheckTime AS DataTime + ,CONVERT(varchar(100),CheckColligation.CheckTime, 23) AS DataTimeStr + ,'../HSSE/Check/CheckColligationEdit.aspx?CheckColligationId='+CheckColligation.CheckColligationId AS PCUrl +FROM Check_CheckColligation AS CheckColligation +LEFT JOIN Sys_User AS users ON users.UserId =@userId +LEFT JOIN Sys_FlowOperate AS FlowOperate ON CheckColligation.CheckColligationId=FlowOperate.DataId +LEFT JOIN Sys_User AS OperateUser ON FlowOperate.OperaterId=OperateUser.UserId +WHERE CheckColligation.ProjectId=@projectId and FlowOperate.IsClosed <> 1 and FlowOperate.OperaterId=@userId +UNION ALL +SELECT PatrolPlanId AS DataId + ,'D256E5C8-DC76-4F4D-BABE-A253418823F4' AS MenuId + ,'Ѳ' AS MenuName + ,HazardListItem.HazardItems AS Content + ,UserId + ,users.UserName + ,PatrolPlan.LimitCheckDate AS DataTime + ,CONVERT(varchar(100),PatrolPlan.LimitCheckDate, 23) AS DataTimeStr + ,'../HSSE/Hazard/RoutingInspectionEdit.aspx?PatrolPlanId='+PatrolPlan.PatrolPlanId AS PCUrl +FROM Hazard_PatrolPlan AS PatrolPlan +LEFT JOIN Sys_User AS users ON users.UserId =@userId +LEFT JOIN Hazard_HazardSelectedItem AS HazardListItem on HazardListItem.HazardSelectedItemId=PatrolPlan.HazardSelectedItemId +WHERE HazardListItem.ProjectId=@projectId and +dateadd(day,-3,PatrolPlan.LimitCheckDate)=22 and (select COUNT(*) from JDGL_QuantityCompletion WHERE ProjectId=@projectId and DATENAME(year,GETDATE())=DATENAME(year,EndDate) and DATENAME(MONTH,GETDATE())=DATENAME(MONTH,EndDate))=0) +or (DATEADD(day,60,(select top 1 EndDate from JDGL_QuantityCompletion WHERE ProjectId=@projectId order by EndDate desc)) @@ -33,6 +33,9 @@ + @@ -124,13 +127,10 @@ - diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.cs b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.cs index 3fa4f44e..95013fdc 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.cs @@ -42,33 +42,16 @@ namespace FineUIPro.Web.JDGL.Check if (buttonList.Contains(BLL.Const.BtnSave)) { this.btnNew.Hidden = false; - this.btnMenuModify.Hidden = false; + this.btnModify.Hidden = false; this.btnMenuDel.Hidden = false; } } } #endregion - #region Grid双击事件 - /// - /// Grid行双击事件 - /// - /// - /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + protected void btnModify_Click(object sender, EventArgs e) { - btnMenuModify_Click(null, null); - } - #endregion - - protected void btnMenuModify_Click(object sender, EventArgs e) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QuantityCompletionEdit.aspx?QuantityCompletionId={0}", Grid1.SelectedRowID, "编辑 - "))); + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("QuantityCompletionEdit.aspx?Months={0}", this.txtMonths.Text, "编辑 - "))); } /// @@ -105,35 +88,37 @@ namespace FineUIPro.Web.JDGL.Check private void BindGrid() { //GetQuantityCompletion(); - 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, + string strSql = @"select qc.QuantityCompletionId,(select PlanNum from JDGL_QuantityCompletion where QuantityListId=ql.QuantityListId and Months=@month) as PlanNum, + (select RealNum from JDGL_QuantityCompletion where QuantityListId=ql.QuantityListId and Months=@month) as RealNum, + (select NextNum from JDGL_QuantityCompletion where QuantityListId=ql.QuantityListId and Months=@month) as NextNum,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 Months <= @month)) as TotalPlanNum, + CONVERT(FLOAT, (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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 + CONVERT(NVARCHAR(10), ((CAST(CASE(select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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)))))+'%' + ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @month) / (1.0 * (select sum(ISNULL(PlanNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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)))))+'%' + ELSE 100 * (select sum(ISNULL(RealNum, 0)) from JDGL_QuantityCompletion where ProjectId = ql.ProjectId and QuantityListId = qc.QuantityListId and Months <= @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"; +where qc.QuantityCompletionId=(select top 1 QuantityCompletionId from[JDGL_QuantityCompletion] q where q.QuantityListId=qc.QuantityListId and q.Months<=@month order by q.Months 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 listStr = new List(); 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)))); + listStr.Add(new SqlParameter("@month", string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01")))); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); Grid1.RecordCount = tb.Rows.Count; diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.designer.cs b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.designer.cs index 5b0f805c..fd82f08f 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletion.aspx.designer.cs @@ -84,6 +84,15 @@ namespace FineUIPro.Web.JDGL.Check { /// protected global::FineUIPro.Button btnNew; + /// + /// btnModify 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnModify; + /// /// btnImport 控件。 /// @@ -120,15 +129,6 @@ namespace FineUIPro.Web.JDGL.Check { /// protected global::FineUIPro.Menu Menu1; - /// - /// btnMenuModify 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuModify; - /// /// btnMenuDel 控件。 /// diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx index 921ae393..c37ac7fd 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx @@ -4,21 +4,103 @@ - +
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- - - - @@ -67,7 +149,7 @@ - + --%> diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.cs b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.cs index 651a653c..45edcc9b 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.cs @@ -1,4 +1,5 @@ using BLL; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -10,20 +11,6 @@ namespace FineUIPro.Web.JDGL.Check { public partial class QuantityCompletionEdit : PageBase { - /// - /// id - /// - public string QuantityCompletionId - { - get - { - return (string)ViewState["QuantityCompletionId"]; - } - set - { - ViewState["QuantityCompletionId"] = value; - } - } /// /// 项目id /// @@ -42,110 +29,171 @@ namespace FineUIPro.Web.JDGL.Check { if (!IsPostBack) { - - this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); - QuantityCompletionId = Request.Params["QuantityCompletionId"]; - if (!string.IsNullOrEmpty(QuantityCompletionId)) + DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01"); + if (!string.IsNullOrEmpty(Request.Params["Months"])) { - - Model.JDGL_QuantityCompletion QuantityCompletion = BLL.QuantityCompletionService.GetQuantityCompletionById(QuantityCompletionId); - 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(); - } - if (QuantityCompletion.RealNum != null) - { - this.txtRealNum.Text = QuantityCompletion.RealNum.ToString(); - } - if (QuantityCompletion.NextNum != null) - { - this.txtNextNum.Text = QuantityCompletion.NextNum.ToString(); - } - } + months = Convert.ToDateTime(Request.Params["Months"] + "-01"); } + this.txtMonth.Text = string.Format("{0:yyyy-MM}", months); + BindGrid(); } } + /// + /// 加载Grid + /// + private void BindGrid() + { + DateTime months = Convert.ToDateTime(this.txtMonth.Text + "-01"); + Model.SGGLDB db = Funs.DB; + Grid1.DataSource = from x in db.JDGL_QuantityList + where x.ProjectId == this.CurrUser.LoginProjectId + orderby x.SortIndex, x.Name + select new + { + x.QuantityListId, + x.Name, + x.Unit, + x.DesignNum, + PlanNum = (from y in db.JDGL_QuantityCompletion where y.ProjectId == this.CurrUser.LoginProjectId && y.Months == months && y.QuantityListId == x.QuantityListId select y.PlanNum).First(), + RealNum = (from y in db.JDGL_QuantityCompletion where y.ProjectId == this.CurrUser.LoginProjectId && y.Months == months && y.QuantityListId == x.QuantityListId select y.RealNum).First(), + NextNum = (from y in db.JDGL_QuantityCompletion where y.ProjectId == this.CurrUser.LoginProjectId && y.Months == months && y.QuantityListId == x.QuantityListId select y.NextNum).First(), + }; + Grid1.DataBind(); + } + + #region 月份选择事件 + /// + /// 月份选择事件 + /// + /// + /// + protected void txtMonths_TextChanged(object sender, EventArgs e) + { + BindGrid(); + } + #endregion + protected void btnSave_Click(object sender, EventArgs e) { + if (string.IsNullOrEmpty(this.txtMonth.Text)) + { + ShowNotify("请选择月份!", MessageBoxIcon.Warning); + } SaveData(true); } 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) + DateTime months = Convert.ToDateTime(this.txtMonth.Text + "-01"); + var list = GetDetails(); + Model.SGGLDB db = Funs.DB; + foreach (var item in list) { - 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())) - { - QuantityCompletion.PlanNum = Convert.ToDecimal(this.txtPlanNum.Text.Trim()); - } - if (!string.IsNullOrEmpty(this.txtRealNum.Text.Trim())) - { - 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; - BLL.QuantityCompletionService.UpdateQuantityCompletion(QuantityCompletion); - } - else - { - QuantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion)); - QuantityCompletion.ProjectId = this.CurrUser.LoginProjectId; - BLL.QuantityCompletionService.AddQuantityCompletion(QuantityCompletion); + string quantityListId = string.Empty; + var oldQuantityList = db.JDGL_QuantityList.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.Name == item.Name); + 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 = item.Name; + newQuantityList.Unit = item.Unit; + newQuantityList.DesignNum = item.DesignNum; + BLL.QuantityListService.AddQuantityList(newQuantityList); + } + else + { + quantityListId = oldQuantityList.QuantityListId; + oldQuantityList.Unit = item.Unit; + oldQuantityList.DesignNum = item.DesignNum; + BLL.QuantityListService.UpdateQuantityList(oldQuantityList); + } + var oldQuantityCompletion = db.JDGL_QuantityCompletion.FirstOrDefault(x => x.ProjectId == this.CurrUser.LoginProjectId && x.QuantityListId == quantityListId && x.Months == months); + if (oldQuantityCompletion==null) + { + Model.JDGL_QuantityCompletion QuantityCompletion = new Model.JDGL_QuantityCompletion(); + QuantityCompletion.QuantityCompletionId = SQLHelper.GetNewID(typeof(Model.JDGL_QuantityCompletion)); + QuantityCompletion.PlanNum = item.PlanNum; + QuantityCompletion.RealNum = item.RealNum; + QuantityCompletion.NextNum = item.NextNum; + QuantityCompletion.Months = months; + QuantityCompletion.QuantityListId = quantityListId; + QuantityCompletion.CompileMan = this.CurrUser.UserId; + QuantityCompletion.CompileDate = DateTime.Now; + QuantityCompletion.ProjectId = this.CurrUser.LoginProjectId; + BLL.QuantityCompletionService.AddQuantityCompletion(QuantityCompletion); + } + else + { + oldQuantityCompletion.PlanNum = item.PlanNum; + oldQuantityCompletion.RealNum = item.RealNum; + oldQuantityCompletion.NextNum = item.NextNum; + BLL.QuantityCompletionService.UpdateQuantityCompletion(oldQuantityCompletion); + } } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } + + #region 增加按钮事件 + /// + /// 增加按钮事件 + /// + /// + /// + protected void btnNew_Click(object sender, EventArgs e) + { + var list = GetDetails(); + Model.View_JDGL_QuantityCompletion ql = new Model.View_JDGL_QuantityCompletion(); + ql.QuantityListId = SQLHelper.GetNewID(); + list.Add(ql); + Grid1.DataSource = list; + Grid1.DataBind(); + } + private List GetDetails() + { + List list = new List(); + foreach (JObject mergedRow in Grid1.GetMergedData()) + { + JObject values = mergedRow.Value("values"); + int i = mergedRow.Value("index"); + Model.View_JDGL_QuantityCompletion ql = new Model.View_JDGL_QuantityCompletion(); + ql.QuantityListId = Grid1.Rows[i].RowID; + ql.Name = values.Value("Name"); + ql.Unit = values.Value("Unit"); + ql.DesignNum = Funs.GetNewDecimal(values.Value("DesignNum")); + ql.PlanNum = Funs.GetNewDecimal(values.Value("PlanNum")); + ql.RealNum = Funs.GetNewDecimal(values.Value("RealNum")); + ql.NextNum = Funs.GetNewDecimal(values.Value("NextNum")); + list.Add(ql); + } + return list; + } + #endregion + + #region 行点击事件 + /// + /// Grid行点击事件 + /// + /// + /// + protected void Grid1_RowCommand(object sender, GridCommandEventArgs e) + { + string quantityListId = Grid1.DataKeys[e.RowIndex][0].ToString(); + var list = GetDetails(); + if (e.CommandName == "del")//删除 + { + var Report = list.FirstOrDefault(x => x.QuantityListId == quantityListId); + if (Report != null) + { + list.Remove(Report); + } + this.Grid1.DataSource = list; + this.Grid1.DataBind(); + } + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.designer.cs index c9d5c868..009ff37b 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionEdit.aspx.designer.cs @@ -31,31 +31,85 @@ namespace FineUIPro.Web.JDGL.Check { protected global::FineUIPro.PageManager PageManager1; /// - /// SimpleForm1 控件。 + /// Panel17 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Form SimpleForm1; + protected global::FineUIPro.Panel Panel17; /// - /// txtStartDate 控件。 + /// Toolbar5 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.DatePicker txtStartDate; + protected global::FineUIPro.Toolbar Toolbar5; /// - /// txtEndDate 控件。 + /// txtMonth 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.DatePicker txtEndDate; + protected global::FineUIPro.DatePicker txtMonth; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// Form15 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form Form15; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar3; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnNew; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; /// /// txtName 控件。 @@ -110,41 +164,5 @@ namespace FineUIPro.Web.JDGL.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.NumberBox txtNextNum; - - /// - /// Toolbar1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Toolbar Toolbar1; - - /// - /// hdCheckerId 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.HiddenField hdCheckerId; - - /// - /// btnSave 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnSave; - - /// - /// btnClose 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Button btnClose; } } diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx index 966fb8c1..0b91d671 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx @@ -15,10 +15,7 @@ - - - diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.cs b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.cs index a33c6448..65d06f96 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.cs @@ -436,9 +436,9 @@ namespace FineUIPro.Web.JDGL.Check /// protected void btnSave_Click(object sender, EventArgs e) { - if (string.IsNullOrEmpty(this.txtStartDate.Text.Trim()) || string.IsNullOrEmpty(this.txtEndDate.Text.Trim())) + if (string.IsNullOrEmpty(this.txtMonth.Text.Trim())) { - ShowNotify("请选择开始、结束日期!", MessageBoxIcon.Warning); + ShowNotify("请选择月份!", MessageBoxIcon.Warning); return; } if (string.IsNullOrEmpty(errorInfos)) @@ -447,8 +447,7 @@ namespace FineUIPro.Web.JDGL.Check var quantityCompletionLists = from x in Funs.DB.JDGL_QuantityCompletion where x.ProjectId == this.ProjectId select x; string quantityListId = string.Empty; int a = quantityCompletions.Count(); - DateTime startDate = Convert.ToDateTime(this.txtStartDate.Text.Trim()); - DateTime endDate = Convert.ToDateTime(this.txtEndDate.Text.Trim()); + DateTime month = Convert.ToDateTime(this.txtMonth.Text.Trim()); for (int i = 0; i < a; i++) { var oldQuantityList = quantityLists.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.Name == quantityCompletions[i].Name); @@ -470,7 +469,7 @@ namespace FineUIPro.Web.JDGL.Check oldQuantityList.DesignNum = quantityCompletions[i].DesignNum; BLL.QuantityListService.UpdateQuantityList(oldQuantityList); } - var oldQuantityCompletion = quantityCompletionLists.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.QuantityListId == quantityListId && x.StartDate == startDate && x.EndDate == endDate); + var oldQuantityCompletion = quantityCompletionLists.FirstOrDefault(x => x.ProjectId == this.ProjectId && x.QuantityListId == quantityListId && x.Months == month); if (oldQuantityCompletion == null) { Model.JDGL_QuantityCompletion newQuantityCompletion = new Model.JDGL_QuantityCompletion(); @@ -482,8 +481,7 @@ namespace FineUIPro.Web.JDGL.Check newQuantityCompletion.NextNum = quantityCompletions[i].NextNum; newQuantityCompletion.CompileMan = this.CurrUser.UserId; newQuantityCompletion.CompileDate = DateTime.Now; - newQuantityCompletion.StartDate = startDate; - newQuantityCompletion.EndDate = endDate; + newQuantityCompletion.Months = month; BLL.QuantityCompletionService.AddQuantityCompletion(newQuantityCompletion); } else diff --git a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.designer.cs b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.designer.cs index a6af568c..f094f32d 100644 --- a/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/JDGL/Check/QuantityCompletionIn.aspx.designer.cs @@ -49,22 +49,13 @@ namespace FineUIPro.Web.JDGL.Check { protected global::FineUIPro.Toolbar Toolbar2; /// - /// txtStartDate 控件。 + /// txtMonth 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.DatePicker txtStartDate; - - /// - /// txtEndDate 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.DatePicker txtEndDate; + protected global::FineUIPro.DatePicker txtMonth; /// /// btnAudit 控件。 diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index 963148f2..f50b26d3 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -77,7 +77,7 @@ - +