专项检查
This commit is contained in:
@@ -3,11 +3,13 @@ using BLL;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AspNet = System.Web.UI.WebControls;
|
||||
@@ -129,65 +131,100 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
protected DataTable ChecklistData()
|
||||
{
|
||||
string strSql = @"SELECT chec.CheckControlCode,chec.CheckSite,chec.ProjectId,chec.unitId,cNProfessional.ProfessionalName,"
|
||||
+ @" QualityQuestionType.QualityQuestionType as QuestionType,"
|
||||
+ @" chec.checkman,chec.CheckDate,chec.DocCode,chec.submitman,chec.state,chec.CNProfessionalCode,"
|
||||
+ @" unit.UnitName,unitWork.UnitWorkName,u.userName "
|
||||
+ @" FROM Check_CheckControl chec"
|
||||
+ @" left join Base_Unit unit on unit.unitId=chec.unitId"
|
||||
+ @" left join Base_CNProfessional cNProfessional on cNProfessional.CNProfessionalId=chec.CNProfessionalCode"
|
||||
+ @" left join WBS_UnitWork unitWork on unitWork.UnitWorkId = chec.UnitWorkId"
|
||||
+ @" left join Base_QualityQuestionType QualityQuestionType on QualityQuestionType.QualityQuestionTypeId = chec.QuestionType"
|
||||
+ @" left join sys_User u on u.userId = chec.CheckMan"
|
||||
+ @" where chec.ProjectId=@ProjectId";
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
strSql += " AND (chec.CheckDate>=@startTime or @startTime='') and (chec.CheckDate<=@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" : ""));
|
||||
if (drpSponsorUnit.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND chec.unitId=@unitId";
|
||||
listStr.Add(new SqlParameter("@unitId", drpSponsorUnit.SelectedValue));
|
||||
}
|
||||
if (drpUnitWork.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND chec.unitworkId=@unitworkId";
|
||||
listStr.Add(new SqlParameter("@unitworkId", drpUnitWork.SelectedValue));
|
||||
}
|
||||
if (drpCNProfessional.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND chec.CNProfessionalCode=@CNProfessionalCode";
|
||||
listStr.Add(new SqlParameter("@CNProfessionalCode", drpCNProfessional.SelectedValue));
|
||||
}
|
||||
if (drpQuestionType.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND chec.QuestionType=@QuestionType";
|
||||
listStr.Add(new SqlParameter("@QuestionType", drpQuestionType.SelectedValue));
|
||||
}
|
||||
if (dpHandelStatus.SelectedValue != Const._Null)
|
||||
{
|
||||
if (dpHandelStatus.SelectedValue.Equals("1"))
|
||||
{
|
||||
strSql += " AND (chec.state='5' or chec.state='6')";
|
||||
}
|
||||
else if (dpHandelStatus.SelectedValue.Equals("2"))
|
||||
{
|
||||
strSql += " AND chec.state='7'";
|
||||
}
|
||||
else if (dpHandelStatus.SelectedValue.Equals("3"))
|
||||
{
|
||||
strSql += " AND DATEADD(day,1,chec.LimitDate)< GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
||||
}
|
||||
else if (dpHandelStatus.SelectedValue.Equals("4"))
|
||||
{
|
||||
strSql += " AND DATEADD(day,1,chec.LimitDate)> GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
||||
}
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
return tb;
|
||||
//string strSql = @"SELECT chec.CheckControlCode,chec.CheckSite,chec.ProjectId,chec.unitId,cNProfessional.ProfessionalName,"
|
||||
// + @" QualityQuestionType.QualityQuestionType as QuestionType,"
|
||||
// + @" chec.checkman,chec.CheckDate,chec.DocCode,chec.submitman,chec.state,chec.CNProfessionalCode,"
|
||||
// + @" unit.UnitName,unitWork.UnitWorkName,u.userName "
|
||||
// + @" FROM Check_CheckControl chec"
|
||||
// + @" left join Base_Unit unit on unit.unitId=chec.unitId"
|
||||
// + @" left join Base_CNProfessional cNProfessional on cNProfessional.CNProfessionalId=chec.CNProfessionalCode"
|
||||
// + @" left join WBS_UnitWork unitWork on unitWork.UnitWorkId = chec.UnitWorkId"
|
||||
// + @" left join Base_QualityQuestionType QualityQuestionType on QualityQuestionType.QualityQuestionTypeId = chec.QuestionType"
|
||||
// + @" left join sys_User u on u.userId = chec.CheckMan"
|
||||
// + @" where chec.ProjectId=@ProjectId";
|
||||
|
||||
//List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
//listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
//strSql += " AND (chec.CheckDate>=@startTime or @startTime='') and (chec.CheckDate<=@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" : ""));
|
||||
//if (drpSponsorUnit.SelectedValue != BLL.Const._Null)
|
||||
//{
|
||||
// strSql += " AND chec.unitId=@unitId";
|
||||
// listStr.Add(new SqlParameter("@unitId", drpSponsorUnit.SelectedValue));
|
||||
//}
|
||||
//if (drpUnitWork.SelectedValue != Const._Null)
|
||||
//{
|
||||
// strSql += " AND chec.unitworkId=@unitworkId";
|
||||
// listStr.Add(new SqlParameter("@unitworkId", drpUnitWork.SelectedValue));
|
||||
//}
|
||||
//if (drpCNProfessional.SelectedValue != Const._Null)
|
||||
//{
|
||||
// strSql += " AND chec.CNProfessionalCode=@CNProfessionalCode";
|
||||
// listStr.Add(new SqlParameter("@CNProfessionalCode", drpCNProfessional.SelectedValue));
|
||||
//}
|
||||
//if (drpQuestionType.SelectedValue != Const._Null)
|
||||
//{
|
||||
// strSql += " AND chec.QuestionType=@QuestionType";
|
||||
// listStr.Add(new SqlParameter("@QuestionType", drpQuestionType.SelectedValue));
|
||||
//}
|
||||
//if (dpHandelStatus.SelectedValue != Const._Null)
|
||||
//{
|
||||
// if (dpHandelStatus.SelectedValue.Equals("1"))
|
||||
// {
|
||||
// strSql += " AND (chec.state='5' or chec.state='6')";
|
||||
// }
|
||||
// else if (dpHandelStatus.SelectedValue.Equals("2"))
|
||||
// {
|
||||
// strSql += " AND chec.state='7'";
|
||||
// }
|
||||
// else if (dpHandelStatus.SelectedValue.Equals("3"))
|
||||
// {
|
||||
// strSql += " AND DATEADD(day,1,chec.LimitDate)< GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
||||
// }
|
||||
// else if (dpHandelStatus.SelectedValue.Equals("4"))
|
||||
// {
|
||||
// strSql += " AND DATEADD(day,1,chec.LimitDate)> GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
||||
// }
|
||||
//}
|
||||
|
||||
//SqlParameter[] parameter = listStr.ToArray();
|
||||
//DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
var query = (from x in Funs.DB.Check_CheckControl
|
||||
select new
|
||||
{
|
||||
CheckControlCode = x.CheckControlCode,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectName = Funs.DB.Base_Project.FirstOrDefault(p => p.ProjectId == x.ProjectId).ProjectName,
|
||||
DocCode = x.DocCode,
|
||||
States = x.State,
|
||||
CheckSite = x.CheckSite,
|
||||
QuestionDef = x.QuestionDef,
|
||||
CheckDate = String.Format("{0:yyyy-MM-dd}", x.CheckDate),
|
||||
LimitDate = String.Format("{0:yyyy-MM-dd}", x.LimitDate),
|
||||
RectifyOpinion = x.RectifyOpinion,
|
||||
CheckMan = x.CheckMan,
|
||||
UnitWorkId = x.UnitWorkId,
|
||||
AttachUrl = x.AttachUrl,
|
||||
HandleWay = x.HandleWay,
|
||||
RectifyDate = String.Format("{0:yyyy-MM-dd}", x.RectifyDate),
|
||||
ReAttachUrl = x.ReAttachUrl,
|
||||
IsOk = x.IsOK,
|
||||
OKDescr = x.OKDescr,
|
||||
UnitWorkName = (from y in Funs.DB.WBS_UnitWork where y.UnitWorkId == x.UnitWorkId select y.UnitWorkName).First(),
|
||||
CheckManName = (from y in Funs.DB.Sys_User where y.UserId == x.CheckMan select y.UserName).First(),
|
||||
PrincipalMan = x.DutyMan,
|
||||
PrincipalManName = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == x.DutyMan).UserName,
|
||||
CNProfessionalCode = x.CNProfessionalCode,
|
||||
CNProfessionalCodeName = Funs.DB.Base_CNProfessional.FirstOrDefault(e => e.CNProfessionalId == x.CNProfessionalCode).ProfessionalName,
|
||||
QuestionType = x.QuestionType,
|
||||
QuestionTypeName = Funs.DB.Base_QualityQuestionType.FirstOrDefault(e => e.QualityQuestionTypeId == x.QuestionType).QualityQuestionType,
|
||||
|
||||
}).ToList();
|
||||
DataTable td = ToDataTable(query);
|
||||
return td;
|
||||
}
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -272,42 +309,26 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
#region 检查照片
|
||||
protected string ConvertImageUrlByImage(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
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(ConfigurationManager.AppSettings["CEMS_IMG_URL"], AttachUrl.TrimEnd(','));
|
||||
}
|
||||
Model.Check_CheckControl m = Funs.DB.Check_CheckControl.FirstOrDefault(e => e.CheckControlCode == registrationId.ToString());
|
||||
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["CEMS_IMG_URL"], m.AttachUrl.TrimEnd(','));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
#endregion
|
||||
protected string ConvertImgUrlByImage(object registrationId)
|
||||
{
|
||||
string url = string.Empty;
|
||||
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(ConfigurationManager.AppSettings["CEMS_IMG_URL"], AttachUrl.TrimEnd(','));
|
||||
}
|
||||
Model.Check_CheckControl m = Funs.DB.Check_CheckControl.FirstOrDefault(e => e.CheckControlCode == registrationId.ToString());
|
||||
url = BLL.UploadAttachmentService.ShowImage(ConfigurationManager.AppSettings["CEMS_IMG_URL"], m.ReAttachUrl.TrimEnd(','));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
@@ -315,25 +336,25 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
public string Convertstatus(Object code)
|
||||
{
|
||||
Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(code.ToString());
|
||||
if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
||||
if (checkControl.State.Equals("1") )
|
||||
{
|
||||
return "未确认";
|
||||
return "待整改";
|
||||
}
|
||||
else if (checkControl.State == Const.CheckControl_Complete)
|
||||
else if (checkControl.State.Equals("2"))
|
||||
{ //闭环
|
||||
return "已闭环";
|
||||
return "待确认";
|
||||
}
|
||||
//else if( checkControl.LimitDate> )
|
||||
else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
||||
else if (checkControl.State.Equals("3")) //延期未整改
|
||||
{
|
||||
return "超期未整改";
|
||||
return "已闭环";
|
||||
|
||||
}
|
||||
else //期内未整改
|
||||
else
|
||||
{
|
||||
return "未整改";
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -355,31 +376,31 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
|
||||
for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
{
|
||||
string rowID = Grid1.Rows[i].DataKeys[0].ToString();
|
||||
if (rowID.Count() > 0)
|
||||
{
|
||||
Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(rowID);
|
||||
if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
||||
{
|
||||
Grid1.Rows[i].CellCssClasses[11] = "LightGreen";//未确认
|
||||
}
|
||||
else if (checkControl.State == Const.CheckControl_Complete)
|
||||
{ //闭环
|
||||
Grid1.Rows[i].CellCssClasses[11] = "Green";
|
||||
//for (int i = 0; i < Grid1.Rows.Count; i++)
|
||||
//{
|
||||
// string rowID = Grid1.Rows[i].DataKeys[0].ToString();
|
||||
// if (rowID.Count() > 0)
|
||||
// {
|
||||
// Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(rowID);
|
||||
// if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
||||
// {
|
||||
// Grid1.Rows[i].CellCssClasses[11] = "LightGreen";//未确认
|
||||
// }
|
||||
// else if (checkControl.State == Const.CheckControl_Complete)
|
||||
// { //闭环
|
||||
// Grid1.Rows[i].CellCssClasses[11] = "Green";
|
||||
|
||||
}
|
||||
else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
||||
{
|
||||
Grid1.Rows[i].CellCssClasses[11] = "Red";
|
||||
}
|
||||
else //期内未整改
|
||||
{
|
||||
Grid1.Rows[i].CellCssClasses[11] = " Yellow ";
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
||||
// {
|
||||
// Grid1.Rows[i].CellCssClasses[11] = "Red";
|
||||
// }
|
||||
// else //期内未整改
|
||||
// {
|
||||
// Grid1.Rows[i].CellCssClasses[11] = " Yellow ";
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -507,16 +528,16 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
}
|
||||
|
||||
}
|
||||
if (this.btnMenuModify.Hidden || checks.State == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
||||
return;
|
||||
}
|
||||
//if (this.btnMenuModify.Hidden || checks.State == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", codes, "查看 - ")));
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListEdit.aspx?CheckControlCode={0}", codes, "编辑 - ")));
|
||||
// return;
|
||||
//}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -574,15 +595,12 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.CheckListMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
//if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
//{
|
||||
// this.btnNew.Hidden = false;
|
||||
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.btnMenuModify.Hidden = false;
|
||||
}
|
||||
//}
|
||||
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnMenuDel.Hidden = false;
|
||||
@@ -1498,5 +1516,29 @@ namespace FineUIPro.Web.CQMS.Check
|
||||
txtEndTime.Text = "";
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#region Linq获取列表转换焊材DateTable类型
|
||||
public DataTable ToDataTable<T>(IEnumerable<T> data)
|
||||
{
|
||||
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T));
|
||||
DataTable table = new DataTable();
|
||||
foreach (PropertyDescriptor prop in properties)
|
||||
{
|
||||
table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType);
|
||||
}
|
||||
|
||||
foreach (T item in data)
|
||||
{
|
||||
DataRow row = table.NewRow();
|
||||
foreach (PropertyDescriptor prop in properties)
|
||||
{
|
||||
row[prop.Name] = prop.GetValue(item) ?? DBNull.Value;
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user