219 lines
8.8 KiB
C#
219 lines
8.8 KiB
C#
|
using Aspose.Words;
|
|||
|
using BLL;
|
|||
|
using Org.BouncyCastle.Asn1.Ocsp;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Data;
|
|||
|
using System.Data.SqlClient;
|
|||
|
using System.IO;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
|
|||
|
namespace FineUIPro.Web.DataShow
|
|||
|
{
|
|||
|
public partial class InspectionManagementItem : PageBase
|
|||
|
{
|
|||
|
#region 加载页面
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
string projectId = Request.Params["projectId"];
|
|||
|
this.txtProject.Text = ProjectService.GetProjectNameByProjectId(projectId);
|
|||
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|||
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|||
|
// 绑定表格t
|
|||
|
BindGrid();
|
|||
|
this.Panel1.Title = "质量共检数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 绑定数据
|
|||
|
/// </summary>
|
|||
|
private void BindGrid()
|
|||
|
{
|
|||
|
string strSql = @"SELECT distinct 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='True' THEN '是' ELSE '否' END)AS IsOnceQualified,
|
|||
|
P.InspectionCode,
|
|||
|
P.InspectionDate"
|
|||
|
+ @" FROM ProcessControl_InspectionManagementDetail AS D"
|
|||
|
+ @" LEFT JOIN ProcessControl_InspectionManagement AS P on P.InspectionId=D.InspectionId"
|
|||
|
+ @" 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", Request.Params["projectId"]));
|
|||
|
|
|||
|
strSql += " AND (P.InspectionDate>=@startTime or @startTime='') and (P.InspectionDate<=@endTime or @endTime='') ";
|
|||
|
listStr.Add(new SqlParameter("@startTime", !string.IsNullOrEmpty(txtStartTime.Text.Trim()) ? txtStartTime.Text.Trim() + " 00:00:00" : ""));
|
|||
|
listStr.Add(new SqlParameter("@endTime", !string.IsNullOrEmpty(txtEndTime.Text.Trim()) ? txtEndTime.Text.Trim() + " 23:59:59" : ""));
|
|||
|
SqlParameter[] parameter = listStr.ToArray();
|
|||
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|||
|
Grid1.RecordCount = tb.Rows.Count;
|
|||
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|||
|
Grid1.DataSource = table;
|
|||
|
Grid1.DataBind();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 查询
|
|||
|
/// <summary>
|
|||
|
/// 查询
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 表排序、分页、关闭窗口
|
|||
|
/// <summary>
|
|||
|
/// 分页
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 排序
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|||
|
{
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 分页显示条数下拉框
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
#endregion
|
|||
|
protected string ConvertImageUrlByImage(object registrationId)
|
|||
|
{
|
|||
|
string url = string.Empty;
|
|||
|
string httpUrl = string.Empty;
|
|||
|
var sysSet6 = (from x in Funs.DB.Sys_Set where x.SetName == "程序访问地址" select x).ToList().FirstOrDefault();
|
|||
|
if (sysSet6 != null)
|
|||
|
{
|
|||
|
httpUrl = sysSet6.SetValue;
|
|||
|
}
|
|||
|
if (registrationId != null)
|
|||
|
{
|
|||
|
IList<Model.AttachFile> sourlist = AttachFileService.GetBeforeFileList(registrationId.ToString(), BLL.Const.CheckListMenuId);
|
|||
|
|
|||
|
if (sourlist != null && sourlist.Count > 0)
|
|||
|
{
|
|||
|
string AttachUrl = "";
|
|||
|
foreach (var item in sourlist)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|||
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|||
|
}
|
|||
|
url = BLL.UploadAttachmentService.ShowImage("../", AttachUrl.TrimEnd(','));
|
|||
|
}
|
|||
|
}
|
|||
|
return url;
|
|||
|
}
|
|||
|
protected string ConvertImgUrlByImage(object registrationId)
|
|||
|
{
|
|||
|
string url = string.Empty;
|
|||
|
string httpUrl = string.Empty;
|
|||
|
var sysSet6 = (from x in Funs.DB.Sys_Set where x.SetName == "程序访问地址" select x).ToList().FirstOrDefault();
|
|||
|
if (sysSet6 != null)
|
|||
|
{
|
|||
|
httpUrl = sysSet6.SetValue;
|
|||
|
}
|
|||
|
if (registrationId != null)
|
|||
|
{
|
|||
|
IList<Model.AttachFile> sourlist = AttachFileService.Getfilelist(registrationId.ToString() + "r", BLL.Const.CheckListMenuId);
|
|||
|
|
|||
|
if (sourlist != null && sourlist.Count > 0)
|
|||
|
{
|
|||
|
string AttachUrl = "";
|
|||
|
foreach (var item in sourlist)
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(item.AttachUrl) && item.AttachUrl.ToLower().EndsWith(".jpg") || item.AttachUrl.ToLower().EndsWith(".jpeg") || item.AttachUrl.ToLower().EndsWith(".png"))
|
|||
|
AttachUrl += item.AttachUrl.TrimEnd(',') + ",";
|
|||
|
}
|
|||
|
url = BLL.UploadAttachmentService.ShowImage("../", AttachUrl.TrimEnd(','));
|
|||
|
}
|
|||
|
}
|
|||
|
return url;
|
|||
|
}
|
|||
|
|
|||
|
public string Convertstatus(Object code)
|
|||
|
{
|
|||
|
Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(code.ToString());
|
|||
|
if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|||
|
{
|
|||
|
return "未确认";
|
|||
|
}
|
|||
|
else if (checkControl.State == Const.CheckControl_Complete)
|
|||
|
{ //闭环
|
|||
|
return "已闭环";
|
|||
|
}
|
|||
|
//else if( checkControl.LimitDate> )
|
|||
|
else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
|||
|
{
|
|||
|
return "超期未整改";
|
|||
|
|
|||
|
}
|
|||
|
else //期内未整改
|
|||
|
{
|
|||
|
return "未整改";
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取检查人名称
|
|||
|
/// </summary>
|
|||
|
/// <param name="CarryUnitIds"></param>
|
|||
|
/// <returns></returns>
|
|||
|
protected string ConvertCheckMan(object CarryUnitIds)
|
|||
|
{
|
|||
|
var uname = BLL.UserService.getUserNamesUserIds(CarryUnitIds);
|
|||
|
if (string.IsNullOrEmpty(uname))
|
|||
|
{
|
|||
|
uname = CarryUnitIds.ToString();
|
|||
|
}
|
|||
|
return uname;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|