diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-12.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-12.sql index bea26c75..6349430c 100644 --- a/DataBase/版本日志/SGGLDB_WH_2023-10-12.sql +++ b/DataBase/版本日志/SGGLDB_WH_2023-10-12.sql @@ -21,3 +21,390 @@ alter table PreRun_SubInspectTermItem add SubcontractorIsPass int NULL-- alter table PreRun_SubInspectTermItem add ContractorIsPass int NULL--аǷͨ0/null:δͨ 1:ͨ alter table PreRun_SubInspectTermItem add SupervisionIsPass int NULL--Ƿͨ0/null:δͨ 1:ͨ alter table PreRun_SubInspectTermItem add OwnerIsPass int NULL--ҵǷͨ0/null:δͨ 1:ͨ +GO + + + +--ȡǰ˴ +ALTER PROCEDURE [dbo].[Sp_APP_GetToDoItems] + @projectId NVARCHAR(50)=NULL, + @userId NVARCHAR(200)=NULL +AS +/*ȡǰ˴*/ +BEGIN +SELECT HazardRegisterId AS DataId + ,'B6BE5FE0-CB84-47FF-A6C3-5AD9E1CCE079' AS MenuId + ,'ȫѲ' AS MenuName + ,register.RegisterDef AS Content + ,UserId + ,users.UserName + ,register.RegisterDate AS DataTime + ,CONVERT(varchar(100),register.RegisterDate, 23) AS DataTimeStr + ,'/pagesHSSE/safe/inspecitonconfirm' AS UrlStr +FROM HSSE_Hazard_HazardRegister AS register +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE register.ProjectId=@projectId AND +((register.states = '1' AND (register.ResponsibleMan =@userId OR register.CCManIds LIKE ('%'+@userId+'%') )) +OR (register.states = '2' AND register.CheckManId =@userId)) + +UNION ALL +SELECT PlanId AS DataId + ,'B782A26B-D85C-4F84-8B45-F7AA47B3159E' AS MenuId + ,'ѵƻ' AS MenuName + ,PlanName AS Content + ,UserId + ,users.UserName + ,DesignerDate AS DataTime + ,CONVERT(varchar(100),DesignerDate, 23) AS DataTimeStr + ,'/pagesTest/test/trainindex' AS UrlStr +FROM Training_Plan AS ePlan +LEFT JOIN Sys_User AS users ON ePlan.DesignerId= users.UserId +WHERE (ePlan.ProjectId=@projectId or (@projectId is null and ePlan.ProjectId is null)) + AND (States = '0' OR States = '1' ) AND ePlan.DesignerId =@userId + +UNION ALL +SELECT TestPlanId AS DataId + ,'FAF7F4A4-A4BC-4D94-9E88-0CF5A380DB34' AS MenuId + ,'Լƻ' AS MenuName + ,PlanName AS Content + ,UserId + ,users.UserName + ,PlanDate AS DataTime + ,CONVERT(varchar(100),PlanDate, 23) AS DataTimeStr + ,'/pagesTest/test/testplan' AS UrlStr +FROM Training_TestPlan AS TPlan +LEFT JOIN Sys_User AS users ON users.UserId =TPlan.PlanManId +WHERE (TPlan.ProjectId=@projectId or (@projectId is null and TPlan.ProjectId is null)) + AND (States = '0' OR States = '1' ) AND PlanManId =@userId + +UNION ALL +SELECT TaskId AS DataId + ,'E108F75D-89D0-4DCA-8356-A156C328805C' AS MenuId + ,'ѵ' AS MenuName + ,Plans.PlanName AS Content + ,users.UserId + ,users.UserName + ,TaskDate AS DataTime + ,CONVERT(varchar(100),TaskDate, 23) AS DataTimeStr + ,('/pagesTest/test/taskindex') AS UrlStr +FROM Training_Task AS Task + LEFT JOIN Sys_User AS users ON users.UserId =@userId + LEFT JOIN Training_Plan AS Plans ON Plans.PlanId =Task.PlanId +WHERE (Task.ProjectId=@projectId or (@projectId is null and Task.ProjectId is null)) + AND (Task.States IS NULL OR Task.States != 2) + AND Task.UserId = @userId + +UNION ALL +SELECT TestRecordId AS DataId + ,'0EEB138D-84F9-4686-8CBB-CAEAA6CF1B2A' AS MenuId + ,'ɨ뿼' AS MenuName + ,TestPlan.PlanName AS Content + ,TestRecord.TestManId + ,Person.PersonName + ,TestPlan.TestStartTime AS DataTime + ,CONVERT(varchar(100),TestPlan.TestStartTime, 23) AS DataTimeStr + ,('/pages/temp_index/index') AS UrlStr +FROM Training_TestRecord AS TestRecord +left join Training_TestPlan as TestPlan on TestRecord.TestPlanId = TestPlan.TestPlanId +left join SitePerson_Person as Person on Person.PersonId = TestRecord.TestManId +left join Sys_User as uses on Person.IdentityCard = uses.IdentityCard +WHERE (TestRecord.ProjectId=@projectId or (@projectId is null and TestRecord.ProjectId is null)) +AND TestPlan.States ='1' +AND TestRecord.TestEndTime IS NULL +AND (TestRecord.TestManId = @userId or uses.UserId = @userId) + +UNION ALL +SELECT FireWorkId AS DataId + ,'2E58D4F1-2FF1-450E-8A00-1CE3BBCF8D4B' AS MenuId + ,'ҵ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/dhuo/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_FireWork AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT HeightWorkId AS DataId + ,'DA1CAE8E-B5BF-4AC0-9996-AF6CAA412CA9' AS MenuId + ,'ߴҵ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/gchu/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_HeightWork AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT LimitedSpaceId AS DataId + ,'AEC9166D-1C91-45F0-8BFE-D3D0479A28C7' AS MenuId + ,'޿ռ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/sxkj/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_LimitedSpace AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT RadialWorkId AS DataId + ,'F72FF20B-D3EB-46A5-97F7-C99B2473A140' AS MenuId + ,'ҵ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/sx/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_RadialWork AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT OpenCircuitId AS DataId + ,'4E607E83-41FC-4F49-B26F-A21CFE38328F' AS MenuId + ,'·(ռ)' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/dlu/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_OpenCircuit AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT BreakGroundId AS DataId + ,'755C6AC9-2E38-4D4F-AF33-33CB1744A907' AS MenuId + ,'ҵ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/dtu/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_BreakGround AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT NightWorkId AS DataId + ,'7BBAE649-7B00-4475-A911-BFE3A37AC55B' AS MenuId + ,'ҹʩ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/yjsg/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_NightWork AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT LiftingWorkId AS DataId + ,'A1BE3AB6-9D4A-41E7-8870-E73423165451' AS MenuId + ,'װҵ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/dzhuang/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_LiftingWork AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT ElectricityId AS DataId + ,'48F64E0F-38B2-4BDC-9B61-6200BD02CBF5' AS MenuId + ,'ʱõ' AS MenuName + ,LicenseCode AS Content + ,UserId + ,users.UserName + ,ApplyDate AS DataTime + ,CONVERT(varchar(100),ApplyDate, 23) AS DataTimeStr + ,(CASE WHEN States = '0' THEN '/pagesWork/ldian/add' + ELSE '/pagesWork/dhuo/approval' END) AS UrlStr +FROM License_Electricity AS License + LEFT JOIN Sys_User AS users ON users.UserId =License.NextManId +WHERE License.ProjectId=@projectId + AND (States = '0' OR States = '1' OR States= '6') + AND License.NextManId LIKE '%'+ @userId+'%' + +UNION ALL +SELECT RectifyNoticesId AS DataId + ,'0038D764-D628-46F0-94FF-D0A22C3C45A3' AS MenuId + ,'' AS MenuName + ,(CASE WHEN Rectify.States =1 THEN 'ǩ' + WHEN Rectify.States =2 THEN 'ģ' + WHEN Rectify.States =3 THEN 'ˣ' + WHEN Rectify.States =4 THEN '飺' + WHEN Rectify.States =5 THEN 'ɣ' + ELSE 'ύ' END + RectifyNoticesCode) AS Content + ,users.UserId + ,users.UserName + ,CheckedDate AS DataTime + ,CONVERT(varchar(100),CheckedDate, 23) AS DataTimeStr + ,(CASE WHEN ISNULL(Rectify.States,0) =0 THEN '/pagesHSSE/rn/rn_add' --ύ + WHEN Rectify.States =1 THEN '/pagesHSSE/rn/rn_approval' --ǩ + WHEN Rectify.States =2 THEN '/pagesHSSE/rn/rn_rectify' -- + WHEN Rectify.States =3 THEN '/pagesHSSE/rn/rn_rectifycf' -- + WHEN Rectify.States =4 THEN '/pagesHSSE/rn/rn_confirm' -- + ELSE '/pagesHSSE/rn/rn_add' END) AS UrlStr +FROM Check_RectifyNotices AS Rectify + LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Rectify.Projectid=@projectId AND Rectify.States <> 5 + AND ((ISNULL(Rectify.States,0) =0 AND Rectify.CompleteManId LIKE '%'+ @userId+'%') + OR (Rectify.States =1 AND Rectify.SignPerson LIKE '%'+ @userId+'%') + OR (Rectify.States =2 AND Rectify.DutyPersonId LIKE '%'+ @userId+'%') + OR (Rectify.States =3 AND Rectify.UnitHeadManId LIKE '%'+ @userId+'%') + OR (Rectify.States =4 AND Rectify.CheckPerson LIKE '%'+ @userId+'%') + OR (Rectify.ProfessionalEngineerId LIKE '%'+ @userId+'%' AND (ProfessionalEngineerTime1 IS NULL OR ProfessionalEngineerTime2 IS NULL)) + OR (Rectify.ConstructionManagerId LIKE '%'+ @userId+'%' AND (ConstructionManagerTime1 IS NULL OR ConstructionManagerTime2 IS NULL)) + OR (Rectify.ProjectManagerId LIKE '%'+ @userId+'%' AND (ProjectManagerTime1 IS NULL OR ProjectManagerTime2 IS NULL))) + +UNION ALL +SELECT PersonId AS DataId + ,'EE260447-028F-46AF-8864-9A5DC9DAA5BD' AS MenuId + ,'ֳԱ' AS MenuName + ,Person.PersonName AS Content + ,users.UserId + ,users.UserName + ,Person.InTime AS DataTime + ,CONVERT(varchar(100),Person.InTime, 23) AS DataTimeStr + ,('/pagesHSSE/info/peopledetail') AS UrlStr +FROM SitePerson_Person AS Person + LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Person.ProjectId=@projectId AND (Person.IsUsed IS NULL OR Person.IsUsed= 0) + AND Person.AuditorId = @userId AND Person.AuditorDate IS NULL + + +UNION ALL +SELECT PauseNoticeId AS DataId + ,'C81DB7ED-165E-4C69-86B0-A3AAE37059FE' AS MenuId + ,'ͣ' AS MenuName + ,(CASE WHEN PauseNotice.PauseStates =1 THEN 'ǩ' + WHEN PauseNotice.PauseStates =2 THEN '׼' + WHEN PauseNotice.PauseStates =3 THEN 'գ' + ELSE 'ύ' END + PauseNoticeCode) AS Content + ,users.UserId + ,users.UserName + ,PauseTime AS DataTime + ,CONVERT(varchar(100),PauseTime, 23) AS DataTimeStr + ,(CASE WHEN ISNULL(PauseNotice.PauseStates,0) =0 THEN '/pagesHSSE/info/stop_add' --ύ + WHEN PauseNotice.PauseStates =1 AND PauseNotice.SignManId=@userId THEN '/pagesHSSE/info/stop_approval' --ǩ + WHEN PauseNotice.PauseStates =2 AND PauseNotice.ApproveManId=@userId THEN '/pagesHSSE/info/stop_confirm' --׼ + WHEN PauseNotice.PauseStates =3 AND PauseNotice.DutyPersonId=@userId THEN '/pagesHSSE/info/stop_feedback' -- + ELSE '/pagesHSSE/info/stop_add' END) AS UrlStr +FROM Check_PauseNotice AS PauseNotice + LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE PauseNotice.ProjectId=@projectId AND PauseNotice.PauseStates <> 4 + AND ((ISNULL(PauseNotice.PauseStates,0) =0 AND PauseNotice.CompileManId LIKE '%'+ @userId+'%') + OR (PauseNotice.PauseStates =1 AND PauseNotice.SignManId LIKE '%'+ @userId+'%') + OR (PauseNotice.PauseStates =2 AND PauseNotice.ApproveManId LIKE '%'+ @userId+'%') + OR (PauseNotice.PauseStates =3 AND PauseNotice.DutyPersonId LIKE '%'+ @userId+'%') + OR (PauseNotice.ProfessionalEngineerId LIKE '%'+ @userId+'%' AND ProfessionalEngineerTime IS NULL) + OR (PauseNotice.ConstructionManagerId LIKE '%'+ @userId+'%' AND ConstructionManagerTime IS NULL) + OR (PauseNotice.UnitHeadManId LIKE '%'+ @userId+'%' AND UnitHeadManTime IS NULL) + OR (PauseNotice.SupervisorManId LIKE '%'+ @userId+'%' AND SupervisorManTime IS NULL) + OR (PauseNotice.OwnerId LIKE '%'+ @userId+'%' AND OwnerTime IS NULL)) +UNION ALL +SELECT PunishNoticeId AS DataId + ,'755F1C1D-2178-47D8-9F82-A501B53A2436' AS MenuId + ,'' AS MenuName + ,(CASE WHEN PunishNotice.PunishStates =1 THEN 'ǩ' + WHEN PunishNotice.PunishStates =2 THEN '׼' + WHEN PunishNotice.PunishStates =3 THEN 'ִ' + ELSE 'ύ' END + PunishNoticeCode) AS Content + ,users.UserId + ,users.UserName + ,PunishNoticeDate AS DataTime + ,CONVERT(varchar(100),PunishNoticeDate, 23) AS DataTimeStr + ,(CASE WHEN ISNULL(PunishNotice.PunishStates,0) =0 THEN '/pagesTest/punish/add' --ύ + WHEN PunishNotice.PunishStates =1 AND PunishNotice.SignMan=@userId THEN '/pagesTest/punish/approval' --ǩ + WHEN PunishNotice.PunishStates =2 AND PunishNotice.ApproveMan=@userId THEN '/pagesTest/punish/rectify' --׼ + WHEN PunishNotice.PunishStates =3 AND PunishNotice.DutyPersonId=@userId THEN '/pagesTest/punish/rectifycf' --ִ + ELSE '/pagesTest/punish/detail' END) AS UrlStr +FROM Check_PunishNotice AS PunishNotice + LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE PunishNotice.ProjectId=@projectId AND PunishNotice.PunishStates <> 4 + AND ((ISNULL(PunishNotice.PunishStates,0) =0 AND PunishNotice.CompileMan LIKE '%'+ @userId+'%') + OR (PunishNotice.PunishStates =1 AND PunishNotice.SignMan LIKE '%'+ @userId+'%') + OR (PunishNotice.PunishStates =2 AND PunishNotice.ApproveMan LIKE '%'+ @userId+'%') + OR (PunishNotice.PunishStates =3 AND PunishNotice.DutyPersonId LIKE '%'+ @userId+'%') + OR (PunishNotice.ProfessionalEngineerId LIKE '%'+ @userId+'%' AND ProfessionalEngineerTime IS NULL) + OR (PunishNotice.ConstructionManagerId LIKE '%'+ @userId+'%' AND ConstructionManagerTime IS NULL) + OR (PunishNotice.UnitHeadManId LIKE '%'+ @userId+'%' AND UnitHeadManTime IS NULL)) +UNION ALL + +SELECT CheckSpecialId AS DataId + ,'1B08048F-93ED-4E84-AE65-DB7917EA2DFB' AS MenuId + ,'ר' AS MenuName + ,checkspecial.CheckSpecialCode+'ר' AS Content + ,UserId + ,users.UserName + ,checkspecial.CheckTime AS DataTime + ,CONVERT(varchar(100),checkspecial.CheckTime, 23) AS DataTimeStr + ,'/pagesHSSE/grow/special_detail' AS UrlStr +FROM Check_CheckSpecial AS checkspecial +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE checkspecial.ProjectId=@projectId AND +checkspecial.States='1' and checkspecial.ResponsibleMan=@userId + +UNION ALL +SELECT ConstructSolutionId AS DataId + ,'91C4BFDB-0A51-4992-99CC-EB4EC185593D' AS MenuId + ,'ʩ' AS MenuName + ,Solution.SolutionName AS Content + ,UserId + ,users.UserName + ,Solution.CompileDate AS DataTime + ,CONVERT(varchar(100),Solution.CompileDate, 23) AS DataTimeStr + ,'/pagesQ/eq_fangan/detail' AS UrlStr +FROM Solution_CQMSConstructSolution AS Solution +LEFT JOIN Sys_User AS users ON users.UserId =@userId +WHERE Solution.ProjectId=@projectId and +Solution.State!='3' AND Solution.ConstructSolutionId in (select ConstructSolutionId from Solution_CQMSConstructSolutionApprove approve where approve.ApproveType!='S' and approve.ApproveMan=@userId and approve.ApproveDate is null ) + +ORDER BY DataTime DESC +END + + + + + diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-16.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-16.sql new file mode 100644 index 00000000..87ccdd7c --- /dev/null +++ b/DataBase/版本日志/SGGLDB_WH_2023-10-16.sql @@ -0,0 +1,21 @@ + +--ɾ +truncate table PreRun_SubInspectTerm +truncate table PreRun_SubInspectTermItem +truncate table PreRun_InspectTailTerm +truncate table PreRun_InspectTermApproveRecords + +--ֶ +alter table PreRun_SubInspectTermItem add SubcontractorRemark varchar(1000) NULL--ְ̱ע +alter table PreRun_SubInspectTermItem add ContractorRemark varchar(1000) NULL--а̱ע +alter table PreRun_SubInspectTermItem add SupervisionRemark varchar(1000) NULL--ע +alter table PreRun_SubInspectTermItem add OwnerRemark varchar(1000) NULL--ҵע +GO + + + + + +--ѵ¼Ӷά +alter table EduTrain_TrainRecord add QRCodeUrl nvarchar(2000) null +GO \ No newline at end of file diff --git a/SGGL/BLL/API/HSSE/APITestRecordService.cs b/SGGL/BLL/API/HSSE/APITestRecordService.cs index 2eaa488a..2a973ae5 100644 --- a/SGGL/BLL/API/HSSE/APITestRecordService.cs +++ b/SGGL/BLL/API/HSSE/APITestRecordService.cs @@ -616,5 +616,116 @@ namespace BLL } } #endregion + + #region 扫码获取培训记录 + /// + /// 培训记录主表实体类 + /// + public class EduTrainRecord { + public string TrainTitle { get; set; } + public string UnitsName { get; set; } + public string TrainType { get; set; } + public string TrainStartDate { get; set; } + public string TeachHour { get; set; } + public string TrainContent { get; set; } + public List ChildList { get; set; } + } + public class EduTrain_TrainRecordDetailDto { + public string PersonName { get; set; } + public string IdCard { get; set; } + public string CheckScore { get; set; } + public string CheckResult { get; set; } + } + + /// + /// 扫码获取培训记录 + /// + /// + /// + public static EduTrainRecord getTestRecordByTestRecordIdQrCode(string TrainingId) + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = from x in db.EduTrain_TrainRecord + where x.TrainingId == TrainingId + select new EduTrainRecord + { + TrainTitle=x.TrainTitle, + UnitsName= getUnitNameByUnitids(x.UnitIds), + TrainType= getTrainTypeNameByTrainTypeId(x.TrainTypeId), + TrainStartDate = string.Format("{0:yyyy-MM-dd}", x.TrainStartDate), + TeachHour=x.TeachHour.ToString(), + TrainContent=x.TrainContent, + ChildList=getChildEduTrainChild(x.TrainingId) + }; + return getDataLists.FirstOrDefault(); + } + } + /// + /// 根据单位id获取单位名称 + /// + /// + /// + private static string getUnitNameByUnitids(string unitId) { + if (!string.IsNullOrEmpty(unitId)) + { + string unitNames = string.Empty; + string[] unitIds = unitId.Split(','); + foreach (var item in unitIds) + { + Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item); + if (unit != null) + { + unitNames += unit.UnitName + ","; + } + } + if (!string.IsNullOrEmpty(unitNames)) + { + unitNames = unitNames.Substring(0, unitNames.LastIndexOf(",")); + } + return unitNames; + } + else { + return ""; + } + } + + private static string getPerIdCardByPersonId(string personId) { + var pmodel = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == personId); + if (pmodel != null) + { + return pmodel.IdentityCard; + } + else { + return ""; + } + } + + private static string getTrainTypeNameByTrainTypeId(string TrainTypeId) { + if (!string.IsNullOrEmpty(TrainTypeId)) + { + return BLL.TrainTypeService.GetTrainTypeById(TrainTypeId).TrainTypeName; + } + else { + return ""; + } + } + private static List getChildEduTrainChild(string TrainingId) { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + var getDataLists = from x in db.View_EduTrain_TrainRecordDetail + where x.TrainingId == TrainingId + select new EduTrain_TrainRecordDetailDto + { + PersonName=x.PersonName, + IdCard= getPerIdCardByPersonId(x.PersonId), + CheckScore=x.CheckScore.ToString(), + CheckResult=x.CheckResult==true?"合格":"不合格" + + }; + return getDataLists.ToList(); + } + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Controls/SeeQRImage.aspx.cs b/SGGL/FineUIPro.Web/Controls/SeeQRImage.aspx.cs index 3dd05f4e..791293e1 100644 --- a/SGGL/FineUIPro.Web/Controls/SeeQRImage.aspx.cs +++ b/SGGL/FineUIPro.Web/Controls/SeeQRImage.aspx.cs @@ -167,6 +167,23 @@ namespace FineUIPro.Web.Controls } } } + else if (!string.IsNullOrEmpty(Request.Params["TrainingId"])) + { + var serverTestPlan = Funs.DB.EduTrain_TrainRecord.FirstOrDefault(e => e.TrainingId == Request.Params["TrainingId"]); + if (serverTestPlan != null) + { + if (!string.IsNullOrEmpty(serverTestPlan.QRCodeUrl) && CreateQRCodeService.isHaveImage(serverTestPlan.QRCodeUrl)) + { + this.QRCodeAttachUrl = serverTestPlan.QRCodeUrl; + } + else + { + this.CreateCode_Simple(Request.Params["strCode"]); + serverTestPlan.QRCodeUrl = this.QRCodeAttachUrl; + Funs.DB.SubmitChanges(); + } + } + } this.Image1.ImageUrl = "~/" + this.QRCodeAttachUrl; } diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx index efc7fda4..5a70c33f 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx @@ -46,11 +46,12 @@ - + - + + @@ -153,12 +154,12 @@ } function onGridDataLoad(event) { - this.mergeColumns(['CheckSpecialCode', 'CheckCount','CheckTime'], { depends: true }); -// this.mergeColumns(['CheckCount']); -// this.mergeColumns(['CheckPersonName']); -// this.mergeColumns(['CheckTime']); -// this.mergeColumns(['FlowOperateName']); - } + this.mergeColumns(['CheckSpecialCode', 'CheckCount', 'CheckTime'], { depends: true }); + // this.mergeColumns(['CheckCount']); + // this.mergeColumns(['CheckPersonName']); + // this.mergeColumns(['CheckTime']); + // this.mergeColumns(['FlowOperateName']); + } diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs index c178df09..9b77dffb 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.cs @@ -60,7 +60,7 @@ namespace FineUIPro.Web.HSSE.Check { string strSql = @"SELECT CheckSpecial.CheckSpecialId,CodeRecords.Code AS CheckSpecialCode," + @" CheckItemSet.CheckItemName,CheckSpecial.CheckTime,(CASE WHEN CheckSpecial.CheckType ='1' THEN '联合检查' ELSE '专项检查' END) AS CheckTypeName" - + @" ,(CASE WHEN CheckSpecial.States='2' THEN '已完成' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName" + + @" ,(CASE WHEN CheckSpecial.States='2' THEN '待确认' WHEN CheckSpecial.States='3' THEN '已确认' WHEN CheckSpecial.States='1' THEN '待整改' ELSE '待提交' END) AS StatesName" + @" FROM Check_CheckSpecial AS CheckSpecial " + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON CheckSpecial.CheckSpecialId=CodeRecords.DataId " + @" LEFT JOIN Technique_CheckItemSet AS CheckItemSet ON CheckItemSet.CheckItemSetId = CheckSpecial.CheckItemSetId where 1=1"; @@ -68,9 +68,9 @@ namespace FineUIPro.Web.HSSE.Check strSql += " AND CheckSpecial.ProjectId = @ProjectId"; listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); - if (this.rbStates.SelectedValue!="-1") + if (this.rbStates.SelectedValue != "-1") { - strSql += " AND CheckSpecial.States = @States"; + strSql += " AND CheckSpecial.States = @States"; listStr.Add(new SqlParameter("@States", this.rbStates.SelectedValue)); } if (this.rbType.SelectedValue != "-1") @@ -86,10 +86,10 @@ namespace FineUIPro.Web.HSSE.Check listStr.Add(new SqlParameter("@CheckType", this.rbType.SelectedValue)); } } - if (this.drpSupCheckItemSet.SelectedValue!=BLL.Const._Null) + if (this.drpSupCheckItemSet.SelectedValue != BLL.Const._Null) { strSql += " AND CheckSpecial.CheckItemSetId = @CheckItemSetId"; - listStr.Add(new SqlParameter("@CheckItemSetId", this.drpSupCheckItemSet.SelectedValue )); + listStr.Add(new SqlParameter("@CheckItemSetId", this.drpSupCheckItemSet.SelectedValue)); } if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim())) { @@ -269,8 +269,8 @@ namespace FineUIPro.Web.HSSE.Check } } } - #endregion - + #endregion + #region 导出按钮 /// 导出按钮 /// @@ -289,7 +289,7 @@ namespace FineUIPro.Web.HSSE.Check Response.End(); } #endregion - + /// /// /// @@ -361,7 +361,8 @@ namespace FineUIPro.Web.HSSE.Check uploadfilepath = rootPath + initTemplatePath; newUrl = uploadfilepath.Replace(".doc", string.Format("{0:yyyy-MM}", DateTime.Now) + ".doc"); //filePath = initTemplatePath.Replace(".doc", string.Format("{0:yyyy-MM}", DateTime.Now) + ".pdf"); - if (File.Exists(newUrl)) { + if (File.Exists(newUrl)) + { File.Delete(newUrl); } File.Copy(uploadfilepath, newUrl); @@ -398,10 +399,11 @@ namespace FineUIPro.Web.HSSE.Check { if (checkSpecial != null) { - if (!string.IsNullOrEmpty(checkSpecial.CheckItemSetId)) { + if (!string.IsNullOrEmpty(checkSpecial.CheckItemSetId)) + { bookmarkSupCheckItemSet.Text = Technique_CheckItemSetService.GetCheckItemSetNameById(checkSpecial.CheckItemSetId); } - + } } @@ -410,10 +412,11 @@ namespace FineUIPro.Web.HSSE.Check { if (checkSpecial != null) { - if (checkSpecial.CheckTime.HasValue) { + if (checkSpecial.CheckTime.HasValue) + { bookmarkCheckDate.Text = string.Format("{0:yyyy-MM-dd}", checkSpecial.CheckTime); } - + } } @@ -598,7 +601,7 @@ namespace FineUIPro.Web.HSSE.Check builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;//水平居中对齐 builder.CellFormat.Width = 250; builder.CellFormat.WrapText = true; - builder.Write(string.IsNullOrEmpty(detail.CheckItemSetContent)?"": detail.CheckItemSetContent); + builder.Write(string.IsNullOrEmpty(detail.CheckItemSetContent) ? "" : detail.CheckItemSetContent); ////处理结果 //builder.InsertCell(); @@ -615,7 +618,7 @@ namespace FineUIPro.Web.HSSE.Check builder.CellFormat.VerticalAlignment = Aspose.Words.Tables.CellVerticalAlignment.Center;//垂直居中对齐 builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;//水平居中对齐 builder.CellFormat.Width = 60; - builder.Write(string.Format("{0:yyyy-MM-dd}", detail.Rectification_Date)); + builder.Write(string.Format("{0:yyyy-MM-dd}", detail.Rectification_Date)); //隐患类别 builder.InsertCell(); builder.CellFormat.VerticalMerge = Aspose.Words.Tables.CellMerge.None; diff --git a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.designer.cs index 82f82f65..7b0d4f2c 100644 --- a/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/Check/CheckSpecial.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.HSSE.Check { - - - public partial class CheckSpecial { - +namespace FineUIPro.Web.HSSE.Check +{ + + + public partial class CheckSpecial + { + /// /// form1 控件。 /// @@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// Panel1 控件。 /// @@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Panel Panel1; - + /// /// Grid1 控件。 /// @@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid Grid1; - + /// /// Toolbar2 控件。 /// @@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar2; - + /// /// rbStates 控件。 /// @@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rbStates; - + /// /// rbType 控件。 /// @@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.RadioButtonList rbType; - + /// /// drpSupCheckItemSet 控件。 /// @@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpSupCheckItemSet; - + /// /// txtStartTime 控件。 /// @@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtStartTime; - + /// /// txtEndTime 控件。 /// @@ -101,7 +103,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtEndTime; - + /// /// ToolbarFill1 控件。 /// @@ -110,7 +112,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnNew 控件。 /// @@ -119,7 +121,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnNew; - + /// /// btnOut 控件。 /// @@ -128,7 +130,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnOut; - + /// /// labNumber 控件。 /// @@ -137,7 +139,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label labNumber; - + /// /// ToolbarSeparator1 控件。 /// @@ -146,7 +148,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; - + /// /// ToolbarText1 控件。 /// @@ -155,7 +157,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarText ToolbarText1; - + /// /// ddlPageSize 控件。 /// @@ -164,7 +166,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList ddlPageSize; - + /// /// Window1 控件。 /// @@ -173,7 +175,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window1; - + /// /// Menu1 控件。 /// @@ -182,7 +184,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Menu Menu1; - + /// /// btnMenuModify 控件。 /// @@ -191,7 +193,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.MenuButton btnMenuModify; - + /// /// btnPrinter 控件。 /// @@ -200,7 +202,7 @@ namespace FineUIPro.Web.HSSE.Check { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.MenuButton btnPrinter; - + /// /// btnMenuDel 控件。 /// diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx b/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx index 45ecaa32..d5b689b9 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/Plan.aspx @@ -88,7 +88,7 @@ runat="server" Text="查看" Icon="Find"> + runat="server" Text="二维码" Hidden="true" Icon="Shading"> + + diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs index b2ed5240..07e64c76 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.cs @@ -661,5 +661,21 @@ namespace FineUIPro.Web.HSSE.EduTrain } } } + + /// + /// 查看二维码 + /// + /// + /// + protected void btnQR_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning); + return; + } + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("~/Controls/SeeQRImage.aspx?TrainingId={0}&strCode={1}", Grid1.SelectedRowID, "trainRecord$" + Grid1.SelectedRowID), "二维码查看", 400, 400)); + } } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.designer.cs b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.designer.cs index c00b7651..764a3460 100644 --- a/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/HSSE/EduTrain/TrainRecord.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace FineUIPro.Web.HSSE.EduTrain { - - - public partial class TrainRecord { - +namespace FineUIPro.Web.HSSE.EduTrain +{ + + + public partial class TrainRecord + { + /// /// form1 控件。 /// @@ -20,7 +22,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// PageManager1 控件。 /// @@ -29,7 +31,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.PageManager PageManager1; - + /// /// Panel1 控件。 /// @@ -38,7 +40,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Panel Panel1; - + /// /// Grid1 控件。 /// @@ -47,7 +49,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Grid Grid1; - + /// /// Toolbar2 控件。 /// @@ -56,7 +58,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Toolbar Toolbar2; - + /// /// drpUnitId 控件。 /// @@ -65,7 +67,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpUnitId; - + /// /// drpTrainType 控件。 /// @@ -74,7 +76,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpTrainType; - + /// /// drpTrainLevel 控件。 /// @@ -83,7 +85,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList drpTrainLevel; - + /// /// txtStartDate 控件。 /// @@ -92,7 +94,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtStartDate; - + /// /// lblTo 控件。 /// @@ -101,7 +103,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Label lblTo; - + /// /// txtEndDate 控件。 /// @@ -110,7 +112,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DatePicker txtEndDate; - + /// /// ToolbarFill1 控件。 /// @@ -119,7 +121,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarFill ToolbarFill1; - + /// /// btnNew 控件。 /// @@ -128,7 +130,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnNew; - + /// /// btnOut 控件。 /// @@ -137,7 +139,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnOut; - + /// /// btnRefresh 控件。 /// @@ -146,7 +148,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Button btnRefresh; - + /// /// lblNumber 控件。 /// @@ -155,7 +157,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label lblNumber; - + /// /// lblTrainingCode 控件。 /// @@ -164,7 +166,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label lblTrainingCode; - + /// /// lblUnitId 控件。 /// @@ -173,7 +175,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label lblUnitId; - + /// /// Label1 控件。 /// @@ -182,7 +184,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.WebControls.Label Label1; - + /// /// ToolbarSeparator1 控件。 /// @@ -191,7 +193,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; - + /// /// ToolbarText1 控件。 /// @@ -200,7 +202,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.ToolbarText ToolbarText1; - + /// /// ddlPageSize 控件。 /// @@ -209,7 +211,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.DropDownList ddlPageSize; - + /// /// Window1 控件。 /// @@ -218,7 +220,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window1; - + /// /// Window2 控件。 /// @@ -227,7 +229,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Window Window2; - + /// /// Menu1 控件。 /// @@ -236,7 +238,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.Menu Menu1; - + /// /// btnMenuView 控件。 /// @@ -245,7 +247,16 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.MenuButton btnMenuView; - + + /// + /// btnQR 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnQR; + /// /// btnMenuEdit 控件。 /// @@ -254,7 +265,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.MenuButton btnMenuEdit; - + /// /// btnPrint 控件。 /// @@ -263,7 +274,7 @@ namespace FineUIPro.Web.HSSE.EduTrain { /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::FineUIPro.MenuButton btnPrint; - + /// /// btnMenuDelete 控件。 /// diff --git a/SGGL/FineUIPro.Web/Images/Template.png b/SGGL/FineUIPro.Web/Images/Template.png new file mode 100644 index 00000000..0f479c9d Binary files /dev/null and b/SGGL/FineUIPro.Web/Images/Template.png differ diff --git a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx index 1cd6b3f3..fe7cc557 100644 --- a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx +++ b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx @@ -25,7 +25,10 @@ + + + @@ -42,6 +45,12 @@ + + + + + diff --git a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.cs b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.cs index 0244bfbd..4e77c65f 100644 --- a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.cs +++ b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.cs @@ -1,18 +1,23 @@ using BLL; +using Model; using Newtonsoft.Json.Linq; +using NPOI.SS.UserModel; +using NPOI.SS.Util; +using NPOI.XSSF.UserModel; using System; using System.Collections.Generic; +using System.Data; +using System.IO; using System.Linq; using System.Web; using System.Web.UI; -using System.Web.UI.WebControls; namespace FineUIPro.Web.TestRun.BeforeTestRun { public partial class InspectWanderAboutConfirm : PageBase { /// - /// + /// 检查表主键 /// public string SubInspectId { @@ -21,7 +26,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun } /// - /// + /// 类型 /// public int ConfirmType { @@ -29,12 +34,39 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun set { ViewState["ConfirmType"] = value; } } + /// + /// 类型名称 + /// + public string ConfirmTypeName + { + get { return (string)ViewState["ConfirmTypeName"]; } + set { ViewState["ConfirmTypeName"] = value; } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.SubInspectId = Request.Params["SubInspectId"]; this.ConfirmType = int.Parse(Request.Params["ConfirmType"]); + + if (this.ConfirmType == 1) + { + this.ConfirmTypeName = "分包商"; + } + if (this.ConfirmType == 2) + { + this.ConfirmTypeName = "承包商"; + } + if (this.ConfirmType == 3) + { + this.ConfirmTypeName = "监理"; + } + if (this.ConfirmType == 4) + { + this.ConfirmTypeName = "业主"; + } + this.BindGrid(); } } @@ -60,26 +92,27 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun model.WorkInspectName = item.WorkInspectName; model.ConfirmType = this.ConfirmType; model.InspectionIllustrate = item.InspectionIllustrate; + model.ConfirmTypeName = this.ConfirmTypeName; //1=分包商2=承包商3=监理4=业主 if (this.ConfirmType == 1) { model.IsPass = item.SubcontractorIsPass; - model.ConfirmTypeName = "分包商"; + model.Remark = item.SubcontractorRemark; } if (this.ConfirmType == 2) { model.IsPass = item.ContractorIsPass; - model.ConfirmTypeName = "承包商"; + model.Remark = item.ContractorRemark; } if (this.ConfirmType == 3) { model.IsPass = item.SupervisionIsPass; - model.ConfirmTypeName = "监理"; + model.Remark = item.SupervisionRemark; } if (this.ConfirmType == 4) { model.IsPass = item.OwnerIsPass; - model.ConfirmTypeName = "业主"; + model.Remark = item.OwnerRemark; } data.Add(model); } @@ -127,18 +160,22 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun if (this.ConfirmType == 1) { model.SubcontractorIsPass = int.Parse(values.Value("IsPass")); + model.SubcontractorRemark = values.Value("Remark"); } else if (this.ConfirmType == 2) { model.ContractorIsPass = int.Parse(values.Value("IsPass")); + model.ContractorRemark = values.Value("Remark"); } else if (this.ConfirmType == 3) { model.SupervisionIsPass = int.Parse(values.Value("IsPass")); + model.SupervisionRemark = values.Value("Remark"); } else if (this.ConfirmType == 4) { model.OwnerIsPass = int.Parse(values.Value("IsPass")); + model.OwnerRemark = values.Value("Remark"); } } Funs.DB.SubmitChanges(); @@ -243,6 +280,10 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun /// 是否通过 /// public int? IsPass { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } } @@ -253,5 +294,528 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun { BindGrid(); } + + /// + /// 导出 + /// + protected void btnExport_Click(object sender, EventArgs e) + { + string rootPath = Server.MapPath("~/") + Const.ExcelUrl; + //导出文件 + string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\"; + if (!Directory.Exists(filePath)) + { + Directory.CreateDirectory(filePath); + } + string ReportFileName = filePath + this.ConfirmTypeName + "确认签字.xlsx"; + //获取工作包检查表 + var termData = from a in Funs.DB.PreRun_SubInspectTerm + join b in Funs.DB.Base_Project on a.ProjectId equals b.ProjectId + join c in Funs.DB.PreRun_WorkPackage on a.WorkPackId equals c.WorkPackId + join zz in Funs.DB.PreRun_SysDevice on a.InstallationId equals zz.PreRunId//装置 + join gx in Funs.DB.PreRun_SysDevice on a.ProcessesId equals gx.PreRunId//工序 + join xt in Funs.DB.PreRun_SysDevice on a.SystemId equals xt.PreRunId//系统 + select new { a.SubInspectId, a.ProjectId, b.ProjectName, b.ShortName, b.ProjectCode, a.InstallationId, a.ProcessesId, a.SystemId, a.SubSystemId, a.WorkPackId, a.InspectResult, a.Subcontractor, a.Contractor, a.Supervision, a.Owner, a.InspectionIsAllPass, a.SubcontractorIsAllPass, a.ContractorIsAllPass, a.SupervisionIsAllPass, a.OwnerIsAllPass, a.WorkPackType, a.PropertyTechnologyId, a.InspectTime, a.AddUser, a.AddTime, c.WorkPackName, zzName = zz.PreRunName, gxName = gx.PreRunName, xtName = xt.PreRunName }; + if (termData != null) + { + var termModel = termData.FirstOrDefault(); + //获取工作包检查项表 + var termItems = Funs.DB.PreRun_SubInspectTermItem.Where(x => x.SubInspectId == this.SubInspectId).OrderBy(x => x.Sort).ToList(); + //获取管道或者设备号 + var termCodes = string.Empty; + //1=管道2=设备 + var ids = termModel.PropertyTechnologyId.Split(',').ToList(); + if (termModel.WorkPackType == 1) + { + var codeDatas = Funs.DB.PreRun_PropertySysPiping.Where(x => ids.Contains(x.PropertyId)).ToList(); + if (codeDatas.Count > 0) + { + termCodes = string.Join(",", codeDatas.ConvertAll(x => x.PipingCode)); + } + } + else + { + var codeDatas = Funs.DB.PreRun_TechnologySysPiping.Where(x => ids.Contains(x.TechnologyId)).ToList(); + if (codeDatas.Count > 0) + { + termCodes = string.Join(",", codeDatas.ConvertAll(x => x.TagNumber)); + } + } + + int rowIndex = 0; + XSSFWorkbook hssfworkbook = new XSSFWorkbook(); + XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet(this.ConfirmTypeName + "确认签字"); + + #region 列宽 + + ws.SetColumnWidth(0, (7 * 256)); + ws.SetColumnWidth(1, (4 * 256)); + ws.SetColumnWidth(2, (4 * 256)); + ws.SetColumnWidth(3, (4 * 256)); + ws.SetColumnWidth(4, (10 * 256)); + ws.SetColumnWidth(5, (10 * 256)); + ws.SetColumnWidth(6, (10 * 256)); + ws.SetColumnWidth(7, (10 * 256)); + ws.SetColumnWidth(8, (3 * 256)); + ws.SetColumnWidth(9, (3 * 256)); + ws.SetColumnWidth(10, (3 * 256)); + ws.SetColumnWidth(11, (3 * 256)); + ws.SetColumnWidth(12, (3 * 256)); + ws.SetColumnWidth(13, (3 * 256)); + ws.SetColumnWidth(14, (3 * 256)); + ws.SetColumnWidth(15, (3 * 256)); + ws.SetColumnWidth(16, (3 * 256)); + ws.SetColumnWidth(17, (3 * 256)); + + #endregion + + #region 样式 + //头部样式居中 + ICellStyle titleStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 14, true, true); + //头部样式靠左 + ICellStyle leftTitleStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 14, true, true); + //公共样式 + ICellStyle style = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10.5, true); + //公共样式靠左 + ICellStyle leftStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Left, 10.5, true); + //公共样式靠左上对其 + ICellStyle leftTopStyle = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Top, HorizontalAlignment.Left, 10.5, true); + //公共样式加粗 + ICellStyle styleBold = SetExcelStyle(hssfworkbook, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, BorderStyle.Thin, VerticalAlignment.Center, HorizontalAlignment.Center, 10.5, true, true); + + #endregion + + #region 头部 + + ws = ExcelCreateRowTitle(ws, hssfworkbook, style, rowIndex, rowIndex + 5, 0, 17); + //行1 + var region = new CellRangeAddress(rowIndex, rowIndex + 2, 0, 0); + ws.AddMergedRegion(region); + byte[] bytes = File.ReadAllBytes(Server.MapPath("~/") + "Images\\Template.png"); + int pictureIdx = hssfworkbook.AddPicture(bytes, PictureType.JPEG); + IDrawing patriarch = ws.CreateDrawingPatriarch(); + IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, 0, rowIndex, 1, rowIndex + 2); + IPicture pict = patriarch.CreatePicture(anchor, pictureIdx); + //pict.Resize(); + region = new CellRangeAddress(rowIndex, rowIndex + 2, 1, 3); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex).GetCell(1).SetCellValue("中国五环工程有限公司"); + ws.GetRow(rowIndex).GetCell(1).CellStyle = + ws.GetRow(rowIndex).GetCell(2).CellStyle = + ws.GetRow(rowIndex).GetCell(3).CellStyle = leftTitleStyle; + region = new CellRangeAddress(rowIndex, rowIndex, 4, 7); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex).GetCell(4).SetCellValue(termModel.ProjectName); + ws.GetRow(rowIndex).GetCell(4).CellStyle = style; + region = new CellRangeAddress(rowIndex, rowIndex, 8, 12); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex).GetCell(8).SetCellValue("项目号"); + ws.GetRow(rowIndex).GetCell(8).CellStyle = style; + region = new CellRangeAddress(rowIndex, rowIndex, 13, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex).GetCell(13).SetCellValue(termModel.ProjectCode); + ws.GetRow(rowIndex).GetCell(13).CellStyle = style; + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 4, 7); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(4).SetCellValue($"({termModel.zzName})({termModel.gxName}/{termModel.xtName})"); + ws.GetRow(rowIndex + 1).GetCell(4).CellStyle = style; + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 8, 12); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(8).SetCellValue("(文件号)"); + ws.GetRow(rowIndex + 1).GetCell(8).CellStyle = style; + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 13, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(13).SetCellValue(""); + ws.GetRow(rowIndex + 1).GetCell(13).CellStyle = style; + region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 4, 7); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 2).GetCell(4).SetCellValue($"{termModel.WorkPackName}条件检查表"); + ws.GetRow(rowIndex + 2).GetCell(4).CellStyle = titleStyle; + region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 8, 12); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 2).GetCell(8).SetCellValue("第 1 页"); + ws.GetRow(rowIndex + 2).GetCell(8).CellStyle = style; + region = new CellRangeAddress(rowIndex + 2, rowIndex + 2, 13, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 2).GetCell(13).SetCellValue("共 1 页"); + ws.GetRow(rowIndex + 2).GetCell(13).CellStyle = style; + //行4,行5 + region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 0, 2); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 3).GetCell(0).CellStyle = style; + ws.GetRow(rowIndex + 3).GetCell(0).SetCellValue(termModel.WorkPackType == 1 ? "管道号" : "设备号"); + region = new CellRangeAddress(rowIndex + 3, rowIndex + 4, 3, 11); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 3).GetCell(3).CellStyle = leftStyle; + ws.GetRow(rowIndex + 3).GetCell(3).SetCellValue(termCodes); + region = new CellRangeAddress(rowIndex + 3, rowIndex + 3, 12, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 3).GetCell(12).CellStyle = style; + ws.GetRow(rowIndex + 3).GetCell(12).SetCellValue("检查日期"); + region = new CellRangeAddress(rowIndex + 4, rowIndex + 4, 12, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 4).GetCell(12).CellStyle = style; + ws.GetRow(rowIndex + 4).GetCell(12).SetCellValue(DateTime.Now.ToString("yyyy年MM月dd日")); + //行6 + ws.GetRow(rowIndex + 5).GetCell(0).CellStyle = styleBold; + ws.GetRow(rowIndex + 5).GetCell(0).SetCellValue("序号"); + region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 1, 7); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 5).GetCell(1).CellStyle = styleBold; + ws.GetRow(rowIndex + 5).GetCell(1).SetCellValue("检查项目"); + region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 8, 12); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 5).GetCell(8).CellStyle = styleBold; + ws.GetRow(rowIndex + 5).GetCell(8).SetCellValue("结果"); + region = new CellRangeAddress(rowIndex + 5, rowIndex + 5, 13, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 5).GetCell(13).CellStyle = styleBold; + ws.GetRow(rowIndex + 5).GetCell(13).SetCellValue("备注"); + + #endregion + + #region 表格 + + var start = rowIndex + 6; + var end = rowIndex + 5 + termItems.Count; + + ws = ExcelCreateRowTitle(ws, hssfworkbook, style, start, end, 0, 17); + + //合并单元格 + for (int hb = start; hb <= end; hb++) + { + region = new CellRangeAddress(hb, hb, 1, 7); + ws.AddMergedRegion(region); + region = new CellRangeAddress(hb, hb, 8, 12); + ws.AddMergedRegion(region); + region = new CellRangeAddress(hb, hb, 13, 17); + ws.AddMergedRegion(region); + } + + //数据 + int num = 1; + var dataIndex = 6; + foreach (var item in termItems) + { + //序号 + ws.GetRow(dataIndex).GetCell(0).SetCellValue(num); + //检查项目 + ws.GetRow(dataIndex).GetCell(1).SetCellValue(item.WorkInspectName); + ws.GetRow(dataIndex).GetCell(1).CellStyle = leftStyle; + //结果 + ws.GetRow(dataIndex).GetCell(8).SetCellValue(""); + //备注 + ws.GetRow(dataIndex).GetCell(13).SetCellValue(""); + dataIndex++; + num++; + } + rowIndex = start + termItems.Count; + + #endregion + + #region 尾部 + + ws = ExcelCreateRowTitle(ws, hssfworkbook, style, rowIndex, rowIndex, 0, 17, 100); + //行1 + ws.GetRow(rowIndex).GetCell(0).SetCellValue("结论"); + region = new CellRangeAddress(rowIndex, rowIndex, 1, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex).GetCell(1).SetCellValue("是否同意进行冲洗吹扫(包括整改意见):"); + ws.GetRow(rowIndex).GetCell(1).CellStyle = leftTopStyle; + //行2 + ws = ExcelCreateRowTitle(ws, hssfworkbook, style, rowIndex + 1, rowIndex + 1, 0, 17, 80); + ws.GetRow(rowIndex + 1).GetCell(0).SetCellValue("检查人员"); + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 1, 4); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(1).SetCellValue("施工单位:"); + ws.GetRow(rowIndex + 1).GetCell(1).CellStyle = leftTopStyle; + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 5, 6); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(5).SetCellValue("总承包商:"); + ws.GetRow(rowIndex + 1).GetCell(5).CellStyle = leftTopStyle; + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 7, 11); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(7).SetCellValue("监理:"); + ws.GetRow(rowIndex + 1).GetCell(7).CellStyle = leftTopStyle; + region = new CellRangeAddress(rowIndex + 1, rowIndex + 1, 12, 17); + ws.AddMergedRegion(region); + ws.GetRow(rowIndex + 1).GetCell(12).SetCellValue("业主:"); + ws.GetRow(rowIndex + 1).GetCell(12).CellStyle = leftTopStyle; + + #endregion + + ws.PrintSetup.Landscape = false; + ws.PrintSetup.PaperSize = 9; + ws.ForceFormulaRecalculation = true; + using (FileStream filess = File.OpenWrite(ReportFileName)) + { + hssfworkbook.Write(filess); + } + FileInfo filet = new FileInfo(ReportFileName); + Response.Clear(); + Response.Charset = "GB2312"; + Response.ContentEncoding = System.Text.Encoding.UTF8; + // 添加头信息,为"文件下载/另存为"对话框指定默认文件名 + Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(this.ConfirmTypeName + "确认签字.xlsx")); + // 添加头信息,指定文件大小,让浏览器能够显示下载进度 + Response.AddHeader("Content-Length", filet.Length.ToString()); + // 指定返回的是一个不能被客户端读取的流,必须被下载 + Response.ContentType = "application/ms-excel"; + // 把文件流发送到客户端 + Response.WriteFile(filet.FullName); + // 停止页面的执行 + Response.End(); + } + } + + /// + /// 导入 + /// + protected void btnImport_Click(object sender, EventArgs e) + { + try + { + if (this.fileData.HasFile == false) + { + ShowNotify("请选择excel文件!", MessageBoxIcon.Warning); + return; + } + string IsXls = Path.GetExtension(this.fileData.FileName).ToString().Trim().ToLower(); + if (IsXls != ".xls" && IsXls != ".xlsx") + { + ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning); + return; + } + string rootPath = Server.MapPath("~/"); + string initFullPath = rootPath + Const.ExcelUrl; + if (!Directory.Exists(initFullPath)) + { + Directory.CreateDirectory(initFullPath); + } + //指定上传文件名称 + string fileUrl = BLL.Funs.GetNewFileName() + IsXls; + //上传文件路径 + string filePath = initFullPath + fileUrl; + //文件上传服务器 + this.fileData.PostedFile.SaveAs(filePath); + //文件上传服务器后的名称 + string fileName = rootPath + Const.ExcelUrl + fileUrl; + //读取Excel + DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false); + if (ds == null) + { + ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning); + return; + } + if (!string.IsNullOrWhiteSpace(message)) + { + ShowNotify(message, MessageBoxIcon.Warning); + return; + } + if (ds.Tables[0].Rows.Count > 6) + { + var fileVerify = VerifyFile(ds); + if (!fileVerify) + { + ShowNotify("请使用导出的Excel作为模板!", MessageBoxIcon.Warning); + return; + } + List list = new List(); + //数据导入 + for (int i = 6; i < ds.Tables[0].Rows.Count; i++) + { + if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][1].ToString())) continue; + if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][8].ToString())) continue; + var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.WorkInspectName.Trim() == ds.Tables[0].Rows[i][1].ToString().Trim()); + if (model == null) continue; + var resultStr = ds.Tables[0].Rows[i][8].ToString(); + var remark = ds.Tables[0].Rows[i][13].ToString(); + var isPass = 0; + if (resultStr.Trim() == "通过") + { + isPass = 1; + } + if (this.ConfirmType == 1) + { + model.SubcontractorIsPass = isPass; + if (!string.IsNullOrWhiteSpace(remark)) + { + model.SubcontractorRemark = remark; + } + } + else if (this.ConfirmType == 2) + { + model.ContractorIsPass = isPass; + if (!string.IsNullOrWhiteSpace(remark)) + { + model.ContractorRemark = remark; + } + } + else if (this.ConfirmType == 3) + { + model.SupervisionIsPass = isPass; + if (!string.IsNullOrWhiteSpace(remark)) + { + model.SupervisionRemark = remark; + } + } + else if (this.ConfirmType == 4) + { + model.OwnerIsPass = isPass; + if (!string.IsNullOrWhiteSpace(remark)) + { + model.OwnerRemark = remark; + } + } + Funs.DB.SubmitChanges(); + } + } + else + { + ShowNotify("文件无数据!", MessageBoxIcon.Warning); + } + var subModel = Funs.DB.PreRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == this.SubInspectId); + if (subModel != null) + { + //1=分包商2=承包商3=监理4=业主 + if (this.ConfirmType == 1) + { + if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.SubcontractorIsPass.GetValueOrDefault() != 1) == 0) + { + subModel.SubcontractorIsAllPass = 1; + } + else + { + subModel.SubcontractorIsAllPass = 0; + } + } + else if (this.ConfirmType == 2) + { + if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.ContractorIsPass.GetValueOrDefault() != 1) == 0) + { + subModel.ContractorIsAllPass = 1; + } + else + { + subModel.ContractorIsAllPass = 0; + } + } + else if (this.ConfirmType == 3) + { + if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.SupervisionIsPass.GetValueOrDefault() != 1) == 0) + { + subModel.SupervisionIsAllPass = 1; + } + else + { + subModel.SupervisionIsAllPass = 0; + } + } + else if (this.ConfirmType == 4) + { + if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == this.SubInspectId && x.OwnerIsPass.GetValueOrDefault() != 1) == 0) + { + subModel.OwnerIsAllPass = 1; + } + else + { + subModel.OwnerIsAllPass = 0; + } + } + Funs.DB.SubmitChanges(); + } + BindGrid(); + fileData.Reset(); + ShowNotify("导入成功!", MessageBoxIcon.Success); + } + catch (Exception ex) + { + ShowNotify(ex.Message, MessageBoxIcon.Warning); + } + } + + #region 私有方法 + + private bool VerifyFile(DataSet ds) + { + var result = true; + + if (ds.Tables[0].Rows[5][0].ToString() != "序号") result = false; + if (ds.Tables[0].Rows[5][1].ToString() != "检查项目") result = false; + if (ds.Tables[0].Rows[5][8].ToString() != "结果") result = false; + if (ds.Tables[0].Rows[5][13].ToString() != "备注") result = false; + + return result; + } + + /// + /// 获取某一列的所有值 + /// + /// 列数据类型 + /// 数据表 + /// 列名 + /// + public static List GetColumnValues(DataTable dtSource, string filedName) + { + return (from r in dtSource.AsEnumerable() select r.Field(filedName)).ToList(); + } + + /// + /// 验证datatable某列是否存在重复 + /// + /// + public bool HasRepeatData(DataTable dt, string[] colName) + { + bool flag = false; + DataView myDataView = new DataView(dt); + if (myDataView.ToTable(true, colName).Rows.Count < dt.Rows.Count) + { + flag = true; + } + return flag; + } + + /// + /// 创建样式 + /// + /// + public static ICellStyle SetExcelStyle(XSSFWorkbook wb, BorderStyle Bottom, BorderStyle Left, BorderStyle Right, BorderStyle Top, VerticalAlignment VerAig, HorizontalAlignment HorAig, double FontSize, bool WrapText = true, bool Bold = false, string FontName = "宋体") + { + ICellStyle style = wb.CreateCellStyle(); + style.BorderBottom = Bottom; + style.BorderLeft = Left; + style.BorderRight = Right; + style.BorderTop = Top; + style.VerticalAlignment = VerAig; + style.Alignment = HorAig; + IFont font = wb.CreateFont(); + font.FontHeightInPoints = FontSize; + font.IsBold = Bold; + font.FontName = FontName; + style.SetFont(font); + style.WrapText = WrapText; + return style; + } + + /// + /// 创建头部 + /// + /// + private XSSFSheet ExcelCreateRowTitle(XSSFSheet ws, XSSFWorkbook hssfworkbook, ICellStyle style, int sRows, int eRows, int cStart, int cEnd, float height = 21) + { + for (int i = sRows; i <= eRows; i++) + { + ws.CreateRow(i); + ws.GetRow(i).HeightInPoints = height; + for (int j = cStart; j <= cEnd; j++) + { + ws.GetRow(i).CreateCell(j); + ws.GetRow(i).CreateCell(j).CellStyle = style; + } + } + return ws; + } + + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.designer.cs b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.designer.cs index 7f26c159..d8b837ef 100644 --- a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/InspectWanderAboutConfirm.aspx.designer.cs @@ -59,6 +59,24 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun /// protected global::FineUIPro.Toolbar Toolbar1; + /// + /// fileData 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.FileUpload fileData; + + /// + /// btnImport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnImport; + /// /// ToolbarFill 控件。 /// @@ -68,6 +86,15 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun /// protected global::FineUIPro.ToolbarFill ToolbarFill; + /// + /// btnExport 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnExport; + /// /// btnSave 控件。 /// @@ -86,6 +113,15 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun /// protected global::FineUIPro.DropDownList ddlrenderIsPass; + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtRemark; + /// /// Window1 控件。 /// diff --git a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx index c24d23d3..42575527 100644 --- a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx +++ b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx @@ -27,7 +27,7 @@ - + @@ -63,7 +63,7 @@ - + @@ -111,45 +111,79 @@ diff --git a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx.cs b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx.cs index 0d8e489f..643b2135 100644 --- a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx.cs +++ b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SubInspectTerm.aspx.cs @@ -175,7 +175,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun /// public void BindGrid(bool typechange = true) { - var result = new List(); + var result = new List(); var workPackId = this.tvControlItem.SelectedNodeID.Split('|')[0]; var subSystemId = this.tvControlItem.SelectedNodeID.Split('|')[1]; var subInspectId = string.Empty; @@ -258,7 +258,8 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun { foreach (var item in list) { - var model = new Brid_SubInspectTermItem(); + var model = new PreRun_SubInspectTermItem(); + model.TermItemId = item.TermItemId; model.SubItemId = item.SubItemId; model.ProjectId = item.ProjectId; model.WorkPackId = item.WorkPackId; @@ -272,44 +273,46 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun model.InspectionResults = item.InspectionResults; model.InspectionIllustrate = item.InspectionIllustrate; model.Sort = item.Sort; - model.isChick = true; result.Add(model); } } - //获取预加载的数据 - var defaultDatas = Funs.DB.PreRun_WorkInspectTemplate.Where(s => s.WorkPackId == workPackId).OrderBy(x => x.Sort).ToList(); - if (defaultDatas.Count > 0) + else { - int index = list.Count + 1; - foreach (var item in defaultDatas) + //获取预加载的数据 + var defaultDatas = Funs.DB.PreRun_WorkInspectTemplate.Where(s => s.WorkPackId == workPackId).OrderBy(x => x.Sort).ToList(); + if (defaultDatas.Count > 0) { - if (list.Count(x => x.WorkInspectName == item.WorkInspectName) == 0) + int index = list.Count + 1; + foreach (var item in defaultDatas) { - var model = new Brid_SubInspectTermItem(); - model.SubItemId = Guid.NewGuid().ToString(); - model.ProjectId = this.CurrUser.LoginProjectId; - model.WorkPackId = item.WorkPackId; - model.WorkInspectId = item.WorkInspectId; - model.WorkInspectName = item.WorkInspectName; - model.InstallationId = subSysModel.InstallationId; - model.ProcessesId = subSysModel.ProcessesId; - model.SystemId = subSysModel.SystemId; - model.SubSystemId = subSysModel.PreRunId; - model.Sort = index + 1; - model.isChick = false; - result.Add(model); - index++; + if (list.Count(x => x.WorkInspectName == item.WorkInspectName) == 0) + { + var model = new PreRun_SubInspectTermItem(); + model.TermItemId = Guid.NewGuid().ToString(); + model.SubItemId = Guid.NewGuid().ToString(); + model.ProjectId = this.CurrUser.LoginProjectId; + model.WorkPackId = item.WorkPackId; + model.WorkInspectId = item.WorkInspectId; + model.WorkInspectName = item.WorkInspectName; + model.InstallationId = subSysModel.InstallationId; + model.ProcessesId = subSysModel.ProcessesId; + model.SystemId = subSysModel.SystemId; + model.SubSystemId = subSysModel.PreRunId; + model.Sort = index + 1; + result.Add(model); + index++; + } } } } Grid1.DataSource = result; Grid1.DataBind(); - if (result.Count(x => x.isChick) > 0) - { - //默认选中行 - var checkids = result.Where(x => x.isChick).Select(a => a.SubItemId); - Grid1.SelectedRowIDArray = checkids.ToArray(); - } + //if (result.Count(x => x.isChick) > 0) + //{ + // //默认选中行 + // var checkids = result.Where(x => x.isChick).Select(a => a.SubItemId); + // Grid1.SelectedRowIDArray = checkids.ToArray(); + //} //检查人绑定 var userList = from user in Funs.DB.Sys_User join projectrole in Funs.DB.Project_ProjectUser on user.UserId equals projectrole.UserId where projectrole.ProjectId == this.CurrUser.LoginProjectId select user; @@ -345,7 +348,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun if (e.CommandName == "Delete") { string rowID = e.RowID; - var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(p => p.SubItemId == rowID); + var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(p => p.TermItemId == rowID); if (model != null) { Funs.DB.PreRun_SubInspectTermItem.DeleteOnSubmit(model); @@ -356,7 +359,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun else { var list = gvList(); - list.RemoveAll(x => x.SubItemId == rowID); + list.RemoveAll(x => x.TermItemId == rowID); Grid1.DataSource = list; Grid1.DataBind(); ShowNotify("删除成功!"); @@ -398,12 +401,6 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun ShowNotify("请选择设备!", MessageBoxIcon.Warning); return; } - if (Grid1.SelectedRowIndexArray.Length == 0) - { - ShowNotify("请选择一条数据!", MessageBoxIcon.Warning); - return; - } - var workPackId = this.tvControlItem.SelectedNodeID.Split('|')[0]; var subSystemId = this.tvControlItem.SelectedNodeID.Split('|')[1]; var subInspectId = string.Empty; @@ -412,22 +409,19 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun subInspectId = this.tvControlItem.SelectedNodeID.Split('|').Last(); } var workPackType = int.Parse(ddlWorkPackType.SelectedValue); - List subTrems = new List(); List subTremItems = new List(); - - //foreach (var item in ddbSysPiping.Values) - //{ var subTrem = Funs.DB.PreRun_SubInspectTerm.FirstOrDefault(x => x.SubInspectId == subInspectId); + var termItems = Funs.DB.PreRun_SubInspectTermItem.Where(x => x.SubInspectId == subInspectId).ToList(); JArray mergedData = Grid1.GetMergedData(); foreach (JObject mergedRow in mergedData) { string status = mergedRow.Value("status"); JObject values = mergedRow.Value("values"); int i = mergedRow.Value("index"); - var subItemId = this.Grid1.Rows[i].DataKeys[0].ToString(); - var workInspectId = this.Grid1.Rows[i].DataKeys[1].ToString(); - if (!Grid1.SelectedRowIndexArray.Contains(i)) continue; + var termItemId = this.Grid1.Rows[i].DataKeys[0].ToString(); + var subItemId = this.Grid1.Rows[i].DataKeys[1].ToString(); + var workInspectId = this.Grid1.Rows[i].DataKeys[2].ToString(); //获取子系统信息 var list = new List(); @@ -460,15 +454,14 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun subTrem.Subcontractor = ddlfbs.SelectedValue; subTrem.Contractor = ddlcbs.SelectedValue; subTrem.Supervision = ddljl.SelectedValue; - subTrem.Owner = ddlyz.SelectedValue; + subTrem.Owner = ddlyz.SelectedValue; Funs.DB.SubmitChanges(); } - - var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.SubInspectId == subInspectId); + var model = Funs.DB.PreRun_SubInspectTermItem.FirstOrDefault(x => x.TermItemId == termItemId); if (model == null) { model = new PreRun_SubInspectTermItem(); - model.TermItemId = Guid.NewGuid().ToString(); + model.TermItemId = termItemId; model.SubItemId = subItemId; model.SubInspectId = subTrem.SubInspectId; model.WorkPackId = workPackId; @@ -500,11 +493,19 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun } } - Funs.DB.PreRun_SubInspectTerm.InsertAllOnSubmit(subTrems); - Funs.DB.PreRun_SubInspectTermItem.InsertAllOnSubmit(subTremItems); + if (subTrems != null) Funs.DB.PreRun_SubInspectTerm.InsertAllOnSubmit(subTrems); + if (subTremItems.Count > 0) Funs.DB.PreRun_SubInspectTermItem.InsertAllOnSubmit(subTremItems); + Funs.DB.SubmitChanges(); + if (Funs.DB.PreRun_SubInspectTermItem.Count(x => x.SubInspectId == subTrem.SubInspectId && x.InspectionResults.GetValueOrDefault() != 1) == 0) + { + subTrem.InspectionIsAllPass = 1; + } + else + { + subTrem.InspectionIsAllPass = 0; + } Funs.DB.SubmitChanges(); this.InitTreeMenu(); - //BindGrid(); ShowNotify("保存成功!"); } catch (Exception ex) @@ -526,6 +527,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun if (subSysModel != null) { var model = new PreRun_SubInspectTermItem(); + model.TermItemId = Guid.NewGuid().ToString(); model.SubItemId = Guid.NewGuid().ToString(); model.ProjectId = this.CurrUser.LoginProjectId; model.WorkPackId = workPackId; @@ -554,17 +556,18 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun string status = mergedRow.Value("status"); JObject values = mergedRow.Value("values"); int i = mergedRow.Value("index"); - var subItemId = this.Grid1.Rows[i].DataKeys[0].ToString(); - var workInspectId = this.Grid1.Rows[i].DataKeys[1] != null ? this.Grid1.Rows[i].DataKeys[1].ToString() : string.Empty; ; - var subInspectId = this.Grid1.Rows[i].DataKeys[2] != null ? this.Grid1.Rows[i].DataKeys[2].ToString() : string.Empty; - var workPackId = this.Grid1.Rows[i].DataKeys[3].ToString(); - var installationId = this.Grid1.Rows[i].DataKeys[4].ToString(); - var processesId = this.Grid1.Rows[i].DataKeys[4].ToString(); - var systemId = this.Grid1.Rows[i].DataKeys[4].ToString(); - var subSystemId = this.Grid1.Rows[i].DataKeys[4].ToString(); + var termItemId = this.Grid1.Rows[i].DataKeys[0].ToString(); + var subItemId = this.Grid1.Rows[i].DataKeys[1].ToString(); + var workInspectId = this.Grid1.Rows[i].DataKeys[2] != null ? this.Grid1.Rows[i].DataKeys[2].ToString() : string.Empty; ; + var subInspectId = this.Grid1.Rows[i].DataKeys[3] != null ? this.Grid1.Rows[i].DataKeys[3].ToString() : string.Empty; + var workPackId = this.Grid1.Rows[i].DataKeys[4].ToString(); + var installationId = this.Grid1.Rows[i].DataKeys[5].ToString(); + var processesId = this.Grid1.Rows[i].DataKeys[6].ToString(); + var systemId = this.Grid1.Rows[i].DataKeys[7].ToString(); + var subSystemId = this.Grid1.Rows[i].DataKeys[8].ToString(); var model = new PreRun_SubInspectTermItem(); - model = new PreRun_SubInspectTermItem(); + model.TermItemId = termItemId; model.SubItemId = subItemId; model.SubInspectId = subInspectId; model.WorkPackId = workPackId; @@ -608,17 +611,6 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun return result; } - /// - /// 绑定实体 - /// - public class Brid_SubInspectTermItem : PreRun_SubInspectTermItem - { - /// - /// 是否选中 - /// - public bool isChick { get; set; } - } - /// /// 类型 /// diff --git a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SysPipingDeviceImport.aspx.cs b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SysPipingDeviceImport.aspx.cs index ffd96e50..b025a6ef 100644 --- a/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SysPipingDeviceImport.aspx.cs +++ b/SGGL/FineUIPro.Web/TestRun/BeforeTestRun/SysPipingDeviceImport.aspx.cs @@ -256,6 +256,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun string IsXls = Path.GetExtension(this.fileData.FileName).ToString().Trim().ToLower(); if (IsXls != ".xls" && IsXls != ".xlsx") { + fileData.Reset(); ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning); return; } @@ -277,6 +278,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false); if (ds == null) { + fileData.Reset(); ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning); return; } @@ -290,12 +292,14 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun var fileVerify = PropertyVerifyFile(ds); if (!fileVerify) { + fileData.Reset(); ShowNotify("请获取正确模板!", MessageBoxIcon.Warning); return; } var columVerify = HasRepeatData(ds.Tables[0], new string[] { "A" }); if (columVerify) { + fileData.Reset(); ShowNotify("模板中存在管道号相同或管道号为空的数据!", MessageBoxIcon.Warning); return; } @@ -317,6 +321,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun { if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][0].ToString())) { + fileData.Reset(); ShowNotify($"第{i}行管道号为空", MessageBoxIcon.Warning); return; } @@ -350,13 +355,16 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun } else { + fileData.Reset(); ShowNotify("文件无数据!", MessageBoxIcon.Warning); } + fileData.Reset(); ZxtgdBrid(); ShowNotify("导入成功!", MessageBoxIcon.Success); } catch (Exception ex) { + fileData.Reset(); ShowNotify(ex.Message, MessageBoxIcon.Warning); } } @@ -494,6 +502,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun string IsXls = Path.GetExtension(this.filegyData.FileName).ToString().Trim().ToLower(); if (IsXls != ".xls" && IsXls != ".xlsx") { + filegyData.Reset(); ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning); return; } @@ -515,6 +524,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false); if (ds == null) { + filegyData.Reset(); ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning); return; } @@ -528,6 +538,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun var fileVerify = TechnologyVerifyFile(ds); if (!fileVerify) { + filegyData.Reset(); ShowNotify("请获取正确模板!", MessageBoxIcon.Warning); return; } @@ -554,6 +565,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun { if (model == null) { + filegyData.Reset(); ShowNotify($"{i}行数据存在错误!", MessageBoxIcon.Warning); return; } @@ -616,6 +628,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun } if (list.GroupBy(x => x.TagNumber).Count() != list.Count) { + filegyData.Reset(); ShowNotify("模板中存在设备位号相同的数据!", MessageBoxIcon.Warning); return; } @@ -625,13 +638,16 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun } else { + filegyData.Reset(); ShowNotify("文件无数据!", MessageBoxIcon.Warning); } + filegyData.Reset(); ZxtgyBrid(); ShowNotify("导入成功!", MessageBoxIcon.Success); } catch (Exception ex) { + filegyData.Reset(); ShowNotify(ex.Message, MessageBoxIcon.Warning); } } diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 471c6cfa..834d18e0 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -128299,6 +128299,8 @@ namespace Model private string _UnitWorkIds; + private string _QRCodeUrl; + private EntitySet _EduTrain_TrainRecordDetail; private EntityRef _Base_Project; @@ -128359,6 +128361,8 @@ namespace Model partial void OnCNProfessionalIdChanged(); partial void OnUnitWorkIdsChanging(string value); partial void OnUnitWorkIdsChanged(); + partial void OnQRCodeUrlChanging(string value); + partial void OnQRCodeUrlChanged(); #endregion public EduTrain_TrainRecord() @@ -128843,6 +128847,26 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_QRCodeUrl", DbType="NVarChar(2000)")] + public string QRCodeUrl + { + get + { + return this._QRCodeUrl; + } + set + { + if ((this._QRCodeUrl != value)) + { + this.OnQRCodeUrlChanging(value); + this.SendPropertyChanging(); + this._QRCodeUrl = value; + this.SendPropertyChanged("QRCodeUrl"); + this.OnQRCodeUrlChanged(); + } + } + } + [global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_EduTrain_TrainDetail_EduTrain_Training", Storage="_EduTrain_TrainRecordDetail", ThisKey="TrainingId", OtherKey="TrainingId", DeleteRule="NO ACTION")] public EntitySet EduTrain_TrainRecordDetail { @@ -263002,6 +263026,14 @@ namespace Model private System.Nullable _OwnerIsPass; + private string _SubcontractorRemark; + + private string _ContractorRemark; + + private string _SupervisionRemark; + + private string _OwnerRemark; + #region 可扩展性方法定义 partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); @@ -263062,6 +263094,14 @@ namespace Model partial void OnSupervisionIsPassChanged(); partial void OnOwnerIsPassChanging(System.Nullable value); partial void OnOwnerIsPassChanged(); + partial void OnSubcontractorRemarkChanging(string value); + partial void OnSubcontractorRemarkChanged(); + partial void OnContractorRemarkChanging(string value); + partial void OnContractorRemarkChanged(); + partial void OnSupervisionRemarkChanging(string value); + partial void OnSupervisionRemarkChanged(); + partial void OnOwnerRemarkChanging(string value); + partial void OnOwnerRemarkChanged(); #endregion public PreRun_SubInspectTermItem() @@ -263629,6 +263669,86 @@ namespace Model } } + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SubcontractorRemark", DbType="VarChar(1000)")] + public string SubcontractorRemark + { + get + { + return this._SubcontractorRemark; + } + set + { + if ((this._SubcontractorRemark != value)) + { + this.OnSubcontractorRemarkChanging(value); + this.SendPropertyChanging(); + this._SubcontractorRemark = value; + this.SendPropertyChanged("SubcontractorRemark"); + this.OnSubcontractorRemarkChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ContractorRemark", DbType="VarChar(1000)")] + public string ContractorRemark + { + get + { + return this._ContractorRemark; + } + set + { + if ((this._ContractorRemark != value)) + { + this.OnContractorRemarkChanging(value); + this.SendPropertyChanging(); + this._ContractorRemark = value; + this.SendPropertyChanged("ContractorRemark"); + this.OnContractorRemarkChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SupervisionRemark", DbType="VarChar(1000)")] + public string SupervisionRemark + { + get + { + return this._SupervisionRemark; + } + set + { + if ((this._SupervisionRemark != value)) + { + this.OnSupervisionRemarkChanging(value); + this.SendPropertyChanging(); + this._SupervisionRemark = value; + this.SendPropertyChanged("SupervisionRemark"); + this.OnSupervisionRemarkChanged(); + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OwnerRemark", DbType="VarChar(1000)")] + public string OwnerRemark + { + get + { + return this._OwnerRemark; + } + set + { + if ((this._OwnerRemark != value)) + { + this.OnOwnerRemarkChanging(value); + this.SendPropertyChanging(); + this._OwnerRemark = value; + this.SendPropertyChanged("OwnerRemark"); + this.OnOwnerRemarkChanged(); + } + } + } + public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; diff --git a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs index 303ca136..1580f762 100644 --- a/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs +++ b/SGGL/WebAPI/Controllers/HSSE/TestRecordController.cs @@ -400,6 +400,28 @@ namespace WebAPI.Controllers return responeData; } - #endregion + #endregion + + #region 扫码获取培训记录详情 + /// + /// 扫码获取培训记录详情 + /// + /// + /// + public Model.ResponeData getTestRecordByTestRecordIdQrCode(string TrainingId) + { + var responeData = new Model.ResponeData(); + try + { + responeData.data = APITestRecordService.getTestRecordByTestRecordIdQrCode(TrainingId); + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion } }