From c93dba3c61e527fc9d1e0c6325ecef0dca7cd931 Mon Sep 17 00:00:00 2001 From: liyh Date: Tue, 30 Jul 2024 11:40:11 +0800 Subject: [PATCH] 1212 --- .../AttachFile/webuploader.aspx.cs | 12 ++-- .../FineUIPro.Web/Transfer/PunchlistFrom.aspx | 4 +- .../Transfer/PunchlistFrom.aspx.cs | 5 +- .../Transfer/PunchlistFromEdit.aspx | 42 ++++++------ .../Transfer/PunchlistFromEdit.aspx.cs | 68 ++++++++++++------- .../PunchlistFromEdit.aspx.designer.cs | 9 +++ 6 files changed, 85 insertions(+), 55 deletions(-) diff --git a/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs b/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs index 821158c6..3333ace5 100644 --- a/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs +++ b/SGGL/FineUIPro.Web/AttachFile/webuploader.aspx.cs @@ -778,12 +778,12 @@ namespace FineUIPro.Web.AttachFile } #endregion - #region PunchlistFrom附件保存成功后处理事件 - if (MenuId == BLL.Const.PunchlistFromMenuId) - { - PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); - } - #endregion + //#region PunchlistFrom附件保存成功后处理事件 + //if (MenuId == BLL.Const.PunchlistFromMenuId) + //{ + // PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + //} + //#endregion PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } diff --git a/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx b/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx index 95720d13..7d45c29e 100644 --- a/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx +++ b/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx @@ -244,14 +244,14 @@ diff --git a/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx.cs b/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx.cs index afbd3ffb..2c47563e 100644 --- a/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/PunchlistFrom.aspx.cs @@ -212,6 +212,10 @@ namespace FineUIPro.Web.Transfer { BindGrid(); } + protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) + { + BindGrid(); + } #endregion #region 删除 @@ -569,7 +573,6 @@ namespace FineUIPro.Web.Transfer Response.Flush(); Response.Close(); File.Delete(newUrl); - } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx b/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx index d4a631ad..b1cb418d 100644 --- a/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx +++ b/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx @@ -17,65 +17,65 @@ + + - + - + + + + + - - - - - + - + - - - + + + - + - - - - + + + - - - + - + + + - diff --git a/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.cs b/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.cs index b599f9ef..1dd548ca 100644 --- a/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.cs @@ -50,6 +50,7 @@ namespace FineUIPro.Web.Transfer var TransferPunchlistFrom = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(p => p.Id == this.Id); if (TransferPunchlistFrom != null) { + this.txtNum_NO.Text = TransferPunchlistFrom.Num_NO; this.txtSystem_No.Text = TransferPunchlistFrom.System_No; this.txtSub_Sys_No.Text = TransferPunchlistFrom.Sub_Sys_No; this.txtDESCRIPTION.Text = TransferPunchlistFrom.DESCRIPTION; @@ -83,6 +84,16 @@ namespace FineUIPro.Web.Transfer this.txtVerified_Date.Text = Convert.ToDateTime(TransferPunchlistFrom.Verified_Date).ToString("yyyy-MM-dd"); this.txtRemark.Text = TransferPunchlistFrom.Remark; } + else + { + var maxNumNO = 0; + var modelTp = Funs.DB.Transfer_PunchlistFrom.OrderByDescending(x => x.Num_NO).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + if (modelTp == null) + maxNumNO = 1; + else + maxNumNO = Convert.ToInt32(modelTp.Num_NO) + 1; + this.txtNum_NO.Text = maxNumNO.ToString("0000"); + } } } @@ -122,12 +133,12 @@ namespace FineUIPro.Web.Transfer /// protected void btnSave_Click(object sender, EventArgs e) { - if (SaveData() == 0) { - Alert.ShowInTop("保存失败!", MessageBoxIcon.Warning); + if (SaveData() == 0) + { return; } - ShowNotify("保存成功",MessageBoxIcon.Success); - PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); + ShowNotify("保存成功", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } /// @@ -136,19 +147,13 @@ namespace FineUIPro.Web.Transfer /// private int SaveData() { - int reutState = 0; - var maxNumNO = 0; - var modelTp = Funs.DB.Transfer_PunchlistFrom.OrderByDescending(x => x.Num_NO).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); - if (modelTp == null) - maxNumNO = 1; - else - maxNumNO = Convert.ToInt32(modelTp.Num_NO) + 1; + int reutState = 0; Model.Transfer_PunchlistFrom newTransferFrom = new Model.Transfer_PunchlistFrom() { - Id= Guid.NewGuid().ToString(), - Num_NO = maxNumNO.ToString("0000"), - ProjectId=this.ProjectId, + Id = Guid.NewGuid().ToString(), + Num_NO = this.txtNum_NO.Text.Trim(), + ProjectId = this.ProjectId, System_No = this.txtSystem_No.Text.Trim(), Sub_Sys_No = this.txtSub_Sys_No.Text.Trim(), DESCRIPTION = this.txtDESCRIPTION.Text.Trim(), @@ -159,19 +164,19 @@ namespace FineUIPro.Web.Transfer IsEng = this.ddlIsEng.SelectedValue == "Y" ? true : false, IsMatI = this.ddlIsMatI.SelectedValue, Punch_Type = this.txtPunch_Type.Text.Trim(), - Required_Date= Funs.GetNewDateTime(this.txtRequired_Date.Text), - Action_By= this.txtAction_By.Text.Trim(), - PIC= this.txtPIC.Text.Trim(), - PIC_WUH=this.txtPIC_WUH.Text.Trim(), - Correction_Action= this.txtCorrection_Action.Text.Trim(), + Required_Date = Funs.GetNewDateTime(this.txtRequired_Date.Text), + Action_By = this.txtAction_By.Text.Trim(), + PIC = this.txtPIC.Text.Trim(), + PIC_WUH = this.txtPIC_WUH.Text.Trim(), + Correction_Action = this.txtCorrection_Action.Text.Trim(), Actual_Date = Funs.GetNewDateTime(this.txtActual_Date.Text), - Cleared_By= this.txtCleared_By.Text.Trim(), + Cleared_By = this.txtCleared_By.Text.Trim(), Cleared_Date = Funs.GetNewDateTime(this.txtCleared_Date.Text), - Confirmed_By= this.txtConfirmed_By.Text.Trim(), + Confirmed_By = this.txtConfirmed_By.Text.Trim(), Confirmed_Date = Funs.GetNewDateTime(this.txtConfirmed_Date.Text), - Verified_By= this.txtVerified_By.Text.Trim(), + Verified_By = this.txtVerified_By.Text.Trim(), Verified_Date = Funs.GetNewDateTime(this.txtVerified_Date.Text), - Remark= this.txtRemark.Text.Trim() + Remark = this.txtRemark.Text.Trim() }; if (newTransferFrom.Cleared_Date == null && newTransferFrom.Confirmed_Date == null && newTransferFrom.Verified_Date == null) @@ -184,11 +189,24 @@ namespace FineUIPro.Web.Transfer var TransferPunchlistFrom = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(p => p.Id == this.Id); if (TransferPunchlistFrom == null) { + if (Funs.DB.Transfer_PunchlistFrom.Where(p => p.ProjectId == this.ProjectId && p.Num_NO == newTransferFrom.Num_NO).Count() > 0) + { + ShowNotify("录入的NO.重复了,不能保存", MessageBoxIcon.Warning); + return reutState; + } + Funs.DB.Transfer_PunchlistFrom.InsertOnSubmit(newTransferFrom); - this.Id = newTransferFrom.Id; + this.Id = newTransferFrom.Id; } - else + else { + if (Funs.DB.Transfer_PunchlistFrom.Where(p => p.ProjectId == this.ProjectId && p.Num_NO == newTransferFrom.Num_NO && p.Id != TransferPunchlistFrom.Id).Count() > 0) + { + ShowNotify("录入的NO.重复了,不能保存", MessageBoxIcon.Warning); + return reutState; + } + + TransferPunchlistFrom.Num_NO = newTransferFrom.Num_NO; TransferPunchlistFrom.System_No = newTransferFrom.System_No; TransferPunchlistFrom.Sub_Sys_No = newTransferFrom.Sub_Sys_No; TransferPunchlistFrom.DESCRIPTION = newTransferFrom.DESCRIPTION; diff --git a/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.designer.cs index ef019b0c..58d3720b 100644 --- a/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Transfer/PunchlistFromEdit.aspx.designer.cs @@ -41,6 +41,15 @@ namespace FineUIPro.Web.Transfer /// protected global::FineUIPro.Form SimpleForm1; + /// + /// txtNum_NO 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtNum_NO; + /// /// txtSystem_No 控件。 ///