diff --git a/HJGL_DS/BLL/JGZL/PipeFittingInspectionRecordService.cs b/HJGL_DS/BLL/JGZL/PipeFittingInspectionRecordService.cs index 7c89fbc..f8c5152 100644 --- a/HJGL_DS/BLL/JGZL/PipeFittingInspectionRecordService.cs +++ b/HJGL_DS/BLL/JGZL/PipeFittingInspectionRecordService.cs @@ -94,5 +94,16 @@ namespace BLL db.SubmitChanges(); } } + + public static void DeleteListsByProjectId(string projectId) + { + SGGLDB db = Funs.DB; + var q = (from x in db.JGZL_PipeFittingInspectionRecord where x.ProjectId == projectId select x).ToList(); + if (q.Count > 0) + { + db.JGZL_PipeFittingInspectionRecord.DeleteAllOnSubmit(q); + db.SubmitChanges(); + } + } } } diff --git a/HJGL_DS/BLL/JGZL/SteelPipeCheckRecordService.cs b/HJGL_DS/BLL/JGZL/SteelPipeCheckRecordService.cs index a7f0a97..60f3d52 100644 --- a/HJGL_DS/BLL/JGZL/SteelPipeCheckRecordService.cs +++ b/HJGL_DS/BLL/JGZL/SteelPipeCheckRecordService.cs @@ -17,6 +17,12 @@ namespace BLL e.RecordId == recordId); } + public static Model.JGZL_SteelPipeCheckRecord GetSteelPipeReportByProjectId(string projectId) + { + return Funs.DB.JGZL_SteelPipeCheckRecord.FirstOrDefault(e => + e.ProjectId == projectId); + } + /// /// 添加钢管检查验收记录 /// diff --git a/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/管件宏观检查记录表.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/管件宏观检查记录表.frx index 70a5eca..d610e5e 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/File/Fastreport/JGZL/钢管检查验收记录.frx b/HJGL_DS/FineUIPro.Web/File/Fastreport/JGZL/钢管检查验收记录.frx index 2dee118..a04804e 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; @@ -72,7 +72,7 @@ namespace FastReport } - + @@ -95,8 +95,17 @@ namespace FastReport - - + + + + + + + + + + + @@ -110,7 +119,7 @@ namespace FastReport - + @@ -125,11 +134,11 @@ namespace FastReport - + - + @@ -145,12 +154,12 @@ namespace FastReport - + - + - + @@ -242,15 +251,15 @@ namespace FastReport - - - - - + + + + + - + @@ -278,7 +287,7 @@ namespace FastReport - + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx index cf621a9..8d4087c 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx @@ -40,6 +40,7 @@ + @@ -51,67 +52,108 @@ EnableColumnLines="true" ClicksToEdit="1" DataIDField="RecordId" AllowSorting="true" SortField="ContractNo" 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="String" HeaderTextAlign="Center" TextAlign="Left" Width="60px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="60px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="120px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="80px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="80px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="80px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="80px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="80px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="100px"> + + + + FieldType="String" HeaderTextAlign="Center" TextAlign="Left" Width="90px"> + + + + + + - <%-- - --%> - - - @@ -130,30 +172,10 @@ - - - - - - - - diff --git a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs index 498c5c2..53f1f4a 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.cs @@ -1,18 +1,53 @@ using BLL; +using Model; +using Newtonsoft.Json.Linq; +using NPOI.SS.UserModel; 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 PipeFittingInspectionRecord : PageBase { + #region 定义项 + /// + /// 主键 + /// + private string RecordId + { + get + { + return (string)ViewState["RecordId"]; + } + set + { + ViewState["RecordId"] = value; + } + } + + /// + /// 项目Id + /// + private string ProjectId + { + get + { + return (string)ViewState["ProjectId"]; + } + set + { + ViewState["ProjectId"] = value; + } + } + #endregion + #region 加载页面 /// /// 加载页面 @@ -34,6 +69,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 +118,7 @@ namespace FineUIPro.Web.JGZL { if (this.tvControlItem.SelectedNodeID != "0") { + this.ProjectId = this.tvControlItem.SelectedNodeID; this.BindGrid(); } } @@ -93,24 +130,13 @@ namespace FineUIPro.Web.JGZL /// private void BindGrid() { - //string projectIds = BLL.Base_ProjectService.GetStrOnProjectIds(this.CurrUser.UserId, "1"); - string strSql = @"SELECT * from JGZL_PipeFittingInspectionRecord where 1=1"; + string strSql = @"SELECT * from JGZL_PipeFittingInspectionRecord where ProjectId=@projectId"; List listStr = new List(); - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - strSql += " AND ProjectId = @ProjectId"; - listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID)); - } - //else - //{ - // strSql += " AND CHARINDEX(ProjectId,@ProjectId)>0 "; - // listStr.Add(new SqlParameter("@ProjectId", projectIds)); - //} + listStr.Add(new SqlParameter("@projectId", this.ProjectId)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); // 2.获取当前分页数据 Grid1.RecordCount = tb.Rows.Count; - //tb = GetFilteredTable(Grid1.FilteredData, tb); var table = this.GetPagedDataTable(Grid1, tb); Grid1.DataSource = table; Grid1.DataBind(); @@ -164,7 +190,9 @@ namespace FineUIPro.Web.JGZL /// protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e) { + this.ProjectId = this.drpProjectId.SelectedValue; this.InitTreeMenu(); + this.tvControlItem.SelectedNodeID = this.ProjectId; this.BindGrid(); } @@ -187,9 +215,7 @@ namespace FineUIPro.Web.JGZL /// protected void btnPrint_Click(object sender, EventArgs e) { - string projectId = this.tvControlItem.SelectedNodeID; - - if (projectId != null) + if (!string.IsNullOrEmpty(this.ProjectId)) { string initTemplatePath = ""; string rootPath = Server.MapPath("~/"); @@ -197,7 +223,7 @@ namespace FineUIPro.Web.JGZL string strSql = @"SELECT * from JGZL_PipeFittingInspectionRecord where ProjectId = @ProjectId order by CompileDate "; List listStr = new List(); - listStr.Add(new SqlParameter("@ProjectId", projectId)); + listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); @@ -241,7 +267,7 @@ namespace FineUIPro.Web.JGZL BLL.Common.FastReportService.AddFastreportTable(dt); Dictionary keyValuePairs = new Dictionary(); - keyValuePairs.Add("ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName); + keyValuePairs.Add("ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(this.ProjectId).ProjectName); BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); initTemplatePath = "File\\Fastreport\\JGZL\\管件宏观检查记录表.frx"; @@ -268,7 +294,40 @@ namespace FineUIPro.Web.JGZL { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipeFittingInspectionRecordEdit.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 + { + { "RecordId", Guid.NewGuid() }, + { "Name", ""}, + { "ContractNo", "" }, + { "ArrivalUnit", "" }, + { "ArrivalNum", "" }, + { "MaterialCertificateNumber", "" }, + { "Material", "" }, + { "Specifications", "" }, + { "InspectionNum", "" }, + { "ODVariation", "" }, + { "IDVariation", "" }, + { "WallVariation", "" }, + { "OtherVariation", "" }, + { "AppearanceQuality", "" }, + { "Result", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid1.DataSource = list; + Grid1.DataBind(); } else { @@ -277,139 +336,82 @@ namespace FineUIPro.Web.JGZL } } - /// - /// 双击编辑 - /// - /// - /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + protected void Grid1_PreDataBound(object sender, EventArgs e) { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_PipeFittingInspectionRecordMenuId, BLL.Const.BtnModify)) - { - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) - { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipeFittingInspectionRecordEdit.aspx?recordId={0}", this.Grid1.SelectedRowID, "编辑 - "))); - } - else - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - } - else - { - Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); - return; - } - } - else - { - ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } + // 设置LinkButtonField的点击客户端事件 + LinkButtonField deleteField = Grid1.FindColumn("Delete3") as LinkButtonField; + deleteField.OnClientClick = GetDeleteScriptGrid1(); } /// - /// 右键编辑 - /// - /// - /// - protected void btnMenuEdit_Click(object sender, EventArgs e) - { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_PipeFittingInspectionRecordMenuId, BLL.Const.BtnModify)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PipeFittingInspectionRecordEdit.aspx?recordId={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_PipeFittingInspectionRecordMenuId, 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.PipeFittingInspectionRecordService.DeletePipeFittingInspectionRecordById(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) + private string GetDeleteScriptGrid1() { - string content = string.Empty; - - if (string.IsNullOrEmpty(content)) - { - return true; - } - else - { - if (isShow) - { - Alert.ShowInTop(content, MessageBoxIcon.Error); - } - return false; - } + return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, + Grid1.GetDeleteSelectedRowsReference(), String.Empty); } #endregion - #endregion - #region 关闭弹出窗口及刷新页面 + #region 保存 /// - /// 关闭弹出窗口 + /// 保存按钮 /// /// /// - protected void Window1_Close(object sender, WindowCloseEventArgs e) + protected void btnSave_Click(object sender, EventArgs e) { - this.InitTreeMenu();//加载树 - this.BindGrid(); + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, + Const.JGZL_PipeFittingInspectionRecordMenuId, Const.BtnSave)) + { + BLL.PipeFittingInspectionRecordService.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_PipeFittingInspectionRecord newDetail = new Model.JGZL_PipeFittingInspectionRecord + { + RecordId = values.Value("RecordId"), + ProjectId = this.ProjectId, + Name = values.Value("Name"), + ContractNo = values.Value("ContractNo"), + ArrivalUnit = values.Value("ArrivalUnit"), + ArrivalNum = Funs.GetNewInt(values.Value("ArrivalNum")), + MaterialCertificateNumber = values.Value("MaterialCertificateNumber"), + Material = values.Value("Material"), + Specifications = values.Value("Specifications"), + InspectionNum = Funs.GetNewInt(values.Value("InspectionNum")), + ODVariation = values.Value("ODVariation"), + IDVariation = values.Value("IDVariation"), + WallVariation = values.Value("WallVariation"), + OtherVariation = values.Value("OtherVariation"), + AppearanceQuality = values.Value("AppearanceQuality"), + Result = values.Value("Result"), + }; + lists.Add(newDetail); + } + try + { + if (lists.Count > 0) + { + Funs.DB.JGZL_PipeFittingInspectionRecord.InsertAllOnSubmit(lists); + ShowNotify("保存成功!", MessageBoxIcon.Success); + } + Funs.DB.SubmitChanges(); + } + catch (Exception) + { + return; + } + } + else + { + Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); + return; + } } #endregion } diff --git a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.designer.cs index 0abd896..0cd82f6 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/PipeFittingInspectionRecord.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,132 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.Grid Grid1; + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// txtContractNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtContractNo; + + /// + /// txtArrivalUnit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtArrivalUnit; + + /// + /// txtArrivalNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtArrivalNum; + + /// + /// txtMaterialCertificateNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterialCertificateNumber; + + /// + /// txtMaterial 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterial; + + /// + /// txtSpecifications 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecifications; + + /// + /// txtInspectionNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.NumberBox txtInspectionNum; + + /// + /// txtODVariation 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtODVariation; + + /// + /// txtIDVariation 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtIDVariation; + + /// + /// txtWallVariation 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtWallVariation; + + /// + /// txtOtherVariation 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtOtherVariation; + + /// + /// txtAppearanceQuality 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAppearanceQuality; + + /// + /// txtResult 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtResult; + /// /// ToolbarSeparator1 控件。 /// @@ -158,15 +293,6 @@ namespace FineUIPro.Web.JGZL /// protected global::FineUIPro.DropDownList ddlPageSize; - /// - /// Window1 控件。 - /// - /// - /// 自动生成的字段。 - /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 - /// - protected global::FineUIPro.Window Window1; - /// /// WindowPrint 控件。 /// @@ -175,32 +301,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; } } diff --git a/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx b/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx index f810d37..8a944af 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx +++ b/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx @@ -4,134 +4,252 @@ - + 钢管检查验收记录 -
- - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.cs b/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.cs index 9b9982d..3133016 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.cs @@ -1,14 +1,53 @@ using BLL; +using Model; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; -using System.Data.SqlClient; using System.Data; -using System.Linq; +using System.Data.SqlClient; using System.IO; +using System.Linq; namespace FineUIPro.Web.JGZL { public partial class SteelPipeCheckRecord : PageBase { + #region 定义项 + + /// + /// 主键 + /// + private string RecordId + { + get { return (string)ViewState["RecordId"]; } + set { ViewState["RecordId"] = value; } + } + + /// + /// 项目Id + /// + private string ProjectId + { + get { return (string)ViewState["ProjectId"]; } + set { ViewState["ProjectId"] = value; } + } + + /// + /// 附件路径 + /// + public string FullAttachUrl + { + get + { + return (string)ViewState["FullAttachUrl"]; + } + set + { + ViewState["FullAttachUrl"] = value; + } + } + + #endregion + #region 加载页面 /// /// 加载页面 @@ -19,18 +58,15 @@ namespace FineUIPro.Web.JGZL { if (!IsPostBack) { - this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); + //this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString(); this.drpProjectId.DataTextField = "ProjectCode"; this.drpProjectId.DataValueField = "ProjectId"; this.drpProjectId.DataSource = BLL.Base_ProjectService.GetOnProjectListByUserId(this.CurrUser.UserId, "1"); this.drpProjectId.DataBind(); Funs.FineUIPleaseSelect(this.drpProjectId); - // 默认显示选中的项目 - if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId)) - { - this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId; - } + this.drpProjectId.SelectedValue = this.CurrUser.LoginProjectId; + this.ProjectId = this.drpProjectId.SelectedValue; this.InitTreeMenu();//加载树 } @@ -81,10 +117,10 @@ namespace FineUIPro.Web.JGZL rootProjectNode.CommandName = "项目名称"; rootNode.Nodes.Add(rootProjectNode); } - + if (this.tvControlItem.SelectedNodeID != "0") { - this.BindGrid(); + DataInfo(); } } #endregion @@ -99,25 +135,60 @@ namespace FineUIPro.Web.JGZL { if (this.tvControlItem.SelectedNodeID != "0") { - this.BindGrid(); + this.ProjectId = this.tvControlItem.SelectedNodeID; + this.DataInfo(); } } #endregion #region 数据绑定 + + private void DataInfo() + { + if (!string.IsNullOrEmpty(this.ProjectId)) + { + var report = SteelPipeCheckRecordService.GetSteelPipeReportByProjectId(this.ProjectId); + if (report != null) + { + this.RecordId = report.RecordId; + this.txtContractCode.Text= report.ContractCode; + this.txtArrivalDate.Text =string.Format("{0:yyyy-MM-dd}",report.ArrivalDate); + this.txtExecutionStandard.Text = report.ExecutionStandard; + this.drpCrack.SelectedValue = report.Crack; + this.drpSlagInclusion.SelectedValue = report.SlagInclusion; + this.drpShrinkageHole.SelectedValue = report.ShrinkageHole; + this.drpHeavyLeather.SelectedValue = report.HeavyLeather; + this.drpOther.SelectedValue = report.Other; + this.imgPicture.ImageUrl = report.Remark; + } + else + { + //默认 + this.RecordId = string.Empty; + this.txtContractCode.Text = string.Empty; + this.txtArrivalDate.Text = string.Empty; + this.txtExecutionStandard.Text = string.Empty; + this.drpCrack.SelectedValue = "合格"; + this.drpSlagInclusion.SelectedValue = "合格"; + this.drpShrinkageHole.SelectedValue = "合格"; + this.drpHeavyLeather.SelectedValue = "合格"; + this.drpOther.SelectedValue= "合格"; + this.imgPicture.ImageUrl = string.Empty; + } + BindGrid(); + BindGrid2(); + } + } + /// /// 数据绑定 /// private void BindGrid() { - string strSql = @"SELECT * from JGZL_SteelPipeCheckRecord where 1=1 "; + string strSql = @"SELECT * from JGZL_SteelPipeCheckRecordItem1 where RecordId=@recordId "; List listStr = new List(); - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) - { - strSql += " AND ProjectId = @ProjectId"; - listStr.Add(new SqlParameter("@ProjectId", this.tvControlItem.SelectedNodeID)); - } - + listStr.Add(new SqlParameter("@recordId", this.RecordId)); + SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); Grid1.RecordCount = tb.Rows.Count; @@ -125,47 +196,22 @@ namespace FineUIPro.Web.JGZL Grid1.DataSource = table; Grid1.DataBind(); } - #endregion - #region 分页排序 - #region 页索引改变事件 - /// - /// 页索引改变事件 - /// - /// - /// - protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + private void BindGrid2() { - BindGrid(); - } - #endregion + string strSql = @"SELECT * from JGZL_SteelPipeCheckRecordItem2 where RecordId=@recordId "; + List listStr = new List(); + listStr.Add(new SqlParameter("@recordId", this.RecordId)); - #region 排序 - /// - /// 排序 - /// - /// - /// - protected void Grid1_Sort(object sender, GridSortEventArgs e) - { - BindGrid(); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + Grid2.RecordCount = tb.Rows.Count; + var table = this.GetPagedDataTable(Grid2, tb); + Grid2.DataSource = table; + Grid2.DataBind(); } #endregion - #region 分页选择下拉改变事件 - /// - /// 分页选择下拉改变事件 - /// - /// - /// - protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) - { - Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); - BindGrid(); - } - #endregion - #endregion - #region 查询 /// ///查询 @@ -174,8 +220,10 @@ namespace FineUIPro.Web.JGZL /// protected void drpProjectId_SelectedIndexChanged(object sender, EventArgs e) { + this.ProjectId = this.drpProjectId.SelectedValue; this.InitTreeMenu(); - this.BindGrid(); + this.tvControlItem.SelectedNodeID = this.ProjectId; + DataInfo(); } /// @@ -183,10 +231,10 @@ namespace FineUIPro.Web.JGZL /// /// /// - protected void TextBox_TextChanged(object sender, EventArgs e) - { - this.BindGrid(); - } + //protected void TextBox_TextChanged(object sender, EventArgs e) + //{ + // this.BindGrid(); + //} #endregion #region 打印 @@ -197,130 +245,150 @@ namespace FineUIPro.Web.JGZL /// protected void btnPrint_Click(object sender, EventArgs e) { - string projectId = this.tvControlItem.SelectedNodeID; - - if (projectId != null) + if (!string.IsNullOrEmpty(this.ProjectId)) { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) + string initTemplatePath = ""; + string rootPath = Server.MapPath("~/"); + BLL.Common.FastReportService.ResetData(); + + var report = BLL.SteelPipeCheckRecordService.GetSteelPipeReportById(this.RecordId); + if (report != null) { - string initTemplatePath = ""; - string rootPath = Server.MapPath("~/"); - BLL.Common.FastReportService.ResetData(); + DataTable dtMainData = new DataTable(); + dtMainData.TableName = "MData"; + dtMainData.Columns.Add("ProjectName"); + dtMainData.Columns.Add("ContractCode"); + dtMainData.Columns.Add("ArrivalDate"); + dtMainData.Columns.Add("ExecutionStandard"); + dtMainData.Columns.Add("Crack"); + dtMainData.Columns.Add("SlagInclusion"); + dtMainData.Columns.Add("ShrinkageHole"); + dtMainData.Columns.Add("HeavyLeather"); + dtMainData.Columns.Add("Other"); + dtMainData.Columns.Add("ImageUrl"); - var report = BLL.SteelPipeCheckRecordService.GetSteelPipeReportById(this.Grid1.SelectedRowID); - if (report != null) + var newMainData = dtMainData.NewRow(); + newMainData["ProjectName"] = BLL.Base_ProjectService.GetProjectByProjectId(this.ProjectId).ProjectName; + newMainData["ContractCode"] = report.ContractCode; + string arrivalDate = report.ArrivalDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ArrivalDate) : ""; + newMainData["ArrivalDate"] = arrivalDate; + newMainData["ExecutionStandard"] = report.ExecutionStandard; + newMainData["Crack"] = report.Crack; + newMainData["SlagInclusion"] = report.SlagInclusion; + newMainData["ShrinkageHole"] = report.ShrinkageHole; + newMainData["HeavyLeather"] = report.HeavyLeather; + newMainData["Other"] = report.Other; + newMainData["ImageUrl"] = Funs.RootPath + report.Remark.Substring(report.Remark.IndexOf('/')); + + dtMainData.Rows.Add(newMainData); + + BLL.Common.FastReportService.AddFastreportTable(dtMainData); + + Dictionary keyValuePairs = new Dictionary(); + //keyValuePairs.Add("ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName); + //keyValuePairs.Add("ContractCode", report.ContractCode); + //keyValuePairs.Add("ArrivalDate", string.Format("{0:yyyy.MM.dd}", report.ArrivalDate)); + //keyValuePairs.Add("ExecutionStandard", report.ExecutionStandard); + //keyValuePairs.Add("Crack", report.Crack); + //keyValuePairs.Add("SlagInclusion", report.SlagInclusion); + //keyValuePairs.Add("ShrinkageHole", report.ShrinkageHole); + //keyValuePairs.Add("HeavyLeather", report.HeavyLeather); + //keyValuePairs.Add("Other", report.Other); + //keyValuePairs.Add("Remark", report.Remark); + BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); + + ////加载图片 + //var imageUrl = (from x in Funs.DB.AttachFile where x.ToKeyId == report.RecordId && x.MenuId == BLL.Const.JGZL_SteelPipeCheckRecordMenuId select x).FirstOrDefault(); + //if (imageUrl != null) + //{ + // DataTable imagedt = new DataTable(); + // imagedt.TableName = "ImageData"; + // imagedt.Columns.Add("ImageUrl"); + // var newRowsImage = imagedt.NewRow(); + // newRowsImage["ImageUrl"] = Funs.RootPath + imageUrl.AttachUrl; + // imagedt.Rows.Add(newRowsImage); + // BLL.Common.FastReportService.AddFastreportTable(imagedt); + //} + + //明细表1 + string strSql = @"SELECT * from JGZL_SteelPipeCheckRecordItem1 where RecordId=@recordId "; + List listStr = new List(); + listStr.Add(new SqlParameter("@recordId", this.RecordId)); + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + DataTable dt = new DataTable(); + dt.TableName = "Data"; + dt.Columns.Add("Name"); + dt.Columns.Add("Material"); + dt.Columns.Add("Specifications"); + dt.Columns.Add("Quantity"); + dt.Columns.Add("MaterialCertificateCode"); + dt.Columns.Add("HeatCode"); + dt.Columns.Add("MaterialCertificateSelfNumber"); + + DataRow[] rows = tb.DefaultView.ToTable().Select(); + foreach (var row in rows) { - Dictionary keyValuePairs = new Dictionary(); - keyValuePairs.Add("ProjectName", BLL.Base_ProjectService.GetProjectByProjectId(projectId).ProjectName); - keyValuePairs.Add("ContractCode", report.ContractCode); - keyValuePairs.Add("ArrivalDate", string.Format("{0:yyyy.MM.dd}", report.ArrivalDate)); - keyValuePairs.Add("ExecutionStandard", report.ExecutionStandard); - keyValuePairs.Add("Crack", report.Crack); - keyValuePairs.Add("SlagInclusion", report.SlagInclusion); - keyValuePairs.Add("ShrinkageHole", report.ShrinkageHole); - keyValuePairs.Add("HeavyLeather", report.HeavyLeather); - keyValuePairs.Add("Other", report.Other); - keyValuePairs.Add("Remark", report.Remark); - BLL.Common.FastReportService.AddFastreportParameter(keyValuePairs); + var newRows = dt.NewRow(); + newRows["Name"] = row["Name"].ToString(); + newRows["Material"] = row["Material"].ToString(); + newRows["Specifications"] = row["Specifications"].ToString(); + newRows["Quantity"] = row["Quantity"].ToString(); + newRows["MaterialCertificateCode"] = row["MaterialCertificateCode"].ToString(); + newRows["HeatCode"] = row["HeatCode"].ToString(); + newRows["MaterialCertificateSelfNumber"] = row["MaterialCertificateSelfNumber"].ToString(); - //加载图片 - var imageUrl = (from x in Funs.DB.AttachFile where x.ToKeyId == report.RecordId && x.MenuId == BLL.Const.JGZL_SteelPipeCheckRecordMenuId select x).FirstOrDefault(); - if (imageUrl != null) - { - DataTable imagedt = new DataTable(); - imagedt.TableName = "ImageData"; - imagedt.Columns.Add("ImageUrl"); - var newRowsImage = imagedt.NewRow(); - newRowsImage["ImageUrl"] = Funs.RootPath + imageUrl.AttachUrl; - imagedt.Rows.Add(newRowsImage); - BLL.Common.FastReportService.AddFastreportTable(imagedt); - } - - //明细表1 - string strSql = @"SELECT * from JGZL_SteelPipeCheckRecordItem1 where RecordId=@recordId "; - List listStr = new List(); - listStr.Add(new SqlParameter("@recordId", this.Grid1.SelectedRowID)); - SqlParameter[] parameter = listStr.ToArray(); - DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); - - DataTable dt = new DataTable(); - dt.TableName = "Data"; - dt.Columns.Add("Name"); - dt.Columns.Add("Material"); - dt.Columns.Add("Specifications"); - dt.Columns.Add("Quantity"); - dt.Columns.Add("MaterialCertificateCode"); - dt.Columns.Add("HeatCode"); - dt.Columns.Add("MaterialCertificateSelfNumber"); - - DataRow[] rows = tb.DefaultView.ToTable().Select(); - foreach (var row in rows) - { - var newRows = dt.NewRow(); - newRows["Name"] = row["Name"].ToString(); - newRows["Material"] = row["Material"].ToString(); - newRows["Specifications"] = row["Specifications"].ToString(); - newRows["Quantity"] = row["Quantity"].ToString(); - newRows["MaterialCertificateCode"] = row["MaterialCertificateCode"].ToString(); - newRows["HeatCode"] = row["HeatCode"].ToString(); - newRows["MaterialCertificateSelfNumber"] = row["MaterialCertificateSelfNumber"].ToString(); - - dt.Rows.Add(newRows); - } - BLL.Common.FastReportService.AddFastreportTable(dt); - - //明细表2 - string strSql2 = @"SELECT * from JGZL_SteelPipeCheckRecordItem2 where RecordId=@recordId "; - List listStr2 = new List(); - listStr2.Add(new SqlParameter("@recordId", this.Grid1.SelectedRowID)); - SqlParameter[] parameter2 = listStr2.ToArray(); - DataTable tb2 = SQLHelper.GetDataTableRunText(strSql2, parameter2); - - DataTable dt2 = new DataTable(); - dt2.TableName = "ItemData"; - dt2.Columns.Add("Num"); - dt2.Columns.Add("Part1"); - dt2.Columns.Add("Part2"); - dt2.Columns.Add("Part3"); - dt2.Columns.Add("Part4"); - dt2.Columns.Add("InnerDiameter"); - dt2.Columns.Add("OuterDiameter"); - dt2.Columns.Add("Lengths"); - - DataRow[] rows2 = tb2.DefaultView.ToTable().Select(); - int i = 0; - foreach (var row in rows2) - { - var newRows = dt2.NewRow(); - newRows["Num"] = (i + 1).ToString(); - newRows["Part1"] = row["Part1"].ToString(); - newRows["Part2"] = row["Part2"].ToString(); - newRows["Part3"] = row["Part3"].ToString(); - newRows["Part4"] = row["Part4"].ToString(); - newRows["InnerDiameter"] = row["InnerDiameter"].ToString(); - newRows["OuterDiameter"] = row["OuterDiameter"].ToString(); - newRows["Lengths"] = row["Lengths"].ToString(); - - dt2.Rows.Add(newRows); - i++; - } - BLL.Common.FastReportService.AddFastreportTable(dt2); + dt.Rows.Add(newRows); } - initTemplatePath = "File\\Fastreport\\JGZL\\钢管检查验收记录.frx"; - if (File.Exists(rootPath + initTemplatePath)) + BLL.Common.FastReportService.AddFastreportTable(dt); + + //明细表2 + string strSql2 = @"SELECT * from JGZL_SteelPipeCheckRecordItem2 where RecordId=@recordId "; + List listStr2 = new List(); + listStr2.Add(new SqlParameter("@recordId", this.RecordId)); + SqlParameter[] parameter2 = listStr2.ToArray(); + DataTable tb2 = SQLHelper.GetDataTableRunText(strSql2, parameter2); + + DataTable dt2 = new DataTable(); + dt2.TableName = "ItemData"; + dt2.Columns.Add("Num"); + dt2.Columns.Add("Part1"); + dt2.Columns.Add("Part2"); + dt2.Columns.Add("Part3"); + dt2.Columns.Add("Part4"); + dt2.Columns.Add("InnerDiameter"); + dt2.Columns.Add("OuterDiameter"); + dt2.Columns.Add("Lengths"); + + DataRow[] rows2 = tb2.DefaultView.ToTable().Select(); + int i = 0; + foreach (var row in rows2) { - PageContext.RegisterStartupScript(WindowPrint.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); + var newRows = dt2.NewRow(); + newRows["Num"] = (i + 1).ToString(); + newRows["Part1"] = row["Part1"].ToString(); + newRows["Part2"] = row["Part2"].ToString(); + newRows["Part3"] = row["Part3"].ToString(); + newRows["Part4"] = row["Part4"].ToString(); + newRows["InnerDiameter"] = row["InnerDiameter"].ToString(); + newRows["OuterDiameter"] = row["OuterDiameter"].ToString(); + newRows["Lengths"] = row["Lengths"].ToString(); + + dt2.Rows.Add(newRows); + i++; } + BLL.Common.FastReportService.AddFastreportTable(dt2); } - else + initTemplatePath = "File\\Fastreport\\JGZL\\钢管检查验收记录.frx"; + if (File.Exists(rootPath + initTemplatePath)) { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; + PageContext.RegisterStartupScript(WindowPrint.GetShowReference(String.Format("../common/ReportPrint/Fastreport.aspx?ReportPath={0}", rootPath + initTemplatePath))); } } else { - Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); return; } } @@ -336,7 +404,89 @@ namespace FineUIPro.Web.JGZL { if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SteelPipeCheckRecordEdit.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 + { + { "RecordItemId", Guid.NewGuid() }, + { "Name", ""}, + { "Material", "" }, + { "Specifications", "" }, + { "Quantity", "" }, + { "MaterialCertificateCode", "" }, + { "HeatCode", "" }, + { "MaterialCertificateSelfNumber", "" }, + { + "Delete3", + String.Format("", + GetDeleteScriptGrid1(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid1.DataSource = list; + Grid1.DataBind(); + } + else + { + Alert.ShowInTop("请选择项目!", MessageBoxIcon.Warning); + return; + } + } + 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 btnAddItem2_Click(object sender, EventArgs e) + { + if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) + { + JArray teamGroupData = Grid2.GetMergedData(); + List list = new List(); + foreach (JObject teamGroupRow in teamGroupData) + { + JObject values = teamGroupRow.Value("values"); + list.Add(values); + } + + JObject defaultObj = new JObject + { + { "RecordItemId", Guid.NewGuid() }, + { "Part1", ""}, + { "Part2", "" }, + { "Part3", "" }, + { "Part4", "" }, + { "InnerDiameter", "" }, + { "OuterDiameter", "" }, + { "Lengths", "" }, + { + "Delete2", + String.Format("", + GetDeleteScriptGrid2(), IconHelper.GetResolvedIconUrl(Icon.Delete)) + } + }; + list.Add(defaultObj); + Grid2.DataSource = list; + Grid2.DataBind(); } else { @@ -345,144 +495,177 @@ namespace FineUIPro.Web.JGZL } } + + protected void Grid2_PreDataBound(object sender, EventArgs e) + { + // 设置LinkButtonField的点击客户端事件 + LinkButtonField deleteField = Grid2.FindColumn("Delete2") as LinkButtonField; + deleteField.OnClientClick = GetDeleteScriptGrid2(); + } + /// - /// 双击编辑 + /// 删除提示 + /// + /// + private string GetDeleteScriptGrid2() + { + return Confirm.GetShowReference("删除选中行?", String.Empty, MessageBoxIcon.Question, + Grid2.GetDeleteSelectedRowsReference(), String.Empty); + } + + #endregion + + #region 上传 + /// + /// 上传 /// /// /// - protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + protected void filePicture_FileSelected(object sender, EventArgs e) { - if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.JGZL_SteelPipeCheckRecordMenuId, BLL.Const.BtnModify)) + if (filePicture.HasFile) { - if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID)) + string fileName = filePicture.ShortFileName; + if (!ValidateFileType(fileName)) { - if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID)) + ShowNotify("无效的文件类型!"); + return; + } + fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_"); + fileName = DateTime.Now.Ticks.ToString() + "_" + fileName; + filePicture.SaveAs(Server.MapPath("~/upload/" + fileName)); + imgPicture.ImageUrl = "~/upload/" + fileName; + // 清空文件上传组件 + filePicture.Reset(); + } + } + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, + Const.JGZL_SteelPipeCheckRecordMenuId, Const.BtnSave)) + { + Model.JGZL_SteelPipeCheckRecord newReport = new JGZL_SteelPipeCheckRecord(); + newReport.ContractCode = this.txtContractCode.Text.Trim(); + newReport.ArrivalDate = Funs.GetNewDateTime(this.txtArrivalDate.Text); + newReport.ExecutionStandard = this.txtExecutionStandard.Text; + newReport.Crack = this.drpCrack.SelectedValue; + newReport.SlagInclusion = this.drpSlagInclusion.SelectedValue; + newReport.ShrinkageHole= this.drpShrinkageHole.SelectedValue; + newReport.HeavyLeather = this.drpHeavyLeather.SelectedValue; + newReport.Other = this.drpOther.SelectedValue; + newReport.Remark = imgPicture.ImageUrl;//图片 + if (!string.IsNullOrEmpty(this.RecordId)) + { + var r = BLL.SteelPipeCheckRecordService.GetSteelPipeReportById(this.RecordId); + if (r != null) { - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SteelPipeCheckRecordEdit.aspx?recordId={0}", this.Grid1.SelectedRowID, "编辑 - "))); - } - else - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; + string url = r.Remark.Substring(r.Remark.IndexOf('/')); + if (File.Exists(Funs.RootPath + url)) + { + //删除被覆盖的图片 + File.Delete(Funs.RootPath + url); + } } + newReport.RecordId = this.RecordId; + BLL.SteelPipeCheckRecordService.UpdateSteelPipeReport(newReport); } 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_SteelPipeCheckRecordMenuId, BLL.Const.BtnModify)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; - } - PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SteelPipeCheckRecordEdit.aspx?recordId={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_SteelPipeCheckRecordMenuId, Const.BtnDelete)) - { - if (Grid1.SelectedRowIndexArray.Length == 0) - { - Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); - return; + newReport.RecordId = SQLHelper.GetNewID(typeof(Model.JGZL_SteelPipeCheckRecord)); + newReport.ProjectId = this.ProjectId; + newReport.CompileMan = this.CurrUser.UserId; + newReport.CompileDate = DateTime.Now; + this.RecordId = newReport.RecordId; + BLL.SteelPipeCheckRecordService.AddSteelPipeReport(newReport); } - bool isShow = true; - if (Grid1.SelectedRowIndexArray.Length > 1) + + BLL.SteelPipeCheckRecordItem1Service.DeleteSteelPipeItem1ByRecordId(this.RecordId); + List lists = new List(); + JArray teamGroupData = Grid1.GetMergedData(); + foreach (JObject teamGroupRow in teamGroupData) { - isShow = false; - } - bool isDelete = false; - foreach (int rowIndex in Grid1.SelectedRowIndexArray) - { - string rowID = Grid1.DataKeys[rowIndex][0].ToString(); - if (judgementDelete(rowID, isShow)) + JObject values = teamGroupRow.Value("values"); + int rowIndex = teamGroupRow.Value("index"); + Model.JGZL_SteelPipeCheckRecordItem1 newDetail = new Model.JGZL_SteelPipeCheckRecordItem1 { - isDelete = true; - //删除附件 - AttachFileService.GetAttachFile(rowID, BLL.Const.JGZL_SteelPipeCheckRecordMenuId); - BLL.SteelPipeCheckRecordItem1Service.DeleteSteelPipeItem1ByRecordId(rowID); - BLL.SteelPipeCheckRecordItem2Service.DeleteSteelPipeItem2ByRecordId(rowID); - BLL.SteelPipeCheckRecordService.DeleteSteelPipeReportById(rowID); - BLL.Sys_LogService.AddLog(BLL.Const.System_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "删除钢管检查验收记录"); - } + RecordItemId = values.Value("RecordItemId"), + RecordId = this.RecordId, + Name = values.Value("Name"), + Material = values.Value("Material"), + Specifications = values.Value("Specifications"), + Quantity = values.Value("Quantity"), + MaterialCertificateCode = values.Value("MaterialCertificateCode"), + HeatCode = values.Value("HeatCode"), + MaterialCertificateSelfNumber = values.Value("MaterialCertificateSelfNumber"), + }; + lists.Add(newDetail); } - if (isDelete) + try { - ShowNotify("删除成功!", MessageBoxIcon.Success); + if (lists.Count > 0) + { + Funs.DB.JGZL_SteelPipeCheckRecordItem1.InsertAllOnSubmit(lists); + //ShowNotify("保存成功!", MessageBoxIcon.Success); + } + Funs.DB.SubmitChanges(); } - this.BindGrid(); + catch (Exception) + { + return; + } + + BLL.SteelPipeCheckRecordItem2Service.DeleteSteelPipeItem2ByRecordId(this.RecordId); + List lists2 = new List(); + JArray teamGroupData2 = Grid2.GetMergedData(); + foreach (JObject teamGroupRow in teamGroupData2) + { + JObject values = teamGroupRow.Value("values"); + int rowIndex = teamGroupRow.Value("index"); + Model.JGZL_SteelPipeCheckRecordItem2 newDetai2 = new Model.JGZL_SteelPipeCheckRecordItem2 + { + RecordItemId = values.Value("RecordItemId"), + RecordId = this.RecordId, + Part1 = values.Value("Part1"), + Part2 = values.Value("Part2"), + Part3 = values.Value("Part3"), + Part4 = values.Value("Part4"), + InnerDiameter = values.Value("InnerDiameter"), + OuterDiameter = values.Value("OuterDiameter"), + Lengths = values.Value("Lengths"), + }; + lists2.Add(newDetai2); + } + try + { + if (lists2.Count > 0) + { + Funs.DB.JGZL_SteelPipeCheckRecordItem2.InsertAllOnSubmit(lists2); + + } + Funs.DB.SubmitChanges(); + } + catch (Exception) + { + return; + } + ShowNotify("保存成功!", MessageBoxIcon.Success); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); - } - } - - #region 判断是否可删除 - /// - /// 判断是否可以删除 - /// - /// - 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; + return; } } #endregion - #endregion - #region 关闭弹出窗口及刷新页面 - /// - /// 关闭弹出窗口 - /// - /// - /// - protected void Window1_Close(object sender, WindowCloseEventArgs e) - { - this.InitTreeMenu();//加载树 - this.BindGrid(); - } - #endregion } } \ No newline at end of file diff --git a/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.designer.cs b/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.designer.cs index 0d9c842..73cd57d 100644 --- a/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.designer.cs +++ b/HJGL_DS/FineUIPro.Web/JGZL/SteelPipeCheckRecord.aspx.designer.cs @@ -105,13 +105,13 @@ namespace FineUIPro.Web.JGZL protected global::FineUIPro.ToolbarFill ToolbarFill1; /// - /// btnAdd 控件。 + /// btnSave 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Button btnAdd; + protected global::FineUIPro.Button btnSave; /// /// btnPrint 控件。 @@ -132,40 +132,319 @@ namespace FineUIPro.Web.JGZL protected global::FineUIPro.Grid Grid1; /// - /// ToolbarSeparator1 控件。 + /// Toolbar3 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + protected global::FineUIPro.Toolbar Toolbar3; /// - /// ToolbarText1 控件。 + /// txtContractCode 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.ToolbarText ToolbarText1; + protected global::FineUIPro.TextBox txtContractCode; /// - /// ddlPageSize 控件。 + /// txtArrivalDate 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.DropDownList ddlPageSize; + protected global::FineUIPro.DatePicker txtArrivalDate; /// - /// Window1 控件。 + /// txtExecutionStandard 控件。 /// /// /// 自动生成的字段。 /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// - protected global::FineUIPro.Window Window1; + protected global::FineUIPro.TextBox txtExecutionStandard; + + /// + /// ToolbarFill2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill2; + + /// + /// btnAdd 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAdd; + + /// + /// txtName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtName; + + /// + /// txtMaterial 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterial; + + /// + /// txtSpecifications 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecifications; + + /// + /// txtQuantity 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtQuantity; + + /// + /// txtMaterialCertificateCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterialCertificateCode; + + /// + /// txtHeatCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtHeatCode; + + /// + /// txtMaterialCertificateSelfNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtMaterialCertificateSelfNumber; + + /// + /// drpCrack 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpCrack; + + /// + /// drpSlagInclusion 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpSlagInclusion; + + /// + /// drpShrinkageHole 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpShrinkageHole; + + /// + /// drpHeavyLeather 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpHeavyLeather; + + /// + /// drpOther 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpOther; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label1; + + /// + /// imgPicture 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Image imgPicture; + + /// + /// Label2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label2; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label3; + + /// + /// filePicture 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload filePicture; + + /// + /// Label4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label4; + + /// + /// Grid2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid2; + + /// + /// Toolbar4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar4; + + /// + /// ToolbarFill3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarFill ToolbarFill3; + + /// + /// btnAddItem2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAddItem2; + + /// + /// txtPart1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPart1; + + /// + /// txtPart2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPart2; + + /// + /// txtPart3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPart3; + + /// + /// txtPart4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtPart4; + + /// + /// txtInnerDiameter 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtInnerDiameter; + + /// + /// txtOuterDiameter 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtOuterDiameter; + + /// + /// txtLengths 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtLengths; /// /// WindowPrint 控件。 @@ -175,32 +454,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; } }