This commit is contained in:
2023-11-13 17:47:53 +08:00
4 changed files with 193 additions and 100 deletions
@@ -1,4 +1,7 @@
using System; using FineUIPro;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -9,6 +12,91 @@ namespace BLL
/// </summary> /// </summary>
public static class Check_CheckSpecialService public static class Check_CheckSpecialService
{ {
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.Check_CheckSpecial> getDataLists = from x in db.Check_CheckSpecial
select x;
/// <summary>
/// 列表
/// </summary>
/// <param name="projectId"></param>
/// <param name="states"></param>
/// <param name="checkType"></param>
/// <param name="checkItemSetId"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string states, string checkType, string checkItemSetId, DateTime? startTime, DateTime? endTime, Grid Grid1)
{
IQueryable<Model.Check_CheckSpecial> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (states != "-1")
{
getDataList = getDataList.Where(e => e.States == states);
}
if (checkType != "-1")
{
if (checkType == "1")
{
getDataList = getDataList.Where(e => e.CheckType == checkType);
}
else
{
getDataList = getDataList.Where(e => e.CheckType == checkType || e.CheckType == null );
}
}
if (!string.IsNullOrEmpty(checkItemSetId) && checkItemSetId != Const._Null)
{
getDataList = getDataList.Where(e => e.CheckItemSetId == checkItemSetId);
}
if (startTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime >= startTime);
}
if (endTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime <= endTime);
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.CheckSpecialId,
x.CheckTime,
x.CheckSpecialCode,
CheckItemName =db.Technique_CheckItemSet .First(y=>y.CheckItemSetId ==x. CheckItemSetId).CheckItemName,
CheckTypeName = x.CheckType == "1" ? "联合检查" : "专项检查",
StatesName = x.States == "2" ? "已完成" : (x.States == "1" ? "待整改" : "待提交"),
};
}
#endregion
/// <summary> /// <summary>
/// 根据专项检查ID获取专项检查信息 /// 根据专项检查ID获取专项检查信息
/// </summary> /// </summary>
@@ -57,57 +57,62 @@ namespace FineUIPro.Web.HSSE.Check
/// </summary> /// </summary>
private void BindGrid() private void BindGrid()
{ {
string strSql = @"SELECT CheckSpecial.CheckSpecialId,CodeRecords.Code AS CheckSpecialCode," //string strSql = @"SELECT CheckSpecial.CheckSpecialId,CodeRecords.Code AS CheckSpecialCode,"
+ @" CheckItemSet.CheckItemName,CheckSpecial.CheckTime,(CASE WHEN CheckSpecial.CheckType ='1' THEN '联合检查' ELSE '专项检查' END) AS CheckTypeName" // + @" CheckItemSet.CheckItemName,CheckSpecial.CheckTime,(CASE WHEN CheckSpecial.CheckType ='1' THEN '联合检查' ELSE '专项检查' END) AS CheckTypeName"
+ @" ,(CASE WHEN CheckSpecial.States='2' THEN '已完成' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName" // + @" ,(CASE WHEN CheckSpecial.States='2' THEN '已完成' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName"
+ @" FROM Check_CheckSpecial AS CheckSpecial " // + @" FROM Check_CheckSpecial AS CheckSpecial "
+ @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckSpecial.CheckSpecialId=CodeRecords.DataId " // + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckSpecial.CheckSpecialId=CodeRecords.DataId "
+ @" LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId = CheckSpecial.CheckItemSetId where 1=1"; // + @" LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId = CheckSpecial.CheckItemSetId where 1=1";
List<SqlParameter> listStr = new List<SqlParameter>(); //List<SqlParameter> listStr = new List<SqlParameter>();
strSql += " AND CheckSpecial.ProjectId = @ProjectId"; //strSql += " AND CheckSpecial.ProjectId = @ProjectId";
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); //listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
if (this.rbStates.SelectedValue != "-1") //if (this.rbStates.SelectedValue != "-1")
{ //{
strSql += " AND CheckSpecial.States = @States"; // strSql += " AND CheckSpecial.States = @States";
listStr.Add(new SqlParameter("@States", this.rbStates.SelectedValue)); // listStr.Add(new SqlParameter("@States", this.rbStates.SelectedValue));
} //}
if (this.rbType.SelectedValue != "-1") //if (this.rbType.SelectedValue != "-1")
{ //{
if (this.rbType.SelectedValue == "1") // if (this.rbType.SelectedValue == "1")
{ // {
strSql += " AND CheckSpecial.CheckType = @CheckType"; // strSql += " AND CheckSpecial.CheckType = @CheckType";
listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue)); // listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue));
} // }
else // else
{ // {
strSql += " AND (CheckSpecial.CheckType = @CheckType OR CheckSpecial.CheckType IS NULL) "; // strSql += " AND (CheckSpecial.CheckType = @CheckType OR CheckSpecial.CheckType IS NULL) ";
listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue)); // listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue));
} // }
} //}
if (this.drpSupCheckItemSet.SelectedValue != BLL.Const._Null) //if (this.drpSupCheckItemSet.SelectedValue != BLL.Const._Null)
{ //{
strSql += " AND CheckSpecial.CheckItemSetId = @CheckItemSetId"; // strSql += " AND CheckSpecial.CheckItemSetId = @CheckItemSetId";
listStr.Add(new SqlParameter("@CheckItemSetId", this.drpSupCheckItemSet.SelectedValue)); // listStr.Add(new SqlParameter("@CheckItemSetId", this.drpSupCheckItemSet.SelectedValue));
} //}
if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim())) //if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
{ //{
strSql += " AND CheckSpecial.CheckTime >= @StartTime"; // strSql += " AND CheckSpecial.CheckTime >= @StartTime";
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim())); // listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text.Trim()));
} //}
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim())) //if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
{ //{
strSql += " AND CheckSpecial.CheckTime <= @EndTime"; // strSql += " AND CheckSpecial.CheckTime <= @EndTime";
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim())); // listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text.Trim()));
} //}
SqlParameter[] parameter = listStr.ToArray(); //SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); //DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
//Grid1.RecordCount = tb.Rows.Count;
//var table = this.GetPagedDataTable(Grid1, tb);
//Grid1.DataSource = table;
//Grid1.DataBind();
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table; var getData = Check_CheckSpecialService.getListData(this.ProjectId, this.rbStates.SelectedValue, this.rbType.SelectedValue, this.drpSupCheckItemSet.SelectedValue,
Funs.GetNewDateTime(txtStartTime.Text.Trim()), Funs.GetNewDateTime(this.txtEndTime.Text.Trim()), Grid1);
Grid1.RecordCount = Check_CheckSpecialService.count;
Grid1.DataSource = getData;
Grid1.DataBind(); Grid1.DataBind();
} }
#endregion #endregion
+51 -51
View File
@@ -39527,10 +39527,10 @@ namespace Model
private string _SaveHandleMan; private string _SaveHandleMan;
private string _WorkPackageName;
private string _WorkPackageId; private string _WorkPackageId;
private string _WorkPackageName;
private EntityRef<Base_Project> _Base_Project; private EntityRef<Base_Project> _Base_Project;
private EntityRef<Person_Persons> _Person_Persons; private EntityRef<Person_Persons> _Person_Persons;
@@ -39587,10 +39587,10 @@ namespace Model
partial void OnProposeUnitIdChanged(); partial void OnProposeUnitIdChanged();
partial void OnSaveHandleManChanging(string value); partial void OnSaveHandleManChanging(string value);
partial void OnSaveHandleManChanged(); partial void OnSaveHandleManChanged();
partial void OnWorkPackageNameChanging(string value);
partial void OnWorkPackageNameChanged();
partial void OnWorkPackageIdChanging(string value); partial void OnWorkPackageIdChanging(string value);
partial void OnWorkPackageIdChanged(); partial void OnWorkPackageIdChanged();
partial void OnWorkPackageNameChanging(string value);
partial void OnWorkPackageNameChanged();
#endregion #endregion
public Check_CheckControl() public Check_CheckControl()
@@ -40069,26 +40069,6 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageName", DbType="NVarChar(2000)")]
public string WorkPackageName
{
get
{
return this._WorkPackageName;
}
set
{
if ((this._WorkPackageName != value))
{
this.OnWorkPackageNameChanging(value);
this.SendPropertyChanging();
this._WorkPackageName = value;
this.SendPropertyChanged("WorkPackageName");
this.OnWorkPackageNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageId", DbType="NVarChar(2000)")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageId", DbType="NVarChar(2000)")]
public string WorkPackageId public string WorkPackageId
{ {
@@ -40109,6 +40089,26 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageName", DbType="NVarChar(2000)")]
public string WorkPackageName
{
get
{
return this._WorkPackageName;
}
set
{
if ((this._WorkPackageName != value))
{
this.OnWorkPackageNameChanging(value);
this.SendPropertyChanging();
this._WorkPackageName = value;
this.SendPropertyChanged("WorkPackageName");
this.OnWorkPackageNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckControl_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Check_CheckControl_Base_Project", Storage="_Base_Project", ThisKey="ProjectId", OtherKey="ProjectId", IsForeignKey=true)]
public Base_Project Base_Project public Base_Project Base_Project
{ {
@@ -100759,10 +100759,10 @@ namespace Model
private string _HazardValue; private string _HazardValue;
private string _WorkPackageName;
private string _WorkPackageId; private string _WorkPackageId;
private string _WorkPackageName;
private EntityRef<Base_Unit> _Base_Unit; private EntityRef<Base_Unit> _Base_Unit;
private EntityRef<HSSE_Hazard_HazardRegisterTypes> _HSSE_Hazard_HazardRegisterTypes; private EntityRef<HSSE_Hazard_HazardRegisterTypes> _HSSE_Hazard_HazardRegisterTypes;
@@ -100863,10 +100863,10 @@ namespace Model
partial void OnRegisterTypes4IdChanged(); partial void OnRegisterTypes4IdChanged();
partial void OnHazardValueChanging(string value); partial void OnHazardValueChanging(string value);
partial void OnHazardValueChanged(); partial void OnHazardValueChanged();
partial void OnWorkPackageNameChanging(string value);
partial void OnWorkPackageNameChanged();
partial void OnWorkPackageIdChanging(string value); partial void OnWorkPackageIdChanging(string value);
partial void OnWorkPackageIdChanged(); partial void OnWorkPackageIdChanged();
partial void OnWorkPackageNameChanging(string value);
partial void OnWorkPackageNameChanged();
#endregion #endregion
public HSSE_Hazard_HazardRegister() public HSSE_Hazard_HazardRegister()
@@ -101804,26 +101804,6 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageName", DbType="NVarChar(2000)")]
public string WorkPackageName
{
get
{
return this._WorkPackageName;
}
set
{
if ((this._WorkPackageName != value))
{
this.OnWorkPackageNameChanging(value);
this.SendPropertyChanging();
this._WorkPackageName = value;
this.SendPropertyChanged("WorkPackageName");
this.OnWorkPackageNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageId", DbType="NVarChar(2000)")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageId", DbType="NVarChar(2000)")]
public string WorkPackageId public string WorkPackageId
{ {
@@ -101844,6 +101824,26 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPackageName", DbType="NVarChar(2000)")]
public string WorkPackageName
{
get
{
return this._WorkPackageName;
}
set
{
if ((this._WorkPackageName != value))
{
this.OnWorkPackageNameChanging(value);
this.SendPropertyChanging();
this._WorkPackageName = value;
this.SendPropertyChanged("WorkPackageName");
this.OnWorkPackageNameChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HSSE_Hazard_HazardRegister_Base_Unit", Storage="_Base_Unit", ThisKey="ResponsibleUnit", OtherKey="UnitId", IsForeignKey=true)] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_HSSE_Hazard_HazardRegister_Base_Unit", Storage="_Base_Unit", ThisKey="ResponsibleUnit", OtherKey="UnitId", IsForeignKey=true)]
public Base_Unit Base_Unit public Base_Unit Base_Unit
{ {
@@ -182212,7 +182212,7 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(255)")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectDescription", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string ProjectDescription public string ProjectDescription
{ {
get get
@@ -182332,7 +182332,7 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(255)")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CalculationRule", DbType="VarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string CalculationRule public string CalculationRule
{ {
get get
@@ -182392,7 +182392,7 @@ namespace Model
} }
} }
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(50)")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ConstructionSubcontractor", DbType="VarChar(100)")]
public string ConstructionSubcontractor public string ConstructionSubcontractor
{ {
get get
+1 -1
View File
@@ -122,7 +122,7 @@
</Reference> </Reference>
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL"> <Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL">
<HintPath>..\packages\WebActivatorEx.2.0\lib\net40\WebActivatorEx.dll</HintPath> <HintPath>..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll</HintPath>
</Reference> </Reference>
<Reference Include="WebGrease"> <Reference Include="WebGrease">
<Private>True</Private> <Private>True</Private>