This commit is contained in:
2024-07-30 11:40:11 +08:00
parent 9c97cfcb4c
commit c93dba3c61
6 changed files with 85 additions and 55 deletions
@@ -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
/// <param name="e"></param>
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());
}
/// <summary>
@@ -136,19 +147,13 @@ namespace FineUIPro.Web.Transfer
/// <returns></returns>
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;