20210430
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class CnProfessionInitService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据专业Id获取专业信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">专业Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.WBS_CnProfessionInit GetCnProfessionInitByCnProfessionId(string cnProfessionId)
|
||||
{
|
||||
return Funs.DB.WBS_CnProfessionInit.FirstOrDefault(e => e.CnProfessionId.ToString() == cnProfessionId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加专业
|
||||
/// </summary>
|
||||
/// <param name="user">专业</param>
|
||||
//public static void AddCnProfessionInit(Model.WBS_CnProfessionInit cnProfessionInit)
|
||||
//{
|
||||
// Model.SGGLDB db = Funs.DB;
|
||||
// Model.WBS_CnProfessionInit newCnP = new Model.WBS_CnProfessionInit();
|
||||
// newCnP.CnProfessionId = SQLHelper.GetNewID(typeof(Model.WBS_CnProfessionInit));
|
||||
// newCnP.CnProfessionName = cnProfessionInit.CnProfessionName;
|
||||
// newCnP.CnProfessionCode = cnProfessionInit.CnProfessionCode;
|
||||
// newCnP.InstallationId = cnProfessionInit.InstallationId;
|
||||
// newCnP.ProjectId = cnProfessionInit.ProjectId;
|
||||
// newCnP.StartDate = cnProfessionInit.StartDate;
|
||||
// newCnP.EndDate = cnProfessionInit.EndDate;
|
||||
// newCnP.Weights = cnProfessionInit.Weights;
|
||||
// newCnP.OldId = cnProfessionInit.OldId;
|
||||
|
||||
// db.WBS_CnProfessionInit.InsertOnSubmit(newCnP);
|
||||
// db.SubmitChanges();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 修改专业
|
||||
/// </summary>
|
||||
/// <param name="user">专业</param>
|
||||
public static void UpdateCnProfession(Model.WBS_CnProfessionInit cnProfessionInit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_CnProfessionInit newCnP = db.WBS_CnProfessionInit.First(e => e.CnProfessionId == cnProfessionInit.CnProfessionId);
|
||||
|
||||
newCnP.CnProfessionName = cnProfessionInit.CnProfessionName;
|
||||
newCnP.CnProfessionCode = cnProfessionInit.CnProfessionCode;
|
||||
newCnP.ToCNLaw = cnProfessionInit.ToCNLaw;
|
||||
newCnP.SortIndex = cnProfessionInit.SortIndex;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除专业信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteCnProfessionInit(string cnProfessionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_CnProfessionInit CnP = db.WBS_CnProfessionInit.First(e => e.CnProfessionId.ToString() == cnProfessionId);
|
||||
db.WBS_CnProfessionInit.DeleteOnSubmit(CnP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取专业下拉选项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.WBS_CnProfessionInit> GetCnProfessionInitDropDownList()
|
||||
{
|
||||
var list = (from x in Funs.DB.WBS_CnProfessionInit orderby x.CnProfessionId select x).ToList();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class CnProfessionService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据专业Id获取专业信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">专业Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.WBS_CnProfession GetCnProfessionByCnProfessionId(string cnProfessionId)
|
||||
{
|
||||
return Funs.DB.WBS_CnProfession.FirstOrDefault(e => e.CnProfessionId == cnProfessionId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加专业
|
||||
/// </summary>
|
||||
/// <param name="user">专业</param>
|
||||
public static void AddCnProfession(Model.WBS_CnProfession cnProfession)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_CnProfession newCnP = new Model.WBS_CnProfession();
|
||||
newCnP.CnProfessionId = SQLHelper.GetNewID(typeof(Model.WBS_CnProfession));
|
||||
newCnP.CnProfessionName = cnProfession.CnProfessionName;
|
||||
newCnP.CnProfessionCode = cnProfession.CnProfessionCode;
|
||||
newCnP.InstallationId = cnProfession.InstallationId;
|
||||
newCnP.ProjectId = cnProfession.ProjectId;
|
||||
newCnP.StartDate = cnProfession.StartDate;
|
||||
newCnP.EndDate = cnProfession.EndDate;
|
||||
newCnP.Weights = cnProfession.Weights;
|
||||
newCnP.OldId = cnProfession.OldId;
|
||||
newCnP.UnitId = cnProfession.UnitId;
|
||||
|
||||
db.WBS_CnProfession.InsertOnSubmit(newCnP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改专业
|
||||
/// </summary>
|
||||
/// <param name="user">专业</param>
|
||||
public static void UpdateCnProfession(Model.WBS_CnProfession cnProfession)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_CnProfession newCnP = db.WBS_CnProfession.First(e => e.CnProfessionId == cnProfession.CnProfessionId);
|
||||
|
||||
newCnP.CnProfessionName = cnProfession.CnProfessionName;
|
||||
newCnP.CnProfessionCode = cnProfession.CnProfessionCode;
|
||||
newCnP.StartDate = cnProfession.StartDate;
|
||||
newCnP.EndDate = cnProfession.EndDate;
|
||||
newCnP.Weights = cnProfession.Weights;
|
||||
newCnP.WeightsMoney = cnProfession.WeightsMoney;
|
||||
newCnP.IsWeightsApprove = cnProfession.IsWeightsApprove;
|
||||
newCnP.UnitId = cnProfession.UnitId;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除专业信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteCnProfession(string cnProfessionId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_CnProfession CnP = db.WBS_CnProfession.First(e => e.CnProfessionId == cnProfessionId);
|
||||
db.WBS_CnProfession.DeleteOnSubmit(CnP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取装置下所有专业
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.WBS_CnProfession> GetCnProfessionByInstallation(string ins)
|
||||
{
|
||||
var list = (from x in Funs.DB.WBS_CnProfession where x.InstallationId == ins orderby x.CnProfessionId select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取专业下拉选项
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.WBS_CnProfessionInit> GetCnProfessionDropDownList()
|
||||
{
|
||||
var list = (from x in Funs.DB.WBS_CnProfessionInit orderby x.CnProfessionId select x).ToList();
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取专业下拉选项(不含总图)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.WBS_CnProfessionInit> GetCnProfessionDropDownList2()
|
||||
{
|
||||
var list = (from x in Funs.DB.WBS_CnProfessionInit where x.CnProfessionId != 19 orderby x.CnProfessionId select x).ToList();
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class UnitProjectInitService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据单位/子单位工程Id获取单位/子单位工程信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位/子单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Wbs_UnitProjectInit GetUnitProjectInitByUnitProjectCode(string unitProjectCode)
|
||||
{
|
||||
return Funs.DB.Wbs_UnitProjectInit.FirstOrDefault(e => e.UnitProjectCode == unitProjectCode);
|
||||
}
|
||||
public static int GetUnitProjectInitcountByUnitProjectCode(string unitProjectCode)
|
||||
{
|
||||
return Funs.DB.Wbs_UnitProjectInit.Where(e => e.UnitProjectCode == unitProjectCode).Count();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据专业寻找单位工程数量
|
||||
/// </summary>
|
||||
/// <param name="cnProfessionId"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetUnitProcountByCnProfessionId(int cnProfessionId)
|
||||
{
|
||||
return Funs.DB.Wbs_UnitProjectInit.Where(e => e.CnProfessionId == cnProfessionId).Count();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程Id获取子单位工程集合信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_UnitProjectInit> GetUnitProjectInitsBySuperUnitProject(string superUnitProject)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_UnitProjectInit where x.SuperUnitProject == superUnitProject orderby x.UnitProjectCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加单位工程/子单位工程
|
||||
/// </summary>
|
||||
/// <param name="user">单位工程/子单位工程</param>
|
||||
public static void AddUnitProjectInit(Model.Wbs_UnitProjectInit unitProjectInit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_UnitProjectInit newUP = new Model.Wbs_UnitProjectInit();
|
||||
newUP.UnitProjectCode = unitProjectInit.UnitProjectCode;
|
||||
newUP.UnitProjectName = unitProjectInit.UnitProjectName;
|
||||
newUP.SuperUnitProject = unitProjectInit.SuperUnitProject;
|
||||
newUP.CnProfessionId = unitProjectInit.CnProfessionId;
|
||||
newUP.IsIn = unitProjectInit.IsIn;
|
||||
newUP.Remark = unitProjectInit.Remark;
|
||||
|
||||
db.Wbs_UnitProjectInit.InsertOnSubmit(newUP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改单位工程/子单位工程
|
||||
/// </summary>
|
||||
/// <param name="user">单位工程/子单位工程</param>
|
||||
public static void UpdateUnitProjectInit(Model.Wbs_UnitProjectInit unitProjectInit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_UnitProjectInit newUP = db.Wbs_UnitProjectInit.First(e => e.UnitProjectCode == unitProjectInit.UnitProjectCode);
|
||||
|
||||
newUP.UnitProjectName = unitProjectInit.UnitProjectName;
|
||||
newUP.Remark = unitProjectInit.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除单位工程/子单位工程信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteUnitProjectInit(string unitProjectCode)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_UnitProjectInit UP = db.Wbs_UnitProjectInit.First(e => e.UnitProjectCode == unitProjectCode);
|
||||
db.Wbs_UnitProjectInit.DeleteOnSubmit(UP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除所有子级单位工程/子单位工程信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteUnitProjectInitBySuperUnitProject(string superUnitProject)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.Wbs_UnitProjectInit where x.SuperUnitProject == superUnitProject select x;
|
||||
db.Wbs_UnitProjectInit.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class UnitProjectService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据单位/子单位工程Id获取单位/子单位工程信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位/子单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Wbs_UnitProject GetUnitProjectByUnitProjectId(string unitProjectId)
|
||||
{
|
||||
return Funs.DB.Wbs_UnitProject.FirstOrDefault(e => e.UnitProjectId == unitProjectId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程Id获取子单位工程集合信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_UnitProject> GetUnitProjectsBySuperUnitProjectId(string superUnitProjectId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_UnitProject where x.SuperUnitProjectId == superUnitProjectId orderby x.UnitProjectCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据装置Id获取单位工程集合信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_UnitProject> GetUnitProjectsByInstallationId(string installationId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_UnitProject where x.InstallationId == installationId && x.SuperUnitProjectId == null orderby x.UnitProjectCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据专业Id获取单位工程集合信息
|
||||
/// </summary>
|
||||
/// <param name="cnProfessionId">专业Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_UnitProject> GetUnitProjectsByCnProfessionId(string cnProfessionId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_UnitProject where x.CnProfessionId == cnProfessionId orderby x.UnitProjectCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程Id获取单位工程子级集合的累计工程量
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static decimal GetChildEngineerQuantitys(string unitProjectId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.UnitProjectId == unitProjectId && x.SuperWbsSetId == null && x.IsApprove == true select x.EngineerQuantity ?? 0).Sum();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加单位工程/子单位工程
|
||||
/// </summary>
|
||||
/// <param name="user">单位工程/子单位工程</param>
|
||||
public static void AddUnitProject(Model.Wbs_UnitProject unitProject)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_UnitProject newUP = new Model.Wbs_UnitProject();
|
||||
newUP.UnitProjectId = unitProject.UnitProjectId;
|
||||
newUP.UnitProjectName = unitProject.UnitProjectName;
|
||||
newUP.UnitProjectCode = unitProject.UnitProjectCode;
|
||||
newUP.SuperUnitProjectId = unitProject.SuperUnitProjectId;
|
||||
newUP.InstallationId = unitProject.InstallationId;
|
||||
newUP.ProjectId = unitProject.ProjectId;
|
||||
newUP.CnProfessionId = unitProject.CnProfessionId;
|
||||
newUP.StartDate = unitProject.StartDate;
|
||||
newUP.EndDate = unitProject.EndDate;
|
||||
newUP.Weights = unitProject.Weights;
|
||||
newUP.Remark = unitProject.Remark;
|
||||
newUP.IsIn = unitProject.IsIn;
|
||||
newUP.IsSelected = unitProject.IsSelected;
|
||||
newUP.IsApprove = unitProject.IsApprove;
|
||||
newUP.SortIndex = unitProject.SortIndex;
|
||||
newUP.EngineerQuantity = unitProject.EngineerQuantity;
|
||||
newUP.BudgetUnitPrice = unitProject.BudgetUnitPrice;
|
||||
newUP.CostUnivalent = unitProject.CostUnivalent;
|
||||
newUP.Unit = unitProject.Unit;
|
||||
|
||||
db.Wbs_UnitProject.InsertOnSubmit(newUP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改单位工程/子单位工程
|
||||
/// </summary>
|
||||
/// <param name="user">单位工程/子单位工程</param>
|
||||
public static void UpdateUnitProject(Model.Wbs_UnitProject unitProject)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_UnitProject newUP = db.Wbs_UnitProject.First(e => e.UnitProjectId == unitProject.UnitProjectId);
|
||||
|
||||
newUP.UnitProjectName = unitProject.UnitProjectName;
|
||||
newUP.UnitProjectCode = unitProject.UnitProjectCode;
|
||||
newUP.InstallationId = unitProject.InstallationId;
|
||||
newUP.StartDate = unitProject.StartDate;
|
||||
newUP.EndDate = unitProject.EndDate;
|
||||
newUP.Weights = unitProject.Weights;
|
||||
newUP.WeightsMoney = unitProject.WeightsMoney;
|
||||
newUP.Remark = unitProject.Remark;
|
||||
newUP.IsSelected = unitProject.IsSelected;
|
||||
newUP.IsApprove = unitProject.IsApprove;
|
||||
newUP.IsWeightsApprove = unitProject.IsWeightsApprove;
|
||||
newUP.SortIndex = unitProject.SortIndex;
|
||||
newUP.EngineerQuantity = unitProject.EngineerQuantity;
|
||||
newUP.BudgetUnitPrice = unitProject.BudgetUnitPrice;
|
||||
newUP.CostUnivalent = unitProject.CostUnivalent;
|
||||
newUP.Unit = unitProject.Unit;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除单位工程/子单位工程信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteUnitProject(string unitProjectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_UnitProject UP = db.Wbs_UnitProject.First(e => e.UnitProjectId == unitProjectId);
|
||||
db.Wbs_UnitProject.DeleteOnSubmit(UP);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除所有子级单位工程/子单位工程信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteUnitProjectBySuperUnitProjectId(string superUnitProjectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.Wbs_UnitProject where x.SuperUnitProjectId == superUnitProjectId select x;
|
||||
db.Wbs_UnitProject.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class WBSRectificationMeasureSetService
|
||||
{
|
||||
/// <summary>
|
||||
///获取纠偏措施设置信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Model.WBSRectificationMeasureSet GetWBSRectificationMeasureSetByWBSRectificationMeasureSetId(string wBSRectificationMeasureSetId)
|
||||
{
|
||||
return Funs.DB.WBSRectificationMeasureSet.FirstOrDefault(e => e.WBSRectificationMeasureSetId == wBSRectificationMeasureSetId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///获取纠偏措施设置信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Model.WBSRectificationMeasureSet GetWBSRectificationMeasureSetByDateAndToWbs(string toWbs, DateTime date, string rectificationMeasureType)
|
||||
{
|
||||
return Funs.DB.WBSRectificationMeasureSet.FirstOrDefault(e => e.ToWbs == toWbs && e.CompileDate.Value.Year == date.Year && e.CompileDate.Value.Month == date.Month && e.RectificationMeasureType == rectificationMeasureType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据编制人和月份获取当月未落实纠偏措施设置信息集合
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.WBSRectificationMeasureSet> GetWBSRectificationMeasuresByCompileManAndDate(string compileMan, DateTime date)
|
||||
{
|
||||
return (from x in Funs.DB.WBSRectificationMeasureSet where x.CompileMan == compileMan && x.CompileDate.Value.Year == date.Year && x.CompileDate.Value.Month == date.Month && (x.IsComplete == false || x.IsComplete == null) select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加纠偏措施设置信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static void AddWBSRectificationMeasureSet(Model.WBSRectificationMeasureSet wBSRectificationMeasureSet)
|
||||
{
|
||||
Model.WBSRectificationMeasureSet newWBSRectificationMeasureSet = new Model.WBSRectificationMeasureSet();
|
||||
newWBSRectificationMeasureSet.WBSRectificationMeasureSetId = wBSRectificationMeasureSet.WBSRectificationMeasureSetId;
|
||||
newWBSRectificationMeasureSet.ProjectId = wBSRectificationMeasureSet.ProjectId;
|
||||
newWBSRectificationMeasureSet.ToWbs = wBSRectificationMeasureSet.ToWbs;
|
||||
newWBSRectificationMeasureSet.RectificationMeasureIds = wBSRectificationMeasureSet.RectificationMeasureIds;
|
||||
newWBSRectificationMeasureSet.RectificationMeasureType = wBSRectificationMeasureSet.RectificationMeasureType;
|
||||
newWBSRectificationMeasureSet.RemindDay = wBSRectificationMeasureSet.RemindDay;
|
||||
newWBSRectificationMeasureSet.CompileMan = wBSRectificationMeasureSet.CompileMan;
|
||||
newWBSRectificationMeasureSet.CompileDate = wBSRectificationMeasureSet.CompileDate;
|
||||
newWBSRectificationMeasureSet.IsComplete = wBSRectificationMeasureSet.IsComplete;
|
||||
|
||||
Funs.DB.WBSRectificationMeasureSet.InsertOnSubmit(newWBSRectificationMeasureSet);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///修改纠偏措施设置信息
|
||||
/// </summary>
|
||||
/// <param name="wBSRectificationMeasureSet"></param>
|
||||
public static void UpdateWBSRectificationMeasureSet(Model.WBSRectificationMeasureSet wBSRectificationMeasureSet)
|
||||
{
|
||||
Model.WBSRectificationMeasureSet newWBSRectificationMeasureSet = Funs.DB.WBSRectificationMeasureSet.FirstOrDefault(e => e.WBSRectificationMeasureSetId == wBSRectificationMeasureSet.WBSRectificationMeasureSetId);
|
||||
if (newWBSRectificationMeasureSet != null)
|
||||
{
|
||||
newWBSRectificationMeasureSet.IsComplete = wBSRectificationMeasureSet.IsComplete;
|
||||
newWBSRectificationMeasureSet.HandleDate = wBSRectificationMeasureSet.HandleDate;
|
||||
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据纠偏措施设置Id删除一个纠偏措施设置信息
|
||||
/// </summary>
|
||||
/// <param name="wBSRectificationMeasureSetId"></param>
|
||||
public static void DeleteWBSRectificationMeasureSet(string wBSRectificationMeasureSetId)
|
||||
{
|
||||
Model.WBSRectificationMeasureSet wBSRectificationMeasureSet = Funs.DB.WBSRectificationMeasureSet.FirstOrDefault(e => e.WBSRectificationMeasureSetId == wBSRectificationMeasureSetId);
|
||||
if (wBSRectificationMeasureSet != null)
|
||||
{
|
||||
Funs.DB.WBSRectificationMeasureSet.DeleteOnSubmit(wBSRectificationMeasureSet);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class WbsDetailHistoryService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据Id获取一个WBS版本历史明细信息
|
||||
/// </summary>
|
||||
/// <param name="wbsDetailHistoryId">WBS版本历史明细Id</param>
|
||||
public static Model.WbsDetailHistory GetWbsDetailHistoryByWbsDetailHistoryId(string wbsDetailHistoryId)
|
||||
{
|
||||
return Funs.DB.WbsDetailHistory.FirstOrDefault(e => e.WbsDetailHistoryId == wbsDetailHistoryId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据toWbs获取对应WBS版本历史明细信息
|
||||
/// </summary>
|
||||
/// <param name="toWbs">对应wbsId</param>
|
||||
public static List<Model.WbsDetailHistory> GetWbsDetailHistorysByToWbs(string toWbs)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetailHistory where x.ToWbs == toWbs orderby Convert.ToInt32(x.VersionNum.Substring(1, x.VersionNum.Length - 3)), x.Months select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加WBS版本历史明细
|
||||
/// </summary>
|
||||
/// <param name="user">WBS版本历史明细</param>
|
||||
public static void AddWbsDetailHistory(Model.WbsDetailHistory wbsDetailHistory)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WbsDetailHistory newWbsDetailHistory = new Model.WbsDetailHistory();
|
||||
newWbsDetailHistory.WbsDetailHistoryId = wbsDetailHistory.WbsDetailHistoryId;
|
||||
newWbsDetailHistory.ToWbs = wbsDetailHistory.ToWbs;
|
||||
newWbsDetailHistory.ToFlag = wbsDetailHistory.ToFlag;
|
||||
newWbsDetailHistory.Way = wbsDetailHistory.Way;
|
||||
newWbsDetailHistory.Months = wbsDetailHistory.Months;
|
||||
newWbsDetailHistory.PlanValue = wbsDetailHistory.PlanValue;
|
||||
newWbsDetailHistory.PlanValueRate = wbsDetailHistory.PlanValueRate;
|
||||
newWbsDetailHistory.VersionNum = wbsDetailHistory.VersionNum;
|
||||
|
||||
db.WbsDetailHistory.InsertOnSubmit(newWbsDetailHistory);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除WBS版本历史明细信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsDetailHistory(string wbsDetailHistoryId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WbsDetailHistory ins = db.WbsDetailHistory.First(e => e.WbsDetailHistoryId == wbsDetailHistoryId);
|
||||
db.WbsDetailHistory.DeleteOnSubmit(ins);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据toWbs删除WBS版本历史明细信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsDetailHistoryByToWbs(string toWbs)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var details = from x in db.WbsDetailHistory where x.ToWbs == toWbs select x;
|
||||
if (details.Count() > 0)
|
||||
{
|
||||
db.WbsDetailHistory.DeleteAllOnSubmit(details);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class WbsDetailService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据Id获取一个WBS明细信息
|
||||
/// </summary>
|
||||
/// <param name="wbsDetailId">WBS明细Id</param>
|
||||
public static Model.WbsDetail GetWbsDetailByWbsDetailId(string wbsDetailId)
|
||||
{
|
||||
return Funs.DB.WbsDetail.FirstOrDefault(e => e.WbsDetailId == wbsDetailId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据ToWbs判断是否存在WBS明细信息
|
||||
/// </summary>
|
||||
/// <param name="toWbs">toWbs</param>
|
||||
public static bool IsExitWbsDetailByToWbs(string toWbs)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetail where x.ToWbs == toWbs select x).Count() > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据toWbs和toFlag和年及月获取对应WBS明细信息
|
||||
/// </summary>
|
||||
/// <param name="toWbs">对应wbsId</param>
|
||||
/// <param name="toFlag">对应标志</param>
|
||||
/// <param name="years">年</param>
|
||||
/// <param name="months">月</param>
|
||||
public static Model.WbsDetail GetWbsDetailByWbsFlagYearMonth(string toWbs, int toFlag, DateTime months)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetail where x.ToWbs == toWbs && x.ToFlag == toFlag && x.Months == months select x).FirstOrDefault();
|
||||
}
|
||||
|
||||
public static Model.WbsDetail GetWbsDetailByToWbsFlag(string toWbs, int toFlag)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetail where x.ToWbs == toWbs && x.ToFlag == toFlag select x).FirstOrDefault();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据ToWbs和月份判断是否存在未审核WBS明细信息
|
||||
/// </summary>
|
||||
/// <param name="toWbs">toWbs</param>
|
||||
public static bool IsExitNoCompleteApproveWbsDetailByToWbs(string toWbs, int toFlag, DateTime months)
|
||||
{
|
||||
bool result;
|
||||
var q = Funs.DB.WbsDetail.FirstOrDefault(e => e.ToWbs == toWbs && e.ToFlag == toFlag && e.Months == months);
|
||||
if (q != null)
|
||||
{
|
||||
if (q.IsCompleteApprove == null && (q.CompleteValue != null || q.RealValue != null))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="toWbs"></param>
|
||||
/// <param name="toFlag"></param>
|
||||
/// <param name="months"></param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWbsDetailByToWbsOrMonth(string toWbs, int toFlag, DateTime months)
|
||||
{
|
||||
bool result = false;
|
||||
var q = Funs.DB.WbsDetail.FirstOrDefault(e => e.ToWbs == toWbs && e.ToFlag == toFlag && e.Months == months);
|
||||
if (q != null)
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据年及月获取之前月份的对应WBS明细信息集合(含当月)
|
||||
/// </summary>
|
||||
/// <param name="years">年</param>
|
||||
/// <param name="months">月</param>
|
||||
public static List<Model.WbsDetail> GetTotalWbsDetailsByYearMonth2(string toWbs, DateTime months)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetail where x.ToWbs == toWbs && x.Months <= months select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据ToWbs月获取所有月份的对应WBS明细信息集合
|
||||
/// </summary>
|
||||
/// <param name="toWbs">toWbs</param>
|
||||
public static List<Model.WbsDetail> GetTotalWbsDetailsByToWbs(string toWbs)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetail where x.ToWbs == toWbs orderby x.Months select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据年及月获取之前月份的对应WBS明细信息集合(含当月)
|
||||
/// </summary>
|
||||
/// <param name="years">年</param>
|
||||
/// <param name="months">月</param>
|
||||
public static List<Model.WbsDetail> GetTotalWbsDetailsByYearMonth(string toWbs, int toFlag, DateTime months)
|
||||
{
|
||||
return (from x in Funs.DB.WbsDetail where x.ToWbs == toWbs && x.ToFlag == toFlag && x.Months <= months select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加WBS明细
|
||||
/// </summary>
|
||||
/// <param name="user">WBS明细</param>
|
||||
public static void AddWbsDetail(Model.WbsDetail wbsDetail)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WbsDetail newWbsDetail = new Model.WbsDetail();
|
||||
newWbsDetail.WbsDetailId = wbsDetail.WbsDetailId;
|
||||
newWbsDetail.ToWbs = wbsDetail.ToWbs;
|
||||
newWbsDetail.ToFlag = wbsDetail.ToFlag;
|
||||
newWbsDetail.Way = wbsDetail.Way;
|
||||
newWbsDetail.Months = wbsDetail.Months;
|
||||
newWbsDetail.EngineeringQuantity = wbsDetail.EngineeringQuantity;
|
||||
newWbsDetail.PlanValue = wbsDetail.PlanValue;
|
||||
newWbsDetail.PlanValueRate = wbsDetail.PlanValueRate;
|
||||
newWbsDetail.CompleteValue = wbsDetail.CompleteValue;
|
||||
newWbsDetail.CompleteValueRate = wbsDetail.CompleteValueRate;
|
||||
newWbsDetail.RealValue = wbsDetail.RealValue;
|
||||
newWbsDetail.RealValueRate = wbsDetail.RealValueRate;
|
||||
|
||||
db.WbsDetail.InsertOnSubmit(newWbsDetail);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改WBS明细
|
||||
/// </summary>
|
||||
/// <param name="user">WBS明细</param>
|
||||
public static void UpdateWbsDetail(Model.WbsDetail wbsDetail)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WbsDetail newWbsDetail = db.WbsDetail.First(e => e.WbsDetailId == wbsDetail.WbsDetailId);
|
||||
|
||||
newWbsDetail.EngineeringQuantity = wbsDetail.EngineeringQuantity;
|
||||
newWbsDetail.PlanValue = wbsDetail.PlanValue;
|
||||
newWbsDetail.PlanValueRate = wbsDetail.PlanValueRate;
|
||||
newWbsDetail.CompleteValue = wbsDetail.CompleteValue;
|
||||
newWbsDetail.CompleteValueRate = wbsDetail.CompleteValueRate;
|
||||
newWbsDetail.RealValue = wbsDetail.RealValue;
|
||||
newWbsDetail.RealValueRate = wbsDetail.RealValueRate;
|
||||
newWbsDetail.IsCompleteApprove = wbsDetail.IsCompleteApprove;
|
||||
newWbsDetail.IsRealApprove = wbsDetail.IsRealApprove;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除WBS明细信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsDetail(string wbsDetailId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WbsDetail ins = db.WbsDetail.First(e => e.WbsDetailId == wbsDetailId);
|
||||
db.WbsDetail.DeleteOnSubmit(ins);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据toWbs删除WBS明细信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsDetailByToWbs(string toWbs)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var details = from x in db.WbsDetail where x.ToWbs == toWbs select x;
|
||||
if (details.Count() > 0)
|
||||
{
|
||||
db.WbsDetail.DeleteAllOnSubmit(details);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据月份总数和当前是第几月及总计划费用获取当前月份的计划值
|
||||
/// </summary>
|
||||
/// <param name="monthCount">月份总数</param>
|
||||
/// <param name="monthNum">当前是第几月</param>
|
||||
/// <param name="weightMoney">总计划费用</param>
|
||||
/// <returns>当前月份的计划值</returns>
|
||||
public static decimal GetMonthPlanValueByMonthCountAndMonthNumAndWeightMonth(int monthCount, int monthNum, decimal weightMoney)
|
||||
{
|
||||
decimal monthValue = 0;
|
||||
int halfLevelCount = 0; //一半的阶级总数,比如12个月,则一半共有21个阶级,共21X
|
||||
int levelCount = 0; //总共有多少阶级,比如12个月,则共有42个阶级,共42X
|
||||
int count = 0; //阶级绝对数,比如12个月,则共分为6个阶级,1X,2X,3X,4X,5X,6X
|
||||
decimal oneValue = 0; //每一阶级即X的值
|
||||
if (monthCount % 2 == 0) //月份总数为偶数
|
||||
{
|
||||
count = monthCount / 2;
|
||||
for (int i = 1; i < count + 1; i++)
|
||||
{
|
||||
halfLevelCount += i;
|
||||
}
|
||||
levelCount = halfLevelCount * 2;
|
||||
//oneValue = decimal.Round(Convert.ToDecimal(weightMoney / levelCount), 2);
|
||||
oneValue = decimal.Round(Convert.ToDecimal(Math.Floor((weightMoney * 100) / levelCount) / 100), 2);//不进行四舍五入
|
||||
|
||||
if (monthNum > count) //当前月份大于中间的月份,比如12个月,当前为第8月,则阶级为5X
|
||||
{
|
||||
monthNum = monthCount - monthNum + 1;
|
||||
}
|
||||
monthValue = monthNum * oneValue;
|
||||
}
|
||||
else //月份总数为奇数
|
||||
{
|
||||
count = (monthCount - 1) / 2;
|
||||
for (int i = 1; i < count + 1; i++)
|
||||
{
|
||||
halfLevelCount += i;
|
||||
}
|
||||
levelCount = halfLevelCount * 2 + (count + 1);
|
||||
|
||||
//oneValue = decimal.Round(Convert.ToDecimal(weightMoney / levelCount), 2);
|
||||
oneValue = decimal.Round(Convert.ToDecimal(Math.Floor((weightMoney * 100) / levelCount) / 100), 2);
|
||||
|
||||
if (monthNum > (count + 1)) //当前月份大于中间的月份,比如13个月,当前为第8月,则阶级为6X
|
||||
{
|
||||
monthNum = monthCount - monthNum + 1;
|
||||
}
|
||||
monthValue = monthNum * oneValue;
|
||||
}
|
||||
return monthValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class WbsSetInitService
|
||||
{
|
||||
/// <summary>
|
||||
/// 增加分部/子分部/分项/子分项
|
||||
/// </summary>
|
||||
/// <param name="user">分部/子分部/分项/子分项</param>
|
||||
public static void AddWbsSetInit(Model.WBS_WbsSetInit wbsSetInit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_WbsSetInit newWS = new Model.WBS_WbsSetInit();
|
||||
newWS.WbsSetCode = wbsSetInit.WbsSetCode;
|
||||
newWS.WbsSetName = wbsSetInit.WbsSetName;
|
||||
newWS.CnProfessionId = wbsSetInit.CnProfessionId;
|
||||
newWS.UnitProjectCode = wbsSetInit.UnitProjectCode;
|
||||
newWS.SuperWbsSetCode = wbsSetInit.SuperWbsSetCode;
|
||||
newWS.ControlPoint = wbsSetInit.ControlPoint;
|
||||
newWS.ControlItemDef = wbsSetInit.ControlItemDef;
|
||||
newWS.Flag = wbsSetInit.Flag;
|
||||
newWS.IsIn = wbsSetInit.IsIn;
|
||||
newWS.Way = wbsSetInit.Way;
|
||||
newWS.Remark = wbsSetInit.Remark;
|
||||
|
||||
db.WBS_WbsSetInit.InsertOnSubmit(newWS);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改分部/子分部/分项/子分项
|
||||
/// </summary>
|
||||
/// <param name="user">分部/子分部/分项/子分项</param>
|
||||
public static void UpdateWbsSetInit(Model.WBS_WbsSetInit wbsSetInit)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_WbsSetInit newWS = db.WBS_WbsSetInit.First(e => e.WbsSetCode == wbsSetInit.WbsSetCode);
|
||||
|
||||
newWS.WbsSetName = wbsSetInit.WbsSetName;
|
||||
newWS.ControlPoint = wbsSetInit.ControlPoint;
|
||||
newWS.ControlItemDef = wbsSetInit.ControlItemDef;
|
||||
newWS.Flag = wbsSetInit.Flag;
|
||||
newWS.IsIn = wbsSetInit.IsIn;
|
||||
newWS.Way = wbsSetInit.Way;
|
||||
newWS.Remark = wbsSetInit.Remark;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除分部/子分部/分项/子分项信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsSetInit(string wbsSetCode)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.WBS_WbsSetInit WS = db.WBS_WbsSetInit.First(e => e.WbsSetCode == wbsSetCode);
|
||||
db.WBS_WbsSetInit.DeleteOnSubmit(WS);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程Id删除所有分部/子分部/分项/子分项信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsSetInitByUnitProjectCode(string unitProjectCode)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.WBS_WbsSetInit where x.UnitProjectCode == unitProjectCode select x;
|
||||
db.WBS_WbsSetInit.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取集合
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.WBS_WbsSetInit> GetWbsSetInitsBySuperWbsSetCode(string superWbsSetCode)
|
||||
{
|
||||
return (from x in Funs.DB.WBS_WbsSetInit where x.SuperWbsSetCode == superWbsSetCode orderby x.WbsSetCode select x).ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取当前的节点子节点的数量
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetCode"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetItemCount(string superWbsSetCode)
|
||||
{
|
||||
return Funs.DB.WBS_WbsSetInit.Where(p => p.SuperWbsSetCode.Equals(superWbsSetCode)).Count();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据分部/子分部/分项/子分项工程Id获取分部/子分部/分项/子分项工程信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">分部/子分部/分项/子分项工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.WBS_WbsSetInit GetWbsSetInitByWbsSetCode(string wbsSetCode)
|
||||
{
|
||||
return Funs.DB.WBS_WbsSetInit.FirstOrDefault(e => e.WbsSetCode == wbsSetCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id判断子级中是否存在对应Id
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWbsSetById2(string wbsSetId, string searchId)
|
||||
{
|
||||
List<string> ids = GetWbsSetIds2(wbsSetId);
|
||||
if (ids.Contains(searchId) || wbsSetId == searchId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取所有Id集合
|
||||
/// </summary>
|
||||
/// <param name="wbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetWbsSetIds2(string wbsSetId)
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
var wbsSets = BLL.WbsSetInitService.GetWbsSetInitsBySuperWbsSetCode(wbsSetId);
|
||||
if (wbsSets.Count > 0)
|
||||
{
|
||||
foreach (var wbsSet in wbsSets)
|
||||
{
|
||||
ids.Add(wbsSet.WbsSetCode);
|
||||
ids.AddRange(GetWbsSetIds2(wbsSet.WbsSetCode));
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Data.Linq;
|
||||
using System.Web.Security;
|
||||
using System.Web.UI.WebControls;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class WbsSetService
|
||||
{
|
||||
/// <summary>
|
||||
/// 增加分部/子分部/分项/子分项
|
||||
/// </summary>
|
||||
/// <param name="user">分部/子分部/分项/子分项</param>
|
||||
public static void AddWbsSet(Model.Wbs_WbsSet wbsSet)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_WbsSet newWS = new Model.Wbs_WbsSet();
|
||||
newWS.WbsSetId = wbsSet.WbsSetId;
|
||||
newWS.WbsSetName = wbsSet.WbsSetName;
|
||||
newWS.WbsSetCode = wbsSet.WbsSetCode;
|
||||
newWS.SuperWbsSetId = wbsSet.SuperWbsSetId;
|
||||
newWS.ProjectId = wbsSet.ProjectId;
|
||||
newWS.InstallationId = wbsSet.InstallationId;
|
||||
newWS.CnProfessionId = wbsSet.CnProfessionId;
|
||||
newWS.UnitProjectId = wbsSet.UnitProjectId;
|
||||
newWS.StartDate = wbsSet.StartDate;
|
||||
newWS.EndDate = wbsSet.EndDate;
|
||||
newWS.IsChild = wbsSet.IsChild;
|
||||
newWS.ControlItemDef = wbsSet.ControlItemDef;
|
||||
newWS.ControlPoint = wbsSet.ControlPoint;
|
||||
newWS.Cycle = wbsSet.Cycle;
|
||||
newWS.Frequency = wbsSet.Frequency;
|
||||
newWS.Weights = wbsSet.Weights;
|
||||
newWS.Flag = wbsSet.Flag;
|
||||
newWS.Way = wbsSet.Way;
|
||||
newWS.Remark = wbsSet.Remark;
|
||||
newWS.IsIn = wbsSet.IsIn;
|
||||
newWS.IsSelected = wbsSet.IsSelected;
|
||||
newWS.IsApprove = wbsSet.IsApprove;
|
||||
newWS.EngineerQuantity = wbsSet.EngineerQuantity;
|
||||
newWS.BudgetUnitPrice = wbsSet.BudgetUnitPrice;
|
||||
newWS.CostUnivalent = wbsSet.CostUnivalent;
|
||||
newWS.Unit = wbsSet.Unit;
|
||||
|
||||
db.Wbs_WbsSet.InsertOnSubmit(newWS);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改分部/子分部/分项/子分项
|
||||
/// </summary>
|
||||
/// <param name="user">分部/子分部/分项/子分项</param>
|
||||
public static void UpdateWbsSet(Model.Wbs_WbsSet wbsSet)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_WbsSet newWS = db.Wbs_WbsSet.First(e => e.WbsSetId == wbsSet.WbsSetId);
|
||||
|
||||
newWS.WbsSetName = wbsSet.WbsSetName;
|
||||
newWS.WbsSetCode = wbsSet.WbsSetCode;
|
||||
newWS.StartDate = wbsSet.StartDate;
|
||||
newWS.EndDate = wbsSet.EndDate;
|
||||
newWS.Weights = wbsSet.Weights;
|
||||
newWS.WeightsMoney = wbsSet.WeightsMoney;
|
||||
newWS.Flag = wbsSet.Flag;
|
||||
newWS.Way = wbsSet.Way;
|
||||
newWS.ControlItemDef = wbsSet.ControlItemDef;
|
||||
newWS.ControlPoint = wbsSet.ControlPoint;
|
||||
newWS.Cycle = wbsSet.Cycle;
|
||||
newWS.Frequency = wbsSet.Frequency;
|
||||
newWS.Remark = wbsSet.Remark;
|
||||
newWS.IsSelected = wbsSet.IsSelected;
|
||||
newWS.IsApprove = wbsSet.IsApprove;
|
||||
newWS.IsWeightsApprove = wbsSet.IsWeightsApprove;
|
||||
newWS.IsPlanApprove = wbsSet.IsPlanApprove;
|
||||
newWS.VersionNum = wbsSet.VersionNum;
|
||||
newWS.LastCheckDate = wbsSet.LastCheckDate;
|
||||
newWS.CheckDate = wbsSet.CheckDate;
|
||||
newWS.CheckNum = wbsSet.CheckNum;
|
||||
newWS.HandleType = wbsSet.HandleType;
|
||||
newWS.IsENEnd = wbsSet.IsENEnd;
|
||||
newWS.SortIndex = wbsSet.SortIndex;
|
||||
newWS.NoShow = wbsSet.NoShow;
|
||||
newWS.EngineerQuantity = wbsSet.EngineerQuantity;
|
||||
newWS.BudgetUnitPrice = wbsSet.BudgetUnitPrice;
|
||||
newWS.CostUnivalent = wbsSet.CostUnivalent;
|
||||
newWS.Unit = wbsSet.Unit;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改分部/子分部/分项/子分项
|
||||
/// </summary>
|
||||
/// <param name="user">分部/子分部/分项/子分项</param>
|
||||
public static void UpdateWbsSetIsPlanApprove(Model.Wbs_WbsSet wbsSet, bool isPlanApprove)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_WbsSet newWS = db.Wbs_WbsSet.First(e => e.WbsSetId == wbsSet.WbsSetId);
|
||||
newWS.IsPlanApprove = wbsSet.IsPlanApprove;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id删除分部/子分部/分项/子分项信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsSet(string wbsSetId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.Wbs_WbsSet WS = db.Wbs_WbsSet.First(e => e.WbsSetId == wbsSetId);
|
||||
db.Wbs_WbsSet.DeleteOnSubmit(WS);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位工程Id删除所有分部/子分部/分项/子分项信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
public static void DeleteWbsSetByUnitProjectId(string unitProjectId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = from x in db.Wbs_WbsSet where x.UnitProjectId == unitProjectId select x;
|
||||
db.Wbs_WbsSet.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据装置Id获取集合
|
||||
/// </summary>
|
||||
/// <param name="installationId">装置Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_WbsSet> GetWbsSetsByInstallationId(string installationId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.InstallationId == installationId orderby x.SortIndex, x.WbsSetCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取集合
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_WbsSet> GetWbsSetsBySuperWbsSetId(string superWbsSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == superWbsSetId && x.NoShow == null orderby x.SortIndex, x.WbsSetCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取集合
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_WbsSet> GetIsChildWbsSetsBySuperWbsSetId(string superWbsSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == superWbsSetId && x.IsChild == null orderby x.SortIndex, x.WbsSetCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取子级集合的累计工程量
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">单位工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static decimal GetChildEngineerQuantitys(string superWbsSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == superWbsSetId && x.IsApprove == true select x.EngineerQuantity ?? 0).Sum();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取已经选择的集合
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_WbsSet> GetIsSelectedWbsSetsBySuperWbsSetId(string superWbsSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == superWbsSetId && x.IsApprove == true && x.NoShow == null orderby x.SortIndex, x.WbsSetCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据级别获取末级项集合
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_WbsSet> GetWbsSetsByControlPoint(string installationId, string controlPoint)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet
|
||||
join y in Funs.DB.WBS_CnProfession on x.CnProfessionId equals y.CnProfessionId
|
||||
where y.InstallationId == installationId && x.ControlPoint == controlPoint
|
||||
orderby x.SortIndex, x.WbsSetCode
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id判断子级中是否存在对应Id
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWbsSetById(string wbsSetId, string searchId)
|
||||
{
|
||||
List<string> ids = GetWbsSetIds(wbsSetId);
|
||||
if (ids.Contains(searchId) || wbsSetId == searchId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据Id判断子级中是否存在对应Id
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExitWbsSetById2(string wbsSetId, string searchId)
|
||||
{
|
||||
List<string> ids = GetWbsSetIds2(wbsSetId);
|
||||
if (ids.Contains(searchId) || wbsSetId == searchId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取所有Id集合
|
||||
/// </summary>
|
||||
/// <param name="wbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetWbsSetIds(string wbsSetId)
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
var wbsSets = BLL.WbsSetService.GetApproveWbsSetsBySuperWbsSetId(wbsSetId);
|
||||
if (wbsSets.Count > 0)
|
||||
{
|
||||
foreach (var wbsSet in wbsSets)
|
||||
{
|
||||
ids.Add(wbsSet.WbsSetId);
|
||||
ids.AddRange(GetWbsSetIds(wbsSet.WbsSetId));
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据子级Id获取所有上级Id集合
|
||||
/// </summary>
|
||||
/// <param name="wbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetParentWbsSetIds(string superWbsSetId)
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
Model.Wbs_WbsSet wbsSet = BLL.WbsSetService.GetWbsSetByWbsSetId(superWbsSetId);
|
||||
if (wbsSet != null)
|
||||
{
|
||||
ids.Add(wbsSet.WbsSetId);
|
||||
ids.AddRange(GetParentWbsSetIds(wbsSet.SuperWbsSetId));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取所有Id集合
|
||||
/// </summary>
|
||||
/// <param name="wbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> GetWbsSetIds2(string wbsSetId)
|
||||
{
|
||||
List<string> ids = new List<string>();
|
||||
var wbsSets = BLL.WbsSetService.GetWbsSetsBySuperWbsSetId(wbsSetId);
|
||||
if (wbsSets.Count > 0)
|
||||
{
|
||||
foreach (var wbsSet in wbsSets)
|
||||
{
|
||||
ids.Add(wbsSet.WbsSetId);
|
||||
ids.AddRange(GetWbsSetIds2(wbsSet.WbsSetId));
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据上级Id获取审核批准的集合
|
||||
/// </summary>
|
||||
/// <param name="superWbsSetId">上级Id</param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.Wbs_WbsSet> GetApproveWbsSetsBySuperWbsSetId(string superWbsSetId)
|
||||
{
|
||||
return (from x in Funs.DB.Wbs_WbsSet where x.SuperWbsSetId == superWbsSetId && x.IsApprove == true && x.NoShow == null orderby x.SortIndex, x.WbsSetCode select x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据分部/子分部/分项/子分项工程Id获取分部/子分部/分项/子分项工程信息
|
||||
/// </summary>
|
||||
/// <param name="unitProjectId">分部/子分部/分项/子分项工程Id</param>
|
||||
/// <returns></returns>
|
||||
public static Model.Wbs_WbsSet GetWbsSetByWbsSetId(string wbsSetId)
|
||||
{
|
||||
return Funs.DB.Wbs_WbsSet.FirstOrDefault(e => e.WbsSetId == wbsSetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user