This commit is contained in:
李鹏飞 2023-03-21 10:21:21 +08:00
commit deb7e17eee
12 changed files with 962 additions and 74 deletions

View File

@ -0,0 +1,4 @@
alter table Model_QualityModel add AttachUrlModel nvarchar(1000) null
GO
alter table Model_QualityModel add AttachUrl nvarchar(1000) null
GO

View File

@ -819,7 +819,7 @@ namespace BLL
/// 获取质量会议主持人
/// </summary>
/// <returns></returns>
public static List<Model.BaseInfoItem> getCQMSMeetingHostMan(string projectId,string unitId)
public static List<Model.BaseInfoItem> getCQMSMeetingHostMan(string projectId, string unitId)
{
var list = BLL.SitePerson_PersonService.GetSitePerson_PersonListByUnitIdsRoleIds(projectId, unitId, null);
List<Model.BaseInfoItem> items = new List<Model.BaseInfoItem>();
@ -834,6 +834,46 @@ namespace BLL
}
#endregion
#region
/// <summary>
/// 获取质量奖罚事由
/// </summary>
/// <returns></returns>
public static List<Model.BaseInfoItem> getRewardAndPunishCause(string type)
{
if (type == "1") //奖励
{
var list = RewardTypeService.GetRewardTypeList();
List<Model.BaseInfoItem> items = new List<Model.BaseInfoItem>();
foreach (var item in list)
{
Model.BaseInfoItem b = new Model.BaseInfoItem();
b.BaseInfoId = item.RewardTypeId;
b.BaseInfoName = item.RewardCause;
items.Add(b);
}
return items;
}
else if (type == "2") //处罚
{
var list = PunishTypeService.GetPunishTypeList();
List<Model.BaseInfoItem> items = new List<Model.BaseInfoItem>();
foreach (var item in list)
{
Model.BaseInfoItem b = new Model.BaseInfoItem();
b.BaseInfoId = item.PunishTypeId;
b.BaseInfoName = item.PunishCause;
items.Add(b);
}
return items;
}
else
{
return null;
}
}
#endregion
#region
/// <summary>
/// 获取质量会议参加人员

View File

@ -196,7 +196,7 @@ namespace BLL
approve.ApproveDate = item.ApproveDate;
approve.IsAgree = item.IsAgree;
approve.ApproveIdea = item.ApproveIdea;
approve.ApproveType = item.ApproveType;
approve.ApproveType = item.ApproveType + "$" + CQMS_MeetingService.ConvertState(item.ApproveType); ;
res.Add(approve);
}
return res;

View File

@ -190,7 +190,7 @@ namespace BLL
}
/// <summary>
/// 根据状态选择下一步办理类型
/// 根据状态获取办理人
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
@ -374,7 +374,7 @@ namespace BLL
CompileDate = Meeting.CompileDate,
};
db.Meeting_CQMSMeeting.InsertOnSubmit(Meeting);
db.Meeting_CQMSMeeting.InsertOnSubmit(newCQMSMeeting);
db.SubmitChanges();
Model.Meeting_CQMSMeetingApprove approve = new Model.Meeting_CQMSMeetingApprove();

View File

