修改施工日志

This commit is contained in:
2023-09-25 19:20:08 +08:00
parent afce1cfc6a
commit 40afc9e40b
19 changed files with 5840 additions and 64 deletions
@@ -87,15 +87,30 @@ namespace FineUIPro.Web.PZHGL.InformationProject
{
if (!IsPostBack)
{
if (string.IsNullOrEmpty(this.hdWorkPostId.Text.Trim()))
var projectUser = SitePerson_PersonService.GetSitePersonByProjectIdIdentityCard(this.CurrUser.LoginProjectId, this.CurrUser.IdentityCard);
if (projectUser != null && projectUser.WorkPostId == BLL.Const.WorkPost_ConstructionManager)
{
Alert.ShowInTop("请先在个人信息中设置施工日志工种!", MessageBoxIcon.Warning);
return;
this.row1.Hidden = true;
this.row2.Hidden = true;
this.row3.Hidden = true;
this.Grid1.Hidden = true;
this.Grid2.Hidden = true;
this.Grid3.Hidden = true;
this.Grid4.Hidden = true;
}
if (string.IsNullOrEmpty(this.hdMachineId.Text.Trim()))
else
{
Alert.ShowInTop("请先在个人信息中设置施工日志机械!", MessageBoxIcon.Warning);
return;
if (string.IsNullOrEmpty(this.hdWorkPostId.Text.Trim()))
{
Alert.ShowInTop("请先在个人信息中设置施工日志工种!", MessageBoxIcon.Warning);
return;
}
if (string.IsNullOrEmpty(this.hdMachineId.Text.Trim()))
{
Alert.ShowInTop("请先在个人信息中设置施工日志机械!", MessageBoxIcon.Warning);
return;
}
this.Grid5.Hidden = true;
}
UnitWorkService.InitUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, true);
this.drpProfessional.DataTextField = "Value";
@@ -229,6 +244,7 @@ namespace FineUIPro.Web.PZHGL.InformationProject
this.drpContractNo.SelectedValueArray = log.ContractNo.Split(',');
}
}
drpContractNo_SelectedIndexChanged(null, null);
if (!string.IsNullOrEmpty(log.UnitWorks))
{
if (log.UnitWorks.Length > 0)
@@ -521,17 +537,58 @@ namespace FineUIPro.Web.PZHGL.InformationProject
private void TextNew()
{
this.ConstructionLogId = string.Empty;
DateTime today = DateTime.Now;
DateTime today = DateTime.Now.Date;
if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim()))
{
today = Convert.ToDateTime(this.txtCompileDate.Text.Trim()).Date;
}
string prefix = string.Format("{0:yyyyMMdd}", today) + "-";
this.txtFileCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "ZHGL_ConstructionLog", "FileCode", this.CurrUser.LoginProjectId, prefix);
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", today);
this.txtWeek.Text = Funs.GetWeekDay(today.DayOfWeek.ToString());
this.txtWeather.Text = string.Empty;
this.txtTemperature.Text = string.Empty;
var log = (from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileDate == today
select x).FirstOrDefault();
if (log != null)
{
this.txtWeather.Text = log.Weather;
this.txtTemperature.Text = log.Temperature;
}
this.txtCompileMan.Text = this.CurrUser.PersonName;
this.drpContractNo.SelectedIndex = 0;
this.drpUnitWork.SelectedIndex = 0;
this.drpProfessional.SelectedIndex = 0;
var personLog = (from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileMan == this.CurrUser.PersonId
orderby x.CompileDate descending
select x).FirstOrDefault();
if (personLog != null)
{
if (!string.IsNullOrEmpty(personLog.ContractNo))
{
if (personLog.ContractNo.Length > 0)
{
this.drpContractNo.SelectedValueArray = personLog.ContractNo.Split(',');
}
}
drpContractNo_SelectedIndexChanged(null, null);
if (!string.IsNullOrEmpty(personLog.UnitWorks))
{
if (personLog.UnitWorks.Length > 0)
{
this.drpUnitWork.SelectedValueArray = personLog.UnitWorks.Split(',');
}
}
if (!string.IsNullOrEmpty(personLog.Professional))
{
if (personLog.Professional.Length > 0)
{
this.drpProfessional.SelectedValueArray = personLog.Professional.Split(',');
}
}
}
this.txtState.Text = string.Empty;
this.txtRemark.Text = string.Empty;
this.txtHSETodaySummary.Text = string.Empty;
@@ -552,6 +609,7 @@ namespace FineUIPro.Web.PZHGL.InformationProject
this.Grid4.DataBind();
this.Grid5.DataSource = null;
this.Grid5.DataBind();
drpUnitWork_SelectedIndexChanged(null, null);
}
private void TextEmpty()
@@ -641,20 +699,23 @@ namespace FineUIPro.Web.PZHGL.InformationProject
{
if (this.GetButtonPower(BLL.Const.BtnSave))
{
if (this.drpContractNo.SelectedValue == BLL.Const._Null && this.drpContractNo.SelectedItemArray.Length == 1)
if (this.Grid5.Hidden == true)
{
Alert.ShowInTop("请选择合同编号!", MessageBoxIcon.Warning);
return;
}
if (this.drpUnitWork.SelectedValue == BLL.Const._Null && this.drpUnitWork.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择单位工程!", MessageBoxIcon.Warning);
return;
}
if (this.drpProfessional.SelectedValue == BLL.Const._Null && this.drpProfessional.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择专业工程!", MessageBoxIcon.Warning);
return;
if (this.drpContractNo.SelectedValue == BLL.Const._Null && this.drpContractNo.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择合同编号!", MessageBoxIcon.Warning);
return;
}
if (this.drpUnitWork.SelectedValue == BLL.Const._Null && this.drpUnitWork.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择单位工程!", MessageBoxIcon.Warning);
return;
}
if (this.drpProfessional.SelectedValue == BLL.Const._Null && this.drpProfessional.SelectedItemArray.Length == 1)
{
Alert.ShowInTop("请选择专业工程!", MessageBoxIcon.Warning);
return;
}
}
Model.ZHGL_ConstructionLog log = new Model.ZHGL_ConstructionLog();
log.ProjectId = this.CurrUser.LoginProjectId;
@@ -725,9 +786,21 @@ namespace FineUIPro.Web.PZHGL.InformationProject
}
else
{
log.ConstructionLogId = SQLHelper.GetNewID(typeof(Model.ZHGL_ConstructionLog));
this.ConstructionLogId = log.ConstructionLogId;
BLL.ConstructionLogService.AddConstructionLog(log);
var personLog = (from x in Funs.DB.ZHGL_ConstructionLog
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileMan == this.CurrUser.PersonId
&& x.CompileDate == Funs.GetNewDateTime(this.txtCompileDate.Text.Trim())
select x).FirstOrDefault();
if (personLog == null)
{
log.ConstructionLogId = SQLHelper.GetNewID(typeof(Model.ZHGL_ConstructionLog));
this.ConstructionLogId = log.ConstructionLogId;
BLL.ConstructionLogService.AddConstructionLog(log);
}
else
{
Alert.ShowInTop("当前日期施工日志已存在!", MessageBoxIcon.Warning);
return;
}
}
BLL.ConstructionLogPersonService.DeleteConstructionLogPersonsByConstructionLogId(this.ConstructionLogId);
List<string> list = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
@@ -781,7 +854,7 @@ namespace FineUIPro.Web.PZHGL.InformationProject
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
newItem.ConstructionLogProblemId = SQLHelper.GetNewID();
newItem.ConstructionLogProblemId = values.Value<string>("ConstructionLogProblemId");
newItem.ConstructionLogId = this.ConstructionLogId;
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
newItem.MainProblem = values.Value<string>("MainProblem");
@@ -1032,47 +1105,116 @@ namespace FineUIPro.Web.PZHGL.InformationProject
{
string id = this.Grid4.SelectedRow.RowID;
string unitWorkId = this.Grid4.SelectedRow.DataKeys[1].ToString();
//保存页面数据
List<Model.ZHGL_ConstructionLogProblem> items = new List<Model.ZHGL_ConstructionLogProblem>();
foreach (JObject mergedRow in Grid4.GetMergedData()) //专业管理
if (e.CommandName == "download")
{
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/ConstructionLog&menuId={2}",
0, id, Const.ConstructionLogMenuId)));
}
else
{
//保存页面数据
List<Model.ZHGL_ConstructionLogProblem> items = new List<Model.ZHGL_ConstructionLogProblem>();
foreach (JObject mergedRow in Grid4.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
newItem.ConstructionLogProblemId = values.Value<string>("ConstructionLogProblemId");
newItem.ConstructionLogId = this.ConstructionLogId;
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
newItem.MainProblem = values.Value<string>("MainProblem");
newItem.HandlingMeasures = values.Value<string>("HandlingMeasures");
newItem.WorkPackageId = BLL.WorkPackageInitService.GetWorkPackageCodeByPackageContent(values.Value<string>("WorkPackageId"));
newItem.ImportanceLevel = values.Value<string>("ImportanceLevel");
items.Add(newItem);
}
if (e.CommandName == "add")//增加
{
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
newItem.ConstructionLogProblemId = SQLHelper.GetNewID();
newItem.UnitWorkId = unitWorkId;
items.Add(newItem);
items = items.OrderBy(x => x.UnitWorkId).ToList();
}
if (e.CommandName == "del")//删除
{
var w = items.FirstOrDefault(x => x.ConstructionLogProblemId == id);
if (w != null)
{
items.Remove(w);
}
items = items.OrderBy(x => x.UnitWorkId).ToList();
}
foreach (var item in items)
{
item.WorkPackageId = BLL.WorkPackageInitService.GetPackageContentByWorkPackageCode(item.WorkPackageId);
}
this.Grid4.DataSource = items;
this.Grid4.DataBind();
}
}
/// <summary>
/// Grid行点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid5_RowCommand(object sender, GridCommandEventArgs e)
{
string id = this.Grid5.SelectedRow.RowID;
//保存页面数据
List<Model.ZHGL_ConstructionLogRecord> items = new List<Model.ZHGL_ConstructionLogRecord>();
foreach (JObject mergedRow in Grid5.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogRecord newItem = new Model.ZHGL_ConstructionLogRecord();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
newItem.ConstructionLogProblemId = values.Value<string>("ConstructionLogProblemId");
newItem.ConstructionLogRecordId = values.Value<string>("ConstructionLogRecordId");
newItem.ConstructionLogId = this.ConstructionLogId;
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
newItem.MainProblem = values.Value<string>("MainProblem");
newItem.HandlingMeasures = values.Value<string>("HandlingMeasures");
newItem.WorkPackageId = BLL.WorkPackageInitService.GetWorkPackageCodeByPackageContent(values.Value<string>("WorkPackageId"));
newItem.ImportanceLevel = values.Value<string>("ImportanceLevel");
newItem.Record = values.Value<string>("Record");
newItem.Remark = values.Value<string>("Remark");
items.Add(newItem);
}
if (e.CommandName == "add")//增加
{
Model.ZHGL_ConstructionLogProblem newItem = new Model.ZHGL_ConstructionLogProblem();
newItem.ConstructionLogProblemId = SQLHelper.GetNewID();
newItem.UnitWorkId = unitWorkId;
items.Add(newItem);
items = items.OrderBy(x => x.UnitWorkId).ToList();
}
if (e.CommandName == "del")//删除
{
var w = items.FirstOrDefault(x => x.ConstructionLogProblemId == id);
var w = items.FirstOrDefault(x => x.ConstructionLogRecordId == id);
if (w != null)
{
items.Remove(w);
}
items = items.OrderBy(x => x.UnitWorkId).ToList();
}
foreach (var item in items)
{
item.WorkPackageId = BLL.WorkPackageInitService.GetPackageContentByWorkPackageCode(item.WorkPackageId);
}
this.Grid4.DataSource = items;
this.Grid4.DataBind();
this.Grid5.DataSource = items;
this.Grid5.DataBind();
}
#endregion
protected void btnAdd_Click(object sender, EventArgs e)
{
//保存页面数据
List<Model.ZHGL_ConstructionLogRecord> items = new List<Model.ZHGL_ConstructionLogRecord>();
foreach (JObject mergedRow in Grid5.GetMergedData()) //专业管理
{
Model.ZHGL_ConstructionLogRecord item = new Model.ZHGL_ConstructionLogRecord();
int i = mergedRow.Value<int>("index");
JObject values = mergedRow.Value<JObject>("values");
item.ConstructionLogRecordId = values.Value<string>("ConstructionLogRecordId");
item.ConstructionLogId = this.ConstructionLogId;
item.Record = values.Value<string>("Record");
item.Remark = values.Value<string>("Remark");
items.Add(item);
}
Model.ZHGL_ConstructionLogRecord newItem = new Model.ZHGL_ConstructionLogRecord();
newItem.ConstructionLogRecordId = SQLHelper.GetNewID();
items.Add(newItem);
this.Grid5.DataSource = items;
this.Grid5.DataBind();
}
protected void txtCompileDate_TextChanged(object sender, EventArgs e)
{
TextNew();
}
}
}