2024-07-29 17:25:07 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.Transfer
|
|
|
|
|
{
|
|
|
|
|
public partial class PunchlistFromEdit : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 定义项
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string Id
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["Id"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["Id"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 项目主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ProjectId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["ProjectId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["ProjectId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
this.Id = Request.Params["Id"];
|
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
2025-03-21 18:28:54 +08:00
|
|
|
|
ProhibitedFields();
|
2024-07-29 17:25:07 +08:00
|
|
|
|
var TransferPunchlistFrom = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(p => p.Id == this.Id);
|
|
|
|
|
if (TransferPunchlistFrom != null)
|
|
|
|
|
{
|
2024-07-30 11:40:11 +08:00
|
|
|
|
this.txtNum_NO.Text = TransferPunchlistFrom.Num_NO;
|
2024-07-29 17:25:07 +08:00
|
|
|
|
this.txtSystem_No.Text = TransferPunchlistFrom.System_No;
|
|
|
|
|
this.txtSub_Sys_No.Text = TransferPunchlistFrom.Sub_Sys_No;
|
|
|
|
|
this.txtDESCRIPTION.Text = TransferPunchlistFrom.DESCRIPTION;
|
|
|
|
|
this.ddlCat.SelectedValue = TransferPunchlistFrom.Cat;
|
|
|
|
|
this.txtRaised_By.Text = TransferPunchlistFrom.Raised_By;
|
|
|
|
|
if (TransferPunchlistFrom.Date_Raised != null)
|
|
|
|
|
this.txtDate_Raised.Text = Convert.ToDateTime(TransferPunchlistFrom.Date_Raised).ToString("yyyy-MM-dd");
|
|
|
|
|
this.txtDisc.Text = TransferPunchlistFrom.Disc;
|
|
|
|
|
if (TransferPunchlistFrom.IsEng == true)
|
|
|
|
|
this.ddlIsEng.SelectedValue = "Y";
|
|
|
|
|
else
|
|
|
|
|
this.ddlIsEng.SelectedValue = "N";
|
|
|
|
|
this.ddlIsMatI.SelectedValue = TransferPunchlistFrom.IsMatI ?? "";
|
2024-07-30 11:58:39 +08:00
|
|
|
|
this.txtPunch_Type.SelectedValue = TransferPunchlistFrom.Punch_Type ?? "";
|
2024-07-29 17:25:07 +08:00
|
|
|
|
if (TransferPunchlistFrom.Required_Date != null)
|
|
|
|
|
this.txtRequired_Date.Text = Convert.ToDateTime(TransferPunchlistFrom.Required_Date).ToString("yyyy-MM-dd");
|
|
|
|
|
this.txtAction_By.Text = TransferPunchlistFrom.Action_By;
|
|
|
|
|
this.txtPIC.Text = TransferPunchlistFrom.PIC;
|
|
|
|
|
this.txtPIC_WUH.Text = TransferPunchlistFrom.PIC_WUH;
|
|
|
|
|
this.txtCorrection_Action.Text = TransferPunchlistFrom.Correction_Action;
|
|
|
|
|
if (TransferPunchlistFrom.Actual_Date != null)
|
|
|
|
|
this.txtActual_Date.Text = Convert.ToDateTime(TransferPunchlistFrom.Actual_Date).ToString("yyyy-MM-dd");
|
|
|
|
|
this.txtCleared_By.Text = TransferPunchlistFrom.Cleared_By;
|
|
|
|
|
if (TransferPunchlistFrom.Cleared_Date != null)
|
|
|
|
|
this.txtCleared_Date.Text = Convert.ToDateTime(TransferPunchlistFrom.Cleared_Date).ToString("yyyy-MM-dd");
|
|
|
|
|
this.txtConfirmed_By.Text = TransferPunchlistFrom.Confirmed_By;
|
|
|
|
|
if (TransferPunchlistFrom.Confirmed_Date != null)
|
|
|
|
|
this.txtConfirmed_Date.Text = Convert.ToDateTime(TransferPunchlistFrom.Confirmed_Date).ToString("yyyy-MM-dd");
|
|
|
|
|
this.txtVerified_By.Text = TransferPunchlistFrom.Verified_By;
|
|
|
|
|
if (TransferPunchlistFrom.Verified_Date != null)
|
|
|
|
|
this.txtVerified_Date.Text = Convert.ToDateTime(TransferPunchlistFrom.Verified_Date).ToString("yyyy-MM-dd");
|
|
|
|
|
this.txtRemark.Text = TransferPunchlistFrom.Remark;
|
|
|
|
|
}
|
2024-07-30 11:40:11 +08:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var maxNumNO = 0;
|
|
|
|
|
var modelTp = Funs.DB.Transfer_PunchlistFrom.OrderByDescending(x => x.Num_NO).FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId);
|
|
|
|
|
if (modelTp == null)
|
|
|
|
|
maxNumNO = 1;
|
|
|
|
|
else
|
|
|
|
|
maxNumNO = Convert.ToInt32(modelTp.Num_NO) + 1;
|
|
|
|
|
this.txtNum_NO.Text = maxNumNO.ToString("0000");
|
|
|
|
|
}
|
2024-07-29 17:25:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-21 18:28:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 禁止编辑字段事件触发时。
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void ProhibitedFields()
|
|
|
|
|
{
|
|
|
|
|
var query = (from projectUser in Funs.DB.Project_ProjectUser
|
|
|
|
|
join projectUnit in Funs.DB.Project_ProjectUnit on new { projectUser.UnitId, projectUser.ProjectId }
|
|
|
|
|
equals new { projectUnit.UnitId, projectUnit.ProjectId } into projectUnitJoin
|
|
|
|
|
from projectUnit in projectUnitJoin.DefaultIfEmpty()
|
|
|
|
|
join sysConst in Funs.DB.Sys_Const on new
|
|
|
|
|
{ GroupId = "ProjectUnitType", ConstValue = projectUnit.UnitType } equals new
|
|
|
|
|
{ sysConst.GroupId, sysConst.ConstValue } into sysConstJoin
|
|
|
|
|
from sysConst in sysConstJoin.DefaultIfEmpty()
|
|
|
|
|
where projectUser.UserId == this.CurrUser.UserId
|
|
|
|
|
select sysConst.ConstValue)
|
|
|
|
|
.Distinct().FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
if (query != null && query == "2")
|
|
|
|
|
{
|
|
|
|
|
this.txtConfirmed_By.Readonly = true;
|
|
|
|
|
this.txtConfirmed_Date.Readonly = true;
|
|
|
|
|
this.txtVerified_By.Readonly = true;
|
|
|
|
|
this.txtVerified_Date.Readonly = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 17:25:07 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Photoes附件上传
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnAttachA_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
AttachFileClick("A");
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Corrected Photos附件上传
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnAttachB_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
AttachFileClick("B");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过不同的type来保存附件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
private void AttachFileClick(string type)
|
|
|
|
|
{
|
|
|
|
|
SaveData();
|
2024-07-29 18:17:29 +08:00
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?type=0&toKeyId={0}_{1}&path=FileUpload/Transfer/PunchlistFrom&menuId={2}", this.Id, type, BLL.Const.PunchlistFromMenuId)));
|
2024-07-29 17:25:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-07-30 11:40:11 +08:00
|
|
|
|
if (SaveData() == 0)
|
|
|
|
|
{
|
2024-07-29 17:25:07 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2024-07-30 11:40:11 +08:00
|
|
|
|
ShowNotify("保存成功", MessageBoxIcon.Success);
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
2024-07-29 17:25:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private int SaveData()
|
|
|
|
|
{
|
2024-07-30 11:40:11 +08:00
|
|
|
|
int reutState = 0;
|
2024-07-29 17:25:07 +08:00
|
|
|
|
|
|
|
|
|
Model.Transfer_PunchlistFrom newTransferFrom = new Model.Transfer_PunchlistFrom()
|
|
|
|
|
{
|
2024-07-30 11:40:11 +08:00
|
|
|
|
Id = Guid.NewGuid().ToString(),
|
|
|
|
|
Num_NO = this.txtNum_NO.Text.Trim(),
|
|
|
|
|
ProjectId = this.ProjectId,
|
2024-07-29 17:25:07 +08:00
|
|
|
|
System_No = this.txtSystem_No.Text.Trim(),
|
|
|
|
|
Sub_Sys_No = this.txtSub_Sys_No.Text.Trim(),
|
|
|
|
|
DESCRIPTION = this.txtDESCRIPTION.Text.Trim(),
|
|
|
|
|
Cat = this.ddlCat.SelectedValue,
|
|
|
|
|
Raised_By = this.txtRaised_By.Text.Trim(),
|
|
|
|
|
Date_Raised = Funs.GetNewDateTime(this.txtDate_Raised.Text),
|
|
|
|
|
Disc = this.txtDisc.Text.Trim(),
|
|
|
|
|
IsEng = this.ddlIsEng.SelectedValue == "Y" ? true : false,
|
|
|
|
|
IsMatI = this.ddlIsMatI.SelectedValue,
|
2024-07-30 11:58:39 +08:00
|
|
|
|
Punch_Type = this.txtPunch_Type.SelectedValue,
|
2024-07-30 11:40:11 +08:00
|
|
|
|
Required_Date = Funs.GetNewDateTime(this.txtRequired_Date.Text),
|
|
|
|
|
Action_By = this.txtAction_By.Text.Trim(),
|
|
|
|
|
PIC = this.txtPIC.Text.Trim(),
|
|
|
|
|
PIC_WUH = this.txtPIC_WUH.Text.Trim(),
|
|
|
|
|
Correction_Action = this.txtCorrection_Action.Text.Trim(),
|
2024-07-29 17:25:07 +08:00
|
|
|
|
Actual_Date = Funs.GetNewDateTime(this.txtActual_Date.Text),
|
2024-07-30 11:40:11 +08:00
|
|
|
|
Cleared_By = this.txtCleared_By.Text.Trim(),
|
2024-07-29 17:25:07 +08:00
|
|
|
|
Cleared_Date = Funs.GetNewDateTime(this.txtCleared_Date.Text),
|
2024-07-30 11:40:11 +08:00
|
|
|
|
Confirmed_By = this.txtConfirmed_By.Text.Trim(),
|
2024-07-29 17:25:07 +08:00
|
|
|
|
Confirmed_Date = Funs.GetNewDateTime(this.txtConfirmed_Date.Text),
|
2024-07-30 11:40:11 +08:00
|
|
|
|
Verified_By = this.txtVerified_By.Text.Trim(),
|
2024-07-29 17:25:07 +08:00
|
|
|
|
Verified_Date = Funs.GetNewDateTime(this.txtVerified_Date.Text),
|
2024-07-30 11:40:11 +08:00
|
|
|
|
Remark = this.txtRemark.Text.Trim()
|
2024-07-29 17:25:07 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (newTransferFrom.Cleared_Date == null && newTransferFrom.Confirmed_Date == null && newTransferFrom.Verified_Date == null)
|
|
|
|
|
newTransferFrom.Status = "Not Start";
|
|
|
|
|
else if (newTransferFrom.Cleared_Date != null && newTransferFrom.Confirmed_Date != null && newTransferFrom.Verified_Date != null)
|
|
|
|
|
newTransferFrom.Status = "Completed";
|
|
|
|
|
else
|
|
|
|
|
newTransferFrom.Status = "In Progress";
|
|
|
|
|
|
|
|
|
|
var TransferPunchlistFrom = Funs.DB.Transfer_PunchlistFrom.FirstOrDefault(p => p.Id == this.Id);
|
|
|
|
|
if (TransferPunchlistFrom == null)
|
|
|
|
|
{
|
2024-07-30 11:40:11 +08:00
|
|
|
|
if (Funs.DB.Transfer_PunchlistFrom.Where(p => p.ProjectId == this.ProjectId && p.Num_NO == newTransferFrom.Num_NO).Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("录入的NO.重复了,不能保存", MessageBoxIcon.Warning);
|
|
|
|
|
return reutState;
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-29 17:25:07 +08:00
|
|
|
|
Funs.DB.Transfer_PunchlistFrom.InsertOnSubmit(newTransferFrom);
|
2024-07-30 11:40:11 +08:00
|
|
|
|
this.Id = newTransferFrom.Id;
|
2024-07-29 17:25:07 +08:00
|
|
|
|
}
|
2024-07-30 11:40:11 +08:00
|
|
|
|
else
|
2024-07-29 17:25:07 +08:00
|
|
|
|
{
|
2024-07-30 11:40:11 +08:00
|
|
|
|
if (Funs.DB.Transfer_PunchlistFrom.Where(p => p.ProjectId == this.ProjectId && p.Num_NO == newTransferFrom.Num_NO && p.Id != TransferPunchlistFrom.Id).Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("录入的NO.重复了,不能保存", MessageBoxIcon.Warning);
|
|
|
|
|
return reutState;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TransferPunchlistFrom.Num_NO = newTransferFrom.Num_NO;
|
2024-07-29 17:25:07 +08:00
|
|
|
|
TransferPunchlistFrom.System_No = newTransferFrom.System_No;
|
|
|
|
|
TransferPunchlistFrom.Sub_Sys_No = newTransferFrom.Sub_Sys_No;
|
|
|
|
|
TransferPunchlistFrom.DESCRIPTION = newTransferFrom.DESCRIPTION;
|
|
|
|
|
TransferPunchlistFrom.Cat = newTransferFrom.Cat;
|
|
|
|
|
TransferPunchlistFrom.Raised_By = newTransferFrom.Raised_By;
|
|
|
|
|
TransferPunchlistFrom.Date_Raised = newTransferFrom.Date_Raised;
|
|
|
|
|
TransferPunchlistFrom.Disc = newTransferFrom.Disc;
|
|
|
|
|
TransferPunchlistFrom.IsEng = newTransferFrom.IsEng;
|
|
|
|
|
TransferPunchlistFrom.IsMatI = newTransferFrom.IsMatI;
|
|
|
|
|
TransferPunchlistFrom.Punch_Type = newTransferFrom.Punch_Type;
|
|
|
|
|
TransferPunchlistFrom.Required_Date = newTransferFrom.Required_Date;
|
|
|
|
|
TransferPunchlistFrom.Action_By = newTransferFrom.Action_By;
|
|
|
|
|
TransferPunchlistFrom.PIC = newTransferFrom.PIC;
|
|
|
|
|
TransferPunchlistFrom.PIC_WUH = newTransferFrom.PIC_WUH;
|
|
|
|
|
TransferPunchlistFrom.Correction_Action = newTransferFrom.Correction_Action;
|
|
|
|
|
TransferPunchlistFrom.Actual_Date = newTransferFrom.Actual_Date;
|
|
|
|
|
TransferPunchlistFrom.Cleared_By = newTransferFrom.Cleared_By;
|
|
|
|
|
TransferPunchlistFrom.Cleared_Date = newTransferFrom.Cleared_Date;
|
|
|
|
|
TransferPunchlistFrom.Confirmed_By = newTransferFrom.Confirmed_By;
|
|
|
|
|
TransferPunchlistFrom.Confirmed_Date = newTransferFrom.Confirmed_Date;
|
|
|
|
|
TransferPunchlistFrom.Verified_By = newTransferFrom.Verified_By;
|
|
|
|
|
TransferPunchlistFrom.Verified_Date = newTransferFrom.Verified_Date;
|
|
|
|
|
TransferPunchlistFrom.Remark = newTransferFrom.Remark;
|
|
|
|
|
TransferPunchlistFrom.Status = newTransferFrom.Status;
|
|
|
|
|
}
|
|
|
|
|
Funs.DB.SubmitChanges();
|
|
|
|
|
reutState = 1;
|
|
|
|
|
return reutState;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|