20230606新增费用申请页面、项目列表按活跃度排序

This commit is contained in:
2023-06-06 17:01:34 +08:00
parent 5984687629
commit e4871bc690
105 changed files with 63242 additions and 2216 deletions
+59 -1
View File
@@ -71,12 +71,70 @@ namespace BLL
}
/// <summary>
/// 获取费用类型下拉列表项
///
/// </summary>
/// <param name="costTypeItemId"></param>
/// <returns></returns>
public static Model.Base_CostTypeItem GetCostTypeItemById(string costTypeItemId)
{
return Funs.DB.Base_CostTypeItem.FirstOrDefault(e => e.CostTypeItemId == costTypeItemId);
}
/// <summary>
/// 获取费用类型下拉列表
/// </summary>
/// <returns></returns>
public static List<Model.Base_CostType> GetCostTypeList()
{
return (from x in Funs.DB.Base_CostType orderby x.CostTypeCode select x).ToList();
}
/// <summary>
/// 获取费用类型明细项下拉列表
/// </summary>
/// <param name="costTypeId"></param>
/// <returns></returns>
public static List<Model.Base_CostTypeItem> GetCostTypeItemList(string costTypeId)
{
return (from x in Funs.DB.Base_CostTypeItem
where x.CostTypeId == costTypeId
orderby x.SortIndex
select x).ToList();
}
/// <summary>
/// 费用类型下拉框
/// </summary>
/// <param name="dropName">下拉框名字</param>
/// <param name="isShowPlease">是否显示请选择</param>
public static void InitCostTypeDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "CostTypeId";
dropName.DataTextField = "CostTypeName";
dropName.DataSource = GetCostTypeList();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
/// <summary>
/// 费用类型下拉框
/// </summary>
/// <param name="dropName">下拉框名字</param>
/// <param name="isShowPlease">是否显示请选择</param>
public static void InitCostTypeItemDropDownList(FineUIPro.DropDownList dropName,string costTypeId, bool isShowPlease)
{
dropName.Items.Clear();
dropName.DataValueField = "CostTypeItemId";
dropName.DataTextField = "CostTypeItemName";
dropName.DataSource = GetCostTypeItemList(costTypeId);
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
}
}
+52 -104
View File
@@ -32,42 +32,32 @@ namespace BLL
return (from x in Funs.DB.CostGoods_CostManageItem where x.CostManageId == costManageId select x).ToList();
}
/// <summary>
/// 根据项目Id,单位Id和月份获取安全费用管理明细
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
public static List<Model.CostGoods_CostManageItem> GetCostManageItemByUnitIdAndDate(string projectId, string unidId, DateTime date)
{
return (from x in Funs.DB.CostGoods_CostManageItem
join y in Funs.DB.CostGoods_CostManage
on x.CostManageId equals y.CostManageId
where y.ProjectId == projectId && y.UnitId == unidId
&& y.CostManageDate.Value.Year == date.Year && y.CostManageDate.Value.Month == date.Month
select x).ToList();
}
/// <summary>
/// 添加费用管理明细
/// </summary>
/// <param name="costManageItem"></param>
public static void AddCostManageItem(Model.CostGoods_CostManageItem costManageItem)
{
Model.SGGLDB db = Funs.DB;
Model.CostGoods_CostManageItem newCostManageItem = new Model.CostGoods_CostManageItem
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
CostManageItemId = costManageItem.CostManageItemId,
CostManageId = costManageItem.CostManageId,
InvestCostProject = costManageItem.InvestCostProject,
UseReason = costManageItem.UseReason,
Counts = costManageItem.Counts,
PriceMoney = costManageItem.PriceMoney,
AuditCounts = costManageItem.AuditCounts,
AuditPriceMoney = costManageItem.AuditPriceMoney,
Remark = costManageItem.Remark
};
db.CostGoods_CostManageItem.InsertOnSubmit(newCostManageItem);
db.SubmitChanges();
Model.CostGoods_CostManageItem newCostManageItem = new Model.CostGoods_CostManageItem
{
CostManageItemId = costManageItem.CostManageItemId,
CostManageId = costManageItem.CostManageId,
InvestCostProject = costManageItem.InvestCostProject,
PriceMoney = costManageItem.PriceMoney,
SupCostTypeId = costManageItem.SupCostTypeId,
SupCostTypeName = costManageItem.SupCostTypeName,
SupSortIndex = costManageItem.SupSortIndex,
CostTypeId = costManageItem.CostTypeId,
CostTypeName = costManageItem.CostTypeName,
SortIndex = costManageItem.SortIndex,
};
db.CostGoods_CostManageItem.InsertOnSubmit(newCostManageItem);
db.SubmitChanges();
CostManageService.UpdateSumMoney(newCostManageItem.CostManageId);
}
}
/// <summary>
@@ -76,19 +66,23 @@ namespace BLL
/// <param name="costManageItem"></param>
public static void UpdateCostManageItem(Model.CostGoods_CostManageItem costManageItem)
{
Model.SGGLDB db = Funs.DB;
Model.CostGoods_CostManageItem newCostManageItem = db.CostGoods_CostManageItem.FirstOrDefault(e => e.CostManageItemId == costManageItem.CostManageItemId);
if (newCostManageItem != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
newCostManageItem.CostManageId = costManageItem.CostManageId;
newCostManageItem.InvestCostProject = costManageItem.InvestCostProject;
newCostManageItem.UseReason = costManageItem.UseReason;
newCostManageItem.Counts = costManageItem.Counts;
newCostManageItem.PriceMoney = costManageItem.PriceMoney;
newCostManageItem.AuditCounts = costManageItem.AuditCounts;
newCostManageItem.AuditPriceMoney = costManageItem.AuditPriceMoney;
newCostManageItem.Remark = costManageItem.Remark;
db.SubmitChanges();
Model.CostGoods_CostManageItem newCostManageItem = db.CostGoods_CostManageItem.FirstOrDefault(e => e.CostManageItemId == costManageItem.CostManageItemId);
if (newCostManageItem != null)
{
newCostManageItem.InvestCostProject = costManageItem.InvestCostProject;
newCostManageItem.PriceMoney = costManageItem.PriceMoney;
newCostManageItem.SupCostTypeId = costManageItem.SupCostTypeId;
newCostManageItem.SupCostTypeName = costManageItem.SupCostTypeName;
newCostManageItem.SupSortIndex = costManageItem.SupSortIndex;
newCostManageItem.CostTypeId = costManageItem.CostTypeId;
newCostManageItem.CostTypeName = costManageItem.CostTypeName;
newCostManageItem.SortIndex = costManageItem.SortIndex;
db.SubmitChanges();
CostManageService.UpdateSumMoney(newCostManageItem.CostManageId);
}
}
}
@@ -98,12 +92,16 @@ namespace BLL
/// <param name="costManageId"></param>
public static void DeleteCostManageItemByCostManageId(string costManageId)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.CostGoods_CostManageItem where x.CostManageId == costManageId select x).ToList();
if (q != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.CostGoods_CostManageItem.DeleteAllOnSubmit(q);
db.SubmitChanges();
var q = (from x in db.CostGoods_CostManageItem where x.CostManageId == costManageId select x).ToList();
if (q != null)
{
db.CostGoods_CostManageItem.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
CostManageService.UpdateSumMoney(costManageId);
}
}
@@ -113,67 +111,17 @@ namespace BLL
/// <param name="costManageItemId"></param>
public static void DeleteCostManageItemById(string costManageItemId)
{
Model.SGGLDB db = Funs.DB;
Model.CostGoods_CostManageItem costManageItem = db.CostGoods_CostManageItem.FirstOrDefault(e => e.CostManageItemId == costManageItemId);
if (costManageItem != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.CostGoods_CostManageItem.DeleteOnSubmit(costManageItem);
db.SubmitChanges();
}
}
Model.CostGoods_CostManageItem costManageItem = db.CostGoods_CostManageItem.FirstOrDefault(e => e.CostManageItemId == costManageItemId);
if (costManageItem != null)
{
db.CostGoods_CostManageItem.DeleteOnSubmit(costManageItem);
db.SubmitChanges();
/// <summary>
/// 投入费用项目下拉框内容
/// </summary>
/// <returns></returns>
public static ListItem[] GetInvestCostProjectList()
{
ListItem[] lis = new ListItem[29];
lis[0] = new ListItem("内业管理", "内业管理");
lis[1] = new ListItem("检测器材", "检测器材");
lis[2] = new ListItem("警示警戒", "警示警戒");
lis[3] = new ListItem("安全奖励", "安全奖励");
lis[4] = new ListItem("其他", "其他");
lis[5] = new ListItem("安全技术", "安全技术");
lis[6] = new ListItem("工业卫生", "工业卫生");
lis[7] = new ListItem("安全用电", "安全用电");
lis[8] = new ListItem("高处作业及基坑", "高处作业及基坑");
lis[9] = new ListItem("临边洞口防护", "临边洞口防护");
lis[10] = new ListItem("受限空间内作业", "受限空间内作业");
lis[11] = new ListItem("动火作业", "动火作业");
lis[12] = new ListItem("机械装备防护", "机械装备防护");
lis[13] = new ListItem("吊装运输和起重", "吊装运输和起重");
lis[14] = new ListItem("硼砂作业", "硼砂作业");
lis[15] = new ListItem("拆除工程", "拆除工程");
lis[16] = new ListItem("试压试车与有害介质作业", "试压试车与有害介质作业");
lis[17] = new ListItem("特种作业防护", "特种作业防护");
lis[18] = new ListItem("应急管理", "应急管理");
lis[19] = new ListItem("非常措施", "非常措施");
lis[20] = new ListItem("其他安全措施", "其他安全措施");
lis[21] = new ListItem("装置区封闭管理", "装置区封闭管理");
lis[22] = new ListItem("防爆施工器具", "防爆施工器具");
lis[23] = new ListItem("标识标签与锁定", "标识标签与锁定");
lis[24] = new ListItem("关键场所封闭", "关键场所封闭");
lis[25] = new ListItem("催化剂加装还原", "催化剂加装还原");
lis[26] = new ListItem("联动和化工试车", "联动和化工试车");
lis[27] = new ListItem("教育培训", "教育培训");
lis[28] = new ListItem("防护控制和排放", "防护控制和排放");
return lis;
}
public static decimal? GetCostsByUnitId(string unitId, DateTime startTime, DateTime endTime)
{
Model.SGGLDB db = Funs.DB;
var q = (from x in db.CostGoods_CostManageItem
join y in db.CostGoods_CostManage
on x.CostManageId equals y.CostManageId
where y.UnitId == unitId && y.States == BLL.Const.State_2 && y.CostManageDate >= startTime && y.CostManageDate < endTime
select x).ToList();
if (q.Count > 0)
{
return q.Sum(e => (e.AuditCounts * e.AuditPriceMoney));
CostManageService.UpdateSumMoney(costManageItem.CostManageId);
}
}
return null;
}
}
}
+312 -50
View File
@@ -1,4 +1,8 @@
using System;
using Microsoft.SqlServer.Dts.Runtime;
using Model;
using NPOI.SS.UserModel;
using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
@@ -21,13 +25,26 @@ namespace BLL
}
/// <summary>
/// 根据项目Id,单位Id和月份获取安全费用管理
/// 获取 已支付的HSE费用
/// </summary>
/// <param name="costManageId"></param>
/// <param name="ProjectId"></param>
/// <param name="UnitId"></param>
/// <returns></returns>
public static Model.CostGoods_CostManage GetCostManageByUnitIdAndDate(string projectId, string unidId, DateTime date)
public static decimal GetSumHSECost(string ProjectId, string UnitId, string costManageId )
{
return Funs.DB.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == projectId && e.UnitId == unidId && e.CostManageDate.Value.Year == date.Year && e.CostManageDate.Value.Month == date.Month);
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
decimal sumCost = 0;
var getData = from x in db.CostGoods_CostManage
where x.ProjectId == ProjectId && x.UnitId == UnitId && x.States == Const.State_2 && x.CostManageId != costManageId
select x;
if (getData.Count() > 0)
{
sumCost = getData.Sum(x => x.SumMoney ?? 0);
}
return sumCost;
}
}
/// <summary>
@@ -36,26 +53,32 @@ namespace BLL
/// <param name="costManage"></param>
public static void AddCostManage(Model.CostGoods_CostManage costManage)
{
Model.SGGLDB db = Funs.DB;
Model.CostGoods_CostManage newCostManage = new Model.CostGoods_CostManage
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
CostManageId = costManage.CostManageId,
ProjectId = costManage.ProjectId,
CostManageCode = costManage.CostManageCode,
CostManageName = costManage.CostManageName,
UnitId = costManage.UnitId,
ContractNum = costManage.ContractNum,
CostManageDate = costManage.CostManageDate,
Opinion = costManage.Opinion,
SubCN = costManage.SubCN,
SubHSE = costManage.SubHSE,
SubProject = costManage.SubProject,
States = costManage.States,
CompileMan = costManage.CompileMan,
CompileDate = costManage.CompileDate
};
db.CostGoods_CostManage.InsertOnSubmit(newCostManage);
db.SubmitChanges();
Model.CostGoods_CostManage newCostManage = new Model.CostGoods_CostManage
{
CostManageId = costManage.CostManageId,
ProjectId = costManage.ProjectId,
CostManageCode = costManage.CostManageCode,
CostManageName = costManage.CostManageName,
UnitId = costManage.UnitId,
ContractNum = costManage.ContractNum,
CostManageDate = costManage.CostManageDate,
Opinion = costManage.Opinion,
SubCN = costManage.SubCN,
SubHSE = costManage.SubHSE,
SubProject = costManage.SubProject,
States = costManage.States,
CompileMan = costManage.CompileMan,
CompileDate = costManage.CompileDate
};
db.CostGoods_CostManage.InsertOnSubmit(newCostManage);
db.SubmitChanges();
AddCostManageFlowOperate(newCostManage);
}
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectCostManageMenuId, costManage.ProjectId, null, costManage.CostManageId, costManage.CompileDate);
}
@@ -65,24 +88,25 @@ namespace BLL
/// <param name="costManage"></param>
public static void UpdateCostManage(Model.CostGoods_CostManage costManage)
{
Model.SGGLDB db = Funs.DB;
Model.CostGoods_CostManage newCostManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManage.CostManageId);
if (newCostManage != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
//newCostManage.ProjectId = costManage.ProjectId;
newCostManage.CostManageCode = costManage.CostManageCode;
newCostManage.CostManageName = costManage.CostManageName;
newCostManage.UnitId = costManage.UnitId;
newCostManage.ContractNum = costManage.ContractNum;
newCostManage.CostManageDate = costManage.CostManageDate;
newCostManage.Opinion = costManage.Opinion;
newCostManage.SubCN = costManage.SubCN;
newCostManage.SubHSE = costManage.SubHSE;
newCostManage.SubProject = costManage.SubProject;
newCostManage.States = costManage.States;
newCostManage.CompileMan = costManage.CompileMan;
newCostManage.CompileDate = costManage.CompileDate;
db.SubmitChanges();
Model.CostGoods_CostManage newCostManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManage.CostManageId);
if (newCostManage != null)
{
//newCostManage.ProjectId = costManage.ProjectId;
newCostManage.CostManageName = costManage.CostManageName;
newCostManage.UnitId = costManage.UnitId;
newCostManage.ContractNum = costManage.ContractNum;
newCostManage.CostManageDate = costManage.CostManageDate;
newCostManage.Opinion = costManage.Opinion;
newCostManage.SubCN = costManage.SubCN;
newCostManage.SubHSE = costManage.SubHSE;
newCostManage.SubProject = costManage.SubProject;
newCostManage.States = costManage.States;
newCostManage.CompileMan = costManage.CompileMan;
newCostManage.CompileDate = costManage.CompileDate;
db.SubmitChanges();
}
}
}
@@ -92,16 +116,254 @@ namespace BLL
/// <param name="costManageId"></param>
public static void DeleteCostManageById(string costManageId)
{
Model.SGGLDB db = Funs.DB;
Model.CostGoods_CostManage costManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManageId);
if (costManage != null)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
CodeRecordsService.DeleteCodeRecordsByDataId(costManageId);//删除编号
ProjectDataFlowSetService.DeleteFlowSetByDataId(costManageId);//删除流程
CommonService.DeleteFlowOperateByID(costManageId); //删除审核流程
CommonService.DeleteAttachFileById(costManageId);//删除附件
db.CostGoods_CostManage.DeleteOnSubmit(costManage);
db.SubmitChanges();
var costManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManageId);
if (costManage != null)
{
deleteCostManageFlowOperate(costManageId);
CommonService.DeleteAttachFileById(costManageId);//删除附件
db.CostGoods_CostManage.DeleteOnSubmit(costManage);
db.SubmitChanges();
}
}
}
/// <summary>
/// 按照明细取当前单据总费用
/// </summary>
/// <param name="costManageId"></param>
public static void UpdateSumMoney(string costManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var costManage = db.CostGoods_CostManage.FirstOrDefault(e => e.CostManageId == costManageId);
if (costManage != null)
{
decimal sumC = 0;
var getItems = db.CostGoods_CostManageItem.Where(x => x.CostManageId == costManageId);
if (getItems.Count() > 0)
{
sumC = getItems.Sum(x => x.PriceMoney ?? 0);
}
costManage.SumMoney = sumC;
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据主表ID获取审核列表
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
public static List<Model.CostGoods_CostManageFlowOperate> getCostManageFlowOperateList(string costManageId)
{
return (from x in Funs.DB.CostGoods_CostManageFlowOperate
where x.CostManageId == costManageId
orderby x.SortIndex
select x).ToList();
}
/// <summary>
/// 获取当前步骤审核人
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
public static Model.CostGoods_CostManageFlowOperate getNowCostManageFlowOperateList(string costManageId)
{
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
if (getAllNoClose.Count() > 0)
{
var minSortIndex = getAllNoClose.Min(x => x.SortIndex) ?? 0;
return getAllNoClose.FirstOrDefault(x => x.SortIndex == minSortIndex);
}
else
{
return null;
}
}
/// <summary>
/// 获取下一步审核人
/// </summary>
/// <param name="costManageId"></param>
/// <returns></returns>
public static Model.CostGoods_CostManageFlowOperate getNextCostManageFlowOperateList(string costManageId,string operaterId)
{
int minSortIndex = 1;
var getAllNoClose = Funs.DB.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && (x.IsClosed == null || x.IsClosed == false));
if (getAllNoClose.Count() > 0)
{
var getFlowOperate = getAllNoClose.Where(x => x.OperaterId == operaterId);
if (getFlowOperate.Count() > 0)
{
minSortIndex = (getFlowOperate.Min(x => x.SortIndex) ?? 0) + 1;
}
else
{
minSortIndex = getAllNoClose.Min(x => x.SortIndex) ?? 1;
}
return getAllNoClose.FirstOrDefault(x => x.SortIndex == minSortIndex);
}
else
{
return null;
}
}
/// <summary>
/// 根据新增费用申请表 自动生成审核流程表
/// </summary>
public static void AddCostManageFlowOperate(Model.CostGoods_CostManage costManage)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
List<Model.CostGoods_CostManageFlowOperate> flowList = new List<CostGoods_CostManageFlowOperate>();
/// 施工单位
if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(costManage.ProjectId, costManage.UnitId))
{
string cUnitId = Const.UnitId_SEDIN;
var getUnit = db.Project_ProjectUnit.FirstOrDefault(x => x.ProjectId == costManage.ProjectId && x.UnitType == Const.ProjectUnitType_1);
if (getUnit != null && !string.IsNullOrEmpty(getUnit.UnitId))
{
cUnitId = getUnit.UnitId;
}
//// 分包单位项目经理审批、总包单位HSE经理审核、总包单位项目控制经理审核、总包单位项目经理审批
var Flow1 = new CostGoods_CostManageFlowOperate()
{
FlowOperateId = SQLHelper.GetNewID(),
CostManageId = costManage.CostManageId,
AuditFlowName = "分包单位项目经理审批",
SortIndex = 1,
UnitId = costManage.UnitId,
IsClosed = false,
};
flowList.Add(Flow1);
var Flow2 = new CostGoods_CostManageFlowOperate()
{
FlowOperateId = SQLHelper.GetNewID(),
CostManageId = costManage.CostManageId,
AuditFlowName = "总包单位HSE经理审核",
SortIndex = 2,
UnitId = cUnitId,
IsClosed = false,
};
flowList.Add(Flow2);
var Flow3 = new CostGoods_CostManageFlowOperate()
{
FlowOperateId = SQLHelper.GetNewID(),
CostManageId = costManage.CostManageId,
AuditFlowName = "总包单位项目控制经理审核",
SortIndex = 3,
UnitId = cUnitId,
IsClosed = false,
};
flowList.Add(Flow3);
var Flow4 = new CostGoods_CostManageFlowOperate()
{
FlowOperateId = SQLHelper.GetNewID(),
CostManageId = costManage.CostManageId,
AuditFlowName = "总包单位项目经理审批",
SortIndex = 4,
UnitId = cUnitId,
IsClosed = false,
};
flowList.Add(Flow4);
}
else ///非施工单位
{
////安全工程师发起、安全经理审核、项目经理批准
var Flow1 = new CostGoods_CostManageFlowOperate()
{
FlowOperateId = SQLHelper.GetNewID(),
CostManageId = costManage.CostManageId,
AuditFlowName = "安全经理审核",
SortIndex = 1,
UnitId = costManage.UnitId,
IsClosed = false,
};
flowList.Add(Flow1);
var Flow2 = new CostGoods_CostManageFlowOperate()
{
FlowOperateId = SQLHelper.GetNewID(),
CostManageId = costManage.CostManageId,
AuditFlowName = "项目经理批准",
SortIndex = 2,
UnitId = costManage.UnitId,
IsClosed = false,
};
flowList.Add(Flow2);
}
if (flowList.Count() > 0)
{
db.CostGoods_CostManageFlowOperate.InsertAllOnSubmit(flowList);
db.SubmitChanges();
}
}
}
/// <summary>
/// 审核意见更新
/// </summary>
/// <param name="flow"></param>
public static void updateCostManageFlowOperate(Model.CostGoods_CostManageFlowOperate flow)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getData = db.CostGoods_CostManageFlowOperate.FirstOrDefault(x => x.FlowOperateId == flow.FlowOperateId);
if (getData != null)
{
getData.OperaterId = flow.OperaterId;
getData.OperaterTime = flow.OperaterTime;
getData.IsAgree = flow.IsAgree;
getData.Opinion = flow.Opinion;
getData.IsClosed = flow.IsClosed;
db.SubmitChanges();
}
}
}
/// <summary>
/// 所以关闭步骤 打开
/// </summary>
/// <param name="flow"></param>
public static void updateOpenCostManageFlowOperate(string costManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDatas = db.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId && x.IsClosed==true);
foreach ( var item in getDatas)
{
item.IsClosed= false;
db.SubmitChanges();
}
}
}
/// <summary>
///
/// </summary>
/// <param name="costMangeId"></param>
public static void deleteCostManageFlowOperate(string costManageId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getData = db.CostGoods_CostManageFlowOperate.Where(x => x.CostManageId == costManageId);
if (getData.Count() > 0)
{
db.CostGoods_CostManageFlowOperate.DeleteAllOnSubmit(getData);
db.SubmitChanges();
}
}
}
}
+12 -9
View File
@@ -466,21 +466,24 @@ namespace BLL
IQueryable<Model.SpSysUserItem> users = null;
if (!string.IsNullOrEmpty(projectId))
{
var getSitepersons = from x in db.SitePerson_Person
join p in db.Person_Persons on x.PersonId equals p.PersonId
where x.ProjectId == projectId && x.States == Const.State_1 && x.RoleIds != null && p.Account != null
select x;
List<Model.SpSysUserItem> returUsers = new List<Model.SpSysUserItem>();
List<Model.SitePerson_Person> getPUser = new List<Model.SitePerson_Person>();
if (!string.IsNullOrEmpty(unitId))
{
getPUser = (from x in db.SitePerson_Person
/// 为啥 有单位id 还判断单位类型
/// (u.UnitId == unitId || u.UnitType == BLL.Const.ProjectUnitType_1 || u.UnitType == BLL.Const.ProjectUnitType_3 || u.UnitType == BLL.Const.ProjectUnitType_4)
getPUser = (from x in getSitepersons
join u in db.Project_ProjectUnit on new { x.ProjectId, x.UnitId } equals new { u.ProjectId, u.UnitId }
where x.ProjectId == projectId && (u.UnitId == unitId || u.UnitType == BLL.Const.ProjectUnitType_1 || u.UnitType == BLL.Const.ProjectUnitType_3 || u.UnitType == BLL.Const.ProjectUnitType_4)
&& x.States == Const.State_1
where x.UnitId == unitId
select x).ToList();
}
else
{
getPUser = (from x in db.SitePerson_Person
where x.ProjectId == projectId && x.States == Const.State_1
select x).ToList();
getPUser = getSitepersons.ToList();
}
if (getPUser.Count() > 0)
@@ -504,12 +507,12 @@ namespace BLL
return returUsers;
}
else
{
{
if (!string.IsNullOrEmpty(unitId))
{
users = (from x in db.Person_Persons
join z in db.Sys_Role on x.RoleIds equals z.RoleId
where (x.IsPost == true || !x.IsPost.HasValue) && x.UnitId == unitId
where (x.IsPost == true || !x.IsPost.HasValue) && x.UnitId == unitId && x.Account != null && x.RoleIds != null
orderby x.JobNum
select new Model.SpSysUserItem
{
@@ -521,7 +524,7 @@ namespace BLL
{
users = (from x in db.Person_Persons
join z in db.Sys_Role on x.RoleIds equals z.RoleId
where (x.IsPost == true || !x.IsPost.HasValue)
where (x.IsPost == true || !x.IsPost.HasValue) && x.Account != null && x.RoleIds != null
orderby x.JobNum
select new Model.SpSysUserItem
{
+72 -16
View File
@@ -1,8 +1,10 @@
namespace BLL
{
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
public static class ProjectService
{
@@ -272,31 +274,85 @@
orderby x.ProjectCode descending
select x).ToList();
}
List<Model.Base_Project> getLists = new List<Model.Base_Project>();
var getUser = Person_PersonsService.GetPerson_PersonsById(userId);
if (getUser != null)
if (getUser != null && !string.IsNullOrEmpty(getUser.Account))
{
List<string> roleidList = Funs.GetStrListByStr(getUser.RoleIds, ',');
/// 获取角色类型
var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false);
if (getRoleP != null)
//List<string> roleidList = Funs.GetStrListByStr(getUser.RoleIds, ',');
///// 获取角色类型
//var getRoleP = Funs.DB.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false);
if (getUser.IsOffice == true)
{
return (from x in Funs.DB.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1
orderby x.ProjectCode descending
select x).ToList();
getLists = (from x in Funs.DB.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1
orderby x.ProjectCode descending
select x).ToList();
}
else
{
return (from x in Funs.DB.Base_Project
join y in Funs.DB.SitePerson_Person on x.ProjectId equals y.ProjectId
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1 && y.PersonId == userId
orderby x.ProjectCode descending
select x).ToList();
var getProjectIdList = Funs.DB.SitePerson_Person.Where(x => x.PersonId == userId && x.RoleIds != null).Select(x => x.ProjectId);
if (getProjectIdList.Count() > 0)
{
getLists = (from x in Funs.DB.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1 && getProjectIdList.Contains(x.ProjectId)
orderby x.ProjectCode descending
select x).ToList();
}
}
}
else
return getLists;
}
/// <summary>
/// 获取userId参与项目下拉框 -- 按操作频率排序
/// </summary>
/// <returns></returns>
public static List<Model.Base_Project> GetSortIndexProjectByUserIdDropDownList(string userId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
return null;
IQueryable<Model.Base_Project> getProjects = null;
getProjects = from x in db.Base_Project
where x.ProjectState == null || x.ProjectState == BLL.Const.ProjectState_1
select x;
if (userId != Const.sysglyId && userId != Const.hfnbdId && userId != Const.sedinId)
{
var getUser = Person_PersonsService.GetPerson_PersonsById(userId);
if (getUser != null && !string.IsNullOrEmpty(getUser.Account))
{
//List<string> roleidList = Funs.GetStrListByStr(getUser.RoleIds, ',');
///// 获取角色类型
//var getRoleP = db.Sys_RolePower.FirstOrDefault(x => roleidList.Contains(x.RoleId) && x.IsOffice == false);
if (getUser.IsOffice != true)
{
var getProjectIdList = db.SitePerson_Person.Where(x => x.PersonId == userId && x.RoleIds != null).Select(x => x.ProjectId);
if (getProjectIdList.Count() > 0)
{
getProjects = getProjects.Where(x => getProjectIdList.Contains(x.ProjectId));
}
}
}
}
var pcount = from x in db.Sys_Log
where x.ProjectId != null && x.OperationTime > DateTime.Now.AddDays(-3)
group x by x.ProjectId into g
select new { g.First().ProjectId, count = g.Count() };
List<Model.Base_Project> getList = new List<Base_Project>();
if (getProjects.Count() > 0)
{
getList = (from x in getProjects
join y in pcount on x.ProjectId equals y.ProjectId into PP
from p in PP.DefaultIfEmpty()
orderby p.count descending
select x).ToList();
}
return getList;
}
}
+108
View File
@@ -195,5 +195,113 @@
orderby x.UnitType, y.UnitCode
select x).ToList();
}
#region
/// <summary>
///获取项目单位信息
/// </summary>
/// <returns></returns>
public static Model.Project_ProjectUnitItem GetProjectUnitItemById(string ProjectUnitItemId)
{
return Funs.DB.Project_ProjectUnitItem.FirstOrDefault(e => e.ProjectUnitItemId == ProjectUnitItemId);
}
/// <summary>
///
/// </summary>
/// <param name="ProjectId"></param>
/// <param name="UnitId"></param>
/// <returns></returns>
public static List<Model.Project_ProjectUnitItem> GetProjectUnitItemList(string ProjectId, string UnitId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getData = from x in db.Project_ProjectUnitItem where x.ProjectId == ProjectId && x.UnitId == UnitId select x;
return getData.ToList();
}
}
/// <summary>
/// 获取 总HSE费用
/// </summary>
/// <param name="ProjectId"></param>
/// <param name="UnitId"></param>
/// <returns></returns>
public static decimal GetSumHSECost(string ProjectId, string UnitId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
decimal sumCost = 0;
var getData = from x in db.Project_ProjectUnitItem where x.ProjectId == ProjectId && x.UnitId == UnitId select x;
if (getData.Count() > 0)
{
sumCost = getData.Sum(x => x.HSEMoney ?? 0);
}
return sumCost;
}
}
/// <summary>
/// 增加项目单位信息
/// </summary>
/// <returns></returns>
public static void AddProjectUnitItem(Project_ProjectUnitItem projectUnit)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Project_ProjectUnitItem newProjectUnit = new Project_ProjectUnitItem
{
ProjectUnitItemId = SQLHelper.GetNewID(),
ProjectId = projectUnit.ProjectId,
UnitId = projectUnit.UnitId,
ContractNum = projectUnit.ContractNum,
TotalMoney = projectUnit.TotalMoney,
HSEMoney = projectUnit.HSEMoney,
CompileManId = projectUnit.CompileManId,
CompileDate = projectUnit.CompileDate,
};
db.Project_ProjectUnitItem.InsertOnSubmit(newProjectUnit);
db.SubmitChanges();
}
}
/// <summary>
///修改项目单位信息
/// </summary>
/// <param name="projectUnit"></param>
public static void UpdateProjectUnitItem(Model.Project_ProjectUnitItem projectUnit)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_ProjectUnitItem newProjectUnit = db.Project_ProjectUnitItem.FirstOrDefault(e => e.ProjectUnitItemId == projectUnit.ProjectUnitItemId);
if (newProjectUnit != null)
{
newProjectUnit.ContractNum = projectUnit.ContractNum;
newProjectUnit.TotalMoney = projectUnit.TotalMoney;
newProjectUnit.HSEMoney = projectUnit.HSEMoney;
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据项目单位Id删除一个项目单位信息
/// </summary>
/// <param name="projectUnitId"></param>
public static void DeleteProjectUnitItemById(string ProjectUnitItemId)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Project_ProjectUnitItem delProjectUnit = db.Project_ProjectUnitItem.FirstOrDefault(e => e.ProjectUnitItemId == ProjectUnitItemId);
if (delProjectUnit != null)
{
db.Project_ProjectUnitItem.DeleteOnSubmit(delProjectUnit);
db.SubmitChanges();
}
}
}
#endregion
}
}