修改共检通知单

This commit is contained in:
2023-08-15 15:11:57 +08:00
parent a4281a4b80
commit a7631a1e61
19 changed files with 366 additions and 108 deletions
@@ -21,7 +21,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
GetButtonPower();
BLL.UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);//施工分包商
BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);//专业
UserService.InitUserProjectIdUnitTypeDropDownList(this.drpAcceptanceCheckMan, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, false);
this.hdInspectionNoticeId.Text = Request.Params["inspectionId"];
if (!string.IsNullOrEmpty(this.hdInspectionNoticeId.Text))
{
@@ -37,7 +37,10 @@ namespace FineUIPro.Web.CQMS.ProcessControl
this.drpCNProfessionalId.SelectedValue = inspectionManagement.CNProfessionalId;
}
this.txtAcceptanceSite.Text = inspectionManagement.AcceptanceSite;
this.txtAcceptanceCheckMan.Text = inspectionManagement.AcceptanceCheckMan;
if (!string.IsNullOrEmpty(inspectionManagement.AcceptanceCheckMan))
{
this.drpAcceptanceCheckMan.SelectedValueArray = inspectionManagement.AcceptanceCheckMan.Split(',');
}
this.txtNoticeCode.Text = inspectionManagement.NoticeCode;
this.Grid1.DataSource = BLL.InspectionManagementDetailService.GetInspectionDetails(this.hdInspectionNoticeId.Text.Trim());
this.Grid1.DataBind();
@@ -74,6 +77,8 @@ namespace FineUIPro.Web.CQMS.ProcessControl
Alert.ShowInTop("请先选择专业!", MessageBoxIcon.Warning);
return;
}
Model.ProcessControl_InspectionManagement inspectionManagement = new Model.ProcessControl_InspectionManagement();
inspectionManagement.ProjectId = this.CurrUser.LoginProjectId;
if (this.drpUnit.SelectedValue != BLL.Const._Null)
@@ -86,9 +91,28 @@ namespace FineUIPro.Web.CQMS.ProcessControl
}
inspectionManagement.NoticeCode = this.txtNoticeCode.Text.Trim();
inspectionManagement.AcceptanceSite = this.txtAcceptanceSite.Text.Trim();
inspectionManagement.AcceptanceCheckMan = this.txtAcceptanceCheckMan.Text.Trim();
//检查人
string CheckManIds = string.Empty;
foreach (var item in this.drpAcceptanceCheckMan.SelectedValueArray)
{
CheckManIds += item + ",";
}
if (!string.IsNullOrEmpty(CheckManIds))
{
CheckManIds = CheckManIds.Substring(0, CheckManIds.LastIndexOf(","));
}
inspectionManagement.AcceptanceCheckMan = CheckManIds;
//inspectionManagement.AcceptanceCheckMan = this.txtAcceptanceCheckMan.Text.Trim();
if (string.IsNullOrEmpty(Request.Params["inspectionId"]))
{
//编号不能重复
var InspectionManagementModel = Funs.DB.ProcessControl_InspectionManagement.FirstOrDefault(x => x.NoticeCode == this.txtNoticeCode.Text.Trim());
if (InspectionManagementModel != null)
{
ShowNotify("共检通知单编号已存在,不能重复!", MessageBoxIcon.Warning);
return;
}
inspectionManagement.CompileMan = this.CurrUser.UserId;
inspectionManagement.CompileDate = DateTime.Now;
if (!string.IsNullOrEmpty(this.hdInspectionNoticeId.Text.Trim()))
@@ -100,13 +124,35 @@ namespace FineUIPro.Web.CQMS.ProcessControl
inspectionManagement.InspectionId = SQLHelper.GetNewID(typeof(Model.ProcessControl_InspectionManagement));
this.hdInspectionNoticeId.Text = inspectionManagement.InspectionId;
}
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == inspectionManagement.InspectionId);
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
{
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
BLL.InspectionManagementService.AddInspectionManagement(inspectionManagement);
}
else
{
//编号不能重复
var InspectionManagementModel = Funs.DB.ProcessControl_InspectionManagement.FirstOrDefault(x => x.NoticeCode == this.txtNoticeCode.Text.Trim()
&& x.InspectionId!= Request.Params["inspectionId"]);
if (InspectionManagementModel != null)
{
ShowNotify("共检通知单编号已存在,不能重复!", MessageBoxIcon.Warning);
return;
}
Model.ProcessControl_InspectionManagement oldInspectionManagement = BLL.InspectionManagementService.GetInspectionManagementById(this.hdInspectionNoticeId.Text.Trim());
inspectionManagement.AttachUrl2 = oldInspectionManagement.AttachUrl2;
inspectionManagement.InspectionId = this.hdInspectionNoticeId.Text.Trim();
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == inspectionManagement.InspectionId);
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
{
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
BLL.InspectionManagementService.UpdateInspectionManagement(inspectionManagement);
BLL.InspectionManagementDetailService.DeleteAllInspectionDetail(inspectionManagement.InspectionId);
}