11
This commit is contained in:
@@ -28,9 +28,11 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.txtMonth.Text = string.Format("{0:yyyy-MM}",DateTime.Now);
|
||||
//this.txtMonth.Text = string.Format("{0:yyyy-MM}",DateTime.Now);
|
||||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||||
this.InitTreeMenu();//加载树
|
||||
BLL.Project_InstallationService.InitInstallationDropDownList(this.drpInstallation, true, this.CurrUser.LoginProjectId, Resources.Lan.PleaseSelect);
|
||||
BindGrid();
|
||||
//this.InitTreeMenu();//加载树
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,20 +42,20 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
/// </summary>
|
||||
private void InitTreeMenu()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtMonth.Text.Trim()))
|
||||
{
|
||||
DateTime startTime = Convert.ToDateTime(this.txtMonth.Text.Trim() + "-01");
|
||||
DateTime endTime = startTime.AddMonths(1);
|
||||
this.tvControlItem.Nodes.Clear();
|
||||
var weldReports = (from x in Funs.DB.Pipeline_WeldingDaily
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x).ToList();
|
||||
this.BindNodes(null, weldReports, startTime, endTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
|
||||
}
|
||||
//if (!string.IsNullOrEmpty(this.txtMonth.Text.Trim()))
|
||||
//{
|
||||
// DateTime startTime = Convert.ToDateTime(this.txtMonth.Text.Trim() + "-01");
|
||||
// DateTime endTime = startTime.AddMonths(1);
|
||||
// this.tvControlItem.Nodes.Clear();
|
||||
// var weldReports = (from x in Funs.DB.Pipeline_WeldingDaily
|
||||
// where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
// select x).ToList();
|
||||
// this.BindNodes(null, weldReports, startTime, endTime);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Alert.ShowInTop("请选择月份!", MessageBoxIcon.Warning);
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -65,80 +67,80 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
/// <param name="node"></param>
|
||||
private void BindNodes(TreeNode node, List<Model.Pipeline_WeldingDaily> projectWeldReports, DateTime startTime, DateTime endTime)
|
||||
{
|
||||
var pUnitDepth = Funs.DB.Project_Unit.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId && x.ProjectId == this.CurrUser.LoginProjectId);
|
||||
//var pUnitDepth = Funs.DB.Project_Unit.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId && x.ProjectId == this.CurrUser.LoginProjectId);
|
||||
|
||||
if (node == null)
|
||||
{
|
||||
if (pUnitDepth!=null && pUnitDepth.UnitType == Const.UnitType_5)
|
||||
{
|
||||
var installations = (from x in projectWeldReports
|
||||
join y in Funs.DB.Project_Installation
|
||||
on x.InstallationId equals y.InstallationId
|
||||
where x.UnitId==this.CurrUser.UnitId && x.WeldingDate >= startTime && x.WeldingDate < endTime
|
||||
select y).Distinct().ToList();
|
||||
foreach (var q in installations)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.NodeID = q.InstallationId;
|
||||
newNode.Text = q.InstallationName;
|
||||
newNode.ToolTip = Resources.Lan.InstallationName;
|
||||
newNode.Expanded = true;
|
||||
this.tvControlItem.Nodes.Add(newNode);
|
||||
this.BindNodes(newNode, projectWeldReports, startTime, endTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var installations = (from x in projectWeldReports
|
||||
join y in Funs.DB.Project_Installation
|
||||
on x.InstallationId equals y.InstallationId
|
||||
where x.WeldingDate >= startTime && x.WeldingDate < endTime
|
||||
select y).Distinct().ToList();
|
||||
foreach (var q in installations)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.NodeID = q.InstallationId;
|
||||
newNode.Text = q.InstallationName;
|
||||
newNode.ToolTip = Resources.Lan.InstallationName;
|
||||
newNode.Expanded = true;
|
||||
this.tvControlItem.Nodes.Add(newNode);
|
||||
this.BindNodes(newNode, projectWeldReports, startTime, endTime);
|
||||
}
|
||||
}
|
||||
//if (node == null)
|
||||
//{
|
||||
// if (pUnitDepth!=null && pUnitDepth.UnitType == Const.UnitType_5)
|
||||
// {
|
||||
// var installations = (from x in projectWeldReports
|
||||
// join y in Funs.DB.Project_Installation
|
||||
// on x.InstallationId equals y.InstallationId
|
||||
// where x.UnitId==this.CurrUser.UnitId && x.WeldingDate >= startTime && x.WeldingDate < endTime
|
||||
// select y).Distinct().ToList();
|
||||
// foreach (var q in installations)
|
||||
// {
|
||||
// TreeNode newNode = new TreeNode();
|
||||
// newNode.NodeID = q.InstallationId;
|
||||
// newNode.Text = q.InstallationName;
|
||||
// newNode.ToolTip = Resources.Lan.InstallationName;
|
||||
// newNode.Expanded = true;
|
||||
// this.tvControlItem.Nodes.Add(newNode);
|
||||
// this.BindNodes(newNode, projectWeldReports, startTime, endTime);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var installations = (from x in projectWeldReports
|
||||
// join y in Funs.DB.Project_Installation
|
||||
// on x.InstallationId equals y.InstallationId
|
||||
// where x.WeldingDate >= startTime && x.WeldingDate < endTime
|
||||
// select y).Distinct().ToList();
|
||||
// foreach (var q in installations)
|
||||
// {
|
||||
// TreeNode newNode = new TreeNode();
|
||||
// newNode.NodeID = q.InstallationId;
|
||||
// newNode.Text = q.InstallationName;
|
||||
// newNode.ToolTip = Resources.Lan.InstallationName;
|
||||
// newNode.Expanded = true;
|
||||
// this.tvControlItem.Nodes.Add(newNode);
|
||||
// this.BindNodes(newNode, projectWeldReports, startTime, endTime);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
else if (node.ToolTip == Resources.Lan.InstallationName)
|
||||
{
|
||||
List<Model.Base_Unit> units = null;
|
||||
if (pUnitDepth != null && pUnitDepth.UnitType == Const.UnitType_5)
|
||||
{
|
||||
units = (from x in Funs.DB.Base_Unit
|
||||
where x.UnitId == this.CurrUser.UnitId
|
||||
select x).ToList();
|
||||
//}
|
||||
//else if (node.ToolTip == Resources.Lan.InstallationName)
|
||||
//{
|
||||
// List<Model.Base_Unit> units = null;
|
||||
// if (pUnitDepth != null && pUnitDepth.UnitType == Const.UnitType_5)
|
||||
// {
|
||||
// units = (from x in Funs.DB.Base_Unit
|
||||
// where x.UnitId == this.CurrUser.UnitId
|
||||
// select x).ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
units = (from x in projectWeldReports
|
||||
join y in Funs.DB.Project_Installation
|
||||
on x.InstallationId equals y.InstallationId
|
||||
join z in Funs.DB.Base_Unit
|
||||
on x.UnitId equals z.UnitId
|
||||
where x.InstallationId == node.NodeID && x.WeldingDate >= startTime && x.WeldingDate < endTime
|
||||
select z).Distinct().ToList();
|
||||
}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// units = (from x in projectWeldReports
|
||||
// join y in Funs.DB.Project_Installation
|
||||
// on x.InstallationId equals y.InstallationId
|
||||
// join z in Funs.DB.Base_Unit
|
||||
// on x.UnitId equals z.UnitId
|
||||
// where x.InstallationId == node.NodeID && x.WeldingDate >= startTime && x.WeldingDate < endTime
|
||||
// select z).Distinct().ToList();
|
||||
// }
|
||||
|
||||
units = units.OrderBy(x => x.InTime).Distinct().ToList();
|
||||
foreach (var q in units)
|
||||
{
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = q.UnitName;
|
||||
newNode.NodeID = q.UnitId + "|" + node.NodeID;
|
||||
newNode.ToolTip = Resources.Lan.UnitName;
|
||||
newNode.EnableClickEvent = true;
|
||||
node.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
// units = units.OrderBy(x => x.InTime).Distinct().ToList();
|
||||
// foreach (var q in units)
|
||||
// {
|
||||
// TreeNode newNode = new TreeNode();
|
||||
// newNode.Text = q.UnitName;
|
||||
// newNode.NodeID = q.UnitId + "|" + node.NodeID;
|
||||
// newNode.ToolTip = Resources.Lan.UnitName;
|
||||
// newNode.EnableClickEvent = true;
|
||||
// node.Nodes.Add(newNode);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
@@ -173,58 +175,63 @@ namespace FineUIPro.Web.WeldingProcess.WeldingManage
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.ToolTip == Resources.Lan.UnitName)
|
||||
{
|
||||
string[] strs = this.tvControlItem.SelectedNodeID.Split('|');
|
||||
DateTime startDate = Convert.ToDateTime(this.txtMonth.Text.Trim() + "-1");
|
||||
DateTime endDate = startDate.AddMonths(1);
|
||||
string startDateStr = string.Format("{0:yyyy-MM-dd}", startDate);
|
||||
string endDateStr = string.Format("{0:yyyy-MM-dd}", endDate);
|
||||
string strSql = @"SELECT distinct d.WeldingDailyId,d.WeldingDailyCode,d.ProjectId,
|
||||
//if (this.tvControlItem.SelectedNode != null && this.tvControlItem.SelectedNode.ToolTip == Resources.Lan.UnitName)
|
||||
//{
|
||||
//string[] strs = this.tvControlItem.SelectedNodeID.Split('|');
|
||||
//DateTime startDate = Convert.ToDateTime(this.txtMonth.Text.Trim() + "-1");
|
||||
//DateTime endDate = startDate.AddMonths(1);
|
||||
//string startDateStr = string.Format("{0:yyyy-MM-dd}", startDate);
|
||||
//string endDateStr = string.Format("{0:yyyy-MM-dd}", endDate);
|
||||
string strSql = @"SELECT distinct d.WeldingDailyId,d.WeldingDailyCode,d.ProjectId,
|
||||
d.InstallationId,d.UnitId,d.WeldingDate,d.Tabler,d.TableDate,d.Remark
|
||||
FROM dbo.Pipeline_WeldingDaily d
|
||||
left join dbo.View_Pipeline_WeldJoint w on w.WeldingDailyId=d.WeldingDailyId
|
||||
WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>
|
||||
{
|
||||
List<SqlParameter> listStr = new List<SqlParameter>
|
||||
{
|
||||
|
||||
};
|
||||
strSql += " AND d.ProjectId =@ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
};
|
||||
strSql += " AND d.ProjectId =@ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
if (drpInstallation.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND d.InstallationId =@InstallationId";
|
||||
listStr.Add(new SqlParameter("@InstallationId", strs[1]));
|
||||
strSql += " AND d.UnitId =@UnitId";
|
||||
listStr.Add(new SqlParameter("@UnitId", strs[0]));
|
||||
strSql += " AND d.WeldingDate >=@startDateStr";
|
||||
listStr.Add(new SqlParameter("@startDateStr", startDateStr));
|
||||
strSql += " AND d.WeldingDate <@endDateStr";
|
||||
listStr.Add(new SqlParameter("@endDateStr", endDateStr));
|
||||
if (!string.IsNullOrEmpty(this.txtWeldingDate.Text.Trim()))
|
||||
{
|
||||
strSql += " AND d.WeldingDate = @WeldingDate";
|
||||
listStr.Add(new SqlParameter("@WeldingDate", this.txtWeldingDate.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
|
||||
{
|
||||
strSql += " AND w.PipelineCode LIKE @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipelineCode.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
|
||||
{
|
||||
strSql += " AND w.WeldJointCode LIKE @WeldJointCode";
|
||||
listStr.Add(new SqlParameter("@WeldJointCode", "%" + this.txtWeldJointCode.Text.Trim() + "%"));
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
// 2.获取当前分页数据
|
||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
listStr.Add(new SqlParameter("@InstallationId", drpInstallation.SelectedValue));
|
||||
}
|
||||
|
||||
//strSql += " AND d.UnitId =@UnitId";
|
||||
//listStr.Add(new SqlParameter("@UnitId", strs[0]));
|
||||
//strSql += " AND d.WeldingDate >=@startDateStr";
|
||||
//listStr.Add(new SqlParameter("@startDateStr", startDateStr));
|
||||
//strSql += " AND d.WeldingDate <@endDateStr";
|
||||
//listStr.Add(new SqlParameter("@endDateStr", endDateStr));
|
||||
if (!string.IsNullOrEmpty(this.txtWeldingDate.Text.Trim()))
|
||||
{
|
||||
strSql += " AND d.WeldingDate = @WeldingDate";
|
||||
listStr.Add(new SqlParameter("@WeldingDate", this.txtWeldingDate.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text.Trim()))
|
||||
{
|
||||
strSql += " AND w.PipelineCode LIKE @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + this.txtPipelineCode.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtWeldJointCode.Text.Trim()))
|
||||
{
|
||||
strSql += " AND w.WeldJointCode = @WeldJointCode";
|
||||
listStr.Add(new SqlParameter("@WeldJointCode", this.txtWeldJointCode.Text.Trim()));
|
||||
}
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
// 2.获取当前分页数据
|
||||
//var table = this.GetPagedDataTable(Grid1, tb1);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user