@ -41,6 +41,23 @@ namespace BLL
Funs.DB.SubmitChanges();
}
public static void AddQualityModelForApi(Model.Model_QualityModel QualityModel)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.Model_QualityModel newQualityModel = new Model.Model_QualityModel();
newQualityModel.QualityModelId = QualityModel.QualityModelId;
newQualityModel.ProjectId = QualityModel.ProjectId;
newQualityModel.CompanyModelId = QualityModel.CompanyModelId;
newQualityModel.Evaluate = QualityModel.Evaluate;
newQualityModel.Remark = QualityModel.Remark;
newQualityModel.CompileMan = QualityModel.CompileMan;
newQualityModel.CompileDate = QualityModel.CompileDate;
db.Model_QualityModel.InsertOnSubmit(newQualityModel);
db.SubmitChanges();
}
}
/// <summary>
/// 修改公司质量样板
/// </summary>
@ -57,6 +74,24 @@ namespace BLL
}
}
public static void UpdateQualityModelForApi(Model.Model_QualityModel QualityModel)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Model_QualityModel newQualityModel = db.Model_QualityModel.FirstOrDefault(e => e.QualityModelId == QualityModel.QualityModelId);
if (newQualityModel != null)
{
if (!string.IsNullOrEmpty(QualityModel.CompanyModelId))
newQualityModel.CompanyModelId = QualityModel.CompanyModelId;
if (!string.IsNullOrEmpty(QualityModel.Evaluate))
newQualityModel.Evaluate = QualityModel.Evaluate;
if (!string.IsNullOrEmpty(QualityModel.Remark))
newQualityModel.Remark = QualityModel.Remark;
db.SubmitChanges();
}
}
}
/// <summary>
/// 根据主键删除公司质量样板
/// </summary>
@ -71,5 +106,77 @@ namespace BLL
Funs.DB.SubmitChanges();
}
}
public static List<Model.Model_QualityModel> getListDataForApi(string projectId, int startRowIndex, int maximumRows)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.Model_QualityModel> q = db.Model_QualityModel;
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
var qres = from x in q
orderby x.CompileDate descending
select new
{
x.QualityModelId,
x.ProjectId,
x.CompanyModelId,
ModelType = (from y in db.Base_CompanyModel where y.CompanyModelId == x.CompanyModelId select y.ModelType).First(),
CompanyModelKindName = (from y in db.Base_CompanyModelKind
join z in db.Base_CompanyModel on y.CompanyModelKindId equals z.CompanyModelKindId
where z.CompanyModelId == x.CompanyModelId
select y.CompanyModelKindName).First(),
x.Evaluate,
x.Remark,
x.CompileDate,
x.CompileMan,
CompileManName = (from y in db.Person_Persons where y.PersonId == x.CompileMan select y.PersonName).First(),
x.AttachUrl,
};
List<Model.Model_QualityModel> res = new List<Model.Model_QualityModel>();
var list = qres.Skip(startRowIndex).Take(maximumRows).ToList();
foreach (var item in list)
{
Model.Model_QualityModel cd = new Model.Model_QualityModel();
cd.QualityModelId = item.QualityModelId;
cd.ProjectId = item.ProjectId;
cd.CompanyModelId = item.CompanyModelId + "$" + item.ModelType + "$" + item.CompanyModelKindName;
cd.Evaluate = item.Evaluate;
cd.Remark = item.Remark;
cd.CompileDate = item.CompileDate;
cd.CompileMan = item.CompileMan + "$" + item.CompileManName;
cd.AttachUrlModel = AttachFileService.getFileUrl(item.CompanyModelId);
cd.AttachUrl = AttachFileService.getFileUrl(item.QualityModelId);
res.Add(cd);
}
return res;
}
}
/// <summary>
/// 获取质量模板信息
/// </summary>
/// <param name="UnitWorkId"></param>
/// <returns></returns>
public static Model.Model_QualityModel GetQualityModelByQualityModelIdForApi(string QualityModelId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var q = db.Model_QualityModel.FirstOrDefault(e => e.QualityModelId == QualityModelId);
if (q != null)
{
q.CompanyModelId = q.CompanyModelId + "$" + (from y in db.Base_CompanyModel where y.CompanyModelId == q.CompanyModelId select y.ModelType).First() + "$"+ (from y in db.Base_CompanyModelKind
join z in db.Base_CompanyModel on y.CompanyModelKindId equals z.CompanyModelKindId
where z.CompanyModelId == q.CompanyModelId
select y.CompanyModelKindName).First();
q.CompileMan = q.CompileMan + "$" + BLL.Person_PersonsService.GetPersonsNameById(q.CompileMan);
q.AttachUrlModel = AttachFileService.getFileUrl(q.CompanyModelId);
q.AttachUrl = AttachFileService.getFileUrl(q.QualityModelId);
}
return q;
}
}
}
}

View File

@ -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;
}
}
}
}

View File

