提交试车代码
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.TestRun.BeforeTestRun
|
||||
{
|
||||
public partial class SiteImplementation : PageBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string SubInspectId
|
||||
{
|
||||
get { return (string)ViewState["SubInspectId"]; }
|
||||
set { ViewState["SubInspectId"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看
|
||||
/// </summary>
|
||||
public bool IsView
|
||||
{
|
||||
get { return (bool)ViewState["IsView"]; }
|
||||
set { ViewState["IsView"] = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public int RecordUpload
|
||||
{
|
||||
get { return (int)ViewState["RecordUpload"]; }
|
||||
set { ViewState["RecordUpload"] = value; }
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.SubInspectId = Request["SubInspectId"];
|
||||
//是否查看
|
||||
this.IsView = string.IsNullOrWhiteSpace(Request["IsView"]) ? false : bool.Parse(Request["IsView"]);
|
||||
//数据绑定
|
||||
PageInit();
|
||||
//判断是否查看
|
||||
if (IsView)
|
||||
{
|
||||
btnSubmit.Hidden = true;
|
||||
RecordUpload = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 默认绑定
|
||||
/// </summary>
|
||||
public void PageInit()
|
||||
{
|
||||
RecordUpload = 0;
|
||||
//获取检查表数据
|
||||
var data = from a in Funs.DB.PreRun_SubInspectTerm
|
||||
join b in Funs.DB.PreRun_WorkPackage on a.WorkPackId equals b.WorkPackId
|
||||
join c in Funs.DB.Sys_User on a.AddUser equals c.UserId
|
||||
join d in Funs.DB.Sys_User on a.Subcontractor equals d.UserId
|
||||
join e in Funs.DB.Sys_User on a.Contractor equals e.UserId
|
||||
join f in Funs.DB.Sys_User on a.Supervision equals f.UserId
|
||||
join g in Funs.DB.Sys_User on a.Owner equals g.UserId
|
||||
join h in Funs.DB.Base_Project on a.ProjectId equals h.ProjectId
|
||||
where a.SubInspectId == this.SubInspectId
|
||||
select new
|
||||
{
|
||||
a.SubInspectId,
|
||||
a.ProjectId,
|
||||
h.ProjectCode,
|
||||
h.ProjectName,
|
||||
a.WorkPackType,
|
||||
WorkPackTypeName = a.WorkPackType == 1 ? "管道" : "设备",
|
||||
b.WorkPackName,
|
||||
InspectUser = c.UserName,
|
||||
InspectData = a.AddTime,
|
||||
SubcontractorName = d.UserName,
|
||||
ContractorName = e.UserName,
|
||||
SupervisionName = f.UserName,
|
||||
OwnerName = g.UserName,
|
||||
a.RecordUploadData,
|
||||
a.SiteImplementConfirmData,
|
||||
a.IsSiteImplement
|
||||
};
|
||||
if (data != null)
|
||||
{
|
||||
var inspectTermModel = data.FirstOrDefault();
|
||||
lblProjectName.Text = inspectTermModel.ProjectName;
|
||||
lblProjectCode.Text = inspectTermModel.ProjectCode;
|
||||
lblWorkPackTypeName.Text = inspectTermModel.WorkPackTypeName;
|
||||
lblWorkPackName.Text = inspectTermModel.WorkPackName;
|
||||
lblInspectUser.Text = inspectTermModel.InspectUser;
|
||||
lblInspectData.Text = inspectTermModel.InspectData != null ? inspectTermModel.InspectData.Value.ToString("yyyy-MM-dd") : string.Empty;
|
||||
lblSubcontractorName.Text = inspectTermModel.SubcontractorName;
|
||||
lblContractorName.Text = inspectTermModel.ContractorName;
|
||||
lblSupervisionName.Text = inspectTermModel.SupervisionName;
|
||||
lblOwnerName.Text = inspectTermModel.OwnerName;
|
||||
lblRecordUploadData.Text = inspectTermModel.RecordUploadData != null ? inspectTermModel.RecordUploadData.Value.ToString("yyyy-MM-dd") : string.Empty;
|
||||
lblSiteImplementConfirmData.Text = inspectTermModel.SiteImplementConfirmData != null ? inspectTermModel.SiteImplementConfirmData.Value.ToString("yyyy-MM-dd") : string.Empty;
|
||||
rblIsSiteImplement.SelectedValue = inspectTermModel.IsSiteImplement != null ? inspectTermModel.IsSiteImplement.ToString() : "0";
|
||||
}
|
||||
//获取检查项数据
|
||||
var InspectTermItems = from a in Funs.DB.PreRun_SubInspectTermItem
|
||||
where a.SubInspectId == this.SubInspectId
|
||||
orderby a.Sort ascending
|
||||
select new
|
||||
{
|
||||
a.TermItemId,
|
||||
a.SubItemId,
|
||||
a.WorkInspectName,
|
||||
a.InspectionResults,
|
||||
InspectionResultsName = a.InspectionResults == 1 ? "通过" : "未通过",
|
||||
a.InspectionIllustrate
|
||||
};
|
||||
var itemDatas = InspectTermItems.ToList();
|
||||
gvTermItem.DataSource = itemDatas;
|
||||
gvTermItem.DataBind();
|
||||
}
|
||||
|
||||
#region 按钮
|
||||
|
||||
/// <summary>
|
||||
/// 保存并提交
|
||||
/// </summary>
|
||||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||||
{
|
||||
var subModel = Funs.DB.PreRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == this.SubInspectId);
|
||||
if (subModel != null)
|
||||
{
|
||||
subModel.IsSiteImplement = int.Parse(rblIsSiteImplement.SelectedValue);
|
||||
if (!string.IsNullOrWhiteSpace(lblRecordUploadData.Text))
|
||||
{
|
||||
subModel.RecordUploadData = DateTime.Parse(lblRecordUploadData.Text);
|
||||
subModel.SiteImplementUser = this.CurrUser.UserId;
|
||||
}
|
||||
else
|
||||
{
|
||||
subModel.RecordUploadData = null;
|
||||
subModel.SiteImplementUser = string.Empty;
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(lblSiteImplementConfirmData.Text))
|
||||
{
|
||||
subModel.SiteImplementConfirmData = DateTime.Parse(lblRecordUploadData.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
subModel.SiteImplementConfirmData = null;
|
||||
}
|
||||
}
|
||||
Funs.DB.SubmitChanges();
|
||||
ShowNotify("操作成功!", MessageBoxIcon.Success);
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 现场实施是否完成
|
||||
/// </summary>
|
||||
protected void rblIsSiteImplement_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
lblRecordUploadData.Text = rblIsSiteImplement.SelectedValue == "1" ? DateTime.Now.ToString("yyyy-MM-dd") : string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 试车过程记录上传
|
||||
/// </summary>
|
||||
protected void btnRecordUpload_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/CheckControl&menuId={2}", this.RecordUpload, this.SubInspectId + "_xcss", Const.InspectTailTerm)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭
|
||||
/// </summary>
|
||||
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
lblSiteImplementConfirmData.Text = Funs.DB.AttachFile.Count(x => x.ToKeyId == this.SubInspectId + "_xcss" && x.AttachUrl != null && x.AttachUrl != "") > 0 ? DateTime.Now.ToString("yyyy-MM-dd") : string.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user