From 4449a7754f52d6ed0a733928043c743b0988049b Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Tue, 11 Jul 2023 16:32:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/API/APIBaseInfoService.cs | 1723 +++++++-------- SGGL/BLL/API/APIPersonService.cs | 4 +- SGGL/BLL/API/APIUpLoadFileService.cs | 55 +- SGGL/BLL/API/APIUserService.cs | 2 +- .../CQMS/ApiInspectionManagementService.cs | 12 +- SGGL/BLL/API/HJGL/APINDETrustService.cs | 1853 +++++++++-------- SGGL/BLL/API/HJGL/APIPipeJointService.cs | 50 +- .../BLL/API/HJGL/APIPreWeldingDailyService.cs | 43 +- SGGL/BLL/API/HJGL/APIReportQueryService.cs | 802 +++---- SGGL/BLL/API/HSSE/APICheckSpecialService.cs | 20 +- .../API/HSSE/APIConstructSolutionService.cs | 8 +- SGGL/BLL/API/HSSE/APIEmergencyService.cs | 10 +- .../API/HSSE/APIEquipmentQualityService.cs | 8 +- SGGL/BLL/API/HSSE/APIHSEDiaryService.cs | 2 +- SGGL/BLL/API/HSSE/APIHazardListService.cs | 6 +- .../BLL/API/HSSE/APIIncentiveNoticeService.cs | 4 +- SGGL/BLL/API/HSSE/APILicenseDataService.cs | 34 +- .../API/HSSE/APILicenseFlowOperateService.cs | 67 +- SGGL/BLL/API/HSSE/APILicenseItemService.cs | 2 +- SGGL/BLL/API/HSSE/APIMeetingService.cs | 38 +- SGGL/BLL/API/HSSE/APIPauseNoticeService.cs | 12 +- SGGL/BLL/API/HSSE/APIPunishNoticeService.cs | 8 +- .../API/HSSE/APIReceiveFileManagerService.cs | 6 +- SGGL/BLL/API/HSSE/APIRectifyNoticesService.cs | 6 +- SGGL/BLL/API/HSSE/APIResourcesService.cs | 2 +- .../API/HSSE/APIServerTestRecordService.cs | 8 +- SGGL/BLL/API/HSSE/APITestPlanService.cs | 63 +- SGGL/BLL/API/HSSE/APITestRecordService.cs | 8 +- SGGL/BLL/API/HSSE/APITrainRecordService.cs | 12 +- SGGL/BLL/API/HSSE/APITrainingPlanService.cs | 10 +- SGGL/BLL/API/HSSE/APITrainingTaskService.cs | 2 +- SGGL/BLL/BaseInfo/WorkPostService.cs | 70 +- SGGL/BLL/BaseInfo/WorkStageService.cs | 27 +- .../Solution/CQMSConstructSolutionService.cs | 26 +- SGGL/BLL/Common/CodeRecordsService.cs | 378 ++-- SGGL/BLL/Common/CommonService.cs | 156 +- SGGL/BLL/Common/UploadFileService.cs | 61 +- .../PointTrust/Batch_BatchTrustItemService.cs | 309 +-- .../HJGL/WeldingManage/PW_JointInfoService.cs | 37 +- .../Check/Check_CheckSpecialDetailService.cs | 28 +- .../HSSE/Check/Check_CheckSpecialService.cs | 278 ++- SGGL/BLL/HSSE/Check/IncentiveNoticeService.cs | 44 +- SGGL/BLL/HSSE/EduTrain/TestRecordService.cs | 42 +- SGGL/BLL/HSSE/License/LicensePublicService.cs | 58 +- SGGL/BLL/HSSE/Meeting/AttendMeetingService.cs | 80 +- SGGL/BLL/HSSE/Meeting/ClassMeetingService.cs | 78 +- SGGL/BLL/HSSE/Meeting/MonthMeetingService.cs | 80 +- .../BLL/HSSE/Meeting/SpecialMeetingService.cs | 79 +- SGGL/BLL/HSSE/Meeting/WeekMeetingService.cs | 81 +- .../QualityAudit/EquipmentQualityService.cs | 80 +- SGGL/BLL/HSSE/SitePerson/PersonService.cs | 62 +- .../HSSE/Solution/ConstructSolutionService.cs | 93 +- .../Solution/HSSEConstructSolutionService.cs | 28 +- .../ReceiveFileManagerService.cs | 32 +- SGGL/BLL/ProjectData/ProjectService.cs | 24 +- SGGL/BLL/ProjectData/ProjectUnitService.cs | 33 +- SGGL/BLL/ProjectData/UnitWorkService.cs | 40 +- SGGL/BLL/ProjectData/WorkAreaService.cs | 29 +- SGGL/BLL/SysManage/DepartService.cs | 27 +- SGGL/BLL/SysManage/RoleService.cs | 38 +- SGGL/BLL/SysManage/SysConstSetService.cs | 27 +- SGGL/BLL/SysManage/UnitService.cs | 88 +- SGGL/BLL/SysManage/UserService.cs | 68 +- SGGL/FineUIPro.Web/CQMS/Check/Draw.aspx | 2 +- SGGL/FineUIPro.Web/ErrLog.txt | 137 ++ .../HSSE/Hazard/HazardList.aspx.cs | 4 + .../HiddenRectificationList.aspx.cs | 12 +- SGGL/FineUIPro.Web/Web.config | 2 +- 68 files changed, 4634 insertions(+), 2984 deletions(-) diff --git a/SGGL/BLL/API/APIBaseInfoService.cs b/SGGL/BLL/API/APIBaseInfoService.cs index 1f765e7b..3d4901aa 100644 --- a/SGGL/BLL/API/APIBaseInfoService.cs +++ b/SGGL/BLL/API/APIBaseInfoService.cs @@ -6,897 +6,924 @@ using System.Security.Cryptography; namespace BLL { - public static class APIBaseInfoService - { - public static ListItem[] GetInstallationList(string projectId, string unitId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + public static class APIBaseInfoService + { + public static ListItem[] GetInstallationList(string projectId, string unitId) { - - var q = (from x in db.Project_Installation - join y in db.ProjectData_WorkArea on x.InstallationId equals y.InstallationId - where x.ProjectId == projectId && y.UnitId == unitId - orderby x.InstallationId - select x).Distinct().ToList(); - ListItem[] item = new ListItem[q.Count()]; - for (int i = 0; i < q.Count(); i++) - { - item[i] = new ListItem(q[i].InstallationName ?? "", q[i].InstallationId.ToString()); - } - return item; - } - } - /// - /// 质量施工方案类型 - /// - /// - /// + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { - public static List getCQMSSolutinType(string groupId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var list = (from x in db.Base_SolutionTempleteType orderby x.SortIndex select new Model.BaseInfoItem { BaseInfoId = x.SolutionTempleteTypeCode, BaseInfoCode = x.SortIndex.ToString(), BaseInfoName = x.SolutionTempleteTypeName }).ToList(); - return list; - - } - } - #region 获取常量 - /// - /// 获取培训级别 - /// - /// - public static List getSysConst(string groupId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Sys_Const - where x.GroupId == groupId - orderby x.SortIndex - select new Model.BaseInfoItem { BaseInfoId = x.ConstValue, BaseInfoCode = x.SortIndex.ToString(), BaseInfoName = x.ConstText }).ToList(); - return getDataLists; - } - } - #endregion - - #region 获取项目列表 - /// - /// 获取项目列表 - /// - /// - public static List getProjectList() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_Project - orderby x.ProjectCode - select new Model.BaseInfoItem - { - BaseInfoId = x.ProjectId, - BaseInfoCode = x.ProjectCode, - BaseInfoName = x.ProjectName - } - ).ToList(); - return getDataLists; - } - } - #endregion - - #region 根据项目号获取项目信息 - /// - /// 根据项目号获取项目信息 - /// - /// - /// - public static Model.BaseInfoItem getProjectByCode(string projectCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_Project - where x.ProjectCode == projectCode - select new Model.BaseInfoItem - { - BaseInfoId = x.ProjectId, - BaseInfoCode = x.ProjectCode, - BaseInfoName = x.ProjectName - } - ).FirstOrDefault(); - return getDataLists; - } - } - #endregion - - #region 根据项目id获取区域表 - /// - /// 根据项目id获取区域表 - /// - /// - /// - public static List getProjectWorkArea(string projectId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.WBS_UnitWork - where x.ProjectId == projectId && x.SuperUnitWork == null - orderby x.UnitWorkCode - select new Model.BaseInfoItem - { - BaseInfoId = x.UnitWorkId, - BaseInfoCode = x.UnitWorkCode, - BaseInfoName = BLL.UnitWorkService.GetUnitWorkALLName(x.UnitWorkId) - } - ).ToList(); - return getDataLists; - } - } - - /// - /// 根据项目、单位ID获取单位工程 - /// - /// - /// - /// - public static List GetProjecUnitWorkByUnitId(string projectId, string unitId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.WBS_UnitWork - where x.ProjectId == projectId && x.UnitId == unitId && x.SuperUnitWork == null - orderby x.UnitWorkCode - select new Model.BaseInfoItem - { - BaseInfoId = x.UnitWorkId, - BaseInfoCode = x.UnitWorkCode, - BaseInfoName = BLL.UnitWorkService.GetUnitWorkALLName(x.UnitWorkId) - } - ).ToList(); - return getDataLists; - } - } - - #endregion - - #region 获取材质列表 - /// - /// 获取材质列表 - /// - /// - public static List GetMaterial() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_Material - orderby x.MaterialCode - select new Model.BaseInfoItem - { - BaseInfoId = x.MaterialId, - BaseInfoCode = x.MaterialCode, - BaseInfoName = x.MetalType - } - ).ToList(); - return getDataLists; - } - } - #endregion - - #region 焊接探伤类型,探伤比例 - /// - /// 获取探伤类型 - /// - /// - public static List getDetectionType() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_DetectionType - orderby x.DetectionTypeCode - select new Model.BaseInfoItem - { - BaseInfoId = x.DetectionTypeId, - BaseInfoCode = x.DetectionTypeCode, - BaseInfoName = x.DetectionTypeName - } - ).ToList(); - return getDataLists; - } - } - - /// - /// 获取探伤比例 - /// - /// - public static List getDetectionRate() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_DetectionRate - orderby x.DetectionRateCode - select new Model.BaseInfoItem - { - BaseInfoId = x.DetectionRateId, - BaseInfoCode = x.DetectionRateCode, - BaseInfoName = x.DetectionRateValue + "%" - } - ).ToList(); - return getDataLists; - } - } - #endregion - - #region 根据类型获取巡检隐患类型表 - /// - /// 根据类型获取巡检隐患类型表 - /// - /// - /// - public static List getHazardRegisterTypes(string type) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.HSSE_Hazard_HazardRegisterTypes - where x.HazardRegisterType == type - orderby x.TypeCode - select new Model.BaseInfoItem { BaseInfoId = x.RegisterTypesId, BaseInfoCode = x.TypeCode, BaseInfoName = x.RegisterTypesName }).ToList(); - return getDataLists; - } - } - #endregion - - #region 根据项目id获取项目图片 - /// - /// 根据项目id获取项目图片 - /// - /// - /// - public static List getProjectPictureByProjectId(string projectId, string pictureType, string strParam) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.InformationProject_Picture - join y in db.AttachFile on x.PictureId equals y.ToKeyId - where x.States == Const.State_2 && y.AttachUrl != null && x.ProjectId == projectId && x.PictureType == pictureType - orderby x.UploadDate descending - select new Model.BaseInfoItem - { - BaseInfoId = x.PictureId, - BaseInfoName = x.Title, - BaseInfoCode = string.Format("{0:yyyy-MM-dd}", x.UploadDate), - ImageUrl = y.AttachUrl.Replace('\\', '/'), - }); - if (!string.IsNullOrEmpty(strParam)) - { - getDataLists = getDataLists.Where(x => x.BaseInfoName.Contains(strParam)); - } - return getDataLists.ToList(); - } - } - - /// - /// 项目图片信息保存方法 - /// - /// 图片信息 - public static void SaveProjectPicture(Model.PictureItem picture) - { - Model.InformationProject_Picture newPicture = new Model.InformationProject_Picture - { - PictureId = picture.PictureId, - ProjectId = picture.ProjectId, - Title = picture.Title, - ContentDef = picture.ContentDef, - PictureType = picture.PictureTypeId, - UploadDate = System.DateTime.Now, - States = Const.State_2, - CompileMan = picture.CompileManId, - }; - - if (string.IsNullOrEmpty(newPicture.PictureId)) - { - newPicture.PictureId = SQLHelper.GetNewID(); - PictureService.AddPicture(newPicture); - } - else - { - PictureService.UpdatePicture(newPicture); - } - - CommonService.btnSaveData(newPicture.ProjectId, Const.ProjectPictureMenuId, newPicture.PictureId, newPicture.CompileMan, true, newPicture.Title, "../InformationProject/PictureView.aspx?PictureId={0}"); - //// 保存附件 - APIUpLoadFileService.SaveAttachUrl(Const.ProjectPictureMenuId, newPicture.PictureId, picture.AttachUrl, "0"); - } - #endregion - - #region 根据项目id获取项目地图 - /// - /// 根据项目id获取项目地图 - /// - /// - /// - public static List getProjectMapByProjectId(string projectId, string mapType) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.InformationProject_ProjectMap - join y in db.AttachFile on x.ProjectMapId equals y.ToKeyId - where y.AttachUrl != null && x.ProjectId == projectId && x.MapType == mapType - orderby x.UploadDate descending - select new Model.BaseInfoItem - { - BaseInfoId = x.ProjectMapId, - BaseInfoName = x.Title, - BaseInfoCode = string.Format("{0:yyyy-MM-dd}", x.UploadDate), - ImageUrl = y.AttachUrl.Replace('\\', '/'), - }).Take(5).ToList(); - return getDataLists; - } - } - - /// - /// 项目地图信息保存方法 - /// - /// 地图信息 - public static void SaveProjectMap(Model.PictureItem projectMap) - { - Model.InformationProject_ProjectMap newProjectMap = new Model.InformationProject_ProjectMap - { - ProjectMapId = projectMap.PictureId, - ProjectId = projectMap.ProjectId, - Title = projectMap.Title, - ContentDef = projectMap.ContentDef, - MapType = projectMap.PictureTypeId, - UploadDate = System.DateTime.Now, - CompileMan = projectMap.CompileManId, - }; - - if (string.IsNullOrEmpty(newProjectMap.ProjectMapId)) - { - newProjectMap.ProjectMapId = SQLHelper.GetNewID(); - ProjectMapService.AddProjectMap(newProjectMap); - } - else - { - ProjectMapService.UpdateProjectMap(newProjectMap); - } - //// 保存附件 - APIUpLoadFileService.SaveAttachUrl(Const.ProjectProjectMapMenuId, newProjectMap.ProjectMapId, projectMap.AttachUrl, "0"); - } - #endregion - - #region 获取通知通告 - /// - /// 根据项目id获取通知通告 - /// - /// - /// - public static List getNoticesList(string projectId, string strParam) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.InformationProject_Notice - where x.AccessProjectId.Contains(projectId) && x.IsRelease == true - && (strParam == null || x.NoticeTitle.Contains(strParam)) - orderby x.ReleaseDate descending - select new Model.NoticeItem - { - NoticeId = x.NoticeId, - NoticeCode = x.NoticeCode, - NoticeTitle = x.NoticeTitle, - ReleaseDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.ReleaseDate) - }).ToList(); - return getDataLists; - } - } - - /// - /// 根据项目id获取通知通告 - /// - /// - /// - public static List getNoticesList(string projectId, string userId, string strParam) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.InformationProject_Notice - where x.AccessProjectId.Contains(projectId) && x.IsRelease == true - && (strParam == null || x.NoticeTitle.Contains(strParam)) - select new Model.NoticeItem - { - NoticeId = x.NoticeId, - NoticeCode = x.NoticeCode, - NoticeTitle = x.NoticeTitle, - ReleaseDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.ReleaseDate), - IsRead = db.Sys_UserRead.FirstOrDefault(y => y.DataId == x.NoticeId && y.ProjectId == projectId && y.UserId == userId) == null ? false : true, - }).ToList(); - return getDataLists.OrderBy(x => x.IsRead).ThenByDescending(x => x.ReleaseDate).ToList(); - } - } - - /// - /// 根据项目id获取通知通告 - /// - /// - /// - public static Model.NoticeItem getNoticesByNoticeId(string noticeId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.InformationProject_Notice - where x.NoticeId == noticeId - select new Model.NoticeItem - { - NoticeId = x.NoticeId, - NoticeCode = x.NoticeCode, - NoticeTitle = x.NoticeTitle, - ReleaseDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.ReleaseDate), - MainContent = x.MainContent, - AttachUrl = db.AttachFile.FirstOrDefault(y => y.ToKeyId == x.NoticeId).AttachUrl.Replace("\\", "/"), - }).FirstOrDefault(); - return getDataLists; - } - } - #endregion - - #region 获取部门信息 - /// - /// 获取部门信息 - /// - /// - public static List getBaseDepart(string strParam) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_Depart - where strParam == null || x.DepartName.Contains(strParam) - orderby x.DepartName - select new Model.BaseInfoItem { BaseInfoId = x.DepartId, BaseInfoCode = x.DepartCode, BaseInfoName = x.DepartName }).ToList(); - return getDataLists; - } - } - #endregion - #region 获取岗位信息 - /// - /// 获取岗位信息 - /// - /// - public static List getWorkPost(string strParam) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_WorkPost - where strParam == null || x.WorkPostName.Contains(strParam) - orderby x.WorkPostName - select new Model.BaseInfoItem { BaseInfoId = x.WorkPostId, BaseInfoCode = x.WorkPostCode, BaseInfoName = x.WorkPostName }).ToList(); - return getDataLists; - } - } - public static List getWorkPost(string projectId,string strParam) - { - List res = new List(); - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.Base_WorkPost - where strParam == null || x.WorkPostName.Contains(strParam) - orderby x.WorkPostName - select new Model.BaseInfoItem { BaseInfoId = x.WorkPostId.ToUpper(), BaseInfoCode = x.WorkPostCode, BaseInfoName = x.WorkPostName }).ToList(); - if (!string.IsNullOrEmpty(projectId)) - { - var user = from u in db.SitePerson_Person - where u.ProjectId == projectId - select u.WorkPostId.ToUpper(); - var postIds = user.Distinct(); - - foreach (var item in getDataLists) - { - if (postIds.Contains(item.BaseInfoId)) + var q = (from x in db.Project_Installation + join y in db.ProjectData_WorkArea on x.InstallationId equals y.InstallationId + where x.ProjectId == projectId && y.UnitId == unitId + orderby x.InstallationId + select x).Distinct().ToList(); + ListItem[] item = new ListItem[q.Count()]; + for (int i = 0; i < q.Count(); i++) { - res.Add(item); + item[i] = new ListItem(q[i].InstallationName ?? "", q[i].InstallationId.ToString()); } - } - } - else - { - res.AddRange(getDataLists); - } - return res; + return item; + } } - } - #endregion + /// + /// 质量施工方案类型 + /// + /// + /// - #region 获取培训类别 - /// - /// 获取培训类别 - /// - /// - public static List getTrainType() - { - var getDataLists = (from x in Funs.DB.Base_TrainType - orderby x.TrainTypeCode - select new Model.BaseInfoItem { BaseInfoId = x.TrainTypeId, BaseInfoCode = x.TrainTypeCode, BaseInfoName = x.TrainTypeName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取培训级别 - /// - /// 获取培训级别 - /// - /// - public static List getTrainLevel() - { - var getDataLists = (from x in Funs.DB.Base_TrainLevel - orderby x.TrainLevelCode - select new Model.BaseInfoItem { BaseInfoId = x.TrainLevelId, BaseInfoCode = x.TrainLevelCode, BaseInfoName = x.TrainLevelName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取法律法规类型 - /// - /// 获取法律法规类型 - /// - /// - public static List getLawsRegulationsType() - { - var getDataLists = (from x in Funs.DB.Base_LawsRegulationsType - orderby x.Code - select new Model.BaseInfoItem { BaseInfoId = x.Id, BaseInfoCode = x.Code, BaseInfoName = x.Name }).ToList(); - return getDataLists; - } - #endregion - - #region 获取标准规范类型 - /// - /// 获取标准规范类型 - /// - /// - public static List getHSSEStandardListType() - { - var getDataLists = (from x in Funs.DB.Base_HSSEStandardListType - orderby x.TypeCode - select new Model.BaseInfoItem { BaseInfoId = x.TypeId, BaseInfoCode = x.TypeCode, BaseInfoName = x.TypeName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取规章制度类型 - /// - /// 获取规章制度类型 - /// - /// - public static List getRulesRegulationsType() - { - var getDataLists = (from x in Funs.DB.Base_RulesRegulationsType - orderby x.RulesRegulationsTypeCode - select new Model.BaseInfoItem { BaseInfoId = x.RulesRegulationsTypeId, BaseInfoCode = x.RulesRegulationsTypeCode, BaseInfoName = x.RulesRegulationsTypeName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取管理规定类型 - /// - /// 获取管理规定类型 - /// - /// - public static List getManageRuleType() - { - var getDataLists = (from x in Funs.DB.Base_ManageRuleType - orderby x.ManageRuleTypeCode - select new Model.BaseInfoItem { BaseInfoId = x.ManageRuleTypeId, BaseInfoCode = x.ManageRuleTypeCode, BaseInfoName = x.ManageRuleTypeName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取机具设备类型 - /// - /// 获取机具设备类型 - /// - /// - public static List getSpecialEquipment(bool isSpecial) - { - var getDataLists = (from x in Funs.DB.Base_SpecialEquipment - where x.IsSpecial == isSpecial - orderby x.SpecialEquipmentCode - select new Model.BaseInfoItem { BaseInfoId = x.SpecialEquipmentId, BaseInfoCode = x.SpecialEquipmentCode, BaseInfoName = x.SpecialEquipmentName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取工作阶段 - /// - /// 获取工作阶段 - /// - /// - public static List getWorkStage() - { - var getDataLists = (from x in Funs.DB.Base_WorkStage - orderby x.WorkStageCode - select new Model.BaseInfoItem { BaseInfoId = x.WorkStageId, BaseInfoCode = x.WorkStageCode, BaseInfoName = x.WorkStageName }).ToList(); - return getDataLists; - } - #endregion - - #region 获取项目班组 - /// - /// 获取项目班组 - /// - /// - /// - /// - public static List getTeamGroup(string projectId, string unitId) - { - var getDataLists = (from x in Funs.DB.ProjectData_TeamGroup - where x.ProjectId == projectId && (unitId == null || x.UnitId == unitId) - orderby x.TeamGroupCode - select new Model.BaseInfoItem { BaseInfoId = x.TeamGroupId, BaseInfoCode = x.TeamGroupCode, BaseInfoName = x.TeamGroupName }).ToList(); - return getDataLists; - } - - /// - /// 获取项目班组组长 - /// - /// - /// - /// - public static Model.BaseInfoItem getTeamGroupLeader(string teamGroupId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + public static List getCQMSSolutinType(string groupId) { - var getDataLists = (from x in db.ProjectData_TeamGroup - join y in db.SitePerson_Person on x.GroupLeaderId equals y.PersonId - where x.TeamGroupId == teamGroupId && y.PersonId != null - select new Model.BaseInfoItem { BaseInfoId = y.PersonId, BaseInfoCode = y.CardNo, BaseInfoName = y.PersonName }).FirstOrDefault(); - return getDataLists; - } - } - #endregion + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var list = (from x in db.Base_SolutionTempleteType orderby x.SortIndex select new Model.BaseInfoItem { BaseInfoId = x.SolutionTempleteTypeCode, BaseInfoCode = x.SortIndex.ToString(), BaseInfoName = x.SolutionTempleteTypeName }).ToList(); + return list; - #region 获取项目区域 - /// - /// 获取项目区域 - /// - /// - public static List getWorkArea(string projectId, string unitId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + } + } + #region 获取常量 + /// + /// 获取培训级别 + /// + /// + public static List getSysConst(string groupId) { - var getDataLists = (from x in db.WBS_UnitWork - where x.ProjectId == projectId && (unitId == null || x.UnitId == unitId) - orderby x.UnitWorkCode - select new Model.BaseInfoItem { BaseInfoId = x.UnitWorkId, BaseInfoCode = x.UnitWorkCode, BaseInfoName = x.UnitWorkName }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Sys_Const + where x.GroupId == groupId + orderby x.SortIndex + select new Model.BaseInfoItem { BaseInfoId = x.ConstValue, BaseInfoCode = x.SortIndex.ToString(), BaseInfoName = x.ConstText }).ToList(); + return getDataLists; + } } - } - #endregion + #endregion - #region 获取作业票-安全措施 - /// - /// 获取作业票-安全措施 - /// - /// - public static List getSafetyMeasures(string licenseType) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 获取项目列表 + /// + /// 获取项目列表 + /// + /// + public static List getProjectList() { - var getDataLists = (from x in db.Base_SafetyMeasures - where x.LicenseType == licenseType - orderby x.SortIndex - select new Model.BaseInfoItem { BaseInfoId = x.SafetyMeasuresId, BaseInfoCode = x.SortIndex.ToString(), BaseInfoName = x.SafetyMeasures }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_Project + orderby x.ProjectCode + select new Model.BaseInfoItem + { + BaseInfoId = x.ProjectId, + BaseInfoCode = x.ProjectCode, + BaseInfoName = x.ProjectName + } + ).ToList(); + return getDataLists; + } } - } - #endregion + #endregion - #region 获取图片分类 - /// - /// 获取图片分类 - /// - /// - public static List getPictureType(string menuType) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据项目号获取项目信息 + /// + /// 根据项目号获取项目信息 + /// + /// + /// + public static Model.BaseInfoItem getProjectByCode(string projectCode) { - var getDataLists = (from x in db.Base_PictureType - where menuType == null || x.MenuType ==menuType - orderby x.Code - select new Model.BaseInfoItem { BaseInfoId = x.PictureTypeId, BaseInfoCode = x.Code, BaseInfoName = x.Name }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_Project + where x.ProjectCode == projectCode + select new Model.BaseInfoItem + { + BaseInfoId = x.ProjectId, + BaseInfoCode = x.ProjectCode, + BaseInfoName = x.ProjectName + } + ).FirstOrDefault(); + return getDataLists; + } } - } - #endregion + #endregion - #region 获取作业许可证(定稿)类型分类 - /// - /// 获取作业许可证类型分类 - /// - /// - public static List getBase_LicenseType() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据项目id获取区域表 + /// + /// 根据项目id获取区域表 + /// + /// + /// + public static List getProjectWorkArea(string projectId) { - var getDataLists = (from x in db.Base_LicenseType - orderby x.LicenseTypeCode - select new Model.BaseInfoItem { BaseInfoId = x.LicenseTypeId, BaseInfoCode = x.LicenseTypeCode, BaseInfoName = x.LicenseTypeName }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.WBS_UnitWork + where x.ProjectId == projectId && x.SuperUnitWork == null + orderby x.UnitWorkCode + select new Model.BaseInfoItem + { + BaseInfoId = x.UnitWorkId, + BaseInfoCode = x.UnitWorkCode, + BaseInfoName = BLL.UnitWorkService.GetUnitWorkALLName(x.UnitWorkId) + } + ).ToList(); + return getDataLists; + } } - } - #endregion - #region 获取特岗证书 - /// - /// 获取图片分类 - /// - /// - public static List getCertificate() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 根据项目、单位ID获取单位工程 + /// + /// + /// + /// + public static List GetProjecUnitWorkByUnitId(string projectId, string unitId) { - var getDataLists = (from x in db.Base_Certificate - orderby x.CertificateCode - select new Model.BaseInfoItem { BaseInfoId = x.CertificateId, BaseInfoCode = x.CertificateCode, BaseInfoName = x.CertificateName }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.WBS_UnitWork + where x.ProjectId == projectId && x.UnitId == unitId && x.SuperUnitWork == null + orderby x.UnitWorkCode + select new Model.BaseInfoItem + { + BaseInfoId = x.UnitWorkId, + BaseInfoCode = x.UnitWorkCode, + BaseInfoName = BLL.UnitWorkService.GetUnitWorkALLName(x.UnitWorkId) + } + ).ToList(); + return getDataLists; + } } - } - #endregion - #region 获取部门 - /// - /// 获取图片分类 - /// - /// - public static List getDepart() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #endregion + + #region 获取材质列表 + /// + /// 获取材质列表 + /// + /// + public static List GetMaterial() { - var getDataLists = (from x in db.Base_Depart - orderby x.DepartCode - select new Model.BaseInfoItem { BaseInfoId = x.DepartId, BaseInfoCode = x.DepartCode, BaseInfoName = x.DepartName }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_Material + orderby x.MaterialCode + select new Model.BaseInfoItem + { + BaseInfoId = x.MaterialId, + BaseInfoCode = x.MaterialCode, + BaseInfoName = x.MetalType + } + ).ToList(); + return getDataLists; + } } - } - #endregion + #endregion - #region 获取应急预案类型 - /// - /// 获取图片分类 - /// - /// - public static List getEmergencyType() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 焊接探伤类型,探伤比例 + /// + /// 获取探伤类型 + /// + /// + public static List getDetectionType() { - var getDataLists = (from x in db.Base_EmergencyType - orderby x.EmergencyTypeCode - select new Model.BaseInfoItem { BaseInfoId = x.EmergencyTypeId, BaseInfoCode = x.EmergencyTypeCode, BaseInfoName = x.EmergencyTypeName }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_DetectionType + orderby x.DetectionTypeCode + select new Model.BaseInfoItem + { + BaseInfoId = x.DetectionTypeId, + BaseInfoCode = x.DetectionTypeCode, + BaseInfoName = x.DetectionTypeName + } + ).ToList(); + return getDataLists; + } } - } - #endregion - #region 获取国家基础数据 - /// - /// 获取国家基础数据 - /// - /// - public static List getCountry() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 获取探伤比例 + /// + /// + public static List getDetectionRate() { - var getDataLists = (from x in db.RealName_Country - orderby x.Name - select new Model.BaseInfoItem { BaseInfoId = x.CountryId, BaseInfoCode = x.Name, BaseInfoName = x.Cname }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_DetectionRate + orderby x.DetectionRateCode + select new Model.BaseInfoItem + { + BaseInfoId = x.DetectionRateId, + BaseInfoCode = x.DetectionRateCode, + BaseInfoName = x.DetectionRateValue + "%" + } + ).ToList(); + return getDataLists; + } } - } - #endregion + #endregion - #region 获取省份基础数据 - /// - /// 获取省份基础数据 - /// - /// - public static List getProvinceByCountry(string countryId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据类型获取巡检隐患类型表 + /// + /// 根据类型获取巡检隐患类型表 + /// + /// + /// + public static List getHazardRegisterTypes(string type) { - var getDataLists = (from x in db.RealName_City - where countryId == null || countryId=="" || x.CountryId== countryId - orderby x.ProvinceCode - select new Model.BaseInfoItem { BaseInfoId = x.ProvinceCode, BaseInfoCode = x.Name, BaseInfoName = x.Cname }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HSSE_Hazard_HazardRegisterTypes + where x.HazardRegisterType == type + orderby x.TypeCode + select new Model.BaseInfoItem { BaseInfoId = x.RegisterTypesId, BaseInfoCode = x.TypeCode, BaseInfoName = x.RegisterTypesName }).ToList(); + return getDataLists; + } } - } - #endregion + #endregion - #region 获取实名制数据字典信息 - /// - /// 获取实名制数据字典信息 - /// - /// - public static List getBasicDataByDictTypeCode(string dictTypeCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据项目id获取项目图片 + /// + /// 根据项目id获取项目图片 + /// + /// + /// + public static List getProjectPictureByProjectId(string projectId, string pictureType, string strParam) { - var getDataLists = (from x in db.RealName_BasicData - where x.DictTypeCode == dictTypeCode - orderby x.DictCode - select new Model.BaseInfoItem { BaseInfoId = x.DictCode, BaseInfoCode = x.DictCode, BaseInfoName = x.DictName }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.InformationProject_Picture + join y in db.AttachFile on x.PictureId equals y.ToKeyId + where x.States == Const.State_2 && y.AttachUrl != null && x.ProjectId == projectId && x.PictureType == pictureType + orderby x.UploadDate descending + select new Model.BaseInfoItem + { + BaseInfoId = x.PictureId, + BaseInfoName = x.Title, + BaseInfoCode = string.Format("{0:yyyy-MM-dd}", x.UploadDate), + ImageUrl = y.AttachUrl.Replace('\\', '/'), + }); + if (!string.IsNullOrEmpty(strParam)) + { + getDataLists = getDataLists.Where(x => x.BaseInfoName.Contains(strParam)); + } + return getDataLists.ToList(); + } } - } - #endregion - public static List getProjectQuality() - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 项目图片信息保存方法 + /// + /// 图片信息 + public static void SaveProjectPicture(Model.PictureItem picture) { - var getDataLists = (from x in db.WBS_ProjectQuality - orderby x.ProjectQualityType - select x).ToList(); - return getDataLists; + Model.InformationProject_Picture newPicture = new Model.InformationProject_Picture + { + PictureId = picture.PictureId, + ProjectId = picture.ProjectId, + Title = picture.Title, + ContentDef = picture.ContentDef, + PictureType = picture.PictureTypeId, + UploadDate = System.DateTime.Now, + States = Const.State_2, + CompileMan = picture.CompileManId, + }; + + if (string.IsNullOrEmpty(newPicture.PictureId)) + { + newPicture.PictureId = SQLHelper.GetNewID(); + PictureService.AddPicture(newPicture); + } + else + { + PictureService.UpdatePicture(newPicture); + } + + CommonService.btnSaveData(newPicture.ProjectId, Const.ProjectPictureMenuId, newPicture.PictureId, newPicture.CompileMan, true, newPicture.Title, "../InformationProject/PictureView.aspx?PictureId={0}"); + //// 保存附件 + APIUpLoadFileService.SaveAttachUrl(Const.ProjectPictureMenuId, newPicture.PictureId, picture.AttachUrl, "0"); } - } + #endregion - - - public static List getHSSEManager(string projectId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据项目id获取项目地图 + /// + /// 根据项目id获取项目地图 + /// + /// + /// + public static List getProjectMapByProjectId(string projectId, string mapType) { - var userListaq = from x in db.Sys_User - join y in db.Project_ProjectUnit - on x.UnitId equals y.UnitId - join p in db.Project_ProjectUser - on x.UserId equals p.UserId - where p.RoleId.Contains(Const.HSSEManager) - && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == projectId && y.ProjectId == projectId - orderby x.UserCode - select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }; - return userListaq.ToList(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.InformationProject_ProjectMap + join y in db.AttachFile on x.ProjectMapId equals y.ToKeyId + where y.AttachUrl != null && x.ProjectId == projectId && x.MapType == mapType + orderby x.UploadDate descending + select new Model.BaseInfoItem + { + BaseInfoId = x.ProjectMapId, + BaseInfoName = x.Title, + BaseInfoCode = string.Format("{0:yyyy-MM-dd}", x.UploadDate), + ImageUrl = y.AttachUrl.Replace('\\', '/'), + }).Take(5).ToList(); + return getDataLists; + } } - - } - public static List GetUserListByProjectIdAndUnitId(string projectId, string unitId,string system) - { - if (string.IsNullOrEmpty(system)) - { - system = ""; - } - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - List list = new List(); - if (!string.IsNullOrEmpty(projectId)) - { - if (!string.IsNullOrEmpty(unitId)) - { - list = (from x in db.Sys_User - join y in db.Project_ProjectUser - on x.UserId equals y.UserId - where y.ProjectId == projectId && x.UnitId == unitId - where system==""|| y.System.Contains(system) - orderby x.UserName - select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }).ToList(); - } - else - { - list = (from x in db.Sys_User - join y in db.Project_ProjectUser - on x.UserId equals y.UserId - where y.ProjectId == projectId - where system == "" || y.System.Contains(system) - orderby x.UserName - select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }).ToList(); - } - } - else - { - list = (from x in db.Sys_User - where x.UnitId == unitId - orderby x.UserName - select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }).ToList(); - } - return list; - } - } + /// + /// 项目地图信息保存方法 + /// + /// 地图信息 + public static void SaveProjectMap(Model.PictureItem projectMap) + { + Model.InformationProject_ProjectMap newProjectMap = new Model.InformationProject_ProjectMap + { + ProjectMapId = projectMap.PictureId, + ProjectId = projectMap.ProjectId, + Title = projectMap.Title, + ContentDef = projectMap.ContentDef, + MapType = projectMap.PictureTypeId, + UploadDate = System.DateTime.Now, + CompileMan = projectMap.CompileManId, + }; - } + if (string.IsNullOrEmpty(newProjectMap.ProjectMapId)) + { + newProjectMap.ProjectMapId = SQLHelper.GetNewID(); + ProjectMapService.AddProjectMap(newProjectMap); + } + else + { + ProjectMapService.UpdateProjectMap(newProjectMap); + } + //// 保存附件 + APIUpLoadFileService.SaveAttachUrl(Const.ProjectProjectMapMenuId, newProjectMap.ProjectMapId, projectMap.AttachUrl, "0"); + } + #endregion + + #region 获取通知通告 + /// + /// 根据项目id获取通知通告 + /// + /// + /// + public static List getNoticesList(string projectId, string strParam) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.InformationProject_Notice + where x.AccessProjectId.Contains(projectId) && x.IsRelease == true + && (strParam == null || x.NoticeTitle.Contains(strParam)) + orderby x.ReleaseDate descending + select new Model.NoticeItem + { + NoticeId = x.NoticeId, + NoticeCode = x.NoticeCode, + NoticeTitle = x.NoticeTitle, + ReleaseDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.ReleaseDate) + }).ToList(); + return getDataLists; + } + } + + /// + /// 根据项目id获取通知通告 + /// + /// + /// + public static List getNoticesList(string projectId, string userId, string strParam) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.InformationProject_Notice + where x.AccessProjectId.Contains(projectId) && x.IsRelease == true + && (strParam == null || x.NoticeTitle.Contains(strParam)) + select new Model.NoticeItem + { + NoticeId = x.NoticeId, + NoticeCode = x.NoticeCode, + NoticeTitle = x.NoticeTitle, + ReleaseDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.ReleaseDate), + IsRead = db.Sys_UserRead.FirstOrDefault(y => y.DataId == x.NoticeId && y.ProjectId == projectId && y.UserId == userId) == null ? false : true, + }).ToList(); + return getDataLists.OrderBy(x => x.IsRead).ThenByDescending(x => x.ReleaseDate).ToList(); + } + } + + /// + /// 根据项目id获取通知通告 + /// + /// + /// + public static Model.NoticeItem getNoticesByNoticeId(string noticeId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.InformationProject_Notice + where x.NoticeId == noticeId + select new Model.NoticeItem + { + NoticeId = x.NoticeId, + NoticeCode = x.NoticeCode, + NoticeTitle = x.NoticeTitle, + ReleaseDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.ReleaseDate), + MainContent = x.MainContent, + AttachUrl = db.AttachFile.FirstOrDefault(y => y.ToKeyId == x.NoticeId).AttachUrl.Replace("\\", "/"), + }).FirstOrDefault(); + return getDataLists; + } + } + #endregion + + #region 获取部门信息 + /// + /// 获取部门信息 + /// + /// + public static List getBaseDepart(string strParam) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_Depart + where strParam == null || x.DepartName.Contains(strParam) + orderby x.DepartName + select new Model.BaseInfoItem { BaseInfoId = x.DepartId, BaseInfoCode = x.DepartCode, BaseInfoName = x.DepartName }).ToList(); + return getDataLists; + } + } + #endregion + #region 获取岗位信息 + /// + /// 获取岗位信息 + /// + /// + public static List getWorkPost(string strParam) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_WorkPost + where strParam == null || x.WorkPostName.Contains(strParam) + orderby x.WorkPostName + select new Model.BaseInfoItem { BaseInfoId = x.WorkPostId, BaseInfoCode = x.WorkPostCode, BaseInfoName = x.WorkPostName }).ToList(); + return getDataLists; + } + } + public static List getWorkPost(string projectId, string strParam) + { + List res = new List(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_WorkPost + where strParam == null || x.WorkPostName.Contains(strParam) + orderby x.WorkPostName + select new Model.BaseInfoItem { BaseInfoId = x.WorkPostId.ToUpper(), BaseInfoCode = x.WorkPostCode, BaseInfoName = x.WorkPostName }).ToList(); + if (!string.IsNullOrEmpty(projectId)) + { + var user = from u in db.SitePerson_Person + where u.ProjectId == projectId + select u.WorkPostId.ToUpper(); + var postIds = user.Distinct(); + + foreach (var item in getDataLists) + { + if (postIds.Contains(item.BaseInfoId)) + { + res.Add(item); + } + } + } + else + { + res.AddRange(getDataLists); + } + return res; + } + } + #endregion + + #region 获取培训类别 + /// + /// 获取培训类别 + /// + /// + public static List getTrainType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_TrainType + orderby x.TrainTypeCode + select new Model.BaseInfoItem { BaseInfoId = x.TrainTypeId, BaseInfoCode = x.TrainTypeCode, BaseInfoName = x.TrainTypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取培训级别 + /// + /// 获取培训级别 + /// + /// + public static List getTrainLevel() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_TrainLevel + orderby x.TrainLevelCode + select new Model.BaseInfoItem { BaseInfoId = x.TrainLevelId, BaseInfoCode = x.TrainLevelCode, BaseInfoName = x.TrainLevelName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取法律法规类型 + /// + /// 获取法律法规类型 + /// + /// + public static List getLawsRegulationsType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_LawsRegulationsType + orderby x.Code + select new Model.BaseInfoItem { BaseInfoId = x.Id, BaseInfoCode = x.Code, BaseInfoName = x.Name }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取标准规范类型 + /// + /// 获取标准规范类型 + /// + /// + public static List getHSSEStandardListType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_HSSEStandardListType + orderby x.TypeCode + select new Model.BaseInfoItem { BaseInfoId = x.TypeId, BaseInfoCode = x.TypeCode, BaseInfoName = x.TypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取规章制度类型 + /// + /// 获取规章制度类型 + /// + /// + public static List getRulesRegulationsType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_RulesRegulationsType + orderby x.RulesRegulationsTypeCode + select new Model.BaseInfoItem { BaseInfoId = x.RulesRegulationsTypeId, BaseInfoCode = x.RulesRegulationsTypeCode, BaseInfoName = x.RulesRegulationsTypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取管理规定类型 + /// + /// 获取管理规定类型 + /// + /// + public static List getManageRuleType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_ManageRuleType + orderby x.ManageRuleTypeCode + select new Model.BaseInfoItem { BaseInfoId = x.ManageRuleTypeId, BaseInfoCode = x.ManageRuleTypeCode, BaseInfoName = x.ManageRuleTypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取机具设备类型 + /// + /// 获取机具设备类型 + /// + /// + public static List getSpecialEquipment(bool isSpecial) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_SpecialEquipment + where x.IsSpecial == isSpecial + orderby x.SpecialEquipmentCode + select new Model.BaseInfoItem { BaseInfoId = x.SpecialEquipmentId, BaseInfoCode = x.SpecialEquipmentCode, BaseInfoName = x.SpecialEquipmentName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取工作阶段 + /// + /// 获取工作阶段 + /// + /// + public static List getWorkStage() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_WorkStage + orderby x.WorkStageCode + select new Model.BaseInfoItem { BaseInfoId = x.WorkStageId, BaseInfoCode = x.WorkStageCode, BaseInfoName = x.WorkStageName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取项目班组 + /// + /// 获取项目班组 + /// + /// + /// + /// + public static List getTeamGroup(string projectId, string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.ProjectData_TeamGroup + where x.ProjectId == projectId && (unitId == null || x.UnitId == unitId) + orderby x.TeamGroupCode + select new Model.BaseInfoItem { BaseInfoId = x.TeamGroupId, BaseInfoCode = x.TeamGroupCode, BaseInfoName = x.TeamGroupName }).ToList(); + return getDataLists; + } + } + + /// + /// 获取项目班组组长 + /// + /// + /// + /// + public static Model.BaseInfoItem getTeamGroupLeader(string teamGroupId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.ProjectData_TeamGroup + join y in db.SitePerson_Person on x.GroupLeaderId equals y.PersonId + where x.TeamGroupId == teamGroupId && y.PersonId != null + select new Model.BaseInfoItem { BaseInfoId = y.PersonId, BaseInfoCode = y.CardNo, BaseInfoName = y.PersonName }).FirstOrDefault(); + return getDataLists; + } + } + #endregion + + #region 获取项目区域 + /// + /// 获取项目区域 + /// + /// + public static List getWorkArea(string projectId, string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.WBS_UnitWork + where x.ProjectId == projectId && (unitId == null || x.UnitId == unitId) + orderby x.UnitWorkCode + select new Model.BaseInfoItem { BaseInfoId = x.UnitWorkId, BaseInfoCode = x.UnitWorkCode, BaseInfoName = x.UnitWorkName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取作业票-安全措施 + /// + /// 获取作业票-安全措施 + /// + /// + public static List getSafetyMeasures(string licenseType) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_SafetyMeasures + where x.LicenseType == licenseType + orderby x.SortIndex + select new Model.BaseInfoItem { BaseInfoId = x.SafetyMeasuresId, BaseInfoCode = x.SortIndex.ToString(), BaseInfoName = x.SafetyMeasures }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取图片分类 + /// + /// 获取图片分类 + /// + /// + public static List getPictureType(string menuType) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_PictureType + where menuType == null || x.MenuType == menuType + orderby x.Code + select new Model.BaseInfoItem { BaseInfoId = x.PictureTypeId, BaseInfoCode = x.Code, BaseInfoName = x.Name }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取作业许可证(定稿)类型分类 + /// + /// 获取作业许可证类型分类 + /// + /// + public static List getBase_LicenseType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_LicenseType + orderby x.LicenseTypeCode + select new Model.BaseInfoItem { BaseInfoId = x.LicenseTypeId, BaseInfoCode = x.LicenseTypeCode, BaseInfoName = x.LicenseTypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取特岗证书 + /// + /// 获取图片分类 + /// + /// + public static List getCertificate() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_Certificate + orderby x.CertificateCode + select new Model.BaseInfoItem { BaseInfoId = x.CertificateId, BaseInfoCode = x.CertificateCode, BaseInfoName = x.CertificateName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取部门 + /// + /// 获取图片分类 + /// + /// + public static List getDepart() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_Depart + orderby x.DepartCode + select new Model.BaseInfoItem { BaseInfoId = x.DepartId, BaseInfoCode = x.DepartCode, BaseInfoName = x.DepartName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取应急预案类型 + /// + /// 获取图片分类 + /// + /// + public static List getEmergencyType() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Base_EmergencyType + orderby x.EmergencyTypeCode + select new Model.BaseInfoItem { BaseInfoId = x.EmergencyTypeId, BaseInfoCode = x.EmergencyTypeCode, BaseInfoName = x.EmergencyTypeName }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取国家基础数据 + /// + /// 获取国家基础数据 + /// + /// + public static List getCountry() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.RealName_Country + orderby x.Name + select new Model.BaseInfoItem { BaseInfoId = x.CountryId, BaseInfoCode = x.Name, BaseInfoName = x.Cname }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取省份基础数据 + /// + /// 获取省份基础数据 + /// + /// + public static List getProvinceByCountry(string countryId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.RealName_City + where countryId == null || countryId == "" || x.CountryId == countryId + orderby x.ProvinceCode + select new Model.BaseInfoItem { BaseInfoId = x.ProvinceCode, BaseInfoCode = x.Name, BaseInfoName = x.Cname }).ToList(); + return getDataLists; + } + } + #endregion + + #region 获取实名制数据字典信息 + /// + /// 获取实名制数据字典信息 + /// + /// + public static List getBasicDataByDictTypeCode(string dictTypeCode) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.RealName_BasicData + where x.DictTypeCode == dictTypeCode + orderby x.DictCode + select new Model.BaseInfoItem { BaseInfoId = x.DictCode, BaseInfoCode = x.DictCode, BaseInfoName = x.DictName }).ToList(); + return getDataLists; + } + } + #endregion + + public static List getProjectQuality() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.WBS_ProjectQuality + orderby x.ProjectQualityType + select x).ToList(); + return getDataLists; + } + } + + + + public static List getHSSEManager(string projectId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var userListaq = from x in db.Sys_User + join y in db.Project_ProjectUnit + on x.UnitId equals y.UnitId + join p in db.Project_ProjectUser + on x.UserId equals p.UserId + where p.RoleId.Contains(Const.HSSEManager) + && y.UnitType == Const.ProjectUnitType_1 && p.ProjectId == projectId && y.ProjectId == projectId + orderby x.UserCode + select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }; + return userListaq.ToList(); + } + + } + public static List GetUserListByProjectIdAndUnitId(string projectId, string unitId, string system) + { + if (string.IsNullOrEmpty(system)) + { + system = ""; + } + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + List list = new List(); + if (!string.IsNullOrEmpty(projectId)) + { + if (!string.IsNullOrEmpty(unitId)) + { + list = (from x in db.Sys_User + join y in db.Project_ProjectUser + on x.UserId equals y.UserId + where y.ProjectId == projectId && x.UnitId == unitId + where system == "" || y.System.Contains(system) + orderby x.UserName + select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }).ToList(); + } + else + { + list = (from x in db.Sys_User + join y in db.Project_ProjectUser + on x.UserId equals y.UserId + where y.ProjectId == projectId + where system == "" || y.System.Contains(system) + orderby x.UserName + select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }).ToList(); + } + + } + else + { + list = (from x in db.Sys_User + where x.UnitId == unitId + orderby x.UserName + select new Model.BaseInfoItem { BaseInfoId = x.UserId, BaseInfoName = x.UserName, BaseInfoCode = x.Telephone }).ToList(); + } + return list; + } + } + + } } diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index 7271a710..4cbe8601 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -355,7 +355,7 @@ namespace BLL } if (states == "0") { - getViews = getViews.Where(x => x.IsUsed == 0 && !x.AuditorDate.HasValue); + getViews = getViews.Where(x => x.IsUsed == 2 && !x.AuditorDate.HasValue); } else if (states == "1") { @@ -583,7 +583,7 @@ namespace BLL using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { DateTime inDateTime=DateTime.Now; - if (!string.IsNullOrEmpty(InTime)) + if (!string.IsNullOrEmpty(InTime)&&!"null".Equals(InTime)) { inDateTime = DateTime.Parse(InTime); } diff --git a/SGGL/BLL/API/APIUpLoadFileService.cs b/SGGL/BLL/API/APIUpLoadFileService.cs index 89a1d74b..f7c0baa6 100644 --- a/SGGL/BLL/API/APIUpLoadFileService.cs +++ b/SGGL/BLL/API/APIUpLoadFileService.cs @@ -122,35 +122,38 @@ namespace BLL toDoItem.UrlStr = att.AttachUrl + "," + toDoItem.UrlStr; } } - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(toDoItem.UrlStr, 10, null), toDoItem.UrlStr, toDoItem.MenuId, toDoItem.DataId); + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(toDoItem.UrlStr, 10, null), toDoItem.UrlStr, toDoItem.MenuId, toDoItem.DataId); } else { - CommonService.DeleteAttachFileById(toDoItem.DataId); + CommonService.DeleteAttachFileByIdForApi(toDoItem.DataId); } } } - public static void SaveAttachUrl(string menuId, string dataId, string url, string isInsert) - { - ////保存附件 - if (!string.IsNullOrEmpty(url)) + public static void SaveAttachUrl(string menuId, string dataId, string url, string isInsert) { - if (isInsert == "1") - { - var att = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId); - if (att != null) - { - url = att.AttachUrl + "," + url; - } - } - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(url, 10, null), url, menuId, dataId); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + ////保存附件 + if (!string.IsNullOrEmpty(url)) + { + if (isInsert == "1") + { + var att = db.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId); + if (att != null) + { + url = att.AttachUrl + "," + url; + } + } + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(url, 10, null), url, menuId, dataId); + } + else + { + CommonService.DeleteAttachFileByIdForApi(dataId); + } + } } - else - { - CommonService.DeleteAttachFileById(dataId); - } - } /// /// 获取附件路径 @@ -177,12 +180,12 @@ namespace BLL } return fileUrl; } - - /// - /// 获取附件路径 - /// - /// - public static string getFileUrl(string menuId, string tokeyId, string url) + + /// + /// 获取附件路径 + /// + /// + public static string getFileUrl(string menuId, string tokeyId, string url) { string fileUrl = url; using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) diff --git a/SGGL/BLL/API/APIUserService.cs b/SGGL/BLL/API/APIUserService.cs index 0f500921..2cc46ebb 100644 --- a/SGGL/BLL/API/APIUserService.cs +++ b/SGGL/BLL/API/APIUserService.cs @@ -208,7 +208,7 @@ namespace BLL Password = x.Password, UserName = x.UserName, RoleId = y.RoleId, - RoleName = RoleService.getRoleNamesRoleIds(y.RoleId), + RoleName = RoleService.getRoleNamesRoleIdsForApi(y.RoleId), UnitId = y.UnitId, UnitName = db.Base_Unit.First(z => z.UnitId == y.UnitId).UnitName, LoginProjectId = y.ProjectId, diff --git a/SGGL/BLL/API/CQMS/ApiInspectionManagementService.cs b/SGGL/BLL/API/CQMS/ApiInspectionManagementService.cs index ce67ab8e..4d3373de 100644 --- a/SGGL/BLL/API/CQMS/ApiInspectionManagementService.cs +++ b/SGGL/BLL/API/CQMS/ApiInspectionManagementService.cs @@ -137,11 +137,11 @@ namespace BLL.API.CQMS inspectionManagement.AttachUrl2 = item.ProcessControl_InspectionManagement.AttachUrl2; inspectionManagement.MainSendUnitId = item.ProcessControl_InspectionManagement.MainSendUnitId; if(!string.IsNullOrEmpty(inspectionManagement.MainSendUnitId)) - inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.MainSendUnitId);//item.ProcessControl_InspectionManagement.MainSendUnitName; + inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIdsForApi(inspectionManagement.MainSendUnitId);//item.ProcessControl_InspectionManagement.MainSendUnitName; inspectionManagement.CCUnitIds = item.ProcessControl_InspectionManagement.CCUnitIds; if (!string.IsNullOrEmpty(inspectionManagement.CCUnitIds)) { - inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.CCUnitIds);// item.ProcessControl_InspectionManagement.CCUnitName; + inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIdsForApi(inspectionManagement.CCUnitIds);// item.ProcessControl_InspectionManagement.CCUnitName; } inspectionManagement.PlanComplateDate = item.ProcessControl_InspectionManagement.PlanComplateDate.HasValue? item.ProcessControl_InspectionManagement.PlanComplateDate.Value.ToString("yyyy-MM-dd"): ""; @@ -211,11 +211,11 @@ namespace BLL.API.CQMS inspectionManagement.AttachUrl2 = item.AttachUrl2; inspectionManagement.MainSendUnitId = item.MainSendUnitId; if (!string.IsNullOrEmpty(inspectionManagement.MainSendUnitId)) - inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.MainSendUnitId);//item.MainSendUnitName; + inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIdsForApi(inspectionManagement.MainSendUnitId);//item.MainSendUnitName; inspectionManagement.CCUnitIds = item.CCUnitIds; if (!string.IsNullOrEmpty(inspectionManagement.CCUnitIds)) { - inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.CCUnitIds);// item.CCUnitName; + inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIdsForApi(inspectionManagement.CCUnitIds);// item.CCUnitName; } inspectionManagement.PlanComplateDate = item.PlanComplateDate.HasValue ? item.PlanComplateDate.Value.ToString("yyyy-MM-dd") : ""; @@ -297,11 +297,11 @@ namespace BLL.API.CQMS inspectionManagement.AttachUrl2 = item.ProcessControl_InspectionManagement.AttachUrl2; inspectionManagement.MainSendUnitId = item.ProcessControl_InspectionManagement.MainSendUnitId; if (!string.IsNullOrEmpty(inspectionManagement.MainSendUnitId)) - inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.MainSendUnitId);//item.ProcessControl_InspectionManagement.MainSendUnitName; + inspectionManagement.MainSendUnitName = UnitService.getUnitNamesUnitIdsForApi(inspectionManagement.MainSendUnitId);//item.ProcessControl_InspectionManagement.MainSendUnitName; inspectionManagement.CCUnitIds = item.ProcessControl_InspectionManagement.CCUnitIds; if (!string.IsNullOrEmpty(inspectionManagement.CCUnitIds)) { - inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIds(inspectionManagement.CCUnitIds);// item.ProcessControl_InspectionManagement.CCUnitName; + inspectionManagement.CCUnitName = UnitService.getUnitNamesUnitIdsForApi(inspectionManagement.CCUnitIds);// item.ProcessControl_InspectionManagement.CCUnitName; } inspectionManagement.PlanComplateDate = item.ProcessControl_InspectionManagement.PlanComplateDate.HasValue ? item.ProcessControl_InspectionManagement.PlanComplateDate.Value.ToString("yyyy-MM-dd") : ""; diff --git a/SGGL/BLL/API/HJGL/APINDETrustService.cs b/SGGL/BLL/API/HJGL/APINDETrustService.cs index b9253dad..ecd961ee 100644 --- a/SGGL/BLL/API/HJGL/APINDETrustService.cs +++ b/SGGL/BLL/API/HJGL/APINDETrustService.cs @@ -1,955 +1,1058 @@ -using System; +using Microsoft.SqlServer.Dts.Runtime; +using Model; +using NPOI.SS.Formula.Functions; +using System; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace BLL { - public static class APINDETrustService - { - #region 选择单位工程、探伤类型、探伤比例、点口批号获取需要进行点口的批 - /// - /// 选择单位工程、探伤类型、探伤比例、点口批号获取还未点口的批 - /// - /// - /// - /// - /// - /// - public static List getAutoPointBatchCode(string unitWorkId,string detectionTypeId,string detectionRateId, string pointBatchCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + public static class APINDETrustService + { + #region 选择单位工程、探伤类型、探伤比例、点口批号获取需要进行点口的批 + /// + /// 选择单位工程、探伤类型、探伤比例、点口批号获取还未点口的批 + /// + /// + /// + /// + /// + /// + public static List getAutoPointBatchCode(string unitWorkId, string detectionTypeId, string detectionRateId, string pointBatchCode) { - var dataList = from x in db.HJGL_Batch_PointBatch - where x.UnitWorkId == unitWorkId && x.EndDate == null - select x; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var dataList = from x in db.HJGL_Batch_PointBatch + where x.UnitWorkId == unitWorkId && x.EndDate == null + select x; - if (!string.IsNullOrEmpty(detectionTypeId)) - { - dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId); - } - if (!string.IsNullOrEmpty(detectionRateId)) - { - dataList = dataList.Where(e => e.DetectionRateId == detectionRateId); - } - if (!string.IsNullOrEmpty(pointBatchCode)) - { - dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode)); - } - - var getDataLists = (from x in dataList - orderby x.PointBatchCode - select new Model.NDETrustItem - { - PointBatchId = x.PointBatchId, - PointBatchCode = x.PointBatchCode, - }).ToList(); - return getDataLists; - } - } - #endregion - - #region 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表) - /// - /// 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表) - /// - /// - /// - /// - /// - public static List getPointBatchCode(string unitWorkId, string detectionTypeId, string detectionRateId, string pointBatchCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var dataList = from x in db.HJGL_Batch_PointBatch - join y in db.HJGL_Batch_PointBatchItem on x.PointBatchId equals y.PointBatchId - where x.UnitWorkId == unitWorkId && y.IsBuildTrust == null && x.EndDate.HasValue - select x; - - if (!string.IsNullOrEmpty(detectionTypeId)) - { - dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId); - } - if (!string.IsNullOrEmpty(detectionRateId)) - { - dataList = dataList.Where(e => e.DetectionRateId == detectionRateId); - } - if (!string.IsNullOrEmpty(pointBatchCode)) - { - dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode)); - } - - var getDataLists = (from x in dataList - orderby x.PointBatchCode - select new Model.NDETrustItem - { - PointBatchId = x.PointBatchId, - PointBatchCode = x.PointBatchCode, - }).Distinct().ToList(); - return getDataLists; - } - } - #endregion - - #region 根据点口批ID获取批明细(自动点口呈现) - /// - /// 根据点口批ID获取批明细(自动点口呈现) - /// - /// - /// - /// - public static List getPointBatchDetail(string pointBatchId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.HJGL_Batch_PointBatchItem - join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.PointBatchId == pointBatchId - select new Model.NDETrustItem - { - WeldJointId = x.WeldJointId, - WeldJointCode = y.WeldJointCode, - PipelineCode = y.PipelineCode, - JointArea = y.JointArea, - AttachUrl = y.AttachUrl - }).ToList(); - - return getDataLists; - } - } - #endregion - - #region 根据点口批ID获取已点口还未审批的焊口 - /// - /// 根据点口批ID获取已点口还未审批的焊口 - /// - /// - /// - /// - public static List getPointWeldJoint(string pointBatchId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.HJGL_Batch_PointBatchItem - join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.IsBuildTrust == null && x.PointBatchId == pointBatchId && x.PointState == "1" - select new Model.NDETrustItem - { - WeldJointId = x.WeldJointId, - WeldJointCode = y.WeldJointCode, - PipelineCode = y.PipelineCode, - JointArea = y.JointArea, - AttachUrl = y.AttachUrl - }).ToList(); - - return getDataLists; - } - } - #endregion - - #region 根据点口批ID和焊口ID获取待调整焊口 - /// - /// 根据点口批ID和焊口ID获取待调整焊口 - /// - /// - /// - /// - public static List getPointWeldJoint(string pointBatchId, string weldJointId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var jot = BLL.WeldJointService.GetWeldJointByWeldJointId(weldJointId); - - var getDataLists = (from x in Funs.DB.HJGL_Batch_PointBatchItem - join y in Funs.DB.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.PointBatchId == pointBatchId && x.PointState == null - && y.JointAttribute == jot.JointAttribute - select new Model.NDETrustItem - { - WeldJointId = x.WeldJointId, - WeldJointCode = y.WeldJointCode, - PipelineCode = y.PipelineCode, - JointArea = y.JointArea, - AttachUrl = y.AttachUrl - }).ToList(); - - return getDataLists; - } - } - #endregion - - #region 对所选批次进行自动点口 - /// - /// 对所选批次进行自动点口 - /// - /// - public static void AutoPointSave(string pointBatchId) - { - BLL.PointBatchDetailService.AutoPoint(pointBatchId); - } - #endregion - - #region 点口调整 - /// - /// 点口调整 - /// - /// 原来点的焊口 - /// 调为新的焊口 - public static void RePointSave(string oldJointId,string newJointId) - { - var oldPoint = BLL.PointBatchDetailService.GetBatchDetailByJotId(oldJointId); - if (oldPoint != null) - { - oldPoint.PointDate = null; - oldPoint.PointState = null; - oldPoint.IsAudit = null; - oldPoint.IsPipelineFirst = null; - oldPoint.IsWelderFirst = null; - } - - var newPoint = BLL.PointBatchDetailService.GetBatchDetailByJotId(newJointId); - if (newPoint != null) - { - newPoint.PointState = "1"; - newPoint.PointDate = DateTime.Now; - } - - Funs.DB.SubmitChanges(); - } - #endregion - - #region 根据单位工程获取所有已点的焊口列表 - /// - /// 根据单位工程获取所有已点的焊口列表 - /// - /// - /// - public static List GetPointWeldJointList(string unitWorkId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.HJGL_Batch_PointBatchItem - join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId - where x.IsBuildTrust == null && z.UnitWorkId == unitWorkId - && x.PointState == "1" - select new Model.NDETrustItem - { - WeldJointId = x.WeldJointId, - PointBatchCode = z.PointBatchCode, - WeldJointCode = y.WeldJointCode, - PipelineCode = y.PipelineCode, - AttachUrl = y.AttachUrl - }).ToList(); - - return getDataLists; - } - } - #endregion - - #region 根据单位工程获取所有已点的焊口生成委托单 - /// - /// 根据单位工程获取所有已点的焊口生成委托单 - /// - /// - public static void GenerateTrust(string unitWorkId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getViewGenerateTrustLists = (from x in db.View_GenerateTrust where x.UnitWorkId == unitWorkId select x).ToList(); - - foreach (var trust in getViewGenerateTrustLists) - { - Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust(); - var project = BLL.ProjectService.GetProjectByProjectId(trust.ProjectId); - var unit = BLL.UnitService.GetUnitByUnitId(trust.UnitId); - var unitWork = BLL.UnitWorkService.getUnitWorkByUnitWorkId(trust.UnitWorkId); - var ndt = BLL.Base_DetectionTypeService.GetDetectionTypeByDetectionTypeId(trust.DetectionTypeId); - var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId); - - string perfix = string.Empty; - perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-"; - newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix); - - string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust)); - newBatchTrust.TrustBatchId = trustBatchId; - - newBatchTrust.TrustDate = DateTime.Now; - newBatchTrust.ProjectId = trust.ProjectId; - newBatchTrust.UnitId = trust.UnitId; - newBatchTrust.UnitWorkId = trust.UnitWorkId; - newBatchTrust.DetectionTypeId = trust.DetectionTypeId; - newBatchTrust.NDEUuit = unitWork.NDEUnit; - - BLL.Batch_BatchTrustService.AddBatchTrust(newBatchTrust); // 新增委托单 - - // 生成委托条件对比 - var generateTrustItem = from x in db.View_GenerateTrustItem - where x.ProjectId == trust.ProjectId - && x.UnitWorkId == trust.UnitWorkId && x.UnitId == trust.UnitId - && x.DetectionTypeId == trust.DetectionTypeId - && x.DetectionRateId == trust.DetectionRateId - select x; - - List toPointBatchList = generateTrustItem.Select(x => x.PointBatchId).Distinct().ToList(); - - // 生成委托明细,并回写点口明细信息 - foreach (var item in generateTrustItem) - { - if (BLL.Batch_BatchTrustItemService.GetIsGenerateTrust(item.PointBatchItemId)) ////生成委托单的条件判断 + if (!string.IsNullOrEmpty(detectionTypeId)) { - Model.HJGL_Batch_BatchTrustItem trustItem = new Model.HJGL_Batch_BatchTrustItem - { - TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)), - TrustBatchId = trustBatchId, - PointBatchItemId = item.PointBatchItemId, - WeldJointId = item.WeldJointId, - CreateDate = DateTime.Now - }; - Batch_BatchTrustItemService.AddBatchTrustItem(trustItem); + dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId); + } + if (!string.IsNullOrEmpty(detectionRateId)) + { + dataList = dataList.Where(e => e.DetectionRateId == detectionRateId); + } + if (!string.IsNullOrEmpty(pointBatchCode)) + { + dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode)); } - Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId); + var getDataLists = (from x in dataList + orderby x.PointBatchCode + select new Model.NDETrustItem + { + PointBatchId = x.PointBatchId, + PointBatchCode = x.PointBatchCode, + }).ToList(); + return getDataLists; + } + } + #endregion + + #region 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表) + /// + /// 根据单位工程、点口批号、批开始时间获取需要调整的批(已点口但还未进行委托的批列表) + /// + /// + /// + /// + /// + public static List getPointBatchCode(string unitWorkId, string detectionTypeId, string detectionRateId, string pointBatchCode) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var dataList = from x in db.HJGL_Batch_PointBatch + join y in db.HJGL_Batch_PointBatchItem on x.PointBatchId equals y.PointBatchId + where x.UnitWorkId == unitWorkId && y.IsBuildTrust == null && x.EndDate.HasValue + select x; + + if (!string.IsNullOrEmpty(detectionTypeId)) + { + dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId); + } + if (!string.IsNullOrEmpty(detectionRateId)) + { + dataList = dataList.Where(e => e.DetectionRateId == detectionRateId); + } + if (!string.IsNullOrEmpty(pointBatchCode)) + { + dataList = dataList.Where(e => e.PointBatchCode.Contains(pointBatchCode)); + } + + var getDataLists = (from x in dataList + orderby x.PointBatchCode + select new Model.NDETrustItem + { + PointBatchId = x.PointBatchId, + PointBatchCode = x.PointBatchCode, + }).Distinct().ToList(); + return getDataLists; + } + } + #endregion + + #region 根据点口批ID获取批明细(自动点口呈现) + /// + /// 根据点口批ID获取批明细(自动点口呈现) + /// + /// + /// + /// + public static List getPointBatchDetail(string pointBatchId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where x.PointBatchId == pointBatchId + select new Model.NDETrustItem + { + WeldJointId = x.WeldJointId, + WeldJointCode = y.WeldJointCode, + PipelineCode = y.PipelineCode, + JointArea = y.JointArea, + AttachUrl = y.AttachUrl + }).ToList(); + + return getDataLists; + } + } + #endregion + + #region 根据点口批ID获取已点口还未审批的焊口 + /// + /// 根据点口批ID获取已点口还未审批的焊口 + /// + /// + /// + /// + public static List getPointWeldJoint(string pointBatchId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where x.IsBuildTrust == null && x.PointBatchId == pointBatchId && x.PointState == "1" + select new Model.NDETrustItem + { + WeldJointId = x.WeldJointId, + WeldJointCode = y.WeldJointCode, + PipelineCode = y.PipelineCode, + JointArea = y.JointArea, + AttachUrl = y.AttachUrl + }).ToList(); + + return getDataLists; + } + } + #endregion + + #region 根据点口批ID和焊口ID获取待调整焊口 + /// + /// 根据点口批ID和焊口ID获取待调整焊口 + /// + /// + /// + /// + public static List getPointWeldJoint(string pointBatchId, string weldJointId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var jot = db.HJGL_WeldJoint.FirstOrDefault(e => e.WeldJointId == weldJointId); + + var getDataLists = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where x.PointBatchId == pointBatchId && x.PointState == null + && y.JointAttribute == jot.JointAttribute + select new Model.NDETrustItem + { + WeldJointId = x.WeldJointId, + WeldJointCode = y.WeldJointCode, + PipelineCode = y.PipelineCode, + JointArea = y.JointArea, + AttachUrl = y.AttachUrl + }).ToList(); + + return getDataLists; + } + } + #endregion + + #region 对所选批次进行自动点口 + /// + /// 对所选批次进行自动点口 + /// + /// + public static void AutoPointSave(string pointBatchId) + { + AutoPoint(pointBatchId); + } + public static void AutoPoint(string pointBatchId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int pointNum = 0; + int pointNumG = 0; + int pointNumA = 0; + + var batch = db.HJGL_Batch_PointBatch.FirstOrDefault(e => e.PointBatchId == pointBatchId); + var batchItemNum = db.HJGL_Batch_PointBatchItem.Where(e => e.PointBatchId == pointBatchId).ToList(); + + if (batch.DetectionRateId != null && batchItemNum.Count() > 0) + { + var rate = db.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == batch.DetectionRateId); + // 批里要检测的数量 + pointNum = Convert.ToInt32(Math.Ceiling((batchItemNum.Count() * Convert.ToDouble(rate.DetectionRateValue)) * 0.01)); + } + + var weldG = from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where y.JointAttribute == "固定口" && x.PointBatchId == pointBatchId + select x; + var weldA = from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where y.JointAttribute == "活动口" && x.PointBatchId == pointBatchId + select x; + if (weldG.Count() > 0) + { + // 固定口检测数量 + pointNumG = Convert.ToInt32(Math.Ceiling(weldG.Count() * 0.4)); + } + + // 活动口要检测的数量 + pointNumA = pointNum - pointNumG; + + if (pointNumG > 0) + { + int[] r = Funs.GetRandomNum(pointNumG, 1, weldG.Count()); + int i = 0; + foreach (var p in weldG) + { + i++; + if (r.Contains(i)) + { + Model.HJGL_Batch_PointBatchItem newBatchDetail = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == p.PointBatchItemId); + if (newBatchDetail != null) + { + newBatchDetail.PointState = "1"; + newBatchDetail.PointDate = System.DateTime.Now; + db.SubmitChanges(); + } + } + } + } + + if (pointNumA > 0) + { + int[] r = Funs.GetRandomNum(pointNumA, 1, weldA.Count()); + int j = 0; + foreach (var p in weldA) + { + j++; + if (r.Contains(j)) + { + Model.HJGL_Batch_PointBatchItem newBatchDetail = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == p.PointBatchItemId); + if (newBatchDetail != null) + { + newBatchDetail.PointState = "1"; + newBatchDetail.PointDate = System.DateTime.Now; + + } + db.SubmitChanges(); + + } + } + } + Model.HJGL_Batch_PointBatch newBatch = db.HJGL_Batch_PointBatch.FirstOrDefault(e => e.PointBatchId == pointBatchId); + if (newBatch != null) + { + newBatch.EndDate = DateTime.Now; + db.SubmitChanges(); + } + + } + } + #endregion + + #region 点口调整 + /// + /// 点口调整 + /// + /// 原来点的焊口 + /// 调为新的焊口 + public static void RePointSave(string oldJointId, string newJointId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var oldPoint = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == oldJointId); + if (oldPoint != null) + { + oldPoint.PointDate = null; + oldPoint.PointState = null; + oldPoint.IsAudit = null; + oldPoint.IsPipelineFirst = null; + oldPoint.IsWelderFirst = null; + } + + var newPoint = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.WeldJointId == newJointId); + if (newPoint != null) + { + newPoint.PointState = "1"; + newPoint.PointDate = DateTime.Now; + } - pointBatchItem.IsBuildTrust = true; db.SubmitChanges(); - } + } + } + #endregion + #region 根据单位工程获取所有已点的焊口列表 + /// + /// 根据单位工程获取所有已点的焊口列表 + /// + /// + /// + public static List GetPointWeldJointList(string unitWorkId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId + where x.IsBuildTrust == null && z.UnitWorkId == unitWorkId + && x.PointState == "1" + select new Model.NDETrustItem + { + WeldJointId = x.WeldJointId, + PointBatchCode = z.PointBatchCode, + WeldJointCode = y.WeldJointCode, + PipelineCode = y.PipelineCode, + AttachUrl = y.AttachUrl + }).ToList(); - // 回写委托批对应点口信息 - if (toPointBatchList.Count() > 0) - { - string toPointBatch = String.Join(",", toPointBatchList); + return getDataLists; + } + } + #endregion - var updateTrut = BLL.Batch_BatchTrustService.GetBatchTrustById(trustBatchId); - if (updateTrut != null) + #region 根据单位工程获取所有已点的焊口生成委托单 + /// + /// 根据单位工程获取所有已点的焊口生成委托单 + /// + /// + public static void GenerateTrust(string unitWorkId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getViewGenerateTrustLists = (from x in db.View_GenerateTrust where x.UnitWorkId == unitWorkId select x).ToList(); + + foreach (var trust in getViewGenerateTrustLists) { - updateTrut.TopointBatch = toPointBatch; - BLL.Batch_BatchTrustService.UpdateBatchTrust(updateTrut); + Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust(); + var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == trust.ProjectId) ; + var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == trust.UnitId) ; + var unitWork = db.WBS_UnitWork.FirstOrDefault(e => e.UnitWorkId.ToString() == trust.UnitWorkId) ; + var ndt = db.Base_DetectionType.FirstOrDefault(e => e.DetectionTypeId == trust.DetectionTypeId) ; + var rate = db.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == trust.DetectionRateId) ; + + string perfix = string.Empty; + perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-"; + newBatchTrust.TrustBatchCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.HJGL_Batch_BatchTrust", "TrustBatchCode", project.ProjectId, perfix); + + string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust)); + newBatchTrust.TrustBatchId = trustBatchId; + + newBatchTrust.TrustDate = DateTime.Now; + newBatchTrust.ProjectId = trust.ProjectId; + newBatchTrust.UnitId = trust.UnitId; + newBatchTrust.UnitWorkId = trust.UnitWorkId; + newBatchTrust.DetectionTypeId = trust.DetectionTypeId; + newBatchTrust.NDEUuit = unitWork.NDEUnit; + newBatchTrust.IsAudit = true; + db.HJGL_Batch_BatchTrust.InsertOnSubmit(newBatchTrust); + db.SubmitChanges(); + // 生成委托条件对比 + var generateTrustItem = from x in db.View_GenerateTrustItem + where x.ProjectId == trust.ProjectId + && x.UnitWorkId == trust.UnitWorkId && x.UnitId == trust.UnitId + && x.DetectionTypeId == trust.DetectionTypeId + && x.DetectionRateId == trust.DetectionRateId + select x; + + List toPointBatchList = generateTrustItem.Select(x => x.PointBatchId).Distinct().ToList(); + + // 生成委托明细,并回写点口明细信息 + foreach (var item in generateTrustItem) + { + if (BLL.Batch_BatchTrustItemService.GetIsGenerateTrust(item.PointBatchItemId)) ////生成委托单的条件判断 + { + Model.HJGL_Batch_BatchTrustItem trustItem = new Model.HJGL_Batch_BatchTrustItem + { + TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)), + TrustBatchId = trustBatchId, + PointBatchItemId = item.PointBatchItemId, + WeldJointId = item.WeldJointId, + CreateDate = DateTime.Now + }; + db.HJGL_Batch_BatchTrustItem.InsertOnSubmit(trustItem); + db.SubmitChanges(); + } + + Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(e => e.PointBatchItemId == item.PointBatchItemId); + + pointBatchItem.IsBuildTrust = true; + db.SubmitChanges(); + } + + + // 回写委托批对应点口信息 + if (toPointBatchList.Count() > 0) + { + string toPointBatch = String.Join(",", toPointBatchList); + + var updateTrut = db.HJGL_Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == trustBatchId); + if (updateTrut != null) + { + updateTrut.TopointBatch = toPointBatch; + db.SubmitChanges(); + + } + } + } - } - - } + } } - } - #endregion + #endregion - //////////////////////////////////////委托单///////////////////////////////////////////////////////////// + //////////////////////////////////////委托单///////////////////////////////////////////////////////////// - #region 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单 - /// - /// 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单 - /// - /// - /// - /// - /// - /// - /// - public static List getBatchTrustCode(string unitWorkId, string detectionTypeId, string detectionRateId, bool? isAudit ,string trustBatchCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单 + /// + /// 选择单位工程、探伤类型、探伤比例、委托单号等获取委托单 + /// + /// + /// + /// + /// + /// + /// + public static List getBatchTrustCode(string unitWorkId, string detectionTypeId, string detectionRateId, bool? isAudit, string trustBatchCode) { - var dataList = from x in db.HJGL_Batch_BatchTrust - where x.UnitWorkId == unitWorkId - select x; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var dataList = from x in db.HJGL_Batch_BatchTrust + where x.UnitWorkId == unitWorkId + select x; - if (!string.IsNullOrEmpty(detectionTypeId)) - { - dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId); - } - if (!string.IsNullOrEmpty(detectionRateId)) - { - dataList = dataList.Where(e => e.DetectionRateId == detectionRateId); - } + if (!string.IsNullOrEmpty(detectionTypeId)) + { + dataList = dataList.Where(e => e.DetectionTypeId == detectionTypeId); + } + if (!string.IsNullOrEmpty(detectionRateId)) + { + dataList = dataList.Where(e => e.DetectionRateId == detectionRateId); + } - if (isAudit == true) - { - dataList = dataList.Where(e => e.IsAudit == true); - } - else - { - dataList = dataList.Where(e => e.IsAudit == null || e.IsAudit == false); - } + if (isAudit == true) + { + dataList = dataList.Where(e => e.IsAudit == true); + } + else + { + dataList = dataList.Where(e => e.IsAudit == null || e.IsAudit == false); + } - if (!string.IsNullOrEmpty(trustBatchCode)) - { - dataList = dataList.Where(e => e.TrustBatchCode.Contains(trustBatchCode)); - } + if (!string.IsNullOrEmpty(trustBatchCode)) + { + dataList = dataList.Where(e => e.TrustBatchCode.Contains(trustBatchCode)); + } - var getDataLists = (from x in dataList - orderby x.TrustBatchCode - select new Model.BaseInfoItem - { - BaseInfoId = x.TrustBatchId, - BaseInfoCode = x.TrustBatchCode, - }).ToList(); - return getDataLists; + var getDataLists = (from x in dataList + orderby x.TrustBatchCode + select new Model.BaseInfoItem + { + BaseInfoId = x.TrustBatchId, + BaseInfoCode = x.TrustBatchCode, + }).ToList(); + return getDataLists; + } } - } - #endregion + #endregion - #region 选择委托单ID获取委托单明细信息 - /// - /// 选择委托单ID获取委托单明细信息 - /// - /// - /// - public static List GetBatchTrustDetail(string trustBatchId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 选择委托单ID获取委托单明细信息 + /// + /// 选择委托单ID获取委托单明细信息 + /// + /// + /// + public static List GetBatchTrustDetail(string trustBatchId) { - var getDataLists = (from x in db.HJGL_Batch_BatchTrustItem - join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - where x.TrustBatchId == trustBatchId - orderby y.WeldJointCode - select new Model.NDETrustItem - { - WeldJointCode = y.WeldJointCode, - PipelineCode = y.PipelineCode, - JointArea = y.JointArea, - }).ToList(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_Batch_BatchTrustItem + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + where x.TrustBatchId == trustBatchId + orderby y.WeldJointCode + select new Model.NDETrustItem + { + WeldJointCode = y.WeldJointCode, + PipelineCode = y.PipelineCode, + JointArea = y.JointArea, + }).ToList(); - return getDataLists; + return getDataLists; + } } - } - #endregion + #endregion - #region 对所选委托单进行审核 - /// - /// 对所选委托单进行审核 - /// - /// - public static void BatchTrustAudit(string trustBatchId) - { - BLL.Batch_BatchTrustService.UpdateBatchTrustAudit(trustBatchId, true); - } - #endregion - - ///////////////////////////////////////无损检测单//////////////////////////////////////////// - #region 无损检测单 - /// - /// 选择单位工程、探伤类型、检测单号获取检测单 - /// - /// - /// - /// - /// - public static List getBatchNdeCode(string unitWorkId, string detectionTypeId, string ndeCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 对所选委托单进行审核 + /// + /// 对所选委托单进行审核 + /// + /// + public static void BatchTrustAudit(string trustBatchId) { - var dataList = from x in db.HJGL_Batch_NDE - join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId - where x.UnitWorkId == unitWorkId - select new Model.BaseInfoItem - { - BaseInfoId = x.NDEID, - BaseInfoCode = x.NDECode, - BaseInfoName = y.DetectionTypeId - }; - - if (!string.IsNullOrEmpty(detectionTypeId)) - { - dataList = dataList.Where(e => e.BaseInfoName == detectionTypeId); - } - - if (!string.IsNullOrEmpty(ndeCode)) - { - dataList = dataList.Where(e => e.BaseInfoCode.Contains(ndeCode)); - } - - var getDataLists = (from x in dataList - orderby x.BaseInfoCode - select new Model.BaseInfoItem - { - BaseInfoId = x.BaseInfoId, - BaseInfoCode = x.BaseInfoCode, - }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.HJGL_Batch_BatchTrust newBatchTrust = db.HJGL_Batch_BatchTrust.FirstOrDefault(e => e.TrustBatchId == trustBatchId); + if (newBatchTrust != null) + { + newBatchTrust.IsAudit = true; + db.SubmitChanges(); + } + } } - } + #endregion - /// - /// 根据检测单ID获取检测单明细 - /// - /// - /// - public static List GetBatchNDEDetail(string ndeId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + ///////////////////////////////////////无损检测单//////////////////////////////////////////// + #region 无损检测单 + /// + /// 选择单位工程、探伤类型、检测单号获取检测单 + /// + /// + /// + /// + /// + public static List getBatchNdeCode(string unitWorkId, string detectionTypeId, string ndeCode) { - var getDataLists = (from x in db.HJGL_Batch_NDEItem - join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId - join z in db.HJGL_WeldJoint on y.WeldJointId equals z.WeldJointId - where x.NDEID == ndeId - orderby z.WeldJointCode - select new Model.NDETrustItem - { - WeldJointCode = z.WeldJointCode, - PipelineCode = z.PipelineCode, - JointArea = z.JointArea, - CheckResult = x.CheckResult == "1" ? "合格" : "不合格" - }).ToList(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var dataList = from x in db.HJGL_Batch_NDE + join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId + where x.UnitWorkId == unitWorkId + select new Model.BaseInfoItem + { + BaseInfoId = x.NDEID, + BaseInfoCode = x.NDECode, + BaseInfoName = y.DetectionTypeId + }; - return getDataLists; + if (!string.IsNullOrEmpty(detectionTypeId)) + { + dataList = dataList.Where(e => e.BaseInfoName == detectionTypeId); + } + + if (!string.IsNullOrEmpty(ndeCode)) + { + dataList = dataList.Where(e => e.BaseInfoCode.Contains(ndeCode)); + } + + var getDataLists = (from x in dataList + orderby x.BaseInfoCode + select new Model.BaseInfoItem + { + BaseInfoId = x.BaseInfoId, + BaseInfoCode = x.BaseInfoCode, + }).ToList(); + return getDataLists; + } } - } - #endregion - //////////////////////////////////////返修/扩透///////////////////////////////////// - - #region 返修/扩透 - /// - /// 获取返修单列表 - /// - /// - /// - /// - /// - public static List GetRepairRecord(string unitWorkId, bool isAudit, string repairRecordCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 根据检测单ID获取检测单明细 + /// + /// + /// + public static List GetBatchNDEDetail(string ndeId) { - var repair = (from x in db.HJGL_RepairRecord - where x.UnitWorkId == unitWorkId - orderby x.RepairRecordCode descending - select x).ToList(); - if (isAudit) - { - repair = (from x in repair where x.AuditDate.HasValue select x).ToList(); - } - else - { - repair = (from x in repair where !x.AuditDate.HasValue select x).ToList(); - } + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_Batch_NDEItem + join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId + join z in db.HJGL_WeldJoint on y.WeldJointId equals z.WeldJointId + where x.NDEID == ndeId + orderby z.WeldJointCode + select new Model.NDETrustItem + { + WeldJointCode = z.WeldJointCode, + PipelineCode = z.PipelineCode, + JointArea = z.JointArea, + CheckResult = x.CheckResult == "1" ? "合格" : "不合格" + }).ToList(); - if (!string.IsNullOrEmpty(repairRecordCode)) - { - repair = (from x in repair where x.RepairRecordCode.Contains(repairRecordCode) select x).ToList(); - } - - var getDataLists = (from x in repair - select new Model.BaseInfoItem - { - BaseInfoId = x.RepairRecordId, - BaseInfoCode = x.RepairRecordCode - }).ToList(); - return getDataLists; + return getDataLists; + } } - } + #endregion - /// - /// 获取返修单信息 - /// - /// - /// - public static Model.WeldJointItem GetRepairInfoByRepairRecordId(string repairRecordId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + //////////////////////////////////////返修/扩透///////////////////////////////////// + + #region 返修/扩透 + /// + /// 获取返修单列表 + /// + /// + /// + /// + /// + public static List GetRepairRecord(string unitWorkId, bool isAudit, string repairRecordCode) { - var getDataLists = (from x in db.HJGL_RepairRecord - join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - join z in db.SitePerson_Person on y.BackingWelderId equals z.PersonId - where x.RepairRecordId == repairRecordId - select new Model.WeldJointItem - { - PipelineCode = y.PipelineCode, - WeldJointCode = y.WeldJointCode, - BackingWelderCode = z.WelderCode, - BackingWelderId = y.BackingWelderId - }).FirstOrDefault(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var repair = (from x in db.HJGL_RepairRecord + where x.UnitWorkId == unitWorkId + orderby x.RepairRecordCode descending + select x).ToList(); + if (isAudit) + { + repair = (from x in repair where x.AuditDate.HasValue select x).ToList(); + } + else + { + repair = (from x in repair where !x.AuditDate.HasValue select x).ToList(); + } + + if (!string.IsNullOrEmpty(repairRecordCode)) + { + repair = (from x in repair where x.RepairRecordCode.Contains(repairRecordCode) select x).ToList(); + } + + var getDataLists = (from x in repair + select new Model.BaseInfoItem + { + BaseInfoId = x.RepairRecordId, + BaseInfoCode = x.RepairRecordCode + }).ToList(); + return getDataLists; + } } - } - /// - /// 根据条件获取可选取扩透口的批明细 - /// - /// - /// 同焊工 - /// 同管线 - /// 同一天 - /// 返修前所焊 - /// 同材质 - /// 同规格 - /// - public static List GetRepairExpDetail(string repairRecordId, bool welder, bool pipeLine, bool daily, bool repairBefore, bool mat, bool spec) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 获取返修单信息 + /// + /// + /// + public static Model.WeldJointItem GetRepairInfoByRepairRecordId(string repairRecordId) { - var record = BLL.RepairRecordService.GetRepairRecordById(repairRecordId); - var jot = BLL.WeldJointService.GetViewWeldJointById(record.WeldJointId); - var day = BLL.WeldingDailyService.GetPipeline_WeldingDailyByWeldingDailyId(jot.WeldingDailyId); - - var repairExp = from x in db.HJGL_Batch_PointBatchItem - join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId - join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId - join d in db.HJGL_WeldingDaily on y.WeldingDailyId equals d.WeldingDailyId - where z.DetectionTypeId == record.DetectionTypeId - && !x.PointDate.HasValue || (x.PointDate.HasValue && x.RepairRecordId == repairRecordId) - select new - { - x.PointBatchItemId, - x.PointState, - y.WeldJointCode, - y.PipelineId, - y.PipelineCode, - y.JointArea, - y.BackingWelderId, - y.Material1Id, - y.Specification, - d.WeldingDate - }; - - if (welder) - { - repairExp = repairExp.Where(x => x.BackingWelderId == jot.BackingWelderId); - } - if (pipeLine) - { - repairExp = repairExp.Where(x => x.PipelineId == jot.PipelineId); - } - if (daily) - { - repairExp = repairExp.Where(x => x.WeldingDate == day.WeldingDate); - } - if (repairBefore) - { - repairExp = repairExp.Where(x => x.WeldingDate <= day.WeldingDate); - } - if (mat) - { - repairExp = repairExp.Where(x => x.Material1Id == jot.Material1Id); - } - if (spec) - { - repairExp = repairExp.Where(x => x.Specification == jot.Specification); - } - - var getDataLists = (from x in repairExp - select new Model.NDETrustItem - { - PointBatchItemId = x.PointBatchItemId, - PointState=x.PointState, - WeldJointCode = x.WeldJointCode, - PipelineCode = x.PipelineCode, - JointArea = x.JointArea - }).ToList(); - return getDataLists; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_RepairRecord + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + join z in db.SitePerson_Person on y.BackingWelderId equals z.PersonId + where x.RepairRecordId == repairRecordId + select new Model.WeldJointItem + { + PipelineCode = y.PipelineCode, + WeldJointCode = y.WeldJointCode, + BackingWelderCode = z.WelderCode, + BackingWelderId = y.BackingWelderId + }).FirstOrDefault(); + return getDataLists; + } } - } - /// - /// 保存返修/扩透口信息 - /// - /// 返修ID - /// 扩透口ID(多个用“,”号隔开) - /// 返修焊工 - /// 返修日期 - /// 是否切除 - public static void GetRepairExpSaveInfo(string repairRecordId, string expandId, string repairWelder, string repairDate, bool isCut) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 根据条件获取可选取扩透口的批明细 + /// + /// + /// 同焊工 + /// 同管线 + /// 同一天 + /// 返修前所焊 + /// 同材质 + /// 同规格 + /// + public static List GetRepairExpDetail(string repairRecordId, bool welder, bool pipeLine, bool daily, bool repairBefore, bool mat, bool spec) { - Model.HJGL_RepairRecord repairRecord = BLL.RepairRecordService.GetRepairRecordById(repairRecordId); - // 更新返修记录 - var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId); - if (repair != null) - { - repair.RepairWelder = repairWelder; - repair.RepairDate = Convert.ToDateTime(repairDate); - if (isCut) - { - repair.IsCut = true; - } - } + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var record = db.HJGL_RepairRecord.FirstOrDefault(e => e.RepairRecordId == repairRecordId); + var jot = db.View_HJGL_WeldJoint.FirstOrDefault(e => e.WeldJointId == record.WeldJointId); + var day = db.HJGL_WeldingDaily.FirstOrDefault(e => e.WeldingDailyId == jot.WeldingDailyId); - // 更新返修口 - var batchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == repairRecord.WeldJointId); - if (batchItem != null) - { - batchItem.RepairDate = Convert.ToDateTime(repairDate); - if (isCut) - { - batchItem.CutDate = DateTime.Now.Date; - } - } - db.SubmitChanges(); + var repairExp = from x in db.HJGL_Batch_PointBatchItem + join z in db.HJGL_Batch_PointBatch on x.PointBatchId equals z.PointBatchId + join y in db.HJGL_WeldJoint on x.WeldJointId equals y.WeldJointId + join d in db.HJGL_WeldingDaily on y.WeldingDailyId equals d.WeldingDailyId + where z.DetectionTypeId == record.DetectionTypeId + && !x.PointDate.HasValue || (x.PointDate.HasValue && x.RepairRecordId == repairRecordId) + select new + { + x.PointBatchItemId, + x.PointState, + y.WeldJointCode, + y.PipelineId, + y.PipelineCode, + y.JointArea, + y.BackingWelderId, + y.Material1Id, + y.Specification, + d.WeldingDate + }; - var exp = BLL.RepairRecordService.GetExportItem(repairRecordId); - if (exp != null) - { - foreach (Model.HJGL_Batch_PointBatchItem item in exp) - { - Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item.PointBatchItemId); - newPointBatchItem.PointState = null; - newPointBatchItem.PointDate = null; - newPointBatchItem.RepairRecordId = null; + if (welder) + { + repairExp = repairExp.Where(x => x.BackingWelderId == jot.BackingWelderId); + } + if (pipeLine) + { + repairExp = repairExp.Where(x => x.PipelineId == jot.PipelineId); + } + if (daily) + { + repairExp = repairExp.Where(x => x.WeldingDate == day.WeldingDate); + } + if (repairBefore) + { + repairExp = repairExp.Where(x => x.WeldingDate <= day.WeldingDate); + } + if (mat) + { + repairExp = repairExp.Where(x => x.Material1Id == jot.Material1Id); + } + if (spec) + { + repairExp = repairExp.Where(x => x.Specification == jot.Specification); + } + + var getDataLists = (from x in repairExp + select new Model.NDETrustItem + { + PointBatchItemId = x.PointBatchItemId, + PointState = x.PointState, + WeldJointCode = x.WeldJointCode, + PipelineCode = x.PipelineCode, + JointArea = x.JointArea + }).ToList(); + return getDataLists; + } + } + + /// + /// 保存返修/扩透口信息 + /// + /// 返修ID + /// 扩透口ID(多个用“,”号隔开) + /// 返修焊工 + /// 返修日期 + /// 是否切除 + public static void GetRepairExpSaveInfo(string repairRecordId, string expandId, string repairWelder, string repairDate, bool isCut) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.HJGL_RepairRecord repairRecord = db.HJGL_RepairRecord.FirstOrDefault(e => e.RepairRecordId == repairRecordId); + // 更新返修记录 + var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId); + if (repair != null) + { + repair.RepairWelder = repairWelder; + repair.RepairDate = Convert.ToDateTime(repairDate); + if (isCut) + { + repair.IsCut = true; + } + } + + // 更新返修口 + var batchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.WeldJointId == repairRecord.WeldJointId); + if (batchItem != null) + { + batchItem.RepairDate = Convert.ToDateTime(repairDate); + if (isCut) + { + batchItem.CutDate = DateTime.Now.Date; + } + } db.SubmitChanges(); - } - } - // 更新扩透口 - string[] checkedRow = expandId.Split(','); - if (checkedRow.Count() > 0) - { - foreach (string item in checkedRow) - { - Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item); - if (newPointBatchItem != null) - { - newPointBatchItem.PointState = "2"; - newPointBatchItem.PointDate = DateTime.Now; - newPointBatchItem.RepairRecordId = repairRecordId; - db.SubmitChanges(); - } - } - } - } - } - #endregion - #region 返修单审核 - /// - /// 返修单审核 - /// - /// - public static void RepairAudit(string repairRecordId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - // 更新返修记录 - var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId); - if (!repair.AuditDate.HasValue) - { - repair.AuditDate = DateTime.Now; - db.SubmitChanges(); - } - } - } - #endregion - - #region 生成返修委托单 - /// - /// 生成返修委托单 - /// - /// - /// - public static string GenerateRepairTrust(string repairRecordId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - string submitStr = string.Empty; - Model.HJGL_RepairRecord repairRecord = BLL.RepairRecordService.GetRepairRecordById(repairRecordId); - var trustItem = from x in Funs.DB.HJGL_Batch_BatchTrustItem where x.RepairRecordId == repairRecordId select x; - if (trustItem.Count() == 0) - { - if (!string.IsNullOrEmpty(repairRecordId) && repairRecord.AuditDate.HasValue) - { - // 返修委托 - Model.HJGL_Batch_BatchTrust newRepairTrust = new Model.HJGL_Batch_BatchTrust(); - string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust)); - newRepairTrust.TrustBatchId = trustBatchId; - newRepairTrust.TrustBatchCode = repairRecord.RepairRecordCode; - newRepairTrust.TrustDate = DateTime.Now; - newRepairTrust.ProjectId = repairRecord.ProjectId; - newRepairTrust.UnitId = repairRecord.UnitId; - newRepairTrust.UnitWorkId = repairRecord.UnitWorkId; - newRepairTrust.DetectionTypeId = repairRecord.DetectionTypeId; - - BLL.Batch_BatchTrustService.AddBatchTrust(newRepairTrust); // 新增返修委托单 - - Model.HJGL_Batch_BatchTrustItem newRepairTrustItem = new Model.HJGL_Batch_BatchTrustItem(); - newRepairTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)); - newRepairTrustItem.TrustBatchId = trustBatchId; - newRepairTrustItem.RepairRecordId = repairRecordId; - newRepairTrustItem.WeldJointId = repairRecord.WeldJointId; - newRepairTrustItem.CreateDate = DateTime.Now; - Batch_BatchTrustItemService.AddBatchTrustItem(newRepairTrustItem); - - // 扩透委托 - var exp = BLL.RepairRecordService.GetExportItem(repairRecordId); + var exp = db.HJGL_Batch_PointBatchItem.Where( x=>x.RepairRecordId == repairRecordId).ToList(); if (exp != null) { - foreach (var q in exp) - { - Model.HJGL_Batch_BatchTrustItem newExportTrustItem = new Model.HJGL_Batch_BatchTrustItem(); - newExportTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)); - newExportTrustItem.TrustBatchId = trustBatchId; - newExportTrustItem.PointBatchItemId = q.PointBatchItemId; - newExportTrustItem.WeldJointId = q.WeldJointId; - newExportTrustItem.CreateDate = DateTime.Now; - Batch_BatchTrustItemService.AddBatchTrustItem(newExportTrustItem); + foreach (Model.HJGL_Batch_PointBatchItem item in exp) + { + Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item.PointBatchItemId); + newPointBatchItem.PointState = null; + newPointBatchItem.PointDate = null; + newPointBatchItem.RepairRecordId = null; + db.SubmitChanges(); + } + } + // 更新扩透口 + string[] checkedRow = expandId.Split(','); + if (checkedRow.Count() > 0) + { + foreach (string item in checkedRow) + { + Model.HJGL_Batch_PointBatchItem newPointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == item); + if (newPointBatchItem != null) + { + newPointBatchItem.PointState = "2"; + newPointBatchItem.PointDate = DateTime.Now; + newPointBatchItem.RepairRecordId = repairRecordId; + db.SubmitChanges(); + } + } + } + } + } + #endregion - Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == q.PointBatchItemId); - pointBatchItem.IsBuildTrust = true; - db.SubmitChanges(); - } + #region 返修单审核 + /// + /// 返修单审核 + /// + /// + public static void RepairAudit(string repairRecordId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // 更新返修记录 + var repair = db.HJGL_RepairRecord.FirstOrDefault(x => x.RepairRecordId == repairRecordId); + if (!repair.AuditDate.HasValue) + { + repair.AuditDate = DateTime.Now; + db.SubmitChanges(); + } + } + } + #endregion + + #region 生成返修委托单 + /// + /// 生成返修委托单 + /// + /// + /// + public static string GenerateRepairTrust(string repairRecordId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string submitStr = string.Empty; + Model.HJGL_RepairRecord repairRecord = db.HJGL_RepairRecord.FirstOrDefault(e => e.RepairRecordId == repairRecordId); + var trustItem = from x in db.HJGL_Batch_BatchTrustItem where x.RepairRecordId == repairRecordId select x; + if (trustItem.Count() == 0) + { + if (!string.IsNullOrEmpty(repairRecordId) && repairRecord.AuditDate.HasValue) + { + // 返修委托 + Model.HJGL_Batch_BatchTrust newRepairTrust = new Model.HJGL_Batch_BatchTrust(); + string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust)); + newRepairTrust.TrustBatchId = trustBatchId; + newRepairTrust.TrustBatchCode = repairRecord.RepairRecordCode; + newRepairTrust.TrustDate = DateTime.Now; + newRepairTrust.ProjectId = repairRecord.ProjectId; + newRepairTrust.UnitId = repairRecord.UnitId; + newRepairTrust.UnitWorkId = repairRecord.UnitWorkId; + newRepairTrust.DetectionTypeId = repairRecord.DetectionTypeId; + newRepairTrust.IsAudit = true; + db.HJGL_Batch_BatchTrust.InsertOnSubmit(newRepairTrust); + db.SubmitChanges(); ; // 新增返修委托单 + + Model.HJGL_Batch_BatchTrustItem newRepairTrustItem = new Model.HJGL_Batch_BatchTrustItem(); + newRepairTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)); + newRepairTrustItem.TrustBatchId = trustBatchId; + newRepairTrustItem.RepairRecordId = repairRecordId; + newRepairTrustItem.WeldJointId = repairRecord.WeldJointId; + newRepairTrustItem.CreateDate = DateTime.Now; + Batch_BatchTrustItemService.AddBatchTrustItemForApi(newRepairTrustItem); + + // 扩透委托 + var exp = db.HJGL_Batch_PointBatchItem .Where(x=> x.RepairRecordId == repairRecordId).ToList(); + if (exp != null) + { + foreach (var q in exp) + { + Model.HJGL_Batch_BatchTrustItem newExportTrustItem = new Model.HJGL_Batch_BatchTrustItem(); + newExportTrustItem.TrustBatchItemId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrustItem)); + newExportTrustItem.TrustBatchId = trustBatchId; + newExportTrustItem.PointBatchItemId = q.PointBatchItemId; + newExportTrustItem.WeldJointId = q.WeldJointId; + newExportTrustItem.CreateDate = DateTime.Now; + Batch_BatchTrustItemService.AddBatchTrustItemForApi(newExportTrustItem); + + Model.HJGL_Batch_PointBatchItem pointBatchItem = db.HJGL_Batch_PointBatchItem.FirstOrDefault(x => x.PointBatchItemId == q.PointBatchItemId); + pointBatchItem.IsBuildTrust = true; + db.SubmitChanges(); + } + } + + submitStr = "成功生成委托单!"; + } + else + { + submitStr = "选中返修单并确认已审核!"; + } + } + else + { + submitStr = "已生成委托单!"; } - submitStr = "成功生成委托单!"; - } - else - { - submitStr = "选中返修单并确认已审核!"; - } - } - else - { - submitStr = "已生成委托单!"; - } - - return submitStr; + return submitStr; + } } - } - #endregion + #endregion - #region 获取扩透口的随机数 - /// - /// 获取扩透口的随机数 - /// - /// - /// - public static string RandomExport(int num) - { - string strNum = string.Empty; - if (num > 0 && num <= 2) + #region 获取扩透口的随机数 + /// + /// 获取扩透口的随机数 + /// + /// + /// + public static string RandomExport(int num) { - if (num == 1) - { - strNum = "0"; - } - else - { - strNum = "0,1"; - } + string strNum = string.Empty; + if (num > 0 && num <= 2) + { + if (num == 1) + { + strNum = "0"; + } + else + { + strNum = "0,1"; + } + } + else + { + int[] r = Funs.GetRandomNum(2, 0, num - 1); + strNum = r[0].ToString() + "," + r[1].ToString(); + } + + return strNum; + } - else + #endregion + + //////////////////////////////////////////// NDE预警////////////////////////////////////// + + #region NDE预警 + /// + /// 无损检测不合格焊口信息 + /// + /// + /// + public static List GetNdeCheckNoPassWarn(string projectId) { - int[] r = Funs.GetRandomNum(2, 0, num - 1); - strNum = r[0].ToString() + "," + r[1].ToString(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var onecheckNoPass = (from x in db.HJGL_Batch_NDEItem + join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId + join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId + join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID + where y.RepairRecordId == null && x.CheckResult == "2" + select new Model.BaseInfoItem + { + BaseInfoId = y.WeldJointId, + BaseInfoCode = "检测单:" + z.NDECode, + BaseInfoName = "不合格焊口:" + w.WeldJointCode + }).ToList(); + + var repairPass = (from x in db.HJGL_Batch_NDEItem + join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId + join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId + join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID + where y.RepairRecordId != null && x.CheckResult == "1" + select new Model.BaseInfoItem + { + BaseInfoId = y.WeldJointId, + BaseInfoCode = "检测单:" + z.NDECode, + BaseInfoName = "不合格焊口:" + w.WeldJointCode + }).ToList(); + + List getDataLists = new List(); + foreach (var q in onecheckNoPass) + { + if (!repairPass.Contains(q)) + { + getDataLists.Add(q); + } + } + + return getDataLists; + } } - return strNum; - - } - #endregion - - //////////////////////////////////////////// NDE预警////////////////////////////////////// - - #region NDE预警 - /// - /// 无损检测不合格焊口信息 - /// - /// - /// - public static List GetNdeCheckNoPassWarn(string projectId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 未委托焊口预警 + /// + /// + /// + public static List GetNoTrustJointWarn(string projectId) { - var onecheckNoPass = (from x in db.HJGL_Batch_NDEItem - join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId - join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId - join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID - where y.RepairRecordId == null && x.CheckResult == "2" + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var point = (from x in db.HJGL_Batch_PointBatchItem + join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId + join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId + join t in db.HJGL_Batch_BatchTrustItem on x.PointBatchItemId equals t.PointBatchItemId + where y.ProjectId == projectId && t.TrustBatchItemId == null + orderby y.PointBatchCode, z.WeldJointCode + select new Model.BaseInfoItem + { + BaseInfoId = x.WeldJointId, + BaseInfoCode = "批号:" + y.PointBatchCode, + BaseInfoName = "未委托焊口:" + z.WeldJointCode, + }).ToList(); + + var repair = (from x in db.HJGL_RepairRecord + join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId + join t in db.HJGL_Batch_BatchTrustItem on x.RepairRecordId equals t.RepairRecordId + where x.ProjectId == projectId && t.TrustBatchItemId == null + orderby x.RepairRecordCode, z.WeldJointCode select new Model.BaseInfoItem { - BaseInfoId = y.WeldJointId, - BaseInfoCode = "检测单:" + z.NDECode, - BaseInfoName = "不合格焊口:" + w.WeldJointCode + BaseInfoId = x.WeldJointId, + BaseInfoCode = "返修单号:" + x.RepairRecordCode, + BaseInfoName = "未委托焊口:" + z.WeldJointCode, }).ToList(); - var repairPass = (from x in db.HJGL_Batch_NDEItem - join y in db.HJGL_Batch_BatchTrustItem on x.TrustBatchItemId equals y.TrustBatchItemId - join w in db.HJGL_WeldJoint on y.WeldJointId equals w.WeldJointId - join z in db.HJGL_Batch_NDE on x.NDEID equals z.NDEID - where y.RepairRecordId != null && x.CheckResult == "1" - select new Model.BaseInfoItem - { - BaseInfoId = y.WeldJointId, - BaseInfoCode = "检测单:" + z.NDECode, - BaseInfoName = "不合格焊口:" + w.WeldJointCode - }).ToList(); - - List getDataLists = new List(); - foreach (var q in onecheckNoPass) - { - if (!repairPass.Contains(q)) - { - getDataLists.Add(q); - } - } - - return getDataLists; + return point.Concat(repair).ToList(); + } } - } - /// - /// 未委托焊口预警 - /// - /// - /// - public static List GetNoTrustJointWarn(string projectId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + /// + /// 未检测焊口预警 + /// + /// + /// + public static List GetNoCheckJointWarn(string projectId) { - var point = (from x in db.HJGL_Batch_PointBatchItem - join y in db.HJGL_Batch_PointBatch on x.PointBatchId equals y.PointBatchId - join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId - join t in db.HJGL_Batch_BatchTrustItem on x.PointBatchItemId equals t.PointBatchItemId - where y.ProjectId == projectId && t.TrustBatchItemId == null - orderby y.PointBatchCode, z.WeldJointCode - select new Model.BaseInfoItem - { - BaseInfoId = x.WeldJointId, - BaseInfoCode ="批号:" + y.PointBatchCode, - BaseInfoName = "未委托焊口:" + z.WeldJointCode, - }).ToList(); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.HJGL_Batch_BatchTrustItem + join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId + join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId + join n in db.HJGL_Batch_NDEItem on x.TrustBatchItemId equals n.TrustBatchItemId + where y.ProjectId == projectId && n.NDEItemID == null + orderby y.TrustBatchCode, z.WeldJointCode + select new Model.BaseInfoItem + { + BaseInfoId = x.WeldJointId, + BaseInfoCode = "委托单号:" + y.TrustBatchCode, + BaseInfoName = "焊口:" + z.WeldJointCode, + }).ToList(); - var repair = (from x in db.HJGL_RepairRecord - join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId - join t in db.HJGL_Batch_BatchTrustItem on x.RepairRecordId equals t.RepairRecordId - where x.ProjectId == projectId && t.TrustBatchItemId == null - orderby x.RepairRecordCode, z.WeldJointCode - select new Model.BaseInfoItem - { - BaseInfoId = x.WeldJointId, - BaseInfoCode = "返修单号:" + x.RepairRecordCode, - BaseInfoName = "未委托焊口:" + z.WeldJointCode, - }).ToList(); - - return point.Concat(repair).ToList(); + return getDataLists; + } } - } - /// - /// 未检测焊口预警 - /// - /// - /// - public static List GetNoCheckJointWarn(string projectId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - var getDataLists = (from x in db.HJGL_Batch_BatchTrustItem - join y in db.HJGL_Batch_BatchTrust on x.TrustBatchId equals y.TrustBatchId - join z in db.HJGL_WeldJoint on x.WeldJointId equals z.WeldJointId - join n in db.HJGL_Batch_NDEItem on x.TrustBatchItemId equals n.TrustBatchItemId - where y.ProjectId == projectId && n.NDEItemID == null - orderby y.TrustBatchCode, z.WeldJointCode - select new Model.BaseInfoItem - { - BaseInfoId = x.WeldJointId, - BaseInfoCode ="委托单号:" + y.TrustBatchCode, - BaseInfoName = "焊口:" + z.WeldJointCode, - }).ToList(); + #endregion - return getDataLists; - } - } - - #endregion - - } + } } diff --git a/SGGL/BLL/API/HJGL/APIPipeJointService.cs b/SGGL/BLL/API/HJGL/APIPipeJointService.cs index aa184cf2..f60803ec 100644 --- a/SGGL/BLL/API/HJGL/APIPipeJointService.cs +++ b/SGGL/BLL/API/HJGL/APIPipeJointService.cs @@ -1,4 +1,5 @@ -using System; +using Model; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -253,24 +254,27 @@ namespace BLL return getDateInfo.FirstOrDefault(); } } - #endregion + #endregion - /// - /// 根据管线ID获取探伤比例 - /// - /// - /// - private static string GetDetectionRate(string pipeLineId) - { - string detectionRate = string.Empty; - var pipe = BLL.PipelineService.GetPipelineByPipelineId(pipeLineId); - if (pipe != null && !string.IsNullOrEmpty(pipe.DetectionRateId)) + /// + /// 根据管线ID获取探伤比例 + /// + /// + /// + private static string GetDetectionRate(string pipeLineId) { - var r = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipe.DetectionRateId); - detectionRate = r.DetectionRateValue + "%"; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string detectionRate = string.Empty; + var pipe = db.HJGL_Pipeline.FirstOrDefault(e => e.PipelineId == pipeLineId); + if (pipe != null && !string.IsNullOrEmpty(pipe.DetectionRateId)) + { + var r = db.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == pipe.DetectionRateId); + detectionRate = r.DetectionRateValue + "%"; + } + return detectionRate; + } } - return detectionRate; - } #region 根据焊口标识获取焊口详细信息 /// @@ -521,15 +525,15 @@ namespace BLL string jotId = addItem.WeldJointId; if (!string.IsNullOrEmpty(jotId)) { - var jotInfo = BLL.PW_JointInfoService.GetJointInfoByJotID(jotId); + var jotInfo = db.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); if (jotInfo != null) { if (!string.IsNullOrEmpty(jotInfo.ISO_ID)) { - var isoInfo = BLL.PW_IsoInfoService.GetIsoInfoByIsoInfoId(jotInfo.ISO_ID); + var isoInfo =db.PW_IsoInfo.FirstOrDefault(e => e.ISO_ID == jotInfo.ISO_ID); if (isoInfo != null) { - workAreaCode = BLL.WorkAreaService.GetWorkAreaCodeByWorkAreaId(isoInfo.WorkAreaId); + workAreaCode = BLL.WorkAreaService.GetWorkAreaCodeByWorkAreaIdForApi(isoInfo.WorkAreaId); } } } @@ -546,9 +550,9 @@ namespace BLL string DReportID = SQLHelper.GetNewID(typeof(Model.BO_WeldReportMain)); newWeldReportMain.DReportID = DReportID; BLL.WeldReportService.AddWeldReport(newWeldReportMain); - BLL.LogService.AddSys_Log(BLL.UserService.GetUserByUserId(addItem.UserId), newWeldReportMain.JOT_DailyReportNo, DReportID, BLL.Const.HJGL_WeldReportMenuId, "添加焊接日报信息"); + BLL.LogService.AddSys_Log(db.Sys_User.FirstOrDefault(e => e.UserId == addItem.UserId), newWeldReportMain.JOT_DailyReportNo, DReportID, BLL.Const.HJGL_WeldReportMenuId, "添加焊接日报信息"); - Model.PW_JointInfo jot = BLL.PW_JointInfoService.GetJointInfoByJotID(addItem.WeldJointId); + Model.PW_JointInfo jot = db.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == addItem.WeldJointId); jot.DReportID = newWeldReportMain.DReportID; jot.JOT_CellWelder = addItem.CoverWelderId; jot.JOT_FloorWelder = addItem.BackingWelderId; @@ -565,9 +569,9 @@ namespace BLL //jot.JOT_CellTemp = item.JOT_CellTemp; //jot.JOT_LastTemp = item.JOT_LastTemp; - BLL.PW_JointInfoService.UpdateJointInfoByDReport(jot); + db.SubmitChanges(); //更新焊口号 修改固定焊口号后 +G - BLL.PW_JointInfoService.UpdateJointNoAddG(jot.JOT_ID, addItem.JointAttribute, "Add"); + BLL.PW_JointInfoService.UpdateJointNoAddGForApi(jot.JOT_ID, addItem.JointAttribute, "Add"); SaveAttachFile(addItem.WeldJointId, BLL.Const.HJGL_WeldReportMenuId, addItem.AttachUrl); } diff --git a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs index 80dc8a7c..10ec0194 100644 --- a/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs +++ b/SGGL/BLL/API/HJGL/APIPreWeldingDailyService.cs @@ -73,29 +73,30 @@ namespace BLL /// public static void SavePreWeldingDaily(Model.HJGL_PreWeldingDailyItem newItem) { - Model.SGGLDB db = Funs.DB; - Model.HJGL_PreWeldingDaily newP= new Model.HJGL_PreWeldingDaily - { - PreWeldingDailyId = newItem.PreWeldingDailyId, - ProjectId = newItem.ProjectId, - UnitWorkId = newItem.UnitWorkId, - UnitId = newItem.UnitId, - }; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.HJGL_PreWeldingDaily newP = new Model.HJGL_PreWeldingDaily + { + PreWeldingDailyId = newItem.PreWeldingDailyId, + ProjectId = newItem.ProjectId, + UnitWorkId = newItem.UnitWorkId, + UnitId = newItem.UnitId, + }; - var updateItem = db.HJGL_PreWeldingDaily.FirstOrDefault(x => x.PreWeldingDailyId == newItem.PreWeldingDailyId); - if (updateItem == null) - { - - newP.PreWeldingDailyId = SQLHelper.GetNewID(); - db.HJGL_PreWeldingDaily.InsertOnSubmit(newP); - db.SubmitChanges(); - } - else - { - /// 更新 - /// // - } + var updateItem = db.HJGL_PreWeldingDaily.FirstOrDefault(x => x.PreWeldingDailyId == newItem.PreWeldingDailyId); + if (updateItem == null) + { + newP.PreWeldingDailyId = SQLHelper.GetNewID(); + db.HJGL_PreWeldingDaily.InsertOnSubmit(newP); + db.SubmitChanges(); + } + else + { + /// 更新 + /// // + } + } //if (newItem.BaseInfoItem != null && newItem.BaseInfoItem.Count() > 0) //{ // foreach (var item in newItem.BaseInfoItem) diff --git a/SGGL/BLL/API/HJGL/APIReportQueryService.cs b/SGGL/BLL/API/HJGL/APIReportQueryService.cs index fa0bb52e..2bfabbf4 100644 --- a/SGGL/BLL/API/HJGL/APIReportQueryService.cs +++ b/SGGL/BLL/API/HJGL/APIReportQueryService.cs @@ -5,185 +5,186 @@ using System.Data; using System.Data.SqlClient; using System.Text; using System.Threading.Tasks; +using Model; namespace BLL { - public static class APIReportQueryService - { - #region 根据人员二维码获取焊工业绩 - /// - /// 根据人员二维码获取焊工业绩 - /// - /// - /// - public static Model.WelderPerformanceItem GetWelderPerformanceByQRC(string personId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + public static class APIReportQueryService + { + #region 根据人员二维码获取焊工业绩 + /// + /// 根据人员二维码获取焊工业绩 + /// + /// + /// + public static Model.WelderPerformanceItem GetWelderPerformanceByQRC(string personId) { - // todo 二维码分解待做 - var getDataLists = from x in db.View_WelderPerformance - where x.PersonId == personId - select new Model.WelderPerformanceItem - { - WelderCode = x.WelderCode, - PersonName = x.PersonName, - UnitName = x.UnitName, - CertificateLimitTime = x.CertificateLimitTime.ToString(), - WelderLevel = x.WelderLevel, - OnePassRate = x.PassRate, - TotalJotDin = x.Nowtotal_jot.ToString() + "/" + x.Nowtotal_din.ToString(), - WeldAvgNum = GetWeldAvgNum(personId, x.Nowtotal_din.HasValue ? x.Nowtotal_din.Value : 0), - OneCheckJotNum = x.OneCheckJotNum.ToString(), - OneCheckPassJotNum = x.OneCheckPassJotNum, - RepairJotNum = x.OneCheckRepairJotNum.ToString(), - ExpandJotNum = x.ExpandJotNum.ToString() - }; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // todo 二维码分解待做 + var getDataLists = from x in db.View_WelderPerformance + where x.PersonId == personId + select new Model.WelderPerformanceItem + { + WelderCode = x.WelderCode, + PersonName = x.PersonName, + UnitName = x.UnitName, + CertificateLimitTime = x.CertificateLimitTime.ToString(), + WelderLevel = x.WelderLevel, + OnePassRate = x.PassRate, + TotalJotDin = x.Nowtotal_jot.ToString() + "/" + x.Nowtotal_din.ToString(), + WeldAvgNum = GetWeldAvgNum(personId, x.Nowtotal_din.HasValue ? x.Nowtotal_din.Value : 0), + OneCheckJotNum = x.OneCheckJotNum.ToString(), + OneCheckPassJotNum = x.OneCheckPassJotNum, + RepairJotNum = x.OneCheckRepairJotNum.ToString(), + ExpandJotNum = x.ExpandJotNum.ToString() + }; - return getDataLists.FirstOrDefault(); + return getDataLists.FirstOrDefault(); + } } - } - #endregion + #endregion - private static string GetWeldAvgNum(string personId,decimal totalDin) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + private static string GetWeldAvgNum(string personId, decimal totalDin) { - string vagDin = string.Empty; - var date = from x in db.HJGL_WeldJoint - join y in db.HJGL_WeldingDaily on x.WeldingDailyId equals y.WeldingDailyId - where x.BackingWelderId == personId || x.CoverWelderId == personId - select y.WeldingDate; - if (date.Count() > 0) - { - DateTime startDate = Convert.ToDateTime(date.Min()); - DateTime endDate = Convert.ToDateTime(date.Max()); - TimeSpan t = endDate - startDate; - int dayNum = t.Days; - vagDin = (totalDin / dayNum).ToString("0.##"); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string vagDin = string.Empty; + var date = from x in db.HJGL_WeldJoint + join y in db.HJGL_WeldingDaily on x.WeldingDailyId equals y.WeldingDailyId + where x.BackingWelderId == personId || x.CoverWelderId == personId + select y.WeldingDate; + if (date.Count() > 0) + { + DateTime startDate = Convert.ToDateTime(date.Min()); + DateTime endDate = Convert.ToDateTime(date.Max()); + TimeSpan t = endDate - startDate; + int dayNum = t.Days; + vagDin = (totalDin / dayNum).ToString("0.##"); - } - return vagDin; + } + return vagDin; + } } - } - #region 根据焊工号获取焊工业绩 - /// - /// 根据焊工号获取焊工业绩 - /// - /// - /// - /// - public static Model.WelderPerformanceItem GetWelderPerformanceByWelderCode(string projectId,string welderCode) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据焊工号获取焊工业绩 + /// + /// 根据焊工号获取焊工业绩 + /// + /// + /// + /// + public static Model.WelderPerformanceItem GetWelderPerformanceByWelderCode(string projectId, string welderCode) { - // todo 二维码分解待做 - var getDataLists = from x in db.View_WelderPerformance - where x.ProjectId == projectId && x.WelderCode == welderCode - select new Model.WelderPerformanceItem - { - WelderCode = x.WelderCode, - PersonName = x.PersonName, - UnitName = x.UnitName, - CertificateLimitTime = x.CertificateLimitTime.ToString(), - WelderLevel = x.WelderLevel, - OnePassRate = x.PassRate, - TotalJotDin = x.Nowtotal_jot.ToString() + "/" + x.Nowtotal_din.ToString(), - WeldAvgNum = GetWeldAvgNum(x.PersonId, x.Nowtotal_din.HasValue ? x.Nowtotal_din.Value : 0), - OneCheckJotNum = x.OneCheckJotNum.ToString(), - OneCheckPassJotNum = x.OneCheckPassJotNum, - RepairJotNum = x.OneCheckRepairJotNum.ToString(), - ExpandJotNum = x.ExpandJotNum.ToString() - }; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + // todo 二维码分解待做 + var getDataLists = from x in db.View_WelderPerformance + where x.ProjectId == projectId && x.WelderCode == welderCode + select new Model.WelderPerformanceItem + { + WelderCode = x.WelderCode, + PersonName = x.PersonName, + UnitName = x.UnitName, + CertificateLimitTime = x.CertificateLimitTime.ToString(), + WelderLevel = x.WelderLevel, + OnePassRate = x.PassRate, + TotalJotDin = x.Nowtotal_jot.ToString() + "/" + x.Nowtotal_din.ToString(), + WeldAvgNum = GetWeldAvgNum(x.PersonId, x.Nowtotal_din.HasValue ? x.Nowtotal_din.Value : 0), + OneCheckJotNum = x.OneCheckJotNum.ToString(), + OneCheckPassJotNum = x.OneCheckPassJotNum, + RepairJotNum = x.OneCheckRepairJotNum.ToString(), + ExpandJotNum = x.ExpandJotNum.ToString() + }; - return getDataLists.FirstOrDefault(); + return getDataLists.FirstOrDefault(); + } } - } - #endregion + #endregion - # region 根据人员ID获取焊工合格项目 - /// - /// 根据人员ID获取焊工合格项目 - /// - /// - /// - public static List getWelderQualify(string personId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据人员ID获取焊工合格项目 + /// + /// 根据人员ID获取焊工合格项目 + /// + /// + /// + public static List getWelderQualify(string personId) { - var getDataLists = (from x in db.Welder_WelderQualify - where x.WelderId == personId - orderby x.LimitDate - select new Model.BaseInfoItem + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = (from x in db.Welder_WelderQualify + where x.WelderId == personId + orderby x.LimitDate + select new Model.BaseInfoItem + { + BaseInfoId = x.QualificationItem, // 合格项目 + BaseInfoCode = x.CheckDate.HasValue ? x.CheckDate.Value.ToString() : "", // 批准日期 + BaseInfoName = x.LimitDate.HasValue ? x.LimitDate.Value.ToString() : "" // 有效日期 + } + ).ToList(); + return getDataLists; + } + } + #endregion + + #region 焊工资质预警 + /// + /// 焊工资质预警 + /// + /// + /// + public static List GetWelderQualifyWarning(string projectId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var welder = from x in db.SitePerson_Person + where x.ProjectId == projectId && x.WorkPostId == Const.WorkPost_Welder + && x.WelderCode != null + select x; + List warnWelder = new List(); + + foreach (var q in welder) + { + + DateTime? validity = q.CertificateLimitTime; + DateTime nowDate = DateTime.Now; + if (validity != null) + { + if (validity.Value.AddMonths(-1) < nowDate && validity >= nowDate) { - BaseInfoId = x.QualificationItem, // 合格项目 - BaseInfoCode = x.CheckDate.HasValue ? x.CheckDate.Value.ToString() : "", // 批准日期 - BaseInfoName = x.LimitDate.HasValue ? x.LimitDate.Value.ToString() : "" // 有效日期 + Model.BaseInfoItem item = new Model.BaseInfoItem(); + item.BaseInfoId = q.PersonId; + item.BaseInfoCode = q.WelderCode; + item.BaseInfoName = q.CertificateLimitTime.HasValue ? q.CertificateLimitTime.Value.ToString() : "" + "即将过期"; + warnWelder.Add(item); } - ).ToList(); - return getDataLists; - } - } - #endregion + else if (validity < nowDate) + { + Model.BaseInfoItem item = new Model.BaseInfoItem(); + item.BaseInfoId = q.PersonId; + item.BaseInfoCode = q.WelderCode; + item.BaseInfoName = q.CertificateLimitTime.HasValue ? q.CertificateLimitTime.Value.ToString() : "" + "已过期"; + warnWelder.Add(item); + } + } + } - #region 焊工资质预警 - /// - /// 焊工资质预警 - /// - /// - /// - public static List GetWelderQualifyWarning(string projectId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + return warnWelder; + } + } + #endregion + + + #region 焊工一次合格率低于96%预警 + /// + /// 焊工一次合格率低于96%预警 + /// + /// + /// + public static List GetWelderOnePassRateWarning(string projectId) { - var welder = from x in db.SitePerson_Person - where x.ProjectId == projectId && x.WorkPostId == Const.WorkPost_Welder - && x.WelderCode != null - select x; - List warnWelder = new List(); - foreach (var q in welder) - { - - DateTime? validity = q.CertificateLimitTime; - DateTime nowDate = DateTime.Now; - if (validity != null) - { - if (validity.Value.AddMonths(-1) < nowDate && validity >= nowDate) - { - Model.BaseInfoItem item = new Model.BaseInfoItem(); - item.BaseInfoId = q.PersonId; - item.BaseInfoCode = q.WelderCode; - item.BaseInfoName = q.CertificateLimitTime.HasValue ? q.CertificateLimitTime.Value.ToString() : "" + "即将过期"; - warnWelder.Add(item); - } - else if (validity < nowDate) - { - Model.BaseInfoItem item = new Model.BaseInfoItem(); - item.BaseInfoId = q.PersonId; - item.BaseInfoCode =q.WelderCode; - item.BaseInfoName = q.CertificateLimitTime.HasValue ? q.CertificateLimitTime.Value.ToString() : "" + "已过期"; - warnWelder.Add(item); - } - } - } - - return warnWelder; - } - } - #endregion - - - #region 焊工一次合格率低于96%预警 - /// - /// 焊工一次合格率低于96%预警 - /// - /// - /// - public static List GetWelderOnePassRateWarning(string projectId) - { - - string strSql = @"SELECT welder.ProjectId, welder.WelderCode, welder.PersonName, + string strSql = @"SELECT welder.ProjectId, welder.WelderCode, welder.PersonName, CONVERT(NVARCHAR(10),(CAST((CASE ISNULL(oneCheck.OneCheckJotNum,0) WHEN 0 THEN 0 ELSE 100.0 * (ISNULL(oneCheck.OneCheckJotNum,0)-ISNULL(oneCheckRepair.oneCheckRepairJotNum,0))/(1.0 * oneCheck.OneCheckJotNum) END) AS DECIMAL(8,1))))+'%' AS passRate FROM SitePerson_Person AS welder @@ -214,266 +215,269 @@ namespace BLL AND (CAST((CASE ISNULL(oneCheck.OneCheckJotNum,0) WHEN 0 THEN 0 ELSE 100.0 * (ISNULL(oneCheck.OneCheckJotNum,0)-ISNULL(oneCheckRepair.oneCheckRepairJotNum,0))/(1.0 * oneCheck.OneCheckJotNum) END) AS DECIMAL(8,1)))<=96"; - List listStr = new List(); + List listStr = new List(); - strSql += " AND welder.ProjectId=@ProjectId"; - listStr.Add(new SqlParameter("@ProjectId", projectId)); + strSql += " AND welder.ProjectId=@ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", projectId)); - SqlParameter[] parameter = listStr.ToArray(); - DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter); + SqlParameter[] parameter = listStr.ToArray(); + DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter); - List warnWelder = new List(); + List warnWelder = new List(); + + foreach (DataRow row in dt.Rows) + { + Model.BaseInfoItem item = new Model.BaseInfoItem(); + item.BaseInfoCode = row["WelderCode"].ToString(); + item.BaseInfoName = "一次合格率:" + row["passRate"].ToString(); + warnWelder.Add(item); + } + + return warnWelder; - foreach (DataRow row in dt.Rows) - { - Model.BaseInfoItem item = new Model.BaseInfoItem(); - item.BaseInfoCode = row["WelderCode"].ToString(); - item.BaseInfoName = "一次合格率:" + row["passRate"].ToString(); - warnWelder.Add(item); } - - return warnWelder; - - } - #endregion + #endregion - #region 根据焊口ID获取焊口信息和焊接信息 - /// - /// 根据焊口ID获取焊口信息和焊接信息 - /// - /// - /// - public static Model.JointCompreInfoItem GetJointCompreInfo(string weldJointId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + #region 根据焊口ID获取焊口信息和焊接信息 + /// + /// 根据焊口ID获取焊口信息和焊接信息 + /// + /// + /// + public static Model.JointCompreInfoItem GetJointCompreInfo(string weldJointId) { - var getDateInfo = from x in db.View_HJGL_WeldJoint - where x.WeldJointId == weldJointId + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDateInfo = from x in db.View_HJGL_WeldJoint + where x.WeldJointId == weldJointId - select new Model.JointCompreInfoItem - { - WeldJointCode = x.WeldJointCode, - PipelineCode = x.PipelineCode, - PipingClass = x.PipingClassCode, - Medium = x.MediumCode, - DetectionType = x.DetectionTypeCode, - WeldType = x.WeldTypeCode, - Material = x.MaterialCode, - JointArea = x.JointArea, - JointAttribute = x.JointAttribute, - WeldingMode = x.WeldingMode, - Size = x.Size, - Dia = x.Dia, - Thickness = x.Thickness, - Specification = x.Specification, - WeldingMethodCode = x.WeldingMethodCode, - GrooveType = x.GrooveTypeCode, - WeldingLocation = x.WeldingLocationCode, - WeldingWire = x.WeldingWireCode, - WeldingRod = x.WeldingRodCode, - IsHotProess = x.IsHotProessStr, - WelderCode = x.WelderCode, - WeldingDate = x.WeldingDate, - WeldingDailyCode = x.WeldingDailyCode, - PointBatchCode = x.PointBatchCode, - IsPoint = x.IsPoint + select new Model.JointCompreInfoItem + { + WeldJointCode = x.WeldJointCode, + PipelineCode = x.PipelineCode, + PipingClass = x.PipingClassCode, + Medium = x.MediumCode, + DetectionType = x.DetectionTypeCode, + WeldType = x.WeldTypeCode, + Material = x.MaterialCode, + JointArea = x.JointArea, + JointAttribute = x.JointAttribute, + WeldingMode = x.WeldingMode, + Size = x.Size, + Dia = x.Dia, + Thickness = x.Thickness, + Specification = x.Specification, + WeldingMethodCode = x.WeldingMethodCode, + GrooveType = x.GrooveTypeCode, + WeldingLocation = x.WeldingLocationCode, + WeldingWire = x.WeldingWireCode, + WeldingRod = x.WeldingRodCode, + IsHotProess = x.IsHotProessStr, + WelderCode = x.WelderCode, + WeldingDate = x.WeldingDate, + WeldingDailyCode = x.WeldingDailyCode, + PointBatchCode = x.PointBatchCode, + IsPoint = x.IsPoint - }; - return getDateInfo.FirstOrDefault(); + }; + return getDateInfo.FirstOrDefault(); + } } - } - #endregion + #endregion - #region 多维度查询报表 - /// - /// 多维度查询报表 - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static List GetReportQueryByRequir(string projectId,string unitId,string unitWorkId, string pipeLineId, string material, string startTime,string endTime) - { - List listStr = new List(); - listStr.Add(new SqlParameter("@projectId", projectId)); - - if (!string.IsNullOrEmpty(pipeLineId)) + #region 多维度查询报表 + /// + /// 多维度查询报表 + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static List GetReportQueryByRequir(string projectId, string unitId, string unitWorkId, string pipeLineId, string material, string startTime, string endTime) { - listStr.Add(new SqlParameter("@pipeLineId", pipeLineId)); - } - else if (!string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - listStr.Add(new SqlParameter("@unitWorkId", unitWorkId)); - } + List listStr = new List(); + listStr.Add(new SqlParameter("@projectId", projectId)); - else if (!string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - listStr.Add(new SqlParameter("@unitId", unitId)); - } + if (!string.IsNullOrEmpty(pipeLineId)) + { + listStr.Add(new SqlParameter("@pipeLineId", pipeLineId)); + } + else if (!string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + listStr.Add(new SqlParameter("@unitWorkId", unitWorkId)); + } - if (!string.IsNullOrEmpty(material)) - { - listStr.Add(new SqlParameter("@material", material)); - } - else - { - listStr.Add(new SqlParameter("@material", null)); - } + else if (!string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + listStr.Add(new SqlParameter("@unitId", unitId)); + } - if (!string.IsNullOrEmpty(startTime)) - { - listStr.Add(new SqlParameter("@startTime", Convert.ToDateTime(startTime))); - } - else - { - listStr.Add(new SqlParameter("@startTime", null)); - } + if (!string.IsNullOrEmpty(material)) + { + listStr.Add(new SqlParameter("@material", material)); + } + else + { + listStr.Add(new SqlParameter("@material", null)); + } - if (!string.IsNullOrEmpty(endTime)) - { - listStr.Add(new SqlParameter("@endTime", Convert.ToDateTime(endTime))); + if (!string.IsNullOrEmpty(startTime)) + { + listStr.Add(new SqlParameter("@startTime", Convert.ToDateTime(startTime))); + } + else + { + listStr.Add(new SqlParameter("@startTime", null)); + } + + if (!string.IsNullOrEmpty(endTime)) + { + listStr.Add(new SqlParameter("@endTime", Convert.ToDateTime(endTime))); + } + else + { + listStr.Add(new SqlParameter("@endTime", null)); + } + SqlParameter[] parameter = listStr.ToArray(); + + DataTable dt = null; + if (string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByProject", parameter); + } + if (!string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByUnit", parameter); + } + if (!string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByUnitWork", parameter); + } + if (!string.IsNullOrEmpty(pipeLineId)) + { + dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByPipeLine", parameter); + } + + List reportList = new List(); + foreach (DataRow row in dt.Rows) + { + string totalJot = row["TotalJot"].ToString(); + string totalDin = row["TotalDin"].ToString(); + string weldedJot = row["weldedJot"].ToString(); + string weldedDin = row["weldedDin"].ToString(); + string oneCheckJotNum = row["OneCheckJotNum"].ToString(); + string oneCheckRepairJotNum = row["OneCheckRepairJotNum"].ToString(); + string expandJotNum = row["OneExpandJotNum"].ToString(); + + Model.ReportQueryItem report = new Model.ReportQueryItem(); + + string code = string.Empty; + int mustCheckJotNum = 0; + if (string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + mustCheckJotNum = GetMustCheckJotNum("1", row["ProjectId"].ToString()); + code = row["ProjectCode"].ToString(); + report.ProjectCode = row["ProjectCode"].ToString(); + } + if (!string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + mustCheckJotNum = GetMustCheckJotNum("2", row["UnitId"].ToString()); + report.CUnit = row["UnitCode"].ToString(); + + } + if (!string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) + { + mustCheckJotNum = GetMustCheckJotNum("3", row["UnitWorkId"].ToString()); + report.UnitWork = row["UnitWorkCode"].ToString(); + } + if (!string.IsNullOrEmpty(pipeLineId)) + { + mustCheckJotNum = GetMustCheckJotNum("4", row["PipelineId"].ToString()); + report.PipeLine = row["PipelineCode"].ToString(); + } + + + string weldingRate = "0.0%"; + if (totalJot != "0") + { + weldingRate = (Convert.ToInt32(weldedJot) * 100.0 / Convert.ToInt32(totalJot)).ToString() + "%"; + } + + string weldingOnePassRate = "0.0%"; + if (oneCheckJotNum != "0") + { + weldingOnePassRate = ((Convert.ToInt32(oneCheckJotNum) - Convert.ToInt32(oneCheckRepairJotNum)) * 100.0 / Convert.ToInt32(oneCheckJotNum)).ToString() + "%"; + } + + string checkCompRate = "0.0%"; + if (mustCheckJotNum != 0) + { + checkCompRate = (Convert.ToInt32(oneCheckJotNum) * 100.0 / mustCheckJotNum).ToString() + "%"; + } + + report.TotalJotDin = totalJot + "/" + totalDin; + report.WeldedJotDin = weldedJot + "/" + weldedDin; + report.WeldingRate = weldingRate; + report.WeldingOnePassRate = weldingOnePassRate; + + report.MustCheckJotNum = mustCheckJotNum.ToString(); + report.CheckedJotNum = oneCheckJotNum; + report.CheckCompRate = checkCompRate; + report.RepairJotNum = oneCheckRepairJotNum; + report.ExpandJotNum = expandJotNum; + + reportList.Add(report); + } + + return reportList; } - else + #endregion + + /// + /// 获取应检测焊口数 + /// + /// 1-施工单位,2-单位工程,3-管线 + /// + /// + private static int GetMustCheckJotNum(string flag, string id) { - listStr.Add(new SqlParameter("@endTime", null)); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int num = 0; + List pipeList = null; + if (flag == "1") + { + pipeList = (from x in db.HJGL_Pipeline where x.ProjectId == id select x).ToList(); + } + if (flag == "2") + { + pipeList = (from x in db.HJGL_Pipeline where x.UnitId == id select x).ToList(); + } + if (flag == "3") + { + pipeList = (from x in db.HJGL_Pipeline where x.UnitWorkId == id select x).ToList(); + } + if (flag == "4") + { + pipeList = (from x in db.HJGL_Pipeline where x.PipelineId == id select x).ToList(); + } + + foreach (var pipe in pipeList) + { + var rate = db.Base_DetectionRate.FirstOrDefault(e => e.DetectionRateId == pipe.DetectionRateId); + int jointNum = (from x in db.HJGL_WeldJoint where x.PipelineId == pipe.PipelineId select x).Count(); + int DetectionRateValue = int.Parse(rate.DetectionRateValue); + decimal n = Convert.ToDecimal(1.0 * jointNum * DetectionRateValue / 100); + num = num + Convert.ToInt32(Math.Ceiling(n)); + } + return num; + } } - SqlParameter[] parameter = listStr.ToArray(); - - DataTable dt = null; - if (string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByProject", parameter); - } - if (!string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByUnit", parameter); - } - if (!string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByUnitWork", parameter); - } - if (!string.IsNullOrEmpty(pipeLineId)) - { - dt = SQLHelper.GetDataTableRunProc("sp_ReportQueryByPipeLine", parameter); - } - - List reportList = new List(); - foreach (DataRow row in dt.Rows) - { - string totalJot = row["TotalJot"].ToString(); - string totalDin = row["TotalDin"].ToString(); - string weldedJot = row["weldedJot"].ToString(); - string weldedDin = row["weldedDin"].ToString(); - string oneCheckJotNum = row["OneCheckJotNum"].ToString(); - string oneCheckRepairJotNum = row["OneCheckRepairJotNum"].ToString(); - string expandJotNum = row["OneExpandJotNum"].ToString(); - - Model.ReportQueryItem report = new Model.ReportQueryItem(); - - string code = string.Empty; - int mustCheckJotNum = 0; - if (string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - mustCheckJotNum = GetMustCheckJotNum("1", row["ProjectId"].ToString()); - code = row["ProjectCode"].ToString(); - report.ProjectCode = row["ProjectCode"].ToString(); - } - if (!string.IsNullOrEmpty(unitId) && string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - mustCheckJotNum = GetMustCheckJotNum("2", row["UnitId"].ToString()); - report.CUnit = row["UnitCode"].ToString(); - - } - if (!string.IsNullOrEmpty(unitWorkId) && string.IsNullOrEmpty(pipeLineId)) - { - mustCheckJotNum = GetMustCheckJotNum("3", row["UnitWorkId"].ToString()); - report.UnitWork = row["UnitWorkCode"].ToString(); - } - if (!string.IsNullOrEmpty(pipeLineId)) - { - mustCheckJotNum = GetMustCheckJotNum("4", row["PipelineId"].ToString()); - report.PipeLine = row["PipelineCode"].ToString(); - } - - - string weldingRate = "0.0%"; - if (totalJot != "0") - { - weldingRate = (Convert.ToInt32(weldedJot) * 100.0 / Convert.ToInt32(totalJot)).ToString() + "%"; - } - - string weldingOnePassRate = "0.0%"; - if (oneCheckJotNum != "0") - { - weldingOnePassRate=((Convert.ToInt32(oneCheckJotNum)-Convert.ToInt32(oneCheckRepairJotNum))*100.0/ Convert.ToInt32(oneCheckJotNum)).ToString() + "%"; - } - - string checkCompRate = "0.0%"; - if (mustCheckJotNum != 0) - { - checkCompRate = (Convert.ToInt32(oneCheckJotNum) * 100.0 / mustCheckJotNum).ToString() + "%"; - } - - report.TotalJotDin = totalJot + "/" + totalDin; - report.WeldedJotDin = weldedJot + "/" + weldedDin; - report.WeldingRate = weldingRate; - report.WeldingOnePassRate = weldingOnePassRate; - - report.MustCheckJotNum = mustCheckJotNum.ToString(); - report.CheckedJotNum = oneCheckJotNum; - report.CheckCompRate = checkCompRate; - report.RepairJotNum = oneCheckRepairJotNum; - report.ExpandJotNum = expandJotNum; - - reportList.Add(report); - } - - return reportList; - } - #endregion - - /// - /// 获取应检测焊口数 - /// - /// 1-施工单位,2-单位工程,3-管线 - /// - /// - private static int GetMustCheckJotNum(string flag, string id) - { - int num = 0; - List pipeList = null; - if (flag == "1") - { - pipeList = (from x in Funs.DB.HJGL_Pipeline where x.ProjectId == id select x).ToList(); - } - if (flag == "2") - { - pipeList = (from x in Funs.DB.HJGL_Pipeline where x.UnitId == id select x).ToList(); - } - if (flag == "3") - { - pipeList = (from x in Funs.DB.HJGL_Pipeline where x.UnitWorkId == id select x).ToList(); - } - if (flag == "4") - { - pipeList = (from x in Funs.DB.HJGL_Pipeline where x.PipelineId == id select x).ToList(); - } - - foreach (var pipe in pipeList) - { - var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(pipe.DetectionRateId); - int jointNum = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == pipe.PipelineId select x).Count(); - int DetectionRateValue = int.Parse(rate.DetectionRateValue); - decimal n = Convert.ToDecimal(1.0 * jointNum * DetectionRateValue / 100); - num = num + Convert.ToInt32(Math.Ceiling(n)); - } - return num; - } - } + } } diff --git a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs index cc24ddaf..b33bd754 100644 --- a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs +++ b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs @@ -99,9 +99,9 @@ namespace BLL CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime), DaySummary = x.DaySummary, PartInUnitIds = x.PartInUnits, - PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits), + PartInUnitNames = UnitService.getUnitNamesUnitIdsForApi (x.PartInUnits), PartInPersonIds = x.PartInPersonIds, - PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds), + PartInPersonNames = UserService.getUserNamesUserIdsForApi(x.PartInPersonIds), PartInPersonNames2 = x.PartInPersonNames, CompileManId = x.CompileMan, CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName, @@ -159,7 +159,7 @@ namespace BLL DaySummary = System.Web.HttpUtility.HtmlEncode(newItem.DaySummary), PartInUnits = newItem.PartInUnitIds, PartInPersonIds = newItem.PartInPersonIds, - PartInPersons = UserService.getUserNamesUserIds(newItem.PartInPersonIds), + PartInPersons = UserService.getUserNamesUserIdsForApi(newItem.PartInPersonIds), PartInPersonNames = newItem.PartInPersonNames2, CompileMan = newItem.CompileManId, States = Const.State_0, @@ -194,22 +194,22 @@ namespace BLL db.Check_CheckSpecial.InsertOnSubmit(newCheckSpecial); db.SubmitChanges(); ////增加一条编码记录 - BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckSpecialMenuId, newCheckSpecial.ProjectId, null, newCheckSpecial.CheckSpecialId, newCheckSpecial.CheckTime); + BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(BLL.Const.ProjectCheckSpecialMenuId, newCheckSpecial.ProjectId, null, newCheckSpecial.CheckSpecialId, newCheckSpecial.CheckTime); } else { - Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial); + Check_CheckSpecialService.UpdateCheckSpecialForApi(newCheckSpecial); //// 删除专项检查明细项 - Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(newCheckSpecial.CheckSpecialId); + Check_CheckSpecialDetailService.DeleteCheckSpecialDetailsForApi(newCheckSpecial.CheckSpecialId); } ////保存附件 if (!string.IsNullOrEmpty(newItem.AttachUrl1)) { - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); } else { - CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); + CommonService.DeleteAttachFileByIdForApi(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); } ///// 新增检查项 @@ -227,7 +227,7 @@ namespace BLL if (getC == null) { newCheckSpecial.States = Const.State_2; - Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial); + Check_CheckSpecialService.UpdateCheckSpecialForApi(newCheckSpecial); } else { @@ -235,7 +235,7 @@ namespace BLL var detailLists = db.Check_CheckSpecialDetail.Where(x => x.CheckSpecialId == newCheckSpecial.CheckSpecialId && x.CompleteStatus == false); if (detailLists.Count() > 0) { - message = Check_CheckSpecialService.IssueRectification(detailLists.ToList(), newCheckSpecial); + message = Check_CheckSpecialService.IssueRectificationForApi(detailLists.ToList(), newCheckSpecial); } diff --git a/SGGL/BLL/API/HSSE/APIConstructSolutionService.cs b/SGGL/BLL/API/HSSE/APIConstructSolutionService.cs index 2da849f3..4ece7336 100644 --- a/SGGL/BLL/API/HSSE/APIConstructSolutionService.cs +++ b/SGGL/BLL/API/HSSE/APIConstructSolutionService.cs @@ -123,15 +123,15 @@ namespace BLL newConstructSolution.CompileDate = DateTime.Now; newConstructSolution.ConstructSolutionId = SQLHelper.GetNewID(); newConstructSolution.ConstructSolutionCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectConstructSolutionMenuId, newConstructSolution.ProjectId, newConstructSolution.UnitId); - ConstructSolutionService.AddConstructSolution(newConstructSolution); + ConstructSolutionService.AddConstructSolutionForApi(newConstructSolution); } else { - ConstructSolutionService.UpdateConstructSolution(newConstructSolution); + ConstructSolutionService.UpdateConstructSolutionForApi(newConstructSolution); } if (newConstructSolution.States == "1") { - CommonService.btnSaveData(newConstructSolution.ProjectId, Const.ProjectConstructSolutionMenuId, newConstructSolution.ConstructSolutionId, newConstructSolution.CompileMan, true, newConstructSolution.CompileManName, "../Solution/ConstructSolutionView.aspx?ConstructSolutionId={0}"); + CommonService.btnSaveDataForApi(newConstructSolution.ProjectId, Const.ProjectConstructSolutionMenuId, newConstructSolution.ConstructSolutionId, newConstructSolution.CompileMan, true, newConstructSolution.CompileManName, "../Solution/ConstructSolutionView.aspx?ConstructSolutionId={0}"); } if (!string.IsNullOrEmpty(newItem.AttachUrl)) { @@ -140,7 +140,7 @@ namespace BLL } else { - CommonService.DeleteAttachFileById(newConstructSolution.ConstructSolutionId); + CommonService.DeleteAttachFileByIdForApi(newConstructSolution.ConstructSolutionId); } } #endregion diff --git a/SGGL/BLL/API/HSSE/APIEmergencyService.cs b/SGGL/BLL/API/HSSE/APIEmergencyService.cs index 7d946125..c599d3d7 100644 --- a/SGGL/BLL/API/HSSE/APIEmergencyService.cs +++ b/SGGL/BLL/API/HSSE/APIEmergencyService.cs @@ -307,7 +307,7 @@ namespace BLL db.Emergency_EmergencyList.InsertOnSubmit(newEmergency); db.SubmitChanges(); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectEmergencyListMenuId, newEmergency.ProjectId, null, newEmergency.EmergencyListId, newEmergency.CompileDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectEmergencyListMenuId, newEmergency.ProjectId, null, newEmergency.EmergencyListId, newEmergency.CompileDate); } else { @@ -322,7 +322,7 @@ namespace BLL } if (emergencyInfo.States == Const.State_1) { - CommonService.btnSaveData(newEmergency.ProjectId, Const.ProjectEmergencyListMenuId, newEmergency.EmergencyListId, newEmergency.CompileMan, true, newEmergency.EmergencyName, "../Emergency/EmergencyListView.aspx?EmergencyListId={0}"); + CommonService.btnSaveDataForApi(newEmergency.ProjectId, Const.ProjectEmergencyListMenuId, newEmergency.EmergencyListId, newEmergency.CompileMan, true, newEmergency.EmergencyName, "../Emergency/EmergencyListView.aspx?EmergencyListId={0}"); } menuId = Const.ProjectEmergencyListMenuId; @@ -366,7 +366,7 @@ namespace BLL } if (emergencyInfo.States == Const.State_1) { - CommonService.btnSaveData(newEmergency.ProjectId, Const.ProjectEmergencySupplyMenuId, newEmergency.FileId, newEmergency.CompileMan, true, newEmergency.FileName, "../Emergency/EmergencySupplyView.aspx?FileId={0}"); + CommonService.btnSaveDataForApi(newEmergency.ProjectId, Const.ProjectEmergencySupplyMenuId, newEmergency.FileId, newEmergency.CompileMan, true, newEmergency.FileName, "../Emergency/EmergencySupplyView.aspx?FileId={0}"); } menuId = Const.ProjectEmergencySupplyMenuId; } @@ -435,7 +435,7 @@ namespace BLL if (emergencyInfo.States == Const.State_1) { - CommonService.btnSaveData(newEmergency.ProjectId, Const.ProjectEmergencyTeamAndTrainMenuId, newEmergency.FileId, newEmergency.CompileMan, true, newEmergency.FileName, "../Emergency/EmergencyTeamAndTrainView.aspx?FileId={0}"); + CommonService.btnSaveDataForApi(newEmergency.ProjectId, Const.ProjectEmergencyTeamAndTrainMenuId, newEmergency.FileId, newEmergency.CompileMan, true, newEmergency.FileName, "../Emergency/EmergencyTeamAndTrainView.aspx?FileId={0}"); } menuId = Const.ProjectEmergencyTeamAndTrainMenuId; } @@ -567,7 +567,7 @@ namespace BLL Model.BaseInfoItem newItem = new Model.BaseInfoItem { BaseInfoId = teamItem.PersonId, - BaseInfoName = BLL.PersonService.GetPersonNameById(teamItem.PersonId), + BaseInfoName = BLL.PersonService.GetPersonNameByIdForApi(teamItem.PersonId), BaseInfoCode = teamItem.Tel, Remark = teamItem.Job, RemarkOther = "1", diff --git a/SGGL/BLL/API/HSSE/APIEquipmentQualityService.cs b/SGGL/BLL/API/HSSE/APIEquipmentQualityService.cs index bb16b40e..6f112455 100644 --- a/SGGL/BLL/API/HSSE/APIEquipmentQualityService.cs +++ b/SGGL/BLL/API/HSSE/APIEquipmentQualityService.cs @@ -131,20 +131,20 @@ namespace BLL newEquipmentQuality.CompileDate = DateTime.Now; newEquipmentQuality.EquipmentQualityId = SQLHelper.GetNewID(); newEquipmentQuality.EquipmentQualityCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.EquipmentQualityMenuId, newEquipmentQuality.ProjectId, newEquipmentQuality.UnitId); - EquipmentQualityService.AddEquipmentQuality(newEquipmentQuality); + EquipmentQualityService.AddEquipmentQualityForApi(newEquipmentQuality); } else { - EquipmentQualityService.UpdateEquipmentQuality(newEquipmentQuality); + EquipmentQualityService.UpdateEquipmentQualityForApi(newEquipmentQuality); } if (!string.IsNullOrEmpty(newItem.AttachUrl)) { ////保存附件 - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl, 10, null), newItem.AttachUrl, Const.EquipmentQualityMenuId, newEquipmentQuality.EquipmentQualityId); + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl, 10, null), newItem.AttachUrl, Const.EquipmentQualityMenuId, newEquipmentQuality.EquipmentQualityId); } else { - CommonService.DeleteAttachFileById(newEquipmentQuality.EquipmentQualityId); + CommonService.DeleteAttachFileByIdForApi(newEquipmentQuality.EquipmentQualityId); } } #endregion diff --git a/SGGL/BLL/API/HSSE/APIHSEDiaryService.cs b/SGGL/BLL/API/HSSE/APIHSEDiaryService.cs index d652bca7..858294ff 100644 --- a/SGGL/BLL/API/HSSE/APIHSEDiaryService.cs +++ b/SGGL/BLL/API/HSSE/APIHSEDiaryService.cs @@ -28,7 +28,7 @@ namespace BLL var getFlowOperteList = ReturnFlowOperteList(projectId, userId, getDiaryDate.Value); getItem.ProjectId = projectId; getItem.UserId = userId; - getItem.UserName = UserService.GetUserNameByUserId(userId); + getItem.UserName = UserService.GetUserNameByUserIdForApi(userId); getItem.DiaryDate = diaryDate; getItem.HSEDiaryId = SQLHelper.GetNewID(); getItem.Value1 = getValues1(getFlowOperteList, projectId, userId, getDiaryDate.Value); diff --git a/SGGL/BLL/API/HSSE/APIHazardListService.cs b/SGGL/BLL/API/HSSE/APIHazardListService.cs index 387f1158..616fcdf5 100644 --- a/SGGL/BLL/API/HSSE/APIHazardListService.cs +++ b/SGGL/BLL/API/HSSE/APIHazardListService.cs @@ -31,7 +31,7 @@ namespace BLL CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName, CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate), WorkStageIds = x.WorkStage, - WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage), + WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIdsForApi(x.WorkStage), Contents = x.Contents, WorkAreaName = x.WorkAreaName, IdentificationDate = string.Format("{0:yyyy-MM-dd}", x.IdentificationDate), @@ -68,7 +68,7 @@ namespace BLL CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName, CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate), WorkStageIds = x.WorkStage, - WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage), + WorkStageNames = WorkStageService.getWorkStageNamesWorkStageIdsForApi(x.WorkStage), Contents = x.Contents, WorkAreaName = x.WorkAreaName, IdentificationDate = string.Format("{0:yyyy-MM-dd}", x.IdentificationDate), @@ -98,7 +98,7 @@ namespace BLL select new Model.HazardListSelectedItem { HazardId = x.HazardId, - WorkStageName = WorkStageService.getWorkStageNamesWorkStageIds(x.WorkStage), + WorkStageName = WorkStageService.getWorkStageNamesWorkStageIdsForApi(x.WorkStage), SupHazardListTypeName = db.Technique_HazardListType.First(z => z.HazardListTypeId == y.SupHazardListTypeId).HazardListTypeName, HazardListTypeName = y.HazardListTypeName, HazardCode = y.HazardListTypeCode, diff --git a/SGGL/BLL/API/HSSE/APIIncentiveNoticeService.cs b/SGGL/BLL/API/HSSE/APIIncentiveNoticeService.cs index 68d01a46..65dec192 100644 --- a/SGGL/BLL/API/HSSE/APIIncentiveNoticeService.cs +++ b/SGGL/BLL/API/HSSE/APIIncentiveNoticeService.cs @@ -162,7 +162,7 @@ namespace BLL newIncentiveNotice.CompileDate = DateTime.Now; newIncentiveNotice.IncentiveNoticeId = SQLHelper.GetNewID(); newIncentiveNotice.IncentiveNoticeCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectIncentiveNoticeMenuId, newIncentiveNotice.ProjectId, newIncentiveNotice.UnitId); - IncentiveNoticeService.AddIncentiveNotice(newIncentiveNotice); + IncentiveNoticeService.AddIncentiveNoticeForApi(newIncentiveNotice); } else { @@ -261,7 +261,7 @@ namespace BLL } if (newIncentiveNotice.States == "1" || newIncentiveNotice.States == "0") { - CommonService.btnSaveData(newIncentiveNotice.ProjectId, Const.ProjectIncentiveNoticeMenuId, newIncentiveNotice.IncentiveNoticeId, newIncentiveNotice.CompileMan, true, newIncentiveNotice.IncentiveNoticeCode, "../Check/IncentiveNoticeView.aspx?IncentiveNoticeId={0}"); + CommonService.btnSaveDataForApi(newIncentiveNotice.ProjectId, Const.ProjectIncentiveNoticeMenuId, newIncentiveNotice.IncentiveNoticeId, newIncentiveNotice.CompileMan, true, newIncentiveNotice.IncentiveNoticeCode, "../Check/IncentiveNoticeView.aspx?IncentiveNoticeId={0}"); } } #endregion diff --git a/SGGL/BLL/API/HSSE/APILicenseDataService.cs b/SGGL/BLL/API/HSSE/APILicenseDataService.cs index 0aeebd14..65135f40 100644 --- a/SGGL/BLL/API/HSSE/APILicenseDataService.cs +++ b/SGGL/BLL/API/HSSE/APILicenseDataService.cs @@ -531,7 +531,7 @@ namespace BLL { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - if (!ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(projectId, unitId)) + if (!ProjectUnitService.GetProjectUnitTypeByProjectIdUnitIdForApi(projectId, unitId)) { unitId = null; } @@ -993,7 +993,7 @@ namespace BLL ApplyManId = x.CompileMan, ApplyManName = x.ApplicantMan, ApplyDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.CompileDate), - WorkPalce = UnitWorkService.GetUnitWorkName(x.WorkAreaId), + WorkPalce = UnitWorkService.GetUnitWorkNameForApi(x.WorkAreaId), ValidityStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.StartDate), ValidityEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.EndDate), States = x.WorkStates, @@ -1384,7 +1384,7 @@ namespace BLL ApplyUnitName = db.Base_Unit.First(u => u.UnitId == x.UnitId).UnitName, ApplyManName = x.ApplicantMan, ApplyDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.CompileDate), - WorkPalce = UnitWorkService.GetUnitWorkName(x.WorkAreaId), + WorkPalce = UnitWorkService.GetUnitWorkNameForApi(x.WorkAreaId), ValidityStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.StartDate), ValidityEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.EndDate), States = x.WorkStates, @@ -1534,7 +1534,7 @@ namespace BLL newItem.LicenseCode = newFireWork.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectFireWorkMenuId, newFireWork.ProjectId, newFireWork.ApplyUnitId); db.License_FireWork.InsertOnSubmit(newFireWork); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectFireWorkMenuId, newFireWork.ProjectId, newFireWork.ApplyUnitId, newFireWork.FireWorkId, newFireWork.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectFireWorkMenuId, newFireWork.ProjectId, newFireWork.ApplyUnitId, newFireWork.FireWorkId, newFireWork.ApplyDate); } else { @@ -1619,7 +1619,7 @@ namespace BLL db.License_HeightWork.InsertOnSubmit(newHeightWork); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectHeightWorkMenuId, newHeightWork.ProjectId, newHeightWork.ApplyUnitId, newHeightWork.HeightWorkId, newHeightWork.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectHeightWorkMenuId, newHeightWork.ProjectId, newHeightWork.ApplyUnitId, newHeightWork.HeightWorkId, newHeightWork.ApplyDate); } else { @@ -1701,7 +1701,7 @@ namespace BLL newItem.LicenseCode = newLimitedSpace.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectLimitedSpaceMenuId, newLimitedSpace.ProjectId, newLimitedSpace.ApplyUnitId); db.License_LimitedSpace.InsertOnSubmit(newLimitedSpace); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectLimitedSpaceMenuId, newLimitedSpace.ProjectId, newLimitedSpace.ApplyUnitId, newLimitedSpace.LimitedSpaceId, newLimitedSpace.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectLimitedSpaceMenuId, newLimitedSpace.ProjectId, newLimitedSpace.ApplyUnitId, newLimitedSpace.LimitedSpaceId, newLimitedSpace.ApplyDate); } else { @@ -1792,7 +1792,7 @@ namespace BLL newItem.LicenseCode = newRadialWork.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectRadialWorkMenuId, newRadialWork.ProjectId, newRadialWork.ApplyUnitId); db.License_RadialWork.InsertOnSubmit(newRadialWork); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectRadialWorkMenuId, newRadialWork.ProjectId, newRadialWork.ApplyUnitId, newRadialWork.RadialWorkId, newRadialWork.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectRadialWorkMenuId, newRadialWork.ProjectId, newRadialWork.ApplyUnitId, newRadialWork.RadialWorkId, newRadialWork.ApplyDate); } else { @@ -1877,7 +1877,7 @@ namespace BLL newItem.LicenseCode = newOpenCircuit.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectOpenCircuitMenuId, newOpenCircuit.ProjectId, newOpenCircuit.ApplyUnitId); db.License_OpenCircuit.InsertOnSubmit(newOpenCircuit); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectOpenCircuitMenuId, newOpenCircuit.ProjectId, newOpenCircuit.ApplyUnitId, newOpenCircuit.OpenCircuitId, newOpenCircuit.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectOpenCircuitMenuId, newOpenCircuit.ProjectId, newOpenCircuit.ApplyUnitId, newOpenCircuit.OpenCircuitId, newOpenCircuit.ApplyDate); } else { @@ -1958,7 +1958,7 @@ namespace BLL newItem.LicenseCode = newBreakGround.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectBreakGroundMenuId, newBreakGround.ProjectId, newBreakGround.ApplyUnitId); db.License_BreakGround.InsertOnSubmit(newBreakGround); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectBreakGroundMenuId, newBreakGround.ProjectId, newBreakGround.ApplyUnitId, newBreakGround.BreakGroundId, newBreakGround.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectBreakGroundMenuId, newBreakGround.ProjectId, newBreakGround.ApplyUnitId, newBreakGround.BreakGroundId, newBreakGround.ApplyDate); } else { @@ -2040,7 +2040,7 @@ namespace BLL newItem.LicenseCode = newNightWork.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectNightWorkMenuId, newNightWork.ProjectId, newNightWork.ApplyUnitId); db.License_NightWork.InsertOnSubmit(newNightWork); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectNightWorkMenuId, newNightWork.ProjectId, newNightWork.ApplyUnitId, newNightWork.NightWorkId, newNightWork.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectNightWorkMenuId, newNightWork.ProjectId, newNightWork.ApplyUnitId, newNightWork.NightWorkId, newNightWork.ApplyDate); } else { @@ -2130,7 +2130,7 @@ namespace BLL newItem.LicenseCode = newLiftingWork.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectLiftingWorkMenuId, newLiftingWork.ProjectId, newLiftingWork.ApplyUnitId); db.License_LiftingWork.InsertOnSubmit(newLiftingWork); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectLiftingWorkMenuId, newLiftingWork.ProjectId, newLiftingWork.ApplyUnitId, newLiftingWork.LiftingWorkId, newLiftingWork.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectLiftingWorkMenuId, newLiftingWork.ProjectId, newLiftingWork.ApplyUnitId, newLiftingWork.LiftingWorkId, newLiftingWork.ApplyDate); } else { @@ -2214,7 +2214,7 @@ namespace BLL newItem.LicenseCode = newTempElectricity.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTempElectricityMenuId, newTempElectricity.ProjectId, newTempElectricity.ApplyUnitId); db.License_TempElectricity.InsertOnSubmit(newTempElectricity); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTempElectricityMenuId, newTempElectricity.ProjectId, newTempElectricity.ApplyUnitId, newTempElectricity.TempElectricityId, newTempElectricity.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTempElectricityMenuId, newTempElectricity.ProjectId, newTempElectricity.ApplyUnitId, newTempElectricity.TempElectricityId, newTempElectricity.ApplyDate); } else { @@ -2299,7 +2299,7 @@ namespace BLL newItem.LicenseCode = newPressureTest.LicenseCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectPressureTestMenuId, newPressureTest.ProjectId, newPressureTest.ApplyUnitId); db.License_PressureTest.InsertOnSubmit(newPressureTest); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTempElectricityMenuId, newPressureTest.ProjectId, newPressureTest.ApplyUnitId, newPressureTest.PressureTestId, newPressureTest.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTempElectricityMenuId, newPressureTest.ProjectId, newPressureTest.ApplyUnitId, newPressureTest.PressureTestId, newPressureTest.ApplyDate); } else { @@ -2388,7 +2388,7 @@ namespace BLL db.License_JiaBan.InsertOnSubmit(newJiaBan); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectJiaBanWorkMenuId, newJiaBan.ProjectId, newJiaBan.ApplyUnitId, newJiaBan.JiaBanId, newJiaBan.ApplyDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectJiaBanWorkMenuId, newJiaBan.ProjectId, newJiaBan.ApplyUnitId, newJiaBan.JiaBanId, newJiaBan.ApplyDate); } else { @@ -2469,7 +2469,7 @@ namespace BLL newItem.LicenseCode = newLicenseManager.LicenseManagerCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectLicenseManagerMenuId, newLicenseManager.ProjectId, newLicenseManager.UnitId); db.License_LicenseManager.InsertOnSubmit(newLicenseManager); ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectLicenseManagerMenuId, newLicenseManager.ProjectId, newLicenseManager.UnitId, newLicenseManager.LicenseManagerId, newLicenseManager.CompileDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectLicenseManagerMenuId, newLicenseManager.ProjectId, newLicenseManager.UnitId, newLicenseManager.LicenseManagerId, newLicenseManager.CompileDate); } else { @@ -2488,7 +2488,7 @@ namespace BLL } if (newLicenseManager.States == Const.State_2) { - CommonService.btnSaveData(newLicenseManager.ProjectId, Const.ProjectLicenseManagerMenuId, newLicenseManager.LicenseManagerId, newLicenseManager.CompileMan, true, newLicenseManager.LicenseManagerCode, "../License/LicenseManagerView.aspx?LicenseManagerId={0}"); + CommonService.btnSaveDataForApi(newLicenseManager.ProjectId, Const.ProjectLicenseManagerMenuId, newLicenseManager.LicenseManagerId, newLicenseManager.CompileMan, true, newLicenseManager.LicenseManagerCode, "../License/LicenseManagerView.aspx?LicenseManagerId={0}"); } //// 保存附件 APIUpLoadFileService.SaveAttachUrl(newItem.MenuId, strLicenseId, newItem.AttachUrl, "0"); @@ -3744,7 +3744,7 @@ namespace BLL db.License_FlowOperate.DeleteAllOnSubmit(getDelFlows); } //// 删除编码表记录 - CodeRecordsService.DeleteCodeRecordsByDataId(strLicenseId); + CodeRecordsService.DeleteCodeRecordsByDataIdForApi(strLicenseId); #region 动火作业票 if (newItem.MenuId == Const.ProjectFireWorkMenuId) { diff --git a/SGGL/BLL/API/HSSE/APILicenseFlowOperateService.cs b/SGGL/BLL/API/HSSE/APILicenseFlowOperateService.cs index 9567dd4d..fc43bed4 100644 --- a/SGGL/BLL/API/HSSE/APILicenseFlowOperateService.cs +++ b/SGGL/BLL/API/HSSE/APILicenseFlowOperateService.cs @@ -28,7 +28,7 @@ namespace BLL AuditFlowName = x.AuditFlowName, SortIndex = x.SortIndex ?? 1, RoleIds = x.RoleIds, - RoleNames = RoleService.getRoleNamesRoleIds(x.RoleIds), + RoleNames = RoleService.getRoleNamesRoleIdsForApi(x.RoleIds), OperaterId = x.OperaterId, OperaterName = db.Sys_User.First(u => u.UserId == x.OperaterId).UserName, OperaterTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.OperaterTime), @@ -63,7 +63,7 @@ namespace BLL AuditFlowName = x.AuditFlowName, SortIndex = x.SortIndex ?? 1, RoleIds = x.RoleIds, - RoleNames = RoleService.getRoleNamesRoleIds(x.RoleIds), + RoleNames = RoleService.getRoleNamesRoleIdsForApi(x.RoleIds), OperaterId = x.OperaterId, OperaterName = db.Sys_User.First(u => u.UserId == x.OperaterId).UserName, OperaterTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.OperaterTime), @@ -132,43 +132,46 @@ namespace BLL IsSelfRole = item.IsSelfRole }; - LicensePublicService.AddFlowOperate(newFlowOperate); + LicensePublicService.AddFlowOperateForApi(newFlowOperate); } } } - #endregion + #endregion - #region 保存作业票-流程审核[State=1] - /// - /// 保存作业票-流程审核 - /// - /// 流程审核集合 - /// - public static void SaveFlowOperate(Model.FlowOperateItem flowOperate) - { - var getFlowOperate = LicensePublicService.GetFlowOperateById(flowOperate.FlowOperateId); - if (getFlowOperate != null) + #region 保存作业票-流程审核[State=1] + /// + /// 保存作业票-流程审核 + /// + /// 流程审核集合 + /// + public static void SaveFlowOperate(Model.FlowOperateItem flowOperate) { - getFlowOperate.OperaterId = flowOperate.OperaterId; - getFlowOperate.OperaterTime = System.DateTime.Now; - getFlowOperate.IsAgree = flowOperate.IsAgree; - getFlowOperate.Opinion = flowOperate.Opinion; - getFlowOperate.IsClosed = flowOperate.IsAgree;///同意时,当前流程关闭;不同意则返回申请人。 - LicensePublicService.UpdateFlowOperate(getFlowOperate); + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getFlowOperate = db.License_FlowOperate.FirstOrDefault(e => e.FlowOperateId == flowOperate.FlowOperateId); + if (getFlowOperate != null) + { + getFlowOperate.OperaterId = flowOperate.OperaterId; + getFlowOperate.OperaterTime = System.DateTime.Now; + getFlowOperate.IsAgree = flowOperate.IsAgree; + getFlowOperate.Opinion = flowOperate.Opinion; + getFlowOperate.IsClosed = flowOperate.IsAgree;///同意时,当前流程关闭;不同意则返回申请人。 + db.SubmitChanges(); - Model.License_FlowOperateItem newFlowOperateItem = new Model.License_FlowOperateItem - { - FlowOperateItemId = SQLHelper.GetNewID(), - FlowOperateId = getFlowOperate.FlowOperateId, - OperaterId = getFlowOperate.OperaterId, - OperaterTime = getFlowOperate.OperaterTime, - IsAgree = getFlowOperate.IsAgree, - Opinion = getFlowOperate.Opinion, - }; - - LicensePublicService.AddFlowOperateItem(newFlowOperateItem); + Model.License_FlowOperateItem newFlowOperateItem = new Model.License_FlowOperateItem + { + FlowOperateItemId = SQLHelper.GetNewID(), + FlowOperateId = getFlowOperate.FlowOperateId, + OperaterId = getFlowOperate.OperaterId, + OperaterTime = getFlowOperate.OperaterTime, + IsAgree = getFlowOperate.IsAgree, + Opinion = getFlowOperate.Opinion, + }; + db.License_FlowOperateItem.InsertOnSubmit(newFlowOperateItem); + db.SubmitChanges(); + } + } } - } #endregion } } diff --git a/SGGL/BLL/API/HSSE/APILicenseItemService.cs b/SGGL/BLL/API/HSSE/APILicenseItemService.cs index cb6b1c47..6e0bec04 100644 --- a/SGGL/BLL/API/HSSE/APILicenseItemService.cs +++ b/SGGL/BLL/API/HSSE/APILicenseItemService.cs @@ -81,7 +81,7 @@ namespace BLL IsUsed = item.IsUsed, ConfirmManId = item.ConfirmManId, }; - LicensePublicService.AddLicenseItem(newLicenseItem); + LicensePublicService.AddLicenseItemForApi(newLicenseItem); } } #endregion diff --git a/SGGL/BLL/API/HSSE/APIMeetingService.cs b/SGGL/BLL/API/HSSE/APIMeetingService.cs index 72236163..16014bda 100644 --- a/SGGL/BLL/API/HSSE/APIMeetingService.cs +++ b/SGGL/BLL/API/HSSE/APIMeetingService.cs @@ -86,7 +86,7 @@ namespace BLL MeetingHostManOther = x.MeetingHostManOther, MeetingHostManName = db.Sys_User.First(z => z.UserId == x.MeetingHostManId).UserName, AttentPersonIds = x.AttentPersonIds, - AttentPersonNames = UserService.getUserNamesUserIds(x.AttentPersonIds), + AttentPersonNames = UserService.getUserNamesUserIdsForApi(x.AttentPersonIds), }).FirstOrDefault(); } else if (meetingType == "M") @@ -119,7 +119,7 @@ namespace BLL MeetingHostManId = x.MeetingHostManId, MeetingHostManName = db.Sys_User.First(z => z.UserId == x.MeetingHostManId).UserName, AttentPersonIds = x.AttentPersonIds, - AttentPersonNames = UserService.getUserNamesUserIds(x.AttentPersonIds), + AttentPersonNames = UserService.getUserNamesUserIdsForApi(x.AttentPersonIds), }).FirstOrDefault(); } else if (meetingType == "S") @@ -152,7 +152,7 @@ namespace BLL MeetingHostManId = x.MeetingHostManId, MeetingHostManName = db.Sys_User.First(z => z.UserId == x.MeetingHostManId).UserName, AttentPersonIds = x.AttentPersonIds, - AttentPersonNames = UserService.getUserNamesUserIds(x.AttentPersonIds), + AttentPersonNames = UserService.getUserNamesUserIdsForApi(x.AttentPersonIds), }).FirstOrDefault(); } else @@ -185,7 +185,7 @@ namespace BLL MeetingHostManId = x.MeetingHostManId, MeetingHostManName = db.Sys_User.First(z => z.UserId == x.MeetingHostManId).UserName, AttentPersonIds = x.AttentPersonIds, - AttentPersonNames = UserService.getUserNamesUserIds(x.AttentPersonIds), + AttentPersonNames = UserService.getUserNamesUserIdsForApi(x.AttentPersonIds), }).FirstOrDefault(); } return getMeetItem; @@ -412,15 +412,15 @@ namespace BLL newClassMeeting.CompileDate = DateTime.Now; meeting.MeetingId = newClassMeeting.ClassMeetingId = SQLHelper.GetNewID(); newClassMeeting.ClassMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectClassMeetingMenuId, newClassMeeting.ProjectId, null); - ClassMeetingService.AddClassMeeting(newClassMeeting); + ClassMeetingService.AddClassMeetingForApi(newClassMeeting); } else { - ClassMeetingService.UpdateClassMeeting(newClassMeeting); + ClassMeetingService.UpdateClassMeetingForApi(newClassMeeting); } if (meeting.States == "1") { - CommonService.btnSaveData(meeting.ProjectId, Const.ProjectClassMeetingMenuId, newClassMeeting.ClassMeetingId, newClassMeeting.CompileMan, true, newClassMeeting.ClassMeetingName, "../Meeting/ClassMeetingView.aspx?ClassMeetingId={0}"); + CommonService.btnSaveDataForApi(meeting.ProjectId, Const.ProjectClassMeetingMenuId, newClassMeeting.ClassMeetingId, newClassMeeting.CompileMan, true, newClassMeeting.ClassMeetingName, "../Meeting/ClassMeetingView.aspx?ClassMeetingId={0}"); } menuId = Const.ProjectClassMeetingMenuId; @@ -463,15 +463,15 @@ namespace BLL newWeekMeeting.CompileDate = DateTime.Now; meeting.MeetingId = newWeekMeeting.WeekMeetingId = SQLHelper.GetNewID(); newWeekMeeting.WeekMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectWeekMeetingMenuId, newWeekMeeting.ProjectId, null); - WeekMeetingService.AddWeekMeeting(newWeekMeeting); + WeekMeetingService.AddWeekMeetingForApi(newWeekMeeting); } else { - WeekMeetingService.UpdateWeekMeeting(newWeekMeeting); + WeekMeetingService.UpdateWeekMeetingForApi(newWeekMeeting); } if (meeting.States == "1") { - CommonService.btnSaveData(meeting.ProjectId, Const.ProjectWeekMeetingMenuId, newWeekMeeting.WeekMeetingId, newWeekMeeting.CompileMan, true, newWeekMeeting.WeekMeetingName, "../Meeting/WeekMeetingView.aspx?WeekMeetingId={0}"); + CommonService.btnSaveDataForApi(meeting.ProjectId, Const.ProjectWeekMeetingMenuId, newWeekMeeting.WeekMeetingId, newWeekMeeting.CompileMan, true, newWeekMeeting.WeekMeetingName, "../Meeting/WeekMeetingView.aspx?WeekMeetingId={0}"); } menuId = Const.ProjectWeekMeetingMenuId; } @@ -512,15 +512,15 @@ namespace BLL newMonthMeeting.CompileDate = DateTime.Now; meeting.MeetingId = newMonthMeeting.MonthMeetingId = SQLHelper.GetNewID(); newMonthMeeting.MonthMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectMonthMeetingMenuId, newMonthMeeting.ProjectId, null); - MonthMeetingService.AddMonthMeeting(newMonthMeeting); + MonthMeetingService.AddMonthMeetingForApi(newMonthMeeting); } else { - MonthMeetingService.UpdateMonthMeeting(newMonthMeeting); + MonthMeetingService.UpdateMonthMeetingForApi(newMonthMeeting); } if (meeting.States == "1") { - CommonService.btnSaveData(meeting.ProjectId, Const.ProjectMonthMeetingMenuId, newMonthMeeting.MonthMeetingId, newMonthMeeting.CompileMan, true, newMonthMeeting.MonthMeetingName, "../Meeting/MonthMeetingView.aspx?MonthMeetingId={0}"); + CommonService.btnSaveDataForApi(meeting.ProjectId, Const.ProjectMonthMeetingMenuId, newMonthMeeting.MonthMeetingId, newMonthMeeting.CompileMan, true, newMonthMeeting.MonthMeetingName, "../Meeting/MonthMeetingView.aspx?MonthMeetingId={0}"); } menuId = Const.ProjectMonthMeetingMenuId; } @@ -562,15 +562,15 @@ namespace BLL newSpecialMeeting.CompileDate = DateTime.Now; meeting.MeetingId = newSpecialMeeting.SpecialMeetingId = SQLHelper.GetNewID(); newSpecialMeeting.SpecialMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectSpecialMeetingMenuId, newSpecialMeeting.ProjectId, null); - SpecialMeetingService.AddSpecialMeeting(newSpecialMeeting); + SpecialMeetingService.AddSpecialMeetingForApi(newSpecialMeeting); } else { - SpecialMeetingService.UpdateSpecialMeeting(newSpecialMeeting); + SpecialMeetingService.UpdateSpecialMeetingForApi(newSpecialMeeting); } if (meeting.States == "1") { - CommonService.btnSaveData(meeting.ProjectId, Const.ProjectSpecialMeetingMenuId, newSpecialMeeting.SpecialMeetingId, newSpecialMeeting.CompileMan, true, newSpecialMeeting.SpecialMeetingName, "../Meeting/SpecialMeetingView.aspx?SpecialMeetingId={0}"); + CommonService.btnSaveDataForApi(meeting.ProjectId, Const.ProjectSpecialMeetingMenuId, newSpecialMeeting.SpecialMeetingId, newSpecialMeeting.CompileMan, true, newSpecialMeeting.SpecialMeetingName, "../Meeting/SpecialMeetingView.aspx?SpecialMeetingId={0}"); } menuId = Const.ProjectSpecialMeetingMenuId; } @@ -612,15 +612,15 @@ namespace BLL newAttendMeeting.CompileDate = DateTime.Now; meeting.MeetingId = newAttendMeeting.AttendMeetingId = SQLHelper.GetNewID(); newAttendMeeting.AttendMeetingCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectAttendMeetingMenuId, newAttendMeeting.ProjectId, null); - AttendMeetingService.AddAttendMeeting(newAttendMeeting); + AttendMeetingService.AddAttendMeetingForApi(newAttendMeeting); } else { - AttendMeetingService.UpdateAttendMeeting(newAttendMeeting); + AttendMeetingService.UpdateAttendMeetingForApi(newAttendMeeting); } if (meeting.States == "1") { - CommonService.btnSaveData(meeting.ProjectId, Const.ProjectAttendMeetingMenuId, newAttendMeeting.AttendMeetingId, newAttendMeeting.CompileMan, true, newAttendMeeting.AttendMeetingName, "../Meeting/AttendMeetingView.aspx?AttendMeetingId={0}"); + CommonService.btnSaveDataForApi(meeting.ProjectId, Const.ProjectAttendMeetingMenuId, newAttendMeeting.AttendMeetingId, newAttendMeeting.CompileMan, true, newAttendMeeting.AttendMeetingName, "../Meeting/AttendMeetingView.aspx?AttendMeetingId={0}"); } menuId = Const.ProjectAttendMeetingMenuId; } diff --git a/SGGL/BLL/API/HSSE/APIPauseNoticeService.cs b/SGGL/BLL/API/HSSE/APIPauseNoticeService.cs index e7419ec5..40804669 100644 --- a/SGGL/BLL/API/HSSE/APIPauseNoticeService.cs +++ b/SGGL/BLL/API/HSSE/APIPauseNoticeService.cs @@ -51,7 +51,7 @@ namespace BLL DutyPersonName = db.Sys_User.First(u => u.UserId == x.DutyPersonId).UserName, DutyPersonDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.DutyPersonDate), ProfessionalEngineerId = x.ProfessionalEngineerId, - ProfessionalEngineerName = UserService.getUserNamesUserIds(x.ProfessionalEngineerId), + ProfessionalEngineerName = UserService.getUserNamesUserIdsForApi(x.ProfessionalEngineerId), ProfessionalEngineerTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.ProfessionalEngineerTime), ConstructionManagerId = x.ConstructionManagerId, ConstructionManagerName = db.Sys_User.First(u => u.UserId == x.ConstructionManagerId).UserName, @@ -203,7 +203,7 @@ namespace BLL db.Check_PauseNotice.InsertOnSubmit(newPauseNotice); db.SubmitChanges(); - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectPauseNoticeMenuId, newPauseNotice.ProjectId, newPauseNotice.UnitId, newPauseNotice.PauseNoticeId, newPauseNotice.CompileDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectPauseNoticeMenuId, newPauseNotice.ProjectId, newPauseNotice.UnitId, newPauseNotice.PauseNoticeId, newPauseNotice.CompileDate); //// 回写巡检记录表 if (!string.IsNullOrEmpty(newItem.HazardRegisterId)) { @@ -360,7 +360,7 @@ namespace BLL if (newItem.PauseStates == Const.State_0 || newItem.PauseStates == Const.State_1) { //// 通知单附件 - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.PauseNoticeAttachUrl, 10, null), newItem.PauseNoticeAttachUrl, Const.ProjectPauseNoticeMenuId, newPauseNotice.PauseNoticeId); + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(newItem.PauseNoticeAttachUrl, 10, null), newItem.PauseNoticeAttachUrl, Const.ProjectPauseNoticeMenuId, newPauseNotice.PauseNoticeId); } if (getUpdate != null && getUpdate.States == Const.State_2) { @@ -373,7 +373,7 @@ namespace BLL getcheck.CompletedDate = DateTime.Now; db.SubmitChanges(); //// 根据明细ID判断是否全部整改完成 并更新专项检查状态 - Check_CheckSpecialService.UpdateCheckSpecialStates(getcheck.CheckSpecialId); + Check_CheckSpecialService.UpdateCheckSpecialStatesForApi(getcheck.CheckSpecialId); } } } @@ -397,11 +397,11 @@ namespace BLL ////保存附件 if (!string.IsNullOrEmpty(attachUrl)) { - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, getPauseNotice.PauseNoticeId); + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, getPauseNotice.PauseNoticeId); } else { - CommonService.DeleteAttachFileById(menuId, getPauseNotice.PauseNoticeId); + CommonService.DeleteAttachFileByIdForApi(menuId, getPauseNotice.PauseNoticeId); } } } diff --git a/SGGL/BLL/API/HSSE/APIPunishNoticeService.cs b/SGGL/BLL/API/HSSE/APIPunishNoticeService.cs index 4694fd3b..8706cef7 100644 --- a/SGGL/BLL/API/HSSE/APIPunishNoticeService.cs +++ b/SGGL/BLL/API/HSSE/APIPunishNoticeService.cs @@ -220,7 +220,7 @@ namespace BLL newPunishNotice.PunishNoticeCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectPunishNoticeMenuId, newPunishNotice.ProjectId, newPunishNotice.UnitId); db.Check_PunishNotice.InsertOnSubmit(newPunishNotice); db.SubmitChanges(); - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectPunishNoticeMenuId, newPunishNotice.ProjectId, newPunishNotice.UnitId, newPunishNotice.PunishNoticeId, newPunishNotice.CompileDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectPunishNoticeMenuId, newPunishNotice.ProjectId, newPunishNotice.UnitId, newPunishNotice.PunishNoticeId, newPunishNotice.CompileDate); //// 回写巡检记录表 if (!string.IsNullOrEmpty(newItem.HazardRegisterId)) @@ -438,7 +438,7 @@ namespace BLL getcheck.CompletedDate = DateTime.Now; db.SubmitChanges(); //// 根据明细ID判断是否全部整改完成 并更新专项检查状态 - Check_CheckSpecialService.UpdateCheckSpecialStates(getcheck.CheckSpecialId); + Check_CheckSpecialService.UpdateCheckSpecialStatesForApi(getcheck.CheckSpecialId); } } } @@ -466,11 +466,11 @@ namespace BLL ////保存附件 if (!string.IsNullOrEmpty(attachUrl)) { - UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, getPunishNotice.PunishNoticeId); + UploadFileService.SaveAttachUrlForApi(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, getPunishNotice.PunishNoticeId); } else { - CommonService.DeleteAttachFileById(menuId, getPunishNotice.PunishNoticeId); + CommonService.DeleteAttachFileByIdForApi(menuId, getPunishNotice.PunishNoticeId); } } } diff --git a/SGGL/BLL/API/HSSE/APIReceiveFileManagerService.cs b/SGGL/BLL/API/HSSE/APIReceiveFileManagerService.cs index 190429a2..3698b564 100644 --- a/SGGL/BLL/API/HSSE/APIReceiveFileManagerService.cs +++ b/SGGL/BLL/API/HSSE/APIReceiveFileManagerService.cs @@ -41,7 +41,7 @@ namespace BLL SendPersonName = db.Sys_User.First(u => u.UserId == x.SendPersonId).UserName, MainContent = x.MainContent, UnitIds = x.UnitIds, - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds), FileAttachUrl = APIUpLoadFileService.getFileUrl(x.ReceiveFileManagerId, null), ReplyFileAttachUrl = APIUpLoadFileService.getFileUrl(x.ReceiveFileManagerId + "#1", null), Issue = (db.InformationProject_ReceiveFileManager.FirstOrDefault(y => y.FromId == x.ReceiveFileManagerId) == null) ? false : true, @@ -83,7 +83,7 @@ namespace BLL SendPersonName = db.Sys_User.First(u => u.UserId == x.SendPersonId).UserName, MainContent = x.MainContent, UnitIds = x.UnitIds, - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds), FileAttachUrl = APIUpLoadFileService.getFileUrl(x.ReceiveFileManagerId, null), ReplyFileAttachUrl = APIUpLoadFileService.getFileUrl(x.ReceiveFileManagerId + "#1", null), States = x.States, @@ -165,7 +165,7 @@ namespace BLL } if (newItem.States == "1") { - CommonService.btnSaveData(newItem.ProjectId, Const.ReceiveFileManagerMenuId, newReceiveFile.ReceiveFileManagerId, newReceiveFile.SendPersonId, true, newReceiveFile.ReceiveFileName, "../ReceiveFileManager/ReceiveFileManagerView.aspx?ReceiveFileManagerId={0}"); + CommonService.btnSaveDataForApi(newItem.ProjectId, Const.ReceiveFileManagerMenuId, newReceiveFile.ReceiveFileManagerId, newReceiveFile.SendPersonId, true, newReceiveFile.ReceiveFileName, "../ReceiveFileManager/ReceiveFileManagerView.aspx?ReceiveFileManagerId={0}"); } ////保存附件 diff --git a/SGGL/BLL/API/HSSE/APIRectifyNoticesService.cs b/SGGL/BLL/API/HSSE/APIRectifyNoticesService.cs index 4e31ccb8..84c602f8 100644 --- a/SGGL/BLL/API/HSSE/APIRectifyNoticesService.cs +++ b/SGGL/BLL/API/HSSE/APIRectifyNoticesService.cs @@ -216,7 +216,7 @@ namespace BLL newRectifyNotices.RectifyNoticesCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId); db.Check_RectifyNotices.InsertOnSubmit(newRectifyNotices); db.SubmitChanges(); - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId, newRectifyNotices.RectifyNoticesId, newRectifyNotices.CheckedDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectRectifyNoticesMenuId, newRectifyNotices.ProjectId, newRectifyNotices.UnitId, newRectifyNotices.RectifyNoticesId, newRectifyNotices.CheckedDate); //// 整改单附件 if (!string.IsNullOrEmpty(rectifyNotices.BeAttachUrl)) { @@ -307,7 +307,7 @@ namespace BLL { foreach (var cdeleteItem in deleteItem) { - CommonService.DeleteAttachFileById(cdeleteItem.RectifyNoticesItemId); + CommonService.DeleteAttachFileByIdForApi(cdeleteItem.RectifyNoticesItemId); } db.Check_RectifyNoticesItem.DeleteAllOnSubmit(deleteItem); } @@ -454,7 +454,7 @@ namespace BLL db.SubmitChanges(); } //// 根据明细ID判断是否全部整改完成 并更新专项检查状态 - Check_CheckSpecialService.UpdateCheckSpecialStates(getcheck.FirstOrDefault().CheckSpecialId); + Check_CheckSpecialService.UpdateCheckSpecialStatesForApi(getcheck.FirstOrDefault().CheckSpecialId); } } db.SubmitChanges(); diff --git a/SGGL/BLL/API/HSSE/APIResourcesService.cs b/SGGL/BLL/API/HSSE/APIResourcesService.cs index 1aab6df0..86297658 100644 --- a/SGGL/BLL/API/HSSE/APIResourcesService.cs +++ b/SGGL/BLL/API/HSSE/APIResourcesService.cs @@ -266,7 +266,7 @@ namespace BLL TestType = x.TestType, TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"), WorkPostIds = x.WorkPostIds, - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostIds), + WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostIds), AItem = x.AItem, BItem = x.BItem, CItem = x.CItem, diff --git a/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs b/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs index 317a5cd4..6a2f0e72 100644 --- a/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APIServerTestRecordService.cs @@ -81,9 +81,9 @@ namespace BLL newTestRecord.UnitId = newTestRecord.UnitId = Const.UnitId_CD; } } - newTestRecord.DepartName = DepartService.getDepartNameById(newTestRecord.DepartId); - newTestRecord.UnitName = UnitService.GetUnitNameByUnitId(newTestRecord.UnitId); - newTestRecord.ProjectName = ProjectService.GetProjectNameByProjectId(newTestRecord.ProjectId); + newTestRecord.DepartName = DepartService.getDepartNameByIdForApi(newTestRecord.DepartId); + newTestRecord.UnitName = UnitService.GetUnitNameByUnitIdForApi(newTestRecord.UnitId); + newTestRecord.ProjectName = ProjectService.GetProjectNameByProjectIdForApi(newTestRecord.ProjectId); if (newTestRecord.UnitId == Const.UnitId_CD) { newTestRecord.IsThiUnit = true; @@ -146,7 +146,7 @@ namespace BLL { newTestRecord.ManType = "2"; } - else if (UserService.GetUserByUserId(testRecord.TestManId) != null) + else if (db.Sys_User.FirstOrDefault(e => e.UserId == testRecord.TestManId) != null) { newTestRecord.ManType = "1"; } diff --git a/SGGL/BLL/API/HSSE/APITestPlanService.cs b/SGGL/BLL/API/HSSE/APITestPlanService.cs index 928eabf8..28cb76ee 100644 --- a/SGGL/BLL/API/HSSE/APITestPlanService.cs +++ b/SGGL/BLL/API/HSSE/APITestPlanService.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using EmitMapper; using EmitMapper.MappingConfiguration; +using Newtonsoft.Json.Linq; namespace BLL { @@ -36,7 +37,7 @@ namespace BLL TestPlanName = x.PlanName, ProjectId = x.ProjectId, DepartIds = x.DepartIds, - DepartNames = WorkPostService.getDepartNamesByIds(x.DepartIds), + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), TestPlanManId = x.PlanManId, TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName, TestPalce = x.TestPalce, @@ -60,7 +61,7 @@ namespace BLL ProjectId = x.ProjectId, TestPlanManId = x.PlanManId, DepartIds = x.DepartIds, - DepartNames = WorkPostService.getDepartNamesByIds(x.DepartIds), + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), TestPlanManName = db.Sys_User.First(y => y.UserId == x.PlanManId).UserName, TestPalce = x.TestPalce, TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime), @@ -105,11 +106,11 @@ namespace BLL QuestionCount = x.QuestionCount ?? 0, TestPalce = x.TestPalce, UnitIds = x.UnitIds, - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds), WorkPostIds = x.WorkPostIds, - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostIds), + WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostIds), DepartIds = x.DepartIds, - DepartNames = WorkPostService.getDepartNamesByIds(x.DepartIds), + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), States = x.States, QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'), TrainingPlanId = x.PlanId, @@ -203,7 +204,7 @@ namespace BLL db.Training_TestPlan.InsertOnSubmit(newTestPlan); db.SubmitChanges(); - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, newTestPlan.TestPlanId, newTestPlan.PlanDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, newTestPlan.TestPlanId, newTestPlan.PlanDate); } else { @@ -223,6 +224,9 @@ namespace BLL isUpdate.WorkPostIds = newTestPlan.WorkPostIds; isUpdate.DepartIds = newTestPlan.DepartIds; isUpdate.TrainTypeId = newTestPlan.TrainTypeId; + isUpdate.SValue = newTestPlan.SValue; + isUpdate.MValue = newTestPlan.MValue; + isUpdate.JValue = newTestPlan.JValue; ////删除 考生记录 var deleteRecords = from x in db.Training_TestRecord where x.TestPlanId == isUpdate.TestPlanId @@ -314,7 +318,7 @@ namespace BLL { foreach (var item in getTestPlan.TestPlanTrainingItems) { - var trainingType = TestTrainingService.GetTestTrainingById(item.TrainingTypeId); + var trainingType = db.Training_TestTraining.FirstOrDefault(e => e.TrainingId == item.TrainingTypeId); if (trainingType != null) { Model.Training_TestPlanTraining newPlanItem = new Model.Training_TestPlanTraining @@ -341,24 +345,27 @@ namespace BLL /// 新增 考试人员明细 /// public static void AddTrainingTestRecord(List testRecords, Model.Training_TestPlan newTestPlan) - { - foreach (var item in testRecords) { - var person = PersonService.GetPersonById(item.TestManId); - if (person != null) - { - Model.Training_TestRecord newTrainDetail = new Model.Training_TestRecord - { - TestRecordId = SQLHelper.GetNewID(), - ProjectId = newTestPlan.ProjectId, - TestPlanId = newTestPlan.TestPlanId, - TestManId = item.TestManId, - TestType = item.TestType, - Duration= newTestPlan.Duration, - }; - TestRecordService.AddTestRecord(newTrainDetail); - } - } + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + foreach (var item in testRecords) + { + var person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == item.TestManId); + if (person != null) + { + Model.Training_TestRecord newTrainDetail = new Model.Training_TestRecord + { + TestRecordId = SQLHelper.GetNewID(), + ProjectId = newTestPlan.ProjectId, + TestPlanId = newTestPlan.TestPlanId, + TestManId = item.TestManId, + TestType = item.TestType, + Duration = newTestPlan.Duration, + }; + TestRecordService.AddTestRecordForApi(newTrainDetail); + } + } + } } /// @@ -417,11 +424,11 @@ namespace BLL TestStartTime = DateTime.Now, TestPalce = getTrainingPlan.TeachAddress, UnitIds = getTrainingPlan.UnitIds, - UnitNames = UnitService.getUnitNamesUnitIds(getTrainingPlan.UnitIds), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(getTrainingPlan.UnitIds), WorkPostIds = getTrainingPlan.WorkPostId, - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(getTrainingPlan.WorkPostId), + WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(getTrainingPlan.WorkPostId), DepartIds=getTrainingPlan.DepartIds, - DepartNames = WorkPostService.getDepartNamesByIds(getTrainingPlan.DepartIds), + DepartNames = WorkPostService.getDepartNamesByIdsForApi(getTrainingPlan.DepartIds), PlanId = getTrainingPlan.PlanId, States = "0", }; @@ -477,7 +484,7 @@ namespace BLL { db.Training_TestPlan.InsertOnSubmit(newTestPlan); db.SubmitChanges(); - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, testPlanId, newTestPlan.PlanDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, testPlanId, newTestPlan.PlanDate); ///培训人员 var getTrainingTask = (from x in db.Training_Task where x.PlanId == trainingPlanId select x).ToList(); foreach (var itemTask in getTrainingTask) diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index adddf092..b6ec2c56 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -498,7 +498,7 @@ namespace BLL } if (!string.IsNullOrEmpty(strPass)) { - int PassingScore = SysConstSetService.getPassScore(); + int PassingScore = SysConstSetService.getPassScoreForApi(); if (strPass == "0") { getDataLists = getDataLists.Where(x => x.TestScores < PassingScore); @@ -556,7 +556,7 @@ namespace BLL } if (!string.IsNullOrEmpty(strPass)) { - int PassingScore = SysConstSetService.getPassScore(); + int PassingScore = SysConstSetService.getPassScoreForApi(); if (strPass == "0") { getDataLists = getDataLists.Where(x => x.TestScores < PassingScore); @@ -592,14 +592,14 @@ namespace BLL var user = db.Sys_User.FirstOrDefault(x => x.UserId == testManId); if (user != null) { - name = UnitService.GetUnitNameByUnitId(user.UnitId); + name = UnitService.GetUnitNameByUnitIdForApi(user.UnitId); } else { var getPerson = db.SitePerson_Person.FirstOrDefault(x => x.PersonId == testManId); if (getPerson != null) { - name = UnitService.GetUnitNameByUnitId(getPerson.UnitId); + name = UnitService.GetUnitNameByUnitIdForApi(getPerson.UnitId); } } return name; diff --git a/SGGL/BLL/API/HSSE/APITrainRecordService.cs b/SGGL/BLL/API/HSSE/APITrainRecordService.cs index 6d47f75f..2579f7e1 100644 --- a/SGGL/BLL/API/HSSE/APITrainRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITrainRecordService.cs @@ -71,8 +71,8 @@ namespace BLL WorkPostIds = x.WorkPostIds, TrainContent = x.TrainContent, AttachUrl = db.AttachFile.First(y => y.ToKeyId == x.TrainingId).AttachUrl.Replace('\\', '/'), - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostIds), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds), + WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostIds), }; return getDataLists.FirstOrDefault(); } @@ -117,7 +117,7 @@ namespace BLL WorkPostIds = getTrainingPlan.WorkPostId, PlanId = getTrainingPlan.PlanId, }; - newTrainRecord.CompileMan = UserService.GetUserNameByUserId(getTrainingPlan.DesignerId); + newTrainRecord.CompileMan = UserService.GetUserNameByUserIdForApi(getTrainingPlan.DesignerId); ///获取培训人员 var getTrainingTasks = from x in db.Training_Task where x.PlanId == getTrainingPlan.PlanId @@ -171,15 +171,15 @@ namespace BLL var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == newDetail.PersonId); if (getPerson != null && string.IsNullOrEmpty(getPerson.CardNo)) { - getPerson.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getPerson.ProjectId, UnitService.GetUnitCodeByUnitId(getPerson.UnitId)); + getPerson.CardNo = SQLHelper.RunProcNewId("SpGetNewNumber", "SitePerson_Person", "CardNo", getPerson.ProjectId, UnitService.GetUnitCodeByUnitIdForApi(getPerson.UnitId)); db.SubmitChanges(); } } } ////增加一条编码记录 - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainRecordMenuId, newTrainRecord.ProjectId, null, newTrainRecord.TrainingId, newTrainRecord.TrainStartDate); - CommonService.btnSaveData(newTrainRecord.ProjectId, Const.ProjectTrainRecordMenuId, newTrainRecord.TrainingId, getTrainingPlan.DesignerId, true, newTrainRecord.TrainTitle, "../EduTrain/TrainRecordView.aspx?TrainingId={0}"); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTrainRecordMenuId, newTrainRecord.ProjectId, null, newTrainRecord.TrainingId, newTrainRecord.TrainStartDate); + CommonService.btnSaveDataForApi(newTrainRecord.ProjectId, Const.ProjectTrainRecordMenuId, newTrainRecord.TrainingId, getTrainingPlan.DesignerId, true, newTrainRecord.TrainTitle, "../EduTrain/TrainRecordView.aspx?TrainingId={0}"); } } } diff --git a/SGGL/BLL/API/HSSE/APITrainingPlanService.cs b/SGGL/BLL/API/HSSE/APITrainingPlanService.cs index badaaef9..f0d4fdba 100644 --- a/SGGL/BLL/API/HSSE/APITrainingPlanService.cs +++ b/SGGL/BLL/API/HSSE/APITrainingPlanService.cs @@ -77,10 +77,10 @@ namespace BLL UnitIds = x.UnitIds, WorkPostId = x.WorkPostId, DepartIds = x.DepartIds, - DepartNames = WorkPostService.getDepartNamesByIds(x.DepartIds), + DepartNames = WorkPostService.getDepartNamesByIdsForApi(x.DepartIds), TrainContent = x.TrainContent, - UnitNames = UnitService.getUnitNamesUnitIds(x.UnitIds), - WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIds(x.WorkPostId), + UnitNames = UnitService.getUnitNamesUnitIdsForApi(x.UnitIds), + WorkPostNames = WorkPostService.getWorkPostNamesWorkPostIdsForApi(x.WorkPostId), DesignerId = x.DesignerId, DesignerName = db.Sys_User.First(y => y.UserId == x.DesignerId).UserName, DesignerDate = string.Format("{0:yyyy-MM-dd HH:mm}", x.TrainStartDate), @@ -177,7 +177,7 @@ namespace BLL { newTrainingPlan.DesignerDate = DateTime.Now; string unitId = string.Empty; - var user = UserService.GetUserByUserId(newTrainingPlan.DesignerId); + var user = db.Sys_User.FirstOrDefault(x=>x.UserId==newTrainingPlan.DesignerId); if (user != null) { unitId = user.UnitId; @@ -190,7 +190,7 @@ namespace BLL db.Training_Plan.InsertOnSubmit(newTrainingPlan); db.SubmitChanges(); - CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTrainingPlanMenuId, newTrainingPlan.ProjectId, null, newTrainingPlan.PlanId, newTrainingPlan.DesignerDate); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectTrainingPlanMenuId, newTrainingPlan.ProjectId, null, newTrainingPlan.PlanId, newTrainingPlan.DesignerDate); } else { diff --git a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs index 948e4d75..47d0f578 100644 --- a/SGGL/BLL/API/HSSE/APITrainingTaskService.cs +++ b/SGGL/BLL/API/HSSE/APITrainingTaskService.cs @@ -18,7 +18,7 @@ namespace BLL { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { - personId = PersonService.GetPersonIdByUserId(personId); + personId = PersonService.GetPersonIdByUserIdForApi(personId); var getDataLists = (from x in db.Training_Task join y in db.Training_Plan on x.PlanId equals y.PlanId where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.UserId == personId && y.States != "0" diff --git a/SGGL/BLL/BaseInfo/WorkPostService.cs b/SGGL/BLL/BaseInfo/WorkPostService.cs index 47d5f42c..3c8e45a8 100644 --- a/SGGL/BLL/BaseInfo/WorkPostService.cs +++ b/SGGL/BLL/BaseInfo/WorkPostService.cs @@ -259,14 +259,39 @@ namespace BLL return workPostName; } - #endregion - #region 根据岗位ID得到岗位名称 - /// - /// 根据岗位ID得到岗位名称 - /// - /// - /// - public static string getDepartNameById(string workPostId) + public static string getWorkPostNamesWorkPostIdsForApi(object workPostIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string workPostName = string.Empty; + if (workPostIds != null) + { + string[] ids = workPostIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_WorkPost.FirstOrDefault(e => e.WorkPostId == id); + if (q != null) + { + workPostName += q.WorkPostName + ","; + } + } + if (workPostName != string.Empty) + { + workPostName = workPostName.Substring(0, workPostName.Length - 1); ; + } + } + + return workPostName; + } + } + #endregion + #region 根据岗位ID得到岗位名称 + /// + /// 根据岗位ID得到岗位名称 + /// + /// + /// + public static string getDepartNameById(string workPostId) { string workPostName = string.Empty; if (!string.IsNullOrEmpty(workPostId)) @@ -313,6 +338,31 @@ namespace BLL return departName; } - #endregion - } + public static string getDepartNamesByIdsForApi(object departIdsIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string departName = string.Empty; + if (departIdsIds != null) + { + string[] ids = departIdsIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_Depart.FirstOrDefault(e => e.DepartId == id); + if (q != null) + { + departName += q.DepartName + ","; + } + } + if (departName != string.Empty) + { + departName = departName.Substring(0, departName.Length - 1); ; + } + } + + return departName; + } + } + #endregion + } } \ No newline at end of file diff --git a/SGGL/BLL/BaseInfo/WorkStageService.cs b/SGGL/BLL/BaseInfo/WorkStageService.cs index cce824db..073fc2e3 100644 --- a/SGGL/BLL/BaseInfo/WorkStageService.cs +++ b/SGGL/BLL/BaseInfo/WorkStageService.cs @@ -134,5 +134,30 @@ namespace BLL return workStageName; } - } + public static string getWorkStageNamesWorkStageIdsForApi(object workStageIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string workStageName = string.Empty; + if (workStageIds != null) + { + string[] workStages = workStageIds.ToString().Split(','); + foreach (string workStageId in workStages) + { + var q =db.Base_WorkStage.FirstOrDefault(e => e.WorkStageId == workStageId); + if (q != null) + { + workStageName += q.WorkStageName + ","; + } + } + if (workStageName != string.Empty) + { + workStageName = workStageName.Substring(0, workStageName.Length - 1); ; + } + } + + return workStageName; + } + } + } } \ No newline at end of file diff --git a/SGGL/BLL/CQMS/Solution/CQMSConstructSolutionService.cs b/SGGL/BLL/CQMS/Solution/CQMSConstructSolutionService.cs index 8300eeed..6394e141 100644 --- a/SGGL/BLL/CQMS/Solution/CQMSConstructSolutionService.cs +++ b/SGGL/BLL/CQMS/Solution/CQMSConstructSolutionService.cs @@ -30,18 +30,20 @@ namespace BLL return result; } - /// - /// 根据方案审查Id删除一个方案审查信息 - /// - /// 方案审查Id - public static void DeleteConstructSolution(string constructSolutionId) - { - Model.SGGLDB db = Funs.DB; - Model.Solution_CQMSConstructSolution constructSolution = db.Solution_CQMSConstructSolution.First(e => e.ConstructSolutionId == constructSolutionId); - - db.Solution_CQMSConstructSolution.DeleteOnSubmit(constructSolution); - db.SubmitChanges(); - } + /// + /// 根据方案审查Id删除一个方案审查信息 + /// + /// 方案审查Id + public static void DeleteConstructSolution(string constructSolutionId) + { + Model.SGGLDB db = Funs.DB; + Model.Solution_CQMSConstructSolution constructSolution = db.Solution_CQMSConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolutionId); + if (constructSolution != null) + { + db.Solution_CQMSConstructSolution.DeleteOnSubmit(constructSolution); + db.SubmitChanges(); + } + } /// /// 增加方案审查信息 diff --git a/SGGL/BLL/Common/CodeRecordsService.cs b/SGGL/BLL/Common/CodeRecordsService.cs index 0d6b33a6..1e112e2d 100644 --- a/SGGL/BLL/Common/CodeRecordsService.cs +++ b/SGGL/BLL/Common/CodeRecordsService.cs @@ -1,4 +1,5 @@ -using System; +using Model; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -43,114 +44,127 @@ namespace BLL // BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId); Funs.DB.Sys_CodeRecords.DeleteOnSubmit(codeRecords); } - } - - #region 根据菜单id、项目id返回编码 (用于页面新增显示) - /// - /// 根据菜单id、项目id返回编码 (用于页面新增显示) - /// - /// - /// - /// - public static string ReturnCodeByMenuIdProjectId(string menuId, string projectId, string unitId) - { - using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) - { - string code = string.Empty; - string ruleCodes = string.Empty; - int digit = 4; - string symbol = "-"; ///间隔符 - var codeRecords = (from x in db.Sys_CodeRecords where x.MenuId == menuId && x.ProjectId == projectId orderby x.CompileDate descending select x).FirstOrDefault(); - if (codeRecords != null && !string.IsNullOrEmpty(codeRecords.RuleCodes)) - { - ruleCodes = codeRecords.RuleCodes; - if (codeRecords.Digit.HasValue) - { - digit = codeRecords.Digit.Value; - } - } - else - { - ////项目 - string ruleCode = string.Empty; - var project = ProjectService.GetProjectByProjectId(projectId); - if (project != null) - { - string projectCode = project.ProjectCode; ///项目编号 - ////编码规则表 - var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId); - if (sysCodeTemplateRule != null) - { - symbol = sysCodeTemplateRule.Symbol; - if (sysCodeTemplateRule.Digit.HasValue) - { - digit = sysCodeTemplateRule.Digit.Value; - } - if (sysCodeTemplateRule.IsProjectCode == true) - { - ruleCode = projectCode + symbol; - } - if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix)) - { - ruleCode += sysCodeTemplateRule.Prefix + symbol; - } - if (sysCodeTemplateRule.IsUnitCode == true) - { - var unit = UnitService.GetUnitByUnitId(unitId); - if (unit != null) - { - ruleCode += unit.UnitCode + symbol; - } - } - ruleCodes = ruleCode; - } - } - else - { - var codeTempRule = db.Sys_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId); - if (codeTempRule != null && !string.IsNullOrEmpty(codeTempRule.Prefix)) - { - if (!string.IsNullOrEmpty(codeTempRule.Symbol)) - { - symbol = codeTempRule.Symbol; - } - ruleCodes = codeTempRule.Prefix + symbol; - if (codeTempRule.Digit.HasValue) - { - digit = codeTempRule.Digit.Value; - } - } - } - } - - ////获取编码记录表最大排列序号 - int maxNewSortIndex = 0; - var maxSortIndex = db.Sys_CodeRecords.Where(x => (x.ProjectId == projectId || projectId == null) && x.MenuId == menuId).Select(x => x.SortIndex).Max(); - - if (maxSortIndex.HasValue) - { - maxNewSortIndex = maxSortIndex.Value; - } - maxNewSortIndex = maxNewSortIndex + 1; - code = (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零 - if (!string.IsNullOrEmpty(ruleCodes)) - { - code = ruleCodes + code; - } - - return code; } - } - #endregion + public static void DeleteCodeRecordsByDataIdForApi(string dataId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var codeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId); + if (codeRecords != null) + { + ///删除文件柜A中数据 + // BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId); + db.Sys_CodeRecords.DeleteOnSubmit(codeRecords); + } + } + } - #region 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码) - /// - /// 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码) - /// - /// - /// - /// - public static string InsertCodeRecordsByMenuIdProjectIdUnitId(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate) + #region 根据菜单id、项目id返回编码 (用于页面新增显示) + /// + /// 根据菜单id、项目id返回编码 (用于页面新增显示) + /// + /// + /// + /// + public static string ReturnCodeByMenuIdProjectId(string menuId, string projectId, string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string code = string.Empty; + string ruleCodes = string.Empty; + int digit = 4; + string symbol = "-"; ///间隔符 + var codeRecords = (from x in db.Sys_CodeRecords where x.MenuId == menuId && x.ProjectId == projectId orderby x.CompileDate descending select x).FirstOrDefault(); + if (codeRecords != null && !string.IsNullOrEmpty(codeRecords.RuleCodes)) + { + ruleCodes = codeRecords.RuleCodes; + if (codeRecords.Digit.HasValue) + { + digit = codeRecords.Digit.Value; + } + } + else + { + ////项目 + string ruleCode = string.Empty; + var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId) ; + if (project != null) + { + string projectCode = project.ProjectCode; ///项目编号 + ////编码规则表 + var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId); + if (sysCodeTemplateRule != null) + { + symbol = sysCodeTemplateRule.Symbol; + if (sysCodeTemplateRule.Digit.HasValue) + { + digit = sysCodeTemplateRule.Digit.Value; + } + if (sysCodeTemplateRule.IsProjectCode == true) + { + ruleCode = projectCode + symbol; + } + if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix)) + { + ruleCode += sysCodeTemplateRule.Prefix + symbol; + } + if (sysCodeTemplateRule.IsUnitCode == true) + { + var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId); + if (unit != null) + { + ruleCode += unit.UnitCode + symbol; + } + } + ruleCodes = ruleCode; + } + } + else + { + var codeTempRule = db.Sys_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId); + if (codeTempRule != null && !string.IsNullOrEmpty(codeTempRule.Prefix)) + { + if (!string.IsNullOrEmpty(codeTempRule.Symbol)) + { + symbol = codeTempRule.Symbol; + } + ruleCodes = codeTempRule.Prefix + symbol; + if (codeTempRule.Digit.HasValue) + { + digit = codeTempRule.Digit.Value; + } + } + } + } + + ////获取编码记录表最大排列序号 + int maxNewSortIndex = 0; + var maxSortIndex = db.Sys_CodeRecords.Where(x => (x.ProjectId == projectId || projectId == null) && x.MenuId == menuId).Select(x => x.SortIndex).Max(); + + if (maxSortIndex.HasValue) + { + maxNewSortIndex = maxSortIndex.Value; + } + maxNewSortIndex = maxNewSortIndex + 1; + code = (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零 + if (!string.IsNullOrEmpty(ruleCodes)) + { + code = ruleCodes + code; + } + + return code; + } + } + #endregion + + #region 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码) + /// + /// 根据菜单id、项目id插入一条编码记录(数据新增到数据库 生成编码) + /// + /// + /// + /// + public static string InsertCodeRecordsByMenuIdProjectIdUnitId(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate) { string ruleCode = string.Empty; var IsHaveCodeRecords = Funs.DB.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId); @@ -276,16 +290,148 @@ namespace BLL return ruleCode; } - #endregion - #region 根据菜单id,项目id 更新编码记录(当编码规则改变的时候 更新编码) - /// - /// 根据菜单id 更新编码记录(当编码规则改变的时候 更新编码) - /// - /// - /// - /// - public static void UpdateCodeRecordsByMenuIdProjectId(string menuId, string projectId) + + public static string InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string ruleCode = string.Empty; + var IsHaveCodeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId); + if (IsHaveCodeRecords == null) ///是否已存在编码 + { + string ruleCodeower = string.Empty; + int digit = 4; ///流水位数 + string symbolower = "-"; ///业主间隔符 + int digitower = 4; ///业主流水位数 + string symbol = "-"; ///间隔符 + var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); ////项目 + if (project != null && !string.IsNullOrEmpty(dataId)) + { + string projectCode = project.ProjectCode; ///项目编号 + ////编码规则表 + var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId); + if (sysCodeTemplateRule != null) + { + symbol = sysCodeTemplateRule.Symbol; + symbolower = sysCodeTemplateRule.OwerSymbol; + + if (sysCodeTemplateRule.Digit.HasValue) + { + digit = sysCodeTemplateRule.Digit.Value; + } + if (sysCodeTemplateRule.OwerDigit.HasValue) + { + digitower = sysCodeTemplateRule.OwerDigit.Value; + } + if (sysCodeTemplateRule.IsProjectCode == true) + { + ruleCode = projectCode + symbol; + } + if (sysCodeTemplateRule.OwerIsProjectCode == true) + { + ruleCodeower = projectCode + symbolower; + } + if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix)) + { + ruleCode += sysCodeTemplateRule.Prefix + symbol; + } + if (!string.IsNullOrEmpty(sysCodeTemplateRule.OwerPrefix)) + { + ruleCodeower += sysCodeTemplateRule.OwerPrefix + symbolower; + } + if (sysCodeTemplateRule.IsUnitCode == true || sysCodeTemplateRule.OwerIsUnitCode == true) + { + var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId); + if (unit != null) + { + if (sysCodeTemplateRule.IsUnitCode == true) + { ruleCode = unit.UnitCode + symbol; } + + if (sysCodeTemplateRule.OwerIsUnitCode == true) + { + ruleCodeower = unit.UnitCode + symbolower; + } + } + } + } + } + + ////获取编码记录表最大排列序号 + int maxNewSortIndex = 0; + if (!String.IsNullOrEmpty(projectId)) + { + var maxSortIndex = db.Sys_CodeRecords.Where(x => x.ProjectId == projectId && x.MenuId == menuId).Select(x => x.SortIndex).Max(); + if (maxSortIndex.HasValue) + { + maxNewSortIndex = maxSortIndex.Value; + } + } + else + { + var maxSortIndexNull = db.Sys_CodeRecords.Where(x => x.MenuId == menuId).Select(x => x.SortIndex).Max(); + if (maxSortIndexNull.HasValue) + { + maxNewSortIndex = maxSortIndexNull.Value; + } + } + maxNewSortIndex = maxNewSortIndex + 1; + ////插入数据库 + Model.Sys_CodeRecords newCodeRecords = new Model.Sys_CodeRecords + { + CodeRecordId = SQLHelper.GetNewID(typeof(Model.Sys_CodeRecords)) + }; + if (project != null) + { + newCodeRecords.ProjectId = project.ProjectId; + } + newCodeRecords.MenuId = menuId; + newCodeRecords.DataId = dataId; + newCodeRecords.UnitId = unitId; + newCodeRecords.SortIndex = maxNewSortIndex; + newCodeRecords.CompileDate = compileDate; + newCodeRecords.RuleCodes = ruleCode; + newCodeRecords.Digit = digit; + newCodeRecords.OwnerRuleCodes = ruleCodeower; + newCodeRecords.OwerDigit = digitower; + if (!string.IsNullOrEmpty(ruleCode)) + { + newCodeRecords.Code = ruleCode + (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零 编码 + } + else + { + newCodeRecords.Code = (maxNewSortIndex.ToString().PadLeft(digit, '0')); + } + if (!string.IsNullOrEmpty(ruleCodeower)) + { + newCodeRecords.OwnerCode = ruleCodeower + (maxNewSortIndex.ToString().PadLeft(digitower, '0')); ///字符自动补零 业主编码 + } + else + { + newCodeRecords.OwnerCode = (maxNewSortIndex.ToString().PadLeft(digitower, '0')); + } + db.Sys_CodeRecords.InsertOnSubmit(newCodeRecords); + db.SubmitChanges(); + } + else + { + ruleCode = IsHaveCodeRecords.Code; + } + + return ruleCode; + } + } + + #endregion + + #region 根据菜单id,项目id 更新编码记录(当编码规则改变的时候 更新编码) + /// + /// 根据菜单id 更新编码记录(当编码规则改变的时候 更新编码) + /// + /// + /// + /// + public static void UpdateCodeRecordsByMenuIdProjectId(string menuId, string projectId) { var codeRecords = from x in Funs.DB.Sys_CodeRecords where x.MenuId == menuId && x.ProjectId == projectId select x; if (codeRecords.Count() > 0) diff --git a/SGGL/BLL/Common/CommonService.cs b/SGGL/BLL/Common/CommonService.cs index aa74639c..34b81589 100644 --- a/SGGL/BLL/Common/CommonService.cs +++ b/SGGL/BLL/Common/CommonService.cs @@ -1,4 +1,5 @@ using BLL.CNCECHSSEService; +using Model; using System; using System.Collections.Generic; using System.IO; @@ -501,12 +502,28 @@ namespace BLL Funs.DB.SubmitChanges(); } } + public static void DeleteAttachFileByIdForApi(string id) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.ToKeyId == id); + if (attachFile != null) + { + if (!string.IsNullOrEmpty(attachFile.AttachUrl)) + { + UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl); + } - /// - ///根据主键删除附件 - /// - /// - public static void DeleteAttachFileById(string menuId, string id) + db.AttachFile.DeleteOnSubmit(attachFile); + db.SubmitChanges(); + } + } + } + /// + ///根据主键删除附件 + /// + /// + public static void DeleteAttachFileById(string menuId, string id) { Model.SGGLDB db = Funs.DB; Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.MenuId == menuId && e.ToKeyId == id); @@ -520,15 +537,32 @@ namespace BLL db.AttachFile.DeleteOnSubmit(attachFile); db.SubmitChanges(); } - } - #endregion + } + public static void DeleteAttachFileByIdForApi(string menuId, string id) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.MenuId == menuId && e.ToKeyId == id); + if (attachFile != null) + { + if (!string.IsNullOrEmpty(attachFile.AttachUrl)) + { + BLL.UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl); + } - #region 根据主键删除流程 - /// - ///根据主键删除流程 - /// - /// - public static void DeleteFlowOperateByID(string id) + db.AttachFile.DeleteOnSubmit(attachFile); + db.SubmitChanges(); + } + } + } + #endregion + + #region 根据主键删除流程 + /// + ///根据主键删除流程 + /// + /// + public static void DeleteFlowOperateByID(string id) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -628,15 +662,95 @@ namespace BLL } } } - #endregion + public static void btnSaveDataForApi(string projectId, string menuId, string dataId, string userId, bool isClosed, string content, string url) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Sys_FlowOperate newFlowOperate = new Model.Sys_FlowOperate + { + MenuId = menuId, + DataId = dataId, + OperaterId = userId, + State = Const.State_2, + IsClosed = isClosed, + Opinion = "系统自动关闭流程", + ProjectId = projectId, + Url = url + }; + var user = db.Sys_User.FirstOrDefault(e => e.UserId == newFlowOperate.OperaterId); + if (user != null) + { + var roles = RoleService.GetRoleByRoleId(user.RoleId); + if (roles != null && !string.IsNullOrEmpty(roles.RoleName)) + { + newFlowOperate.AuditFlowName = "[" + roles.RoleName + "]"; + } + else + { + newFlowOperate.AuditFlowName = "[" + user.UserName + "]"; + } - #region 接收http post请求 - /// 接收http post请求 - /// - /// 地址 - /// 查询参数集合 - /// - public static string CreateGetHttpResponse(string url) + newFlowOperate.AuditFlowName += "系统审核完成"; + } + + var updateFlowOperate = from x in db.Sys_FlowOperate + where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue) + select x; + if (updateFlowOperate.Count() > 0) + { + foreach (var item in updateFlowOperate) + { + item.OperaterId = newFlowOperate.OperaterId; + item.OperaterTime = System.DateTime.Now; + item.State = newFlowOperate.State; + item.Opinion = newFlowOperate.Opinion; + item.AuditFlowName = "系统审核完成"; + item.IsClosed = newFlowOperate.IsClosed; + db.SubmitChanges(); + } + } + else + { + int maxSortIndex = 1; + var flowSet = db.Sys_FlowOperate.Where(x => x.DataId == newFlowOperate.DataId); + var sortIndex = flowSet.Select(x => x.SortIndex).Max(); + if (sortIndex.HasValue) + { + maxSortIndex = sortIndex.Value + 1; + } + newFlowOperate.FlowOperateId = SQLHelper.GetNewID(typeof(Model.Sys_FlowOperate)); + newFlowOperate.SortIndex = maxSortIndex; + newFlowOperate.OperaterTime = System.DateTime.Now; + newFlowOperate.AuditFlowName = "系统审核完成"; + db.Sys_FlowOperate.InsertOnSubmit(newFlowOperate); + db.SubmitChanges(); + } + + if (newFlowOperate.IsClosed == true) + { + var updateNoClosedFlowOperate = from x in Funs.DB.Sys_FlowOperate + where x.DataId == newFlowOperate.DataId && (x.IsClosed == false || !x.IsClosed.HasValue) + select x; + if (updateNoClosedFlowOperate.Count() > 0) + { + foreach (var itemClosed in updateNoClosedFlowOperate) + { + itemClosed.IsClosed = true; + db.SubmitChanges(); + } + } + } + } + } + #endregion + + #region 接收http post请求 + /// 接收http post请求 + /// + /// 地址 + /// 查询参数集合 + /// + public static string CreateGetHttpResponse(string url) { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls; diff --git a/SGGL/BLL/Common/UploadFileService.cs b/SGGL/BLL/Common/UploadFileService.cs index e172a016..fee2f6b0 100644 --- a/SGGL/BLL/Common/UploadFileService.cs +++ b/SGGL/BLL/Common/UploadFileService.cs @@ -350,13 +350,62 @@ namespace BLL } } } + public static void SaveAttachUrlForApi(string source, string attachUrl, string menuId, string toKeyId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string rootUrl = ConfigurationManager.AppSettings["localRoot"]; + if (string.IsNullOrEmpty(rootUrl)) + { + rootUrl = Funs.RootPath; + } - /// - /// 通过附件路径得到Source - /// - /// - /// - public static string GetSourceByAttachUrl(string attachUrl, int size, string oldSrouce) + List sour = (from x in db.AttachFile + where x.MenuId == menuId && x.ToKeyId == toKeyId + select x).ToList(); + if (sour.Count() == 0) + { + Model.AttachFile att = new Model.AttachFile + { + AttachFileId = SQLHelper.GetNewID(), + ToKeyId = toKeyId, + AttachSource = source.ToString(), + AttachUrl = attachUrl, + MenuId = menuId, + // ImageByte= imageByte, + //AttachPath= attachPath, + }; + if (menuId == BLL.Const.PersonListMenuId) + { + att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]); + } + db.AttachFile.InsertOnSubmit(att); + db.SubmitChanges(); + } + else + { + Model.AttachFile att = db.AttachFile.FirstOrDefault(x => x.MenuId == menuId && x.AttachFileId == sour.First().AttachFileId); + if (att != null) + { + att.ToKeyId = toKeyId; + att.AttachSource = source.ToString(); + att.AttachUrl = attachUrl; + att.MenuId = menuId; + if (menuId == BLL.Const.PersonListMenuId) + { + att.ImageByte = AttachFileService.SetImageToByteArray(rootUrl + attachUrl.Split(',')[0]); + } + db.SubmitChanges(); + } + } + } + } + /// + /// 通过附件路径得到Source + /// + /// + /// + public static string GetSourceByAttachUrl(string attachUrl, int size, string oldSrouce) { string attachSource = string.Empty; if (!string.IsNullOrEmpty(attachUrl)) diff --git a/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs b/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs index 41a8c996..937d6a8f 100644 --- a/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs +++ b/SGGL/BLL/HJGL/PointTrust/Batch_BatchTrustItemService.cs @@ -1,150 +1,179 @@ -using System; +using Model; +using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { - /// - /// 无损委托明细 - /// - public static class Batch_BatchTrustItemService - { - /// - /// 根据主键获取无损委托明细 - /// - /// - /// - public static Model.HJGL_Batch_BatchTrustItem GetBatchTrustItemById(string trustBatchItemId) - { - Model.SGGLDB db = Funs.DB; - return db.HJGL_Batch_BatchTrustItem.FirstOrDefault(e => e.TrustBatchItemId == trustBatchItemId); - } - - /// - /// 根据无损委托Id获取相关明细信息 - /// - /// - /// - public static List GetBatchTrustItemByTrustBatchId(string trustBatchId) - { - Model.SGGLDB db = Funs.DB; - return (from x in db.HJGL_Batch_BatchTrustItem where x.TrustBatchId == trustBatchId select x).ToList(); - } - - /// - /// 添加无损委托明细 - /// - /// - public static void AddBatchTrustItem(Model.HJGL_Batch_BatchTrustItem batchTrustItem) - { - Model.SGGLDB db = Funs.DB; - Model.HJGL_Batch_BatchTrustItem newTrustBatchItem = new Model.HJGL_Batch_BatchTrustItem + /// + /// 无损委托明细 + /// + public static class Batch_BatchTrustItemService + { + /// + /// 根据主键获取无损委托明细 + /// + /// + /// + public static Model.HJGL_Batch_BatchTrustItem GetBatchTrustItemById(string trustBatchItemId) { - TrustBatchItemId = batchTrustItem.TrustBatchItemId, - TrustBatchId = batchTrustItem.TrustBatchId, - PointBatchItemId = batchTrustItem.PointBatchItemId, - RepairRecordId = batchTrustItem.RepairRecordId, - WeldJointId = batchTrustItem.WeldJointId, - CreateDate = batchTrustItem.CreateDate, - RepairNum = batchTrustItem.RepairNum, - }; - db.HJGL_Batch_BatchTrustItem.InsertOnSubmit(newTrustBatchItem); - db.SubmitChanges(); - UpdateTrustNum(batchTrustItem.TrustBatchItemId, 1); - - } - - - /// - /// 修改无损委托 - /// - /// - public static void UpdateBatchTrustItem(Model.HJGL_Batch_BatchTrustItem batchTrustItem) - { - Model.SGGLDB db = Funs.DB; - Model.HJGL_Batch_BatchTrustItem newBatchTrustItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(e => e.TrustBatchItemId == batchTrustItem.TrustBatchItemId); - if (newBatchTrustItem != null) - { - newBatchTrustItem.PointBatchItemId = batchTrustItem.PointBatchItemId; - newBatchTrustItem.WeldJointId = batchTrustItem.WeldJointId; - newBatchTrustItem.CreateDate = batchTrustItem.CreateDate; - newBatchTrustItem.RepairNum = batchTrustItem.RepairNum; - db.SubmitChanges(); - } - } - - - /// - /// 根据无损委托Id获取相关明细视图信息 - /// - /// - /// - /// - public static List GetViewBatchTrustItem(string trustBatchId) - { - Model.SGGLDB db = Funs.DB; - return (from x in db.View_Batch_BatchTrustItem where x.TrustBatchId == trustBatchId select x).ToList(); - } - - - /// - /// 根据Id删除明细信息 - /// - /// - public static void DeleteTrustItemByTrustBatchItemId(string trustBatchItemId) - { - Model.SGGLDB db = Funs.DB; - Model.HJGL_Batch_BatchTrustItem trustItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(e => e.TrustBatchItemId == trustBatchItemId); - if (trustItem != null) - { - UpdateTrustNum(trustBatchItemId, -1); - db.HJGL_Batch_BatchTrustItem.DeleteOnSubmit(trustItem); - db.SubmitChanges(); - - } - } - - /// - /// 更新委托次数 - /// - /// 委托批明细ID - /// - public static void UpdateTrustNum(string trustBatchItemId, int num) - { - Model.SGGLDB db = Funs.DB; - var trustBatchItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(x => x.TrustBatchItemId == trustBatchItemId); - if (trustBatchItem != null) - { - trustBatchItem.TrustNum = trustBatchItem.TrustNum ?? 0 + num; - if (trustBatchItem.TrustNum < 0) - { - trustBatchItem.TrustNum = 0; - } - } - db.SubmitChanges(); - } - - #region 是否满足生成委托条件 - /// - /// 是否满足生成委托条件 - /// - /// - public static bool GetIsGenerateTrust(string pointBatchItemId) - { - bool isShow = true; - var trustBatchItem = Funs.DB.HJGL_Batch_BatchTrustItem.FirstOrDefault(x => x.PointBatchItemId == pointBatchItemId); - if (trustBatchItem != null) - { - var checkItem = Funs.DB.HJGL_Batch_NDEItem.FirstOrDefault(x => x.TrustBatchItemId == trustBatchItem.TrustBatchItemId && x.CheckResult == "1"); - if (checkItem != null) - { - isShow = false; - } + Model.SGGLDB db = Funs.DB; + return db.HJGL_Batch_BatchTrustItem.FirstOrDefault(e => e.TrustBatchItemId == trustBatchItemId); } - return isShow; - } - #endregion - } + /// + /// 根据无损委托Id获取相关明细信息 + /// + /// + /// + public static List GetBatchTrustItemByTrustBatchId(string trustBatchId) + { + Model.SGGLDB db = Funs.DB; + return (from x in db.HJGL_Batch_BatchTrustItem where x.TrustBatchId == trustBatchId select x).ToList(); + } + + /// + /// 添加无损委托明细 + /// + /// + public static void AddBatchTrustItem(Model.HJGL_Batch_BatchTrustItem batchTrustItem) + { + Model.SGGLDB db = Funs.DB; + Model.HJGL_Batch_BatchTrustItem newTrustBatchItem = new Model.HJGL_Batch_BatchTrustItem + { + TrustBatchItemId = batchTrustItem.TrustBatchItemId, + TrustBatchId = batchTrustItem.TrustBatchId, + PointBatchItemId = batchTrustItem.PointBatchItemId, + RepairRecordId = batchTrustItem.RepairRecordId, + WeldJointId = batchTrustItem.WeldJointId, + CreateDate = batchTrustItem.CreateDate, + RepairNum = batchTrustItem.RepairNum, + }; + db.HJGL_Batch_BatchTrustItem.InsertOnSubmit(newTrustBatchItem); + db.SubmitChanges(); + UpdateTrustNum(batchTrustItem.TrustBatchItemId, 1); + + } + public static void AddBatchTrustItemForApi(Model.HJGL_Batch_BatchTrustItem batchTrustItem) + { + Model.SGGLDB db = Funs.DB; + Model.HJGL_Batch_BatchTrustItem newTrustBatchItem = new Model.HJGL_Batch_BatchTrustItem + { + TrustBatchItemId = batchTrustItem.TrustBatchItemId, + TrustBatchId = batchTrustItem.TrustBatchId, + PointBatchItemId = batchTrustItem.PointBatchItemId, + RepairRecordId = batchTrustItem.RepairRecordId, + WeldJointId = batchTrustItem.WeldJointId, + CreateDate = batchTrustItem.CreateDate, + RepairNum = batchTrustItem.RepairNum, + }; + db.HJGL_Batch_BatchTrustItem.InsertOnSubmit(newTrustBatchItem); + + var trustBatchItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(x => x.TrustBatchItemId == batchTrustItem.TrustBatchItemId); + if (trustBatchItem != null) + { + trustBatchItem.TrustNum = trustBatchItem.TrustNum ?? 0 + 1; + if (trustBatchItem.TrustNum < 0) + { + trustBatchItem.TrustNum = 0; + } + } + db.SubmitChanges(); + + } + + /// + /// 修改无损委托 + /// + /// + public static void UpdateBatchTrustItem(Model.HJGL_Batch_BatchTrustItem batchTrustItem) + { + Model.SGGLDB db = Funs.DB; + Model.HJGL_Batch_BatchTrustItem newBatchTrustItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(e => e.TrustBatchItemId == batchTrustItem.TrustBatchItemId); + if (newBatchTrustItem != null) + { + newBatchTrustItem.PointBatchItemId = batchTrustItem.PointBatchItemId; + newBatchTrustItem.WeldJointId = batchTrustItem.WeldJointId; + newBatchTrustItem.CreateDate = batchTrustItem.CreateDate; + newBatchTrustItem.RepairNum = batchTrustItem.RepairNum; + db.SubmitChanges(); + } + } + + + /// + /// 根据无损委托Id获取相关明细视图信息 + /// + /// + /// + /// + public static List GetViewBatchTrustItem(string trustBatchId) + { + Model.SGGLDB db = Funs.DB; + return (from x in db.View_Batch_BatchTrustItem where x.TrustBatchId == trustBatchId select x).ToList(); + } + + + /// + /// 根据Id删除明细信息 + /// + /// + public static void DeleteTrustItemByTrustBatchItemId(string trustBatchItemId) + { + Model.SGGLDB db = Funs.DB; + Model.HJGL_Batch_BatchTrustItem trustItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(e => e.TrustBatchItemId == trustBatchItemId); + if (trustItem != null) + { + UpdateTrustNum(trustBatchItemId, -1); + db.HJGL_Batch_BatchTrustItem.DeleteOnSubmit(trustItem); + db.SubmitChanges(); + + } + } + + /// + /// 更新委托次数 + /// + /// 委托批明细ID + /// + public static void UpdateTrustNum(string trustBatchItemId, int num) + { + Model.SGGLDB db = Funs.DB; + var trustBatchItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(x => x.TrustBatchItemId == trustBatchItemId); + if (trustBatchItem != null) + { + trustBatchItem.TrustNum = trustBatchItem.TrustNum ?? 0 + num; + if (trustBatchItem.TrustNum < 0) + { + trustBatchItem.TrustNum = 0; + } + } + db.SubmitChanges(); + } + + #region 是否满足生成委托条件 + /// + /// 是否满足生成委托条件 + /// + /// + public static bool GetIsGenerateTrust(string pointBatchItemId) + { + bool isShow = true; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var trustBatchItem = db.HJGL_Batch_BatchTrustItem.FirstOrDefault(x => x.PointBatchItemId == pointBatchItemId); + if (trustBatchItem != null) + { + var checkItem = db.HJGL_Batch_NDEItem.FirstOrDefault(x => x.TrustBatchItemId == trustBatchItem.TrustBatchItemId && x.CheckResult == "1"); + if (checkItem != null) + { + isShow = false; + } + } + } + return isShow; + } + #endregion + } } diff --git a/SGGL/BLL/HJGL/WeldingManage/PW_JointInfoService.cs b/SGGL/BLL/HJGL/WeldingManage/PW_JointInfoService.cs index c2e4982e..162cf8cc 100644 --- a/SGGL/BLL/HJGL/WeldingManage/PW_JointInfoService.cs +++ b/SGGL/BLL/HJGL/WeldingManage/PW_JointInfoService.cs @@ -450,13 +450,36 @@ namespace BLL Funs.DB.SubmitChanges(); } } - - /// - /// 根据焊接日报ID获取焊接日期 - /// - /// - /// - public static DateTime GetReportDateByDReportID(string dReportID) + public static void UpdateJointNoAddGForApi(string jotId, string jointAttribute, string operateState) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (operateState == Const.BtnDelete || jointAttribute != "固定") + { + Model.PW_JointInfo deleteJointInfo = db.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); + if (deleteJointInfo.JOT_JointNo.Last() == 'G') + { + deleteJointInfo.JOT_JointNo = deleteJointInfo.JOT_JointNo.Substring(0, deleteJointInfo.JOT_JointNo.Length - 1); + db.SubmitChanges(); + } + } + else + { + Model.PW_JointInfo addJointInfo = db.PW_JointInfo.FirstOrDefault(e => e.JOT_ID == jotId); + if (addJointInfo.JOT_JointNo.Last() != 'G') + { + addJointInfo.JOT_JointNo += "G"; + } + db.SubmitChanges(); + } + } + } + /// + /// 根据焊接日报ID获取焊接日期 + /// + /// + /// + public static DateTime GetReportDateByDReportID(string dReportID) { return (from y in Funs.DB.BO_WeldReportMain where y.DReportID == dReportID select y.JOT_WeldDate).FirstOrDefault(); } diff --git a/SGGL/BLL/HSSE/Check/Check_CheckSpecialDetailService.cs b/SGGL/BLL/HSSE/Check/Check_CheckSpecialDetailService.cs index 564ecf04..23f2a336 100644 --- a/SGGL/BLL/HSSE/Check/Check_CheckSpecialDetailService.cs +++ b/SGGL/BLL/HSSE/Check/Check_CheckSpecialDetailService.cs @@ -122,12 +122,28 @@ namespace BLL db.SubmitChanges(); } } - - /// - /// 根据专项检查ID删除一条专项检查明细信息 - /// - /// - public static void DeleteCheckSpecialDetailById(string checkSpecialDetailId) + public static void DeleteCheckSpecialDetailsForApi(string checkSpecialId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var q = (from x in db.Check_CheckSpecialDetail where x.CheckSpecialId == checkSpecialId select x).ToList(); + if (q != null) + { + //foreach (var item in q) + //{ + // ////删除附件表 + // BLL.CommonService.DeleteAttachFileById(item.CheckSpecialDetailId); + //} + db.Check_CheckSpecialDetail.DeleteAllOnSubmit(q); + db.SubmitChanges(); + } + } + } + /// + /// 根据专项检查ID删除一条专项检查明细信息 + /// + /// + public static void DeleteCheckSpecialDetailById(string checkSpecialDetailId) { Model.SGGLDB db = Funs.DB; var q = (from x in db.Check_CheckSpecialDetail where x.CheckSpecialDetailId == checkSpecialDetailId select x).FirstOrDefault(); diff --git a/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs b/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs index bc46638f..2d1b54e8 100644 --- a/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs +++ b/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs @@ -120,12 +120,36 @@ namespace BLL db.SubmitChanges(); } } - - /// - /// 根据专项检查ID 更新专项检查状态 - /// - /// - public static void UpdateCheckSpecialStates(string checkSpecialId) + public static void UpdateCheckSpecialForApi(Model.Check_CheckSpecial checkSpecial) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Check_CheckSpecial newCheckSpecial = db.Check_CheckSpecial.FirstOrDefault(e => e.CheckSpecialId == checkSpecial.CheckSpecialId); + if (newCheckSpecial != null) + { + newCheckSpecial.CheckSpecialCode = checkSpecial.CheckSpecialCode; + //newCheckSpecial.ProjectId = checkSpecial.ProjectId; + newCheckSpecial.CheckPerson = checkSpecial.CheckPerson; + newCheckSpecial.CheckTime = checkSpecial.CheckTime; + newCheckSpecial.ScanUrl = checkSpecial.ScanUrl; + newCheckSpecial.DaySummary = checkSpecial.DaySummary; + newCheckSpecial.PartInUnits = checkSpecial.PartInUnits; + newCheckSpecial.PartInPersons = checkSpecial.PartInPersons; + newCheckSpecial.PartInPersonIds = checkSpecial.PartInPersonIds; + newCheckSpecial.PartInPersonNames = checkSpecial.PartInPersonNames; + newCheckSpecial.CheckAreas = checkSpecial.CheckAreas; + newCheckSpecial.States = checkSpecial.States; + newCheckSpecial.CheckType = checkSpecial.CheckType; + newCheckSpecial.CheckItemSetId = checkSpecial.CheckItemSetId; + db.SubmitChanges(); + } + } + } + /// + /// 根据专项检查ID 更新专项检查状态 + /// + /// + public static void UpdateCheckSpecialStates(string checkSpecialId) { var getS = Funs.DB.Check_CheckSpecial.FirstOrDefault(x => x.CheckSpecialId == checkSpecialId); if (getS != null && getS.States == Const.State_1) @@ -137,13 +161,29 @@ namespace BLL Funs.DB.SubmitChanges(); } } - } + } + public static void UpdateCheckSpecialStatesForApi(string checkSpecialId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getS = db.Check_CheckSpecial.FirstOrDefault(x => x.CheckSpecialId == checkSpecialId); + if (getS != null && getS.States == Const.State_1) + { + var getNCDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialId == getS.CheckSpecialId && x.CompleteStatus == false); + if (getNCDetail == null) + { + getS.States = Const.State_2; + db.SubmitChanges(); + } + } + } + } - /// - /// 根据专项检查ID删除对应专项检查记录信息 - /// - /// - public static void DeleteCheckSpecial(string checkSpecialId) + /// + /// 根据专项检查ID删除对应专项检查记录信息 + /// + /// + public static void DeleteCheckSpecial(string checkSpecialId) { Model.SGGLDB db = Funs.DB; var q = (from x in db.Check_CheckSpecial where x.CheckSpecialId == checkSpecialId select x).FirstOrDefault(); @@ -205,84 +245,160 @@ namespace BLL return name; } - /// - /// - /// - /// - /// - /// - public static string IssueRectification(List detailLists, Model.Check_CheckSpecial checkSpecial) - { - string info = string.Empty; - if (detailLists.Count() > 0 && checkSpecial != null) + /// + /// + /// + /// + /// + /// + public static string IssueRectification(List detailLists, Model.Check_CheckSpecial checkSpecial) { - ////隐患整改单 - var getDetail1 = detailLists.Where(x => x.CompleteStatus==false); - if (getDetail1.Count() > 0) - { - var getUnitList = getDetail1.Select(x => x.UnitId).Distinct(); - foreach (var unitItem in getUnitList) - { - var getUnitItemList = getDetail1.Where(x => x.UnitId == unitItem); - foreach (var item in getUnitItemList) + string info = string.Empty; + if (detailLists.Count() > 0 && checkSpecial != null) + { + ////隐患整改单 + var getDetail1 = detailLists.Where(x => x.CompleteStatus == false); + if (getDetail1.Count() > 0) { - Model.HSSE_Hazard_HazardRegister register = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.CheckItemDetailId == item.CheckSpecialDetailId); - if (register == null) - { - register = new Model.HSSE_Hazard_HazardRegister(); - } - register.ProjectId = checkSpecial.ProjectId; - register.CheckItemDetailId = item.CheckSpecialDetailId; - register.ProblemTypes = "2"; //1 安全问题 2 专项巡检 - register.RegisterTypesId = item.CheckItem; - // register.CheckCycle = this.ckType.SelectedValue; - register.IsEffective = "1"; - register.RegisterDate = checkSpecial.CheckTime; - register.CheckTime = checkSpecial.CheckTime; - register.ResponsibleUnit = item.UnitId; + var getUnitList = getDetail1.Select(x => x.UnitId).Distinct(); + foreach (var unitItem in getUnitList) + { + var getUnitItemList = getDetail1.Where(x => x.UnitId == unitItem); + foreach (var item in getUnitItemList) + { + Model.HSSE_Hazard_HazardRegister register = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.CheckItemDetailId == item.CheckSpecialDetailId); + if (register == null) + { + register = new Model.HSSE_Hazard_HazardRegister(); + } + register.ProjectId = checkSpecial.ProjectId; + register.CheckItemDetailId = item.CheckSpecialDetailId; + register.ProblemTypes = "2"; //1 安全问题 2 专项巡检 + register.RegisterTypesId = item.CheckItem; + // register.CheckCycle = this.ckType.SelectedValue; + register.IsEffective = "1"; + register.RegisterDate = checkSpecial.CheckTime; + register.CheckTime = checkSpecial.CheckTime; + register.ResponsibleUnit = item.UnitId; - register.Place = item.WorkArea; + register.Place = item.WorkArea; - register.RegisterDef = item.Unqualified; - // register.HandleIdea = item.Suggestions; - register.ResponsibleMan = item.HSEManage; - register.Risk_Level = item.RiskLevel; - register.Requirements = item.Suggestions; + register.RegisterDef = item.Unqualified; + // register.HandleIdea = item.Suggestions; + register.ResponsibleMan = item.HSEManage; + register.Risk_Level = item.RiskLevel; + register.Requirements = item.Suggestions; - register.RectificationPeriod = item.LimitedDate; - register.CheckManId = checkSpecial.CompileMan; - //register.CutPayment = Funs.GetNewIntOrZero(this.txtCutPayment.Text.Trim()); - register.States = "1"; //待整改 - if (string.IsNullOrEmpty(register.HazardRegisterId)) - { - register.HazardRegisterId = Guid.NewGuid().ToString(); - var url = AttachFileService.getFileUrl(item.CheckSpecialDetailId); - register.ImageUrl = url; - SaveAttachFile(register.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, url); - BLL.HSSE_Hazard_HazardRegisterService.AddHazardRegister(register); - } - else - { - var url = AttachFileService.getFileUrl(item.CheckSpecialDetailId); - register.ImageUrl = url; - SaveAttachFile(register.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, url); - BLL.HSSE_Hazard_HazardRegisterService.UpdateHazardRegister(register); - } + register.RectificationPeriod = item.LimitedDate; + register.CheckManId = checkSpecial.CompileMan; + //register.CutPayment = Funs.GetNewIntOrZero(this.txtCutPayment.Text.Trim()); + register.States = "1"; //待整改 + if (string.IsNullOrEmpty(register.HazardRegisterId)) + { + register.HazardRegisterId = Guid.NewGuid().ToString(); + var url = AttachFileService.getFileUrl(item.CheckSpecialDetailId); + register.ImageUrl = url; + SaveAttachFile(register.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, url); + BLL.HSSE_Hazard_HazardRegisterService.AddHazardRegister(register); + } + else + { + var url = AttachFileService.getFileUrl(item.CheckSpecialDetailId); + register.ImageUrl = url; + SaveAttachFile(register.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, url); + BLL.HSSE_Hazard_HazardRegisterService.UpdateHazardRegister(register); + } + } + } + info += "整改已下发。"; } - } - info += "整改已下发。"; - } - Check_CheckSpecialService.UpdateCheckSpecial(checkSpecial); - } + Check_CheckSpecialService.UpdateCheckSpecial(checkSpecial); + } - if (!string.IsNullOrEmpty(info)) - { - info += "请在相应办理页面提交!"; + if (!string.IsNullOrEmpty(info)) + { + info += "请在相应办理页面提交!"; + } + return info; } - return info; - } - public static void SaveAttachFile(string dataId, string menuId, string url) + public static string IssueRectificationForApi(List detailLists, Model.Check_CheckSpecial checkSpecial) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string info = string.Empty; + if (detailLists.Count() > 0 && checkSpecial != null) + { + ////隐患整改单 + var getDetail1 = detailLists.Where(x => x.CompleteStatus == false); + if (getDetail1.Count() > 0) + { + var getUnitList = getDetail1.Select(x => x.UnitId).Distinct(); + foreach (var unitItem in getUnitList) + { + var getUnitItemList = getDetail1.Where(x => x.UnitId == unitItem); + foreach (var item in getUnitItemList) + { + Model.HSSE_Hazard_HazardRegister register = db.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.CheckItemDetailId == item.CheckSpecialDetailId); + if (register == null) + { + register = new Model.HSSE_Hazard_HazardRegister(); + db.HSSE_Hazard_HazardRegister.InsertOnSubmit(register); + + } + register.ProjectId = checkSpecial.ProjectId; + register.CheckItemDetailId = item.CheckSpecialDetailId; + register.ProblemTypes = "2"; //1 安全问题 2 专项巡检 + register.RegisterTypesId = item.CheckItem; + // register.CheckCycle = this.ckType.SelectedValue; + register.IsEffective = "1"; + register.RegisterDate = checkSpecial.CheckTime; + register.CheckTime = checkSpecial.CheckTime; + register.ResponsibleUnit = item.UnitId; + + register.Place = item.WorkArea; + + register.RegisterDef = item.Unqualified; + // register.HandleIdea = item.Suggestions; + register.ResponsibleMan = item.HSEManage; + register.Risk_Level = item.RiskLevel; + register.Requirements = item.Suggestions; + + register.RectificationPeriod = item.LimitedDate; + register.CheckManId = checkSpecial.CompileMan; + //register.CutPayment = Funs.GetNewIntOrZero(this.txtCutPayment.Text.Trim()); + register.States = "1"; //待整改 + if (string.IsNullOrEmpty(register.HazardRegisterId)) + { + register.HazardRegisterId = Guid.NewGuid().ToString(); + var url = AttachFileService.getFileUrl(item.CheckSpecialDetailId); + register.ImageUrl = url; + SaveAttachFile(register.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, url); + db.SubmitChanges(); + } + else + { + var url = AttachFileService.getFileUrl(item.CheckSpecialDetailId); + register.ImageUrl = url; + SaveAttachFile(register.HazardRegisterId, BLL.Const.HSSE_HiddenRectificationListMenuId, url); + db.SubmitChanges(); + } + + } + } + info += "整改已下发。"; + } + Check_CheckSpecialService.UpdateCheckSpecialForApi(checkSpecial); + } + + if (!string.IsNullOrEmpty(info)) + { + info += "请在相应办理页面提交!"; + } + return info; + } + } + public static void SaveAttachFile(string dataId, string menuId, string url) { Model.ToDoItem toDoItem = new Model.ToDoItem { diff --git a/SGGL/BLL/HSSE/Check/IncentiveNoticeService.cs b/SGGL/BLL/HSSE/Check/IncentiveNoticeService.cs index f1ccfada..b0196fba 100644 --- a/SGGL/BLL/HSSE/Check/IncentiveNoticeService.cs +++ b/SGGL/BLL/HSSE/Check/IncentiveNoticeService.cs @@ -162,13 +162,45 @@ namespace BLL db.Check_IncentiveNotice.InsertOnSubmit(newIncentiveNotice); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectIncentiveNoticeMenuId, incentiveNotice.ProjectId, null, incentiveNotice.IncentiveNoticeId, incentiveNotice.CompileDate); - } + } + public static void AddIncentiveNoticeForApi(Model.Check_IncentiveNotice incentiveNotice) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Check_IncentiveNotice newIncentiveNotice = new Model.Check_IncentiveNotice + { + IncentiveNoticeId = incentiveNotice.IncentiveNoticeId, + ProjectId = incentiveNotice.ProjectId, + IncentiveNoticeCode = incentiveNotice.IncentiveNoticeCode, + UnitId = incentiveNotice.UnitId, + TeamGroupId = incentiveNotice.TeamGroupId, + IncentiveDate = incentiveNotice.IncentiveDate, + PersonId = incentiveNotice.PersonId, + BasicItem = incentiveNotice.BasicItem, + IncentiveMoney = incentiveNotice.IncentiveMoney, + TitleReward = incentiveNotice.TitleReward, + MattleReward = incentiveNotice.MattleReward, + FileContents = incentiveNotice.FileContents, + AttachUrl = incentiveNotice.AttachUrl, + CompileMan = incentiveNotice.CompileMan, + CompileDate = incentiveNotice.CompileDate, + States = incentiveNotice.States, + SignMan = incentiveNotice.SignMan, + ApproveMan = incentiveNotice.ApproveMan, + RewardType = incentiveNotice.RewardType, + Currency = incentiveNotice.Currency + }; + db.Check_IncentiveNotice.InsertOnSubmit(newIncentiveNotice); + db.SubmitChanges(); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectIncentiveNoticeMenuId, incentiveNotice.ProjectId, null, incentiveNotice.IncentiveNoticeId, incentiveNotice.CompileDate); + } + } - /// - /// 修改奖励通知单 - /// - /// - public static void UpdateIncentiveNotice(Model.Check_IncentiveNotice incentiveNotice) + /// + /// 修改奖励通知单 + /// + /// + public static void UpdateIncentiveNotice(Model.Check_IncentiveNotice incentiveNotice) { Model.SGGLDB db = Funs.DB; Model.Check_IncentiveNotice newIncentiveNotice = db.Check_IncentiveNotice.FirstOrDefault(e => e.IncentiveNoticeId == incentiveNotice.IncentiveNoticeId); diff --git a/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs b/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs index e33cf528..7336dfea 100644 --- a/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs +++ b/SGGL/BLL/HSSE/EduTrain/TestRecordService.cs @@ -52,13 +52,43 @@ namespace BLL db.Training_TestRecord.InsertOnSubmit(newTestRecord); db.SubmitChanges(); - } + } + public static void AddTestRecordForApi(Model.Training_TestRecord testRecord) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Training_TestRecord newTestRecord = new Model.Training_TestRecord + { + TestRecordId = testRecord.TestRecordId, + ProjectId = testRecord.ProjectId, + TestPlanId = testRecord.TestPlanId, + TestManId = testRecord.TestManId, + TestType = testRecord.TestType, + }; - /// - /// 修改考试记录信息 - /// - /// - public static void UpdateTestRecord(Model.Training_TestRecord testRecord) + if (string.IsNullOrEmpty(newTestRecord.TestType)) + { + var getTrainTypeName = (from x in db.Training_TestPlan + join y in db.Training_Plan on x.PlanId equals y.PlanId + join z in db.Base_TrainType on y.TrainTypeId equals z.TrainTypeId + where x.TestPlanId == testRecord.TestPlanId + select z).FirstOrDefault(); + + if (getTrainTypeName != null) + { + testRecord.TestType = getTrainTypeName.TrainTypeName; + } + } + + db.Training_TestRecord.InsertOnSubmit(newTestRecord); + db.SubmitChanges(); + } + } + /// + /// 修改考试记录信息 + /// + /// + public static void UpdateTestRecord(Model.Training_TestRecord testRecord) { Model.SGGLDB db = Funs.DB; Model.Training_TestRecord newTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecord.TestRecordId); diff --git a/SGGL/BLL/HSSE/License/LicensePublicService.cs b/SGGL/BLL/HSSE/License/LicensePublicService.cs index d2a66f33..24489659 100644 --- a/SGGL/BLL/HSSE/License/LicensePublicService.cs +++ b/SGGL/BLL/HSSE/License/LicensePublicService.cs @@ -1253,12 +1253,29 @@ namespace BLL db.License_LicenseItem.InsertOnSubmit(newLicenseItem); db.SubmitChanges(); } + public static void AddLicenseItemForApi(Model.License_LicenseItem licenseItem) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.License_LicenseItem newLicenseItem = new Model.License_LicenseItem + { + LicenseItemId = SQLHelper.GetNewID(), + DataId = licenseItem.DataId, + SortIndex = licenseItem.SortIndex, + SafetyMeasures = licenseItem.SafetyMeasures, + IsUsed = licenseItem.IsUsed, + ConfirmManId = licenseItem.ConfirmManId, + }; + db.License_LicenseItem.InsertOnSubmit(newLicenseItem); + db.SubmitChanges(); + } + } - /// - /// 修改-安全措施 - /// - /// - public static void UpdateLicenseItem(Model.License_LicenseItem licenseItem) + /// + /// 修改-安全措施 + /// + /// + public static void UpdateLicenseItem(Model.License_LicenseItem licenseItem) { Model.SGGLDB db = Funs.DB; Model.License_LicenseItem newLicenseItem = db.License_LicenseItem.FirstOrDefault(e => e.LicenseItemId == licenseItem.LicenseItemId); @@ -1346,13 +1363,32 @@ namespace BLL }; db.License_FlowOperate.InsertOnSubmit(newFlowOperate); db.SubmitChanges(); - } + } + public static void AddFlowOperateForApi(Model.License_FlowOperate flowOperate) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.License_FlowOperate newFlowOperate = new Model.License_FlowOperate + { + FlowOperateId = SQLHelper.GetNewID(), + DataId = flowOperate.DataId, + MenuId = flowOperate.MenuId, + OperaterId = flowOperate.OperaterId, + AuditFlowName = flowOperate.AuditFlowName, + SortIndex = flowOperate.SortIndex, + RoleIds = flowOperate.RoleIds, + IsFlowEnd = flowOperate.IsFlowEnd, + }; + db.License_FlowOperate.InsertOnSubmit(newFlowOperate); + db.SubmitChanges(); + } + } - /// - /// 修改审核信息 - /// - /// - public static void UpdateFlowOperate(Model.License_FlowOperate flowOperate) + /// + /// 修改审核信息 + /// + /// + public static void UpdateFlowOperate(Model.License_FlowOperate flowOperate) { Model.SGGLDB db = Funs.DB; Model.License_FlowOperate newFlowOperate = db.License_FlowOperate.FirstOrDefault(e => e.FlowOperateId == flowOperate.FlowOperateId); diff --git a/SGGL/BLL/HSSE/Meeting/AttendMeetingService.cs b/SGGL/BLL/HSSE/Meeting/AttendMeetingService.cs index a94d0454..d93d2e93 100644 --- a/SGGL/BLL/HSSE/Meeting/AttendMeetingService.cs +++ b/SGGL/BLL/HSSE/Meeting/AttendMeetingService.cs @@ -79,12 +79,43 @@ namespace BLL ////增加一条编码记录 CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectAttendMeetingMenuId, attendMeeting.ProjectId, null, attendMeeting.AttendMeetingId, attendMeeting.CompileDate); } + public static void AddAttendMeetingForApi(Model.Meeting_AttendMeeting attendMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { - /// - /// 修改其他会议记录 - /// - /// - public static void UpdateAttendMeeting(Model.Meeting_AttendMeeting attendMeeting) + Model.Meeting_AttendMeeting newAttendMeeting = new Model.Meeting_AttendMeeting + { + AttendMeetingId = attendMeeting.AttendMeetingId, + ProjectId = attendMeeting.ProjectId, + UnitId = attendMeeting.UnitId, + AttendMeetingCode = attendMeeting.AttendMeetingCode, + AttendMeetingName = attendMeeting.AttendMeetingName, + AttendMeetingDate = attendMeeting.AttendMeetingDate, + CompileMan = attendMeeting.CompileMan, + AttendMeetingContents = attendMeeting.AttendMeetingContents, + CompileDate = attendMeeting.CompileDate, + States = attendMeeting.States, + MeetingHours = attendMeeting.MeetingHours, + MeetingHostMan = attendMeeting.MeetingHostMan, + AttentPerson = attendMeeting.AttentPerson, + MeetingPlace = attendMeeting.MeetingPlace, + MeetingHostManId = attendMeeting.MeetingHostManId, + AttentPersonIds = attendMeeting.AttentPersonIds, + AttentPersonNum = attendMeeting.AttentPersonNum, + MeetingHostManOther = attendMeeting.MeetingHostManOther + }; + db.Meeting_AttendMeeting.InsertOnSubmit(attendMeeting); + db.SubmitChanges(); + ////增加一条编码记录 + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectAttendMeetingMenuId, attendMeeting.ProjectId, null, attendMeeting.AttendMeetingId, attendMeeting.CompileDate); + } + } + /// + /// 修改其他会议记录 + /// + /// + public static void UpdateAttendMeeting(Model.Meeting_AttendMeeting attendMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_AttendMeeting newAttendMeeting = db.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeeting.AttendMeetingId); @@ -110,12 +141,39 @@ namespace BLL db.SubmitChanges(); } } - - /// - /// 根据主键删除其他会议记录 - /// - /// - public static void DeleteAttendMeetingById(string attendMeetingId) + public static void UpdateAttendMeetingForApi(Model.Meeting_AttendMeeting attendMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_AttendMeeting newAttendMeeting = db.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeeting.AttendMeetingId); + if (newAttendMeeting != null) + { + //newAttendMeeting.ProjectId = attendMeeting.ProjectId; + newAttendMeeting.UnitId = attendMeeting.UnitId; + newAttendMeeting.AttendMeetingCode = attendMeeting.AttendMeetingCode; + newAttendMeeting.AttendMeetingName = attendMeeting.AttendMeetingName; + newAttendMeeting.AttendMeetingDate = attendMeeting.AttendMeetingDate; + newAttendMeeting.CompileMan = attendMeeting.CompileMan; + newAttendMeeting.AttendMeetingContents = attendMeeting.AttendMeetingContents; + newAttendMeeting.CompileDate = attendMeeting.CompileDate; + newAttendMeeting.States = attendMeeting.States; + newAttendMeeting.MeetingHours = attendMeeting.MeetingHours; + newAttendMeeting.MeetingHostMan = attendMeeting.MeetingHostMan; + newAttendMeeting.AttentPerson = attendMeeting.AttentPerson; + newAttendMeeting.MeetingPlace = attendMeeting.MeetingPlace; + newAttendMeeting.MeetingHostManId = attendMeeting.MeetingHostManId; + newAttendMeeting.AttentPersonIds = attendMeeting.AttentPersonIds; + newAttendMeeting.MeetingHostManOther = attendMeeting.MeetingHostManOther; + newAttendMeeting.AttentPersonNum = attendMeeting.AttentPersonNum; + db.SubmitChanges(); + } + } + } + /// + /// 根据主键删除其他会议记录 + /// + /// + public static void DeleteAttendMeetingById(string attendMeetingId) { Model.SGGLDB db = Funs.DB; Model.Meeting_AttendMeeting attendMeeting = db.Meeting_AttendMeeting.FirstOrDefault(e => e.AttendMeetingId == attendMeetingId); diff --git a/SGGL/BLL/HSSE/Meeting/ClassMeetingService.cs b/SGGL/BLL/HSSE/Meeting/ClassMeetingService.cs index 69c5df78..2c24b7c7 100644 --- a/SGGL/BLL/HSSE/Meeting/ClassMeetingService.cs +++ b/SGGL/BLL/HSSE/Meeting/ClassMeetingService.cs @@ -51,12 +51,41 @@ namespace BLL ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectClassMeetingMenuId, classMeeting.ProjectId, null, classMeeting.ClassMeetingId, classMeeting.CompileDate); } - - /// - /// 修改班前会 - /// - /// - public static void UpdateClassMeeting(Model.Meeting_ClassMeeting classMeeting) + public static void AddClassMeetingForApi(Model.Meeting_ClassMeeting classMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_ClassMeeting newClassMeeting = new Model.Meeting_ClassMeeting + { + ClassMeetingId = classMeeting.ClassMeetingId, + ProjectId = classMeeting.ProjectId, + UnitId = classMeeting.UnitId, + TeamGroupId = classMeeting.TeamGroupId, + ClassMeetingCode = classMeeting.ClassMeetingCode, + ClassMeetingName = classMeeting.ClassMeetingName, + ClassMeetingDate = classMeeting.ClassMeetingDate, + ClassMeetingContents = classMeeting.ClassMeetingContents, + CompileMan = classMeeting.CompileMan, + CompileDate = classMeeting.CompileDate, + States = classMeeting.States, + MeetingPlace = classMeeting.MeetingPlace, + MeetingHours = classMeeting.MeetingHours, + MeetingHostMan = classMeeting.MeetingHostMan, + AttentPerson = classMeeting.AttentPerson, + AttentPersonNum = classMeeting.AttentPersonNum, + MeetingHostManOther = classMeeting.MeetingHostManOther + }; + db.Meeting_ClassMeeting.InsertOnSubmit(newClassMeeting); + db.SubmitChanges(); + ////增加一条编码记录 + BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(BLL.Const.ProjectClassMeetingMenuId, classMeeting.ProjectId, null, classMeeting.ClassMeetingId, classMeeting.CompileDate); + } + } + /// + /// 修改班前会 + /// + /// + public static void UpdateClassMeeting(Model.Meeting_ClassMeeting classMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_ClassMeeting newClassMeeting = db.Meeting_ClassMeeting.FirstOrDefault(e => e.ClassMeetingId == classMeeting.ClassMeetingId); @@ -82,12 +111,39 @@ namespace BLL db.SubmitChanges(); } } + public static void UpdateClassMeetingForApi(Model.Meeting_ClassMeeting classMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_ClassMeeting newClassMeeting = db.Meeting_ClassMeeting.FirstOrDefault(e => e.ClassMeetingId == classMeeting.ClassMeetingId); + if (newClassMeeting != null) + { + // newClassMeeting.ProjectId = classMeeting.ProjectId; + newClassMeeting.UnitId = classMeeting.UnitId; + newClassMeeting.TeamGroupId = classMeeting.TeamGroupId; + newClassMeeting.ClassMeetingCode = classMeeting.ClassMeetingCode; + newClassMeeting.ClassMeetingName = classMeeting.ClassMeetingName; + newClassMeeting.ClassMeetingDate = classMeeting.ClassMeetingDate; + newClassMeeting.ClassMeetingContents = classMeeting.ClassMeetingContents; + newClassMeeting.CompileMan = classMeeting.CompileMan; + newClassMeeting.CompileDate = classMeeting.CompileDate; + newClassMeeting.States = classMeeting.States; + newClassMeeting.MeetingPlace = classMeeting.MeetingPlace; + newClassMeeting.MeetingHours = classMeeting.MeetingHours; + newClassMeeting.MeetingHostMan = classMeeting.MeetingHostMan; + newClassMeeting.AttentPerson = classMeeting.AttentPerson; + newClassMeeting.AttentPersonNum = classMeeting.AttentPersonNum; + newClassMeeting.MeetingHostManOther = classMeeting.MeetingHostManOther; - /// - /// 根据主键删除班前会 - /// - /// - public static void DeleteClassMeetingById(string classMeetingId) + db.SubmitChanges(); + } + } + } + /// + /// 根据主键删除班前会 + /// + /// + public static void DeleteClassMeetingById(string classMeetingId) { Model.SGGLDB db = Funs.DB; Model.Meeting_ClassMeeting classMeeting = db.Meeting_ClassMeeting.FirstOrDefault(e => e.ClassMeetingId == classMeetingId); diff --git a/SGGL/BLL/HSSE/Meeting/MonthMeetingService.cs b/SGGL/BLL/HSSE/Meeting/MonthMeetingService.cs index 33c3ffa9..7173c7b7 100644 --- a/SGGL/BLL/HSSE/Meeting/MonthMeetingService.cs +++ b/SGGL/BLL/HSSE/Meeting/MonthMeetingService.cs @@ -95,12 +95,42 @@ namespace BLL ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectMonthMeetingMenuId, monthMeeting.ProjectId, null, monthMeeting.MonthMeetingId, monthMeeting.CompileDate); } - - /// - /// 修改安全月例会 - /// - /// - public static void UpdateMonthMeeting(Model.Meeting_MonthMeeting monthMeeting) + public static void AddMonthMeetingForApi(Model.Meeting_MonthMeeting monthMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_MonthMeeting newMonthMeeting = new Model.Meeting_MonthMeeting + { + MonthMeetingId = monthMeeting.MonthMeetingId, + ProjectId = monthMeeting.ProjectId, + UnitId = monthMeeting.UnitId, + MonthMeetingCode = monthMeeting.MonthMeetingCode, + MonthMeetingName = monthMeeting.MonthMeetingName, + MonthMeetingDate = monthMeeting.MonthMeetingDate, + CompileMan = monthMeeting.CompileMan, + MonthMeetingContents = monthMeeting.MonthMeetingContents, + CompileDate = monthMeeting.CompileDate, + States = monthMeeting.States, + AttentPersonNum = monthMeeting.AttentPersonNum, + MeetingHours = monthMeeting.MeetingHours, + MeetingHostMan = monthMeeting.MeetingHostMan, + AttentPerson = monthMeeting.AttentPerson, + MeetingPlace = monthMeeting.MeetingPlace, + MeetingHostManId = monthMeeting.MeetingHostManId, + AttentPersonIds = monthMeeting.AttentPersonIds, + MeetingHostManOther = monthMeeting.MeetingHostManOther + }; + db.Meeting_MonthMeeting.InsertOnSubmit(newMonthMeeting); + db.SubmitChanges(); + ////增加一条编码记录 + BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(BLL.Const.ProjectMonthMeetingMenuId, monthMeeting.ProjectId, null, monthMeeting.MonthMeetingId, monthMeeting.CompileDate); + } + } + /// + /// 修改安全月例会 + /// + /// + public static void UpdateMonthMeeting(Model.Meeting_MonthMeeting monthMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_MonthMeeting newMonthMeeting = db.Meeting_MonthMeeting.FirstOrDefault(e => e.MonthMeetingId == monthMeeting.MonthMeetingId); @@ -126,12 +156,40 @@ namespace BLL db.SubmitChanges(); } } + public static void UpdateMonthMeetingForApi(Model.Meeting_MonthMeeting monthMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_MonthMeeting newMonthMeeting = db.Meeting_MonthMeeting.FirstOrDefault(e => e.MonthMeetingId == monthMeeting.MonthMeetingId); + if (newMonthMeeting != null) + { + //newMonthMeeting.ProjectId = monthMeeting.ProjectId; + newMonthMeeting.UnitId = monthMeeting.UnitId; + newMonthMeeting.MonthMeetingCode = monthMeeting.MonthMeetingCode; + newMonthMeeting.MonthMeetingName = monthMeeting.MonthMeetingName; + newMonthMeeting.MonthMeetingDate = monthMeeting.MonthMeetingDate; + newMonthMeeting.CompileMan = monthMeeting.CompileMan; + newMonthMeeting.MonthMeetingContents = monthMeeting.MonthMeetingContents; + newMonthMeeting.CompileDate = monthMeeting.CompileDate; + newMonthMeeting.States = monthMeeting.States; + newMonthMeeting.AttentPersonNum = monthMeeting.AttentPersonNum; + newMonthMeeting.MeetingHours = monthMeeting.MeetingHours; + newMonthMeeting.MeetingHostMan = monthMeeting.MeetingHostMan; + newMonthMeeting.AttentPerson = monthMeeting.AttentPerson; + newMonthMeeting.MeetingPlace = monthMeeting.MeetingPlace; + newMonthMeeting.MeetingHostManId = monthMeeting.MeetingHostManId; + newMonthMeeting.AttentPersonIds = monthMeeting.AttentPersonIds; + newMonthMeeting.MeetingHostManOther = monthMeeting.MeetingHostManOther; + db.SubmitChanges(); + } + } + } - /// - /// 根据主键删除安全月例会 - /// - /// - public static void DeleteMonthMeetingById(string monthMeetingId) + /// + /// 根据主键删除安全月例会 + /// + /// + public static void DeleteMonthMeetingById(string monthMeetingId) { Model.SGGLDB db = Funs.DB; Model.Meeting_MonthMeeting monthMeeting = db.Meeting_MonthMeeting.FirstOrDefault(e => e.MonthMeetingId == monthMeetingId); diff --git a/SGGL/BLL/HSSE/Meeting/SpecialMeetingService.cs b/SGGL/BLL/HSSE/Meeting/SpecialMeetingService.cs index a0f20a69..32d051ef 100644 --- a/SGGL/BLL/HSSE/Meeting/SpecialMeetingService.cs +++ b/SGGL/BLL/HSSE/Meeting/SpecialMeetingService.cs @@ -95,12 +95,43 @@ namespace BLL ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectSpecialMeetingMenuId, specialMeeting.ProjectId, null, specialMeeting.SpecialMeetingId, specialMeeting.CompileDate); } + public static void AddSpecialMeetingForApi(Model.Meeting_SpecialMeeting specialMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_SpecialMeeting newSpecialMeeting = new Model.Meeting_SpecialMeeting + { + SpecialMeetingId = specialMeeting.SpecialMeetingId, + ProjectId = specialMeeting.ProjectId, + UnitId = specialMeeting.UnitId, + SpecialMeetingCode = specialMeeting.SpecialMeetingCode, + SpecialMeetingName = specialMeeting.SpecialMeetingName, + SpecialMeetingDate = specialMeeting.SpecialMeetingDate, + CompileMan = specialMeeting.CompileMan, + SpecialMeetingContents = specialMeeting.SpecialMeetingContents, + CompileDate = specialMeeting.CompileDate, + States = specialMeeting.States, + AttentPersonNum = specialMeeting.AttentPersonNum, + MeetingHours = specialMeeting.MeetingHours, + MeetingHostMan = specialMeeting.MeetingHostMan, + AttentPerson = specialMeeting.AttentPerson, + MeetingPlace = specialMeeting.MeetingPlace, + MeetingHostManId = specialMeeting.MeetingHostManId, + AttentPersonIds = specialMeeting.AttentPersonIds, + MeetingHostManOther = specialMeeting.MeetingHostManOther + }; + db.Meeting_SpecialMeeting.InsertOnSubmit(newSpecialMeeting); + db.SubmitChanges(); + ////增加一条编码记录 + BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(BLL.Const.ProjectSpecialMeetingMenuId, specialMeeting.ProjectId, null, specialMeeting.SpecialMeetingId, specialMeeting.CompileDate); + } + } - /// - /// 修改专题例会 - /// - /// - public static void UpdateSpecialMeeting(Model.Meeting_SpecialMeeting specialMeeting) + /// + /// 修改专题例会 + /// + /// + public static void UpdateSpecialMeeting(Model.Meeting_SpecialMeeting specialMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_SpecialMeeting newSpecialMeeting = db.Meeting_SpecialMeeting.FirstOrDefault(e => e.SpecialMeetingId == specialMeeting.SpecialMeetingId); @@ -126,12 +157,40 @@ namespace BLL db.SubmitChanges(); } } + public static void UpdateSpecialMeetingForApi(Model.Meeting_SpecialMeeting specialMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_SpecialMeeting newSpecialMeeting = db.Meeting_SpecialMeeting.FirstOrDefault(e => e.SpecialMeetingId == specialMeeting.SpecialMeetingId); + if (newSpecialMeeting != null) + { + //newSpecialMeeting.ProjectId = specialMeeting.ProjectId; + newSpecialMeeting.UnitId = specialMeeting.UnitId; + newSpecialMeeting.SpecialMeetingCode = specialMeeting.SpecialMeetingCode; + newSpecialMeeting.SpecialMeetingName = specialMeeting.SpecialMeetingName; + newSpecialMeeting.SpecialMeetingDate = specialMeeting.SpecialMeetingDate; + newSpecialMeeting.CompileMan = specialMeeting.CompileMan; + newSpecialMeeting.SpecialMeetingContents = specialMeeting.SpecialMeetingContents; + newSpecialMeeting.CompileDate = specialMeeting.CompileDate; + newSpecialMeeting.States = specialMeeting.States; + newSpecialMeeting.AttentPersonNum = specialMeeting.AttentPersonNum; + newSpecialMeeting.MeetingHours = specialMeeting.MeetingHours; + newSpecialMeeting.MeetingHostMan = specialMeeting.MeetingHostMan; + newSpecialMeeting.AttentPerson = specialMeeting.AttentPerson; + newSpecialMeeting.MeetingPlace = specialMeeting.MeetingPlace; + newSpecialMeeting.MeetingHostManId = specialMeeting.MeetingHostManId; + newSpecialMeeting.AttentPersonIds = specialMeeting.AttentPersonIds; + newSpecialMeeting.MeetingHostManOther = specialMeeting.MeetingHostManOther; + db.SubmitChanges(); + } + } + } - /// - /// 根据主键删除专题例会 - /// - /// - public static void DeleteSpecialMeetingById(string specialMeetingId) + /// + /// 根据主键删除专题例会 + /// + /// + public static void DeleteSpecialMeetingById(string specialMeetingId) { Model.SGGLDB db = Funs.DB; Model.Meeting_SpecialMeeting spcialMeeting = db.Meeting_SpecialMeeting.FirstOrDefault(e => e.SpecialMeetingId == specialMeetingId); diff --git a/SGGL/BLL/HSSE/Meeting/WeekMeetingService.cs b/SGGL/BLL/HSSE/Meeting/WeekMeetingService.cs index a27a40cf..f44b25fa 100644 --- a/SGGL/BLL/HSSE/Meeting/WeekMeetingService.cs +++ b/SGGL/BLL/HSSE/Meeting/WeekMeetingService.cs @@ -95,12 +95,42 @@ namespace BLL ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectWeekMeetingMenuId, weekMeeting.ProjectId, null, weekMeeting.WeekMeetingId, weekMeeting.CompileDate); } - - /// - /// 修改周例会 - /// - /// - public static void UpdateWeekMeeting(Model.Meeting_WeekMeeting weekMeeting) + public static void AddWeekMeetingForApi(Model.Meeting_WeekMeeting weekMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Meeting_WeekMeeting newWeekMeeting = new Model.Meeting_WeekMeeting + { + WeekMeetingId = weekMeeting.WeekMeetingId, + ProjectId = weekMeeting.ProjectId, + UnitId = weekMeeting.UnitId, + WeekMeetingCode = weekMeeting.WeekMeetingCode, + WeekMeetingName = weekMeeting.WeekMeetingName, + WeekMeetingDate = weekMeeting.WeekMeetingDate, + CompileMan = weekMeeting.CompileMan, + WeekMeetingContents = weekMeeting.WeekMeetingContents, + CompileDate = weekMeeting.CompileDate, + States = weekMeeting.States, + AttentPersonNum = weekMeeting.AttentPersonNum, + MeetingHours = weekMeeting.MeetingHours, + MeetingHostMan = weekMeeting.MeetingHostMan, + AttentPerson = weekMeeting.AttentPerson, + MeetingPlace = weekMeeting.MeetingPlace, + MeetingHostManId = weekMeeting.MeetingHostManId, + AttentPersonIds = weekMeeting.AttentPersonIds, + MeetingHostManOther = weekMeeting.MeetingHostManOther + }; + db.Meeting_WeekMeeting.InsertOnSubmit(newWeekMeeting); + db.SubmitChanges(); + ////增加一条编码记录 + BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(BLL.Const.ProjectWeekMeetingMenuId, weekMeeting.ProjectId, null, weekMeeting.WeekMeetingId, weekMeeting.CompileDate); + } + } + /// + /// 修改周例会 + /// + /// + public static void UpdateWeekMeeting(Model.Meeting_WeekMeeting weekMeeting) { Model.SGGLDB db = Funs.DB; Model.Meeting_WeekMeeting newWeekMeeting = db.Meeting_WeekMeeting.FirstOrDefault(e => e.WeekMeetingId == weekMeeting.WeekMeetingId); @@ -126,12 +156,41 @@ namespace BLL db.SubmitChanges(); } } + public static void UpdateWeekMeetingForApi(Model.Meeting_WeekMeeting weekMeeting) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { - /// - /// 根据主键删除周例会 - /// - /// - public static void DeleteWeekMeetingById(string weekMeetingId) + Model.Meeting_WeekMeeting newWeekMeeting = db.Meeting_WeekMeeting.FirstOrDefault(e => e.WeekMeetingId == weekMeeting.WeekMeetingId); + if (newWeekMeeting != null) + { + //newWeekMeeting.ProjectId = weekMeeting.ProjectId; + newWeekMeeting.UnitId = weekMeeting.UnitId; + newWeekMeeting.WeekMeetingCode = weekMeeting.WeekMeetingCode; + newWeekMeeting.WeekMeetingName = weekMeeting.WeekMeetingName; + newWeekMeeting.WeekMeetingDate = weekMeeting.WeekMeetingDate; + newWeekMeeting.CompileMan = weekMeeting.CompileMan; + newWeekMeeting.WeekMeetingContents = weekMeeting.WeekMeetingContents; + newWeekMeeting.CompileDate = weekMeeting.CompileDate; + newWeekMeeting.States = weekMeeting.States; + newWeekMeeting.AttentPersonNum = weekMeeting.AttentPersonNum; + newWeekMeeting.MeetingHours = weekMeeting.MeetingHours; + newWeekMeeting.MeetingHostMan = weekMeeting.MeetingHostMan; + newWeekMeeting.AttentPerson = weekMeeting.AttentPerson; + newWeekMeeting.MeetingPlace = weekMeeting.MeetingPlace; + newWeekMeeting.MeetingHostManId = weekMeeting.MeetingHostManId; + newWeekMeeting.AttentPersonIds = weekMeeting.AttentPersonIds; + newWeekMeeting.MeetingHostManOther = weekMeeting.MeetingHostManOther; + db.SubmitChanges(); + } + } + } + + /// + /// 根据主键删除周例会 + /// + /// + public static void DeleteWeekMeetingById(string weekMeetingId) { Model.SGGLDB db = Funs.DB; Model.Meeting_WeekMeeting weekMeeting = db.Meeting_WeekMeeting.FirstOrDefault(e => e.WeekMeetingId == weekMeetingId); diff --git a/SGGL/BLL/HSSE/QualityAudit/EquipmentQualityService.cs b/SGGL/BLL/HSSE/QualityAudit/EquipmentQualityService.cs index 58ff34f1..5a7bd429 100644 --- a/SGGL/BLL/HSSE/QualityAudit/EquipmentQualityService.cs +++ b/SGGL/BLL/HSSE/QualityAudit/EquipmentQualityService.cs @@ -67,12 +67,42 @@ namespace BLL db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.EquipmentQualityMenuId, equipmentQuality.ProjectId, null, equipmentQuality.EquipmentQualityId, equipmentQuality.CompileDate); } + public static void AddEquipmentQualityForApi(Model.QualityAudit_EquipmentQuality equipmentQuality) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { - /// - /// 修改特殊机具设备资质 - /// - /// - public static void UpdateEquipmentQuality(Model.QualityAudit_EquipmentQuality equipmentQuality) + Model.QualityAudit_EquipmentQuality newEquipmentQuality = new Model.QualityAudit_EquipmentQuality + { + EquipmentQualityId = equipmentQuality.EquipmentQualityId, + ProjectId = equipmentQuality.ProjectId, + EquipmentQualityCode = equipmentQuality.EquipmentQualityCode, + UnitId = equipmentQuality.UnitId, + SpecialEquipmentId = equipmentQuality.SpecialEquipmentId, + EquipmentQualityName = equipmentQuality.EquipmentQualityName, + SizeModel = equipmentQuality.SizeModel, + FactoryCode = equipmentQuality.FactoryCode, + CertificateCode = equipmentQuality.CertificateCode, + CheckDate = equipmentQuality.CheckDate, + LimitDate = equipmentQuality.LimitDate, + InDate = equipmentQuality.InDate, + OutDate = equipmentQuality.OutDate, + ApprovalPerson = equipmentQuality.ApprovalPerson, + CarNum = equipmentQuality.CarNum, + Remark = equipmentQuality.Remark, + CompileMan = equipmentQuality.CompileMan, + CompileDate = equipmentQuality.CompileDate + }; + db.QualityAudit_EquipmentQuality.InsertOnSubmit(newEquipmentQuality); + db.SubmitChanges(); + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.EquipmentQualityMenuId, equipmentQuality.ProjectId, null, equipmentQuality.EquipmentQualityId, equipmentQuality.CompileDate); + } + } + /// + /// 修改特殊机具设备资质 + /// + /// + public static void UpdateEquipmentQuality(Model.QualityAudit_EquipmentQuality equipmentQuality) { Model.SGGLDB db = Funs.DB; Model.QualityAudit_EquipmentQuality newEquipmentQuality = db.QualityAudit_EquipmentQuality.FirstOrDefault(e => e.EquipmentQualityId == equipmentQuality.EquipmentQualityId); @@ -99,12 +129,40 @@ namespace BLL db.SubmitChanges(); } } - - /// - /// 根据主键删除特殊机具设备资质 - /// - /// - public static void DeleteEquipmentQualityById(string equipmentQualityId) + public static void UpdateEquipmentQualityForApi(Model.QualityAudit_EquipmentQuality equipmentQuality) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.QualityAudit_EquipmentQuality newEquipmentQuality = db.QualityAudit_EquipmentQuality.FirstOrDefault(e => e.EquipmentQualityId == equipmentQuality.EquipmentQualityId); + if (newEquipmentQuality != null) + { + newEquipmentQuality.ProjectId = equipmentQuality.ProjectId; + newEquipmentQuality.EquipmentQualityCode = equipmentQuality.EquipmentQualityCode; + newEquipmentQuality.UnitId = equipmentQuality.UnitId; + newEquipmentQuality.SpecialEquipmentId = equipmentQuality.SpecialEquipmentId; + newEquipmentQuality.EquipmentQualityName = equipmentQuality.EquipmentQualityName; + newEquipmentQuality.SizeModel = equipmentQuality.SizeModel; + newEquipmentQuality.FactoryCode = equipmentQuality.FactoryCode; + newEquipmentQuality.CertificateCode = equipmentQuality.CertificateCode; + newEquipmentQuality.CheckDate = equipmentQuality.CheckDate; + newEquipmentQuality.LimitDate = equipmentQuality.LimitDate; + newEquipmentQuality.InDate = equipmentQuality.InDate; + newEquipmentQuality.OutDate = equipmentQuality.OutDate; + newEquipmentQuality.ApprovalPerson = equipmentQuality.ApprovalPerson; + newEquipmentQuality.CarNum = equipmentQuality.CarNum; + newEquipmentQuality.Remark = equipmentQuality.Remark; + newEquipmentQuality.CompileMan = equipmentQuality.CompileMan; + newEquipmentQuality.CompileDate = equipmentQuality.CompileDate; + newEquipmentQuality.QRCodeAttachUrl = equipmentQuality.QRCodeAttachUrl; + db.SubmitChanges(); + } + } + } + /// + /// 根据主键删除特殊机具设备资质 + /// + /// + public static void DeleteEquipmentQualityById(string equipmentQualityId) { Model.SGGLDB db = Funs.DB; Model.QualityAudit_EquipmentQuality equipmentQuality = db.QualityAudit_EquipmentQuality.FirstOrDefault(e => e.EquipmentQualityId == equipmentQualityId); diff --git a/SGGL/BLL/HSSE/SitePerson/PersonService.cs b/SGGL/BLL/HSSE/SitePerson/PersonService.cs index a3d87601..11f06e8a 100644 --- a/SGGL/BLL/HSSE/SitePerson/PersonService.cs +++ b/SGGL/BLL/HSSE/SitePerson/PersonService.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using FineUIPro; +using Model; namespace BLL { @@ -125,14 +126,27 @@ namespace BLL name = getp.PersonName; } return name; - } + } + public static string GetPersonNameByIdForApi(string personId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string name = string.Empty; + var getp = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId); + if (getp != null) + { + name = getp.PersonName; + } + return name; + } + } - /// - /// 根据UserId主键获取人员信息 - /// - /// - /// - public static string GetPersonIdByUserId(string userId) + /// + /// 根据UserId主键获取人员信息 + /// + /// + /// + public static string GetPersonIdByUserId(string userId) { string personId = userId; var getPerson = GetPersonById(userId); @@ -151,13 +165,35 @@ namespace BLL return personId; } + public static string GetPersonIdByUserIdForApi(string userId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string personId = userId; + var getPerson = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == userId); + if (getPerson == null) + { + var getUser = db.Sys_User.FirstOrDefault(e => e.UserId == userId); + if (getUser != null) + { + getPerson = db.SitePerson_Person.FirstOrDefault(e => e.IdentityCard == getUser.IdentityCard); + if (getPerson != null) + { + personId = getPerson.PersonId; + } + } + } - /// - /// 根据UserId主键获取人员信息 - /// - /// - /// - public static Model.SitePerson_Person GetPersonByUserId(string userId, string projectId) + return personId; + } + } + + /// + /// 根据UserId主键获取人员信息 + /// + /// + /// + public static Model.SitePerson_Person GetPersonByUserId(string userId, string projectId) { var getPerson = GetPersonById(userId); if (getPerson == null) diff --git a/SGGL/BLL/HSSE/Solution/ConstructSolutionService.cs b/SGGL/BLL/HSSE/Solution/ConstructSolutionService.cs index a655086f..5c781492 100644 --- a/SGGL/BLL/HSSE/Solution/ConstructSolutionService.cs +++ b/SGGL/BLL/HSSE/Solution/ConstructSolutionService.cs @@ -78,12 +78,40 @@ namespace BLL CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectConstructSolutionMenuId, constructSolution.ProjectId, null, constructSolution.ConstructSolutionId, constructSolution.CompileDate); } } - - /// - /// 修改施工方案/审查 - /// - /// - public static void UpdateConstructSolution(Model.Solution_ConstructSolution constructSolution) + public static void AddConstructSolutionForApi(Model.Solution_ConstructSolution constructSolution) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Solution_ConstructSolution newConstructSolution = new Model.Solution_ConstructSolution + { + ConstructSolutionId = constructSolution.ConstructSolutionId, + ProjectId = constructSolution.ProjectId, + ConstructSolutionCode = constructSolution.ConstructSolutionCode, + ConstructSolutionName = constructSolution.ConstructSolutionName, + VersionNo = constructSolution.VersionNo, + UnitId = constructSolution.UnitId, + InvestigateType = constructSolution.InvestigateType, + SolutinType = constructSolution.SolutinType, + FileContents = constructSolution.FileContents, + Remark = constructSolution.Remark, + CompileMan = constructSolution.CompileMan, + CompileManName = constructSolution.CompileManName, + CompileDate = constructSolution.CompileDate, + States = constructSolution.States + }; + db.Solution_ConstructSolution.InsertOnSubmit(newConstructSolution); + db.SubmitChanges(); + if (constructSolution.ConstructSolutionCode == BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectConstructSolutionMenuId, constructSolution.ProjectId, null)) + { + CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(Const.ProjectConstructSolutionMenuId, constructSolution.ProjectId, null, constructSolution.ConstructSolutionId, constructSolution.CompileDate); + } + } + } + /// + /// 修改施工方案/审查 + /// + /// + public static void UpdateConstructSolution(Model.Solution_ConstructSolution constructSolution) { Model.SGGLDB db = Funs.DB; Model.Solution_ConstructSolution newConstructSolution = db.Solution_ConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId); @@ -109,12 +137,55 @@ namespace BLL } } } + public static void UpdateConstructSolutionForApi(Model.Solution_ConstructSolution constructSolution) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Solution_ConstructSolution newConstructSolution = db.Solution_ConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId); + if (newConstructSolution != null) + { + newConstructSolution.ConstructSolutionName = constructSolution.ConstructSolutionName; + newConstructSolution.VersionNo = constructSolution.VersionNo; + newConstructSolution.UnitId = constructSolution.UnitId; + newConstructSolution.InvestigateType = constructSolution.InvestigateType; + newConstructSolution.SolutinType = constructSolution.SolutinType; + newConstructSolution.FileContents = constructSolution.FileContents; + newConstructSolution.Remark = constructSolution.Remark; + newConstructSolution.States = constructSolution.States; + if (!string.IsNullOrEmpty(constructSolution.QRCodeAttachUrl)) + { + newConstructSolution.QRCodeAttachUrl = constructSolution.QRCodeAttachUrl; + } - /// - /// 根据主键删除施工方案/审查 - /// - /// - public static void DeleteConstructSolutionById(string constructSolutionId) + db.SubmitChanges(); + string code = string.Empty; + var codeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == constructSolution.ConstructSolutionId); + if (codeRecords != null) + { + code = codeRecords.Code; + } + + if (constructSolution.ConstructSolutionCode != code) + { + var codeRecords1 = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == constructSolution.ConstructSolutionId); + if (codeRecords1 != null) + { + ///删除文件柜A中数据 + // BLL.FileCabinetAItemService.DeleteFileCabinetAItemByID(dataId); + db.Sys_CodeRecords.DeleteOnSubmit(codeRecords1); + db.SubmitChanges(); + } + + } + } + } + } + + /// + /// 根据主键删除施工方案/审查 + /// + /// + public static void DeleteConstructSolutionById(string constructSolutionId) { Model.SGGLDB db = Funs.DB; Model.Solution_ConstructSolution constructSolution = db.Solution_ConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolutionId); diff --git a/SGGL/BLL/HSSE/Solution/HSSEConstructSolutionService.cs b/SGGL/BLL/HSSE/Solution/HSSEConstructSolutionService.cs index 06b22c20..1ec48dbc 100644 --- a/SGGL/BLL/HSSE/Solution/HSSEConstructSolutionService.cs +++ b/SGGL/BLL/HSSE/Solution/HSSEConstructSolutionService.cs @@ -37,24 +37,26 @@ namespace BLL public static void DeleteConstructSolution(string constructSolutionId) { Model.SGGLDB db = Funs.DB; - Model.Solution_HSSEConstructSolution constructSolution = db.Solution_HSSEConstructSolution.First(e => e.ConstructSolutionId == constructSolutionId); + Model.Solution_HSSEConstructSolution constructSolution = db.Solution_HSSEConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolutionId); db.Solution_HSSEConstructSolution.DeleteOnSubmit(constructSolution); db.SubmitChanges(); } - /// - /// 根据方案审查Id删除一个方案审查信息 - /// - /// 方案审查Id - public static void DeleteConstructSolutionByCQMSConstructSolutionId(string CQMSConstructSolutionId) - { - Model.SGGLDB db = Funs.DB; - Model.Solution_HSSEConstructSolution constructSolution = db.Solution_HSSEConstructSolution.First(e => e.CQMSConstructSolutionId == CQMSConstructSolutionId); - - db.Solution_HSSEConstructSolution.DeleteOnSubmit(constructSolution); - db.SubmitChanges(); - } + /// + /// 根据方案审查Id删除一个方案审查信息 + /// + /// 方案审查Id + public static void DeleteConstructSolutionByCQMSConstructSolutionId(string CQMSConstructSolutionId) + { + Model.SGGLDB db = Funs.DB; + Model.Solution_HSSEConstructSolution constructSolution = db.Solution_HSSEConstructSolution.FirstOrDefault(e => e.CQMSConstructSolutionId == CQMSConstructSolutionId); + if (constructSolution != null) + { + db.Solution_HSSEConstructSolution.DeleteOnSubmit(constructSolution); + db.SubmitChanges(); + } + } /// /// 增加方案审查信息 diff --git a/SGGL/BLL/PZHGL/InformationProject/ReceiveFileManagerService.cs b/SGGL/BLL/PZHGL/InformationProject/ReceiveFileManagerService.cs index 58a020ae..5c044021 100644 --- a/SGGL/BLL/PZHGL/InformationProject/ReceiveFileManagerService.cs +++ b/SGGL/BLL/PZHGL/InformationProject/ReceiveFileManagerService.cs @@ -81,12 +81,34 @@ namespace BLL db.SubmitChanges(); } } + public static void UpdateReceiveFileManagerForApi(Model.InformationProject_ReceiveFileManager ReceiveFileManager) + { + Model.SGGLDB db = Funs.DB; + Model.InformationProject_ReceiveFileManager newReceiveFileManager = db.InformationProject_ReceiveFileManager.FirstOrDefault(e => e.ReceiveFileManagerId == ReceiveFileManager.ReceiveFileManagerId); + if (newReceiveFileManager != null) + { + // newReceiveFileManager.ReceiveFileCode = ReceiveFileManager.ReceiveFileCode; + newReceiveFileManager.ReceiveFileName = ReceiveFileManager.ReceiveFileName; + newReceiveFileManager.Version = ReceiveFileManager.Version; + newReceiveFileManager.FileUnitId = ReceiveFileManager.FileUnitId; + newReceiveFileManager.FileCode = ReceiveFileManager.FileCode; + newReceiveFileManager.FilePageNum = ReceiveFileManager.FilePageNum; + newReceiveFileManager.GetFileDate = ReceiveFileManager.GetFileDate; + newReceiveFileManager.SendPersonId = ReceiveFileManager.SendPersonId; + newReceiveFileManager.MainContent = ReceiveFileManager.MainContent; + newReceiveFileManager.AttachUrl = ReceiveFileManager.AttachUrl; + newReceiveFileManager.States = ReceiveFileManager.States; + newReceiveFileManager.UnitIds = ReceiveFileManager.UnitIds; + newReceiveFileManager.FileType = ReceiveFileManager.FileType; + db.SubmitChanges(); + } + } - /// - /// 根据主键删除一般来文 - /// - /// - public static void DeleteReceiveFileManagerById(string ReceiveFileManagerId) + /// + /// 根据主键删除一般来文 + /// + /// + public static void DeleteReceiveFileManagerById(string ReceiveFileManagerId) { Model.SGGLDB db = Funs.DB; Model.InformationProject_ReceiveFileManager ReceiveFileManager = db.InformationProject_ReceiveFileManager.FirstOrDefault(e => e.ReceiveFileManagerId == ReceiveFileManagerId); diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs index 63fb4838..e745becc 100644 --- a/SGGL/BLL/ProjectData/ProjectService.cs +++ b/SGGL/BLL/ProjectData/ProjectService.cs @@ -45,12 +45,24 @@ } return name; } - - /// - ///根据ID获取项目编号 - /// - /// - public static string GetProjectCodeByProjectId(string projectId) + public static string GetProjectNameByProjectIdForApi(string projectId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string name = string.Empty; + var project =db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); + if (project != null) + { + name = project.ProjectName; + } + return name; + } + } + /// + ///根据ID获取项目编号 + /// + /// + public static string GetProjectCodeByProjectId(string projectId) { string name = string.Empty; var project = Funs.DB.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); diff --git a/SGGL/BLL/ProjectData/ProjectUnitService.cs b/SGGL/BLL/ProjectData/ProjectUnitService.cs index 947ed3ff..73f064a3 100644 --- a/SGGL/BLL/ProjectData/ProjectUnitService.cs +++ b/SGGL/BLL/ProjectData/ProjectUnitService.cs @@ -142,14 +142,33 @@ return isShow; } + public static bool GetProjectUnitTypeByProjectIdUnitIdForApi(string projectId, string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + bool isShow = false; + if (unitId != Const.UnitId_CD) + { + var pUnit = db.Project_ProjectUnit.FirstOrDefault(e => e.ProjectId == projectId && e.UnitId == unitId); + if (pUnit != null) + { + if (pUnit.UnitType == Const.ProjectUnitType_2 || pUnit.UnitType == Const.ProjectUnitType_0) + { + isShow = true; + } + } + } - #region 项目类型单位表下拉框 - /// - /// 项目类型单位表下拉框 - /// - /// 下拉框名字 - /// 是否显示请选择 - public static void InitUnitDropDownList(FineUIPro.DropDownList dropName, string projectId, string unitType, bool isShowPlease) + return isShow; + } + } + #region 项目类型单位表下拉框 + /// + /// 项目类型单位表下拉框 + /// + /// 下拉框名字 + /// 是否显示请选择 + public static void InitUnitDropDownList(FineUIPro.DropDownList dropName, string projectId, string unitType, bool isShowPlease) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { diff --git a/SGGL/BLL/ProjectData/UnitWorkService.cs b/SGGL/BLL/ProjectData/UnitWorkService.cs index 88155444..78ace5c5 100644 --- a/SGGL/BLL/ProjectData/UnitWorkService.cs +++ b/SGGL/BLL/ProjectData/UnitWorkService.cs @@ -482,15 +482,39 @@ namespace BLL } } return unitWorkName; - } + } + public static string GetUnitWorkNameForApi(string unitWorkIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string unitWorkName = string.Empty; + if (!string.IsNullOrEmpty(unitWorkIds)) + { + string[] strs = unitWorkIds.Split(','); + foreach (var item in strs) + { + var un = db.WBS_UnitWork.FirstOrDefault(e => e.UnitWorkId == item); + if (un != null) + { + unitWorkName += un.UnitWorkName + GetProjectType(un.ProjectType) + ","; + } + } + if (!string.IsNullOrEmpty(unitWorkName)) + { + unitWorkName = unitWorkName.Substring(0, unitWorkName.LastIndexOf(",")); + } + } + return unitWorkName; + } + } - /// - /// 获取单位工程下拉列表 - /// - /// - /// - /// - public static void InitUnitWorkDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease) + /// + /// 获取单位工程下拉列表 + /// + /// + /// + /// + public static void InitUnitWorkDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease) { var unitWorks = from x in Funs.DB.WBS_UnitWork where x.ProjectId == projectId && x.SuperUnitWork == null diff --git a/SGGL/BLL/ProjectData/WorkAreaService.cs b/SGGL/BLL/ProjectData/WorkAreaService.cs index 21d76178..47ae940b 100644 --- a/SGGL/BLL/ProjectData/WorkAreaService.cs +++ b/SGGL/BLL/ProjectData/WorkAreaService.cs @@ -282,15 +282,28 @@ namespace BLL name = WorkArea.WorkAreaCode; } return name; - } + } + public static string GetWorkAreaCodeByWorkAreaIdForApi(string workAreaId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string name = string.Empty; + var WorkArea =db.ProjectData_WorkArea.FirstOrDefault(x => x.WorkAreaId == workAreaId); + if (WorkArea != null) + { + name = WorkArea.WorkAreaCode; + } + return name; + } + } - /// - /// 根据项目ID、装置Id、单位ID获取班组下拉选择项 - /// - /// - /// - /// - public static object GetWorkAreaListByInstallUnitId(string projectId, string installId, string unitId) + /// + /// 根据项目ID、装置Id、单位ID获取班组下拉选择项 + /// + /// + /// + /// + public static object GetWorkAreaListByInstallUnitId(string projectId, string installId, string unitId) { return (from x in Funs.DB.ProjectData_WorkArea where x.ProjectId == projectId && x.InstallationId == installId && x.UnitId == unitId diff --git a/SGGL/BLL/SysManage/DepartService.cs b/SGGL/BLL/SysManage/DepartService.cs index a7e0b694..5ad4c5be 100644 --- a/SGGL/BLL/SysManage/DepartService.cs +++ b/SGGL/BLL/SysManage/DepartService.cs @@ -99,14 +99,27 @@ namespace BLL } return name; } + public static string getDepartNameByIdForApi(string departId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string name = string.Empty; + var dep = db.Base_Depart.FirstOrDefault(e => e.DepartId == departId); + if (dep != null) + { + name = dep.DepartName; + } + return name; + } + } - #region 表下拉框 - /// - /// 表下拉框 - /// - /// 下拉框名字 - /// 是否显示请选择 - public static void InitDepartDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) + #region 表下拉框 + /// + /// 表下拉框 + /// + /// 下拉框名字 + /// 是否显示请选择 + public static void InitDepartDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease) { dropName.DataValueField = "DepartId"; dropName.DataTextField = "DepartName"; diff --git a/SGGL/BLL/SysManage/RoleService.cs b/SGGL/BLL/SysManage/RoleService.cs index c34428ff..aa94ef85 100644 --- a/SGGL/BLL/SysManage/RoleService.cs +++ b/SGGL/BLL/SysManage/RoleService.cs @@ -170,14 +170,38 @@ return roleName; } + public static string getRoleNamesRoleIdsForApi(object roleIds) + { + string roleName = string.Empty; + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + if (roleIds != null) + { + string[] roles = roleIds.ToString().Split(','); + foreach (string roleId in roles) + { + var q = db.Sys_Role.FirstOrDefault(x => x.RoleId == roleId); + if (q != null && !roleName.Contains(q.RoleName)) + { + roleName += q.RoleName + ","; + } + } + if (roleName != string.Empty) + { + roleName = roleName.Substring(0, roleName.Length - 1); ; + } + } + } + return roleName; + } - /// - /// 角色下拉框 - /// - /// 下拉框名字 - /// 项目id - /// 是否显示请选择 - public static void InitRoleDropDownList(FineUIPro.DropDownList dropName, string roleId, bool? isOffice, bool isShowPlease) + /// + /// 角色下拉框 + /// + /// 下拉框名字 + /// 项目id + /// 是否显示请选择 + public static void InitRoleDropDownList(FineUIPro.DropDownList dropName, string roleId, bool? isOffice, bool isShowPlease) { dropName.DataValueField = "RoleId"; dropName.DataTextField = "RoleName"; diff --git a/SGGL/BLL/SysManage/SysConstSetService.cs b/SGGL/BLL/SysManage/SysConstSetService.cs index 57e847fe..d83ad083 100644 --- a/SGGL/BLL/SysManage/SysConstSetService.cs +++ b/SGGL/BLL/SysManage/SysConstSetService.cs @@ -126,14 +126,27 @@ } return passScore; } + public static int getPassScoreForApi() + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int passScore = 80; + var testRule = db.Sys_TestRule.FirstOrDefault(); + if (testRule != null) + { + passScore = testRule.PassingScore; + } + return passScore; + } + } - #region 菜单编码模板 - /// - /// 获取菜单编码模板信息 根据MenuId - /// - /// - /// - public static Model.Sys_CodeTemplateRule GetCodeTemplateRuleByMenuId(string menuId) + #region 菜单编码模板 + /// + /// 获取菜单编码模板信息 根据MenuId + /// + /// + /// + public static Model.Sys_CodeTemplateRule GetCodeTemplateRuleByMenuId(string menuId) { return Funs.DB.Sys_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId); } diff --git a/SGGL/BLL/SysManage/UnitService.cs b/SGGL/BLL/SysManage/UnitService.cs index 37eaa7de..97a5b649 100644 --- a/SGGL/BLL/SysManage/UnitService.cs +++ b/SGGL/BLL/SysManage/UnitService.cs @@ -1,4 +1,5 @@ -using System; +using NPOI.Util; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -331,8 +332,22 @@ namespace BLL name = unit.UnitName; } return name; - } - public static string GetUnitNameByUnitId(object unitId) + } + public static string GetUnitNameByUnitIdForApi(string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + + string name = string.Empty; + var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId); + if (unit != null) + { + name = unit.UnitName; + } + return name; + } + } + public static string GetUnitNameByUnitId(object unitId) { string name = string.Empty; if (unitId != null) @@ -391,14 +406,26 @@ namespace BLL } return code; } - - #region 单位表下拉框 - /// - /// 单位表下拉框 - /// - /// 下拉框名字 - /// 是否显示请选择 - public static void InitUnitDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease) + public static string GetUnitCodeByUnitIdForApi(string unitId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string code = string.Empty; + var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId); + if (unit != null) + { + code = unit.UnitCode; + } + return code; + } + } + #region 单位表下拉框 + /// + /// 单位表下拉框 + /// + /// 下拉框名字 + /// 是否显示请选择 + public static void InitUnitDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease) { dropName.DataValueField = "UnitId"; dropName.DataTextField = "UnitName"; @@ -645,14 +672,39 @@ namespace BLL return unitName; } - #endregion + public static string getUnitNamesUnitIdsForApi(object unitIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string unitName = string.Empty; + if (unitIds != null) + { + string[] ids = unitIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Base_Unit.FirstOrDefault(x => x.UnitId == id) ; + if (q != null) + { + unitName += q.UnitName + ","; + } + } + if (unitName != string.Empty) + { + unitName = unitName.Substring(0, unitName.Length - 1); ; + } + } - /// - /// 根据项目Id获取总包和分包单位名称项 - /// - /// 项目Id - /// - public static ListItem[] drpMainOrSubUnitList(string projectId) + return unitName; + } + } + #endregion + + /// + /// 根据项目Id获取总包和分包单位名称项 + /// + /// 项目Id + /// + public static ListItem[] drpMainOrSubUnitList(string projectId) { var q = (from x in Funs.DB.Project_ProjectUnit join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId diff --git a/SGGL/BLL/SysManage/UserService.cs b/SGGL/BLL/SysManage/UserService.cs index 6453e295..a3aae576 100644 --- a/SGGL/BLL/SysManage/UserService.cs +++ b/SGGL/BLL/SysManage/UserService.cs @@ -160,13 +160,26 @@ namespace BLL return userName; } + public static string GetUserNameByUserIdForApi(string userId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string userName = string.Empty; + Model.Sys_User user = db.Sys_User.FirstOrDefault(e => e.UserId == userId); + if (user != null) + { + userName = user.UserName; + } - /// - /// ûȡû - /// - /// - /// - public static string GetUserNameAndTelByUserId(string userId) + return userName; + } + } + /// + /// ûȡû + /// + /// + /// + public static string GetUserNameAndTelByUserId(string userId) { string userName = string.Empty; Model.Sys_User user = Funs.DB.Sys_User.FirstOrDefault(e => e.UserId == userId); @@ -1322,16 +1335,41 @@ namespace BLL } return userName; - } - #endregion + } + public static string getUserNamesUserIdsForApi(object userIds) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + string userName = string.Empty; + if (userIds != null) + { + string[] ids = userIds.ToString().Split(','); + foreach (string id in ids) + { + var q = db.Sys_User.FirstOrDefault(e => e.UserId == id); + if (q != null) + { + userName += q.UserName + ","; + } + } + if (userName != string.Empty) + { + userName = userName.Substring(0, userName.Length - 1); ; + } + } - /// - /// - /// - /// - /// - /// - public static List GetProjectUserListByProjectIdForApi(string projectId, string name) + return userName; + } + } + #endregion + + /// + /// + /// + /// + /// + /// + public static List GetProjectUserListByProjectIdForApi(string projectId, string name) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { diff --git a/SGGL/FineUIPro.Web/CQMS/Check/Draw.aspx b/SGGL/FineUIPro.Web/CQMS/Check/Draw.aspx index 2496530e..0beb0d19 100644 --- a/SGGL/FineUIPro.Web/CQMS/Check/Draw.aspx +++ b/SGGL/FineUIPro.Web/CQMS/Check/Draw.aspx @@ -22,7 +22,7 @@ diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt index 2190b3a0..9b9029b0 100644 --- a/SGGL/FineUIPro.Web/ErrLog.txt +++ b/SGGL/FineUIPro.Web/ErrLog.txt @@ -597,3 +597,140 @@ IP地址:::1 出错时间:07/01/2023 14:46:08 + +错误信息开始=====> +错误类型:InvalidOperationException +错误信息:序列不包含任何元素 +错误堆栈: + 在 System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) + 在 System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) + 在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) + 在 System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute[TResult](Expression expression) + 在 System.Linq.Queryable.First[TSource](IQueryable`1 source, Expression`1 predicate) + 在 BLL.HSSEConstructSolutionService.DeleteConstructSolutionByCQMSConstructSolutionId(String CQMSConstructSolutionId) 位置 D:\project\vs\sggl_cd\SGGL\BLL\HSSE\Solution\HSSEConstructSolutionService.cs:行号 53 + 在 FineUIPro.Web.CQMS.Solution.ConstructSolution.btnMenuDel_Click(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\CQMS\Solution\ConstructSolution.aspx.cs:行号 852 + 在 FineUIPro.MenuButton.OnClick(EventArgs e) + 在 (MenuButton , EventArgs ) + 在 FineUIPro.MenuButton.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:07/04/2023 15:36:22 +出错文件:http://localhost:1295/CQMS/Solution/ConstructSolution.aspx +IP地址:::1 +操作人员:JT + +出错时间:07/04/2023 15:36:22 + + +错误信息开始=====> +错误类型:InvalidOperationException +错误信息:序列不包含任何元素 +错误堆栈: + 在 System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) + 在 System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) + 在 System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) + 在 System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute[TResult](Expression expression) + 在 System.Linq.Queryable.First[TSource](IQueryable`1 source, Expression`1 predicate) + 在 BLL.HSSEConstructSolutionService.DeleteConstructSolutionByCQMSConstructSolutionId(String CQMSConstructSolutionId) 位置 D:\project\vs\sggl_cd\SGGL\BLL\HSSE\Solution\HSSEConstructSolutionService.cs:行号 53 + 在 FineUIPro.Web.CQMS.Solution.ConstructSolution.btnMenuDel_Click(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\CQMS\Solution\ConstructSolution.aspx.cs:行号 852 + 在 FineUIPro.MenuButton.OnClick(EventArgs e) + 在 (MenuButton , EventArgs ) + 在 FineUIPro.MenuButton.RaisePostBackEvent(String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) + 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:07/04/2023 15:36:36 +出错文件:http://localhost:1295/CQMS/Solution/ConstructSolution.aspx +IP地址:::1 +操作人员:JT + +出错时间:07/04/2023 15:36:36 + + +错误信息开始=====> +错误类型:FormatException +错误信息:索引(从零开始)必须大于或等于零,且小于参数列表的大小。 +错误堆栈: + 在 System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args) + 在 System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args) + 在 System.String.Format(String format, Object arg0) + 在 FineUIPro.HyperLinkField.VQscVYXUOqxsrrrlgEYaXHIhTAZB(GridRow ) + 在 (GridColumn , GridRow ) + 在 FineUIPro.GridRow.BkpgFeAELTFlAvoTrOBrConfcLJbA() + 在 (GridRow ) + 在 FineUIPro.Grid.BkpgFeAELTFlAvoTrOBrConfcLJbA(Int32 , Object ) + 在 (Grid , Int32 , Object ) + 在 FineUIPro.Grid.CRTRkdQFrrBRFQuCddjZPswlTORP(IEnumerable , Boolean ) + 在 (Grid , IEnumerable , Boolean ) + 在 FineUIPro.Grid.DataBind(Boolean keepCurrentData) + 在 (Grid , Boolean ) + 在 FineUIPro.Grid.DataBind() + 在 FineUIPro.Web.AttachFile.webuploader.BindGrid() 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\AttachFile\webuploader.aspx.cs:行号 153 + 在 FineUIPro.Web.AttachFile.webuploader.Page_Load(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\AttachFile\webuploader.aspx.cs:行号 117 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:07/08/2023 17:49:49 +出错文件:http://localhost:1295/AttachFile/webuploader.aspx?type=0&toKeyId=444bf309-526a-4c08-b9e9-76a4f676740b&path=FileUpload/PZHGL/XmsgGlgdUrl/&menuId=90217D8E-D2AC-4B8D-A1A7-A27317890408 +IP地址:::1 +操作人员:JT + +出错时间:07/08/2023 17:49:49 + + +错误信息开始=====> +错误类型:NullReferenceException +错误信息:未将对象引用设置到对象的实例。 +错误堆栈: + 在 FineUIPro.Web.HSSE.HiddenInspection.HiddenRectificationList.GetButtonPower() 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\HSSE\HiddenInspection\HiddenRectificationList.aspx.cs:行号 826 + 在 FineUIPro.Web.HSSE.HiddenInspection.HiddenRectificationList.Page_Load(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\HSSE\HiddenInspection\HiddenRectificationList.aspx.cs:行号 44 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:07/09/2023 10:53:56 +出错文件:http://localhost:1295/HSSE/HiddenInspection/HiddenRectificationList.aspx +IP地址:::1 + +出错时间:07/09/2023 10:53:57 + + +错误信息开始=====> +错误类型:SqlException +错误信息:参数化查询 '(@ProjectId nvarchar(4000))select HazardList.HazardListId,Hazard' 需要参数 '@ProjectId',但未提供该参数。 +错误堆栈: + 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) + 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) + 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) + 在 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) + 在 System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() + 在 System.Data.SqlClient.SqlDataReader.get_MetaData() + 在 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) + 在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) + 在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) + 在 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) + 在 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) + 在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) + 在 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) + 在 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) + 在 BLL.SQLHelper.GetDataTableRunText(String strSql, SqlParameter[] parameters) 位置 D:\project\vs\sggl_cd\SGGL\BLL\SQLHelper.cs:行号 311 + 在 FineUIPro.Web.HSSE.Hazard.HazardList.BindGrid() 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\HSSE\Hazard\HazardList.aspx.cs:行号 100 + 在 FineUIPro.Web.HSSE.Hazard.HazardList.Page_Load(Object sender, EventArgs e) 位置 D:\project\vs\sggl_cd\SGGL\FineUIPro.Web\HSSE\Hazard\HazardList.aspx.cs:行号 65 + 在 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) + 在 System.EventHandler.Invoke(Object sender, EventArgs e) + 在 System.Web.UI.Control.OnLoad(EventArgs e) + 在 System.Web.UI.Control.LoadRecursive() + 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +出错时间:07/09/2023 11:29:41 +出错文件:http://localhost:1295/HSSE/Hazard/HazardList.aspx +IP地址:::1 +操作人员:JT + +出错时间:07/09/2023 11:29:41 + diff --git a/SGGL/FineUIPro.Web/HSSE/Hazard/HazardList.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Hazard/HazardList.aspx.cs index df7063d9..b3dde689 100644 --- a/SGGL/FineUIPro.Web/HSSE/Hazard/HazardList.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Hazard/HazardList.aspx.cs @@ -374,7 +374,11 @@ namespace FineUIPro.Web.HSSE.Hazard Response.ContentEncoding = System.Text.Encoding.UTF8; this.Grid1.PageSize = Grid1.RecordCount; this.BindGrid(); + + Response.Write(GetGridTableHtml(Grid1)); + + Response.End(); } diff --git a/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx.cs b/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx.cs index 5a48a72c..7e937d98 100644 --- a/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/HiddenInspection/HiddenRectificationList.aspx.cs @@ -174,12 +174,12 @@ namespace FineUIPro.Web.HSSE.HiddenInspection } if (this.drpStates.SelectedValueArray.Contains("2")) { - strSqlTemp += " ( States in( '2','3') and RectificationPeriod > RectificationTime) OR"; + strSqlTemp += " ( States in( '2','3') and datediff(DAY,RectificationPeriod,RectificationTime)>0 ) OR"; } if (this.drpStates.SelectedValueArray.Contains("3")) { - strSqlTemp += " (States in( '2','3') and RectificationPeriod < RectificationTime ) OR"; + strSqlTemp += " (States in( '2','3') and datediff(DAY,RectificationPeriod,RectificationTime)<=0 ) OR"; } if (this.drpStates.SelectedValueArray.Contains("4")) @@ -655,15 +655,17 @@ namespace FineUIPro.Web.HSSE.HiddenInspection Model.View_Hazard_HazardRegister registration = (from x in Funs.DB.View_Hazard_HazardRegister where x.HazardRegisterId == registrationId.ToString() select x).FirstOrDefault(); if (registration != null) { - if (registration.States == "1" && registration.RectificationPeriod.Value > DateTime.Now) + DateTime RectificationPeriod = DateTime.Parse(registration.RectificationPeriod.Value.ToString("yyyy-MM-dd")).AddDays(1); + + if (registration.States == "1" && RectificationPeriod > DateTime.Now) { state += "未整改"; } - else if ((registration.States == "2" || registration.States == "3")&& registration.RectificationPeriod.Value>registration.RectificationTime.Value) + else if ((registration.States == "2" || registration.States == "3")&& RectificationPeriod > registration.RectificationTime.Value) { state += "按时整改"; } - else if ((registration.States == "2" || registration.States == "3") && registration.RectificationPeriod.Value < registration.RectificationTime.Value) + else if ((registration.States == "2" || registration.States == "3") && RectificationPeriod <= registration.RectificationTime.Value) { state += "超期整改"; diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index a3fc3189..a09cbf61 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -12,7 +12,7 @@ - +