@ -47,6 +47,39 @@ namespace BLL
db.SubmitChanges();
}
public static void AddRewardAndPunishForApi(Model.RewardAndPunish_RewardAndPunish RewardAndPunish)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.RewardAndPunish_RewardAndPunish newRewardAndPunish = new Model.RewardAndPunish_RewardAndPunish
{
RewardAndPunishId = RewardAndPunish.RewardAndPunishId,
ProjectId = RewardAndPunish.ProjectId,
RewardAndPunishCode = RewardAndPunish.RewardAndPunishCode,
UnitId = RewardAndPunish.UnitId,
Type = RewardAndPunish.Type,
RewardAndPunishTypeId = RewardAndPunish.RewardAndPunishTypeId,
RewardAndPunishBasis = RewardAndPunish.RewardAndPunishBasis,
State = RewardAndPunish.State,
CompileMan = RewardAndPunish.CompileMan,
CompileDate = RewardAndPunish.CompileDate,
RewardAndPunishDecision=RewardAndPunish.RewardAndPunishDecision,
};
db.RewardAndPunish_RewardAndPunish.InsertOnSubmit(newRewardAndPunish);
db.SubmitChanges();
Model.RewardAndPunish_RewardAndPunishApprove approve = new Model.RewardAndPunish_RewardAndPunishApprove();
approve.RewardAndPunishApproveId = BLL.SQLHelper.GetNewID();
approve.RewardAndPunishId = RewardAndPunish.RewardAndPunishId;
approve.ApproveType = BLL.Const.RewardAndPunish_Compile;
approve.ApproveMan = RewardAndPunish.CompileMan;
approve.ApproveDate = RewardAndPunish.CompileDate;
db.RewardAndPunish_RewardAndPunishApprove.InsertOnSubmit(approve);
db.SubmitChanges();
}
}
/// <summary>
/// 修改质量奖罚
/// </summary>
@ -69,6 +102,30 @@ namespace BLL
}
}
public static void UpdateRewardAndPunishForApi(Model.RewardAndPunish_RewardAndPunish RewardAndPunish)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.RewardAndPunish_RewardAndPunish newRewardAndPunish = db.RewardAndPunish_RewardAndPunish.First(e => e.RewardAndPunishId == RewardAndPunish.RewardAndPunishId);
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishCode))
newRewardAndPunish.RewardAndPunishCode = RewardAndPunish.RewardAndPunishCode;
if (!string.IsNullOrEmpty(RewardAndPunish.UnitId))
newRewardAndPunish.UnitId = RewardAndPunish.UnitId;
if (!string.IsNullOrEmpty(RewardAndPunish.Type))
newRewardAndPunish.Type = RewardAndPunish.Type;
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishTypeId))
newRewardAndPunish.RewardAndPunishTypeId = RewardAndPunish.RewardAndPunishTypeId;
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishBasis))
newRewardAndPunish.RewardAndPunishBasis = RewardAndPunish.RewardAndPunishBasis;
if (!string.IsNullOrEmpty(RewardAndPunish.RewardAndPunishDecision))
newRewardAndPunish.RewardAndPunishDecision = RewardAndPunish.RewardAndPunishDecision;
if (!string.IsNullOrEmpty(RewardAndPunish.State))
newRewardAndPunish.State = RewardAndPunish.State;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除质量奖罚
/// </summary>
@ -116,72 +173,228 @@ namespace BLL
return null;
}
//public static List<Model.Meeting_CQMSMeeting> getListDataForApi(string projectId, int startRowIndex, int maximumRows, string type)
//{
// using (var db = new Model.SGGLDB(Funs.ConnString))
// {
// IQueryable<Model.RewardAndPunish_RewardAndPunish> q = db.RewardAndPunish_RewardAndPunish;
// if (!string.IsNullOrEmpty(projectId))
// {
// q = q.Where(e => e.ProjectId == projectId);
// }
// if (type!="0")
// {
// q = q.Where(e => e.Type == type);
// }
// var qres = from x in q
// orderby x.CompileDate descending
// select new
// {
// x.MeetingId,
// x.ProjectId,
// x.UnitId,
// UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
// x.MeetingType,
// MeetingTypeStr = x.MeetingType == "M" ? "质量月例会" : "质量专题会",
// x.MeetingCode,
// x.MeetingDate,
// x.Place,
// x.HostMan,
// HostManName = BLL.Person_PersonsService.getPersonsNamesPersonIds(x.HostMan),
// x.AttentPerson,
// AttentPersonName = BLL.Person_PersonsService.getPersonsNamesPersonIds(x.AttentPerson),
// x.AttentPersonNum,
// x.MeetingTheme,
// x.MeetingContents,
// x.CompileDate,
// x.CompileMan,
// x.State,
// StateStr = ConvertState(x.State),
// CompileManName = (from y in db.Person_Persons where y.PersonId == x.CompileMan select y.PersonName).First(),
// HandleManName = BLL.CQMS_MeetingApproveService.GetHandleManName(x.MeetingId),
// x.AttachUrl,
// };
// List<Model.Meeting_CQMSMeeting> res = new List<Model.Meeting_CQMSMeeting>();
// var list = qres.Skip(startRowIndex).Take(maximumRows).ToList();
// foreach (var item in list)
// {
// Model.Meeting_CQMSMeeting cd = new Model.Meeting_CQMSMeeting();
// cd.MeetingId = item.MeetingId;
// cd.ProjectId = item.ProjectId;
// cd.UnitId = item.UnitId + "$" + item.UnitName;
// cd.MeetingType = item.MeetingType + "$" + item.MeetingTypeStr;
// cd.MeetingCode = item.MeetingCode;
// cd.MeetingDate = item.MeetingDate;
// cd.Place = item.Place;
// cd.HostMan = item.HostMan + "$" + item.HostManName;
// cd.AttentPerson = item.AttentPerson + "$" + item.AttentPersonName;
// cd.AttentPersonNum = item.AttentPersonNum;
// cd.MeetingTheme = item.MeetingTheme;
// cd.MeetingContents = item.MeetingContents;
// cd.CompileDate = item.CompileDate;
// cd.CompileMan = item.CompileMan + "$" + item.CompileManName;
// cd.State = item.State + "$" + item.StateStr + "$" + item.HandleManName;
// cd.AttachUrl = AttachFileService.getFileUrl(item.MeetingId);
// res.Add(cd);
// }
// return res;
// }
//}
/// <summary>
/// 根据状态选择下一步办理类型
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static List<Model.BaseInfoItem> GetDHandleTypeByStateForApi(string state)
{
List<Model.BaseInfoItem> list = new List<Model.BaseInfoItem>();
if (state == Const.RewardAndPunish_Compile || state == Const.RewardAndPunish_ReCompile)
{
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = Const.RewardAndPunish_Audit1;
item.BaseInfoName = "质量经理审核";
list.Add(item);
return list;
}
else if (state == Const.RewardAndPunish_Audit1)
{
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = Const.RewardAndPunish_Audit2;
item.BaseInfoName = "项目经理批准";
list.Add(item);
Model.BaseInfoItem item2 = new Model.BaseInfoItem();
item2.BaseInfoId = Const.RewardAndPunish_ReCompile;
item2.BaseInfoName = "重新编制";
list.Add(item2);
return list;
}
else if (state == Const.RewardAndPunish_Audit2)
{
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = Const.RewardAndPunish_Complete;
item.BaseInfoName = "审批完成";
list.Add(item);
Model.BaseInfoItem item2 = new Model.BaseInfoItem();
item2.BaseInfoId = Const.RewardAndPunish_ReCompile;
item2.BaseInfoName = "重新编制";
list.Add(item2);
return list;
}
else
return null;
}
/// <summary>
/// 把状态转换代号为文字形式
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static string ConvertState(object state)
{
if (state != null)
{
if (state.ToString() == BLL.Const.RewardAndPunish_ReCompile)
{
return "重新编制";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Compile)
{
return "编制";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Audit1)
{
return "质量经理审核";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Audit2)
{
return "项目经理批准";
}
else if (state.ToString() == BLL.Const.RewardAndPunish_Complete)
{
return "审批完成";
}
else
{
return "";
}
}
return "";
}
/// <summary>
/// 把状态转换代号为文字形式
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static string ConvertCause(object RewardAndPunishTypeId)
{
string cause = string.Empty;
if (RewardAndPunishTypeId != null)
{
Model.Base_RewardType rt = BLL.RewardTypeService.GetRewardTypeById(RewardAndPunishTypeId.ToString());
Model.Base_PunishType pt = BLL.PunishTypeService.GetPunishTypeById(RewardAndPunishTypeId.ToString());
if (rt != null)
{
cause = rt.RewardCause;
}
else if (pt != null)
{
cause = pt.PunishCause;
}
}
return cause;
}
public static List<Model.RewardAndPunish_RewardAndPunish> getListDataForApi(string projectId, int startRowIndex, int maximumRows, string type)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.RewardAndPunish_RewardAndPunish> q = db.RewardAndPunish_RewardAndPunish;
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
if (type != "0")
{
q = q.Where(e => e.Type == type);
}
var qres = from x in q
orderby x.CompileDate descending
select new
{
x.RewardAndPunishId,
x.ProjectId,
x.RewardAndPunishCode,
x.UnitId,
UnitName = (from y in db.Base_Unit where y.UnitId == x.UnitId select y.UnitName).First(),
x.Type,
TypeStr = x.Type == "1" ? "奖励" : "处罚",
x.RewardAndPunishTypeId,
RewardAndPunishTypeStr = ConvertCause(x.RewardAndPunishTypeId),
x.RewardAndPunishBasis,
x.RewardAndPunishDecision,
x.CompileDate,
x.CompileMan,
x.State,
StateStr = ConvertState(x.State),
CompileManName = (from y in db.Person_Persons where y.PersonId == x.CompileMan select y.PersonName).First(),
HandleManName = BLL.RewardAndPunishApproveService.GetHandleManName(x.RewardAndPunishId),
x.AttachUrl,
};
List<Model.RewardAndPunish_RewardAndPunish> res = new List<Model.RewardAndPunish_RewardAndPunish>();
var list = qres.Skip(startRowIndex).Take(maximumRows).ToList();
foreach (var item in list)
{
Model.RewardAndPunish_RewardAndPunish cd = new Model.RewardAndPunish_RewardAndPunish();
cd.RewardAndPunishId = item.RewardAndPunishId;
cd.ProjectId = item.ProjectId;
cd.RewardAndPunishCode = item.RewardAndPunishCode;
cd.UnitId = item.UnitId + "$" + item.UnitName;
cd.Type = item.Type + "$" + item.TypeStr;
cd.RewardAndPunishTypeId = item.RewardAndPunishTypeId + "$" + item.RewardAndPunishTypeStr;
cd.RewardAndPunishBasis = item.RewardAndPunishBasis;
cd.RewardAndPunishDecision = item.RewardAndPunishDecision;
cd.CompileDate = item.CompileDate;
cd.CompileMan = item.CompileMan + "$" + item.CompileManName;
cd.State = item.State + "$" + item.StateStr + "$" + item.HandleManName;
cd.AttachUrl = AttachFileService.getFileUrl(item.RewardAndPunishId);
res.Add(cd);
}
return res;
}
}
/// <summary>
/// 获取质量奖罚信息
/// </summary>
/// <param name="UnitWorkId"></param>
/// <returns></returns>
public static Model.RewardAndPunish_RewardAndPunish GetRewardAndPunishByRewardAndPunishIdForApi(string RewardAndPunishId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var q = db.RewardAndPunish_RewardAndPunish.FirstOrDefault(e => e.RewardAndPunishId == RewardAndPunishId);
if (q != null)
{
q.UnitId = q.UnitId + "$" + BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
q.Type = q.Type + "$" + (q.Type == "1" ? "奖励" : "处罚");
q.RewardAndPunishTypeId = q.RewardAndPunishTypeId + "$" + ConvertCause(q.RewardAndPunishTypeId);
q.CompileMan = q.CompileMan + "$" + BLL.Person_PersonsService.GetPersonsNameById(q.CompileMan);
q.State = q.State + "$" + ConvertState(q.State) + "$" + BLL.RewardAndPunishApproveService.GetHandleManName(q.RewardAndPunishId);
q.AttachUrl = AttachFileService.getFileUrl(q.RewardAndPunishId);
}
return q;
}
}
/// <summary>
/// 根据状态获取办理人
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static List<Model.BaseInfoItem> GetHandleManListForApi(string state, string id, string projectId)
{
List<Model.BaseInfoItem> list = new List<Model.BaseInfoItem>();
if (state == Const.RewardAndPunish_Compile)
{
return null;
}
else if (state == Const.RewardAndPunish_ReCompile)
{
var user = BLL.Person_PersonsService.GetPerson_PersonsById(BLL.RewardAndPunishApproveService.GetAuditMan(id, BLL.Const.RewardAndPunish_Compile).ApproveMan);
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = user.PersonId;
item.BaseInfoName = user.PersonName;
list.Add(item);
return list;
}
else if (state == Const.RewardAndPunish_Audit1 || state == Const.RewardAndPunish_Audit2)
{
var users = BLL.SitePerson_PersonService.GetSitePerson_PersonListByProjectIdUnitTypeRoleIds(projectId, Const.ProjectUnitType_1, null);
foreach (var user in users)
{
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = user.PersonId;
item.BaseInfoName = user.PersonName;
list.Add(item);
}
return list;
}
else
return null;
}
}
}

