2023-04-28 天辰质量报验移植

This commit is contained in:
2023-04-28 17:46:41 +08:00
parent dbfd7086e1
commit 03c6364f47
171 changed files with 17248 additions and 2071 deletions
@@ -1,4 +1,5 @@
using BLL;
using BLL.CQMS.Comprehensive;
using System;
using System.Linq;
@@ -35,15 +36,19 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{
GetButtonPower();
BLL.UnitService.InitUnitDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
this.drpUnitId.SelectedValue = CurrUser.UnitId;
BLL.CNProfessionalService.InitCNProfessionalDownList(this.drpCNProfessionalId, true);
BLL.InspectionEquipmentService.InitAttributeDropDownList(this.drpAttribute, true);
Funs.FineUIPleaseSelect(this.drpEquipmentOrMatail);
LoadAuditSelect();
this.agree.Hidden = true;
this.options.Hidden = true;
this.btnSave.Hidden = true;
this.btnSubmit.Hidden = true;
this.InspectionEquipmentId = Request.Params["InspectionEquipmentId"];
var inspectionEquipment = BLL.InspectionEquipmentService.GetInspectionEquipmentById(this.InspectionEquipmentId);
if (inspectionEquipment != null)
{
this.InspectionEquipmentId = inspectionEquipment.InspectionEquipmentId;
this.hdAttachUrl.Text = this.InspectionEquipmentId;
if (!string.IsNullOrEmpty(inspectionEquipment.UnitId))
{
this.drpUnitId.SelectedValue = inspectionEquipment.UnitId;
@@ -53,10 +58,6 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{
this.drpCNProfessionalId.SelectedValue = inspectionEquipment.CNProfessionalId;
}
if (!string.IsNullOrEmpty(inspectionEquipment.EquipmentOrMatail))
{
this.drpEquipmentOrMatail.SelectedValue = inspectionEquipment.EquipmentOrMatail;
}
this.txtInspectionName.Text = inspectionEquipment.InspectionName;
this.txtSpecifications.Text = inspectionEquipment.Specifications;
this.txtSupplier.Text = inspectionEquipment.Supplier;
@@ -78,14 +79,151 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
this.txtInspectionDate.Text = inspectionEquipment.InspectionDate.HasValue ? string.Format("{0:yyyy-MM-dd}", inspectionEquipment.InspectionDate) : "";
this.txtRemarkCode.Text = inspectionEquipment.RemarkCode;
this.txtEquipmentNo.Text = inspectionEquipment.EquipmentNO;
this.txtUsedPlace.Text = inspectionEquipment.UsedPlace;
var currApprove = InspectionEquipmentApproveService.GetCurrentApprove(inspectionEquipment.InspectionEquipmentId);
if(currApprove != null)
{
this.drpAudit.SelectedValue = currApprove.ApproveMan;
//重新编制 编制人 可以 显示 提交 保存按钮
if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile && inspectionEquipment.CompileMan == CurrUser.UserId)
{
this.btnSubmit.Hidden = false;
this.btnSave.Hidden = false;
}//审核状态 审核人 可以显示 提交 保存按钮
else if (currApprove.ApproveType== BLL.Const.Comprehensive_Audit&&currApprove.ApproveMan== CurrUser.UserId)
{
//审核状态不可编辑
this.txtInspectionName.Readonly = true;
this.drpUnitId.Readonly = true;
this.drpCNProfessionalId.Readonly = true;
this.txtSpecifications.Readonly = true;
this.txtSupplier.Readonly = true;
this.drpAttribute.Readonly = true;
this.drpSamplingResult.Readonly = true;
this.txtInspectionDate.Readonly = true;
this.txtRemarkCode.Readonly = true;
this.txtEquipmentNo.Readonly = true;
this.txtUsedPlace.Readonly = true;
this.drpAudit.Readonly = true;
this.txtSamplingCount.Readonly = true;
this.txtCounts.Readonly = true;
this.agree.Hidden = false;
this.options.Hidden = false;
this.btnSubmit.Hidden = false;
this.btnSave.Hidden = false;
}
}//没有当前审核人,已完成状态 或者 待提交状态
else
{
if(inspectionEquipment.Status == BLL.Const.Comprehensive_Compile && inspectionEquipment.CompileMan == CurrUser.UserId)
{
this.btnSubmit.Hidden = false;
this.btnSave.Hidden = false;
}
}
//var res = InspectionEquipmentApproveService.GetState(inspectionEquipment.InspectionEquipmentId);
//if (inspectionEquipment.CompileMan != CurrUser.UserId) //不是创建用户禁止编辑
//{
// Readonly();
//}
//if (res != null)
//{
// if (res.ApproveType.Trim() == BLL.Const.Comprehensive_Audit)
// {
// this.txtInspectionName.Readonly = true;
// this.drpUnitId.Readonly = true;
// this.drpCNProfessionalId.Readonly = true;
// this.txtSpecifications.Readonly = true;
// this.txtSupplier.Readonly = true;
// this.drpAttribute.Readonly = true;
// this.drpSamplingResult.Readonly = true;
// this.txtInspectionDate.Readonly = true;
// this.txtRemarkCode.Readonly = true;
// this.txtEquipmentNo.Readonly = true;
// this.txtUsedPlace.Readonly = true;
// this.drpAudit.Readonly = true;
// this.txtSamplingCount.Readonly = true;
// this.txtCounts.Readonly = true;
// this.btnAttach.Enabled = false;
// this.btnSave.Enabled = false;
// if (res.ApproveMan == CurrUser.UserId)
// {
// this.agree.Hidden = false;
// this.options.Hidden = false;
// this.drpAudit.Hidden = true;
// this.btnSubmit.Enabled = true;
// }
// }
// else if (res.ApproveType.Trim() == BLL.Const.Comprehensive_ReCompile) //重报
// {
// }
// else if (res.ApproveType.Trim() == BLL.Const.Comprehensive_Complete) //已完成
// {
// Readonly();
// }
//}
}
else
{
this.txtInspectionDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
this.btnSave.Hidden = false;
this.btnSubmit.Hidden = false;
}
}
}
/// <summary>
/// 禁止编辑
/// </summary>
public void Readonly()
{
this.txtInspectionName.Readonly = true;
this.drpUnitId.Readonly = true;
this.drpCNProfessionalId.Readonly = true;
this.txtSpecifications.Readonly = true;
this.txtSupplier.Readonly = true;
this.drpAttribute.Readonly = true;
this.drpSamplingResult.Readonly = true;
this.txtInspectionDate.Readonly = true;
this.txtRemarkCode.Readonly = true;
this.txtEquipmentNo.Readonly = true;
this.txtUsedPlace.Readonly = true;
this.drpAudit.Readonly = true;
this.txtSamplingCount.Readonly = true;
this.txtCounts.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
@@ -101,16 +239,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
Alert.ShowInTop("请选择报验单位!", MessageBoxIcon.Warning);
return;
}
if (this.drpCNProfessionalId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择专业!", MessageBoxIcon.Warning);
return;
}
if (this.drpEquipmentOrMatail.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择设备/材料!", MessageBoxIcon.Warning);
return;
}
Model.Comprehensive_InspectionEquipment newInspectionEquipment = new Model.Comprehensive_InspectionEquipment();
newInspectionEquipment.ProjectId = this.CurrUser.LoginProjectId;
newInspectionEquipment.UnitId = this.drpUnitId.SelectedValue;
@@ -122,11 +251,17 @@ namespace FineUIPro.Web.CQMS.Comprehensive
newInspectionEquipment.InspectionName = this.txtInspectionName.Text.Trim();
newInspectionEquipment.Specifications = this.txtSpecifications.Text.Trim();
newInspectionEquipment.Supplier = this.txtSupplier.Text.Trim();
newInspectionEquipment.EquipmentOrMatail = this.drpEquipmentOrMatail.SelectedValue;
newInspectionEquipment.EquipmentNO = this.txtEquipmentNo.Text.Trim();
newInspectionEquipment.RemarkCode = this.txtRemarkCode.Text.Trim();
newInspectionEquipment.Counts = this.txtCounts.Text.Trim();
newInspectionEquipment.SamplingCount = this.txtSamplingCount.Text.Trim();
newInspectionEquipment.UsedPlace = this.txtUsedPlace.Text.Trim();
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
{
newInspectionEquipment.AuditMan = drpAudit.SelectedValue;
} //审核人
if (this.drpAttribute.SelectedValue != BLL.Const._Null)
{
newInspectionEquipment.Attribute = this.drpAttribute.SelectedValue;
@@ -139,30 +274,265 @@ namespace FineUIPro.Web.CQMS.Comprehensive
{
newInspectionEquipment.InspectionDate = Convert.ToDateTime(this.txtInspectionDate.Text);
}
if (string.IsNullOrEmpty(this.InspectionEquipmentId))
{
{ newInspectionEquipment.InspectionEquipmentId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionPerson));
newInspectionEquipment.CompileMan = this.CurrUser.UserId;
newInspectionEquipment.CompileDate = DateTime.Now;
if (!string.IsNullOrEmpty(hdAttachUrl.Text))
newInspectionEquipment.Status = BLL.Const.Comprehensive_Compile;
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == newInspectionEquipment.InspectionEquipmentId);
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
{
newInspectionEquipment.InspectionEquipmentId = hdAttachUrl.Text;
}
else
{
newInspectionEquipment.InspectionEquipmentId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionPerson));
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
BLL.InspectionEquipmentService.AddInspectionEquipment(newInspectionEquipment);
}
else
{
newInspectionEquipment.InspectionEquipmentId = this.InspectionEquipmentId;
BLL.InspectionEquipmentService.UpdateInspectionEquipment(newInspectionEquipment);
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.InspectionEquipmentId);
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
{
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
var oldInspectionEquipment = Funs.DB.Comprehensive_InspectionEquipment.Where(u => u.InspectionEquipmentId == this.InspectionEquipmentId).FirstOrDefault();
if (oldInspectionEquipment == null)
{
newInspectionEquipment.CompileMan = this.CurrUser.UserId;
newInspectionEquipment.CompileDate = DateTime.Now;
newInspectionEquipment.Status = BLL.Const.Comprehensive_Compile;
BLL.InspectionEquipmentService.AddInspectionEquipment(newInspectionEquipment);
}
else
{
newInspectionEquipment.CompileMan = oldInspectionEquipment.CompileMan;
newInspectionEquipment.CompileDate = oldInspectionEquipment.CompileDate;
newInspectionEquipment.Status = oldInspectionEquipment.Status;
BLL.InspectionEquipmentService.UpdateInspectionEquipment(newInspectionEquipment);
}
}
//else
//{
// newInspectionEquipment.InspectionEquipmentId = this.InspectionEquipmentId;
// var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.InspectionEquipmentId);
// if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
// {
// Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
// return;
// }
// BLL.InspectionEquipmentService.UpdateInspectionEquipment(newInspectionEquipment);
//}
//#region 审核记录
//var approve = InspectionEquipmentApproveService.GetApproveByApproveMan(newInspectionEquipment.InspectionEquipmentId, CurrUser.UserId);
//if (approve == null) //未添加审核信息时
//{
// approve = new Model.Comprehensive_InspectionEquipmentApprove();
// approve.InspectionEquipmentId = newInspectionEquipment.InspectionEquipmentId;
// approve.ApproveMan = this.CurrUser.UserId;
// approve.ApproveType = Const.Comprehensive_Compile;
// approve.ApproveDate = DateTime.Now;
// InspectionEquipmentApproveService.EditApprove(approve); //新增编制记录
//}
//else
//{
// approve.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
// approve.ApproveIdea = txtidea.Text.Trim();
//}
//#endregion
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (this.drpUnitId.SelectedValue == BLL.Const._Null)
{
Alert.ShowInTop("请选择报验单位!", MessageBoxIcon.Warning);
return;
}
Model.Comprehensive_InspectionEquipment newInspectionEquipment = new Model.Comprehensive_InspectionEquipment();
newInspectionEquipment.ProjectId = this.CurrUser.LoginProjectId;
newInspectionEquipment.UnitId = this.drpUnitId.SelectedValue;
newInspectionEquipment.InspectionCode = this.txtInspectionCode.Text.Trim();
if (this.drpCNProfessionalId.SelectedValue != BLL.Const._Null)
{
newInspectionEquipment.CNProfessionalId = this.drpCNProfessionalId.SelectedValue;
}
newInspectionEquipment.InspectionName = this.txtInspectionName.Text.Trim();
newInspectionEquipment.Specifications = this.txtSpecifications.Text.Trim();
newInspectionEquipment.Supplier = this.txtSupplier.Text.Trim();
newInspectionEquipment.EquipmentNO = this.txtEquipmentNo.Text.Trim();
newInspectionEquipment.RemarkCode = this.txtRemarkCode.Text.Trim();
newInspectionEquipment.Counts = this.txtCounts.Text.Trim();
newInspectionEquipment.SamplingCount = this.txtSamplingCount.Text.Trim();
newInspectionEquipment.UsedPlace = this.txtUsedPlace.Text.Trim();
if (!string.IsNullOrEmpty(this.drpAudit.SelectedValue))
{
newInspectionEquipment.AuditMan = drpAudit.SelectedValue;
} //审核人
if (this.drpAttribute.SelectedValue != BLL.Const._Null)
{
newInspectionEquipment.Attribute = this.drpAttribute.SelectedValue;
}
if (this.drpSamplingResult.SelectedValue != BLL.Const._Null)
{
newInspectionEquipment.SamplingResult = this.drpSamplingResult.SelectedValue;
}
if (!string.IsNullOrEmpty(this.txtInspectionDate.Text))
{
newInspectionEquipment.InspectionDate = Convert.ToDateTime(this.txtInspectionDate.Text);
}
if (string.IsNullOrEmpty(this.InspectionEquipmentId))
{
newInspectionEquipment.CompileMan = this.CurrUser.UserId;
newInspectionEquipment.CompileDate = DateTime.Now;
newInspectionEquipment.Status = BLL.Const.Comprehensive_Audit;
newInspectionEquipment.InspectionEquipmentId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionPerson));
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == newInspectionEquipment.InspectionEquipmentId);
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
{
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
BLL.InspectionEquipmentService.AddInspectionEquipment(newInspectionEquipment);
}
else
{
var sour = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.InspectionEquipmentId);
if (sour == null || string.IsNullOrEmpty(sour.AttachUrl))
{
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
newInspectionEquipment.InspectionEquipmentId = this.InspectionEquipmentId;
var oldInspectionEquipment = Funs.DB.Comprehensive_InspectionEquipment.Where(u => u.InspectionEquipmentId == this.InspectionEquipmentId).FirstOrDefault();
if (oldInspectionEquipment == null) //数据库没有记录 直接点提交 当前状态为 审核状态
{
newInspectionEquipment.CompileMan = this.CurrUser.UserId;
newInspectionEquipment.CompileDate = DateTime.Now;
newInspectionEquipment.Status = BLL.Const.Comprehensive_Audit;
BLL.InspectionEquipmentService.AddInspectionEquipment(newInspectionEquipment);
}
else
{
newInspectionEquipment.CompileMan = oldInspectionEquipment.CompileMan;
newInspectionEquipment.CompileDate = oldInspectionEquipment.CompileDate;
if(oldInspectionEquipment.Status==BLL.Const.Comprehensive_Compile)//编制状态提交变审核
{
newInspectionEquipment.Status = BLL.Const.Comprehensive_Audit;
}
else if (oldInspectionEquipment.Status == BLL.Const.Comprehensive_ReCompile)//重新编制状态提交变审核
{
newInspectionEquipment.Status = BLL.Const.Comprehensive_Audit;
}
else //审核状态 提交 变 完成 或者 重新编制
{
if (Convert.ToBoolean(rblIsAgree.SelectedValue))
{
newInspectionEquipment.Status = BLL.Const.Comprehensive_Complete;
}
else
{
newInspectionEquipment.Status = BLL.Const.Comprehensive_ReCompile;
}
}
BLL.InspectionEquipmentService.UpdateInspectionEquipment(newInspectionEquipment);
}
}
#region
var currApprove = InspectionEquipmentApproveService.GetCurrentApprove(newInspectionEquipment.InspectionEquipmentId);
if (currApprove == null) //为获取到为 当前编制状态 直接提交
{
var approve = new Model.Comprehensive_InspectionEquipmentApprove();
approve.InspectionEquipmentId = newInspectionEquipment.InspectionEquipmentId;
approve.ApproveMan = this.CurrUser.UserId;
approve.ApproveType = Const.Comprehensive_Compile;
approve.ApproveDate = DateTime.Now;
InspectionEquipmentApproveService.EditApprove(approve); //新增编制记录
Model.Comprehensive_InspectionEquipmentApprove newApprove = new Model.Comprehensive_InspectionEquipmentApprove();
newApprove.InspectionEquipmentId = newInspectionEquipment.InspectionEquipmentId;
newApprove.ApproveMan = this.drpAudit.SelectedValue;
newApprove.ApproveType = Const.InspectionManagement_Audit;
InspectionEquipmentApproveService.EditApprove(newApprove); //新增专业工程师审核记录
}else if (currApprove.ApproveMan == CurrUser.UserId)
{
if (currApprove.ApproveType == BLL.Const.Comprehensive_ReCompile)
{
currApprove.ApproveDate = DateTime.Now;
//currApprove.IsAgree = true;
InspectionEquipmentApproveService.EditApprove(currApprove); //新增专业工程师审核记录
Model.Comprehensive_InspectionEquipmentApprove newApprove = new Model.Comprehensive_InspectionEquipmentApprove();
newApprove.InspectionEquipmentId = newInspectionEquipment.InspectionEquipmentId;
newApprove.ApproveMan = this.drpAudit.SelectedValue;
newApprove.ApproveType = Const.InspectionManagement_Audit;
InspectionEquipmentApproveService.EditApprove(newApprove); //新增专业工程师审核记录
}
else
{
currApprove.ApproveDate = DateTime.Now; //更新审核时间
currApprove.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
currApprove.ApproveIdea = this.txtidea.Text;
InspectionEquipmentApproveService.EditApprove(currApprove);
if (Convert.ToBoolean(rblIsAgree.SelectedValue)) //同意时 审批完成
{
Model.Comprehensive_InspectionEquipmentApprove reApprove = new Model.Comprehensive_InspectionEquipmentApprove();
reApprove.InspectionEquipmentId = currApprove.InspectionEquipmentId;
reApprove.ApproveDate = DateTime.Now.AddSeconds(10);
reApprove.ApproveMan = CurrUser.UserId;
reApprove.ApproveType = Const.Comprehensive_Complete;
//reApprove.ApproveIdea = txtidea.Text;
InspectionEquipmentApproveService.EditApprove(reApprove);
}
else
{
Model.Comprehensive_InspectionEquipmentApprove reApprove = new Model.Comprehensive_InspectionEquipmentApprove();
reApprove.InspectionEquipmentId = currApprove.InspectionEquipmentId;
reApprove.ApproveMan = newInspectionEquipment.CompileMan;
reApprove.ApproveType = Const.Comprehensive_ReCompile;
InspectionEquipmentApproveService.EditApprove(reApprove);
}
}
}
#endregion
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#region
/// <summary>
/// 附件上传
@@ -171,11 +541,19 @@ namespace FineUIPro.Web.CQMS.Comprehensive
/// <param name="e"></param>
protected void btnAttach_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.hdAttachUrl.Text)) //新增记录
if (string.IsNullOrEmpty(this.InspectionEquipmentId)) //新增记录
{
this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionEquipment));
this.InspectionEquipmentId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionEquipment));
}
var oldInspectionEquipment = Funs.DB.Comprehensive_InspectionEquipment.Where(u => u.InspectionEquipmentId == this.InspectionEquipmentId).FirstOrDefault();
if (oldInspectionEquipment == null || ((oldInspectionEquipment.CompileMan == CurrUser.UserId && oldInspectionEquipment.Status == BLL.Const.Comprehensive_Compile) || (oldInspectionEquipment.CompileMan == CurrUser.UserId && oldInspectionEquipment.Status == BLL.Const.Comprehensive_ReCompile)))
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/InspectionEquipment&menuId={1}", this.InspectionEquipmentId, BLL.Const.InspectionEquipmentMenuId)));
}
else
{ PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/CQMS/InspectionEquipment&menuId={1}", this.InspectionEquipmentId, BLL.Const.InspectionEquipmentMenuId)));
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/InspectionEquipment&menuId={1}", this.hdAttachUrl.Text, BLL.Const.InspectionEquipmentMenuId)));
}
#endregion