2024-05-14 23:26:27 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CQMS.WBS.Control
|
|
|
|
|
{
|
|
|
|
|
public partial class PointCroppingEdit : PageBase
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上级主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ParentId
|
|
|
|
|
{
|
|
|
|
|
get { return (string)ViewState["ParentId"]; }
|
|
|
|
|
set { ViewState["ParentId"] = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ControlId
|
|
|
|
|
{
|
|
|
|
|
get { return (string)ViewState["ControlId"]; }
|
|
|
|
|
set { ViewState["ControlId"] = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-20 02:22:12 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string FId
|
|
|
|
|
{
|
|
|
|
|
get { return (string)ViewState["FId"]; }
|
|
|
|
|
set { ViewState["FId"] = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 问题图片是否可编辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int FileImg
|
|
|
|
|
{
|
|
|
|
|
get { return (int)ViewState["FileImg"]; }
|
|
|
|
|
set { ViewState["FileImg"] = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-14 23:26:27 +08:00
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
this.ControlId = Request.Params["ControlId"];
|
2024-05-20 02:22:12 +08:00
|
|
|
|
this.FId = !string.IsNullOrWhiteSpace(this.ControlId) ? this.ControlId : Guid.NewGuid().ToString();
|
2024-05-14 23:26:27 +08:00
|
|
|
|
this.ParentId = Request.Params["ParentId"];
|
2024-05-20 02:22:12 +08:00
|
|
|
|
this.FileImg = 0;
|
2024-05-14 23:26:27 +08:00
|
|
|
|
//绑定数据
|
|
|
|
|
PageIn();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="runId">主键</param>
|
|
|
|
|
/// <param name="parentId">上级主键</param>
|
|
|
|
|
public void PageIn()
|
|
|
|
|
{
|
|
|
|
|
var num = 0;
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(this.ParentId))
|
|
|
|
|
{
|
|
|
|
|
var parenLs = GetAllCropping(this.ParentId);
|
|
|
|
|
if (parenLs.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var itemModel = parenLs.FirstOrDefault(p => p.ControlId == this.ParentId);
|
|
|
|
|
if (itemModel != null)
|
|
|
|
|
{
|
|
|
|
|
if (itemModel.ControlLevel == 1)
|
|
|
|
|
{
|
|
|
|
|
one.Hidden = false;
|
|
|
|
|
var oneModel = parenLs.FirstOrDefault(p => p.ControlLevel == 1);
|
|
|
|
|
if (oneModel != null)
|
|
|
|
|
{
|
|
|
|
|
lblOneDetectionItems.Text = oneModel.DetectionItems;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(this.ControlId))
|
|
|
|
|
{
|
|
|
|
|
num = Funs.DB.Control_PointCropping.Count() + 1;
|
|
|
|
|
txtSort.Text = num.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (itemModel.ControlLevel == 2)
|
|
|
|
|
{
|
|
|
|
|
one.Hidden = false;
|
|
|
|
|
two.Hidden = false;
|
|
|
|
|
var oneModel = parenLs.FirstOrDefault(p => p.ControlLevel == 1);
|
|
|
|
|
if (oneModel != null)
|
|
|
|
|
{
|
|
|
|
|
lblOneDetectionItems.Text = oneModel.DetectionItems;
|
|
|
|
|
}
|
|
|
|
|
var twoModel = parenLs.FirstOrDefault(p => p.ControlLevel == 2);
|
|
|
|
|
if (twoModel != null)
|
|
|
|
|
{
|
|
|
|
|
lblTwoDetectionItems.Text = twoModel.DetectionItems;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrWhiteSpace(this.ControlId))
|
|
|
|
|
{
|
|
|
|
|
num = Funs.DB.Control_PointCropping.Count() + 1;
|
|
|
|
|
txtSort.Text = num.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(this.ControlId))
|
|
|
|
|
{
|
|
|
|
|
num = Funs.DB.Control_PointCropping.Count() + 1;
|
|
|
|
|
txtSort.Text = num.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(this.ControlId))
|
|
|
|
|
{
|
|
|
|
|
var controModel = Funs.DB.Control_PointCropping.FirstOrDefault(p => p.ControlId == this.ControlId);
|
|
|
|
|
if (controModel != null)
|
|
|
|
|
{
|
|
|
|
|
txtRemark.Text = controModel.Remark;
|
|
|
|
|
txtSort.Text = controModel.Sort.ToString();
|
|
|
|
|
txtDetectionItems.Text = controModel.DetectionItems;
|
|
|
|
|
txtBasedCriterion.Text = controModel.BasedCriterion;
|
|
|
|
|
txtQualityRecordName.Text = controModel.QualityRecordName;
|
|
|
|
|
txtRecordNumber.Text = controModel.RecordNumber;
|
|
|
|
|
txtPartition.Text = controModel.Partition;
|
|
|
|
|
txtControlCode.Text = controModel.ControlCode;
|
|
|
|
|
txtRemark.Text = controModel.Remark;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var model = new Control_PointCropping();
|
2024-05-20 02:22:12 +08:00
|
|
|
|
model.ControlId = this.FId;
|
2024-05-14 23:26:27 +08:00
|
|
|
|
var oneControlId = string.Empty;
|
|
|
|
|
var twoControlId = string.Empty;
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(this.ControlId))
|
|
|
|
|
{
|
|
|
|
|
model = Funs.DB.Control_PointCropping.FirstOrDefault(p => p.ControlId == this.ControlId);
|
|
|
|
|
}
|
2024-05-20 02:22:12 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
model.States = 1;
|
|
|
|
|
model.ProjectId = CurrUser.LoginProjectId;
|
|
|
|
|
}
|
2024-05-14 23:26:27 +08:00
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("传递参数错误!", MessageBoxIcon.Error);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(this.ParentId))
|
|
|
|
|
{
|
|
|
|
|
var parenLs = GetAllCropping(this.ParentId);
|
|
|
|
|
if (parenLs.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var oneModel = parenLs.FirstOrDefault(p => p.ControlLevel == 1);
|
|
|
|
|
if (oneModel != null)
|
|
|
|
|
{
|
|
|
|
|
model.PlanId = oneModel.ControlId;
|
|
|
|
|
model.ParentId = oneModel.ControlId;
|
|
|
|
|
model.PlanTypeId = model.ControlId;
|
|
|
|
|
model.ControlLevel = 2;
|
|
|
|
|
}
|
|
|
|
|
var twoModel = parenLs.FirstOrDefault(p => p.ControlLevel == 2);
|
|
|
|
|
if (twoModel != null)
|
|
|
|
|
{
|
|
|
|
|
model.PlanId = twoModel.PlanId;
|
|
|
|
|
model.ParentId = twoModel.ControlId;
|
|
|
|
|
model.PlanTypeId = twoModel.ControlId;
|
|
|
|
|
model.SubItemsId = model.ControlId;
|
|
|
|
|
model.ControlLevel = 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
model.ControlLevel = 1;
|
|
|
|
|
}
|
|
|
|
|
model.AddUser = this.CurrUser.UserId;
|
|
|
|
|
model.OperateTime = DateTime.Now;
|
|
|
|
|
model.Sort = !string.IsNullOrEmpty(txtSort.Text) ? int.Parse(txtSort.Text) : Funs.DB.Control_PointCropping.Count() + 1;
|
|
|
|
|
model.DetectionItems = txtDetectionItems.Text;
|
|
|
|
|
model.BasedCriterion = txtBasedCriterion.Text;
|
|
|
|
|
model.QualityRecordName = txtQualityRecordName.Text;
|
|
|
|
|
model.RecordNumber = txtRecordNumber.Text;
|
|
|
|
|
model.Partition = txtPartition.Text;
|
|
|
|
|
model.ControlCode = txtControlCode.Text;
|
|
|
|
|
model.Remark = txtRemark.Text;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(this.ControlId)) Funs.DB.Control_PointCropping.InsertOnSubmit(model);
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-05-20 02:22:12 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 附件
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected void BtnFile_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", FileImg, this.FId, Const.InspectTailTerm)));
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-14 23:26:27 +08:00
|
|
|
|
#region 私有方法
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据主键获取所有节点
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<Control_PointCropping> GetAllCropping(string parentId)
|
|
|
|
|
{
|
|
|
|
|
var result = new List<Control_PointCropping>();
|
|
|
|
|
|
|
|
|
|
var ids = new List<string>();
|
|
|
|
|
var itemCropping = Funs.DB.Control_PointCropping.FirstOrDefault(p => p.ControlId == parentId);
|
|
|
|
|
if (itemCropping != null)
|
|
|
|
|
{
|
|
|
|
|
ids.Add(itemCropping.ControlId);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(itemCropping.PlanId))
|
|
|
|
|
{
|
|
|
|
|
ids.Add(itemCropping.PlanId);
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(itemCropping.PlanTypeId))
|
|
|
|
|
{
|
|
|
|
|
ids.Add(itemCropping.PlanTypeId);
|
|
|
|
|
}
|
|
|
|
|
result = Funs.DB.Control_PointCropping.Where(p => ids.Contains(p.ControlId)).ToList();
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-20 02:22:12 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-14 23:26:27 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|