1287 lines
57 KiB
C#
1287 lines
57 KiB
C#
using BLL;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace FineUIPro.Web.PZHGL.InformationProject
|
|
{
|
|
public partial class ConstructionLog : PageBase
|
|
{
|
|
#region 定义项
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string ConstructionLogId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ConstructionLogId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ConstructionLogId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 加载表头
|
|
/// </summary>
|
|
protected void Page_Init(object sender, EventArgs e)
|
|
{
|
|
InitGrid();
|
|
}
|
|
|
|
#region 表头
|
|
/// <summary>
|
|
/// 表头
|
|
/// </summary>
|
|
private void InitGrid()
|
|
{
|
|
this.hdWorkPostId.Text = this.CurrUser.LogWorkPostId;
|
|
this.hdMachineId.Text = this.CurrUser.LogMachineId;
|
|
List<string> list = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
RenderField rdPlan = new RenderField();
|
|
rdPlan.ColumnID = "Num" + i.ToString();
|
|
rdPlan.Width = Unit.Pixel(100);
|
|
rdPlan.DataField = "Num" + i.ToString();
|
|
rdPlan.FieldType = FieldType.Int;
|
|
rdPlan.HeaderText = BLL.WorkPostService.getWorkPostNameById(list[i]);
|
|
rdPlan.HeaderTextAlign = TextAlign.Center;
|
|
NumberBox numPlan = new NumberBox();
|
|
numPlan.NoNegative = true;
|
|
numPlan.NoDecimal = true;
|
|
rdPlan.Editor.Add(numPlan);
|
|
Grid1.Columns.Add(rdPlan);
|
|
}
|
|
List<string> list2 = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
|
|
for (int i = 0; i < list2.Count; i++)
|
|
{
|
|
RenderField rdPlan = new RenderField();
|
|
rdPlan.ColumnID = "Num" + i.ToString();
|
|
rdPlan.Width = Unit.Pixel(100);
|
|
rdPlan.DataField = "Num" + i.ToString();
|
|
rdPlan.FieldType = FieldType.Int;
|
|
rdPlan.HeaderText = BLL.SpecialEquipmentService.GetSpecialEquipmentNameById(list2[i]);
|
|
rdPlan.HeaderTextAlign = TextAlign.Center;
|
|
NumberBox numPlan = new NumberBox();
|
|
numPlan.NoNegative = true;
|
|
numPlan.NoDecimal = true;
|
|
rdPlan.Editor.Add(numPlan);
|
|
Grid2.Columns.Add(rdPlan);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
var projectUser = SitePerson_PersonService.GetSitePersonByProjectIdIdentityCard(this.CurrUser.LoginProjectId, this.CurrUser.IdentityCard);
|
|
if (projectUser != null && projectUser.WorkPostId == BLL.Const.WorkPost_ConstructionManager)
|
|
{
|
|
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;
|
|
}
|
|
else
|
|
{
|
|
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";
|
|
this.drpProfessional.DataValueField = "Text";
|
|
this.drpProfessional.DataSource = BLL.PHTGL_QuantityService.GetMajorItems();
|
|
this.drpProfessional.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpProfessional);
|
|
//合同编号
|
|
this.drpContractNo.DataTextField = "ContractNum";
|
|
this.drpContractNo.DataValueField = "ContractId";
|
|
this.drpContractNo.DataSource = BLL.PHTGL_ContractReviewService.GetContractReview_CompleteData(this.CurrUser.LoginProjectId);
|
|
this.drpContractNo.DataBind();
|
|
Funs.FineUIPleaseSelect(this.drpContractNo);
|
|
//所属WBS
|
|
BLL.WorkPackageInitService.InitDownList(this.drpWorkPackage, false);
|
|
this.txtReportDate.Text = string.Format("{0:yyyy-MM}", DateTime.Now);
|
|
this.InitTreeMenu();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载树装置-单位-工作区
|
|
/// <summary>
|
|
/// 加载树
|
|
/// </summary>
|
|
private void InitTreeMenu()
|
|
{
|
|
if (!string.IsNullOrEmpty(this.txtReportDate.Text.Trim()))
|
|
{
|
|
DateTime? startTime = Funs.GetNewDateTime(this.txtReportDate.Text.Trim());
|
|
DateTime? endTime = startTime.HasValue ? startTime.Value.AddMonths(1) : System.DateTime.Now;
|
|
|
|
this.tvControlItem.Nodes.Clear();
|
|
TreeNode rootNode = new TreeNode();
|
|
rootNode.Text = this.CurrUser.PersonName;
|
|
rootNode.NodeID = "0";
|
|
rootNode.CommandName = "Person";
|
|
rootNode.EnableClickEvent = true;
|
|
rootNode.Expanded = true;
|
|
this.tvControlItem.Nodes.Add(rootNode);
|
|
var logs = from x in Funs.DB.ZHGL_ConstructionLog
|
|
where x.ProjectId == this.CurrUser.LoginProjectId && x.CompileMan == this.CurrUser.PersonId && x.CompileDate >= startTime && x.CompileDate < endTime
|
|
select x;
|
|
foreach (var item in logs)
|
|
{
|
|
TreeNode rootUnitNode = new TreeNode();//定义根节点
|
|
rootUnitNode.Text = item.FileCode;
|
|
rootUnitNode.NodeID = item.ConstructionLogId;
|
|
rootUnitNode.CommandName = "Log";
|
|
rootUnitNode.Expanded = true;
|
|
rootUnitNode.EnableClickEvent = true;
|
|
rootUnitNode.ToolTip = "施工日志";
|
|
rootNode.Nodes.Add(rootUnitNode);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 查询Tree
|
|
protected void Tree_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.InitTreeMenu();
|
|
}
|
|
#endregion
|
|
|
|
#region 点击树节点
|
|
/// <summary>
|
|
/// 点击树节点
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
{
|
|
if (this.tvControlItem.SelectedNode.CommandName == "Person")
|
|
{
|
|
if (this.GetButtonPower(BLL.Const.BtnAdd))
|
|
{
|
|
this.btnMenuAdd.Hidden = false;
|
|
this.btnMenuEdit.Hidden = true;
|
|
this.btnMenuDown.Hidden = true;
|
|
this.btnMenuDelete.Hidden = true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (this.GetButtonPower(BLL.Const.BtnModify))
|
|
{
|
|
this.btnMenuAdd.Hidden = true;
|
|
this.btnMenuEdit.Hidden = false;
|
|
//this.btnMenuDown.Hidden = false;
|
|
this.btnMenuDelete.Hidden = false;
|
|
}
|
|
}
|
|
this.ConstructionLogId = this.tvControlItem.SelectedNodeID;
|
|
if (!string.IsNullOrEmpty(this.ConstructionLogId))
|
|
{
|
|
GetData();
|
|
}
|
|
else
|
|
{
|
|
this.ConstructionLogId = string.Empty;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void GetData()
|
|
{
|
|
var log = BLL.ConstructionLogService.GetConstructionLogById(ConstructionLogId);
|
|
if (log != null)
|
|
{
|
|
this.hdWorkPostId.Text = log.WorkPostId;
|
|
this.hdMachineId.Text = log.MachineId;
|
|
this.hdConstructionLogId.Text = log.ConstructionLogId;
|
|
this.txtFileCode.Text = log.FileCode;
|
|
if (log.CompileDate != null)
|
|
{
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", log.CompileDate.Value);
|
|
this.txtWeek.Text = Funs.GetWeekDay(log.CompileDate.Value.DayOfWeek.ToString());
|
|
}
|
|
this.txtWeather.Text = log.Weather;
|
|
this.txtTemperature.Text = log.Temperature;
|
|
this.txtCompileMan.Text = BLL.Person_PersonsService.GetPersonsNameById(log.CompileMan);
|
|
if (!string.IsNullOrEmpty(log.ContractNo))
|
|
{
|
|
if (log.ContractNo.Length > 0)
|
|
{
|
|
this.drpContractNo.SelectedValueArray = log.ContractNo.Split(',');
|
|
}
|
|
}
|
|
drpContractNo_SelectedIndexChanged(null, null);
|
|
if (!string.IsNullOrEmpty(log.UnitWorks))
|
|
{
|
|
if (log.UnitWorks.Length > 0)
|
|
{
|
|
this.drpUnitWork.SelectedValueArray = log.UnitWorks.Split(',');
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(log.Professional))
|
|
{
|
|
if (log.Professional.Length > 0)
|
|
{
|
|
this.drpProfessional.SelectedValueArray = log.Professional.Split(',');
|
|
}
|
|
}
|
|
this.txtRemark.Text = log.Remark;
|
|
this.txtHSETodaySummary.Text = log.HSETodaySummary;
|
|
this.txtHSETodaySummaryRemark.Text = log.HSETodaySummaryRemark;
|
|
this.txtHSETomorrowPlan.Text = log.HSETomorrowPlan;
|
|
this.txtHSETomorrowPlanRemark.Text = log.HSETomorrowPlanRemark;
|
|
this.txtCQMSTodaySummary.Text = log.CQMSTodaySummary;
|
|
this.txtCQMSTodaySummaryRemark.Text = log.CQMSTodaySummaryRemark;
|
|
this.txtCQMSTomorrowPlan.Text = log.CQMSTomorrowPlan;
|
|
this.txtCQMSTomorrowPlanRemark.Text = log.CQMSTomorrowPlanRemark;
|
|
var persons = BLL.ConstructionLogPersonService.GetConstructionLogPersonsByConstructionLogId(ConstructionLogId);
|
|
List<string> unitWorkList = Funs.GetStrListByStr(log.UnitWorks, ',');
|
|
List<Model.ConstructionLogPersonItem> personItems = new List<Model.ConstructionLogPersonItem>();
|
|
if (persons.Count > 0)
|
|
{
|
|
List<string> workPostList = Funs.GetStrListByStr(this.hdWorkPostId.Text, ',');
|
|
foreach (var unitWork in unitWorkList)
|
|
{
|
|
Model.ConstructionLogPersonItem personItem = new Model.ConstructionLogPersonItem();
|
|
personItem.ConstructionLogPersonId = SQLHelper.GetNewID();
|
|
personItem.ConstructionLogId = ConstructionLogId;
|
|
personItem.UnitWorkId = unitWork;
|
|
int a = 0;
|
|
foreach (var workPost in workPostList)
|
|
{
|
|
int num = 0;
|
|
var p = persons.FirstOrDefault(x => x.UnitWorkId == unitWork && x.WorkPostId == workPost);
|
|
if (p != null)
|
|
{
|
|
num = p.Num ?? 0;
|
|
}
|
|
if (a == 0)
|
|
{
|
|
personItem.Num0 = num;
|
|
}
|
|
else if (a == 1)
|
|
{
|
|
personItem.Num1 = num;
|
|
}
|
|
else if (a == 2)
|
|
{
|
|
personItem.Num2 = num;
|
|
}
|
|
else if (a == 3)
|
|
{
|
|
personItem.Num3 = num;
|
|
}
|
|
else if (a == 4)
|
|
{
|
|
personItem.Num4 = num;
|
|
}
|
|
else if (a == 5)
|
|
{
|
|
personItem.Num5 = num;
|
|
}
|
|
else if (a == 6)
|
|
{
|
|
personItem.Num6 = num;
|
|
}
|
|
else if (a == 7)
|
|
{
|
|
personItem.Num7 = num;
|
|
}
|
|
else if (a == 8)
|
|
{
|
|
personItem.Num8 = num;
|
|
}
|
|
else if (a == 9)
|
|
{
|
|
personItem.Num9 = num;
|
|
}
|
|
else if (a == 10)
|
|
{
|
|
personItem.Num10 = num;
|
|
}
|
|
else if (a == 11)
|
|
{
|
|
personItem.Num11 = num;
|
|
}
|
|
else if (a == 12)
|
|
{
|
|
personItem.Num12 = num;
|
|
}
|
|
else if (a == 13)
|
|
{
|
|
personItem.Num13 = num;
|
|
}
|
|
else if (a == 14)
|
|
{
|
|
personItem.Num14 = num;
|
|
}
|
|
else if (a == 15)
|
|
{
|
|
personItem.Num15 = num;
|
|
}
|
|
else if (a == 16)
|
|
{
|
|
personItem.Num16 = num;
|
|
}
|
|
else if (a == 17)
|
|
{
|
|
personItem.Num17 = num;
|
|
}
|
|
else if (a == 18)
|
|
{
|
|
personItem.Num18 = num;
|
|
}
|
|
else if (a == 19)
|
|
{
|
|
personItem.Num19 = num;
|
|
}
|
|
else if (a == 20)
|
|
{
|
|
personItem.Num20 = num;
|
|
}
|
|
a++;
|
|
}
|
|
personItems.Add(personItem);
|
|
}
|
|
this.Grid1.DataSource = personItems;
|
|
this.Grid1.DataBind();
|
|
}
|
|
var machines = BLL.ConstructionLogMachineService.GetConstructionLogMachinesByConstructionLogId(ConstructionLogId);
|
|
List<Model.ConstructionLogMachineItem> machineItems = new List<Model.ConstructionLogMachineItem>();
|
|
if (machines.Count > 0)
|
|
{
|
|
List<string> machineList = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
|
|
foreach (var unitWork in unitWorkList)
|
|
{
|
|
Model.ConstructionLogMachineItem machineItem = new Model.ConstructionLogMachineItem();
|
|
machineItem.ConstructionLogMachineId = SQLHelper.GetNewID();
|
|
machineItem.ConstructionLogId = ConstructionLogId;
|
|
machineItem.UnitWorkId = unitWork;
|
|
int a = 0;
|
|
foreach (var machine in machineList)
|
|
{
|
|
int num = 0;
|
|
var p = machines.FirstOrDefault(x => x.UnitWorkId == unitWork && x.MachineId == machine);
|
|
if (p != null)
|
|
{
|
|
num = p.Num ?? 0;
|
|
}
|
|
if (a == 0)
|
|
{
|
|
machineItem.Num0 = num;
|
|
}
|
|
else if (a == 1)
|
|
{
|
|
machineItem.Num1 = num;
|
|
}
|
|
else if (a == 2)
|
|
{
|
|
machineItem.Num2 = num;
|
|
}
|
|
else if (a == 3)
|
|
{
|
|
machineItem.Num3 = num;
|
|
}
|
|
else if (a == 4)
|
|
{
|
|
machineItem.Num4 = num;
|
|
}
|
|
else if (a == 5)
|
|
{
|
|
machineItem.Num5 = num;
|
|
}
|
|
else if (a == 6)
|
|
{
|
|
machineItem.Num6 = num;
|
|
}
|
|
else if (a == 7)
|
|
{
|
|
machineItem.Num7 = num;
|
|
}
|
|
else if (a == 8)
|
|
{
|
|
machineItem.Num8 = num;
|
|
}
|
|
else if (a == 9)
|
|
{
|
|
machineItem.Num9 = num;
|
|
}
|
|
else if (a == 10)
|
|
{
|
|
machineItem.Num10 = num;
|
|
}
|
|
else if (a == 11)
|
|
{
|
|
machineItem.Num11 = num;
|
|
}
|
|
else if (a == 12)
|
|
{
|
|
machineItem.Num12 = num;
|
|
}
|
|
else if (a == 13)
|
|
{
|
|
machineItem.Num13 = num;
|
|
}
|
|
else if (a == 14)
|
|
{
|
|
machineItem.Num14 = num;
|
|
}
|
|
else if (a == 15)
|
|
{
|
|
machineItem.Num15 = num;
|
|
}
|
|
else if (a == 16)
|
|
{
|
|
machineItem.Num16 = num;
|
|
}
|
|
else if (a == 17)
|
|
{
|
|
machineItem.Num17 = num;
|
|
}
|
|
else if (a == 18)
|
|
{
|
|
machineItem.Num18 = num;
|
|
}
|
|
else if (a == 19)
|
|
{
|
|
machineItem.Num19 = num;
|
|
}
|
|
else if (a == 20)
|
|
{
|
|
machineItem.Num20 = num;
|
|
}
|
|
a++;
|
|
}
|
|
machineItems.Add(machineItem);
|
|
}
|
|
this.Grid2.DataSource = machineItems;
|
|
this.Grid2.DataBind();
|
|
}
|
|
var managements = BLL.ConstructionLogManagementService.GetConstructionLogManagementsByConstructionLogId(ConstructionLogId);
|
|
if (managements.Count > 0)
|
|
{
|
|
this.Grid3.DataSource = managements;
|
|
this.Grid3.DataBind();
|
|
}
|
|
var problems = BLL.ConstructionLogProblemService.GetConstructionLogProblemsByConstructionLogId(ConstructionLogId);
|
|
if (problems.Count > 0)
|
|
{
|
|
foreach (var item in problems)
|
|
{
|
|
item.WorkPackageId = BLL.WorkPackageInitService.GetPackageContentByWorkPackageCode(item.WorkPackageId);
|
|
}
|
|
this.Grid4.DataSource = problems;
|
|
this.Grid4.DataBind();
|
|
}
|
|
var records = BLL.ConstructionLogRecordService.GetConstructionLogRecordsByConstructionLogId(ConstructionLogId);
|
|
if (records.Count > 0)
|
|
{
|
|
this.Grid5.DataSource = records;
|
|
this.Grid5.DataBind();
|
|
}
|
|
ChangeText();
|
|
}
|
|
}
|
|
|
|
#region 增加
|
|
/// <summary>
|
|
/// 增加按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuAdd_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.GetButtonPower(BLL.Const.BtnAdd))
|
|
{
|
|
TextNew();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
private void TextNew()
|
|
{
|
|
this.ConstructionLogId = string.Empty;
|
|
this.hdConstructionLogId.Text = string.Empty;
|
|
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.txtRemark.Text = string.Empty;
|
|
this.txtHSETodaySummary.Text = string.Empty;
|
|
this.txtHSETodaySummaryRemark.Text = string.Empty;
|
|
this.txtHSETomorrowPlan.Text = string.Empty;
|
|
this.txtHSETomorrowPlanRemark.Text = string.Empty;
|
|
this.txtCQMSTodaySummary.Text = string.Empty;
|
|
this.txtCQMSTodaySummaryRemark.Text = string.Empty;
|
|
this.txtCQMSTomorrowPlan.Text = string.Empty;
|
|
this.txtCQMSTomorrowPlanRemark.Text = string.Empty;
|
|
this.Grid1.DataSource = null;
|
|
this.Grid1.DataBind();
|
|
this.Grid2.DataSource = null;
|
|
this.Grid2.DataBind();
|
|
this.Grid3.DataSource = null;
|
|
this.Grid3.DataBind();
|
|
this.Grid4.DataSource = null;
|
|
this.Grid4.DataBind();
|
|
this.Grid5.DataSource = null;
|
|
this.Grid5.DataBind();
|
|
drpUnitWork_SelectedIndexChanged(null, null);
|
|
ChangeText();
|
|
}
|
|
|
|
private void TextEmpty()
|
|
{
|
|
this.ConstructionLogId = string.Empty;
|
|
this.txtFileCode.Text = string.Empty;
|
|
this.txtCompileDate.Text = string.Empty;
|
|
this.txtWeek.Text = string.Empty;
|
|
this.txtWeather.Text = string.Empty;
|
|
this.txtTemperature.Text = string.Empty;
|
|
this.txtCompileMan.Text = string.Empty;
|
|
this.drpContractNo.SelectedIndex = 0;
|
|
this.drpUnitWork.SelectedIndex = 0;
|
|
this.drpProfessional.SelectedIndex = 0;
|
|
this.txtRemark.Text = string.Empty;
|
|
this.txtHSETodaySummary.Text = string.Empty;
|
|
this.txtHSETodaySummaryRemark.Text = string.Empty;
|
|
this.txtHSETomorrowPlan.Text = string.Empty;
|
|
this.txtHSETomorrowPlanRemark.Text = string.Empty;
|
|
this.txtCQMSTodaySummary.Text = string.Empty;
|
|
this.txtCQMSTodaySummaryRemark.Text = string.Empty;
|
|
this.txtCQMSTomorrowPlan.Text = string.Empty;
|
|
this.txtCQMSTomorrowPlanRemark.Text = string.Empty;
|
|
this.Grid1.DataSource = null;
|
|
this.Grid1.DataBind();
|
|
this.Grid2.DataSource = null;
|
|
this.Grid2.DataBind();
|
|
this.Grid3.DataSource = null;
|
|
this.Grid3.DataBind();
|
|
this.Grid4.DataSource = null;
|
|
this.Grid4.DataBind();
|
|
this.Grid5.DataSource = null;
|
|
this.Grid5.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.GetButtonPower(BLL.Const.BtnModify))
|
|
{
|
|
this.ConstructionLogId = this.tvControlItem.SelectedNodeID;
|
|
GetData();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出
|
|
/// <summary>
|
|
/// 导出按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDown_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 删除明细
|
|
/// <summary>
|
|
/// 删除明细按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete2_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.GetButtonPower(BLL.Const.BtnSave))
|
|
{
|
|
if (this.Grid5.Hidden == true)
|
|
{
|
|
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;
|
|
log.FileCode = this.txtFileCode.Text.Trim();
|
|
log.CompileDate = Funs.GetNewDateTimeOrNow(this.txtCompileDate.Text.Trim());
|
|
log.Weather = this.txtWeather.Text.Trim();
|
|
log.Temperature = this.txtTemperature.Text.Trim();
|
|
log.CompileMan = this.CurrUser.PersonId;
|
|
string contractNo = string.Empty;
|
|
foreach (var item in this.drpContractNo.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
contractNo += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(contractNo))
|
|
{
|
|
contractNo = contractNo.Substring(0, contractNo.Length - 1);
|
|
}
|
|
log.ContractNo = contractNo;
|
|
string unitWork = string.Empty;
|
|
foreach (var item in this.drpUnitWork.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
unitWork += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(unitWork))
|
|
{
|
|
unitWork = unitWork.Substring(0, unitWork.Length - 1);
|
|
}
|
|
log.UnitWorks = unitWork;
|
|
string professional = string.Empty;
|
|
foreach (var item in this.drpProfessional.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
professional += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(professional))
|
|
{
|
|
professional = professional.Substring(0, professional.Length - 1);
|
|
}
|
|
log.Professional = professional;
|
|
log.State = "1"; //已填报
|
|
log.Remark = this.txtRemark.Text.Trim();
|
|
log.HSETodaySummary = this.txtHSETodaySummary.Text.Trim();
|
|
log.HSETodaySummaryRemark = this.txtHSETodaySummaryRemark.Text.Trim();
|
|
log.HSETomorrowPlan = this.txtHSETomorrowPlan.Text.Trim();
|
|
log.HSETomorrowPlanRemark = this.txtHSETomorrowPlanRemark.Text.Trim();
|
|
log.CQMSTodaySummary = this.txtCQMSTodaySummary.Text.Trim();
|
|
log.CQMSTodaySummaryRemark = this.txtCQMSTodaySummaryRemark.Text.Trim();
|
|
log.CQMSTomorrowPlan = this.txtCQMSTomorrowPlan.Text.Trim();
|
|
log.CQMSTomorrowPlanRemark = this.txtCQMSTomorrowPlanRemark.Text.Trim();
|
|
log.WorkPostId = this.hdWorkPostId.Text.Trim();
|
|
log.MachineId = this.hdMachineId.Text.Trim();
|
|
if (!string.IsNullOrEmpty(this.ConstructionLogId))
|
|
{
|
|
var updatelog = BLL.ConstructionLogService.GetConstructionLogById(this.ConstructionLogId);
|
|
if (updatelog != null)
|
|
{
|
|
log.ConstructionLogId = ConstructionLogId;
|
|
BLL.ConstructionLogService.UpdateConstructionLog(log);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
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)
|
|
{
|
|
if (!string.IsNullOrEmpty(hdConstructionLogId.Text))
|
|
{
|
|
log.ConstructionLogId = hdConstructionLogId.Text;
|
|
}
|
|
else
|
|
{
|
|
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, ',');
|
|
foreach (JObject mergedRow in Grid1.GetMergedData()) //作业人员人数
|
|
{
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
Model.ZHGL_ConstructionLogPerson newItem = new Model.ZHGL_ConstructionLogPerson();
|
|
newItem.ConstructionLogPersonId = SQLHelper.GetNewID();
|
|
newItem.ConstructionLogId = this.ConstructionLogId;
|
|
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
|
|
newItem.WorkPostId = list[i];
|
|
newItem.Num = Funs.GetNewIntOrZero(values.Value<string>("Num" + i.ToString()));
|
|
ConstructionLogPersonService.AddConstructionLogPerson(newItem);
|
|
}
|
|
}
|
|
BLL.ConstructionLogMachineService.DeleteConstructionLogMachinesByConstructionLogId(this.ConstructionLogId);
|
|
List<string> list2 = Funs.GetStrListByStr(this.hdMachineId.Text, ',');
|
|
foreach (JObject mergedRow in Grid2.GetMergedData()) //机械数量
|
|
{
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
Model.ZHGL_ConstructionLogMachine newItem = new Model.ZHGL_ConstructionLogMachine();
|
|
newItem.ConstructionLogMachineId = SQLHelper.GetNewID();
|
|
newItem.ConstructionLogId = this.ConstructionLogId;
|
|
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
|
|
newItem.MachineId = list2[i];
|
|
newItem.Num = Funs.GetNewIntOrZero(values.Value<string>("Num" + i.ToString()));
|
|
ConstructionLogMachineService.AddConstructionLogMachine(newItem);
|
|
}
|
|
}
|
|
BLL.ConstructionLogManagementService.DeleteConstructionLogManagementsByConstructionLogId(this.ConstructionLogId);
|
|
foreach (JObject mergedRow in Grid3.GetMergedData()) //专业管理
|
|
{
|
|
Model.ZHGL_ConstructionLogManagement newItem = new Model.ZHGL_ConstructionLogManagement();
|
|
int i = mergedRow.Value<int>("index");
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
newItem.ConstructionLogManagementId = SQLHelper.GetNewID();
|
|
newItem.ConstructionLogId = this.ConstructionLogId;
|
|
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
|
|
newItem.TodayWork = values.Value<string>("TodayWork");
|
|
newItem.TomorrowWork = values.Value<string>("TomorrowWork");
|
|
newItem.Remark = values.Value<string>("Remark");
|
|
ConstructionLogManagementService.AddConstructionLogManagement(newItem);
|
|
}
|
|
BLL.ConstructionLogProblemService.DeleteConstructionLogProblemsByConstructionLogId(this.ConstructionLogId);
|
|
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");
|
|
ConstructionLogProblemService.AddConstructionLogProblem(newItem);
|
|
}
|
|
BLL.ConstructionLogRecordService.DeleteConstructionLogRecordsByConstructionLogId(this.ConstructionLogId);
|
|
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.ConstructionLogRecordId = SQLHelper.GetNewID();
|
|
newItem.ConstructionLogId = this.ConstructionLogId;
|
|
newItem.Record = values.Value<string>("Record");
|
|
newItem.Remark = values.Value<string>("Remark");
|
|
ConstructionLogRecordService.AddConstructionLogRecord(newItem);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
InitTreeMenu();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 关闭弹出窗体
|
|
/// <summary>
|
|
/// 关闭弹出窗体
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
ChangeText();
|
|
}
|
|
#endregion
|
|
|
|
private void ChangeText()
|
|
{
|
|
var workEfficiencys = from x in Funs.DB.ZHGL_ConstructionLogWorkEfficiency
|
|
where x.ConstructionLogId == this.hdConstructionLogId.Text
|
|
select x;
|
|
if (workEfficiencys.Count() > 0)
|
|
{
|
|
this.btnWorkEfficiency.Text = "已填报";
|
|
}
|
|
else
|
|
{
|
|
this.btnWorkEfficiency.Text = "未填报";
|
|
}
|
|
}
|
|
|
|
#region 右键删除焊口
|
|
/// <summary>
|
|
/// 右键删除焊口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (this.GetButtonPower(BLL.Const.BtnDelete))
|
|
{
|
|
this.ConstructionLogId = this.tvControlItem.SelectedNodeID;
|
|
var log = BLL.ConstructionLogService.GetConstructionLogById(ConstructionLogId);
|
|
if (log != null)
|
|
{
|
|
BLL.ConstructionLogWorkEfficiencyService.DeleteConstructionLogWorkEfficiencysByConstructionLogId(ConstructionLogId);
|
|
BLL.ConstructionLogPersonService.DeleteConstructionLogPersonsByConstructionLogId(ConstructionLogId);
|
|
BLL.ConstructionLogMachineService.DeleteConstructionLogMachinesByConstructionLogId(ConstructionLogId);
|
|
BLL.ConstructionLogManagementService.DeleteConstructionLogManagementsByConstructionLogId(ConstructionLogId);
|
|
BLL.ConstructionLogProblemService.DeleteConstructionLogProblemsByConstructionLogId(ConstructionLogId);
|
|
BLL.ConstructionLogRecordService.DeleteConstructionLogRecordsByConstructionLogId(ConstructionLogId);
|
|
BLL.ConstructionLogService.DeleteConstructionLogById(ConstructionLogId);
|
|
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
|
TextEmpty();
|
|
InitTreeMenu();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择要删除的记录!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 单位工程转换
|
|
/// <summary>
|
|
/// 单位工程转换
|
|
/// </summary>
|
|
/// <param name=""></param>
|
|
/// <returns></returns>
|
|
protected string ConvertUnitWorkName(object unitWorkId)
|
|
{
|
|
if (unitWorkId != null)
|
|
{
|
|
return BLL.UnitWorkService.GetUnitWorkName(unitWorkId.ToString());
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private bool GetButtonPower(string button)
|
|
{
|
|
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, BLL.Const.ConstructionLogMenuId, button);
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void drpContractNo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
List<string> contractNos = new List<string>();
|
|
foreach (var item in this.drpContractNo.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
contractNos.Add(item);
|
|
}
|
|
}
|
|
UnitWorkService.InitContractUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, contractNos, true);
|
|
}
|
|
|
|
protected void drpUnitWork_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (this.drpUnitWork.SelectedValue == BLL.Const._Null && this.drpUnitWork.SelectedItemArray.Length == 1)
|
|
{
|
|
this.Grid1.DataSource = null;
|
|
this.Grid1.DataBind();
|
|
this.Grid2.DataSource = null;
|
|
this.Grid2.DataBind();
|
|
this.Grid3.DataSource = null;
|
|
this.Grid3.DataBind();
|
|
this.Grid4.DataSource = null;
|
|
this.Grid4.DataBind();
|
|
}
|
|
else
|
|
{
|
|
List<Model.ZHGL_ConstructionLogPerson> persons = new List<Model.ZHGL_ConstructionLogPerson>();
|
|
foreach (var item in this.drpUnitWork.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
Model.ZHGL_ConstructionLogPerson person = new Model.ZHGL_ConstructionLogPerson();
|
|
person.ConstructionLogPersonId = SQLHelper.GetNewID();
|
|
person.UnitWorkId = item;
|
|
persons.Add(person);
|
|
}
|
|
}
|
|
this.Grid1.DataSource = persons;
|
|
this.Grid1.DataBind();
|
|
List<Model.ZHGL_ConstructionLogMachine> machines = new List<Model.ZHGL_ConstructionLogMachine>();
|
|
foreach (var item in this.drpUnitWork.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
Model.ZHGL_ConstructionLogMachine machine = new Model.ZHGL_ConstructionLogMachine();
|
|
machine.ConstructionLogMachineId = SQLHelper.GetNewID();
|
|
machine.UnitWorkId = item;
|
|
machines.Add(machine);
|
|
}
|
|
}
|
|
this.Grid2.DataSource = machines;
|
|
this.Grid2.DataBind();
|
|
List<Model.ZHGL_ConstructionLogManagement> managements = new List<Model.ZHGL_ConstructionLogManagement>();
|
|
foreach (var item in this.drpUnitWork.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
Model.ZHGL_ConstructionLogManagement management = new Model.ZHGL_ConstructionLogManagement();
|
|
management.ConstructionLogManagementId = SQLHelper.GetNewID();
|
|
management.UnitWorkId = item;
|
|
managements.Add(management);
|
|
}
|
|
}
|
|
this.Grid3.DataSource = managements;
|
|
this.Grid3.DataBind();
|
|
List<Model.ZHGL_ConstructionLogProblem> problems = new List<Model.ZHGL_ConstructionLogProblem>();
|
|
foreach (var item in this.drpUnitWork.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
Model.ZHGL_ConstructionLogProblem problem = new Model.ZHGL_ConstructionLogProblem();
|
|
problem.ConstructionLogProblemId = SQLHelper.GetNewID();
|
|
problem.UnitWorkId = item;
|
|
problems.Add(problem);
|
|
}
|
|
}
|
|
this.Grid4.DataSource = problems;
|
|
this.Grid4.DataBind();
|
|
}
|
|
}
|
|
|
|
#region Grid行点击事件
|
|
/// <summary>
|
|
/// Grid行点击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid3_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
string id = this.Grid3.SelectedRow.RowID;
|
|
string unitWorkId = this.Grid3.SelectedRow.DataKeys[1].ToString();
|
|
//保存页面数据
|
|
List<Model.ZHGL_ConstructionLogManagement> items = new List<Model.ZHGL_ConstructionLogManagement>();
|
|
foreach (JObject mergedRow in Grid3.GetMergedData()) //专业管理
|
|
{
|
|
Model.ZHGL_ConstructionLogManagement newItem = new Model.ZHGL_ConstructionLogManagement();
|
|
int i = mergedRow.Value<int>("index");
|
|
JObject values = mergedRow.Value<JObject>("values");
|
|
newItem.ConstructionLogManagementId = values.Value<string>("ConstructionLogManagementId");
|
|
newItem.ConstructionLogId = this.ConstructionLogId;
|
|
newItem.UnitWorkId = values.Value<string>("UnitWorkId");
|
|
newItem.TodayWork = values.Value<string>("TodayWork");
|
|
newItem.TomorrowWork = values.Value<string>("TomorrowWork");
|
|
newItem.Remark = values.Value<string>("Remark");
|
|
items.Add(newItem);
|
|
}
|
|
if (e.CommandName == "add")//增加
|
|
{
|
|
Model.ZHGL_ConstructionLogManagement newItem = new Model.ZHGL_ConstructionLogManagement();
|
|
newItem.ConstructionLogManagementId = SQLHelper.GetNewID();
|
|
newItem.UnitWorkId = unitWorkId;
|
|
items.Add(newItem);
|
|
items = items.OrderBy(x => x.UnitWorkId).ToList();
|
|
this.Grid3.DataSource = items;
|
|
this.Grid3.DataBind();
|
|
}
|
|
if (e.CommandName == "del")//删除
|
|
{
|
|
var w = items.FirstOrDefault(x => x.ConstructionLogManagementId == id);
|
|
if (w != null)
|
|
{
|
|
items.Remove(w);
|
|
}
|
|
items = items.OrderBy(x => x.UnitWorkId).ToList();
|
|
this.Grid3.DataSource = items;
|
|
this.Grid3.DataBind();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Grid行点击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid4_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
string id = this.Grid4.SelectedRow.RowID;
|
|
string unitWorkId = this.Grid4.SelectedRow.DataKeys[1].ToString();
|
|
if (e.CommandName == "download")
|
|
{
|
|
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.ConstructionLogRecordId = values.Value<string>("ConstructionLogRecordId");
|
|
newItem.ConstructionLogId = this.ConstructionLogId;
|
|
newItem.Record = values.Value<string>("Record");
|
|
newItem.Remark = values.Value<string>("Remark");
|
|
items.Add(newItem);
|
|
}
|
|
if (e.CommandName == "del")//删除
|
|
{
|
|
var w = items.FirstOrDefault(x => x.ConstructionLogRecordId == id);
|
|
if (w != null)
|
|
{
|
|
items.Remove(w);
|
|
}
|
|
}
|
|
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();
|
|
}
|
|
|
|
protected void btnWorkEfficiency_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(hdConstructionLogId.Text)) //新增记录
|
|
{
|
|
hdConstructionLogId.Text = SQLHelper.GetNewID();
|
|
}
|
|
string contractNo = string.Empty;
|
|
foreach (var item in this.drpContractNo.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
contractNo += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(contractNo))
|
|
{
|
|
contractNo = contractNo.Substring(0, contractNo.Length - 1);
|
|
}
|
|
string professional = string.Empty;
|
|
foreach (var item in this.drpProfessional.SelectedValueArray)
|
|
{
|
|
if (item != BLL.Const._Null)
|
|
{
|
|
professional += item + ",";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(professional))
|
|
{
|
|
professional = professional.Substring(0, professional.Length - 1);
|
|
}
|
|
if (!string.IsNullOrEmpty(contractNo) && !string.IsNullOrEmpty(professional))
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConstructionLogWorkEfficiency.aspx?ConstructionLogId={0}&contractNo={1}&professional={2}&WorkPostId={3}&MachineId={4}", this.hdConstructionLogId.Text, contractNo, professional, hdWorkPostId.Text, hdMachineId.Text, "导入 - ")));
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("请选择合同编号和专业工程!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
}
|
|
} |