diff --git a/DataBase/版本日志/SGGLDB_V2023-03-15.sql b/DataBase/版本日志/SGGLDB_V2023-03-15.sql new file mode 100644 index 00000000..6af1299c --- /dev/null +++ b/DataBase/版本日志/SGGLDB_V2023-03-15.sql @@ -0,0 +1,2 @@ +alter table Train_TrainPlan add AttachUrl nvarchar(1000) null +GO \ No newline at end of file diff --git a/DataBase/版本日志/SGGLDB_V2023-03-16.sql b/DataBase/版本日志/SGGLDB_V2023-03-16.sql index 569025b9..e69de29b 100644 --- a/DataBase/版本日志/SGGLDB_V2023-03-16.sql +++ b/DataBase/版本日志/SGGLDB_V2023-03-16.sql @@ -1,4 +0,0 @@ - -insert into Sys_Role values('FB3EF667-7C38-48EC-9D64-A2A19A0D9E57','ʩ','50','',1,1) - - \ No newline at end of file diff --git a/SGGL/BLL/API/APIBaseInfoService.cs b/SGGL/BLL/API/APIBaseInfoService.cs index 0aa5171e..d60e081c 100644 --- a/SGGL/BLL/API/APIBaseInfoService.cs +++ b/SGGL/BLL/API/APIBaseInfoService.cs @@ -739,5 +739,119 @@ namespace BLL } } #endregion + + #region 获取质量培训对象 + /// + /// 获取质量培训对象 + /// + /// + public static List getPlanTrainPersons() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_CQMSTrainObject + orderby x.TrainObjectCode + select new Model.BaseInfoItem { BaseInfoId = x.TrainObjectId, BaseInfoName = x.TrainObjectName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取质量培训类别 + /// + /// 获取质量培训类别 + /// + /// + public static List getCQMSTrainType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in Funs.DB.Base_CQMSTrainType + orderby x.TrainTypeCode + select new Model.BaseInfoItem { BaseInfoId = x.TrainTypeId, BaseInfoCode = x.TrainTypeCode, BaseInfoName = x.TrainTypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取质量培训主持人 + /// + /// 获取质量培训主持人 + /// + /// + public static List getCQMSTrainHostMan(string projectId) + { + var list = BLL.SitePerson_PersonService.GetSitePerson_PersonListByProjectIdUnitTypeRoleIds(projectId, Const.ProjectUnitType_1, Const.QAManager + "," + Const.CQEngineer); + List items = new List(); + foreach (var item in list) + { + Model.BaseInfoItem b = new Model.BaseInfoItem(); + b.BaseInfoId = item.PersonId; + b.BaseInfoName = item.PersonName; + items.Add(b); + } + return items; + } + #endregion + + #region 获取质量培训参与培训教育人员信息 + /// + /// 获取质量培训参与培训教育人员信息 + /// + /// + public static List getRealTrainPersons(string projectId) + { + var list = BLL.SitePerson_PersonService.GetSitePerson_PersonListByProjectIdUnitTypeRoleIds(projectId, Const.ProjectUnitType_1 + "," + Const.ProjectUnitType_2, null); + List items = new List(); + foreach (var item in list) + { + Model.BaseInfoItem b = new Model.BaseInfoItem(); + b.BaseInfoId = item.PersonId; + b.BaseInfoName = item.PersonName; + items.Add(b); + } + return items; + } + #endregion + + #region 获取质量会议主持人 + /// + /// 获取质量会议主持人 + /// + /// + public static List getCQMSMeetingHostMan(string projectId,string unitId) + { + var list = BLL.SitePerson_PersonService.GetSitePerson_PersonListByUnitIdsRoleIds(projectId, unitId, null); + List items = new List(); + foreach (var item in list) + { + Model.BaseInfoItem b = new Model.BaseInfoItem(); + b.BaseInfoId = item.PersonId; + b.BaseInfoName = item.PersonName; + items.Add(b); + } + return items; + } + #endregion + + #region 获取质量会议参加人员 + /// + /// 获取质量会议参加人员 + /// + /// + public static List getAttentPerson(string projectId) + { + var list = BLL.SitePerson_PersonService.GetSitePerson_PersonListByProjectIdUnitTypeRoleIds(projectId, Const.ProjectUnitType_1 + "," + Const.ProjectUnitType_2, null); + List items = new List(); + foreach (var item in list) + { + Model.BaseInfoItem b = new Model.BaseInfoItem(); + b.BaseInfoId = item.PersonId; + b.BaseInfoName = item.PersonName; + items.Add(b); + } + return items; + } + #endregion } } diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 7fb52841..deaae098 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -1,4 +1,6 @@ using Microsoft.SqlServer.Dts.Runtime; +using Model; +using NPOI.SS.Formula.PTG; using System; using System.Collections.Generic; using System.Configuration; @@ -572,7 +574,16 @@ namespace BLL if (!string.IsNullOrEmpty(newProjectPerson.SitePersonId)) { - SitePerson_PersonService.UpdateSitePerson(newProjectPerson); + Model.Sys_Log newlog = new Sys_Log + { + UserId = newPerson.PersonId, + MenuId = Const.PersonListMenuId, + OperationName = "APP修改人员", + OperationLog = "修改人员"+newPerson.PersonName, + DataId = newPerson.PersonId, + ProjectId = person.ProjectId, + }; + SitePerson_PersonService.UpdateSitePerson(newProjectPerson, newlog); } else { diff --git a/SGGL/BLL/API/APIUnitService.cs b/SGGL/BLL/API/APIUnitService.cs index 3119330e..07519711 100644 --- a/SGGL/BLL/API/APIUnitService.cs +++ b/SGGL/BLL/API/APIUnitService.cs @@ -36,6 +36,25 @@ namespace BLL } } + /// + /// 获取项目所有单位信息 + /// + /// + /// + public static List getProjectUnitLists(string projectId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var units = (from x in db.Base_Unit + join y in db.Project_ProjectUnit + on x.UnitId equals y.UnitId + where y.ProjectId == projectId + orderby x.UnitName + select new Model.BaseInfoItem { BaseInfoId = x.UnitId, BaseInfoCode = x.UnitCode, BaseInfoName = x.UnitName }).ToList(); + return units; + } + } + /// /// 根据projectId、unitType获取单位信息(总包1;施工分包2;监理3;业主4;其他5) /// diff --git a/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs b/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs index e90de5b6..0bffb795 100644 --- a/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs +++ b/SGGL/BLL/API/HTGL/APIHTGLPersonService.cs @@ -150,144 +150,6 @@ namespace BLL } } - public static void AddProjectUser(string ProjectCode, string UserID) - { - Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString); - Base_Project base_Project = new Base_Project(); - SitePerson_Person sitePerson = new SitePerson_Person(); - base_Project = BLL.ProjectService.GetProjectByProjectCode(ProjectCode); - if (base_Project == null) - { - return; - } - var ProUser = SitePerson_PersonService.GetSitePersonByProjectIdPersonId(base_Project.ProjectId, UserID); - if (ProUser == null) - { - sitePerson.SitePersonId = SQLHelper.GetNewID(); - sitePerson.ProjectId = base_Project.ProjectId; - sitePerson.PersonId = UserID; - sitePerson.UnitId = Const.UnitId_SEDIN; - sitePerson.States = Const.State_1; - SitePerson_PersonService.AddSitePerson(ProUser); - } - else - { - ProUser.ProjectId = base_Project.ProjectId; - ProUser.PersonId = UserID; - ProUser.UnitId = Const.UnitId_SEDIN; - ProUser.States = Const.State_1; - SitePerson_PersonService.UpdateSitePerson(ProUser); - - } - } - - - public static Pro_Person SavePro_Person(Pro_Person PersonjsonData) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - Pro_Person rb = PersonjsonData; - - Pro_Person _Person = new Pro_Person - { - data = new List() - }; - foreach (Pro_PersonDataItem item in rb.data) - { - try - { - if (CheckDataIsNull(item)) //判断参数是否有空值 - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += item.UserCode + "--参数有误存在null值|"; - continue; - } - - - if (item.UserCode == null || item.UserCode == "") - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += item.UserCode + "--身份证信息有误|"; - continue; - } - - if (item.ProjectCode == null || item.ProjectCode == "") - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += item.UserCode + "--项目代号不能为空|"; - continue; - } - - var getPerson = Person_PersonsService.GetPerson_PersonsByJobNum(item.UserCode); - if (getPerson != null) - { - getPerson.JobNum = item.UserCode; - getPerson.PersonName = item.UserName; - getPerson.DataFrom = "API"; - db.SubmitChanges(); - APIHTGLPersonService.AddProjectUser(item.ProjectCode, getPerson.PersonId); - } - else - { - string newKeyID = SQLHelper.GetNewID(); - Model.Person_Persons newUser = new Model.Person_Persons - { - PersonId = newKeyID, - Account = item.UserCode, - JobNum = item.UserCode, - PersonName = item.UserName, - IdentityCard = item.IdentityCard, - UnitId = Const.UnitId_SEDIN, - Password = Funs.EncryptionPassword(Const.Password), - DataFrom = "API", - }; - db.Person_Persons.InsertOnSubmit(newUser); - db.SubmitChanges(); - AddProjectUser(item.ProjectCode, newKeyID); - } - } - catch (Exception ex) - { - Pro_PersonDataItem pro_personDataItem = new Pro_PersonDataItem - { - ProjectCode = item.ProjectCode, - UserCode = item.UserCode, - UserName = item.UserName, - IdentityCard = item.IdentityCard - }; - - _Person.data.Add(pro_personDataItem); - _Person.Message += ex.Message; - } - } - return _Person; - } - } - private static bool CheckDataIsNull(object t) { bool Isok = false; diff --git a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs index 3fdfdd28..19333ac1 100644 --- a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs +++ b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingApproveService.cs @@ -91,6 +91,18 @@ namespace BLL } } } + + public static string GetHandleManName(string MeetingId) + { + string name = string.Empty; + var a = Funs.DB.Meeting_CQMSMeetingApprove.FirstOrDefault(x => x.MeetingId == MeetingId && x.ApproveDate == null); + if (a != null) + { + name = BLL.Person_PersonsService.GetPersonsNameById(a.ApproveMan); + } + return name; + } + /// /// 根据质量会议编号获取一个质量会议审批信息 /// @@ -155,5 +167,92 @@ namespace BLL { return db.Meeting_CQMSMeetingApprove.FirstOrDefault(x => x.MeetingId == MeetingId && x.ApproveType == BLL.Const.CQMSMeeting_Compile); } + + public static List GetListDataByIdForApi(string id) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + var q = from x in db.Meeting_CQMSMeetingApprove + where x.MeetingId == id && x.ApproveDate != null && x.ApproveType != "S" + orderby x.ApproveDate + select new + { + x.MeetingApproveId, + x.MeetingId, + 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.Meeting_CQMSMeetingApprove approve = new Model.Meeting_CQMSMeetingApprove(); + approve.MeetingApproveId = item.MeetingApproveId; + approve.MeetingId = item.MeetingId; + approve.ApproveMan = item.ApproveMan; + approve.ApproveDate = item.ApproveDate; + approve.IsAgree = item.IsAgree; + approve.ApproveIdea = item.ApproveIdea; + approve.ApproveType = item.ApproveType; + res.Add(approve); + } + return res; + } + } + + public static Model.Meeting_CQMSMeetingApprove getCurrApproveForApi(string id) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_CQMSMeetingApprove newApprove = db.Meeting_CQMSMeetingApprove.FirstOrDefault(e => e.MeetingId == id && e.ApproveType != "S" && e.ApproveDate == null); + return newApprove; + } + } + + public static string AddMeetingApproveForApi(Model.Meeting_CQMSMeetingApprove approve) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + string newKeyID = SQLHelper.GetNewID(typeof(Model.Meeting_CQMSMeetingApprove)); + Model.Meeting_CQMSMeetingApprove newApprove = new Model.Meeting_CQMSMeetingApprove(); + newApprove.MeetingApproveId = newKeyID; + newApprove.MeetingId = approve.MeetingId; + newApprove.ApproveMan = approve.ApproveMan; + newApprove.ApproveDate = approve.ApproveDate; + newApprove.ApproveIdea = approve.ApproveIdea; + newApprove.IsAgree = approve.IsAgree; + newApprove.ApproveType = approve.ApproveType; + + db.Meeting_CQMSMeetingApprove.InsertOnSubmit(newApprove); + db.SubmitChanges(); + return newKeyID; + } + } + + public static void UpdateMeetingApproveForApi(Model.Meeting_CQMSMeetingApprove approve) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_CQMSMeetingApprove newApprove = db.Meeting_CQMSMeetingApprove.FirstOrDefault(e => e.MeetingApproveId == approve.MeetingApproveId && 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(); + } + } + } } } diff --git a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs index 0c5d020c..62d3c889 100644 --- a/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs +++ b/SGGL/BLL/CQMS/Meeting/CQMS_MeetingService.cs @@ -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; } + + /// + /// 根据状态选择下一步办理类型 + /// + /// + /// + public static List GetDHandleTypeByStateForApi(string state) + { + List list = new List(); + 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; + } + + /// + /// 根据状态选择下一步办理类型 + /// + /// + /// + public static List GetHandleManListForApi(string state, string id, string projectId) + { + List list = new List(); + 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; + } + + /// + /// 把状态转换代号为文字形式 + /// + /// + /// + 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 getListDataForApi(string projectId, int startRowIndex, int maximumRows, string meetingType) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + IQueryable 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 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 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(); + } + } } } diff --git a/SGGL/BLL/CQMS/Plan/CQMS_MainPlanApproveService.cs b/SGGL/BLL/CQMS/Plan/CQMS_MainPlanApproveService.cs index fdc9fbf2..a27b4b2f 100644 --- a/SGGL/BLL/CQMS/Plan/CQMS_MainPlanApproveService.cs +++ b/SGGL/BLL/CQMS/Plan/CQMS_MainPlanApproveService.cs @@ -115,6 +115,16 @@ namespace BLL { return db.Plan_MainPlanApprove.OrderByDescending(x => x.ApproveDate).FirstOrDefault(x => x.MainPlanId == MainPlanId && x.ApproveType == state); } + public static string GetHandleManName(string MainPlanId) + { + string name = string.Empty; + var a = Funs.DB.Plan_MainPlanApprove.FirstOrDefault(x => x.MainPlanId == MainPlanId && x.ApproveDate == null); + if (a != null) + { + name = BLL.Person_PersonsService.GetPersonsNameById(a.ApproveMan); + } + return name; + } /// /// 修改总包施工计划审批信息 /// @@ -207,5 +217,40 @@ namespace BLL { return db.Plan_MainPlanApprove.FirstOrDefault(x => x.MainPlanId == MainPlanId && x.ApproveType == BLL.Const.MainPlan_Compile); } + + public static List getApproveListDataByIdForApi(string MainPlanId) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + var q = from x in db.Plan_MainPlanApprove + where x.MainPlanId == MainPlanId && x.ApproveDate != null && x.ApproveType != "S" + orderby x.ApproveDate + select new + { + x.MainPlanApproveId, + x.MainPlanId, + 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.Plan_MainPlanApprove cd = new Model.Plan_MainPlanApprove(); + cd.MainPlanApproveId = item.MainPlanApproveId; + cd.MainPlanId = item.MainPlanId; + cd.ApproveMan = item.ApproveMan; + cd.ApproveDate = item.ApproveDate; + cd.IsAgree = item.IsAgree; + cd.ApproveIdea = item.ApproveIdea; + cd.ApproveType = item.ApproveType + "$" + CQMS_MainPlanService.ConvertState(item.ApproveType); + res.Add(cd); + } + return res; + } + } } } diff --git a/SGGL/BLL/CQMS/Plan/CQMS_MainPlanService.cs b/SGGL/BLL/CQMS/Plan/CQMS_MainPlanService.cs index e04725c7..0a70204f 100644 --- a/SGGL/BLL/CQMS/Plan/CQMS_MainPlanService.cs +++ b/SGGL/BLL/CQMS/Plan/CQMS_MainPlanService.cs @@ -30,7 +30,7 @@ namespace BLL newMainPlan.State = MainPlan.State; newMainPlan.CompileMan = MainPlan.CompileMan; newMainPlan.CompileDate = MainPlan.CompileDate; - newMainPlan.FilePath = MainPlan.FilePath; + newMainPlan.FilePath = MainPlan.FilePath; db.Plan_MainPlan.InsertOnSubmit(newMainPlan); db.SubmitChanges(); } @@ -123,5 +123,114 @@ namespace BLL else return null; } + + /// + /// 把状态转换代号为文字形式 + /// + /// + /// + public static string ConvertState(object state) + { + if (state != null) + { + if (state.ToString() == BLL.Const.MainPlan_ReCompile) + { + return "重新编制"; + } + else if (state.ToString() == BLL.Const.MainPlan_Compile) + { + return "编制"; + } + else if (state.ToString() == BLL.Const.MainPlan_Audit1) + { + return "施工经理审核"; + } + else if (state.ToString() == BLL.Const.MainPlan_Audit2) + { + return "部门评审小组审核"; + } + else if (state.ToString() == BLL.Const.MainPlan_Audit3) + { + return "审核"; + } + else if (state.ToString() == BLL.Const.MainPlan_Audit4) + { + return "项目经理批准"; + } + else if (state.ToString() == BLL.Const.MainPlan_Audit5) + { + return "评审小组组长确认"; + } + else if (state.ToString() == BLL.Const.MainPlan_Complete) + { + return "审批完成"; + } + else + { + return ""; + } + } + return ""; + } + + public static List getListDataForApi(string projectId, int startRowIndex, int maximumRows) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + IQueryable q = db.Plan_MainPlan; + if (!string.IsNullOrEmpty(projectId)) + { + q = q.Where(e => e.ProjectId == projectId); + } + var qres = from x in q + orderby x.CompileDate descending + select new + { + x.MainPlanId, + x.PlanCode, + x.ProjectId, + x.FileName, + 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_MainPlanApproveService.GetHandleManName(x.MainPlanId), + FilePath = x.FilePath, + }; + List res = new List(); + var list = qres.Skip(startRowIndex).Take(maximumRows).ToList(); + foreach (var item in list) + { + Model.Plan_MainPlan cd = new Model.Plan_MainPlan(); + cd.MainPlanId = item.MainPlanId; + cd.ProjectId = item.ProjectId; + cd.PlanCode = item.PlanCode; + cd.FileName = item.FileName; + cd.CompileDate = item.CompileDate; + cd.CompileMan = item.CompileMan + "$" + item.CompileManName; + cd.State = item.State + "$" + item.StateStr + "$" + item.HandleManName; + cd.FilePath = item.FilePath; + res.Add(cd); + } + return res; + } + } + + /// + /// 获取总包施工计划信息 + /// + /// + /// + public static Model.Plan_MainPlan GetMainPlanByMainPlanIdForApi(string MainPlanId) + { + var q = Funs.DB.Plan_MainPlan.FirstOrDefault(e => e.MainPlanId == MainPlanId); + if (q != null) + { + q.State = q.State + "$" + ConvertState(q.State) + "$" + BLL.CQMS_MainPlanApproveService.GetHandleManName(q.MainPlanId); + q.CompileMan = q.CompileMan + "$" + BLL.Person_PersonsService.GetPersonsNameById(q.CompileMan); + } + return q; + } } } diff --git a/SGGL/BLL/CQMS/Plan/CQMS_SubPlanApproveService.cs b/SGGL/BLL/CQMS/Plan/CQMS_SubPlanApproveService.cs index 4e366fee..866c5567 100644 --- a/SGGL/BLL/CQMS/Plan/CQMS_SubPlanApproveService.cs +++ b/SGGL/BLL/CQMS/Plan/CQMS_SubPlanApproveService.cs @@ -259,5 +259,51 @@ namespace BLL db.SubmitChanges(); } } + + public static List getApproveListDataByIdForApi(string SubPlanId) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + var q = from x in db.Plan_SubPlanApprove + where x.SubPlanId == SubPlanId && x.ApproveDate != null && x.ApproveType != "S" + orderby x.ApproveDate + select new + { + x.SubPlanApproveId, + x.SubPlanId, + 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.Plan_SubPlanApprove cd = new Model.Plan_SubPlanApprove(); + cd.SubPlanApproveId = item.SubPlanApproveId; + cd.SubPlanId = item.SubPlanId; + cd.ApproveMan = item.ApproveMan; + cd.ApproveDate = item.ApproveDate; + cd.IsAgree = item.IsAgree; + cd.ApproveIdea = item.ApproveIdea; + cd.ApproveType = item.ApproveType + "$" + CQMS_SubPlanService.ConvertState(item.ApproveType); + res.Add(cd); + } + return res; + } + } + + public static string GetHandleManName(string SubPlanId) + { + string name = string.Empty; + var a = Funs.DB.Plan_SubPlanApprove.FirstOrDefault(x => x.SubPlanId == SubPlanId && x.ApproveDate == null); + if (a != null) + { + name = BLL.Person_PersonsService.GetPersonsNameById(a.ApproveMan); + } + return name; + } } } diff --git a/SGGL/BLL/CQMS/Plan/CQMS_SubPlanService.cs b/SGGL/BLL/CQMS/Plan/CQMS_SubPlanService.cs index 18508b10..f3ae2505 100644 --- a/SGGL/BLL/CQMS/Plan/CQMS_SubPlanService.cs +++ b/SGGL/BLL/CQMS/Plan/CQMS_SubPlanService.cs @@ -198,5 +198,79 @@ namespace BLL rootNode.Nodes.Add(roleNode); } } + + public static List getListDataForApi(string projectId, int startRowIndex, int maximumRows) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + IQueryable q = db.Plan_SubPlan; + if (!string.IsNullOrEmpty(projectId)) + { + q = q.Where(e => e.ProjectId == projectId); + } + var qres = from x in q + orderby x.CompileDate descending + select new + { + x.SubPlanId, + x.ProjectId, + x.Code, + x.UnitId, + x.PlanName, + x.UnitWorkIds, + x.CNProfessionalCodes, + x.CompileDate, + x.CompileMan, + x.State, + x.Edition, + StateStr = ConvertState(x.State), + CompileManName = (from y in db.Person_Persons where y.PersonId == x.CompileMan select y.PersonName).First(), + UnitName = BLL.UnitService.GetUnitNameByUnitId(x.UnitId), + UnitWorkNames=BLL.UnitWorkService.GetUnitWorkName(x.UnitWorkIds), + CNProfessionalNames=BLL.CNProfessionalService.GetCNProfessionalNameByCode(x.CNProfessionalCodes), + HandleManName = BLL.CQMS_SubPlanApproveService.GetHandleManName(x.SubPlanId), + FilePath = x.FilePath, + }; + List res = new List(); + var list = qres.Skip(startRowIndex).Take(maximumRows).ToList(); + foreach (var item in list) + { + Model.Plan_SubPlan cd = new Model.Plan_SubPlan(); + cd.SubPlanId = item.SubPlanId; + cd.ProjectId = item.ProjectId; + cd.Code = item.Code; + cd.UnitId=item.UnitId + "$" + item.UnitName; + cd.PlanName = item.PlanName; + cd.UnitWorkIds=item.UnitWorkIds + "$" + item.UnitWorkNames; + cd.CNProfessionalCodes = item.CNProfessionalCodes + "$" + item.CNProfessionalNames; + cd.CompileDate = item.CompileDate; + cd.CompileMan = item.CompileMan + "$" + item.CompileManName; + cd.State = item.State + "$" + item.StateStr + "$" + item.HandleManName; + cd.Edition = item.Edition; + cd.FilePath = item.FilePath; + res.Add(cd); + } + return res; + } + } + + /// + /// 根据分包施工质量计划Id获取一个分包施工质量计划信息 + /// + /// 分包施工质量计划Id + /// 一个分包施工质量计划实体 + public static Model.Plan_SubPlan GetSubPlanBySubPlanIdForApi(string SubPlanId) + { + var q= Funs.DB.Plan_SubPlan.FirstOrDefault(x => x.SubPlanId == SubPlanId); + if (q != null) + { + q.UnitId = q.UnitId + "$" + BLL.UnitService.GetUnitNameByUnitId(q.UnitId); + q.UnitWorkIds = q.UnitWorkIds + "$" + BLL.UnitWorkService.GetUnitWorkName(q.UnitWorkIds); + q.CNProfessionalCodes = q.CNProfessionalCodes + "$" + BLL.CNProfessionalService.GetCNProfessionalNameByCode(q.CNProfessionalCodes); + q.CompileMan=q.CompileMan + "$" + BLL.Person_PersonsService.GetPersonsNameById(q.CompileMan); + q.State = q.State + "$" + ConvertState(q.State) + "$" + BLL.CQMS_SubPlanApproveService.GetHandleManName(q.SubPlanId); + } + return q; + } } } diff --git a/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs b/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs index 06f513fb..e9d0f49e 100644 --- a/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs +++ b/SGGL/BLL/CQMS/RewardAndPunish/RewardAndPunishService.cs @@ -115,5 +115,73 @@ namespace BLL else 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; + // } + //} } } diff --git a/SGGL/BLL/CQMS/Train/CQMS_TrainPlanService.cs b/SGGL/BLL/CQMS/Train/CQMS_TrainPlanService.cs index 7cc594e8..c670f188 100644 --- a/SGGL/BLL/CQMS/Train/CQMS_TrainPlanService.cs +++ b/SGGL/BLL/CQMS/Train/CQMS_TrainPlanService.cs @@ -78,5 +78,165 @@ namespace BLL db.SubmitChanges(); } } + + // + //获取培训对象 + // + // + // + public static string ConvertPlanTrainPersons(object PlanTrainPersons) + { + string names = string.Empty; + if (PlanTrainPersons != null) + { + string[] strs = PlanTrainPersons.ToString().Split(','); + foreach (var item in strs) + { + names += BLL.CQMSTrainObjectService.GetTrainObjectNameById(item) + ","; + } + if (!string.IsNullOrEmpty(names)) + { + names = names.Substring(0, names.Length - 1); + } + } + return names; + } + + public static List getListDataForApi(string projectId, int startRowIndex, int maximumRows) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + IQueryable q = db.Train_TrainPlan; + if (!string.IsNullOrEmpty(projectId)) + { + q = q.Where(e => e.ProjectId == projectId); + } + var qres = from x in q + orderby x.CompileDate descending + select new + { + x.TrainPlanId, + x.ProjectId, + x.PlanTrainPersons, + PlanTrainPersonsStr = ConvertPlanTrainPersons(x.PlanTrainPersons), + x.TrainTypeId, + TrainTypeName = (from y in db.Base_CQMSTrainType where y.TrainTypeId == x.TrainTypeId select y.TrainTypeName).First(), + x.TrainContent, + x.PlanTrainDate, + x.HostMan, + x.RealTrainDate, + x.Place, + x.TeachHour, + x.TrainPersonNum, + x.RealTrainPersons, + x.CompileDate, + x.CompileMan, + x.AttachUrl, + CompileManName = (from y in db.Person_Persons where y.PersonId == x.CompileMan select y.PersonName).First(), + }; + List res = new List(); + var list = qres.Skip(startRowIndex).Take(maximumRows).ToList(); + foreach (var item in list) + { + Model.Train_TrainPlan cd = new Model.Train_TrainPlan(); + cd.TrainPlanId = item.TrainPlanId; + cd.ProjectId = item.ProjectId; + cd.PlanTrainPersons = item.PlanTrainPersons + "$" + item.PlanTrainPersonsStr; + cd.TrainTypeId = item.TrainTypeId + "$" + item.TrainTypeName; + cd.TrainContent = item.TrainContent; + cd.PlanTrainDate = item.PlanTrainDate; + cd.HostMan = item.HostMan; + cd.RealTrainDate = item.RealTrainDate; + cd.Place = item.Place; + cd.TeachHour = item.TeachHour; + cd.TrainPersonNum = item.TrainPersonNum; + cd.RealTrainPersons = item.RealTrainPersons; + cd.CompileDate = item.CompileDate; + cd.CompileMan = item.CompileMan + "$" + item.CompileManName; + cd.AttachUrl = AttachFileService.getFileUrl(item.TrainPlanId); + res.Add(cd); + } + return res; + } + } + + /// + /// 获取质量培训信息 + /// + /// + /// + public static Model.Train_TrainPlan GetTraiPlanByTrainPlanIdForApi(string TrainPlanId) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + var q = db.Train_TrainPlan.FirstOrDefault(e => e.TrainPlanId == TrainPlanId); + if (q != null) + { + q.PlanTrainPersons = q.PlanTrainPersons + "$" + ConvertPlanTrainPersons(q.PlanTrainPersons); + q.TrainTypeId = q.TrainTypeId + "$" + (from y in db.Base_CQMSTrainType where y.TrainTypeId == q.TrainTypeId select y.TrainTypeName).First(); + q.RealTrainPersons = q.RealTrainPersons + "$" + Person_PersonsService.getPersonsNamesPersonIds(q.RealTrainPersons); + q.HostMan = q.HostMan + "$" + BLL.Person_PersonsService.getPersonsNamesPersonIds(q.HostMan); + q.CompileMan = q.CompileMan + "$" + BLL.Person_PersonsService.GetPersonsNameById(q.CompileMan); + q.AttachUrl = AttachFileService.getFileUrl(q.TrainPlanId); + } + return q; + } + } + + public static void AddTrainPlanForApi(Model.Train_TrainPlan TrainPlan) + { + using (var db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Train_TrainPlan newTrainPlan = new Model.Train_TrainPlan(); + newTrainPlan.TrainPlanId = TrainPlan.TrainPlanId; + newTrainPlan.ProjectId = TrainPlan.ProjectId; + newTrainPlan.PlanTrainPersons = TrainPlan.PlanTrainPersons; + newTrainPlan.TrainTypeId = TrainPlan.TrainTypeId; + newTrainPlan.TrainContent = TrainPlan.TrainContent; + newTrainPlan.PlanTrainDate = TrainPlan.PlanTrainDate; + newTrainPlan.HostMan = TrainPlan.HostMan; + newTrainPlan.RealTrainDate = TrainPlan.RealTrainDate; + newTrainPlan.Place = TrainPlan.Place; + newTrainPlan.TeachHour = TrainPlan.TeachHour; + newTrainPlan.TrainPersonNum = TrainPlan.TrainPersonNum; + newTrainPlan.RealTrainPersons = TrainPlan.RealTrainPersons; + newTrainPlan.CompileMan = TrainPlan.CompileMan; + newTrainPlan.CompileDate = TrainPlan.CompileDate; + db.Train_TrainPlan.InsertOnSubmit(newTrainPlan); + db.SubmitChanges(); + } + } + + public static void UpdateTrainPlanForApi(Model.Train_TrainPlan TrainPlan) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Train_TrainPlan newTrainPlan = db.Train_TrainPlan.FirstOrDefault(e => e.TrainPlanId == TrainPlan.TrainPlanId); + if (newTrainPlan != null) + { + if (!string.IsNullOrEmpty(TrainPlan.PlanTrainPersons)) + newTrainPlan.PlanTrainPersons = TrainPlan.PlanTrainPersons; + if (!string.IsNullOrEmpty(TrainPlan.TrainTypeId)) + newTrainPlan.TrainTypeId = TrainPlan.TrainTypeId; + if (!string.IsNullOrEmpty(TrainPlan.TrainContent)) + newTrainPlan.TrainContent = TrainPlan.TrainContent; + if (TrainPlan.PlanTrainDate.HasValue) + newTrainPlan.PlanTrainDate = TrainPlan.PlanTrainDate; + if (!string.IsNullOrEmpty(TrainPlan.HostMan)) + newTrainPlan.HostMan = TrainPlan.HostMan; + if (TrainPlan.RealTrainDate.HasValue) + newTrainPlan.RealTrainDate = TrainPlan.RealTrainDate; + if (!string.IsNullOrEmpty(TrainPlan.Place)) + newTrainPlan.Place = TrainPlan.Place; + if (TrainPlan.TeachHour.HasValue) + newTrainPlan.TeachHour = TrainPlan.TeachHour; + if (TrainPlan.TrainPersonNum.HasValue) + newTrainPlan.TrainPersonNum = TrainPlan.TrainPersonNum; + if (!string.IsNullOrEmpty(TrainPlan.RealTrainPersons)) + newTrainPlan.RealTrainPersons = TrainPlan.RealTrainPersons; + db.SubmitChanges(); + } + } + } } } diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs index d7433eef..19fcd73e 100644 --- a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs +++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonItemService.cs @@ -1,6 +1,7 @@ using FineUIPro; using Microsoft.Office.Interop.Excel; using Microsoft.SqlServer.Dts.Runtime; +using Model; using System; using System.Collections; using System.Linq; @@ -115,7 +116,7 @@ namespace BLL /// 设置人员进出场 /// /// - public static void SetPersonItemInOut(Model.SitePerson_Person sitePerson) + public static void SetPersonItemInOut(Model.SitePerson_Person sitePerson, Model.Sys_Log log) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -144,7 +145,7 @@ namespace BLL InTime = sitePerson.InTime, }; - AddPersonItem(newPersonItem); + AddPersonItem(newPersonItem, log); if (!getPersons.MultiProject.HasValue || getPersons.MultiProject == false) { var getOtherPersons = db.SitePerson_Person.Where(x => x.IdentityCard == sitePerson.IdentityCard && x.ProjectId != sitePerson.ProjectId && x.States == Const.ProjectPersonStates_1); @@ -182,7 +183,7 @@ namespace BLL /// 增加 人员进场 /// /// 实体 - public static void AddPersonItem(Model.SitePerson_PersonItem newitem) + public static void AddPersonItem(Model.SitePerson_PersonItem newitem, Model.Sys_Log log) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -271,6 +272,11 @@ namespace BLL db.SitePerson_PersonItem.InsertOnSubmit(newPersonItem); db.SubmitChanges(); } + ///更新人员出入记录日志 + if (log != null) + { + LogService.AddSys_Log(log); + } } } } diff --git a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs index 9f8481e8..1c4a3268 100644 --- a/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs +++ b/SGGL/BLL/HSSE/SitePerson/SitePerson_PersonService.cs @@ -1,5 +1,7 @@ using FineUIPro; +using Microsoft.SqlServer.Dts.Runtime; using Model; +using NPOI.SS.Formula.PTG; using System; using System.Collections; using System.Collections.Generic; @@ -697,9 +699,9 @@ namespace BLL Isprint = "0", States = person.States, }; - ////现场人员项目出入场记录 - SitePerson_PersonItemService.SetPersonItemInOut(newPerson); + ////现场人员项目出入场记录 + SitePerson_PersonItemService.SetPersonItemInOut(newPerson, null); db.SitePerson_Person.InsertOnSubmit(newPerson); db.SubmitChanges(); } @@ -709,7 +711,7 @@ namespace BLL /// 修改人员信息 /// /// 人员实体 - public static void UpdateSitePerson(Model.SitePerson_Person person) + public static void UpdateSitePerson(Model.SitePerson_Person person, Model.Sys_Log newlog) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -790,9 +792,9 @@ namespace BLL } } if (setPersonItemInOut) - { + { ////现场人员项目出入场记录 - SitePerson_PersonItemService.SetPersonItemInOut(newPerson); + SitePerson_PersonItemService.SetPersonItemInOut(newPerson,newlog); } } } @@ -850,7 +852,7 @@ namespace BLL { ////现场人员项目出入场记录 person.States = Const.ProjectPersonStates_2; - SitePerson_PersonItemService.SetPersonItemInOut(person); + SitePerson_PersonItemService.SetPersonItemInOut(person, null); Funs.DB.SitePerson_Person.DeleteOnSubmit(person); Funs.DB.SubmitChanges(); @@ -980,8 +982,18 @@ namespace BLL } Funs.DB.SubmitChanges(); + Model.Sys_Log newlog = new Sys_Log + { + UserId = getSitePerson.AuditorId, + MenuId = Const.PersonListMenuId, + OperationName = "现场人员审核", + OperationLog = "现场人员审核" + getSitePerson.PersonName, + DataId = getSitePerson.PersonId, + ProjectId = getSitePerson.ProjectId, + }; + ////现场人员项目出入场记录 - SitePerson_PersonItemService.SetPersonItemInOut(getSitePerson); + SitePerson_PersonItemService.SetPersonItemInOut(getSitePerson, newlog); } } } diff --git a/SGGL/BLL/Person/Person_PersonsService.cs b/SGGL/BLL/Person/Person_PersonsService.cs index 3f866072..9b42a026 100644 --- a/SGGL/BLL/Person/Person_PersonsService.cs +++ b/SGGL/BLL/Person/Person_PersonsService.cs @@ -776,7 +776,10 @@ namespace BLL newPerson.IdcardEndDate = person.IdcardEndDate; newPerson.IdcardForever = person.IdcardForever; newPerson.IdcardAddress = person.IdcardAddress; - newPerson.Telephone = person.Telephone; + if (!string.IsNullOrEmpty(person.Telephone) && newPerson.Telephone != person.Telephone) + { + newPerson.Telephone = person.Telephone; + } newPerson.Birthday = person.Birthday; newPerson.Sex = person.Sex; newPerson.Address = person.Address; diff --git a/SGGL/BLL/SysManage/LogService.cs b/SGGL/BLL/SysManage/LogService.cs index 1df5bb90..551618ac 100644 --- a/SGGL/BLL/SysManage/LogService.cs +++ b/SGGL/BLL/SysManage/LogService.cs @@ -1,5 +1,6 @@ namespace BLL { + using NPOI.SS.Formula.PTG; using System; using System.Linq; using System.Net; @@ -73,6 +74,70 @@ namespace BLL } } + /// + /// Ӳ־ + /// + /// + /// + /// ID + /// ˵ID + /// + public static void AddSys_Log(Model.Sys_Log newsyslog) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (newsyslog != null) + { + Model.Sys_Log syslog = new Model.Sys_Log + { + LogId = SQLHelper.GetNewID(), + HostName = Dns.GetHostName(), + OperationTime = DateTime.Now, + UserId = newsyslog.UserId, + MenuId = newsyslog.MenuId, + OperationName = newsyslog.OperationName, + DataId = newsyslog.DataId, + LogSource = 1, + }; + + IPAddress[] ips = Dns.GetHostAddresses(syslog.HostName); + if (ips.Length > 0) + { + foreach (IPAddress ip in ips) + { + if (ip.ToString().IndexOf('.') != -1) + { + syslog.Ip = ip.ToString(); + } + } + } + string opLog = string.Empty; + var menu = db.Sys_Menu.FirstOrDefault(x => x.MenuId == newsyslog.MenuId); + if (menu != null) + { + opLog = menu.MenuName + ":"; + } + + if (!string.IsNullOrEmpty(newsyslog.OperationName)) + { + opLog += newsyslog.OperationName; + } + + if (!string.IsNullOrEmpty(newsyslog.OperationLog)) + { + syslog.OperationLog = opLog + "" + newsyslog.OperationLog + ""; + } + + if (!string.IsNullOrEmpty(newsyslog.ProjectId) && newsyslog.ProjectId != "null") + { + syslog.ProjectId = newsyslog.ProjectId; + } + + db.Sys_Log.InsertOnSubmit(syslog); + db.SubmitChanges(); + } + } + } /// /// ĿIdɾ־Ϣ /// diff --git a/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx b/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx index 810edde1..ace3bc66 100644 --- a/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx +++ b/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx @@ -39,6 +39,9 @@ + + @@ -79,6 +82,9 @@ + + diff --git a/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.cs b/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.cs index e915c594..a58c2797 100644 --- a/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.cs +++ b/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.cs @@ -86,6 +86,11 @@ namespace FineUIPro.Web.CQMS.Material strSql += " AND EquipmentName like @EquipmentName"; listStr.Add(new SqlParameter("@EquipmentName", "%" + this.txtEquipmentName.Text.Trim() + "%")); } + if (!string.IsNullOrEmpty(this.txtSpecificationAndModel.Text.Trim())) + { + strSql += " AND SpecificationAndModel like @SpecificationAndModel"; + listStr.Add(new SqlParameter("@SpecificationAndModel", "%" + this.txtSpecificationAndModel.Text.Trim() + "%")); + } SqlParameter[] parameter = listStr.ToArray(); DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); return tb; diff --git a/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.designer.cs b/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.designer.cs index fc68e352..af994a1c 100644 --- a/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/CQMS/Material/EquipmentSearch.aspx.designer.cs @@ -93,6 +93,15 @@ namespace FineUIPro.Web.CQMS.Material { /// protected global::FineUIPro.TextBox txtEquipmentName; + /// + /// txtSpecificationAndModel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtSpecificationAndModel; + /// /// btnSearch 控件。 /// diff --git a/SGGL/FineUIPro.Web/CQMS/Material/InspectionEdit.aspx b/SGGL/FineUIPro.Web/CQMS/Material/InspectionEdit.aspx index 01ac0c59..770ca1ea 100644 --- a/SGGL/FineUIPro.Web/CQMS/Material/InspectionEdit.aspx +++ b/SGGL/FineUIPro.Web/CQMS/Material/InspectionEdit.aspx @@ -124,7 +124,7 @@ - + - +