This commit is contained in:
2023-09-11 11:40:44 +08:00
19 changed files with 4625 additions and 3 deletions
+3
View File
@@ -698,6 +698,9 @@
<Compile Include="TaskScheduling\TimerTask\TimerTaskBase.cs" />
<Compile Include="WebService\CNCECHSSEWebService.cs" />
<Compile Include="WebService\FileStructService.cs" />
<Compile Include="ZHGL\ConstructionMonthReport\ConstructionMonthReportMainCostService.cs" />
<Compile Include="ZHGL\ConstructionMonthReport\ConstructionMonthReportService.cs" />
<Compile Include="ZHGL\ConstructionMonthReport\ConstructionMonthReportSubCostService.cs" />
<Compile Include="ZHGL\DataSync\CQMSDataService.cs" />
<Compile Include="ZHGL\DataSync\Hazard_RealTimeDeviceService.cs" />
<Compile Include="ZHGL\DataSync\HJGLData_DefectService.cs" />
+240
View File
@@ -776,5 +776,245 @@ namespace BLL
}
}
#endregion
/// <summary>
/// 获取模拟树表格
/// </summary>
/// <returns></returns>
public static DataTable GetAllTreeDataTableConstructionMonthReport(string projectId, string IsOut, DateTime startTime, DateTime endTime)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.WBS_WorkPackage> workPackages = from x in db.WBS_WorkPackage where x.ProjectId == projectId select x;
IQueryable<Model.WBS_UnitWork> unitWorks = from x in db.WBS_UnitWork where x.ProjectId == projectId select x;
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();
List<Model.View_WBS> WBSList = new List<Model.View_WBS>();
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))
{
AddDetail2(newList, getWBSs.ToList(), item.Id, a.ToString(), startTime, endTime);
}
else
{
AddDetail2(newList, getWBSs.ToList(), item.Id, a.ToString(), string.Empty, startTime, endTime);
}
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;
if (item.WBSType == "WorkPackage")
{
var childWorkPackages = from x in workPackages where x.SuperWorkPackageId == item.Id && x.IsApprove == true select x;
var workPackage = workPackages.FirstOrDefault(x => x.WorkPackageId == item.Id);
if (workPackage != null)
{
if (childWorkPackages.Count() == 0)
{
row[5] = item.Id;
if (workPackage.JDWeights != null)
{
row[6] = decimal.Round(Convert.ToDecimal(workPackage.JDWeights), 2);
}
row[7] = workPackage.Unit;
if (workPackage.PlanProjectQuantity != null)
{
row[8] = decimal.Round(Convert.ToDecimal(workPackage.PlanProjectQuantity), 2);
}
if (workPackage.RealProjectQuantity != null)
{
row[9] = decimal.Round(Convert.ToDecimal(workPackage.RealProjectQuantity), 2);
}
if (workPackage.PlanStartDate != null)
{
row[10] = workPackage.PlanStartDate;
}
if (workPackage.PlanEndDate != null)
{
row[11] = workPackage.PlanEndDate;
}
if (workPackage.RealStartDate != null)
{
row[12] = workPackage.RealStartDate;
}
if (workPackage.RealEndDate != null)
{
row[13] = workPackage.RealEndDate;
}
if (workPackage.IsMileStone != null)
{
row[14] = workPackage.IsMileStone;
}
if (workPackage.PlanCost != null)
{
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
{
if (workPackage.JDWeights != null)
{
row[6] = decimal.Round(Convert.ToDecimal(workPackage.JDWeights), 2);
}
if (workPackage.PlanStartDate != null)
{
row[10] = workPackage.PlanStartDate;
}
if (workPackage.PlanEndDate != null)
{
row[11] = workPackage.PlanEndDate;
}
if (workPackage.RealStartDate != null)
{
row[12] = workPackage.RealStartDate;
}
if (workPackage.RealEndDate != null)
{
row[13] = workPackage.RealEndDate;
}
if (workPackage.PlanCost != null)
{
row[15] = decimal.Round(Convert.ToDecimal(workPackage.PlanCost), 2);
}
}
}
}
else if (item.WBSType == "UnitWork")
{
var unitWork = unitWorks.FirstOrDefault(x => x.UnitWorkId == item.Id);
if (unitWork != null)
{
if (unitWork.JDWeights != null)
{
row[6] = decimal.Round(Convert.ToDecimal(unitWork.JDWeights), 2);
}
if (unitWork.PlanStartDate != null)
{
row[10] = unitWork.PlanStartDate;
}
if (unitWork.PlanEndDate != null)
{
row[11] = unitWork.PlanEndDate;
}
if (unitWork.RealStartDate != null)
{
row[12] = unitWork.RealStartDate;
}
if (unitWork.RealEndDate != null)
{
row[13] = unitWork.RealEndDate;
}
if (unitWork.PlanCost != null)
{
row[15] = decimal.Round(Convert.ToDecimal(unitWork.PlanCost), 2);
}
}
}
row[17] = item.Code;
table.Rows.Add(row);
}
}
return table;
}
}
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, DateTime startTime, DateTime endTime)
{
var items = oldList.Where(x => x.SupId == id && x.PlanEndDate > startTime && x.PlanEndDate <= endTime).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
newList.Add(item);
AddDetail2(newList, oldList, item.Id, item.Code, startTime, endTime);
b++;
}
}
private static void AddDetail2(List<Model.View_WBS> newList, List<Model.View_WBS> oldList, string id, string preCode, string prefix, DateTime startTime, DateTime endTime)
{
var items = oldList.Where(x => x.SupId == id && x.PlanEndDate > startTime && x.PlanEndDate <= endTime).OrderBy(x => x.WBSCode);
int b = 1;
foreach (var item in items)
{
item.Code = preCode + "." + b.ToString();
item.Name = prefix + "...." + item.Name;
newList.Add(item);
AddDetail2(newList, oldList, item.Id, item.Code, prefix + "....", startTime, endTime);
b++;
}
}
}
}
+9
View File
@@ -4471,6 +4471,10 @@ namespace BLL
/// </summary>
public const string CheckMonthTemplateUrl = "File\\Word\\CQMS\\Check\\质量月报.doc";
/// <summary>
/// 施工月报的虚拟路径
/// </summary>
public const string ConstructionMonthReportTemplateUrl = "File\\Word\\ZHGL\\施工月报.doc";
/// <summary>
/// 设计变更的虚拟路径
/// </summary>
public const string DesignTemplateUrl = "File\\Word\\CQMS\\Check\\设计变更.doc";
@@ -4526,6 +4530,11 @@ namespace BLL
/// 项目级施工日志
/// </summary>
public const string WorkHandoverMenuId = "CD88CE2A-A8E2-4F07-9A90-9161BD1C345C";
/// <summary>
/// 施工月报
/// </summary>
public const string ConstructionMonthReportMenuId = "F50EDEF0-FCDE-4B84-8D30-1F16E03FE26F";
#endregion
#region
@@ -0,0 +1,69 @@
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class ConstructionMonthReportMainCostService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取施工月报总包工程施工请款情况模板列表
/// </summary>
/// <param name="satartRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public static List<Model.ZHGL_ConstructionMonthReportMainCost> getListData(string ConstructionMonthReportId)
{
return (from x in Funs.DB.ZHGL_ConstructionMonthReportMainCost
where x.ConstructionMonthReportId == ConstructionMonthReportId
select x).ToList();
}
/// <summary>
/// 增加施工月报总包工程施工请款情况
/// </summary>
/// <param name="managerRuleApprove">施工月报总包工程施工请款情况实体</param>
public static void AddConstructionMonthReportMainCost(Model.ZHGL_ConstructionMonthReportMainCost ConstructionMonthReportMainCost)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionMonthReportMainCost newApprove = new Model.ZHGL_ConstructionMonthReportMainCost();
newApprove.ConstructionMonthReportMainCostId = ConstructionMonthReportMainCost.ConstructionMonthReportMainCostId;
newApprove.ConstructionMonthReportId = ConstructionMonthReportMainCost.ConstructionMonthReportId;
newApprove.ContractConstructionCost = ConstructionMonthReportMainCost.ContractConstructionCost;
newApprove.ThisRequestCost = ConstructionMonthReportMainCost.ThisRequestCost;
newApprove.TotalRequestCost = ConstructionMonthReportMainCost.TotalRequestCost;
newApprove.ThisCollection = ConstructionMonthReportMainCost.ThisCollection;
newApprove.TotalCollection = ConstructionMonthReportMainCost.TotalCollection;
newApprove.TotalCollectionRate = ConstructionMonthReportMainCost.TotalCollectionRate;
db.ZHGL_ConstructionMonthReportMainCost.InsertOnSubmit(newApprove);
db.SubmitChanges();
}
/// <summary>
/// 根据月报id删除对应的所有施工月报总包工程施工请款情况
/// </summary>
/// <param name="ConstructionMonthReportId">施工月报总包工程施工请款情况编号</param>
public static void DeleteConstructionMonthReportMainCostsByConstructionMonthReportId(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.ZHGL_ConstructionMonthReportMainCost where x.ConstructionMonthReportId == ConstructionMonthReportId select x).ToList();
if (q.Count() > 0)
{
db.ZHGL_ConstructionMonthReportMainCost.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
/// <summary>
/// 根据月报id获取对应的所有施工月报总包工程施工请款情况
/// </summary>
/// <param name="ConstructionMonthReportId">施工月报总包工程施工请款情况编号</param>
public static List<Model.ZHGL_ConstructionMonthReportMainCost> GetConstructionMonthReportMainCostsByConstructionMonthReportId(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
return (from x in db.ZHGL_ConstructionMonthReportMainCost where x.ConstructionMonthReportId == ConstructionMonthReportId select x).ToList();
}
}
}
@@ -0,0 +1,95 @@
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class ConstructionMonthReportService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 添加施工月报
/// </summary>
/// <param name="ConstructionMonthReport"></param>
public static void AddConstructionMonthReport(Model.ZHGL_ConstructionMonthReport ConstructionMonthReport)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionMonthReport newConstructionMonthReport = new Model.ZHGL_ConstructionMonthReport();
newConstructionMonthReport.ConstructionMonthReportId = ConstructionMonthReport.ConstructionMonthReportId;
newConstructionMonthReport.ProjectId = ConstructionMonthReport.ProjectId;
newConstructionMonthReport.Month = ConstructionMonthReport.Month;
newConstructionMonthReport.OwnerName = ConstructionMonthReport.OwnerName;
newConstructionMonthReport.ContractScope = ConstructionMonthReport.ContractScope;
newConstructionMonthReport.ContractPriceAndPricingModel = ConstructionMonthReport.ContractPriceAndPricingModel;
newConstructionMonthReport.ContractStartDate = ConstructionMonthReport.ContractStartDate;
newConstructionMonthReport.ContractEndDate = ConstructionMonthReport.ContractEndDate;
newConstructionMonthReport.MainConstructionActivities = ConstructionMonthReport.MainConstructionActivities;
newConstructionMonthReport.ProgressDeviationAndCauseAnalysis = ConstructionMonthReport.ProgressDeviationAndCauseAnalysis;
newConstructionMonthReport.KeyDeviationAndCauseAnalysis = ConstructionMonthReport.KeyDeviationAndCauseAnalysis;
newConstructionMonthReport.TargetedCorrectiveMeasures = ConstructionMonthReport.TargetedCorrectiveMeasures;
newConstructionMonthReport.NextMonthWork = ConstructionMonthReport.NextMonthWork;
newConstructionMonthReport.NeedCoordinateMatter = ConstructionMonthReport.NeedCoordinateMatter;
newConstructionMonthReport.CompileMan = ConstructionMonthReport.CompileMan;
newConstructionMonthReport.CompileDate = ConstructionMonthReport.CompileDate;
db.ZHGL_ConstructionMonthReport.InsertOnSubmit(newConstructionMonthReport);
db.SubmitChanges();
}
/// <summary>
/// 修改施工月报
/// </summary>
/// <param name="ConstructionMonthReport"></param>
public static void UpdateConstructionMonthReport(Model.ZHGL_ConstructionMonthReport ConstructionMonthReport)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionMonthReport newConstructionMonthReport = db.ZHGL_ConstructionMonthReport.First(e => e.ConstructionMonthReportId == ConstructionMonthReport.ConstructionMonthReportId);
newConstructionMonthReport.OwnerName = ConstructionMonthReport.OwnerName;
newConstructionMonthReport.ContractScope = ConstructionMonthReport.ContractScope;
newConstructionMonthReport.ContractPriceAndPricingModel = ConstructionMonthReport.ContractPriceAndPricingModel;
newConstructionMonthReport.ContractStartDate = ConstructionMonthReport.ContractStartDate;
newConstructionMonthReport.ContractEndDate = ConstructionMonthReport.ContractEndDate;
newConstructionMonthReport.MainConstructionActivities = ConstructionMonthReport.MainConstructionActivities;
newConstructionMonthReport.ProgressDeviationAndCauseAnalysis = ConstructionMonthReport.ProgressDeviationAndCauseAnalysis;
newConstructionMonthReport.KeyDeviationAndCauseAnalysis = ConstructionMonthReport.KeyDeviationAndCauseAnalysis;
newConstructionMonthReport.TargetedCorrectiveMeasures = ConstructionMonthReport.TargetedCorrectiveMeasures;
newConstructionMonthReport.NextMonthWork = ConstructionMonthReport.NextMonthWork;
newConstructionMonthReport.NeedCoordinateMatter = ConstructionMonthReport.NeedCoordinateMatter;
db.SubmitChanges();
}
/// <summary>
/// 根据施工月报Id删除一个施工月报信息
/// </summary>
/// <param name="ConstructionMonthReportId"></param>
public static void DeleteConstructionMonthReport(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionMonthReport ConstructionMonthReport = db.ZHGL_ConstructionMonthReport.First(e => e.ConstructionMonthReportId == ConstructionMonthReportId);
db.ZHGL_ConstructionMonthReport.DeleteOnSubmit(ConstructionMonthReport);
db.SubmitChanges();
}
/// <summary>
/// 根据施工月报Id获取一个施工月报信息
/// </summary>
/// <param name="ConstructionMonthReportDetailId"></param>
public static Model.ZHGL_ConstructionMonthReport GetConstructionMonthReport(string ConstructionMonthReportId)
{
return Funs.DB.ZHGL_ConstructionMonthReport.FirstOrDefault(e => e.ConstructionMonthReportId == ConstructionMonthReportId);
}
/// <summary>
/// 根据月份获取一个施工月报信息
/// </summary>
/// <param name="months">月份</param>
public static Model.ZHGL_ConstructionMonthReport GetConstructionMonthReportByMonth(DateTime month, string projectId)
{
return Funs.DB.ZHGL_ConstructionMonthReport.FirstOrDefault(e => e.Month == month && e.ProjectId == projectId);
}
}
}
@@ -0,0 +1,72 @@
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public class ConstructionMonthReportSubCostService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 获取施工月报分包工程施工付款情况模板列表
/// </summary>
/// <param name="satartRowIndex"></param>
/// <param name="maximumRows"></param>
/// <returns></returns>
public static List<Model.ZHGL_ConstructionMonthReportSubCost> getListData(string ConstructionMonthReportId)
{
return (from x in Funs.DB.ZHGL_ConstructionMonthReportSubCost
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ConstructionMonthReportId == ConstructionMonthReportId
orderby y.UnitCode
select x).ToList();
}
/// <summary>
/// 增加施工月报分包工程施工付款情况
/// </summary>
/// <param name="managerRuleApprove">施工月报分包工程施工付款情况实体</param>
public static void AddConstructionMonthReportSubCost(Model.ZHGL_ConstructionMonthReportSubCost ConstructionMonthReportSubCost)
{
Model.SGGLDB db = Funs.DB;
Model.ZHGL_ConstructionMonthReportSubCost newApprove = new Model.ZHGL_ConstructionMonthReportSubCost();
newApprove.ConstructionMonthReportSubCostId = ConstructionMonthReportSubCost.ConstructionMonthReportSubCostId;
newApprove.ConstructionMonthReportId = ConstructionMonthReportSubCost.ConstructionMonthReportId;
newApprove.UnitId = ConstructionMonthReportSubCost.UnitId;
newApprove.ContractAmount = ConstructionMonthReportSubCost.ContractAmount;
newApprove.ThisNeedPay = ConstructionMonthReportSubCost.ThisNeedPay;
newApprove.ThisRealPay = ConstructionMonthReportSubCost.ThisRealPay;
newApprove.TotalNeedPay = ConstructionMonthReportSubCost.TotalNeedPay;
newApprove.TotalRealPay = ConstructionMonthReportSubCost.TotalRealPay;
newApprove.TotalRealPayRate = ConstructionMonthReportSubCost.TotalRealPayRate;
db.ZHGL_ConstructionMonthReportSubCost.InsertOnSubmit(newApprove);
db.SubmitChanges();
}
/// <summary>
/// 根据月报id删除对应的所有施工月报分包工程施工付款情况
/// </summary>
/// <param name="ConstructionMonthReportId">施工月报分包工程施工付款情况编号</param>
public static void DeleteConstructionMonthReportSubCostsByConstructionMonthReportId(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.ZHGL_ConstructionMonthReportSubCost where x.ConstructionMonthReportId == ConstructionMonthReportId select x).ToList();
if (q.Count() > 0)
{
db.ZHGL_ConstructionMonthReportSubCost.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
/// <summary>
/// 根据月报id获取对应的所有施工月报分包工程施工付款情况
/// </summary>
/// <param name="ConstructionMonthReportId">施工月报分包工程施工付款情况编号</param>
public static List<Model.ZHGL_ConstructionMonthReportSubCost> GetConstructionMonthReportSubCostsByConstructionMonthReportId(string ConstructionMonthReportId)
{
Model.SGGLDB db = Funs.DB;
return (from x in db.ZHGL_ConstructionMonthReportSubCost where x.ConstructionMonthReportId == ConstructionMonthReportId select x).ToList();
}
}
}