diff --git a/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql b/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql
index 426ff131..81a2ba2f 100644
Binary files a/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql and b/DataBase/版本日志/SGGLDB_WH_2023-09-27.sql differ
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-09-30.sql b/DataBase/版本日志/SGGLDB_WH_2023-09-30.sql
new file mode 100644
index 00000000..8c9b1c05
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_WH_2023-09-30.sql
@@ -0,0 +1,47 @@
+--ר¼
+alter table Check_CheckSpecial add ReceiveMan nvarchar(2000) null;
+
+--States0- 1-ύ 2-ͨ 3-ȷ
+
+
+--רϸͼ
+/****** Object: View [dbo].[View_CheckSpecialDetail] Script Date: 2023/9/30 11:19:54 ******/
+SET ANSI_NULLS ON
+GO
+
+SET QUOTED_IDENTIFIER ON
+GO
+/*LEFT JOIN Sys_Const AS const ON const.ConstValue = detail.HandleStep and const.GroupId='HandleStep'*/
+ALTER VIEW [dbo].[View_CheckSpecialDetail]
+AS
+SELECT detail.CheckSpecialDetailId, detail.CheckSpecialId, detail.CheckItem, checkItemSet.CheckItemName, detail.Unqualified,
+ detail.SortIndex, detail.UnitId, detail.HandleStep, detail.CompleteStatus,
+ (CASE WHEN detail.CompleteStatus = 1 THEN 'ϸ' ELSE 'ϸ' END) AS CompleteStatusName, detail.LimitedDate,
+ detail.CompletedDate, detail.CheckContent, detail.CheckArea,
+ workArea.UnitWorkName + (CASE WHEN workArea.ProjectType = '1' THEN '()' WHEN workArea.ProjectType = '2' THEN '(װ)'
+ ELSE '' END) AS CheckAreaName, detail.DataId, detail.DataType, unit.UnitName,
+ dbo.GetConstTextByIds(detail.HandleStep) AS HandleStepStr,
+ (CASE WHEN detail.DataType LIKE '%1%' THEN '·ĵ:' +
+ (SELECT RectifyNoticesCode
+ FROM Check_RectifyNotices
+ WHERE detail.DataId LIKE '%' + RectifyNoticesId + '%') ELSE '' END)
+ + (CASE WHEN detail.DataType LIKE '%2%' THEN '·:' +
+ (SELECT PunishNoticeCode
+ FROM Check_PunishNotice
+ WHERE detail.DataId LIKE '%' + PunishNoticeId + '%') ELSE '' END)
+ + (CASE WHEN detail.DataType = '3' THEN '·ͣ:' +
+ (SELECT PauseNoticeCode
+ FROM Check_PauseNotice
+ WHERE detail.DataId LIKE '%' + PauseNoticeId + '%') ELSE '' END) AS HandleStepLink, detail.HiddenHazardType,
+ (CASE WHEN detail.HiddenHazardType = '3' THEN 'ش' WHEN detail.HiddenHazardType = '2' THEN 'ϴ' WHEN detail.HiddenHazardType
+ = '1' THEN 'һ' ELSE '' END) AS HiddenHazardTypeName, detail.CheckItemSetId, detail.CheckItemSetContent,
+ detail.Rectification_Date
+FROM dbo.Check_CheckSpecialDetail AS detail LEFT OUTER JOIN
+ dbo.Technique_CheckItemSet AS checkItemSet ON checkItemSet.CheckItemSetId = detail.CheckItem LEFT OUTER JOIN
+ dbo.Base_Unit AS unit ON unit.UnitId = detail.UnitId LEFT OUTER JOIN
+ dbo.WBS_UnitWork AS workArea ON detail.CheckArea = workArea.UnitWorkId
+
+
+GO
+
+
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-07.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-07.sql
new file mode 100644
index 00000000..990bad7f
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_WH_2023-10-07.sql
@@ -0,0 +1,4 @@
+alter table Base_Project add ProjType nvarchar(50) null
+GO
+alter table Base_Project add ProjPhase nvarchar(50) null
+GO
\ No newline at end of file
diff --git a/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql b/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
new file mode 100644
index 00000000..3b5aaea3
--- /dev/null
+++ b/DataBase/版本日志/SGGLDB_WH_2023-10-08.sql
@@ -0,0 +1,31 @@
+Create VIEW [dbo].[View_QualityAudit_GeneralEquipmentQuality] AS
+/*豸Ϣбͼ*/
+SELECT equ.GeneralEquipmentQualityId
+ ,equ.ProjectId
+ ,equ.GeneralEquipmentQualityCode
+ ,equ.UnitId
+ ,Unit.UnitName
+ ,equ.SpecialEquipmentId
+ ,sp.SpecialEquipmentName
+ ,equ.[IsQualified]
+ ,equ.EquipmentCount
+ ,equ.InDate
+ ,equ.Remark
+ ,equ.CompileMan
+ ,U.UserName AS CompileManName
+ ,equ.CompileDate
+ ,equ.QRCodeAttachUrl
+ ,REPLACE(a.AttachUrl,'\', '/') AS AttachUrl
+FROM QualityAudit_GeneralEquipmentQuality AS equ
+LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=equ.UnitId
+LEFT JOIN Base_SpecialEquipment AS sp ON equ.SpecialEquipmentId = sp.SpecialEquipmentId
+LEFT JOIN Sys_User AS U ON U.UserId = equ.CompileMan
+LEFT JOIN AttachFile AS a ON a.ToKeyId = equ.GeneralEquipmentQualityId
+
+
+
+GO
+
+
+update QualityAudit_GeneralEquipmentQuality set QRCodeAttachUrl =NULL
+GO
\ No newline at end of file
diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs
index 7000b083..c89257b8 100644
--- a/SGGL/BLL/API/APIPersonService.cs
+++ b/SGGL/BLL/API/APIPersonService.cs
@@ -58,7 +58,7 @@ namespace BLL
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getPerson = from x in db.View_SitePerson_Person
- where x.PersonId == personId || x.IdentityCard == personId
+ where (x.PersonId == personId || x.IdentityCard == personId)
select new Model.PersonItem
{
PersonId = x.PersonId,
@@ -1752,5 +1752,83 @@ namespace BLL
return message;
}
+
+ #region 二维码扫码获取人员
+ ///
+ /// 二维码扫码获取人员
+ ///
+ ///
+ ///
+ public static Model.PersonItem getPersonByPersonIdQrcode(string personId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getPerson = from x in db.View_SitePerson_Person
+ where (x.PersonId == personId || x.IdentityCard == personId) && x.IsUsed == true
+ select new Model.PersonItem
+ {
+ PersonId = x.PersonId,
+ CardNo = x.CardNo,
+ PersonName = x.PersonName,
+ Sex = x.Sex,
+ SexName = x.SexName,
+ IdentityCard = x.IdentityCard,
+ Address = x.Address,
+ ProjectId = x.ProjectId,
+ ProjectCode = x.ProjectCode,
+ ProjectName = x.ProjectName,
+ UnitId = x.UnitId,
+ UnitCode = x.UnitCode,
+ UnitName = x.UnitName,
+ TeamGroupId = x.TeamGroupId,
+ TeamGroupName = x.TeamGroupName,
+ WorkPostId = x.WorkPostId,
+ WorkPostName = x.WorkPostName,
+ InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
+ OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
+ OutResult = x.OutResult,
+ Telephone = x.Telephone,
+ PhotoUrl = x.PhotoUrl,
+ DepartName = x.DepartName,
+ IsUsed = x.IsUsed,
+ IsUsedName = x.IsUsed == false ? "不启用" : "启用",
+ AuditorId = x.AuditorId,
+ AuditorName = db.Sys_User.First(z => z.UserId == x.AuditorId).UserName,
+ IsForeign = x.IsForeign.HasValue ? x.IsForeign : false,
+ IsOutside = x.IsOutside.HasValue ? x.IsOutside : false,
+ AuditorDate = string.Format("{0:yyyy-MM-dd}", x.AuditorDate),
+ AttachUrl1 = x.IDCardUrl == null ? APIUpLoadFileService.getFileUrl(personId + "#1", null) : x.IDCardUrl.Replace('\\', '/'),
+ AttachUrl2 = APIUpLoadFileService.getFileUrl(personId + "#2", null),
+ AttachUrl3 = APIUpLoadFileService.getFileUrl(personId + "#3", null),
+ AttachUrl4 = getAttachUrl4(x.PersonId),
+ AttachUrl5 = APIUpLoadFileService.getFileUrl(personId + "#5", null),
+ IdcardType = x.IdcardType,
+ IdcardTypeName = x.IdcardTypeName,
+ IdcardStartDate = string.Format("{0:yyyy-MM-dd}", x.IdcardStartDate),
+ IdcardEndDate = string.Format("{0:yyyy-MM-dd}", x.IdcardEndDate),
+ IdcardForever = x.IdcardForever,
+ IdcardForeverStr = x.IdcardForeverStr,
+ PoliticsStatus = x.PoliticsStatus,
+ PoliticsStatusName = x.PoliticsStatusName,
+ IdcardAddress = x.IdcardAddress,
+ Nation = x.Nation,
+ NationName = x.NationName,
+ EduLevel = x.EduLevel,
+ EduLevelName = x.EduLevelName,
+ MaritalStatus = x.MaritalStatus,
+ MaritalStatusName = x.MaritalStatusName,
+ CountryCode = x.CountryCode,
+ CountryName = x.CountryName,
+ ProvinceCode = x.ProvinceCode,
+ ProvinceName = x.ProvinceName,
+ MainCNProfessionalId = x.MainCNProfessionalId,
+ MainCNProfessionalName = x.MainCNProfessionalName,
+ ViceCNProfessionalId = x.ViceCNProfessionalId,
+ ViceCNProfessionalName = x.ViceCNProfessionalName
+ };
+ return getPerson.FirstOrDefault();
+ }
+ }
+ #endregion
}
}
diff --git a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
index 03c4a833..3c15b020 100644
--- a/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
+++ b/SGGL/BLL/API/HSSE/APICheckSpecialService.cs
@@ -14,37 +14,96 @@ namespace BLL
///
///
///
- public static Model.CheckSpecialItem getCheckSpecialById(string CheckSpecialId)
+ public static Model.CheckSpecialItem getCheckSpecialById(string CheckSpecialId,string state="0")
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
- var getInfo = from x in db.Check_CheckSpecial
- where x.CheckSpecialId == CheckSpecialId
- select new Model.CheckSpecialItem
- {
- CheckSpecialId = x.CheckSpecialId,
- ProjectId = x.ProjectId,
- CheckSpecialCode = x.CheckSpecialCode,
- CheckTypeName = (x.CheckType == "1" ? "联合" : "专项"),
- CheckType = x.CheckType,
- CheckItemSetId = x.CheckItemSetId,
- CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItemSetId).CheckItemName,
- CheckPersonId = x.CheckPerson,
- CheckPersonName = db.Sys_User.First(u => u.UserId == x.CheckPerson).UserName,
- CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime),
- DaySummary = x.DaySummary,
- PartInUnitIds = x.PartInUnits,
- PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits),
- PartInPersonIds = x.PartInPersonIds,
- PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds),
- PartInPersonNames2 = x.PartInPersonNames,
- CompileManId = x.CompileMan,
- CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
- States = x.States,
- AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
- CheckSpecialDetailItems = getCheckSpecialDetailList(x.CheckSpecialId),
- };
- return getInfo.FirstOrDefault();
+ if (state == "0")
+ {
+ //状态是0的时候查看所有
+ var getInfo = from x in db.Check_CheckSpecial
+ where x.CheckSpecialId == CheckSpecialId
+ select new Model.CheckSpecialItem
+ {
+ CheckSpecialId = x.CheckSpecialId,
+ ProjectId = x.ProjectId,
+ CheckSpecialCode = x.CheckSpecialCode,
+ CheckTypeName = (x.CheckType == "1" ? "联合" : "专项"),
+ CheckType = x.CheckType,
+ CheckItemSetId = x.CheckItemSetId,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItemSetId).CheckItemName,
+ CheckPersonId = x.CheckPerson,
+ CheckPersonName = db.Sys_User.First(u => u.UserId == x.CheckPerson).UserName,
+ CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime),
+ DaySummary = x.DaySummary,
+ PartInUnitIds = x.PartInUnits,
+ PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits),
+ PartInPersonIds = x.PartInPersonIds,
+ PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds),
+ PartInPersonNames2 = x.PartInPersonNames,
+ CompileManId = x.CompileMan,
+ CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
+ States = x.States,
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
+ CheckSpecialDetailItems = getCheckSpecialDetailList(x.CheckSpecialId,"0"),
+
+ ResponsibleUnit = x.ResponsibleUnit,
+ ResponsibleUnitName = UnitService.GetUnitNameByUnitId(x.ResponsibleUnit),
+ WorkAreaId = x.WorkAreaId,
+ WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
+ QuestionType = x.QuestionType,
+ QuestionTypeName = UnitService.GetQuestionTypeId(x.QuestionType),
+
+ ResponsibleMan = x.ResponsibleMan,
+ ReceiveMan = x.ReceiveMan,
+ ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan)
+
+ };
+ return getInfo.FirstOrDefault();
+ }
+ else {
+ //状态是1的时候查看不合格的子项
+ var getInfo = from x in db.Check_CheckSpecial
+ where x.CheckSpecialId == CheckSpecialId
+ select new Model.CheckSpecialItem
+ {
+ CheckSpecialId = x.CheckSpecialId,
+ ProjectId = x.ProjectId,
+ CheckSpecialCode = x.CheckSpecialCode,
+ CheckTypeName = (x.CheckType == "1" ? "联合" : "专项"),
+ CheckType = x.CheckType,
+ CheckItemSetId = x.CheckItemSetId,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItemSetId).CheckItemName,
+ CheckPersonId = x.CheckPerson,
+ CheckPersonName = db.Sys_User.First(u => u.UserId == x.CheckPerson).UserName,
+ CheckTime = string.Format("{0:yyyy-MM-dd}", x.CheckTime),
+ DaySummary = x.DaySummary,
+ PartInUnitIds = x.PartInUnits,
+ PartInUnitNames = UnitService.getUnitNamesUnitIds(x.PartInUnits),
+ PartInPersonIds = x.PartInPersonIds,
+ PartInPersonNames = UserService.getUserNamesUserIds(x.PartInPersonIds),
+ PartInPersonNames2 = x.PartInPersonNames,
+ CompileManId = x.CompileMan,
+ CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
+ States = x.States,
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
+ CheckSpecialDetailItems = getCheckSpecialDetailList(x.CheckSpecialId,"1"),
+
+ ResponsibleUnit = x.ResponsibleUnit,
+ ResponsibleUnitName = UnitService.GetUnitNameByUnitId(x.ResponsibleUnit),
+ WorkAreaId = x.WorkAreaId,
+ WorkAreaName = UnitWorkService.GetUnitWorkName(x.WorkAreaId),
+ QuestionType = x.QuestionType,
+ QuestionTypeName = UnitService.GetQuestionTypeId(x.QuestionType),
+
+ ResponsibleMan = x.ResponsibleMan,
+ ReceiveMan = x.ReceiveMan,
+ ReceiveManName = UserService.getUserNamesUserIds(x.ReceiveMan)
+
+ };
+ return getInfo.FirstOrDefault();
+ }
+
}
}
#endregion
@@ -56,12 +115,14 @@ namespace BLL
///
///
///
- public static List getCheckSpecialList(string projectId, string states)
+ public static List getCheckSpecialList(string projectId, string states,string userid)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getCheckSpecial = from x in db.Check_CheckSpecial
where x.ProjectId == projectId && x.States ==states
+ //当前保存人、审核人、确认人能看到
+ &&(x.CompileMan==userid || x.ResponsibleMan==userid || userid.Split(',').Contains(x.ReceiveMan))
orderby x.CheckSpecialCode descending
select new Model.CheckSpecialItem
{
@@ -85,6 +146,8 @@ namespace BLL
CompileManName = db.Sys_User.First(u => u.UserId == x.CompileMan).UserName,
States = x.States,
AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialId, null),
+ ReceiveMan=x.ReceiveMan,
+ ReceiveManName= UserService.getUserNamesUserIds(x.ReceiveMan)
};
return getCheckSpecial.ToList();
}
@@ -117,18 +180,39 @@ namespace BLL
PartInPersons = UserService.getUserNamesUserIds(newItem.PartInPersonIds),
PartInPersonNames = newItem.PartInPersonNames2,
CompileMan = newItem.CompileManId,
- States = Const.State_0,
+ States = newItem.States,
+
+ ResponsibleUnit=newItem.ResponsibleUnit,
+ WorkAreaId=newItem.WorkAreaId,
+ QuestionType=newItem.QuestionType,
+ //审核人
+ ResponsibleMan=newItem.ResponsibleMan,
+ ReceiveMan=newItem.ReceiveMan
};
//if (newItem.States != Const.State_1)
//{
// newCheckSpecial.States = Const.State_0;
//}
- if (newItem.CheckSpecialDetailItems == null || newItem.CheckSpecialDetailItems.Count() == 0)
+ //if (newItem.CheckSpecialDetailItems == null || newItem.CheckSpecialDetailItems.Count() == 0)
+ //{
+ // if (newItem.States == Const.State_1)
+ // {
+ // newCheckSpecial.States = Const.State_2;
+ // }
+ //}
+
+ //如果审核状态不为空
+ if (!string.IsNullOrEmpty(newItem.AuditState))
{
- if (newItem.States == Const.State_1)
+ //不同意的话
+ if (newItem.AuditState=="0")
{
- newCheckSpecial.States = Const.State_2;
+ newCheckSpecial.States = "0";
+ }
+ else if (newItem.AuditState=="1")
+ {
+ newCheckSpecial.States = "2";
}
}
@@ -167,31 +251,32 @@ namespace BLL
SaveCheckSpecialDetail(item);
}
//// 单据完成后 系统自动按照单位 整改要求生成隐患整改单
- if (newItem.States == Const.State_1)
- {
- var getC = newItem.CheckSpecialDetailItems.FirstOrDefault(x => x.CompleteStatus == false);
- if (getC == null)
- {
- newCheckSpecial.States = Const.State_2;
- Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial);
- }
- else
- {
- var getNA = newItem.CheckSpecialDetailItems.FirstOrDefault(x => x.CompleteStatus == false && (x.HandleStep== null || x.HandleStep==""));
- if (getNA == null)
- {
- 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);
- }
- }
- else
- {
- message += "存在待整改,没有处理措施的记录!";
- }
- }
- }
+ ///五环不需要
+ //if (newItem.States == Const.State_1)
+ //{
+ // var getC = newItem.CheckSpecialDetailItems.FirstOrDefault(x => x.CompleteStatus == false);
+ // if (getC == null)
+ // {
+ // newCheckSpecial.States = Const.State_2;
+ // Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial);
+ // }
+ // else
+ // {
+ // var getNA = newItem.CheckSpecialDetailItems.FirstOrDefault(x => x.CompleteStatus == false && (x.HandleStep== null || x.HandleStep==""));
+ // if (getNA == null)
+ // {
+ // 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);
+ // }
+ // }
+ // else
+ // {
+ // message += "存在待整改,没有处理措施的记录!";
+ // }
+ // }
+ //}
}
return message;
}
@@ -204,42 +289,83 @@ namespace BLL
///
///
///
- public static List getCheckSpecialDetailList(string checkSpecialId)
+ public static List getCheckSpecialDetailList(string checkSpecialId,string CompleteStatus="0")
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
- var getInfo = from x in db.Check_CheckSpecialDetail
- where x.CheckSpecialId == checkSpecialId
- orderby x.SortIndex
- select new Model.CheckSpecialDetailItem
- {
- CheckSpecialDetailId = x.CheckSpecialDetailId,
- CheckSpecialId = x.CheckSpecialId,
- CheckItemSetId = x.CheckItem,
- CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItem).CheckItemName,
- CheckContent = x.CheckContent,
- SortIndex = x.SortIndex,
- Unqualified = x.Unqualified,
- Suggestions = x.Suggestions,
- WorkArea = db.WBS_UnitWork.First(y=>y.UnitWorkId ==x.CheckArea).UnitWorkName,
- WorkAreaId=x.CheckArea,
- UnitId = x.UnitId,
- UnitName = db.Base_Unit.First(y => y.UnitId == x.UnitId).UnitName,
- HandleStep = x.HandleStep,
- HandleStepName = getNames(x.HandleStep),
- HiddenHazardType = x.HiddenHazardType,
- HiddenHazardTypeName = x.HiddenHazardType == "3" ? "重大" : (x.HiddenHazardType == "2" ? "较大" : "一般"),
- LimitedDate = string.Format("{0:yyyy-MM-dd}", x.LimitedDate),
- CompleteStatus = x.CompleteStatus,
- CompleteStatusName = x.CompleteStatus == true ? "已整改" : "待整改",
- CompletedDate = string.Format("{0:yyyy-MM-dd}", x.CompletedDate),
- AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialDetailId, null),
+ if (CompleteStatus == "0")
+ {
+ var getInfo = from x in db.Check_CheckSpecialDetail
+ where x.CheckSpecialId == checkSpecialId
+ orderby x.SortIndex
+ select new Model.CheckSpecialDetailItem
+ {
+ CheckSpecialDetailId = x.CheckSpecialDetailId,
+ CheckSpecialId = x.CheckSpecialId,
+ CheckItemSetId = x.CheckItem,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItem).CheckItemName,
+ CheckContent = x.CheckContent,
+ SortIndex = x.SortIndex,
+ Unqualified = x.Unqualified,
+ Suggestions = x.Suggestions,
+ WorkArea = db.WBS_UnitWork.First(y => y.UnitWorkId == x.CheckArea).UnitWorkName,
+ WorkAreaId = x.CheckArea,
+ UnitId = x.UnitId,
+ UnitName = db.Base_Unit.First(y => y.UnitId == x.UnitId).UnitName,
+ HandleStep = x.HandleStep,
+ HandleStepName = getNames(x.HandleStep),
+ HiddenHazardType = x.HiddenHazardType,
+ HiddenHazardTypeName = x.HiddenHazardType == "3" ? "重大" : (x.HiddenHazardType == "2" ? "较大" : "一般"),
+ LimitedDate = string.Format("{0:yyyy-MM-dd}", x.LimitedDate),
+ CompleteStatus = x.CompleteStatus,
+ CompleteStatusName = x.CompleteStatus == true ? "已整改" : "待整改",
+ CompletedDate = string.Format("{0:yyyy-MM-dd}", x.CompletedDate),
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialDetailId, null),
- CheckItemDetailSetId = x.CheckItemSetId,
- CheckItemDetailContent = x.CheckItemSetContent,
- Rectification_Date = string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
- };
- return getInfo.ToList();
+ CheckItemDetailSetId = x.CheckItemSetId,
+ CheckItemDetailContent = x.CheckItemSetContent,
+ Rectification_Date = string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
+ CheckOpinions = x.CheckOpinions,
+ };
+ return getInfo.ToList();
+ }
+ else {
+ //查询不合格子项
+ var getInfo = from x in db.Check_CheckSpecialDetail
+ where x.CheckSpecialId == checkSpecialId && x.CompleteStatus==false
+ orderby x.SortIndex
+ select new Model.CheckSpecialDetailItem
+ {
+ CheckSpecialDetailId = x.CheckSpecialDetailId,
+ CheckSpecialId = x.CheckSpecialId,
+ CheckItemSetId = x.CheckItem,
+ CheckItemSetName = db.Technique_CheckItemSet.First(y => y.CheckItemSetId == x.CheckItem).CheckItemName,
+ CheckContent = x.CheckContent,
+ SortIndex = x.SortIndex,
+ Unqualified = x.Unqualified,
+ Suggestions = x.Suggestions,
+ WorkArea = db.WBS_UnitWork.First(y => y.UnitWorkId == x.CheckArea).UnitWorkName,
+ WorkAreaId = x.CheckArea,
+ UnitId = x.UnitId,
+ UnitName = db.Base_Unit.First(y => y.UnitId == x.UnitId).UnitName,
+ HandleStep = x.HandleStep,
+ HandleStepName = getNames(x.HandleStep),
+ HiddenHazardType = x.HiddenHazardType,
+ HiddenHazardTypeName = x.HiddenHazardType == "3" ? "重大" : (x.HiddenHazardType == "2" ? "较大" : "一般"),
+ LimitedDate = string.Format("{0:yyyy-MM-dd}", x.LimitedDate),
+ CompleteStatus = x.CompleteStatus,
+ CompleteStatusName = x.CompleteStatus == true ? "已整改" : "待整改",
+ CompletedDate = string.Format("{0:yyyy-MM-dd}", x.CompletedDate),
+ AttachUrl1 = APIUpLoadFileService.getFileUrl(x.CheckSpecialDetailId, null),
+
+ CheckItemDetailSetId = x.CheckItemSetId,
+ CheckItemDetailContent = x.CheckItemSetContent,
+ Rectification_Date = string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
+ CheckOpinions = x.CheckOpinions,
+ };
+ return getInfo.ToList();
+ }
+
}
}
///
@@ -290,6 +416,7 @@ namespace BLL
CheckItemDetailSetId=x.CheckItemSetId,
CheckItemDetailContent=x.CheckItemSetContent,
Rectification_Date= string.Format("{0:yyyy-MM-dd}", x.Rectification_Date),
+ CheckOpinions=x.CheckOpinions
};
return getInfo.First();
}
@@ -316,7 +443,7 @@ namespace BLL
UnitId = newDetail.UnitId,
HandleStep = newDetail.HandleStep,
HiddenHazardType = newDetail.HiddenHazardType,
- CompleteStatus = newDetail.CompleteStatus ?? false,
+ CompleteStatus = newDetail.CompleteStatus,
RectifyNoticeId = newDetail.RectifyNoticeId,
LimitedDate = Funs.GetNewDateTime(newDetail.LimitedDate),
CompletedDate = Funs.GetNewDateTime(newDetail.CompletedDate),
@@ -325,10 +452,11 @@ namespace BLL
CheckArea = newDetail.WorkAreaId,
CheckContent = newDetail.CheckContent,
- //整改日期、检查内容、检查内容id
+ //整改日期、检查内容、检查内容id、处理意见
CheckItemSetId= newDetail.CheckItemDetailSetId,
CheckItemSetContent= newDetail.CheckItemDetailContent,
- Rectification_Date = Funs.GetNewDateTime(newDetail.Rectification_Date)
+ Rectification_Date = Funs.GetNewDateTime(newDetail.Rectification_Date),
+ CheckOpinions=newDetail.CheckOpinions,
};
if (newCheckSpecialDetail.CompleteStatus == false && newCheckSpecialDetail.HandleStep.Contains("1") && string.IsNullOrEmpty(newCheckSpecialDetail.HiddenHazardType))
{
@@ -371,10 +499,11 @@ namespace BLL
updateDetail.CheckArea = newCheckSpecialDetail.CheckArea;
updateDetail.CheckContent = newCheckSpecialDetail.CheckContent;
- //整改日期、检查内容、检查内容id
+ //整改日期、检查内容、检查内容id、处理意见
updateDetail.CheckItemSetId = newDetail.CheckItemDetailSetId;
updateDetail.CheckItemSetContent = newDetail.CheckItemDetailContent;
updateDetail.Rectification_Date = Funs.GetNewDateTime(newDetail.Rectification_Date);
+ updateDetail.CheckOpinions = newDetail.CheckOpinions;
db.SubmitChanges();
}
////保存附件
diff --git a/SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs b/SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs
new file mode 100644
index 00000000..458e6492
--- /dev/null
+++ b/SGGL/BLL/API/HSSE/APIGeneralEquipmentQualityService.cs
@@ -0,0 +1,148 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using EmitMapper;
+
+namespace BLL
+{
+ public static class APIGeneralEquipmentQualityService
+ {
+ #region 根据equipmentQualityId获取机具设备信息
+ ///
+ /// 根据equipmentQualityId获取机具设备信息
+ ///
+ ///
+ ///
+ public static Model.EquipmentQualityItem getEquipmentQualityByEquipmentQualityIdFactoryCode(string equipmentQualityId)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getEquipmentQuality = (from x in db.View_QualityAudit_GeneralEquipmentQuality
+ where x.GeneralEquipmentQualityId == equipmentQualityId
+ select new Model.EquipmentQualityItem
+ {
+ EquipmentQualityId = x.GeneralEquipmentQualityId,
+ ProjectId = x.ProjectId,
+ EquipmentQualityCode = x.GeneralEquipmentQualityCode,
+ EquipmentCount = x.EquipmentCount.HasValue? x.EquipmentCount.Value.ToString():"",
+ UnitId = x.UnitId,
+ IsQualified =x.IsQualified.HasValue? x.IsQualified.Value?"是":"否":"",
+ UnitName = x.UnitName,
+ SpecialEquipmentName = x.SpecialEquipmentName,
+ InDate = string.Format("{0:yyyy-MM-dd}", x.InDate),
+ Remark = x.Remark,
+ CompileManId = x.CompileMan,
+ CompileManName = x.CompileManName,
+ CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate),
+ AttachUrl = x.AttachUrl.Replace('\\', '/')
+ }); ;
+ return getEquipmentQuality.FirstOrDefault();
+ }
+ }
+ #endregion
+
+ #region 获取机具设备列表信息
+ ///
+ /// 获取机具设备列表信息
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static List getEquipmentQualityList(string projectId, string unitId, string strParam)
+ {
+ using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
+ {
+ var getEquipmentQuality = from x in db.View_QualityAudit_GeneralEquipmentQuality
+ where x.ProjectId == projectId && (x.UnitId == unitId || unitId == null)
+ && (strParam == null || x.SpecialEquipmentName.Contains(strParam) )
+ orderby x.GeneralEquipmentQualityCode descending
+ select new Model.EquipmentQualityItem
+ {
+ EquipmentQualityId = x.GeneralEquipmentQualityId,
+ ProjectId = x.ProjectId,
+ EquipmentQualityCode = x.GeneralEquipmentQualityCode,
+ EquipmentCount = x.EquipmentCount.HasValue ? x.EquipmentCount.Value.ToString() : "",
+ UnitId = x.UnitId,
+ IsQualified = x.IsQualified.HasValue ? x.IsQualified.Value ? "是" : "否" : "",
+ UnitName = x.UnitName,
+ SpecialEquipmentName = x.SpecialEquipmentName,
+ InDate = string.Format("{0:yyyy-MM-dd}", x.InDate),
+ Remark = x.Remark,
+ CompileManId = x.CompileMan,
+ CompileManName = x.CompileManName,
+ CompileDate = string.Format("{0:yyyy-MM-dd}", x.CompileDate),
+ AttachUrl = x.AttachUrl.Replace('\\', '/')
+ };
+ return getEquipmentQuality.ToList();
+ }
+ }
+ #endregion
+
+ #region 保存QualityAudit_EquipmentQuality
+ ///
+ /// 保存QualityAudit_EquipmentQuality
+ ///
+ /// 机具设备资质
+ ///
+ public static void SaveEquipmentQuality(Model.EquipmentQualityItem newItem)
+ {
+ Model.SGGLDB db = Funs.DB;
+ Model.QualityAudit_GeneralEquipmentQuality newEquipmentQuality = new Model.QualityAudit_GeneralEquipmentQuality
+ {
+ GeneralEquipmentQualityId = newItem.EquipmentQualityId,
+ ProjectId = newItem.ProjectId,
+ GeneralEquipmentQualityCode = newItem.EquipmentQualityCode,
+ UnitId = newItem.UnitId,
+ SpecialEquipmentId = newItem.SpecialEquipmentId,
+ InDate = Funs.GetNewDateTime(newItem.InDate),
+ Remark = newItem.Remark,
+ CompileMan = newItem.CompileManId,
+ };
+ if (!string.IsNullOrEmpty(newItem.IsQualified))
+ {
+ if ("1".Equals(newItem.IsQualified))
+ {
+ newEquipmentQuality.IsQualified = true;
+ }
+ else
+ {
+ newEquipmentQuality.IsQualified = false;
+
+ }
+ }
+ if (!string.IsNullOrEmpty(newItem.EquipmentCount))
+ {
+ try
+ {
+ newEquipmentQuality.EquipmentCount = int.Parse(newItem.EquipmentCount);
+ }
+ catch (Exception e) { }
+ }
+ var updateEquipmentQuality = db.QualityAudit_GeneralEquipmentQuality.FirstOrDefault(x => x.GeneralEquipmentQualityId == newItem.EquipmentQualityId);
+ if (updateEquipmentQuality == null)
+ {
+ newEquipmentQuality.CompileDate = DateTime.Now;
+ newEquipmentQuality.GeneralEquipmentQualityId = SQLHelper.GetNewID();
+ newEquipmentQuality.GeneralEquipmentQualityCode = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.GeneralEquipmentQualityMenuId, newItem.ProjectId, newItem.UnitId);
+ GeneralEquipmentQualityService.AddGeneralEquipmentQuality(newEquipmentQuality);
+ }
+ else
+ {
+ GeneralEquipmentQualityService.UpdateGeneralEquipmentQuality(newEquipmentQuality);
+ }
+ if (!string.IsNullOrEmpty(newItem.AttachUrl))
+ {
+ ////保存附件
+ UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl, 10, null), newItem.AttachUrl, Const.GeneralEquipmentQualityMenuId, newEquipmentQuality.GeneralEquipmentQualityId);
+ }
+ else
+ {
+ CommonService.DeleteAttachFileById(newEquipmentQuality.GeneralEquipmentQualityId);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/SGGL/BLL/API/HSSE/APIResourcesService.cs b/SGGL/BLL/API/HSSE/APIResourcesService.cs
index 1aab6df0..21ccacce 100644
--- a/SGGL/BLL/API/HSSE/APIResourcesService.cs
+++ b/SGGL/BLL/API/HSSE/APIResourcesService.cs
@@ -357,22 +357,42 @@ namespace BLL
///
/// 1-checkType;2-专项检查;3-综合检查
///
- public static List getCheckItemSetListBySupCheckItemId(string supTypeId, string checkType)
+ public static List getCheckItemSetListBySupCheckItemId(string supTypeId, string checkType,string supName="")
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
- var getDataLists = from x in db.Technique_CheckItemSet
- where x.CheckType == checkType && (x.SupCheckItem == supTypeId || (supTypeId == null && x.SupCheckItem == "0"))
- orderby x.SortIndex
- select new Model.ResourcesItem
- {
- ResourcesId = x.CheckItemSetId,
- ResourcesCode = x.MapCode,
- ResourcesName = x.CheckItemName,
- SupResourcesId = x.SupCheckItem,
- IsEndLever = x.IsEndLever,
- };
- return getDataLists.ToList();
+ if (!string.IsNullOrEmpty(supName))
+ {
+ var getDataLists = from x in db.Technique_CheckItemSet
+ where x.CheckType == checkType && (x.SupCheckItem == supTypeId || (supTypeId == null && x.SupCheckItem == "0"))
+ && x.CheckItemName.Contains(supName)
+ orderby x.SortIndex
+ select new Model.ResourcesItem
+ {
+ ResourcesId = x.CheckItemSetId,
+ ResourcesCode = x.MapCode,
+ ResourcesName = x.CheckItemName,
+ SupResourcesId = x.SupCheckItem,
+ IsEndLever = x.IsEndLever,
+ };
+ return getDataLists.ToList();
+ }
+ else {
+ var getDataLists = from x in db.Technique_CheckItemSet
+ where x.CheckType == checkType && (x.SupCheckItem == supTypeId || (supTypeId == null && x.SupCheckItem == "0"))
+ orderby x.SortIndex
+ select new Model.ResourcesItem
+ {
+ ResourcesId = x.CheckItemSetId,
+ ResourcesCode = x.MapCode,
+ ResourcesName = x.CheckItemName,
+ SupResourcesId = x.SupCheckItem,
+ IsEndLever = x.IsEndLever,
+ };
+ return getDataLists.ToList();
+ }
+
+
}
}
diff --git a/SGGL/BLL/BLL.csproj b/SGGL/BLL/BLL.csproj
index f8b66252..81372eff 100644
--- a/SGGL/BLL/BLL.csproj
+++ b/SGGL/BLL/BLL.csproj
@@ -103,6 +103,7 @@
+
@@ -174,6 +175,7 @@
+
diff --git a/SGGL/BLL/Common/NPOIExcel.cs b/SGGL/BLL/Common/NPOIExcel.cs
new file mode 100644
index 00000000..62868551
--- /dev/null
+++ b/SGGL/BLL/Common/NPOIExcel.cs
@@ -0,0 +1,1559 @@
+using NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using NPOI.SS.Util;
+using NPOI.XSSF.UserModel;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.OleDb;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace BLL.Common
+{
+ public class NPOIExcel
+ {
+ internal IWorkbook Book { get; set; }
+
+ private int sheetID = 0;
+ ///
+ /// 当前活动的SheetID,所有的操作将指向这个Sheet
+ ///
+ public int ActiveSheetID
+ {
+ get
+ {
+ return sheetID;
+ }
+ set
+ {
+ sheetID = value;
+ }
+ }
+
+ ///
+ /// 当前活动的SheetName,所有的操作将指向这个Sheet
+ ///
+ public String ActiveSheetName
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).SheetName;
+ }
+ set
+ {
+ sheetID = Book.GetSheetIndex(value);
+ }
+ }
+ ///
+ /// 当前活动的Sheet,所有的操作将指向这个Sheet
+ ///
+ public ISheet ActiveSheet
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID);
+ }
+ }
+
+ ///
+ /// 第一行非空行的行号
+ ///
+ public int FirstRowNum
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).FirstRowNum;
+ }
+ }
+
+ ///
+ /// 最后一行非空行的行号
+ ///
+ public int LastRostNum
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).LastRowNum;
+ }
+ }
+
+ ///
+ /// 无模板的Excel生成或操作
+ ///
+ public NPOIExcel()
+ {
+ Book = new HSSFWorkbook();
+ Book.CreateSheet();
+ }
+
+ public NPOIExcel(Stream fileStream, String fileName)
+ {
+ if (fileName.Substring(fileName.LastIndexOf(".")) == ".xls")
+ {
+ Book = new HSSFWorkbook(fileStream);
+ }
+ else
+ {
+ Book = new XSSFWorkbook(fileStream);
+ }
+ }
+ ///
+ /// 带模板或数据的Excel生成或操作
+ ///
+ ///
+ public NPOIExcel(String fileName)
+ {
+ Book = CreateBook(fileName);
+ }
+
+ ///
+ /// 创建Excel Book
+ ///
+ /// 模板文件名
+ ///
+ private IWorkbook CreateBook(String fileName)
+ {
+ FileInfo file = new FileInfo(fileName);
+ if (!file.Exists)
+ {
+ File.Create(fileName).Close();
+ }
+ FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
+ IWorkbook book;
+ if (file.Extension == ".xls")
+ {
+ book = new HSSFWorkbook(fs);
+ }
+ else
+ {
+ book = new XSSFWorkbook(fs);
+ }
+ fs.Close();
+ if (book.NumberOfSheets == 0)
+ {
+ book.CreateSheet();
+ }
+ return book;
+ }
+
+ ///
+ /// 新建Sheet
+ ///
+ /// 新建Sheet
+ public ISheet CreateSheet()
+ {
+ return Book.CreateSheet();
+ }
+
+ ///
+ /// 新建Sheet
+ ///
+ /// 新建Sheet的名称
+ /// 新建Sheet
+ public ISheet CreateSheet(String sheetName)
+ {
+ return Book.CreateSheet(sheetName);
+ }
+
+ ///
+ /// 设置行高
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 高度
+ public void SetRowHeight(int rowIndex, float height)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ row.Height = (short)(height * 20);
+ }
+
+ ///
+ /// 设置列宽
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 列号
+ /// 宽度
+ public void SetColumnWidth(int columnIndex, short width)
+ {
+ Book.GetSheetAt(sheetID).SetColumnWidth(columnIndex, width * 256);
+ }
+
+ ///
+ /// 获取或设置默认行高
+ /// 注:只对当前ActiveSheet有效
+ ///
+ public short DefaultRowHeight
+ {
+ get
+ {
+ return (short)(Book.GetSheetAt(sheetID).DefaultRowHeight / 20);
+ }
+ set
+ {
+ Book.GetSheetAt(sheetID).DefaultRowHeight = (short)(value * 20);
+
+ }
+ }
+
+ ///
+ /// 获取或设置默认列宽
+ /// 注:只对当前ActiveSheet有效
+ ///
+ public int DefaultColWidth
+ {
+ get
+ {
+ return Book.GetSheetAt(sheetID).DefaultColumnWidth;
+ }
+ set
+ {
+ Book.GetSheetAt(sheetID).DefaultColumnWidth = value;
+ }
+ }
+
+ ///
+ /// 某一列的列宽自动调整大小
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 列号
+ public void AutoColWidth(int colIndex)
+ {
+ Book.GetSheetAt(sheetID).AutoSizeColumn(colIndex, true);
+ }
+
+ ///
+ /// 隐藏一行
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ public void HiddenRow(int rowIndex)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ row.ZeroHeight = true;
+ }
+
+ ///
+ /// 删除一行
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ public void RemoveRow(int rowIndex)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row != null)
+ {
+ ActiveSheet.RemoveRow(row);
+ }
+ }
+
+ ///
+ /// 读取单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ public object ReadValue(int rowIndex, int columnIndex, bool? isDateTime = null)
+ {
+ try
+ {
+ ICell cell = Book.GetSheetAt(sheetID).GetRow(rowIndex).GetCell(columnIndex);
+ short df = cell.CellStyle.DataFormat;
+
+ //return cell.ToString();
+ switch (cell.CellType)
+ {
+ case CellType.Blank:
+ return null;
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ {
+ switch (cell.CachedFormulaResultType)
+ {
+ case CellType.Blank:
+ return "";
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ throw new Exception("The Formula of this cell is too complex!");
+ case CellType.Numeric:
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ case CellType.Numeric:
+ {
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ catch (System.NullReferenceException)
+ {
+ return null;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ ///
+ /// 设置单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ public void SetValue(int rowIndex, int columnIndex, object value)
+ {
+ SetValue(rowIndex, columnIndex, value, false);
+ }
+ public void SetPicValue(int rowIndex, int columnIndex, string value)
+ {
+ byte[] bytes = System.IO.File.ReadAllBytes(value);
+ int pictureIdx = Book.AddPicture(bytes, PictureType.JPEG);
+
+ // 第三步:创建画部
+ IDrawing patriarch = ActiveSheet.CreateDrawingPatriarch();
+ // 第四步:设置锚点
+ int rowline = 1; // y方向
+ // 参数说明:(在起始单元格的X坐标0-1023,Y的坐标0-255,在终止单元格的X坐标0-1023,Y的坐标0-255,起始单元格列数,行数,终止单元格列数,行数)
+ IClientAnchor anchor = patriarch.CreateAnchor(0, 0, 0, 0, columnIndex, rowIndex, columnIndex+1, rowIndex + 1);
+ // 第五步:把图片插到相应的位置+1
+ IPicture pict = patriarch.CreatePicture(anchor, pictureIdx);
+
+
+ }
+ ///
+ /// 设置单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ /// 是否是公式
+ public void SetValue(int rowIndex, int columnIndex, object value, bool isFormula)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ ICell cell = row.GetCell(columnIndex);
+ if (cell == null)
+ {
+ cell = row.CreateCell(columnIndex);
+ }
+ if (value == null)
+ {
+ cell.SetCellValue("");
+ }
+ if (isFormula)
+ {
+ cell.SetCellFormula(value.ToString());
+ }
+ else
+ {
+ if (value is short)
+ {
+ cell.SetCellValue((short)value);
+ }
+ else if (value is int)
+ {
+ cell.SetCellValue((int)value);
+ }
+ else if (value is long)
+ {
+ cell.SetCellValue((long)value);
+ }
+ else if (value is float)
+ {
+ cell.SetCellValue((float)value);
+ }
+ else if (value is double)
+ {
+ cell.SetCellValue((double)value);
+ }
+ else if (value is bool)
+ {
+ cell.SetCellValue((bool)value);
+ }
+ else if (value is DateTime)
+ {
+ cell.SetCellValue((DateTime)value);
+ }
+ else if (value == null)
+ {
+ }
+ else
+ {
+ cell.SetCellValue(value.ToString());
+ }
+ }
+
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 验证类型
+ /// 验证方式
+ /// 最小值
+ /// 最大值
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, NPOIDataType type, OperatorTypes operatorType, String minValue, String maxValue)
+ {
+ SetValueRange(startRowIndex, EndRowIndex, startColInex, endColIndex, type, operatorType, minValue, maxValue, "", "");
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 验证类型
+ /// 验证方式
+ /// 最小值
+ /// 最大值
+ /// 数据格式
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, NPOIDataType type, OperatorTypes operatorType, String minValue, String maxValue, String formate)
+ {
+ SetValueRange(startRowIndex, EndRowIndex, startColInex, endColIndex, type, operatorType, minValue, maxValue, formate, "");
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 验证类型
+ /// 验证方式
+ /// 最小值
+ /// 最大值
+ /// 数据格式
+ /// 报错信息
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, NPOIDataType type, OperatorTypes operatorType, String minValue, String maxValue, String formate, String AlertMassage)
+ {
+ CellRangeAddressList regions = new CellRangeAddressList(startRowIndex, EndRowIndex, startColInex, endColIndex);
+ DVConstraint constraint = DVConstraint.CreateNumericConstraint(ValidationType.ANY, 0, null, null);
+ switch (type)
+ {
+ case NPOIDataType.Integer:
+ constraint = DVConstraint.CreateNumericConstraint(ValidationType.INTEGER, (int)operatorType, minValue, maxValue);
+ break;
+ case NPOIDataType.Float:
+ constraint = DVConstraint.CreateNumericConstraint(ValidationType.DECIMAL, (int)operatorType, minValue, maxValue);
+ break;
+ case NPOIDataType.Date:
+ if (formate == "")
+ {
+ formate = "yyyy/MM/dd";
+ }
+ constraint = DVConstraint.CreateDateConstraint((int)operatorType, minValue, maxValue, formate);
+ break;
+ case NPOIDataType.Time:
+ constraint = DVConstraint.CreateTimeConstraint((int)operatorType, minValue, maxValue);
+ break;
+ case NPOIDataType.TextLength:
+ constraint = DVConstraint.CreateNumericConstraint(ValidationType.TEXT_LENGTH, (int)operatorType, minValue, maxValue);
+ break;
+ default:
+ break;
+ }
+
+ HSSFDataValidation dataValidate1 = new HSSFDataValidation(regions, constraint);
+ if (!String.IsNullOrEmpty(AlertMassage))
+ {
+ dataValidate1.CreateErrorBox("Error", AlertMassage);
+ }
+ ActiveSheet.AddValidationData(dataValidate1);
+
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 值系列
+ public void SetValueRange(int startRowIndex, int EndRowIndex, int startColInex, int endColIndex, String[] dataRange)
+ {
+
+ SetValueRange(startRowIndex, EndRowIndex, startColInex, endColIndex, dataRange, "");
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 值系列
+ /// 报错信息
+ public void SetValueRange(int startRowIndex, int endRowIndex, int startColInex, int endColIndex, String[] dataRange, String alertMassage)
+ {
+ ISheetConditionalFormatting hscf = ActiveSheet.SheetConditionalFormatting;
+ CellRangeAddress[] regions = {
+ new CellRangeAddress(startRowIndex, endRowIndex,startColInex,endColIndex)
+ };
+
+ CellRangeAddressList rangeList = new CellRangeAddressList();
+ rangeList.AddCellRangeAddress(new CellRangeAddress(startRowIndex, endRowIndex, startColInex, endColIndex));
+ DVConstraint dvconstraint = DVConstraint.CreateExplicitListConstraint(dataRange);
+ HSSFDataValidation dataValidation = new HSSFDataValidation(rangeList, dvconstraint);
+
+ if (!String.IsNullOrEmpty(alertMassage))
+ {
+ dataValidation.CreateErrorBox("Error", alertMassage);
+ }
+
+ ActiveSheet.AddValidationData(dataValidation);
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 计算公式
+ /// 报错信息
+ public void SetValueRange(int startRowIndex, int endRowIndex, int startColInex, int endColIndex, String Formula, String alertMassage)
+ {
+ ISheetConditionalFormatting hscf = ActiveSheet.SheetConditionalFormatting;
+ CellRangeAddress[] regions = {
+ new CellRangeAddress(startRowIndex, endRowIndex,startColInex,endColIndex)
+ };
+
+ CellRangeAddressList rangeList = new CellRangeAddressList();
+ rangeList.AddCellRangeAddress(new CellRangeAddress(startRowIndex, endRowIndex, startColInex, endColIndex));
+ DVConstraint dvconstraint = DVConstraint.CreateFormulaListConstraint(Formula);
+ HSSFDataValidation dataValidation = new HSSFDataValidation(rangeList, dvconstraint);
+
+ if (!String.IsNullOrEmpty(alertMassage))
+ {
+ dataValidation.CreateErrorBox("Error", alertMassage);
+ }
+
+ ActiveSheet.AddValidationData(dataValidation);
+ }
+
+ ///
+ /// 设置一个区域内的单元格的值范围
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行
+ /// 结束行
+ /// 开始列
+ /// 结束列
+ /// 计算公式
+ public void SetValueRange(int startRowIndex, int endRowIndex, int startColInex, int endColIndex, String Formula)
+ {
+ SetValueRange(startRowIndex, endColIndex, startRowIndex, endColIndex, Formula, "");
+ }
+
+ ///
+ /// 生成单元格样式
+ ///
+ /// 与当前Excel相关的单元格样式
+ public ICellStyle CreateCellStyle()
+ {
+ return Book.CreateCellStyle();
+ }
+
+ ///
+ /// 生成字体
+ ///
+ /// 与当前Excel相关的字体
+ public IFont CreateFont()
+ {
+ return Book.CreateFont();
+ }
+
+ ///
+ /// 设置单元格样式
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 样式
+ public void SetStyle(int rowIndex, int columnIndex, ICellStyle style)
+ {
+ IRow row = Book.GetSheetAt(sheetID).GetRow(rowIndex);
+ if (row == null)
+ {
+ row = Book.GetSheetAt(sheetID).CreateRow(rowIndex);
+ }
+ ICell cell = row.GetCell(columnIndex);
+ if (cell == null)
+ {
+ cell = row.CreateCell(columnIndex);
+ }
+ cell.CellStyle = style;
+ }
+
+ ///
+ /// 合并单元格
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 开始行号
+ /// 开始列号
+ /// 结束行号
+ /// 结束列号
+ public void MergeCells(int startRowIndex, int startColumnIndex, int endRowIndex, int endColumnIndex)
+ {
+ int Index = Book.GetSheetAt(sheetID).AddMergedRegion(new CellRangeAddress(startRowIndex, endRowIndex, startColumnIndex, endColumnIndex));
+ }
+
+ ///
+ /// 拆分单元格
+ /// 注1:只对当前ActiveSheet有效
+ /// 注2:只有合并的单元格才能拆分
+ ///
+ /// 开始行号
+ /// 开始列号
+ public void UnMergeCells(int startRowIndex, int startColumnIndex)
+ {
+ int merges = Book.GetSheetAt(sheetID).NumMergedRegions;
+ CellRangeAddress merge;
+ for (int i = 0; i < merges; i++)
+ {
+ merge = Book.GetSheetAt(sheetID).GetMergedRegion(i);
+ if (merge.FirstRow == startRowIndex && merge.FirstColumn == startColumnIndex)
+ {
+ Book.GetSheetAt(sheetID).RemoveMergedRegion(i);
+ break;
+ }
+ }
+ }
+
+ ///
+ /// 保存到文件
+ /// 注:有模板的,文件扩展名与模板一样;没有模板的,文件扩展名为“.xls”;
+ ///
+ /// 保存文件名
+ public void Save(String fileName)
+ {
+ FileStream file = new FileStream(fileName, FileMode.Create);
+ Book.Write(file);
+ file.Close();
+ }
+
+ ///
+ /// 保存到流
+ /// 注:保存或下载时,有模板的,文件扩展名与模板一样;没有模板的,文件扩展名为“.xls”;
+ ///
+ /// 内存流
+ public MemoryStream Save()
+ {
+ MemoryStream ms = new MemoryStream();
+ Book.Write(ms);
+ return ms;
+ }
+
+ ///
+ /// 把Excel读成DataSet
+ /// 注:必须是正规表格式
+ ///
+ /// 读出的Excel
+ public DataSet ReadAsDataSet()
+ {
+ DataSet rtn = new DataSet();
+ for (int i = 0; i < SheetCount; i++)
+ {
+ ISheet sheet = Book.GetSheetAt(i);
+ rtn.Tables.Add(GetDataTableBySheet(sheet));
+ }
+ return rtn;
+ }
+
+ private DataTable GetDataTableBySheet(ISheet sheet)
+ {
+ DataTable dt = new DataTable(sheet.SheetName);
+ int maxCols = 0;
+ object value;
+ while ((value = ReadValue(sheet, 0, maxCols)) != null)
+ {
+ dt.Columns.Add(value.ToString());
+ maxCols++;
+ }
+
+ int row = 1;
+
+ bool emptyRow = false;
+ int emptyRowCount = 0;
+ while (emptyRowCount < 10)
+ {
+ emptyRow = true;
+ DataRow dr = dt.NewRow();
+ for (int i = 0; i < maxCols; i++)
+ {
+ value = ReadValue(sheet, row, i);
+ if (value != null)
+ {
+ dr[i] = value;
+ emptyRow = false;
+ }
+ }
+ if (!emptyRow)
+ {
+ dt.Rows.Add(dr);
+ emptyRowCount = 0;
+ }
+ else
+ {
+ emptyRowCount++;
+ }
+ row++;
+ }
+
+ return dt;
+ }
+
+ ///
+ /// 根据SheetName导出数据为DataTable
+ ///
+ /// Sheet名称
+ ///
+ public DataTable GetDataTableBySheet(String sheetName)
+ {
+
+ ISheet sheet = Book.GetSheet(sheetName);
+ if (sheet != null)
+ {
+ return GetDataTableBySheet(sheet);
+ }
+ return null;
+
+ }
+
+ ///
+ /// 根据SheetName导出数据为DataTable
+ ///
+ /// Sheet编号
+ ///
+ public DataTable GetDataTableBySheet(int sheetIndex)
+ {
+
+ ISheet sheet = Book.GetSheetAt(sheetIndex);
+ if (sheet != null)
+ {
+ return GetDataTableBySheet(sheet);
+ }
+ return null;
+
+ }
+
+ ///
+ /// 写入表格
+ ///
+ /// 表格数据
+ /// 写入的起始列
+ /// 写入的起始行
+ /// 标题颜色
+ /// 是否需要四周边框
+ public void WriteDataTable(DataTable Data, int col = 1, int row = 1, short? titleColor = null, bool fullBorder = true)
+ {
+ if (Data == null)
+ {
+ return;
+ }
+
+ var titleStyle = CreateCellStyle();
+ var rowStyle = CreateCellStyle();
+ if (titleColor != null)
+ titleStyle.FillForegroundColor = titleColor.Value;
+
+ titleStyle.FillPattern = FillPattern.SolidForeground;
+ if (fullBorder)
+ {
+ titleStyle.BorderBottom = BorderStyle.Thin;
+ titleStyle.BorderLeft = BorderStyle.Thin;
+ titleStyle.BorderRight = BorderStyle.Thin;
+ titleStyle.BorderTop = BorderStyle.Thin;
+ titleStyle.BottomBorderColor = NPOIColor.BLACK;
+ titleStyle.LeftBorderColor = NPOIColor.BLACK;
+ titleStyle.RightBorderColor = NPOIColor.BLACK;
+ titleStyle.TopBorderColor = NPOIColor.BLACK;
+ rowStyle.BorderBottom = BorderStyle.Thin;
+ rowStyle.BorderLeft = BorderStyle.Thin;
+ rowStyle.BorderRight = BorderStyle.Thin;
+ rowStyle.BorderTop = BorderStyle.Thin;
+ rowStyle.BottomBorderColor = NPOIColor.BLACK;
+ rowStyle.LeftBorderColor = NPOIColor.BLACK;
+ rowStyle.RightBorderColor = NPOIColor.BLACK;
+ rowStyle.TopBorderColor = NPOIColor.BLACK;
+ }
+
+ int iCol = 0, iRow = 1;
+
+ foreach (DataColumn dc in Data.Columns)
+ {
+ SetValue(row, col + iCol, dc.ColumnName);
+ SetStyle(row, col + iCol, titleStyle);
+ iCol++;
+ }
+
+ rowStyle.FillForegroundColor = NPOIColor.WHITE;
+
+ foreach (DataRow dr in Data.Rows)
+ {
+ iCol = 0;
+ foreach (DataColumn dc in Data.Columns)
+ {
+ SetValue(row + iRow, col + iCol, dr[dc]);
+ SetStyle(row + iRow, col + iCol, rowStyle);
+ iCol++;
+ }
+ iRow++;
+ }
+
+ for (int i = 0; i < iCol; i++)
+ {
+ this.AutoColWidth(i);
+ }
+ }
+
+ ///
+ /// 读取单元格的值
+ /// 注:只对当前ActiveSheet有效
+ ///
+ /// 行号
+ /// 列号
+ /// 单元格的值
+ public object ReadValue(ISheet sheet, int rowIndex, int columnIndex, bool? isDateTime = null)
+ {
+ try
+ {
+ ICell cell = sheet.GetRow(rowIndex).GetCell(columnIndex);
+ short df = cell.CellStyle.DataFormat;
+
+ //return cell.ToString();
+ switch (cell.CellType)
+ {
+ case CellType.Blank:
+ return null;
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ {
+ switch (cell.CachedFormulaResultType)
+ {
+ case CellType.Blank:
+ return "";
+ case CellType.Boolean:
+ return cell.BooleanCellValue;
+ case CellType.Error:
+ throw new Exception("Cell Value Error");
+ case CellType.Formula:
+ throw new Exception("The Formula of this cell is too complex!");
+ case CellType.Numeric:
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ case CellType.Numeric:
+ {
+ if (isDateTime == null)
+ {
+ if (DateUtil.IsCellDateFormatted(cell))
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ else if (isDateTime == true)
+ {
+ return cell.DateCellValue;
+ }
+ else
+ {
+ return cell.NumericCellValue;
+ }
+ }
+ case CellType.String:
+ return cell.StringCellValue;
+ case CellType.Unknown:
+ return cell.ToString();
+ default:
+ return cell.ToString();
+ }
+ }
+ catch (System.NullReferenceException)
+ {
+ return null;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ public int SheetCount
+ {
+ get
+ {
+ return Book.NumberOfSheets;
+ }
+ }
+
+ public String GetSheetName(int Index)
+ {
+ return Book.GetSheetName(Index);
+ }
+
+ public void AddPicture(byte[] data, int row, int col)
+ {
+ int picIndex = Book.AddPicture(data, PictureType.PNG);
+
+ IDrawing draw = ActiveSheet.CreateDrawingPatriarch();
+
+ IClientAnchor anchor = draw.CreateAnchor(0, 0, 255, 255, col, row, col + 5, col + 5);
+ IPicture pic = draw.CreatePicture(anchor, picIndex);
+ pic.Resize();
+ }
+ }
+
+ public enum OperatorTypes
+ {
+ ///
+ /// 介于最大值与小值之间
+ ///
+ BETWEEN = OperatorType.BETWEEN,
+ ///
+ /// 等于最小值
+ ///
+ EQUAL = OperatorType.EQUAL,
+ ///
+ /// 大于或等于最小值
+ ///
+ GREATER_OR_EQUAL = OperatorType.GREATER_OR_EQUAL,
+ ///
+ /// 大于最小值
+ ///
+ GREATER_THAN = OperatorType.GREATER_THAN,
+ ///
+ /// 忽略
+ ///
+ NO_COMPARISON = OperatorType.IGNORED,
+ ///
+ /// 小于或等于最小值
+ ///
+ LESS_OR_EQUAL = OperatorType.LESS_OR_EQUAL,
+ ///
+ /// 小于最小值
+ ///
+ LESS_THAN = OperatorType.LESS_THAN,
+ ///
+ /// 不在最小值与最大值之间
+ ///
+ NOT_BETWEEN = OperatorType.NOT_BETWEEN,
+ ///
+ /// 不等于最小值
+ ///
+ NOT_EQUAL = OperatorType.NOT_EQUAL
+ }
+
+ public enum NPOIDataType
+ {
+ ///
+ /// 验证整数
+ ///
+ Integer,
+ ///
+ /// 验证符点数
+ ///
+ Float,
+ ///
+ /// 验证日期
+ ///
+ Date,
+ ///
+ /// 验证时间
+ ///
+ Time,
+ ///
+ /// 验证字符长度
+ ///
+ TextLength
+ }
+
+ public static class NPOIColor
+ {
+
+ ///
+ /// 红色
+ ///
+ public static short RED { get { return NPOI.HSSF.Util.HSSFColor.Red.Index; } }
+
+ ///
+ /// 蓝色
+ ///
+ public static short BLUE { get { return NPOI.HSSF.Util.HSSFColor.Blue.Index; } }
+
+ ///
+ /// 浅绿色
+ ///
+ public static short AQUA { get { return NPOI.HSSF.Util.HSSFColor.Aqua.Index; } }
+
+ ///
+ /// 自动
+ ///
+ public static short AUTOMATIC { get { return NPOI.HSSF.Util.HSSFColor.Automatic.Index; } }
+
+ ///
+ /// 黑色
+ ///
+ public static short BLACK { get { return NPOI.HSSF.Util.HSSFColor.Black.Index; } }
+
+ ///
+ /// 蓝灰色
+ ///
+ public static short BLUE_GREY { get { return NPOI.HSSF.Util.HSSFColor.BlueGrey.Index; } }
+
+ ///
+ /// 明绿色
+ ///
+ public static short BRIGHT_GREEN { get { return NPOI.HSSF.Util.HSSFColor.BrightGreen.Index; } }
+
+ ///
+ /// 棕色
+ ///
+ public static short BROWN { get { return NPOI.HSSF.Util.HSSFColor.Brown.Index; } }
+
+ ///
+ /// 正常
+ ///
+ public static short COLOR_NORMAL { get { return NPOI.HSSF.Util.HSSFColor.COLOR_NORMAL; } }
+
+ ///
+ /// 珊瑚色
+ ///
+ public static short CORAL { get { return NPOI.HSSF.Util.HSSFColor.Coral.Index; } }
+
+ ///
+ /// 亮蓝色
+ ///
+ public static short CORNFLOWER_BLUE { get { return NPOI.HSSF.Util.HSSFColor.CornflowerBlue.Index; } }
+
+ ///
+ /// 深蓝色
+ ///
+ public static short DARK_BLUE { get { return NPOI.HSSF.Util.HSSFColor.DarkBlue.Index; } }
+
+ ///
+ /// 深绿色
+ ///
+ public static short DARK_GREEN { get { return NPOI.HSSF.Util.HSSFColor.DarkGreen.Index; } }
+
+ ///
+ /// 深红色
+ ///
+ public static short DARK_RED { get { return NPOI.HSSF.Util.HSSFColor.DarkRed.Index; } }
+
+ ///
+ /// 深茶色
+ ///
+ public static short DARK_TEAL { get { return NPOI.HSSF.Util.HSSFColor.DarkTeal.Index; } }
+
+ ///
+ /// 深黄
+ ///
+ public static short DARK_YELLOW { get { return NPOI.HSSF.Util.HSSFColor.DarkYellow.Index; } }
+
+ ///
+ /// 金色
+ ///
+ public static short GOLD { get { return NPOI.HSSF.Util.HSSFColor.Gold.Index; } }
+
+ ///
+ /// 绿色
+ ///
+ public static short GREEN { get { return NPOI.HSSF.Util.HSSFColor.Green.Index; } }
+
+ ///
+ /// 25%灰色
+ ///
+ public static short GREY_25_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey25Percent.Index; } }
+
+ ///
+ /// 40%灰色
+ ///
+ public static short GREY_40_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey40Percent.Index; } }
+
+ ///
+ /// 50%灰色
+ ///
+ public static short GREY_50_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey50Percent.Index; } }
+
+ ///
+ /// 80%灰色
+ ///
+ public static short GREY_80_PERCENT { get { return NPOI.HSSF.Util.HSSFColor.Grey80Percent.Index; } }
+
+ ///
+ /// 靛蓝色
+ ///
+ public static short INDIGO { get { return NPOI.HSSF.Util.HSSFColor.Indigo.Index; } }
+
+ ///
+ /// 淡紫色
+ ///
+ public static short LAVENDER { get { return NPOI.HSSF.Util.HSSFColor.Lavender.Index; } }
+
+ ///
+ /// 粉黄色
+ ///
+ public static short LEMON_CHIFFON { get { return NPOI.HSSF.Util.HSSFColor.LemonChiffon.Index; } }
+
+ ///
+ /// 淡蓝色
+ ///
+ public static short LIGHT_BLUE { get { return NPOI.HSSF.Util.HSSFColor.LightBlue.Index; } }
+
+ ///
+ /// 淡亮蓝色
+ ///
+ public static short LIGHT_CORNFLOWER_BLUE { get { return NPOI.HSSF.Util.HSSFColor.LightCornflowerBlue.Index; } }
+
+ ///
+ /// 淡绿色
+ ///
+ public static short LIGHT_GREEN { get { return NPOI.HSSF.Util.HSSFColor.LightGreen.Index; } }
+
+ ///
+ /// 淡桔黄色
+ ///
+ public static short LIGHT_ORANGE { get { return NPOI.HSSF.Util.HSSFColor.LightOrange.Index; } }
+
+ ///
+ /// 淡蓝绿色
+ ///
+ public static short LIGHT_TURQUOISE { get { return NPOI.HSSF.Util.HSSFColor.LightTurquoise.Index; } }
+
+ ///
+ /// 淡黄色
+ ///
+ public static short LIGHT_YELLOW { get { return NPOI.HSSF.Util.HSSFColor.LightYellow.Index; } }
+
+ ///
+ /// 绿黄色
+ ///
+ public static short LIME { get { return NPOI.HSSF.Util.HSSFColor.Lime.Index; } }
+
+ ///
+ /// 栗色
+ ///
+ public static short MAROON { get { return NPOI.HSSF.Util.HSSFColor.Maroon.Index; } }
+
+ ///
+ /// 橄榄绿色
+ ///
+ public static short OLIVE_GREEN { get { return NPOI.HSSF.Util.HSSFColor.OliveGreen.Index; } }
+
+ ///
+ /// 桔色
+ ///
+ public static short ORANGE { get { return NPOI.HSSF.Util.HSSFColor.Orange.Index; } }
+
+ ///
+ /// 白灰蓝色
+ ///
+ public static short PALE_BLUE { get { return NPOI.HSSF.Util.HSSFColor.PaleBlue.Index; } }
+
+ ///
+ /// 粉红色
+ ///
+ public static short PINK { get { return NPOI.HSSF.Util.HSSFColor.Pink.Index; } }
+
+ ///
+ /// 紫红色
+ ///
+ public static short PLUM { get { return NPOI.HSSF.Util.HSSFColor.Plum.Index; } }
+
+ ///
+ /// 玫瑰红色
+ ///
+ public static short ROSE { get { return NPOI.HSSF.Util.HSSFColor.Rose.Index; } }
+
+ ///
+ /// 高贵蓝
+ ///
+ public static short ROYAL_BLUE { get { return NPOI.HSSF.Util.HSSFColor.RoyalBlue.Index; } }
+
+ ///
+ /// 海绿色
+ ///
+ public static short SEA_GREEN { get { return NPOI.HSSF.Util.HSSFColor.SeaGreen.Index; } }
+
+ ///
+ /// 天空蓝
+ ///
+ public static short SKY_BLUE { get { return NPOI.HSSF.Util.HSSFColor.SkyBlue.Index; } }
+
+ ///
+ /// 棕褐色
+ ///
+ public static short TAN { get { return NPOI.HSSF.Util.HSSFColor.Tan.Index; } }
+
+ ///
+ /// 茶色
+ ///
+ public static short TEAL { get { return NPOI.HSSF.Util.HSSFColor.Teal.Index; } }
+
+ ///
+ /// 蓝绿色
+ ///
+ public static short TURQUOISE { get { return NPOI.HSSF.Util.HSSFColor.Turquoise.Index; } }
+
+ ///
+ /// 紫色
+ ///
+ public static short VIOLET { get { return NPOI.HSSF.Util.HSSFColor.Violet.Index; } }
+
+ ///
+ /// 白色
+ ///
+ public static short WHITE { get { return NPOI.HSSF.Util.HSSFColor.White.Index; } }
+
+ ///
+ /// 黄色
+ ///
+ public static short YELLOW { get { return NPOI.HSSF.Util.HSSFColor.Yellow.Index; } }
+
+ }
+
+ ///
+ /// 针对excel的Oledb
+ ///
+ public class OleDbExcel
+ {
+ ///
+ /// OLEDB连接
+ ///
+ public OleDbConnection Connection
+ {
+ get;
+ set;
+ }
+
+ ///
+ /// 用Oledb对Excel进行操作
+ /// 注:必须是标准表形式Excel内容
+ ///
+ /// Excel文件
+ public OleDbExcel(String excelFile)
+ {
+ String conStr = String.Empty;
+ FileInfo file = new FileInfo(excelFile);
+ if (!file.Exists) { throw new Exception("文件不存在"); }
+ String extension = file.Extension;
+ switch (extension)
+ {
+ case ".xls":
+ conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFile + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
+ break;
+ case ".xlsx":
+ conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFile + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;'";
+ break;
+ default:
+ conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + excelFile + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
+ break;
+ }
+
+ //链接Excel
+ Connection = new OleDbConnection(conStr);
+ }
+
+ private List tableNames;
+
+ ///
+ /// 获取Excel内的Sheet名称
+ ///
+ public List Sheets
+ {
+ get
+ {
+ if (tableNames == null)
+ {
+ try
+ {
+ tableNames = new List();
+ //读取Excel里面的sheet名
+ Connection.Open();
+
+ DataTable schemaTable = Connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
+
+ for (int i = 0; i < schemaTable.Rows.Count; i++)
+ {
+ DataRow dr = schemaTable.Rows[i];
+ String tbName = dr["table_name"].ToString();
+ if (tbName[tbName.Length - 1] == '$')
+ {
+ tableNames.Add(tbName);
+ }
+ }
+ Connection.Close();
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+ return tableNames;
+ }
+ }
+
+ ///
+ /// 查询出所有数据
+ ///
+ /// Sheet名称
+ /// sheet内的所有数据
+ public DataSet QueryAll(String tableName)
+ {
+ try
+ {
+ DataSet excelData = new DataSet();
+ OleDbDataAdapter adapter = new OleDbDataAdapter();
+ adapter.SelectCommand = new OleDbCommand();
+ adapter.SelectCommand.Connection = Connection;
+ adapter.SelectCommand.CommandText = String.Format("SELECT * FROM {0}", "[" + tableName + "]");
+ adapter.Fill(excelData);
+ return excelData;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 查询出所有数据
+ ///
+ /// Sheet序号(从0开始)
+ /// sheet内的所有数据
+ public DataSet QueryAll(int tableIndex)
+ {
+ return QueryAll(Sheets[tableIndex]);
+ }
+
+ ///
+ /// 利用Sql进行查询
+ ///
+ /// Sql语句
+ /// 查询出的数据
+ public DataSet Query(String sql)
+ {
+ try
+ {
+ DataSet excelData = new DataSet();
+ OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection);
+ adapter.Fill(excelData);
+ return excelData;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 利用Sql进行查询
+ ///
+ /// Sql语句
+ /// 查询参数
+ /// 查询出的数据
+ public DataSet Query(String sql, params OleDbParameter[] param)
+ {
+ try
+ {
+ DataSet excelData = new DataSet();
+ OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection);
+ adapter.SelectCommand.Parameters.AddRange(param);
+ adapter.Fill(excelData);
+ return excelData;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 利用Sql进行数据操作
+ ///
+ /// sql语句
+ /// 影响的行数
+ public int ExecuteSql(String sql)
+ {
+ try
+ {
+ Connection.Open();
+ OleDbCommand cmd = Connection.CreateCommand();
+ cmd.CommandText = sql;
+ int rtn = cmd.ExecuteNonQuery();
+ Connection.Close();
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+
+ ///
+ /// 利用Sql进行数据操作
+ ///
+ /// sql语句
+ /// 执行参数
+ /// 影响的行数
+ public int ExecuteSql(String sql, params OleDbParameter[] param)
+ {
+ try
+ {
+ Connection.Open();
+ OleDbCommand cmd = Connection.CreateCommand();
+ cmd.CommandText = sql;
+ cmd.Parameters.AddRange(param);
+ int rtn = cmd.ExecuteNonQuery();
+ Connection.Close();
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ if (Connection.State != ConnectionState.Closed)
+ {
+ Connection.Close();
+ }
+ throw new Exception(ex.Message, ex);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs b/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs
index f349d0ac..621af157 100644
--- a/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs
+++ b/SGGL/BLL/HSSE/Check/Check_CheckSpecialService.cs
@@ -244,7 +244,8 @@ namespace BLL
{
Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem
{
- WrongContent = item.Unqualified
+ //WrongContent = item.Unqualified
+ WrongContent = item.CheckItemSetContent
};
if (string.IsNullOrEmpty(rectifyNotices.CheckSpecialDetailId))
{
@@ -298,7 +299,8 @@ namespace BLL
foreach (var item in getUnitDItem)
{
Model.PunishNoticeItemItem newPItem = new Model.PunishNoticeItemItem();
- newPItem.PunishContent = item.Unqualified;
+ //newPItem.PunishContent = item.Unqualified;
+ newPItem.PunishContent = item.CheckItemSetContent;
newPItem.SortIndex = item.SortIndex;
punishNotice.PunishNoticeItemItem.Add(newPItem);
if (string.IsNullOrEmpty(punishNotice.CheckSpecialDetailId))
@@ -335,7 +337,8 @@ namespace BLL
foreach (var item in getUnitDItem)
{
Model.RectifyNoticesItemItem newRItem = new Model.RectifyNoticesItemItem();
- pauseNotice.ThirdContent += item.Unqualified;
+ //pauseNotice.ThirdContent += item.Unqualified;
+ pauseNotice.ThirdContent += item.CheckItemSetContent;
string checkAreaName= UnitWorkService.GetNameById(item.CheckArea);
if (!string.IsNullOrEmpty(checkAreaName))
{
diff --git a/SGGL/BLL/ProjectData/ProjectService.cs b/SGGL/BLL/ProjectData/ProjectService.cs
index a7b50ff4..2db27732 100644
--- a/SGGL/BLL/ProjectData/ProjectService.cs
+++ b/SGGL/BLL/ProjectData/ProjectService.cs
@@ -138,6 +138,8 @@
HJProjectCode = project.HJProjectCode,
KZProjectCode = project.KZProjectCode,
Progress = project.Progress,
+ ProjType = project.ProjType,
+ ProjPhase = project.ProjPhase,
};
db.Base_Project.InsertOnSubmit(newProject);
db.SubmitChanges();
@@ -186,6 +188,8 @@
newProject.HJProjectCode = project.HJProjectCode;
newProject.KZProjectCode = project.KZProjectCode;
newProject.Progress = project.Progress;
+ newProject.ProjType = project.ProjType;
+ newProject.ProjPhase = project.ProjPhase;
db.SubmitChanges();
HSEDataCollectService.ProjectHSEDataCollectSubmission(newProject);
}
diff --git a/SGGL/BLL/SysManage/UnitService.cs b/SGGL/BLL/SysManage/UnitService.cs
index dbe2aed1..647c8449 100644
--- a/SGGL/BLL/SysManage/UnitService.cs
+++ b/SGGL/BLL/SysManage/UnitService.cs
@@ -761,5 +761,21 @@ namespace BLL
return q;
}
}
+
+ ///
+ /// 获取问题类型名称
+ ///
+ ///
+ ///
+ public static string GetQuestionTypeId(string RegisterTypesId)
+ {
+ string name = string.Empty;
+ var unit = Funs.DB.HSSE_Hazard_HazardRegisterTypes.FirstOrDefault(x => x.RegisterTypesId == RegisterTypesId);
+ if (unit != null)
+ {
+ name = unit.RegisterTypesName;
+ }
+ return name;
+ }
}
}
diff --git a/SGGL/FineUIPro.Web/ErrLog.txt b/SGGL/FineUIPro.Web/ErrLog.txt
index 76e939ac..b012a6c2 100644
--- a/SGGL/FineUIPro.Web/ErrLog.txt
+++ b/SGGL/FineUIPro.Web/ErrLog.txt
@@ -3193,3 +3193,25 @@ IP地址:::1
出错时间:09/26/2023 18:55:14
+
+错误信息开始=====>
+错误类型:JsonReaderException
+错误信息:Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject. Path '', line 1, position 1.
+错误堆栈:
+ 在 Newtonsoft.Json.Linq.JArray.Load(JsonReader reader, JsonLoadSettings settings)
+ 在 Newtonsoft.Json.Linq.JArray.Parse(String json, JsonLoadSettings settings)
+ 在 Newtonsoft.Json.Linq.JArray.Parse(String json)
+ 在 FineUIPro.Web.ProjectData.Installation.btnMenuDown_Click(Object sender, EventArgs e) 位置 E:\工作\五环施工平台\SGGL_CWCEC\SGGL\FineUIPro.Web\ProjectData\Installation.aspx.cs:行号 257
+ 在 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)
+出错时间:10/07/2023 16:42:46
+出错文件:http://localhost:8579/ProjectData/Installation.aspx
+IP地址:::1
+操作人员:JT
+
+出错时间:10/07/2023 16:42:46
+
diff --git a/SGGL/FineUIPro.Web/File/Word/HSSE/专项检查.doc b/SGGL/FineUIPro.Web/File/Word/HSSE/专项检查.doc
index 84c6efe3..90ca6147 100644
--- a/SGGL/FineUIPro.Web/File/Word/HSSE/专项检查.doc
+++ b/SGGL/FineUIPro.Web/File/Word/HSSE/专项检查.doc
@@ -1,9 +1,61 @@
-
- 专项检查
-项目名称: 编号:
-
-|检查类别 | |检查日期 | |
-|参检人员 | |
-
-
-序号 |单位工程 |受检单位 |问题描述 |问题类型 |处理结果 |隐患类别 | |
+PK
+ N@ docProps/PK N@NN\ q docProps/app.xmlQo0ߗ?ޡ9S0Ӳ4͠mj߯E9=CΠ
"&K.`{RQV
+H+=>
+`<!L7֪B5QpJZ'udUqkNbg.D en8|泸*:R{ӆA7li
&r4&hHPMuԛ#Ep79.IZS#E
+ii[wAv;ܬFewmvN9J3j]a>~:9Fq$qN⧗