修改质量接口

This commit is contained in:
2023-03-17 09:59:48 +08:00
parent eef27faf84
commit 4a3fb76c8c
12 changed files with 962 additions and 74 deletions
@@ -121,6 +121,30 @@ namespace BLL
db.SubmitChanges();
}
public static void UpdateRewardAndPunishApproveForApi(Model.RewardAndPunish_RewardAndPunishApprove approve)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.RewardAndPunish_RewardAndPunishApprove newApprove = db.RewardAndPunish_RewardAndPunishApprove.FirstOrDefault(e => e.RewardAndPunishApproveId == approve.RewardAndPunishApproveId && e.ApproveDate == null);
if (newApprove != null)
{
if (!string.IsNullOrEmpty(approve.ApproveMan))
newApprove.ApproveMan = approve.ApproveMan;
if (approve.ApproveDate.HasValue)
newApprove.ApproveDate = approve.ApproveDate;
if (!string.IsNullOrEmpty(approve.ApproveIdea))
newApprove.ApproveIdea = approve.ApproveIdea;
if (approve.IsAgree.HasValue)
newApprove.IsAgree = approve.IsAgree;
if (!string.IsNullOrEmpty(approve.ApproveType))
newApprove.ApproveType = approve.ApproveType;
db.SubmitChanges();
}
}
}
/// <summary>
/// 增加质量奖罚审批信息
/// </summary>
@@ -141,6 +165,27 @@ namespace BLL
db.SubmitChanges();
}
public static string AddRewardAndPunishApproveForApi(Model.RewardAndPunish_RewardAndPunishApprove approve)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
string newKeyID = SQLHelper.GetNewID(typeof(Model.RewardAndPunish_RewardAndPunishApprove));
Model.RewardAndPunish_RewardAndPunishApprove newApprove = new Model.RewardAndPunish_RewardAndPunishApprove();
newApprove.RewardAndPunishApproveId = newKeyID;
newApprove.RewardAndPunishId = approve.RewardAndPunishId;
newApprove.ApproveMan = approve.ApproveMan;
newApprove.ApproveDate = approve.ApproveDate;
newApprove.ApproveIdea = approve.ApproveIdea;
newApprove.IsAgree = approve.IsAgree;
newApprove.ApproveType = approve.ApproveType;
db.RewardAndPunish_RewardAndPunishApprove.InsertOnSubmit(newApprove);
db.SubmitChanges();
return newKeyID;
}
}
/// <summary>
/// 总包专业工程师审核信息
/// </summary>
@@ -155,5 +200,60 @@ namespace BLL
{
return db.RewardAndPunish_RewardAndPunishApprove.FirstOrDefault(x => x.RewardAndPunishId == RewardAndPunishId && x.ApproveType == BLL.Const.RewardAndPunish_Compile);
}
public static string GetHandleManName(string RewardAndPunishId)
{
string name = string.Empty;
var a = Funs.DB.RewardAndPunish_RewardAndPunishApprove.FirstOrDefault(x => x.RewardAndPunishId == RewardAndPunishId && x.ApproveDate == null);
if (a != null)
{
name = BLL.Person_PersonsService.GetPersonsNameById(a.ApproveMan);
}
return name;
}
public static List<Model.RewardAndPunish_RewardAndPunishApprove> GetListDataByIdForApi(string id)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var q = from x in db.RewardAndPunish_RewardAndPunishApprove
where x.RewardAndPunishId == id && x.ApproveDate != null && x.ApproveType != "S"
orderby x.ApproveDate
select new
{
x.RewardAndPunishApproveId,
x.RewardAndPunishId,
ApproveMan = (from y in db.Person_Persons where y.PersonId == x.ApproveMan select y.PersonName).First(),
x.ApproveDate,
x.IsAgree,
x.ApproveIdea,
x.ApproveType,
};
List<Model.RewardAndPunish_RewardAndPunishApprove> res = new List<Model.RewardAndPunish_RewardAndPunishApprove>();
var list = q.ToList();
foreach (var item in list)
{
Model.RewardAndPunish_RewardAndPunishApprove approve = new Model.RewardAndPunish_RewardAndPunishApprove();
approve.RewardAndPunishApproveId = item.RewardAndPunishApproveId;
approve.RewardAndPunishId = item.RewardAndPunishId;
approve.ApproveMan = item.ApproveMan;
approve.ApproveDate = item.ApproveDate;
approve.IsAgree = item.IsAgree;
approve.ApproveIdea = item.ApproveIdea;
approve.ApproveType = item.ApproveType + "$" + RewardAndPunishService.ConvertState(item.ApproveType); ;
res.Add(approve);
}
return res;
}
}
public static Model.RewardAndPunish_RewardAndPunishApprove getCurrApproveForApi(string id)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.RewardAndPunish_RewardAndPunishApprove newApprove = db.RewardAndPunish_RewardAndPunishApprove.FirstOrDefault(e => e.RewardAndPunishId == id && e.ApproveType != "S" && e.ApproveDate == null);
return newApprove;
}
}
}
}