This commit is contained in:
2023-11-10 15:21:46 +08:00
19 changed files with 1344 additions and 248 deletions
+167 -23
View File
@@ -245,7 +245,7 @@ namespace BLL
/// 获取模拟树表格
/// </summary>
/// <returns></returns>
public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string startTime, string endTime, string isOK)
public static DataTable GetAllTreeDataTable0(string projectId, string IsOut, string startTime, string endTime, string isOK)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
@@ -292,11 +292,6 @@ namespace BLL
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
table.Columns.Add(new DataColumn("Code", typeof(String)));
for (int i = 0; i < months.Count; i++)
{
table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String)));
table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String)));
}
if (getWBSs.Count() > 0)
{
List<Model.View_WBS> newList = new List<Model.View_WBS>();
@@ -372,19 +367,6 @@ namespace BLL
row[15] = decimal.Round(Convert.ToDecimal(workPackage.PlanCost), 2);
}
row[16] = workPackage.PreWorkCode;
var details = getDetails.Where(x => x.WorkPackageId == item.Id).ToList();
foreach (var item1 in details)
{
var index = months.FindIndex(x => x.Equals(item1.Months));
if (item1.PlanNum != 0)
{
row[18 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2);
}
if (item1.ThisNum != 0)
{
row[19 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2);
}
}
}
else
{
@@ -454,6 +436,168 @@ namespace BLL
}
}
public static List<Model.View_WBS> GetAllTreeDataTable2(string projectId, string IsOut, string startTime, string endTime, string isOK)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
List<Model.View_WBS> getWBSs = (from x in db.View_WBS where x.ProjectId == projectId select x).ToList();
List<Model.View_WBS> newList = new List<Model.View_WBS>();
if (getWBSs.Count() > 0)
{
var projectTypes = getWBSs.Where(x => x.WBSType == "ProjectType" && x.SupId == "0");
int a = 1;
foreach (var item in projectTypes)
{
item.Code = a.ToString();
newList.Add(item);
if (string.IsNullOrEmpty(IsOut))
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime, isOK);
}
else
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime, isOK);
}
a++;
}
}
return newList;
}
}
/// <summary>
/// 获取模拟树表格
/// </summary>
/// <returns></returns>
public static DataTable GetAllTreeDataTable(string projectId, string IsOut, string startTime, string endTime, string isOK)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.View_WBS_WorkPackageDetail> getDetails = from x in db.View_WBS_WorkPackageDetail where x.ProjectId == projectId select x;
List<Model.View_WBS> getWBSs = (from x in db.View_WBS where x.ProjectId == projectId select x).ToList();
DateTime startDate, endDate, startMonth, endMonth;
List<DateTime> months = new List<DateTime>();
var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == projectId);
if (project.StartDate != null)
{
startDate = Convert.ToDateTime(project.StartDate);
endDate = DateTime.Now;
if (project.EndDate != null)
{
endDate = Convert.ToDateTime(project.EndDate);
}
startMonth = Convert.ToDateTime(startDate.Year + "-" + startDate.Month + "-01");
endMonth = Convert.ToDateTime(endDate.Year + "-" + endDate.Month + "-01");
do
{
months.Add(startMonth);
startMonth = startMonth.AddMonths(1);
} while (startMonth <= endMonth);
}
DataTable table = new DataTable();
table.Columns.Add(new DataColumn("Id", typeof(String)));
table.Columns.Add(new DataColumn("SupId", typeof(String)));
table.Columns.Add(new DataColumn("Name", typeof(String)));
table.Columns.Add(new DataColumn("WBSType", typeof(String)));
table.Columns.Add(new DataColumn("ProjectId", typeof(String)));
table.Columns.Add(new DataColumn("ShowId", typeof(String)));
table.Columns.Add(new DataColumn("JDWeights", typeof(String)));
table.Columns.Add(new DataColumn("Unit", typeof(String)));
table.Columns.Add(new DataColumn("PlanProjectQuantity", typeof(String)));
table.Columns.Add(new DataColumn("RealProjectQuantity", typeof(String)));
table.Columns.Add(new DataColumn("PlanStartDate", typeof(DateTime)));
table.Columns.Add(new DataColumn("PlanEndDate", typeof(DateTime)));
table.Columns.Add(new DataColumn("RealStartDate", typeof(DateTime)));
table.Columns.Add(new DataColumn("RealEndDate", typeof(DateTime)));
table.Columns.Add(new DataColumn("IsMileStone", typeof(bool)));
table.Columns.Add(new DataColumn("PlanCost", typeof(String)));
table.Columns.Add(new DataColumn("PreWorkCode", typeof(String)));
table.Columns.Add(new DataColumn("Code", typeof(String)));
for (int i = 0; i < months.Count; i++)
{
table.Columns.Add(new DataColumn("PlanNum" + (i + 1).ToString(), typeof(String)));
table.Columns.Add(new DataColumn("ThisNum" + (i + 1).ToString(), typeof(String)));
}
if (getWBSs.Count() > 0)
{
List<Model.View_WBS> newList = new List<Model.View_WBS>();
var projectTypes = getWBSs.Where(x => x.WBSType == "ProjectType" && x.SupId == "0");
int a = 1;
foreach (var item in projectTypes)
{
item.Code = a.ToString();
newList.Add(item);
if (string.IsNullOrEmpty(IsOut))
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime, isOK);
}
else
{
AddDetail(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime, isOK);
}
a++;
}
DataRow row;
foreach (Model.View_WBS item in newList)
{
row = table.NewRow();
row[0] = item.Id;
row[1] = item.SupId;
row[2] = item.Name;
row[3] = item.WBSType;
row[4] = item.ProjectId;
row[5] = item.ShowId;
row[6] = item.JDWeights;
row[7] = item.Unit;
row[8] = item.PlanProjectQuantity;
row[9] = item.RealProjectQuantity;
if (item.PlanStartDate != null)
{
row[10] = item.PlanStartDate;
}
if (item.PlanEndDate != null)
{
row[11] = item.PlanEndDate;
}
if (item.RealStartDate != null)
{
row[12] = item.RealStartDate;
}
if (item.RealEndDate != null)
{
row[13] = item.RealEndDate;
}
if (item.IsMileStone != null)
{
row[14] = item.IsMileStone;
}
row[15] = item.PlanCost;
row[16] = item.PreWorkCode;
row[17] = item.Code;
if (!string.IsNullOrEmpty(item.ShowId))
{
var details = getDetails.Where(x => x.WorkPackageId == item.Id).ToList();
foreach (var item1 in details)
{
var index = months.FindIndex(x => x.Equals(item1.Months));
if (item1.PlanNum != 0)
{
row[18 + index * 2] = decimal.Round(Convert.ToDecimal(item1.PlanNum), 2);
}
if (item1.ThisNum != 0)
{
row[19 + index * 2] = decimal.Round(Convert.ToDecimal(item1.ThisNum), 2);
}
}
}
table.Rows.Add(row);
}
}
return table;
}
}
private static void AddDetail(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string startTime, string endTime, string isOK)
{
if (isOK == "0")
@@ -760,7 +904,7 @@ namespace BLL
public static string getWorkPageNamesByControlItemAndCycle(string workPackageId, string controlItemAndCycleId)
{
string returnValues = string.Empty;
string ControlItemName=string.Empty;
string ControlItemName = string.Empty;
if (!string.IsNullOrEmpty(controlItemAndCycleId))
{
var getControlItemAndCycle = Funs.DB.WBS_ControlItemAndCycle.FirstOrDefault(x => x.ControlItemAndCycleId == controlItemAndCycleId);
@@ -802,7 +946,7 @@ namespace BLL
var getSupWorkPackage = Funs.DB.WBS_WorkPackage.FirstOrDefault(x => x.WorkPackageId == getWorkPackage.SuperWorkPackageId);
if (getSupWorkPackage != null)
{
returnValues = getWorkPackage.PackageContent + "|" + returnValues;
returnValues = getWorkPackage.PackageContent + "|" + returnValues;
returnValues = getSelectIds(getWorkPackage.SuperWorkPackageId, returnValues);
}
@@ -820,7 +964,7 @@ namespace BLL
{
returnValues = "安装工程|" + getUnitWork.UnitWorkName + "|" + returnValues;
}
}
}
}
@@ -1093,7 +1237,7 @@ namespace BLL
}
}
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime,List<string> ids)
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime, List<string> ids)
{
var items = oldList.Where(x => x.SupId == id && ((x.PlanEndDate > startTime && x.PlanEndDate <= endTime) || ids.Contains(x.Id))).OrderBy(x => x.Code);
int b = 1;
@@ -221,7 +221,7 @@ namespace BLL
{
Model.SGGLDB db = Funs.DB;
Model.HJGL_Pipeline_Component newPipeline = new Model.HJGL_Pipeline_Component();
pipeline.IsPrint ??= false;
pipeline.IsPrint = false;
newPipeline.PipelineComponentId = pipeline.PipelineComponentId;
newPipeline.PipelineId = pipeline.PipelineId;
newPipeline.PreUnit = pipeline.PreUnit;
@@ -1,7 +1,8 @@
using System;
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web.UI.WebControls;
namespace BLL
{
@@ -9,6 +10,124 @@ namespace BLL
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.View_Hazard_HazardRegisterList> getDataLists = from x in db.View_Hazard_HazardRegisterList
where x.ProblemTypes == "1"
select x;
/// <summary>
///
/// </summary>
/// <param name="projetcId"></param>
/// <param name="checkMan"></param>
/// <param name="type"></param>
/// <param name="workAreaName"></param>
/// <param name="responsibilityUnitName"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="startRectificationTime"></param>
/// <param name="endRectificationTime"></param>
/// <param name="states"></param>
/// <param name="personId"></param>
/// <param name="unitId"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string checkMan, string type, string workAreaName, string responsibilityUnitName, DateTime? startTime, DateTime? endTime, DateTime? startRectificationTime, DateTime? endRectificationTime
,string states, string personId, string unitId, Grid Grid1)
{
IQueryable<Model.View_Hazard_HazardRegisterList> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (!string.IsNullOrEmpty(checkMan))
{
getDataList = getDataList.Where(e => e.CheckManName.Contains(checkMan));
}
if (!string.IsNullOrEmpty(type))
{
getDataList = getDataList.Where(e => e.RegisterTypesName.Contains(type));
}
if (!string.IsNullOrEmpty(workAreaName))
{
getDataList = getDataList.Where(e => e.WorkAreaName.Contains(workAreaName));
}
if (!string.IsNullOrEmpty(responsibilityUnitName))
{
getDataList = getDataList.Where(e => e.ResponsibilityUnitName.Contains(responsibilityUnitName));
}
if (startTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime >= startTime);
}
if (endTime.HasValue)
{
getDataList = getDataList.Where(e => e.CheckTime <= endTime);
}
if (startRectificationTime.HasValue)
{
getDataList = getDataList.Where(e => e.RectificationTime >= startRectificationTime);
}
if (endRectificationTime.HasValue)
{
getDataList = getDataList.Where(e => e.RectificationTime <= endRectificationTime);
}
if (!string.IsNullOrEmpty(states) && states != Const._Null)
{
getDataList = getDataList.Where(e => e.States.Contains(states));
}
if (!CommonService.IsMainUnitOrAdmin(personId))
{
getDataList = getDataList.Where(e => e.ResponsibleUnit == unitId || e.SendUnitId == unitId);
}
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.HazardRegisterId,
x.CheckTime,
x.RegisterDef,
x.RegisterTypes2Name,
x.RegisterTypesName,
x.RegisterTypes3Name,
x.HazardValue,
x.RegisterTypes4Name,
x.WorkAreaName,
x.ResponsibilityUnitName,
x.ResponsibilityManName,
x.Rectification,
x.RectificationPeriod,
//x.CCManNames,
x.RectificationTime,
x.CheckManName,
x.RegisterDate,
x.StatesStr,
};
}
#endregion
/// <summary>
/// 根据危险观察登记主键获取危险观察登记信息
/// </summary>
+121 -1
View File
@@ -1,4 +1,10 @@
using System;
using FineUIPro;
using Model;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace BLL
@@ -10,6 +16,120 @@ namespace BLL
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.License_LicenseManager> getDataLists = from x in db.License_LicenseManager
select x;
/// <summary>
///
/// </summary>
/// <param name="projetcId"></param>
/// <param name="checkMan"></param>
/// <param name="type"></param>
/// <param name="workAreaName"></param>
/// <param name="responsibilityUnitName"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="startRectificationTime"></param>
/// <param name="endRectificationTime"></param>
/// <param name="states"></param>
/// <param name="personId"></param>
/// <param name="unitId"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string unitId, DateTime? startTime, DateTime? endTime, string licenseType, string unitId2, Grid Grid1)
{
IQueryable<Model.License_LicenseManager> getDataList = getDataLists;
if (!string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(e => e.ProjectId == projectId);
}
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(projectId, unitId))
{
getDataList = getDataList.Where(e => e.UnitId == unitId);
}
if (startTime.HasValue)
{
getDataList = getDataList.Where(e => e.StartDate >= startTime);
}
if (endTime.HasValue)
{
getDataList = getDataList.Where(e => e.EndDate <= endTime);
}
if (!string.IsNullOrEmpty(licenseType))
{
getDataList = getDataList.Where(e => e.LicenseTypeId == licenseType);
}
if (!string.IsNullOrEmpty(unitId2) && unitId2 != Const._Null)
{
getDataList = getDataList.Where(e => e.UnitId == unitId2 );
}
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.LicenseManagerId,
x.LicenseManagerCode,
LicenseTypeName = db.Base_LicenseType.First(t => t.LicenseTypeId == x.LicenseTypeId).LicenseTypeName,
UnitName = db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName,
WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
x.CompileDate,
x.StartDate,
x.EndDate,
FlowOperateName = getFlow(x.LicenseManagerId, x.States),
};
}
public static string getFlow(string id,string states)
{
string strrValue = string.Empty;
string name = string.Empty;
var getFlow = Funs.DB.Sys_FlowOperate.FirstOrDefault(x => x.DataId == id && x.IsClosed != true);
if (getFlow != null)
{
var getPerson = Funs.DB.Person_Persons.FirstOrDefault(x => x.PersonId == getFlow.OperaterId);
if (getPerson != null)
{
name = getPerson.PersonName;
}
}
if (states == BLL.Const.State_0 || string.IsNullOrEmpty(states))
{
strrValue = "待[" + name + "]提交";
}
else if (states == BLL.Const.State_1)
{
strrValue = "审核/审批完成";
} else
{
strrValue = "待[" + name + "]办理";
}
return strrValue;
}
#endregion
/// <summary>
/// 根据主键获取安全许可证
/// </summary>