From 0d0c96c0321ed0d40e99891709fa0dbf3b795d3d Mon Sep 17 00:00:00 2001 From: wendy <408182087@qq.com> Date: Thu, 12 Mar 2026 10:37:05 +0800 Subject: [PATCH] =?UTF-8?q?20260312=20=E5=91=A8=E6=9C=9F=E6=A3=80=E5=AE=9A?= =?UTF-8?q?=E8=AE=A1=E9=87=8F=E5=99=A8=E5=85=B7=E6=B8=85=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BLL/JGZL/MeasuringInstrumentsService.cs | 15 + .../Fastreport/JGZL/周期检定计量器具清单.frx | 4 +- .../JGZL/MeasuringInstruments.aspx | 56 ++- .../JGZL/MeasuringInstruments.aspx.cs | 344 +++++++++++++----- .../MeasuringInstruments.aspx.designer.cs | 117 ++++-- 5 files changed, 384 insertions(+), 152 deletions(-) diff --git a/HJGL_DS/BLL/JGZL/MeasuringInstrumentsService.cs b/HJGL_DS/BLL/JGZL/MeasuringInstrumentsService.cs index 4ed4e55..de49b96 100644 --- a/HJGL_DS/BLL/JGZL/MeasuringInstrumentsService.cs +++ b/HJGL_DS/BLL/JGZL/MeasuringInstrumentsService.cs @@ -84,5 +84,20 @@ namespace BLL db.SubmitChanges(); } } + + /// + /// 根据项目Id删除周期检定计量器具清单 + /// + /// + public static void DeleteListsByProjectId(string projectId) + { + SGGLDB db = Funs.DB; + var q = (from x in db.JGZL_MeasuringInstruments where x.ProjectId == projectId select x).ToList(); + if (q.Count>0) + { + db.JGZL_MeasuringInstruments.DeleteAllOnSubmit(q); + db.SubmitChanges(); + } + } } } diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/周期检定计量器具清单.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/周期检定计量器具清单.frx index 16d71a4..b457fda 100644 --- a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/周期检定计量器具清单.frx +++ b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/周期检定计量器具清单.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -42,7 +42,7 @@ namespace FastReport } - + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx index a8acaf9..ef62ec3 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx @@ -40,6 +40,7 @@ + @@ -51,38 +52,67 @@ EnableColumnLines="true" ClicksToEdit="1" DataIDField="MeasuringInstrumentsId" AllowSorting="true" SortField="MeasuringInstrumentsCode" SortDirection="DESC" OnSort="Grid1_Sort" AllowPaging="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" - EnableTextSelection="True" AutoScroll="true" EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"> + EnableTextSelection="True" AutoScroll="true" OnPreDataBound="Grid1_PreDataBound"> + + + + + + + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> + + + + + + + FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="150px" ExpandUnusedSpace="true"> + + + + + + - + <%-- - + --%> @@ -101,30 +131,30 @@ - + --%> - + <%-- - + --%> - + --%> diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs index d52c212..b3e037d 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.cs @@ -1,18 +1,52 @@ using BLL; +using Model; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.Data.SqlClient; using System.Data; +using System.Data.SqlClient; +using System.IO; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; -using System.IO; namespace FineUIPro.Web.JGZL { public partial class MeasuringInstruments : PageBase { + #region 定义项 + /// + /// 主键 + /// + private string MeasuringInstrumentsId + { + get + { + return (string)ViewState["MeasuringInstrumentsId"]; + } + set + { + ViewState["MeasuringInstrumentsId"] = value; + } + } + + /// + /// 项目Id + /// + private string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + #region 加载页面 /// /// 加载页面 @@ -34,6 +68,7 @@ namespace FineUIPro.Web.JGZL this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId; this.InitTreeMenu();//加载树 this.tvControlItem.SelectedNodeID = this.drpProjectId.SelectedValue; + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -82,6 +117,7 @@ namespace FineUIPro.Web.JGZL { if (this.tvControlItem.SelectedNodeID != "0") { + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -262,7 +298,35 @@ namespace FineUIPro.Web.JGZL { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MeasuringInstrumentsEdit.aspx?projectId={0}", this.tvControlItem.SelectedNodeID, "新增 - "))); + JArray teamGroupData = Grid1.GetMergedData(); + List list = new List(); + foreach (JObject teamGroupRow in teamGroupData) + { + JObject values = teamGroupRow.Value("values"); + list.Add(values); + } + + JObject defaultObj = new JObject + { + { "MeasuringInstrumentsId", Guid.NewGuid() }, + { "MeasuringInstrumentsName", "压力表"}, + { "MeasuringInstrumentsCode", "" }, + { "Specification", "(?-?)Mpa" }, + { "AccuracyLevel", "1.6级" }, + { "CertificateNumber", "" }, + { "VerificationDate", "" }, + { "ValidityPeriod", "半年" }, + { "Remark", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid1.DataSource = list; + Grid1.DataBind(); + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MeasuringInstrumentsEdit.aspx?projectId={0}", this.tvControlItem.SelectedNodeID, "新增 - "))); } else { @@ -271,126 +335,144 @@ namespace FineUIPro.Web.JGZL } } + protected void Grid1_PreDataBound(object sender, EventArgs e) + { + // 设置LinkButtonField的点击客户端事件 + LinkButtonField deleteField = Grid1.FindColumn("Delete3") as LinkButtonField; + deleteField.OnClientClick = GetDeleteScriptGrid1(); + } + + /// + /// 删除提示 + /// + /// + private string GetDeleteScriptGrid1() + { + return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, + Grid1.GetDeleteSelectedRowsReference(), String.Empty); + } + + /// /// 双击编辑 /// /// /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) - { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_MeasuringInstrumentsMenuId, BLL.Const.BtnModify)) - { - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) - { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MeasuringInstrumentsEdit.aspx?measuringInstrumentsId={0}", this.Grid1.SelectedRowID, "编辑 - "))); - } - else - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - } - else - { - Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); - return; - } - } - else - { - ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } + //protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + //{ + // if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_MeasuringInstrumentsMenuId, BLL.Const.BtnModify)) + // { + // if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) + // { + // if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) + // { + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MeasuringInstrumentsEdit.aspx?measuringInstrumentsId={0}", this.Grid1.SelectedRowID, "编辑 - "))); + // } + // else + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } + // } + // else + // { + // Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); + // return; + // } + // } + // else + // { + // ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + // } + //} /// /// 右键编辑 /// /// /// - protected void btnMenuEdit_Click(object sender, EventArgs e) - { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_MeasuringInstrumentsMenuId, BLL.Const.BtnModify)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MeasuringInstrumentsEdit.aspx?measuringInstrumentsId={0}", Grid1.SelectedRowID, "维护 - "))); - } - else - { - Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } + //protected void btnMenuEdit_Click(object sender, EventArgs e) + //{ + // if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_MeasuringInstrumentsMenuId, BLL.Const.BtnModify)) + // { + // if (Grid1.SelectedRowIndexArray.Length == 0) + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } + // PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MeasuringInstrumentsEdit.aspx?measuringInstrumentsId={0}", Grid1.SelectedRowID, "维护 - "))); + // } + // else + // { + // Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + // } + //} /// /// 右键删除 /// /// /// - protected void btnMenuDelete_Click(object sender, EventArgs e) - { - if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_MeasuringInstrumentsMenuId, Const.BtnDelete)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } + //protected void btnMenuDelete_Click(object sender, EventArgs e) + //{ + // if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_MeasuringInstrumentsMenuId, Const.BtnDelete)) + // { + // if (Grid1.SelectedRowIndexArray.Length == 0) + // { + // Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + // return; + // } - bool isShow = true; - if (Grid1.SelectedRowIndexArray.Length > 1) - { - isShow = false; - } - bool isDelete = false; - foreach (int rowIndex in Grid1.SelectedRowIndexArray) - { - string rowID = Grid1.DataKeys[rowIndex][0].ToString(); - if (judgementDelete(rowID, isShow)) - { - isDelete = true; - BLL.MeasuringInstrumentsService.DeleteMeasuringInstrumentsById(rowID); - BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除周期检定计量器具清单"); - } - } - if (isDelete) - { - ShowNotify("删除成功!", MessageBoxIcon.Success); - } - this.BindGrid(); - } - else - { - Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } + // bool isShow = true; + // if (Grid1.SelectedRowIndexArray.Length > 1) + // { + // isShow = false; + // } + // bool isDelete = false; + // foreach (int rowIndex in Grid1.SelectedRowIndexArray) + // { + // string rowID = Grid1.DataKeys[rowIndex][0].ToString(); + // if (judgementDelete(rowID, isShow)) + // { + // isDelete = true; + // BLL.MeasuringInstrumentsService.DeleteMeasuringInstrumentsById(rowID); + // BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除周期检定计量器具清单"); + // } + // } + // if (isDelete) + // { + // ShowNotify("删除成功!", MessageBoxIcon.Success); + // } + // this.BindGrid(); + // } + // else + // { + // Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + // } + //} #region 判断是否可删除 /// /// 判断是否可以删除 /// /// - private bool judgementDelete(string id, bool isShow) - { - string content = string.Empty; + //private bool judgementDelete(string id, bool isShow) + //{ + // string content = string.Empty; - if (string.IsNullOrEmpty(content)) - { - return true; - } - else - { - if (isShow) - { - Alert.ShowInTop(content, MessageBoxIcon.Error); - } - return false; - } - } + // if (string.IsNullOrEmpty(content)) + // { + // return true; + // } + // else + // { + // if (isShow) + // { + // Alert.ShowInTop(content, MessageBoxIcon.Error); + // } + // return false; + // } + //} #endregion #endregion @@ -400,10 +482,70 @@ namespace FineUIPro.Web.JGZL /// /// /// - protected void Window1_Close(object sender, WindowCloseEventArgs e) + //protected void Window1_Close(object sender, WindowCloseEventArgs e) + //{ + // this.InitTreeMenu();//加载树 + // this.BindGrid(); + //} + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) { - this.InitTreeMenu();//加载树 - this.BindGrid(); + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, + Const.JGZL_MeasuringInstrumentsMenuId, Const.BtnSave)) + { + BLL.MeasuringInstrumentsService.DeleteListsByProjectId(this.ProjectId); + List lists = new List(); + JArray teamGroupData = Grid1.GetMergedData(); + foreach (JObject teamGroupRow in teamGroupData) + { + JObject values = teamGroupRow.Value("values"); + int rowIndex = teamGroupRow.Value("index"); + Model.JGZL_MeasuringInstruments newDetail = new Model.JGZL_MeasuringInstruments + { + MeasuringInstrumentsId = values.Value("MeasuringInstrumentsId"), + ProjectId = this.ProjectId, + MeasuringInstrumentsName = values.Value("MeasuringInstrumentsName"), + MeasuringInstrumentsCode = values.Value("MeasuringInstrumentsCode"), + Specification = values.Value("Specification"), + AccuracyLevel = values.Value("AccuracyLevel"), + CertificateNumber = values.Value("CertificateNumber"), + VerificationDate = Funs.GetNewDateTime(values.Value("VerificationDate")), + ValidityPeriod = values.Value("ValidityPeriod"), + Remark = values.Value("Remark"), + CompileMan = this.CurrUser.UserId, + CompileDate = DateTime.Now, + Reviewer = this.CurrUser.UserId, + RevieweDate = DateTime.Now + }; + lists.Add(newDetail); + } + try + { + if (lists.Count > 0) + { + Funs.DB.JGZL_MeasuringInstruments.InsertAllOnSubmit(lists); + ShowNotify("保存成功!", MessageBoxIcon.Success); + } + Funs.DB.SubmitChanges(); + } + catch (Exception) + { + return; + } + //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + else + { + Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + return; + } } #endregion } diff --git a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.designer.cs index a79a010..6cb46db 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/MeasuringInstruments.aspx.designer.cs @@ -113,6 +113,15 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Button btnAdd; + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + /// /// btnPrint 控件。 /// @@ -131,6 +140,78 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Grid Grid1; + /// + /// txtMeasuringInstrumentsName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMeasuringInstrumentsName; + + /// + /// txtMeasuringInstrumentsCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMeasuringInstrumentsCode; + + /// + /// txtSpecification 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecification; + + /// + /// txtAccuracyLevel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAccuracyLevel; + + /// + /// txtCertificateNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtCertificateNumber; + + /// + /// txtVerificationDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtVerificationDate; + + /// + /// txtValidityPeriod 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtValidityPeriod; + + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtRemark; + /// /// ToolbarSeparator1 控件。 /// @@ -158,15 +239,6 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.DropDownList ddlPageSize; - /// - /// Window1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Window Window1; - /// /// WindowPrint 控件。 /// @@ -175,32 +247,5 @@ namespace FineUIPro.Web.JGZL /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window WindowPrint; - - /// - /// Menu1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Menu Menu1; - - /// - /// btnMenuEdit 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuEdit; - - /// - /// btnMenuDelete 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.MenuButton btnMenuDelete; } }