This commit is contained in:
2025-05-16 17:54:16 +08:00
parent 1d2aee2c7c
commit 1773ec1dde
24 changed files with 1025 additions and 475 deletions
@@ -25,6 +25,11 @@
<f:DropDownList ID="sdrpUnitId" runat="server" Label="报验单位" LabelAlign="Right">
</f:DropDownList>
<f:DropDownList ID="drpCNPr" runat="server" Label="专业" LabelAlign="Right" LabelWidth="60px"></f:DropDownList>
<f:DropDownList ID="drpSchemeType" runat="server" Label="方案类型" LabelAlign="Right" LabelWidth="100px">
<f:ListItem Text="- 请选择 -" Value="" />
<f:ListItem Text="危大工程" Value="危大工程" />
<f:ListItem Text="超危大工程" Value="超危大工程" />
</f:DropDownList>
<f:TextBox runat="server" ID="txtPlanName" Label="方案名称" LabelAlign="Right"></f:TextBox>
<f:Button ID="btnSearch" Icon="SystemSearch"
EnablePostBack="true" runat="server" ToolTip="查询" OnClick="btnSearch_Click">
@@ -51,10 +56,10 @@
HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="SchemeType" DataField="SchemeType" FieldType="String" HeaderText="方案类型" TextAlign="Center"
HeaderTextAlign="Center" Width="200px">
HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="TypeName" DataField="TypeName" FieldType="String" HeaderText="类型" TextAlign="Center"
HeaderTextAlign="Center" Width="200px">
HeaderTextAlign="Center" Width="200px">
</f:RenderField>
<f:RenderField ColumnID="ProfessionalName" DataField="ProfessionalName" FieldType="String" HeaderText="专业" TextAlign="Center"
HeaderTextAlign="Center" Width="150px">
@@ -82,10 +87,10 @@
<f:RenderField ColumnID="ApprovalMan" DataField="ApprovalMan" FieldType="String" HeaderText="批准人" TextAlign="Center"
HeaderTextAlign="Center" Width="120px">
</f:RenderField>
<f:RenderField ColumnID="IsReview" DataField="IsReview" FieldType="String" HeaderText="是否通过专家评审" TextAlign="Center"
<f:RenderField ColumnID="IsReview" DataField="IsReview" FieldType="String" HeaderText="是否通过专家评审" TextAlign="Center"
HeaderTextAlign="Center" Width="150px">
</f:RenderField>
<%-- <f:RenderField ColumnID="ImplementationDeviation" DataField="ImplementationDeviation" FieldType="String" HeaderText="施工总结" TextAlign="Center"
<%-- <f:RenderField ColumnID="ImplementationDeviation" DataField="ImplementationDeviation" FieldType="String" HeaderText="施工总结" TextAlign="Center"
HeaderTextAlign="Center" Width="220px">
</f:RenderField>--%>
<%-- <f:TemplateField ColumnID="AttachFile" Width="150px" HeaderText="附件" HeaderTextAlign="Center" TextAlign="Left" > --%>
@@ -97,7 +102,7 @@
<f:TemplateField ColumnID="AttachFile" Width="150px" HeaderText="附件" HeaderTextAlign="Center" TextAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="lbtnFileUrl" runat="server" CssClass="ItemLink" OnClick="attchUrl_Click"
Text='查看' ToolTip="附件查看">
Text='查看' ToolTip="附件查看">
</asp:LinkButton>
</ItemTemplate>
</f:TemplateField>
@@ -128,8 +133,8 @@
Width="1200px" Height="660px">
</f:Window>
<f:Window ID="WindowAtt" Title="弹出窗体" Hidden="true" EnableIFrame="true" EnableMaximize="true"
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
Target="Parent" EnableResize="false" runat="server" IsModal="true" Width="700px"
Height="500px">
</f:Window>
<f:Menu ID="Menu1" runat="server">
<Items>
@@ -54,6 +54,11 @@ namespace FineUIPro.Web.Comprehensive
strSql += " AND C.CNProfessionalId=@CNProfessionalId";
listStr.Add(new SqlParameter("@CNProfessionalId", drpCNPr.SelectedValue));
}
if (drpSchemeType.SelectedValue != BLL.Const._Null && !string.IsNullOrWhiteSpace(drpSchemeType.SelectedValue))
{
strSql += " AND C.SchemeType=@SchemeType";
listStr.Add(new SqlParameter("@SchemeType", drpSchemeType.SelectedValue));
}
if (!string.IsNullOrEmpty(this.txtPlanName.Text.Trim()))
{
strSql += " AND C.PlanName like @PlanName";
@@ -433,7 +438,7 @@ namespace FineUIPro.Web.Comprehensive
}
}
#endregion
protected void attchUrl_Click(object sender, EventArgs e)
{
Debug.WriteLine("attchUrl_Click");
@@ -77,6 +77,15 @@ namespace FineUIPro.Web.Comprehensive
/// </remarks>
protected global::FineUIPro.DropDownList drpCNPr;
/// <summary>
/// drpSchemeType 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpSchemeType;
/// <summary>
/// txtPlanName 控件。
/// </summary>
@@ -87,7 +87,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
this.AttachUrl4.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", getUrl(this.MajorPlanApprovalId + "_4"));
this.AttachUrl5.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", getUrl(this.MajorPlanApprovalId + "_5"));
this.AttachUrl6.InnerHtml = BLL.UploadAttachmentService.ShowAttachment("../../", getUrl(this.MajorPlanApprovalId + "_6"));
this.txtTrainPersonNum.Text = majorPlanApproval.TrainPersonNum.HasValue ? majorPlanApproval.TrainPersonNum.ToString() : "";
this.txtAuditMan.Text = majorPlanApproval.AuditMan;
this.txtApprovalMan.Text = majorPlanApproval.ApprovalMan;
@@ -130,7 +130,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
Alert.ShowInTop("请选择类型!", MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrEmpty(this.txtExpectedTime.Text))
{
majorPlanApproval.ExpectedTime = Convert.ToDateTime(this.txtExpectedTime.Text);
@@ -157,7 +157,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
majorPlanApproval.TrainPersonNum = Funs.GetNewInt(this.txtTrainPersonNum.Text.Trim());
if (this.drpStates.SelectedValue != "1")
if (this.drpSchemeType.SelectedValue == "超危大工程" && this.drpStates.SelectedValue != "1")
{
//判断附件是否必传
if (!returnFj(this.hdAttachUrl.Text + "_1"))
@@ -196,8 +196,8 @@ namespace FineUIPro.Web.CQMS.Comprehensive
return;
}
}
majorPlanApproval.ProjectId = this.CurrUser.LoginProjectId;
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
{
@@ -279,7 +279,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
this.hdAttachUrl.Text+"_1", BLL.Const.MajorPlanApprovalMenuId)));
this.hdAttachUrl.Text + "_1", BLL.Const.MajorPlanApprovalMenuId)));
}
protected void btnAttach_Click2(object sender, EventArgs e)
@@ -291,7 +291,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
this.hdAttachUrl.Text+"_2", BLL.Const.MajorPlanApprovalMenuId)));
this.hdAttachUrl.Text + "_2", BLL.Const.MajorPlanApprovalMenuId)));
}
protected void btnAttach_Click3(object sender, EventArgs e)
@@ -303,7 +303,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
this.hdAttachUrl.Text+"_3", BLL.Const.MajorPlanApprovalMenuId)));
this.hdAttachUrl.Text + "_3", BLL.Const.MajorPlanApprovalMenuId)));
}
protected void btnAttach_Click4(object sender, EventArgs e)
@@ -315,7 +315,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
this.hdAttachUrl.Text+"_4", BLL.Const.MajorPlanApprovalMenuId)));
this.hdAttachUrl.Text + "_4", BLL.Const.MajorPlanApprovalMenuId)));
}
protected void btnAttach_Click5(object sender, EventArgs e)
@@ -327,7 +327,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
this.hdAttachUrl.Text+"_5", BLL.Const.MajorPlanApprovalMenuId)));
this.hdAttachUrl.Text + "_5", BLL.Const.MajorPlanApprovalMenuId)));
}
protected void btnAttach_Click6(object sender, EventArgs e)
@@ -339,13 +339,14 @@ namespace FineUIPro.Web.CQMS.Comprehensive
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
this.hdAttachUrl.Text+"_6", BLL.Const.MajorPlanApprovalMenuId)));
this.hdAttachUrl.Text + "_6", BLL.Const.MajorPlanApprovalMenuId)));
}
private bool returnFj(string id) {
private bool returnFj(string id)
{
bool isT = true;
var model = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == id);
if (model==null)
if (model == null)
{
return false;
}
@@ -33,54 +33,40 @@ namespace FineUIPro.Web.CQMS.ProcessControl
/// </summary>
public void BindGrid()
{
string strSql = @"SELECT P.InspectionId,
P.ProjectId,
P.UnitId,
P.CNProfessionalId,
P.UnitWorkId,
U.UnitName,
C.ProfessionalName,
P.NoticeCode,
UnitWork.UnitWorkName,
DP.DivisionName AS Branch,
BP.BreakdownName AS ControlPointType,
BP.Class,
P.AcceptanceSite,
P.AcceptanceCheckMan,
(CASE WHEN IsOnceQualified='False' THEN '否' ELSE '是' END)AS IsOnceQualified,
P.InspectionCode,
P.InspectionDate"
+ @" FROM ProcessControl_InspectionManagement AS P "
+ @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId"
+ @" LEFT JOIN Base_CNProfessional C ON C.CNProfessionalId = P.CNProfessionalId"
+ @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId"
+ @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch"
+ @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType"
+ @" WHERE P.ProjectId=@ProjectId ";
StringBuilder sb = new StringBuilder();
sb.Append("SELECT P.InspectionId,P.ProjectId,P.UnitId,P.CNProfessionalId,P.UnitWorkId,U.UnitName,C.ProfessionalName,P.NoticeCode,UnitWork.UnitWorkName,DP.DivisionName AS Branch,BP.BreakdownName AS ControlPointType,BP.Class,P.AcceptanceSite,P.AcceptanceCheckMan,(CASE WHEN IsOnceQualified='False' THEN '否' ELSE '是' END)AS IsOnceQualified,P.InspectionCode,P.InspectionDate ");
sb.Append("FROM ProcessControl_InspectionManagement AS P ");
sb.Append("LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId ");
sb.Append("LEFT JOIN Base_CNProfessional C ON C.CNProfessionalId = P.CNProfessionalId ");
sb.Append("LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId ");
sb.Append("LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch ");
sb.Append("LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType ");
sb.Append("WHERE P.ProjectId=@ProjectId ");
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (drpUnit.SelectedValue != BLL.Const._Null)
{
strSql += " AND P.UnitId=@UnitId";
sb.Append("AND P.UnitId=@UnitId ");
listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
}
if (drpCNProfessional.SelectedValue != BLL.Const._Null)
{
strSql += " AND P.CNProfessionalId=@CNProfessionalId";
sb.Append("AND P.CNProfessionalId=@CNProfessionalId ");
listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue));
}
if (!string.IsNullOrEmpty(txtStarTime.Text))
{
strSql += " AND P.InspectionDate >= @startTime";
sb.Append("AND P.InspectionDate >= @startTime ");
listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text)));
}
if (!string.IsNullOrEmpty(txtEndTime.Text))
{
strSql += " AND P.InspectionDate <= @endTime";
sb.Append("AND P.InspectionDate <= @endTim ");
listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text)));
}
sb.Append("ORDER BY P.NoticeCode DESC ");
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
DataTable tb = SQLHelper.GetDataTableRunText(sb.ToString(), parameter);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
@@ -246,11 +232,38 @@ namespace FineUIPro.Web.CQMS.ProcessControl
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
var lists = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
join y in Funs.DB.ProcessControl_InspectionManagement
on x.InspectionId equals y.InspectionId
where y.ProjectId == this.CurrUser.LoginProjectId
select y);
//var lists = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
// join y in Funs.DB.ProcessControl_InspectionManagement
// on x.InspectionId equals y.InspectionId
// where y.ProjectId == this.CurrUser.LoginProjectId
// select y);
var db = Funs.DB;
var lists = (from x in db.ProcessControl_InspectionManagement
join bu in db.Base_Unit on x.UnitId equals bu.UnitId into buGroup
from bu in buGroup.DefaultIfEmpty()
join bcn in db.Base_CNProfessional on x.CNProfessionalId equals bcn.CNProfessionalId into bcnGroup
from bcn in bcnGroup.DefaultIfEmpty()
//join wbsuw in db.WBS_UnitWork on x.UnitWorkId equals wbsuw.UnitWorkId into wbsuwGroup
//from wbsuw in wbsuwGroup.DefaultIfEmpty()
//join wbsd in db.WBS_DivisionProject on x.Branch equals wbsd.DivisionProjectId into wbsdGroup
//from wbsd in wbsdGroup.DefaultIfEmpty()
//join wbsbp in db.WBS_BreakdownProject on x.ControlPointType equals wbsbp.BreakdownProjectId into wbsbpGroup
//from wbsbp in wbsbpGroup.DefaultIfEmpty()
where x.ProjectId == this.CurrUser.LoginProjectId
orderby x.NoticeCode descending
select new
{
UnitId = x.UnitId,
UnitName = bu.UnitName,
CNProfessionalId = x.CNProfessionalId,
ProfessionalName = bcn.ProfessionalName,
NoticeCode = x.NoticeCode,
AcceptanceSite = x.AcceptanceSite,
AcceptanceCheckMan = x.AcceptanceCheckMan,
InspectionDate = x.InspectionDate,
IsOnceQualified = x.IsOnceQualified,
InspectionCode = x.InspectionCode
});
if (drpUnit.SelectedValue != BLL.Const._Null)
{
lists = lists.Where(x => x.UnitId == drpUnit.SelectedValue);
@@ -307,22 +320,11 @@ namespace FineUIPro.Web.CQMS.ProcessControl
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
string unitName = string.Empty;
if (!string.IsNullOrEmpty(item.UnitId))
{
unitName = BLL.UnitService.GetUnitNameByUnitId(item.UnitId);
}
cell.SetCellValue(unitName);//施工分包商
cell.SetCellValue(item.UnitName);//施工分包商
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
string proName = string.Empty;
var cnp = BLL.CNProfessionalService.GetCNProfessional(item.CNProfessionalId);
if (cnp != null)
{
proName = cnp.ProfessionalName;
}
cell.SetCellValue(proName);//专业
cell.SetCellValue(item.ProfessionalName);//专业
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
@@ -343,7 +345,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
cell = row.CreateCell(5);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.IsOnceQualified == true ? "" : "");//是否一次合格
cell.SetCellValue(item.IsOnceQualified == false ? "" : "");//是否一次合格
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
@@ -1,6 +1,7 @@
using Aspose.Words;
using Aspose.Words.Tables;
using BLL;
using FineUIPro.Web.BaseInfo;
using System;
using System.Collections.Generic;
using System.Data;
@@ -9,6 +10,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
namespace FineUIPro.Web.CQMS.ProcessControl
{
@@ -47,113 +49,149 @@ namespace FineUIPro.Web.CQMS.ProcessControl
/// </summary>
public void BindGrid()
{
if (this.CurrUser.UserId==BLL.Const.hfnbdId)
{
DataTable tb = BindData();
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
//if (this.CurrUser.UserId == BLL.Const.hfnbdId)
//{
// string strSql = @"SELECT P.InspectionId,P.ProjectId,P.UnitId,
// P.CNProfessionalId,
// P.UnitWorkId,U.UnitName,
// C.DetectionItems as ProfessionalName,
// P.NoticeCode,UnitWork.UnitWorkName,
// DP.DivisionName AS Branch,
// BP.BreakdownName AS ControlPointType,
// BP.Class,P.AcceptanceSite, P.AcceptanceCheckMan"
// + @" FROM ProcessControl_InspectionManagement AS P"
// + @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId"
// + @" LEFT JOIN Control_PointCropping C ON C.ControlId = P.CNProfessionalId"
// + @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId"
// + @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch"
// + @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType"
// + @" WHERE P.ProjectId=@ProjectId ";
// List<SqlParameter> listStr = new List<SqlParameter>();
// listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
// if (drpUnit.SelectedValue != BLL.Const._Null)
// {
// strSql += " AND P.UnitId=@UnitId";
// listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
// }
// if (drpCNProfessional.SelectedValue != BLL.Const._Null)
// {
// strSql += " AND P.CNProfessionalId=@CNProfessionalId";
// listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue));
// }
// if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
// {
// strSql += " AND P.InspectionDate >= @startTime";
// listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
// }
// if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
// {
// strSql += " AND P.InspectionDate <= @endTime";
// listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
// }
// SqlParameter[] parameter = listStr.ToArray();
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// Grid1.RecordCount = tb.Rows.Count;
// //tb = GetFilteredTable(Grid1.FilteredData, tb);
// var table = this.GetPagedDataTable(Grid1, tb);
// Grid1.DataSource = table;
// Grid1.DataBind();
//}
//else
//{
// string strSql = @"SELECT P.InspectionId,P.ProjectId,P.UnitId,
// P.CNProfessionalId,
// P.UnitWorkId,U.UnitName,
// C.ProfessionalName as ProfessionalName,
// P.NoticeCode,UnitWork.UnitWorkName,
// DP.DivisionName AS Branch,
// BP.BreakdownName AS ControlPointType,
// BP.Class,P.AcceptanceSite,P.AcceptanceCheckMan"
// + @" FROM ProcessControl_InspectionManagement AS P"
// + @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId"
// + @" left join Base_CNProfessional c on c.CNProfessionalId = P.CNProfessionalId"
// + @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId"
// + @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch"
// + @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType"
// + @" WHERE P.ProjectId=@ProjectId ";
// List<SqlParameter> listStr = new List<SqlParameter>();
// listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
// if (drpUnit.SelectedValue != BLL.Const._Null)
// {
// strSql += " AND P.UnitId=@UnitId";
// listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
// }
// if (drpCNProfessional.SelectedValue != BLL.Const._Null)
// {
// strSql += " AND P.CNProfessionalId=@CNProfessionalId";
// listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue));
// }
// if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
// {
// strSql += " AND P.InspectionDate >= @startTime";
// listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
// }
// if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
// {
// strSql += " AND P.InspectionDate <= @endTime";
// listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
// }
// SqlParameter[] parameter = listStr.ToArray();
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
// Grid1.RecordCount = tb.Rows.Count;
// //tb = GetFilteredTable(Grid1.FilteredData, tb);
// var table = this.GetPagedDataTable(Grid1, tb);
// Grid1.DataSource = table;
// Grid1.DataBind();
//}
}
string strSql = @"SELECT P.InspectionId,
P.ProjectId,
P.UnitId,
P.CNProfessionalId,
P.UnitWorkId,
U.UnitName,
C.DetectionItems as ProfessionalName,
P.NoticeCode,
UnitWork.UnitWorkName,
DP.DivisionName AS Branch,
BP.BreakdownName AS ControlPointType,
BP.Class,
P.AcceptanceSite,
P.AcceptanceCheckMan"
+ @" FROM ProcessControl_InspectionManagement AS P"
+ @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId"
+ @" LEFT JOIN Control_PointCropping C ON C.ControlId = P.CNProfessionalId"
+ @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId"
+ @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch"
+ @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType"
+ @" WHERE P.ProjectId=@ProjectId ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (drpUnit.SelectedValue != BLL.Const._Null)
{
strSql += " AND P.UnitId=@UnitId";
listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
}
if (drpCNProfessional.SelectedValue != BLL.Const._Null)
{
strSql += " AND P.CNProfessionalId=@CNProfessionalId";
listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
strSql += " AND P.InspectionDate >= @startTime";
listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
strSql += " AND P.InspectionDate <= @endTime";
listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
}
else
/// <summary>
/// 查询数据
/// </summary>
/// <returns></returns>
public DataTable BindData()
{
StringBuilder sb = new StringBuilder();
sb.Append("SELECT P.InspectionId,P.ProjectId,P.UnitId,P.CNProfessionalId,P.UnitWorkId,U.UnitName,C.ProfessionalName as ProfessionalName,P.NoticeCode,UnitWork.UnitWorkName,DP.DivisionName AS Branch,BP.BreakdownName AS ControlPointType,BP.Class,P.AcceptanceSite,P.AcceptanceCheckMan ");
sb.Append("FROM ProcessControl_InspectionManagement AS P ");
sb.Append("LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId ");
sb.Append("LEFT JOIN Base_CNProfessional AS C on c.CNProfessionalId = P.CNProfessionalId ");
sb.Append("LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId ");
sb.Append("LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch ");
sb.Append("LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType ");
sb.Append("WHERE P.ProjectId=@ProjectId ");
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (drpUnit.SelectedValue != BLL.Const._Null)
{
string strSql = @"SELECT P.InspectionId,
P.ProjectId,
P.UnitId,
P.CNProfessionalId,
P.UnitWorkId,
U.UnitName,
C.ProfessionalName as ProfessionalName,
P.NoticeCode,
UnitWork.UnitWorkName,
DP.DivisionName AS Branch,
BP.BreakdownName AS ControlPointType,
BP.Class,
P.AcceptanceSite,
P.AcceptanceCheckMan"
+ @" FROM ProcessControl_InspectionManagement AS P"
+ @" LEFT JOIN Base_Unit AS U ON U.UnitId = P.UnitId"
+ @" left join Base_CNProfessional c on c.CNProfessionalId = P.CNProfessionalId"
+ @" LEFT JOIN WBS_UnitWork AS UnitWork ON UnitWork.UnitWorkId = P.UnitWorkId"
+ @" LEFT JOIN WBS_DivisionProject AS DP ON DP.DivisionProjectId = P.Branch"
+ @" LEFT JOIN WBS_BreakdownProject AS BP ON BP.BreakdownProjectId = P.ControlPointType"
+ @" WHERE P.ProjectId=@ProjectId ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
if (drpUnit.SelectedValue != BLL.Const._Null)
{
strSql += " AND P.UnitId=@UnitId";
listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
}
if (drpCNProfessional.SelectedValue != BLL.Const._Null)
{
strSql += " AND P.CNProfessionalId=@CNProfessionalId";
listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
strSql += " AND P.InspectionDate >= @startTime";
listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
strSql += " AND P.InspectionDate <= @endTime";
listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table;
Grid1.DataBind();
sb.Append("AND P.UnitId=@UnitId ");
listStr.Add(new SqlParameter("@UnitId", drpUnit.SelectedValue));
}
if (drpCNProfessional.SelectedValue != BLL.Const._Null)
{
sb.Append("AND P.CNProfessionalId=@CNProfessionalId ");
listStr.Add(new SqlParameter("@CNProfessionalId", drpCNProfessional.SelectedValue));
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
sb.Append("AND P.InspectionDate >= @startTime ");
listStr.Add(new SqlParameter("@startTime", Funs.GetNewDateTime(txtStarTime.Text.Trim())));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
sb.Append("AND P.InspectionDate <= @endTime ");
listStr.Add(new SqlParameter("@endTime", Funs.GetNewDateTime(txtEndTime.Text.Trim())));
}
sb.Append("ORDER BY P.NoticeCode DESC ");
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(sb.ToString(), parameter);
return tb;
}
#endregion
@@ -342,6 +380,142 @@ namespace FineUIPro.Web.CQMS.ProcessControl
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
var db = Funs.DB;
var lists = (from x in db.ProcessControl_InspectionManagement
join bu in db.Base_Unit on x.UnitId equals bu.UnitId into buGroup
from bu in buGroup.DefaultIfEmpty()
join bcn in db.Base_CNProfessional on x.CNProfessionalId equals bcn.CNProfessionalId into bcnGroup
from bcn in bcnGroup.DefaultIfEmpty()
//join wbsuw in db.WBS_UnitWork on x.UnitWorkId equals wbsuw.UnitWorkId into wbsuwGroup
//from wbsuw in wbsuwGroup.DefaultIfEmpty()
//join wbsd in db.WBS_DivisionProject on x.Branch equals wbsd.DivisionProjectId into wbsdGroup
//from wbsd in wbsdGroup.DefaultIfEmpty()
//join wbsbp in db.WBS_BreakdownProject on x.ControlPointType equals wbsbp.BreakdownProjectId into wbsbpGroup
//from wbsbp in wbsbpGroup.DefaultIfEmpty()
where x.ProjectId == this.CurrUser.LoginProjectId
orderby x.NoticeCode descending
select new
{
UnitId = x.UnitId,
UnitName = bu.UnitName,
CNProfessionalId = x.CNProfessionalId,
ProfessionalName = bcn.ProfessionalName,
NoticeCode = x.NoticeCode,
AcceptanceSite = x.AcceptanceSite,
AcceptanceCheckMan = x.AcceptanceCheckMan,
InspectionDate = x.InspectionDate
});
if (drpUnit.SelectedValue != BLL.Const._Null)
{
lists = lists.Where(x => x.UnitId == drpUnit.SelectedValue);
}
if (drpCNProfessional.SelectedValue != BLL.Const._Null)
{
lists = lists.Where(x => x.CNProfessionalId == drpCNProfessional.SelectedValue);
}
if (!string.IsNullOrEmpty(txtStarTime.Text.Trim()))
{
lists = lists.Where(x => x.InspectionDate >= Funs.GetNewDateTime(txtStarTime.Text.Trim()));
}
if (!string.IsNullOrEmpty(txtEndTime.Text.Trim()))
{
lists = lists.Where(x => x.InspectionDate <= Funs.GetNewDateTime(txtEndTime.Text.Trim()));
}
if (lists != null)
{
string projectName = BLL.ProjectService.GetShortNameByProjectId(this.CurrUser.LoginProjectId);
newUrl = uploadfilepath.Replace("共检通知单模板", "共检通知单(" + projectName + DateTime.Now.ToString("yyyyMMdd") + "");
if (File.Exists(newUrl))
{
File.Delete(newUrl);
}
File.Copy(uploadfilepath, newUrl);
// 第一步:读取文件流
NPOI.SS.UserModel.IWorkbook workbook;
using (FileStream stream = new FileStream(newUrl, FileMode.Open, FileAccess.Read))
{
//workbook = new NPOI.XSSF.UserModel.XSSFWorkbook(stream);
workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(stream);
}
// 创建单元格样式
NPOI.SS.UserModel.ICellStyle cellStyle = workbook.CreateCellStyle();
cellStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
cellStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
cellStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;
cellStyle.WrapText = true;//自动换行
var font = workbook.CreateFont();
font.FontHeightInPoints = 11;
cellStyle.SetFont(font);
// 第二步:创建新数据行
NPOI.SS.UserModel.ISheet sheet = workbook.GetSheetAt(0);
NPOI.SS.UserModel.IRow row = sheet.GetRow(0);
NPOI.SS.UserModel.ICell cell;
int i = 2;
foreach (var item in lists)
{
// 第二步:创建新数据行
row = sheet.CreateRow(i);
// 添加数据
cell = row.CreateCell(0);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.UnitName);//施工分包商
cell = row.CreateCell(1);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.ProfessionalName);//专业
cell = row.CreateCell(2);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.NoticeCode);//共检通知单编号
cell = row.CreateCell(3);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.AcceptanceSite);//验收部位
cell = row.CreateCell(4);
cell.CellStyle = cellStyle;
string userName = string.Empty;
if (!string.IsNullOrEmpty(item.AcceptanceCheckMan))
{
userName = ConvertCheckMan(item.AcceptanceCheckMan);
}
cell.SetCellValue(userName);//检查人
i++;
}
// 第三步:写入文件流
using (FileStream stream = new FileStream(newUrl, FileMode.Create, FileAccess.Write))
{
workbook.Write(stream);
workbook.Close();
}
string fileName = Path.GetFileName(newUrl);
FileInfo info = new FileInfo(newUrl);
long fileSize = info.Length;
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", fileSize.ToString());
Response.TransmitFile(newUrl, 0, fileSize);
Response.Flush();
Response.Close();
File.Delete(newUrl);
}
else
{
Alert.ShowInTop("当前无记录,无法导出!", MessageBoxIcon.Warning);
}
}
protected void btnOut_Click2(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/");
string initTemplatePath = Const.InspectionNoticesTempUrl;
string uploadfilepath = string.Empty;
string newUrl = string.Empty;
uploadfilepath = rootPath + initTemplatePath;
var lists = (from x in Funs.DB.ProcessControl_InspectionManagementDetail
join y in Funs.DB.ProcessControl_InspectionManagement
on x.InspectionId equals y.InspectionId
@@ -1082,7 +1256,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
newInspection.UnqualifiedReason = inspection.UnqualifiedReason;
//通知单编号后有字母递增,无则加“a”
string fisrtE = inspection.NoticeCode.Substring(0,inspection.NoticeCode.Length - 1);
string fisrtE = inspection.NoticeCode.Substring(0, inspection.NoticeCode.Length - 1);
string lastE = inspection.NoticeCode.Substring(inspection.NoticeCode.Length - 1, 1);
bool b = Regex.IsMatch(lastE, "[a-zA-Z]");
if (b)
@@ -1093,7 +1267,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
else
{
newInspection.NoticeCode = inspection.NoticeCode + "a";
}
}
newInspection.AcceptanceCheckMan = inspection.AcceptanceCheckMan;
newInspection.ParentDivisionProjectId = inspection.ParentDivisionProjectId;
@@ -72,8 +72,8 @@
<f:RenderField ColumnID="TotalRate" DataField="TotalRate" FieldType="String" HeaderText="累计一次合格率(%" TextAlign="Center"
HeaderTextAlign="Center" Width="160px">
</f:RenderField>
<f:RenderField ColumnID="CreateDate" DataField="CreateDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd" HeaderText="创建日期" TextAlign="Center"
HeaderTextAlign="Center" Width="120px">
<f:RenderField ColumnID="CreateDate" DataField="CreateDate" FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd HH:mm:ss" HeaderText="创建日期" TextAlign="Center"
HeaderTextAlign="Center" Width="160px">
</f:RenderField>
<f:TemplateField ColumnID="AttachFile" Width="150px" HeaderText="附件" HeaderTextAlign="Center" TextAlign="Left" >
<ItemTemplate>
@@ -321,7 +321,7 @@ namespace FineUIPro.Web.CQMS.ProcessControl
cell = row.CreateCell(6);
cell.CellStyle = cellStyle;
cell.SetCellValue(item.CreateDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.CreateDate) : "");//创建日期
cell.SetCellValue(item.CreateDate.HasValue ? string.Format("{0:yyyy-MM-dd HH:mm:ss}", item.CreateDate) : "");//创建日期
i++;
}