2023-04-28 天辰质量报验移植
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BLL;
|
||||
using BLL.CQMS.Comprehensive;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@@ -37,6 +38,12 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
BLL.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
||||
BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);
|
||||
BLL.UnitWorkService.InitUnitWorkDownList(this.drpUnitWorkId, this.CurrUser.LoginProjectId, true);
|
||||
LoadAuditSelect();
|
||||
this.agree.Hidden = true;
|
||||
this.options.Hidden = true;
|
||||
|
||||
this.btnSave.Hidden = true;
|
||||
this.btnSubmit.Hidden = true;
|
||||
this.VisaId = Request.Params["VisaId"];
|
||||
Model.Comprehensive_SiteVisaManagement siteVisaManagement = BLL.SiteVisaManagementService.GetSiteVisaManagementById(this.VisaId);
|
||||
if (siteVisaManagement != null)
|
||||
@@ -68,13 +75,88 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
this.txtSignMan.Text = siteVisaManagement.SignMan;
|
||||
this.txtAuditMan.Text = siteVisaManagement.AuditMan;
|
||||
this.txtRemark.Text = siteVisaManagement.Remark;
|
||||
|
||||
|
||||
var currApprove = SiteVisaManagementApproveService.GetCurrentApprove(siteVisaManagement.VisaId);
|
||||
if (currApprove != null)
|
||||
{
|
||||
this.drpAudit.SelectedValue = currApprove.ApproveMan;
|
||||
//重新编制 编制人 可以 显示 提交 保存按钮
|
||||
if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile && siteVisaManagement.CompileMan == CurrUser.UserId)
|
||||
{
|
||||
this.btnSubmit.Hidden = false;
|
||||
this.btnSave.Hidden = false;
|
||||
}//审核状态 审核人 可以显示 提交 保存按钮
|
||||
else if (currApprove.ApproveType == BLL.Const.Comprehensive_Audit && currApprove.ApproveMan == CurrUser.UserId)
|
||||
{
|
||||
//审核状态不可编辑
|
||||
Readonly();
|
||||
|
||||
this.agree.Hidden = false;
|
||||
this.options.Hidden = false;
|
||||
this.btnSubmit.Hidden = false;
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}//没有当前审核人,已完成状态 或者 待提交状态
|
||||
else
|
||||
{
|
||||
if (siteVisaManagement.Status == BLL.Const.Comprehensive_Compile && siteVisaManagement.CompileMan == CurrUser.UserId)
|
||||
{
|
||||
this.btnSubmit.Hidden = false;
|
||||
this.btnSave.Hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtVisaDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
this.btnSave.Hidden = false;
|
||||
this.btnSubmit.Hidden = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 禁止编辑
|
||||
/// </summary>
|
||||
public void Readonly()
|
||||
{
|
||||
this.txtRemark.Readonly = true;
|
||||
this.drpUnitId.Readonly = true;
|
||||
this.drpCNProfessionalId.Readonly = true;
|
||||
this.txtSignMan.Readonly = true;
|
||||
this.txtVisaCode.Readonly = true;
|
||||
this.txtVisaContent.Readonly = true;
|
||||
this.txtVisaDate.Readonly = true;
|
||||
this.drpUnitWorkId.Readonly = true;
|
||||
this.drpProcessingState.Readonly = true;
|
||||
this.drpAudit.Readonly = true;
|
||||
//this.btnAttach.Enabled = false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载专业工程师
|
||||
/// </summary>
|
||||
public void LoadAuditSelect()
|
||||
{
|
||||
|
||||
var db = Funs.DB;
|
||||
var userList = from x in db.Sys_User
|
||||
join y in db.Project_ProjectUnit
|
||||
on x.UnitId equals y.UnitId
|
||||
join p in db.Project_ProjectUser
|
||||
on x.UserId equals p.UserId
|
||||
where y.UnitId == Const.UnitId_CWCEC && p.ProjectId == CurrUser.LoginProjectId && y.ProjectId == CurrUser.LoginProjectId
|
||||
where p.RoleId.Contains(Const.ZBCNEngineer)
|
||||
select new { UserId = x.UserId, UserName = x.UserName };
|
||||
drpAudit.DataValueField = "UserId";
|
||||
drpAudit.DataTextField = "UserName";
|
||||
this.drpAudit.DataSource = userList.ToList();
|
||||
this.drpAudit.DataBind();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存
|
||||
@@ -92,6 +174,10 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
Model.Comprehensive_SiteVisaManagement siteVisaManagement = new Model.Comprehensive_SiteVisaManagement();
|
||||
siteVisaManagement.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
{
|
||||
siteVisaManagement.AuditMan = drpAudit.SelectedValue;
|
||||
} //审核人
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
siteVisaManagement.UnitId = this.drpUnitId.SelectedValue;
|
||||
@@ -125,17 +211,210 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
siteVisaManagement.VisaId = SQLHelper.GetNewID(typeof(Model.Comprehensive_SiteVisaManagement));
|
||||
this.hdAttachUrl.Text = siteVisaManagement.VisaId;
|
||||
}
|
||||
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == siteVisaManagement.VisaId);
|
||||
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
|
||||
{
|
||||
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
siteVisaManagement.CompileMan = this.CurrUser.UserId;
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_Compile;
|
||||
BLL.SiteVisaManagementService.AddSiteVisaManagement(siteVisaManagement);
|
||||
}
|
||||
else
|
||||
{
|
||||
siteVisaManagement.VisaId = this.VisaId;
|
||||
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.VisaId);
|
||||
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
|
||||
{
|
||||
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
var model = Funs.DB.Comprehensive_SiteVisaManagement.Where(u => u.VisaId == this.VisaId).FirstOrDefault();
|
||||
if (model != null)
|
||||
{
|
||||
siteVisaManagement.Status = model.Status;
|
||||
}
|
||||
BLL.SiteVisaManagementService.UpdateSiteVisaManagement(siteVisaManagement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (drpCNProfessionalId.SelectedValue == BLL.Const._Null)
|
||||
{
|
||||
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
Model.Comprehensive_SiteVisaManagement siteVisaManagement = new Model.Comprehensive_SiteVisaManagement();
|
||||
siteVisaManagement.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
|
||||
{
|
||||
siteVisaManagement.AuditMan = drpAudit.SelectedValue;
|
||||
} //审核人
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
siteVisaManagement.UnitId = this.drpUnitId.SelectedValue;
|
||||
}
|
||||
siteVisaManagement.VisaCode = this.txtVisaCode.Text.Trim();
|
||||
siteVisaManagement.VisaContent = this.txtVisaContent.Text.Trim();
|
||||
siteVisaManagement.ProcessingState = this.drpProcessingState.SelectedValue.Trim();
|
||||
if (this.drpUnitWorkId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
siteVisaManagement.UnitWorkId = this.drpUnitWorkId.SelectedValue;
|
||||
}
|
||||
if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
siteVisaManagement.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtVisaDate.Text))
|
||||
{
|
||||
siteVisaManagement.VisaDate = Convert.ToDateTime(this.txtVisaDate.Text);
|
||||
}
|
||||
siteVisaManagement.SignMan = this.txtSignMan.Text.Trim();
|
||||
siteVisaManagement.AuditMan = this.txtAuditMan.Text.Trim();
|
||||
siteVisaManagement.Remark = this.txtRemark.Text.Trim();
|
||||
if (string.IsNullOrEmpty(this.VisaId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
||||
{
|
||||
siteVisaManagement.VisaId = this.hdAttachUrl.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
siteVisaManagement.VisaId = SQLHelper.GetNewID(typeof(Model.Comprehensive_SiteVisaManagement));
|
||||
this.hdAttachUrl.Text = siteVisaManagement.VisaId;
|
||||
}
|
||||
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == siteVisaManagement.VisaId);
|
||||
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
|
||||
{
|
||||
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
siteVisaManagement.CompileMan = this.CurrUser.UserId;
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_Audit;
|
||||
BLL.SiteVisaManagementService.AddSiteVisaManagement(siteVisaManagement);
|
||||
}
|
||||
else
|
||||
{
|
||||
siteVisaManagement.VisaId = this.VisaId;
|
||||
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.VisaId);
|
||||
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
|
||||
{
|
||||
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
// BLL.SiteVisaManagementService.UpdateSiteVisaManagement(siteVisaManagement);
|
||||
|
||||
var oldSiteVisaManagement = Funs.DB.Comprehensive_SiteVisaManagement.Where(u => u.VisaId == this.VisaId).FirstOrDefault();
|
||||
if (oldSiteVisaManagement == null) //数据库没有记录 直接点提交 当前状态为 审核状态
|
||||
{
|
||||
siteVisaManagement.CompileMan = this.CurrUser.UserId;
|
||||
//siteVisaManagement.CompileDate = DateTime.Now;
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_Audit;
|
||||
BLL.SiteVisaManagementService.AddSiteVisaManagement(siteVisaManagement);
|
||||
}
|
||||
else
|
||||
{
|
||||
siteVisaManagement.CompileMan = oldSiteVisaManagement.CompileMan;
|
||||
//siteVisaManagement.CompileDate = oldSiteVisaManagement.CompileDate;
|
||||
if (oldSiteVisaManagement.Status == BLL.Const.Comprehensive_Compile)//编制状态提交变审核
|
||||
{
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_Audit;
|
||||
}
|
||||
else if (oldSiteVisaManagement.Status == BLL.Const.Comprehensive_ReCompile)//重新编制状态提交变审核
|
||||
{
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_Audit;
|
||||
}
|
||||
else //审核状态 提交 变 完成 或者 重新编制
|
||||
{
|
||||
if (Convert.ToBoolean(rblIsAgree.SelectedValue))
|
||||
{
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_Complete;
|
||||
}
|
||||
else
|
||||
{
|
||||
siteVisaManagement.Status = BLL.Const.Comprehensive_ReCompile;
|
||||
}
|
||||
}
|
||||
|
||||
BLL.SiteVisaManagementService.UpdateSiteVisaManagement(siteVisaManagement);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#region 审核记录
|
||||
|
||||
var currApprove = SiteVisaManagementApproveService.GetCurrentApprove(siteVisaManagement.VisaId);
|
||||
if (currApprove == null) //为获取到为 当前编制状态 直接提交
|
||||
{
|
||||
var approve = new Model.Comprehensive_SiteVisaManagementApprove();
|
||||
approve.VisaId = siteVisaManagement.VisaId;
|
||||
approve.ApproveMan = this.CurrUser.UserId;
|
||||
approve.ApproveType = Const.Comprehensive_Compile;
|
||||
approve.ApproveDate = DateTime.Now;
|
||||
SiteVisaManagementApproveService.EditApprove(approve); //新增编制记录
|
||||
|
||||
|
||||
Model.Comprehensive_SiteVisaManagementApprove newApprove = new Model.Comprehensive_SiteVisaManagementApprove();
|
||||
newApprove.VisaId = siteVisaManagement.VisaId;
|
||||
newApprove.ApproveMan = this.drpAudit.SelectedValue;
|
||||
newApprove.ApproveType = Const.InspectionManagement_Audit;
|
||||
SiteVisaManagementApproveService.EditApprove(newApprove); //新增专业工程师审核记录
|
||||
|
||||
}
|
||||
else if (currApprove.ApproveMan == CurrUser.UserId)
|
||||
{
|
||||
if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile)
|
||||
{
|
||||
currApprove.ApproveDate = DateTime.Now;
|
||||
//currApprove.IsAgree = true;
|
||||
SiteVisaManagementApproveService.EditApprove(currApprove); //新增专业工程师审核记录
|
||||
Model.Comprehensive_SiteVisaManagementApprove newApprove = new Model.Comprehensive_SiteVisaManagementApprove();
|
||||
newApprove.VisaId = siteVisaManagement.VisaId;
|
||||
newApprove.ApproveMan = this.drpAudit.SelectedValue;
|
||||
newApprove.ApproveType = Const.InspectionManagement_Audit;
|
||||
SiteVisaManagementApproveService.EditApprove(newApprove); //新增专业工程师审核记录
|
||||
}
|
||||
else
|
||||
{
|
||||
currApprove.ApproveDate = DateTime.Now; //更新审核时间
|
||||
currApprove.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
|
||||
currApprove.ApproveIdea = this.txtidea.Text;
|
||||
SiteVisaManagementApproveService.EditApprove(currApprove);
|
||||
|
||||
if (Convert.ToBoolean(rblIsAgree.SelectedValue)) //同意时 审批完成
|
||||
{
|
||||
Model.Comprehensive_SiteVisaManagementApprove reApprove = new Model.Comprehensive_SiteVisaManagementApprove();
|
||||
reApprove.VisaId = currApprove.VisaId;
|
||||
reApprove.ApproveDate = DateTime.Now.AddSeconds(10);
|
||||
reApprove.ApproveMan = CurrUser.UserId;
|
||||
reApprove.ApproveType = Const.Comprehensive_Complete;
|
||||
reApprove.ApproveIdea = txtidea.Text;
|
||||
SiteVisaManagementApproveService.EditApprove(reApprove);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Comprehensive_SiteVisaManagementApprove reApprove = new Model.Comprehensive_SiteVisaManagementApprove();
|
||||
reApprove.VisaId = currApprove.VisaId;
|
||||
reApprove.ApproveMan = siteVisaManagement.CompileMan;
|
||||
reApprove.ApproveType = Const.Comprehensive_ReCompile;
|
||||
SiteVisaManagementApproveService.EditApprove(reApprove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 附件上传
|
||||
@@ -150,7 +429,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.Comprehensive_SiteVisaManagement));
|
||||
}
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/SiteVisaManagement&menuId={1}", this.hdAttachUrl.Text, BLL.Const.SiteVisaManagementMenuId)));
|
||||
Model.Comprehensive_SiteVisaManagement siteVisaManagement = BLL.SiteVisaManagementService.GetSiteVisaManagementById(this.VisaId);
|
||||
if (siteVisaManagement == null || ((siteVisaManagement.CompileMan == CurrUser.UserId && siteVisaManagement.Status == BLL.Const.Comprehensive_Compile) || (siteVisaManagement.CompileMan == CurrUser.UserId && siteVisaManagement.Status == BLL.Const.Comprehensive_ReCompile)))
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/siteVisaManagement&menuId={1}", this.hdAttachUrl.Text, BLL.Const.SiteVisaManagementMenuId)));
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/CQMS/siteVisaManagement&menuId={1}", this.hdAttachUrl.Text, BLL.Const.SiteVisaManagementMenuId)));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user