View File

@ -127544,6 +127544,10 @@ namespace Model
private System.Nullable<System.DateTime> _CompileDate;
private string _AttachUrlModel;
private string _AttachUrl;
private EntityRef<Base_CompanyModel> _Base_CompanyModel;
private EntityRef<Base_Project> _Base_Project;
@ -127566,6 +127570,10 @@ namespace Model
partial void OnCompileManChanged();
partial void OnCompileDateChanging(System.Nullable<System.DateTime> value);
partial void OnCompileDateChanged();
partial void OnAttachUrlModelChanging(string value);
partial void OnAttachUrlModelChanged();
partial void OnAttachUrlChanging(string value);
partial void OnAttachUrlChanged();
#endregion
public Model_QualityModel()
@ -127723,6 +127731,46 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachUrlModel", DbType="NVarChar(1000)")]
public string AttachUrlModel
{
get
{
return this._AttachUrlModel;
}
set
{
if ((this._AttachUrlModel != value))
{
this.OnAttachUrlModelChanging(value);
this.SendPropertyChanging();
this._AttachUrlModel = value;
this.SendPropertyChanged("AttachUrlModel");
this.OnAttachUrlModelChanged();
}
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_AttachUrl", DbType="NVarChar(1000)")]
public string AttachUrl
{
get
{
return this._AttachUrl;
}
set
{
if ((this._AttachUrl != value))
{
this.OnAttachUrlChanging(value);
this.SendPropertyChanging();
this._AttachUrl = value;
this.SendPropertyChanged("AttachUrl");
this.OnAttachUrlChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Model_QualityModel_Base_CompanyModel", Storage="_Base_CompanyModel", ThisKey="CompanyModelId", OtherKey="CompanyModelId", IsForeignKey=true)]
public Base_CompanyModel Base_CompanyModel
{

View File

@ -183,6 +183,8 @@ namespace WebAPI.Controllers
return res;
}
///获取单位接口 Unit/getProjectUnitLists(projectId)
/// <summary>
/// 获取主持人信息
/// </summary>
@ -240,6 +242,25 @@ namespace WebAPI.Controllers
return responeData;
}
/// <summary>
/// 根据是否同意获取办理步骤
/// </summary>
/// <returns></returns>
public Model.ResponeData getChangeHandle(bool isAgree)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = isAgree == true ? Const.CQMSMeeting_Complete : Const.CQMSMeeting_ReCompile;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据办理步骤获取办理人
/// </summary>

View File

@ -0,0 +1,98 @@
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Web.Http;
namespace WebAPI.Controllers
{
/// <summary>
/// 质量样板
/// </summary>
public class CQMSModelsController : ApiController
{
/// <summary>
/// 根据项目id获取质量样板列表集合
/// </summary>
/// <param name="projectId"></param>
/// <param name="index"></param>
/// <param name="page"></param>
/// <returns></returns>
[HttpGet]
public ResponseData<List<Model_QualityModel>> getModelsList(string projectId, int index, int page)
{
ResponseData<List<Model_QualityModel>> res = new ResponseData<List<Model_QualityModel>>();
res.successful = true;
res.resultValue = BLL.QualityModelService.getListDataForApi(projectId, index, page);
return res;
}
/// <summary>
/// 根据id获取质量样板详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public ResponseData<Model_QualityModel> GetModelsById(string id)
{
ResponseData<Model_QualityModel> res = new ResponseData<Model_QualityModel>();
Model_QualityModel cd = BLL.QualityModelService.GetQualityModelById(id);
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<Model_QualityModel>(cd, true);
return res;
}
/// <summary>
/// 保存质量样板
/// </summary>
/// <param name="trainPlan"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> AddModels([FromBody] Model.Model_QualityModel models)
{
ResponseData<string> res = new ResponseData<string>();
try
{
if (string.IsNullOrEmpty(models.QualityModelId))
{
models.QualityModelId = Guid.NewGuid().ToString();
BLL.QualityModelService.AddQualityModelForApi(models);
SaveAttachFile(models.QualityModelId, BLL.Const.QualityModelMenuId, models.AttachUrl);
res.resultValue = models.QualityModelId;
res.successful = true;
}
else
{
BLL.QualityModelService.UpdateQualityModelForApi(models);
SaveAttachFile(models.QualityModelId, BLL.Const.QualityModelMenuId, models.AttachUrl);
res.resultValue = models.QualityModelId;
res.successful = true;
}
}
catch (Exception e)
{
res.successful = false;
res.resultHint = e.StackTrace;
}
return res;
}
/// <summary>
///
/// </summary>
public static void SaveAttachFile(string dataId, string menuId, string url)
{
Model.ToDoItem toDoItem = new Model.ToDoItem
{
MenuId = menuId,
DataId = dataId,
UrlStr = url,
};
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
}
}

View File

@ -9,7 +9,7 @@ namespace WebAPI.Controllers
public class CQMSRewardAndPunishController : ApiController
{
/// <summary>
/// 根据项目id获取质量会议列表集合
/// 根据项目id获取质量奖罚列表集合
/// </summary>
/// <param name="projectId"></param>
/// <param name="index"></param>
@ -17,12 +17,268 @@ namespace WebAPI.Controllers
/// <param name="type">0-全部1-奖励2-处罚</param>
/// <returns></returns>
[HttpGet]
public ResponseData<List<RewardAndPunish_RewardAndPunish>> getMeetingList(string projectId, int index, int page, string type)
public ResponseData<List<RewardAndPunish_RewardAndPunish>> getRewardAndPunishList(string projectId, int index, int page, string type)
{
ResponseData<List<RewardAndPunish_RewardAndPunish>> res = new ResponseData<List<RewardAndPunish_RewardAndPunish>>();
res.successful = true;
//res.resultValue = BLL.RewardAndPunishService.getListDataForApi(projectId, index, page, type);
res.resultValue = BLL.RewardAndPunishService.getListDataForApi(projectId, index, page, type);
return res;
}
/// <summary>
/// 根据id获取质量奖罚详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
public ResponseData<RewardAndPunish_RewardAndPunish> GetRewardAndPunishByRewardAndPunishId(string id)
{
ResponseData<RewardAndPunish_RewardAndPunish> res = new ResponseData<RewardAndPunish_RewardAndPunish>();
RewardAndPunish_RewardAndPunish cd = BLL.RewardAndPunishService.GetRewardAndPunishByRewardAndPunishIdForApi(id);
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<RewardAndPunish_RewardAndPunish>(cd, true);
return res;
}
/// <summary>
/// 根据id获取审核记录集合
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public ResponseData<List<RewardAndPunish_RewardAndPunishApprove>> GetApproveById(string id)
{
ResponseData<List<RewardAndPunish_RewardAndPunishApprove>> res = new ResponseData<List<RewardAndPunish_RewardAndPunishApprove>>();
res.successful = true;
res.resultValue = BLL.RewardAndPunishApproveService.GetListDataByIdForApi(id);
return res;
}
/// <summary>
/// 根据id获取当前办理人审批信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public ResponseData<RewardAndPunish_RewardAndPunishApprove> GetCurrApproveById(string id)
{
ResponseData<RewardAndPunish_RewardAndPunishApprove> res = new ResponseData<RewardAndPunish_RewardAndPunishApprove>();
res.successful = true;
res.resultValue = BeanUtil.CopyOjbect<RewardAndPunish_RewardAndPunishApprove>(BLL.RewardAndPunishApproveService.getCurrApproveForApi(id), true);
return res;
}
/// <summary>
/// 保存奖罚主表信息
/// </summary>
/// <param name="rewardAndPunish"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> AddRewardAndPunish([FromBody] Model.RewardAndPunish_RewardAndPunish rewardAndPunish)
{
ResponseData<string> res = new ResponseData<string>();
try
{
if (string.IsNullOrEmpty(rewardAndPunish.RewardAndPunishId))
{
rewardAndPunish.RewardAndPunishId = Guid.NewGuid().ToString();
BLL.RewardAndPunishService.AddRewardAndPunishForApi(rewardAndPunish);
SaveAttachFile(rewardAndPunish.RewardAndPunishId, BLL.Const.RewardAndPunishMenuId, rewardAndPunish.AttachUrl);
res.resultValue = rewardAndPunish.RewardAndPunishId;
}
else
{
BLL.RewardAndPunishService.UpdateRewardAndPunishForApi(rewardAndPunish);
SaveAttachFile(rewardAndPunish.RewardAndPunishId, BLL.Const.RewardAndPunishMenuId, rewardAndPunish.AttachUrl);
res.resultValue = rewardAndPunish.RewardAndPunishId;
}
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
public static void SaveAttachFile(string dataId, string menuId, string url)
{
Model.ToDoItem toDoItem = new Model.ToDoItem
{
MenuId = menuId,
DataId = dataId,
UrlStr = url,
};
APIUpLoadFileService.SaveAttachUrl(toDoItem);
}
/// <summary>
/// 新增办理信息
/// </summary>
/// <param name="approve"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> AddApprove([FromBody] Model.RewardAndPunish_RewardAndPunishApprove approve)
{
ResponseData<string> res = new ResponseData<string>();
try
{
Model.RewardAndPunish_RewardAndPunish RewardAndPunish = new Model.RewardAndPunish_RewardAndPunish();
RewardAndPunish.RewardAndPunishId = approve.RewardAndPunishId;
RewardAndPunish.State = approve.ApproveType;
BLL.RewardAndPunishService.UpdateRewardAndPunishForApi(RewardAndPunish);
res.resultValue = BLL.RewardAndPunishApproveService.AddRewardAndPunishApproveForApi(approve);
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
/// <summary>
/// 更新办理信息
/// </summary>
/// <param name="approve"></param>
/// <returns></returns>
[HttpPost]
public ResponseData<string> UpdateApprove([FromBody] Model.RewardAndPunish_RewardAndPunishApprove approve)
{
ResponseData<string> res = new ResponseData<string>();
try
{
approve.ApproveDate = DateTime.Now;
BLL.RewardAndPunishApproveService.UpdateRewardAndPunishApproveForApi(approve);
res.successful = true;
}
catch (Exception e)
{
res.resultHint = e.StackTrace;
res.successful = false;
}
return res;
}
///获取奖罚对象接口 Unit/getUnitByProjectIdUnitType(projectId,"2")
/// <summary>
/// 根据奖励或处罚获取奖罚事由
/// </summary>
/// <returns></returns>
public Model.ResponeData getCause(string type)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = APIBaseInfoService.getRewardAndPunishCause(type);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据奖罚事由Id获取奖罚决定
/// </summary>
/// <returns></returns>
public Model.ResponeData getRewardAndPunishDecision(string typeId)
{
var responeData = new Model.ResponeData();
try
{
string rewardAndPunishDecision = string.Empty;
Model.Base_RewardType rt = BLL.RewardTypeService.GetRewardTypeById(typeId);
Model.Base_PunishType pt = BLL.PunishTypeService.GetPunishTypeById(typeId);
if (rt != null)
{
rewardAndPunishDecision = rt.RewardDecision;
}
else if (pt != null)
{
rewardAndPunishDecision = pt.PunishDecision;
}
responeData.data = rewardAndPunishDecision;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据状态获取办理步骤 0-重新编制1-编制2-质量经理审核3-项目经理批准C-审批完成
/// </summary>
/// <returns></returns>
public Model.ResponeData getHandleListByState(string state)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = RewardAndPunishService.GetDHandleTypeByStateForApi(state);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据是否同意和当前主表状态获取办理步骤
/// </summary>
/// <returns></returns>
public Model.ResponeData getChangeHandle(bool isAgree,string state)
{
var responeData = new Model.ResponeData();
try
{
if (state == Const.RewardAndPunish_Audit2)
{
responeData.data = isAgree == true ? Const.RewardAndPunish_Complete : Const.RewardAndPunish_ReCompile;
}
else if (state == Const.RewardAndPunish_Audit1)
{
responeData.data = isAgree == true ? Const.RewardAndPunish_Audit2 : Const.RewardAndPunish_ReCompile;
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
/// <summary>
/// 根据办理步骤获取办理人
/// </summary>
/// <returns></returns>
public Model.ResponeData getHandleManListByState(string state, string id, string projectId)
{
var responeData = new Model.ResponeData();
try
{
responeData.data = RewardAndPunishService.GetHandleManListForApi(state, id, projectId);
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
}

View File

@ -168,6 +168,7 @@
<Compile Include="Controllers\BaseInfoController.cs" />
<Compile Include="Controllers\CommonController.cs" />
<Compile Include="Controllers\CQMS\CQMSMeetingController.cs" />
<Compile Include="Controllers\CQMS\CQMSModelsController.cs" />
<Compile Include="Controllers\CQMS\CQMSPersonManageController.cs" />
<Compile Include="Controllers\CQMS\CQMSPlanController.cs" />
<Compile Include="Controllers\CQMS\CQMSRewardAndPunishController.cs" />