diff --git a/DataBase/版本日志/SGGLDB_V2023-03-17.sql b/DataBase/版本日志/SGGLDB_V2023-03-17.sql
new file mode 100644
index 00000000..6adff33f
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_V2023-03-17.sql
@@ -0,0 +1,4 @@
+alter table Model_QualityModel add AttachUrlModel nvarchar(1000) null
+GO
+alter table Model_QualityModel add AttachUrl nvarchar(1000) null
+GO
\ No newline at end of file
diff --git a/SGGL/BLL/API/APIBaseInfoService.cs b/SGGL/BLL/API/APIBaseInfoService.cs
index d60e081c..ce396ca6 100644
--- a/SGGL/BLL/API/APIBaseInfoService.cs
+++ b/SGGL/BLL/API/APIBaseInfoService.cs
@@ -819,7 +819,7 @@ namespace BLL
/// 获取质量会议主持人
///
///
- public static List getCQMSMeetingHostMan(string projectId,string unitId)
+ public static List getCQMSMeetingHostMan(string projectId, string unitId)
{
var list = BLL.SitePerson_PersonService.GetSitePerson_PersonListByUnitIdsRoleIds(projectId, unitId, null);
List items = new List();
@@ -834,6 +834,46 @@ namespace BLL
}
#endregion
+ #region 获取质量奖罚事由
+ ///
+ /// 获取质量奖罚事由
+ ///
+ ///
+ public static List getRewardAndPunishCause(string type)
+ {
+ if (type == "1") //奖励
+ {
+ var list = RewardTypeService.GetRewardTypeList();
+ List items = new List();
+ 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 items = new List();
+ 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 获取质量会议参加人员
///
/// 获取质量会议参加人员
diff --git a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs
index 19333ac1..2e6738e5 100644
--- a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs
+++ b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs
@@ -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;
diff --git a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs
index 62d3c889..707d080d 100644
--- a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs
+++ b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs
@@ -190,7 +190,7 @@ namespace BLL
}
///
- /// 根据状态选择下一步办理类型
+ /// 根据状态获取办理人
///
///
///
@@ -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();
diff --git a/SGGL/BLL/CQMS/Models/QualityModelService.cs b/SGGL/BLL/CQMS/Models/QualityModelService.cs
index 7d876e3e..2a79a28f 100644
--- a/SGGL/BLL/CQMS/Models/QualityModelService.cs
+++ b/SGGL/BLL/CQMS/Models/QualityModelService.cs
@@ -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();
+ }
+ }
+
///
/// 修改公司质量样板
///
@@ -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();
+ }
+ }
+ }
+
///
/// 根据主键删除公司质量样板
///
@@ -71,5 +106,77 @@ namespace BLL
Funs.DB.SubmitChanges();
}
}
+
+ public static List getListDataForApi(string projectId, int startRowIndex, int maximumRows)
+ {
+ using (var db = new Model.SGGLDB(Funs.ConnString))
+ {
+ IQueryable 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 res = new List();
+ 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;
+ }
+ }
+
+ ///
+ /// 获取质量模板信息
+ ///
+ ///
+ ///
+ 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;
+ }
+ }
}
}
diff --git a/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishApproveService.cs b/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishApproveService.cs
index c5a83799..083cb5d5 100644
--- a/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishApproveService.cs
+++ b/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishApproveService.cs
@@ -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();
+ }
+ }
+ }
+
///
/// 增加质量奖罚审批信息
///
@@ -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;
+ }
+ }
+
///
/// 总包专业工程师审核信息
///
@@ -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 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 res = new List();
+ 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;
+ }
+ }
}
}
diff --git a/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs b/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs
index e9d0f49e..d0f847df 100644
--- a/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs
+++ b/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs
@@ -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();
+ }
+ }
+
///
/// 修改质量奖罚
///
@@ -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();
+ }
+ }
+
///
/// 根据主键删除质量奖罚
///
@@ -116,72 +173,228 @@ namespace BLL
return null;
}
- //public static List getListDataForApi(string projectId, int startRowIndex, int maximumRows, string type)
- //{
- // using (var db = new Model.SGGLDB(Funs.ConnString))
- // {
- // IQueryable 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 res = new List();
- // 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;
- // }
- //}
+ ///
+ /// 根据状态选择下一步办理类型
+ ///
+ ///
+ ///
+ public static List GetDHandleTypeByStateForApi(string state)
+ {
+ List list = new List();
+ 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;
+ }
+
+ ///
+ /// 把状态转换代号为文字形式
+ ///
+ ///
+ ///
+ 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 "";
+ }
+
+ ///
+ /// 把状态转换代号为文字形式
+ ///
+ ///
+ ///
+ 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 getListDataForApi(string projectId, int startRowIndex, int maximumRows, string type)
+ {
+ using (var db = new Model.SGGLDB(Funs.ConnString))
+ {
+ IQueryable 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 res = new List();
+ 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;
+ }
+ }
+
+ ///
+ /// 获取质量奖罚信息
+ ///
+ ///
+ ///
+ 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;
+ }
+ }
+
+ ///
+ /// 根据状态获取办理人
+ ///
+ ///
+ ///
+ public static List GetHandleManListForApi(string state, string id, string projectId)
+ {
+ List list = new List();
+ 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;
+ }
}
}
diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs
index 0ab33041..efe6acf7 100644
--- a/SGGL/Model/Model.cs
+++ b/SGGL/Model/Model.cs
@@ -127544,6 +127544,10 @@ namespace Model
private System.Nullable _CompileDate;
+ private string _AttachUrlModel;
+
+ private string _AttachUrl;
+
private EntityRef _Base_CompanyModel;
private EntityRef _Base_Project;
@@ -127566,6 +127570,10 @@ namespace Model
partial void OnCompileManChanged();
partial void OnCompileDateChanging(System.Nullable 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
{
diff --git a/SGGL/WebAPI/Controllers/CQMS/CQMSMeetingController.cs b/SGGL/WebAPI/Controllers/CQMS/CQMSMeetingController.cs
index 8af82e64..7b6f952a 100644
--- a/SGGL/WebAPI/Controllers/CQMS/CQMSMeetingController.cs
+++ b/SGGL/WebAPI/Controllers/CQMS/CQMSMeetingController.cs
@@ -183,6 +183,8 @@ namespace WebAPI.Controllers
return res;
}
+ ///获取单位接口 Unit/getProjectUnitLists(projectId)
+
///
/// 获取主持人信息
///
@@ -240,6 +242,25 @@ namespace WebAPI.Controllers
return responeData;
}
+ ///
+ /// 根据是否同意获取办理步骤
+ ///
+ ///
+ 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;
+ }
+
///
/// 根据办理步骤获取办理人
///
diff --git a/SGGL/WebAPI/Controllers/CQMS/CQMSModelsController.cs b/SGGL/WebAPI/Controllers/CQMS/CQMSModelsController.cs
new file mode 100644
index 00000000..ee979a2e
--- /dev/null
+++ b/SGGL/WebAPI/Controllers/CQMS/CQMSModelsController.cs
@@ -0,0 +1,98 @@
+using BLL;
+using Model;
+using System;
+using System.Collections.Generic;
+using System.Web.Http;
+
+namespace WebAPI.Controllers
+{
+ ///
+ /// 质量样板
+ ///
+ public class CQMSModelsController : ApiController
+ {
+ ///
+ /// 根据项目id获取质量样板列表集合
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpGet]
+ public ResponseData> getModelsList(string projectId, int index, int page)
+ {
+ ResponseData> res = new ResponseData>();
+ res.successful = true;
+ res.resultValue = BLL.QualityModelService.getListDataForApi(projectId, index, page);
+ return res;
+ }
+
+ ///
+ /// 根据id获取质量样板详情
+ ///
+ ///
+ ///
+ [HttpGet]
+ public ResponseData GetModelsById(string id)
+ {
+ ResponseData res = new ResponseData();
+ Model_QualityModel cd = BLL.QualityModelService.GetQualityModelById(id);
+
+ res.successful = true;
+ res.resultValue = BeanUtil.CopyOjbect(cd, true);
+ return res;
+ }
+
+ ///
+ /// 保存质量样板
+ ///
+ ///
+ ///
+ [HttpPost]
+ public ResponseData AddModels([FromBody] Model.Model_QualityModel models)
+ {
+ ResponseData res = new ResponseData();
+ 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;
+ }
+
+ ///
+ ///
+ ///
+ 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);
+ }
+
+
+
+ }
+}
diff --git a/SGGL/WebAPI/Controllers/CQMS/CQMSRewardAndPunishController.cs b/SGGL/WebAPI/Controllers/CQMS/CQMSRewardAndPunishController.cs
index 7fe5ef34..7538e535 100644
--- a/SGGL/WebAPI/Controllers/CQMS/CQMSRewardAndPunishController.cs
+++ b/SGGL/WebAPI/Controllers/CQMS/CQMSRewardAndPunishController.cs
@@ -9,7 +9,7 @@ namespace WebAPI.Controllers
public class CQMSRewardAndPunishController : ApiController
{
///
- /// 根据项目id获取质量会议列表集合
+ /// 根据项目id获取质量奖罚列表集合
///
///
///
@@ -17,12 +17,268 @@ namespace WebAPI.Controllers
/// 0-全部,1-奖励,2-处罚
///
[HttpGet]
- public ResponseData> getMeetingList(string projectId, int index, int page, string type)
+ public ResponseData> getRewardAndPunishList(string projectId, int index, int page, string type)
{
ResponseData> res = new ResponseData>();
res.successful = true;
- //res.resultValue = BLL.RewardAndPunishService.getListDataForApi(projectId, index, page, type);
+ res.resultValue = BLL.RewardAndPunishService.getListDataForApi(projectId, index, page, type);
return res;
}
+
+ ///
+ /// 根据id获取质量奖罚详情
+ ///
+ ///
+ ///
+ [HttpGet]
+ public ResponseData GetRewardAndPunishByRewardAndPunishId(string id)
+ {
+ ResponseData res = new ResponseData();
+ RewardAndPunish_RewardAndPunish cd = BLL.RewardAndPunishService.GetRewardAndPunishByRewardAndPunishIdForApi(id);
+
+ res.successful = true;
+ res.resultValue = BeanUtil.CopyOjbect(cd, true);
+ return res;
+ }
+
+ ///
+ /// 根据id获取审核记录集合
+ ///
+ ///
+ ///
+ public ResponseData> GetApproveById(string id)
+ {
+ ResponseData> res = new ResponseData>();
+
+ res.successful = true;
+ res.resultValue = BLL.RewardAndPunishApproveService.GetListDataByIdForApi(id);
+ return res;
+ }
+
+ ///
+ /// 根据id获取当前办理人审批信息
+ ///
+ ///
+ ///
+ public ResponseData GetCurrApproveById(string id)
+ {
+ ResponseData res = new ResponseData();
+
+ res.successful = true;
+ res.resultValue = BeanUtil.CopyOjbect(BLL.RewardAndPunishApproveService.getCurrApproveForApi(id), true);
+ return res;
+ }
+
+ ///
+ /// 保存奖罚主表信息
+ ///
+ ///
+ ///
+ [HttpPost]
+ public ResponseData AddRewardAndPunish([FromBody] Model.RewardAndPunish_RewardAndPunish rewardAndPunish)
+ {
+ ResponseData res = new ResponseData();
+ 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);
+ }
+
+ ///
+ /// 新增办理信息
+ ///
+ ///
+ ///
+ [HttpPost]
+ public ResponseData AddApprove([FromBody] Model.RewardAndPunish_RewardAndPunishApprove approve)
+ {
+ ResponseData res = new ResponseData();
+ 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;
+ }
+
+ ///
+ /// 更新办理信息
+ ///
+ ///
+ ///
+ [HttpPost]
+ public ResponseData UpdateApprove([FromBody] Model.RewardAndPunish_RewardAndPunishApprove approve)
+ {
+ ResponseData res = new ResponseData();
+ 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")
+
+ ///
+ /// 根据奖励或处罚获取奖罚事由
+ ///
+ ///
+ 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;
+ }
+
+ ///
+ /// 根据奖罚事由Id获取奖罚决定
+ ///
+ ///
+ 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;
+ }
+
+ ///
+ /// 根据状态获取办理步骤 0-重新编制,1-编制,2-质量经理审核,3-项目经理批准,C-审批完成
+ ///
+ ///
+ 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;
+ }
+
+ ///
+ /// 根据是否同意和当前主表状态获取办理步骤
+ ///
+ ///
+ 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;
+ }
+
+ ///
+ /// 根据办理步骤获取办理人
+ ///
+ ///
+ 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;
+ }
}
}
diff --git a/SGGL/WebAPI/WebAPI.csproj b/SGGL/WebAPI/WebAPI.csproj
index 3643ae1d..685dfec1 100644
--- a/SGGL/WebAPI/WebAPI.csproj
+++ b/SGGL/WebAPI/WebAPI.csproj
@@ -168,6 +168,7 @@
+