202305291、修改奖励通知单、奖惩通知单。
This commit is contained in:
@@ -80,11 +80,11 @@
|
||||
var getUser = db.Person_Persons.FirstOrDefault(x => x.PersonId == personId);
|
||||
if (getUser != null && !string.IsNullOrEmpty(getUser.OpenId))
|
||||
{
|
||||
if (thing2.Length > 20)
|
||||
if (!string.IsNullOrEmpty(thing2) && thing2.Length > 20)
|
||||
{
|
||||
thing2 = thing2.Substring(0, 20);
|
||||
}
|
||||
if (name1.Length > 10)
|
||||
if (!string.IsNullOrEmpty(name1) && name1.Length > 10)
|
||||
{
|
||||
name1 = name1.Substring(0, 10);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace BLL
|
||||
person.AttachUrl2 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#2", null);
|
||||
person.AttachUrl3 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#3", null);
|
||||
person.AttachUrl4 = getAttachUrl4(getProjectPerson.PersonId);
|
||||
//person.AttachUrl5 = APIUpLoadFileService.getFileUrl(personId + "#5", null);
|
||||
person.AttachUrl5 = APIUpLoadFileService.getFileUrl(getProjectPerson.PersonId + "#5", null);
|
||||
}
|
||||
var getPerson = db.Person_Persons.FirstOrDefault(x => x.IdentityCard == idcard);
|
||||
if (getPerson != null)
|
||||
@@ -742,6 +742,15 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getPerson = db.Person_Persons.FirstOrDefault(x => x.IdentityCard == person.IdentityCard || x.PersonId == person.PersonId);
|
||||
if (getPerson == null)
|
||||
{
|
||||
var getSitePerson = db.SitePerson_Person.FirstOrDefault(x => x.SitePersonId ==person.PersonId);
|
||||
if (getSitePerson != null)
|
||||
{
|
||||
getPerson = db.Person_Persons.FirstOrDefault(x => x.IdentityCard == getSitePerson.IdentityCard || x.PersonId == getSitePerson.PersonId);
|
||||
}
|
||||
}
|
||||
|
||||
if (getPerson != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(person.PhotoUrl))
|
||||
|
||||
@@ -6,110 +6,53 @@ namespace BLL
|
||||
{
|
||||
public class ExpenseDetailService
|
||||
{
|
||||
public static decimal? GetSumCostMoneyByExpenseId(string expenseId)
|
||||
{
|
||||
return (from x in Funs.DB.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x.CostMoney).Sum();
|
||||
}
|
||||
|
||||
|
||||
public static List<Model.CostGoods_ExpenseDetail> GetExpenseDetailsByExpenseId(string expenseId)
|
||||
{
|
||||
return (from x in Funs.DB.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x).ToList();
|
||||
}
|
||||
|
||||
public static decimal GetSumCostMoneyByExpenseIdAndType(string expenseId, string costType)
|
||||
{
|
||||
Model.CostGoods_ExpenseDetail detail = (from x in Funs.DB.CostGoods_ExpenseDetail where x.ExpenseId == expenseId && x.CostType == costType select x).FirstOrDefault();
|
||||
if (detail != null)
|
||||
{
|
||||
return detail.CostMoney ?? 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位和时间获取费用明细集合
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
/// <param name="startTime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.CostGoods_ExpenseDetail> GetCostDetailsByUnitId(string unitId, DateTime startTime, DateTime endTime)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
return (from x in db.CostGoods_ExpenseDetail
|
||||
join y in db.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
|
||||
where y.UnitId == unitId && y.States == BLL.Const.State_2 && y.ApproveDate >= startTime && y.ApproveDate < endTime
|
||||
select x).Distinct().ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据单位和时间及费用类型获取当期费用
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
/// <param name="startTime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="costType"></param>
|
||||
/// <returns></returns>
|
||||
public static decimal GetCostDetailsByUnitIdAndCostType(string unitId, DateTime startTime, DateTime endTime, string costType)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
decimal cost = 0;
|
||||
var q = from x in db.CostGoods_ExpenseDetail
|
||||
join y in db.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
|
||||
join z in db.Sys_FlowOperate
|
||||
on y.ExpenseId equals z.DataId
|
||||
where y.UnitId == unitId && y.States == BLL.Const.State_2 && z.State == BLL.Const.State_2 && z.OperaterTime >= startTime && z.OperaterTime < endTime && x.CostType.Contains(costType)
|
||||
select x.CostMoney;
|
||||
foreach (var item in q)
|
||||
{
|
||||
if (item != null)
|
||||
{
|
||||
cost += Funs.GetNewDecimalOrZero(item.ToString());
|
||||
}
|
||||
}
|
||||
return cost;
|
||||
//return (from x in Funs.DB.CostGoods_ExpenseDetail
|
||||
// join y in Funs.DB.CostGoods_Expense on x.ExpenseId equals y.ExpenseId
|
||||
// where y.UnitId == unitId && y.States == BLL.Const.State_2 && y.ApproveDate >= startTime && y.ApproveDate < endTime && x.CostType.Contains(costType)
|
||||
// select x.CostMoney ?? 0).Sum();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 增加费用明细信息
|
||||
/// </summary>
|
||||
/// <param name="pauseNotice">费用明细实体</param>
|
||||
public static void AddCostDetail(string expenseId, string costType, decimal costMoney, string costDef)
|
||||
{
|
||||
public static void AddCostDetail(string expenseId )
|
||||
{
|
||||
DeleteCostDetailByExpenseId(expenseId);
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.CostGoods_ExpenseDetail newExpenseDetail = new Model.CostGoods_ExpenseDetail
|
||||
var getItems = from x in db.Base_CostTypeItem
|
||||
join y in db.Base_CostType on x.CostTypeId equals y.CostTypeId
|
||||
select new
|
||||
{
|
||||
SupCostTypeId = y.CostTypeId,
|
||||
SupCostTypeName = y.CostTypeName,
|
||||
SupSortIndex = y.CostTypeCode,
|
||||
CostType = x.CostTypeId,
|
||||
CostTypeName=x.CostTypeItemName,
|
||||
SortIndex=x.SortIndex,
|
||||
CostMoney=0,
|
||||
};
|
||||
foreach (var item in getItems)
|
||||
{
|
||||
ExpenseDetailId = SQLHelper.GetNewID(typeof(Model.CostGoods_ExpenseDetail)),
|
||||
ExpenseId = expenseId,
|
||||
CostType = costType,
|
||||
CostMoney = costMoney,
|
||||
CostDef = costDef
|
||||
};
|
||||
db.CostGoods_ExpenseDetail.InsertOnSubmit(newExpenseDetail);
|
||||
db.SubmitChanges();
|
||||
Model.CostGoods_ExpenseDetail newExpenseDetail = new Model.CostGoods_ExpenseDetail
|
||||
{
|
||||
ExpenseDetailId = SQLHelper.GetNewID(),
|
||||
ExpenseId = expenseId,
|
||||
SupCostTypeId=item.SupCostTypeId,
|
||||
SupCostTypeName=item.SupCostTypeName,
|
||||
SupSortIndex=item.SupSortIndex,
|
||||
|
||||
CostType = item.CostType,
|
||||
CostTypeName = item.CostTypeName,
|
||||
SortIndex=item.SortIndex,
|
||||
CostMoney = item.CostMoney,
|
||||
};
|
||||
db.CostGoods_ExpenseDetail.InsertOnSubmit(newExpenseDetail);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据费用编号和费用类型获取费用明细信息
|
||||
/// </summary>
|
||||
/// <param name="expenseId"></param>
|
||||
/// <param name="costType"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.CostGoods_ExpenseDetail GetCostDetailByExpenseIdAndCostType(string expenseId, string costType)
|
||||
{
|
||||
return Funs.DB.CostGoods_ExpenseDetail.FirstOrDefault(e => (e.ExpenseId == expenseId && e.CostType == costType));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据费用编号删除对应的费用明细信息
|
||||
@@ -118,9 +61,12 @@ namespace BLL
|
||||
public static void DeleteCostDetailByExpenseId(string expenseId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x).ToList();
|
||||
db.CostGoods_ExpenseDetail.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
var q = from x in db.CostGoods_ExpenseDetail where x.ExpenseId == expenseId select x;
|
||||
if (q.Count() > 0)
|
||||
{
|
||||
db.CostGoods_ExpenseDetail.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,28 @@ namespace BLL
|
||||
return Funs.DB.CostGoods_Expense.FirstOrDefault(e => e.ExpenseId == expenseId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取措施费用使用计划
|
||||
/// </summary>
|
||||
/// <param name="expenseId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.CostGoods_Expense> GetExpenseList(string projectId, string unitId, int? year)
|
||||
{
|
||||
var getData = from x in Funs.DB.CostGoods_Expense
|
||||
where x.ProjectId == projectId
|
||||
select x;
|
||||
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
|
||||
{
|
||||
getData = getData.Where(x =>x.UnitId == unitId);
|
||||
}
|
||||
if (year.HasValue)
|
||||
{
|
||||
getData = getData.Where(x => x.Year == year);
|
||||
}
|
||||
|
||||
return getData.OrderBy(x => x.SortIndex).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据时间获取当期单位Id集合
|
||||
/// </summary>
|
||||
@@ -49,22 +71,17 @@ namespace BLL
|
||||
ProjectId = expense.ProjectId,
|
||||
ExpenseCode = expense.ExpenseCode,
|
||||
UnitId = expense.UnitId,
|
||||
//newExpense.CompileMan = expense.CompileMan;
|
||||
ReportDate=expense.ReportDate,
|
||||
CreateDate = expense.CreateDate,
|
||||
States = expense.States,
|
||||
Months = expense.Months,
|
||||
ReportDate = expense.ReportDate,
|
||||
PlanCostA = expense.PlanCostA,
|
||||
PlanCostB = expense.PlanCostB,
|
||||
CompileMan = expense.CompileMan,
|
||||
CompileDate = expense.CompileDate,
|
||||
// newExpense.CheckMan = expense.CheckMan;
|
||||
CheckDate = expense.CheckDate,
|
||||
// newExpense.ApproveMan = expense.ApproveMan;
|
||||
ApproveDate = expense.ApproveDate
|
||||
SortIndex = expense.SortIndex,
|
||||
Year = expense.Year,
|
||||
};
|
||||
db.CostGoods_Expense.InsertOnSubmit(newExpense);
|
||||
db.SubmitChanges();
|
||||
BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectExpenseMenuId, expense.ProjectId, null, expense.ExpenseId, expense.CreateDate);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -79,20 +96,22 @@ namespace BLL
|
||||
{
|
||||
//newExpense.ProjectId = expense.ProjectId;
|
||||
newExpense.ExpenseCode = expense.ExpenseCode;
|
||||
newExpense.UnitId = expense.UnitId;
|
||||
// newExpense.CompileMan = expense.CompileMan;
|
||||
newExpense.CreateDate = expense.CreateDate;
|
||||
newExpense.UnitId = expense.UnitId;
|
||||
newExpense.States = expense.States;
|
||||
newExpense.Months = expense.Months;
|
||||
newExpense.ReportDate = expense.ReportDate;
|
||||
newExpense.PlanCostA = expense.PlanCostA;
|
||||
newExpense.PlanCostB = expense.PlanCostB;
|
||||
newExpense.CompileDate = expense.CompileDate;
|
||||
newExpense.CompileMan = expense.CompileMan;
|
||||
//newExpense.CheckMan = expense.CheckMan;
|
||||
newExpense.CheckDate = expense.CheckDate;
|
||||
//newExpense.CheckDate = expense.CheckDate;
|
||||
//newExpense.ApproveMan = expense.ApproveMan;
|
||||
newExpense.ApproveDate = expense.ApproveDate;
|
||||
// newExpense.ApproveDate = expense.ApproveDate;
|
||||
newExpense.SortIndex = expense.SortIndex;
|
||||
newExpense.Year = expense.Year;
|
||||
db.SubmitChanges();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +131,48 @@ namespace BLL
|
||||
BLL.CommonService.DeleteFlowOperateByID(expenseId);
|
||||
db.CostGoods_Expense.DeleteOnSubmit(expense);
|
||||
db.SubmitChanges();
|
||||
|
||||
if (expense.Year.HasValue)
|
||||
{
|
||||
SetSumYearExpense(expense.ProjectId, expense.Year.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前合计数
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <param name="Year"></param>
|
||||
public static void SetSumYearExpense(string projectId,int Year)
|
||||
{
|
||||
var getYearEx = Funs.DB. CostGoods_Expense.FirstOrDefault(x=>x.ProjectId == projectId && x.Year == Year && x.UnitId == null);
|
||||
if (getYearEx != null)
|
||||
{
|
||||
Funs.DB.CostGoods_Expense.DeleteOnSubmit(getYearEx);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
var getALLEx=from x in Funs.DB.CostGoods_Expense where x.ProjectId == projectId && x.Year == Year && x.UnitId != null select x;
|
||||
if (getALLEx.Count() > 0)
|
||||
{
|
||||
Model.CostGoods_Expense newExpense = new Model.CostGoods_Expense
|
||||
{
|
||||
ExpenseId = SQLHelper.GetNewID(),
|
||||
ProjectId = projectId,
|
||||
UnitId = null,
|
||||
CreateDate = DateTime.Now,
|
||||
Months = DateTime.Now,
|
||||
ReportDate = DateTime.Now,
|
||||
CompileDate = DateTime.Now,
|
||||
CheckDate = DateTime.Now,
|
||||
ApproveDate = DateTime.Now,
|
||||
SortIndex = 0,
|
||||
Year = Year,
|
||||
};
|
||||
|
||||
db.CostGoods_Expense.InsertOnSubmit(newExpense);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user