2023-10-25
This commit is contained in:
@@ -24,9 +24,13 @@ namespace BLL
|
||||
var getSeDinMonthReport = from x in db.SeDin_MonthReport
|
||||
where x.ProjectId == projectId
|
||||
select x;
|
||||
if (!string.IsNullOrEmpty(states))
|
||||
if (states == "1")
|
||||
{
|
||||
getSeDinMonthReport = getSeDinMonthReport.Where(x => x.States == states || (states == "0" && (x.States == null || x.States == "0")));
|
||||
getSeDinMonthReport = getSeDinMonthReport.Where(x => x.States == BLL.Const.State_3);
|
||||
}
|
||||
else
|
||||
{
|
||||
getSeDinMonthReport = getSeDinMonthReport.Where(x => x.States == null || x.States != BLL.Const.State_3);
|
||||
}
|
||||
|
||||
if (monthD.HasValue)
|
||||
|
||||
@@ -956,11 +956,15 @@ namespace BLL
|
||||
where personLogIds.Contains(x.ConstructionLogId)
|
||||
select x;
|
||||
var unitWorks = (from x in getContractTracks
|
||||
select new { MainItemCode = x.MainItemCode, MainItemName = x.MainItemName }).Distinct().ToList();
|
||||
select new { MainItemCode = x.MainItemCode, MainItemName = x.MainItemName }).Distinct().OrderBy(x => x.MainItemCode).ToList();
|
||||
|
||||
DataTable table = new DataTable();
|
||||
table.Columns.Add(new DataColumn("Id", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("Code", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("MainItemCode", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("MainItemName", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("MajorCode", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("MajorName", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("ProjectCode", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("ProjectName", typeof(String)));
|
||||
table.Columns.Add(new DataColumn("UnitOfMeasurement", typeof(String)));
|
||||
@@ -1054,7 +1058,7 @@ namespace BLL
|
||||
row = table.NewRow();
|
||||
row[0] = unitWork.MainItemCode;
|
||||
row[1] = a;
|
||||
row[2] = string.Empty;
|
||||
row[2] = unitWork.MainItemCode;
|
||||
row[3] = unitWork.MainItemName;
|
||||
table.Rows.Add(row);
|
||||
int b = 1;
|
||||
@@ -1064,84 +1068,156 @@ namespace BLL
|
||||
row[0] = unitWork.MainItemCode + b.ToString();
|
||||
row[1] = a + "." + b;
|
||||
row[2] = string.Empty;
|
||||
row[3] = proName;
|
||||
table.Rows.Add(row);
|
||||
int c = 1;
|
||||
var contractTracks = getContractTracks.Where(x => x.MainItemCode == unitWork.MainItemCode && x.MajorName == proName);
|
||||
foreach (Model.PHTGL_ContractTrack item in contractTracks)
|
||||
row[3] = string.Empty;
|
||||
var pro = pros.FirstOrDefault(x => x.Value == proName);
|
||||
if (pro != null)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[1] = a + "." + b + "." + c;
|
||||
row[2] = item.ProjectCode;
|
||||
row[3] = item.ProjectName;
|
||||
row[4] = item.UnitOfMeasurement;
|
||||
row[7] = item.Id;
|
||||
if (workEfficiencys.Count() > 0)
|
||||
row[4] = pro.Text;
|
||||
}
|
||||
row[5] = proName;
|
||||
table.Rows.Add(row);
|
||||
var subProjects = (from x in getContractTracks
|
||||
where x.MainItemCode == unitWork.MainItemCode && x.MajorName == proName && x.SubProject != null
|
||||
select x.SubProject).Distinct().ToList();
|
||||
if (subProjects.Count == 0) //未填分部工程
|
||||
{
|
||||
int c = 1;
|
||||
var contractTracks = getContractTracks.Where(x => x.MainItemCode == unitWork.MainItemCode && x.MajorName == proName).OrderBy(x => x.SerialNumber);
|
||||
foreach (Model.PHTGL_ContractTrack item in contractTracks)
|
||||
{
|
||||
var we = (from x in workEfficiencys
|
||||
where x.ContractTrackId == item.Id
|
||||
select new { x.ConstructionLogId, x.ContractTrackId, x.PhysicalCompletionQuantity, x.MaterialConsumption }).Distinct().ToList();
|
||||
decimal physicalCompletionQuantity = 0, materialConsumption = 0;
|
||||
if (we.Count() > 0)
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[1] = a + "." + b + "." + c;
|
||||
row[6] = item.ProjectCode;
|
||||
row[7] = item.ProjectName;
|
||||
row[8] = item.UnitOfMeasurement;
|
||||
row[11] = item.Id;
|
||||
if (workEfficiencys.Count() > 0)
|
||||
{
|
||||
foreach (var w in we)
|
||||
var we = (from x in workEfficiencys
|
||||
where x.ContractTrackId == item.Id
|
||||
select new { x.ConstructionLogId, x.ContractTrackId, x.PhysicalCompletionQuantity, x.MaterialConsumption }).Distinct().ToList();
|
||||
decimal physicalCompletionQuantity = 0, materialConsumption = 0;
|
||||
if (we.Count() > 0)
|
||||
{
|
||||
physicalCompletionQuantity += w.PhysicalCompletionQuantity ?? 0;
|
||||
materialConsumption += w.MaterialConsumption ?? 0;
|
||||
physicalCompletionQuantity = we.Sum(x => x.PhysicalCompletionQuantity ?? 0);
|
||||
materialConsumption = we.Sum(x => x.MaterialConsumption ?? 0);
|
||||
row[9] = physicalCompletionQuantity;
|
||||
row[10] = materialConsumption;
|
||||
}
|
||||
row[5] = physicalCompletionQuantity;
|
||||
row[6] = materialConsumption;
|
||||
}
|
||||
for (int i = 0; i < workPostIds.Count; i++)
|
||||
{
|
||||
var workEfficiencyList = workEfficiencys.Where(x => x.Type == "Person" && x.TypeId == workPostIds[i] && x.ContractTrackId == item.Id);
|
||||
if (workEfficiencyList.Count() > 0)
|
||||
for (int i = 0; i < workPostIds.Count; i++)
|
||||
{
|
||||
decimal d = 0;
|
||||
foreach (var workEfficiency in workEfficiencyList)
|
||||
var workEfficiencyList = workEfficiencys.Where(x => x.Type == "Person" && x.TypeId == workPostIds[i] && x.ContractTrackId == item.Id && x.ConsumeHours != null);
|
||||
if (workEfficiencyList.Count() > 0)
|
||||
{
|
||||
if (workEfficiency.ConsumeHours != null)
|
||||
decimal d = 0;
|
||||
d = workEfficiencyList.Sum(x => x.ConsumeHours ?? 0);
|
||||
if (d > 0)
|
||||
{
|
||||
d += decimal.Round(Convert.ToDecimal(workEfficiency.ConsumeHours), 2);
|
||||
row[12 + i * 2] = decimal.Round(d, 2);
|
||||
if (physicalCompletionQuantity > 0)
|
||||
{
|
||||
row[13 + i * 2] = decimal.Round(Convert.ToDecimal(physicalCompletionQuantity / d), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (d > 0)
|
||||
}
|
||||
for (int i = 0; i < machineIds.Count; i++)
|
||||
{
|
||||
var workEfficiencyList = workEfficiencys.Where(x => x.Type == "Machine" && x.TypeId == machineIds[i] && x.ContractTrackId == item.Id && x.ConsumeHours != null);
|
||||
if (workEfficiencyList.Count() > 0)
|
||||
{
|
||||
row[8 + i * 2] = decimal.Round(d, 2);
|
||||
if (physicalCompletionQuantity > 0)
|
||||
decimal d = 0;
|
||||
d = workEfficiencyList.Sum(x => x.ConsumeHours ?? 0);
|
||||
if (d > 0)
|
||||
{
|
||||
row[9 + i * 2] = decimal.Round(Convert.ToDecimal(physicalCompletionQuantity / d), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < machineIds.Count; i++)
|
||||
{
|
||||
var workEfficiencyList = workEfficiencys.Where(x => x.Type == "Machine" && x.TypeId == machineIds[i] && x.ContractTrackId == item.Id);
|
||||
if (workEfficiencyList.Count() > 0)
|
||||
{
|
||||
decimal d = 0;
|
||||
foreach (var workEfficiency in workEfficiencyList)
|
||||
{
|
||||
if (workEfficiency.ConsumeHours != null)
|
||||
{
|
||||
d += decimal.Round(Convert.ToDecimal(workEfficiency.ConsumeHours), 2);
|
||||
}
|
||||
}
|
||||
if (d > 0)
|
||||
{
|
||||
row[48 + i * 2] = decimal.Round(d, 2);
|
||||
if (physicalCompletionQuantity > 0)
|
||||
{
|
||||
row[49 + i * 2] = decimal.Round(Convert.ToDecimal(physicalCompletionQuantity / d), 2);
|
||||
row[52 + i * 2] = decimal.Round(d, 2);
|
||||
if (physicalCompletionQuantity > 0)
|
||||
{
|
||||
row[53 + i * 2] = decimal.Round(Convert.ToDecimal(physicalCompletionQuantity / d), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
else //存在分部工程
|
||||
{
|
||||
int c = 1;
|
||||
foreach (var subProject in subProjects)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = unitWork.MainItemCode + b.ToString() + c.ToString();
|
||||
row[1] = a + "." + b + "." + c;
|
||||
row[7] = subProject;
|
||||
table.Rows.Add(row);
|
||||
int f = 1;
|
||||
var contractTracks = getContractTracks.Where(x => x.MainItemCode == unitWork.MainItemCode && x.MajorName == proName && x.SubProject == subProject).OrderBy(x => x.SerialNumber);
|
||||
foreach (Model.PHTGL_ContractTrack item in contractTracks)
|
||||
{
|
||||
row = table.NewRow();
|
||||
row[0] = item.Id;
|
||||
row[1] = a + "." + b + "." + c + "." + f;
|
||||
row[6] = item.ProjectCode;
|
||||
row[7] = item.ProjectName;
|
||||
row[8] = item.UnitOfMeasurement;
|
||||
row[11] = item.Id;
|
||||
if (workEfficiencys.Count() > 0)
|
||||
{
|
||||
var we = (from x in workEfficiencys
|
||||
where x.ContractTrackId == item.Id
|
||||
select new { x.ConstructionLogId, x.ContractTrackId, x.PhysicalCompletionQuantity, x.MaterialConsumption }).Distinct().ToList();
|
||||
decimal physicalCompletionQuantity = 0, materialConsumption = 0;
|
||||
if (we.Count() > 0)
|
||||
{
|
||||
physicalCompletionQuantity = we.Sum(x => x.PhysicalCompletionQuantity ?? 0);
|
||||
materialConsumption = we.Sum(x => x.MaterialConsumption ?? 0);
|
||||
row[9] = physicalCompletionQuantity;
|
||||
row[10] = materialConsumption;
|
||||
}
|
||||
for (int i = 0; i < workPostIds.Count; i++)
|
||||
{
|
||||
var workEfficiencyList = workEfficiencys.Where(x => x.Type == "Person" && x.TypeId == workPostIds[i] && x.ContractTrackId == item.Id && x.ConsumeHours != null);
|
||||
if (workEfficiencyList.Count() > 0)
|
||||
{
|
||||
decimal d = 0;
|
||||
d = workEfficiencyList.Sum(x => x.ConsumeHours ?? 0);
|
||||
if (d > 0)
|
||||
{
|
||||
row[12 + i * 2] = decimal.Round(d, 2);
|
||||
if (physicalCompletionQuantity > 0)
|
||||
{
|
||||
row[13 + i * 2] = decimal.Round(Convert.ToDecimal(physicalCompletionQuantity / d), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < machineIds.Count; i++)
|
||||
{
|
||||
var workEfficiencyList = workEfficiencys.Where(x => x.Type == "Machine" && x.TypeId == machineIds[i] && x.ContractTrackId == item.Id && x.ConsumeHours != null);
|
||||
if (workEfficiencyList.Count() > 0)
|
||||
{
|
||||
decimal d = 0;
|
||||
d = workEfficiencyList.Sum(x => x.ConsumeHours ?? 0);
|
||||
if (d > 0)
|
||||
{
|
||||
row[52 + i * 2] = decimal.Round(d, 2);
|
||||
if (physicalCompletionQuantity > 0)
|
||||
{
|
||||
row[53 + i * 2] = decimal.Round(Convert.ToDecimal(physicalCompletionQuantity / d), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
f++;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
table.Rows.Add(row);
|
||||
c++;
|
||||
}
|
||||
b++;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,20 @@
|
||||
}
|
||||
return name;
|
||||
}
|
||||
/// <summary>
|
||||
///根据ID获取项目编号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetProjectRealCodeByProjectId(string projectId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
var project = Funs.DB.Base_Project.FirstOrDefault(e => e.ProjectId == projectId);
|
||||
if (project != null)
|
||||
{
|
||||
name = project.ProjectRealCode;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
public static Model.Base_Project GetProjectByProjectShortName(string name)
|
||||
{
|
||||
return Funs.DB.Base_Project.FirstOrDefault(e => e.ShortName == name);
|
||||
@@ -110,6 +124,7 @@
|
||||
Province = project.Province,
|
||||
City = project.City,
|
||||
EnglishRemark = project.EnglishRemark,
|
||||
ProjectRealCode=project.ProjectRealCode,
|
||||
|
||||
};
|
||||
db.Base_Project.InsertOnSubmit(newProject);
|
||||
@@ -155,6 +170,7 @@
|
||||
newProject.Province = project.Province;
|
||||
newProject.City = project.City;
|
||||
newProject.EnglishRemark = project.EnglishRemark;
|
||||
newProject.ProjectRealCode = project.ProjectRealCode;
|
||||
db.SubmitChanges();
|
||||
HSEDataCollectService.ProjectHSEDataCollectSubmission(newProject);
|
||||
CQMSDataCollectService.ProjectCQMSDataCollectSubmission(newProject);
|
||||
|
||||
Reference in New Issue
Block a user