提交质量接口修改

This commit is contained in:
2023-03-16 14:35:01 +08:00
parent f2a3954a44
commit 49afa7e25d
17 changed files with 826 additions and 11 deletions
+262 -1
View File
@@ -112,7 +112,7 @@ namespace BLL
newCQMSMeeting.MeetingTheme = CQMSMeeting.MeetingTheme;
newCQMSMeeting.MeetingContents = CQMSMeeting.MeetingContents;
newCQMSMeeting.State = CQMSMeeting.State;
db.SubmitChanges();
}
}
@@ -156,5 +156,266 @@ namespace BLL
else
return null;
}
/// <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.CQMSMeeting_Compile || state == Const.CQMSMeeting_ReCompile)
{
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = Const.CQMSMeeting_Audit;
item.BaseInfoName = "总包质量经理审批";
list.Add(item);
return list;
}
else if (state == Const.CQMSMeeting_Audit)
{
Model.BaseInfoItem item = new Model.BaseInfoItem();
item.BaseInfoId = Const.CQMSMeeting_Complete;
item.BaseInfoName = "审批完成";
list.Add(item);
Model.BaseInfoItem item2 = new Model.BaseInfoItem();
item2.BaseInfoId = Const.CQMSMeeting_ReCompile;
item2.BaseInfoName = "重新编制";
list.Add(item2);
return list;
}
else
return null;
}
/// <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.CQMSMeeting_Compile)
{
return null;
}
else if (state == Const.CQMSMeeting_ReCompile)
{
var user = BLL.Person_PersonsService.GetPerson_PersonsById(BLL.CQMS_MeetingApproveService.GetAuditMan(id, BLL.Const.CQMSMeeting_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.CQMSMeeting_Audit)
{
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;
}
/// <summary>
/// 把状态转换代号为文字形式
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static string ConvertState(object state)
{
if (state != null)
{
if (state.ToString() == BLL.Const.CQMSMeeting_ReCompile)
{
return "重新编制";
}
else if (state.ToString() == BLL.Const.CQMSMeeting_Compile)
{
return "编制";
}
else if (state.ToString() == BLL.Const.CQMSMeeting_Audit)
{
return "总包质量经理审批";
}
else if (state.ToString() == BLL.Const.CQMSMeeting_Complete)
{
return "审批完成";
}
else
{
return "";
}
}
return "";
}
public static List<Model.Meeting_CQMSMeeting> getListDataForApi(string projectId, int startRowIndex, int maximumRows, string meetingType)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
IQueryable<Model.Meeting_CQMSMeeting> q = db.Meeting_CQMSMeeting;
if (!string.IsNullOrEmpty(projectId))
{
q = q.Where(e => e.ProjectId == projectId);
}
if (!string.IsNullOrEmpty(meetingType))
{
q = q.Where(e => e.MeetingType == meetingType);
}
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="UnitWorkId"></param>
/// <returns></returns>
public static Model.Meeting_CQMSMeeting GetMeetingByMeetingIdForApi(string MeetingId)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var q = db.Meeting_CQMSMeeting.FirstOrDefault(e => e.MeetingId == MeetingId);
if (q != null)
{
q.UnitId = q.UnitId + "$" + BLL.UnitService.GetUnitNameByUnitId(q.UnitId);
q.MeetingType = q.MeetingType + "$" + (q.MeetingType == "M" ? "质量月例会" : "质量专题会");
q.HostMan = q.HostMan + "$" + BLL.Person_PersonsService.getPersonsNamesPersonIds(q.HostMan);
q.AttentPerson = q.AttentPerson + "$" + BLL.Person_PersonsService.getPersonsNamesPersonIds(q.AttentPerson);
q.CompileMan = q.CompileMan + "$" + BLL.Person_PersonsService.GetPersonsNameById(q.CompileMan);
q.State = q.State + "$" + ConvertState(q.State) + "$" + BLL.CQMS_MeetingApproveService.GetHandleManName(q.MeetingId);
q.AttachUrl = AttachFileService.getFileUrl(q.MeetingId);
}
return q;
}
}
public static void AddMeetingForApi(Model.Meeting_CQMSMeeting Meeting)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Meeting_CQMSMeeting newCQMSMeeting = new Model.Meeting_CQMSMeeting
{
MeetingId = Meeting.MeetingId,
ProjectId = Meeting.ProjectId,
UnitId = Meeting.UnitId,
MeetingType = Meeting.MeetingType,
MeetingCode = Meeting.MeetingCode,
MeetingDate = Meeting.MeetingDate,
Place = Meeting.Place,
HostMan = Meeting.HostMan,
AttentPerson = Meeting.AttentPerson,
AttentPersonNum = Meeting.AttentPersonNum,
MeetingTheme = Meeting.MeetingTheme,
MeetingContents = Meeting.MeetingContents,
State = Meeting.State,
CompileMan = Meeting.CompileMan,
CompileDate = Meeting.CompileDate,
};
db.Meeting_CQMSMeeting.InsertOnSubmit(Meeting);
db.SubmitChanges();
Model.Meeting_CQMSMeetingApprove approve = new Model.Meeting_CQMSMeetingApprove();
approve.MeetingApproveId = BLL.SQLHelper.GetNewID();
approve.MeetingId = Meeting.MeetingId;
approve.ApproveType = BLL.Const.CQMSMeeting_Compile;
approve.ApproveMan = Meeting.CompileMan;
approve.ApproveDate = Meeting.CompileDate;
db.Meeting_CQMSMeetingApprove.InsertOnSubmit(approve);
db.SubmitChanges();
}
}
public static void UpdateMeetingForApi(Model.Meeting_CQMSMeeting Meeting)
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
Model.Meeting_CQMSMeeting newMeeting = db.Meeting_CQMSMeeting.First(e => e.MeetingId == Meeting.MeetingId);
if (!string.IsNullOrEmpty(Meeting.UnitId))
newMeeting.UnitId = Meeting.UnitId;
if (!string.IsNullOrEmpty(Meeting.MeetingCode))
newMeeting.MeetingCode = Meeting.MeetingCode;
if (Meeting.MeetingDate.HasValue)
newMeeting.MeetingDate = Meeting.MeetingDate;
if (!string.IsNullOrEmpty(Meeting.Place))
newMeeting.Place = Meeting.Place;
if (!string.IsNullOrEmpty(Meeting.HostMan))
newMeeting.HostMan = Meeting.HostMan;
if (!string.IsNullOrEmpty(Meeting.AttentPerson))
newMeeting.AttentPerson = Meeting.AttentPerson;
if (Meeting.AttentPersonNum.HasValue)
newMeeting.AttentPersonNum = Meeting.AttentPersonNum;
if (!string.IsNullOrEmpty(Meeting.MeetingTheme))
newMeeting.MeetingTheme = Meeting.MeetingTheme;
if (!string.IsNullOrEmpty(Meeting.MeetingContents))
newMeeting.MeetingContents = Meeting.MeetingContents;
if (!string.IsNullOrEmpty(Meeting.State))
newMeeting.State = Meeting.State;
db.SubmitChanges();
}
}
}
}