From 33845042b1de4b3701809eb41d3cba861ad412ce Mon Sep 17 00:00:00 2001
From: geh <1923421292@qq.com>
Date: Thu, 18 Sep 2025 11:31:32 +0800
Subject: [PATCH] =?UTF-8?q?=E7=9D=A3=E6=9F=A5=E6=A3=80=E6=9F=A5=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
SUBQHSE/BLL/OpenService/FileInsertService.cs | 82 +++++-
.../DCGL/ServerCheck/CheckRectify.aspx.cs | 261 +++++++++++++++++-
.../DCGL/ServerCheck/CheckRectifyEdit.aspx | 75 ++++-
.../DCGL/ServerCheck/CheckRectifyEdit.aspx.cs | 28 ++
.../CheckRectifyEdit.aspx.designer.cs | 9 +
SUBQHSE/FineUIPro.Web/res/js/hook.js | 6 +
.../FineUIPro.Web/res/js/jquery-3.3.1.min.js | 2 +
7 files changed, 448 insertions(+), 15 deletions(-)
create mode 100644 SUBQHSE/FineUIPro.Web/res/js/hook.js
create mode 100644 SUBQHSE/FineUIPro.Web/res/js/jquery-3.3.1.min.js
diff --git a/SUBQHSE/BLL/OpenService/FileInsertService.cs b/SUBQHSE/BLL/OpenService/FileInsertService.cs
index f36cd23..2594188 100644
--- a/SUBQHSE/BLL/OpenService/FileInsertService.cs
+++ b/SUBQHSE/BLL/OpenService/FileInsertService.cs
@@ -4,13 +4,53 @@ using System.Linq;
using System.Text;
using System.Collections;
using System.IO;
-using System.Text.RegularExpressions;
using System.Web;
+using System.Text.RegularExpressions;
+using System.Net;
namespace BLL
{
public static class FileInsertService
{
+ ///
+ /// 获取服务器图片转byte
+ ///
+ ///
+ ///
+ ///
+ public static List FilePathTransStream(string fileHost, string attachUrl)
+ {
+ List bytes = new List();
+ var strs = attachUrl.Trim().Split(',');
+
+ try
+ {
+ foreach (var fileUrl in strs)
+ {
+ string filepath = $"{fileHost}{fileUrl}";
+ // 创建WebClient实例
+ using (WebClient webClient = new WebClient())
+ {
+ // 下载图片并保存到内存流
+ using (MemoryStream ms = new MemoryStream(webClient.DownloadData(filepath)))
+ {
+ // 将MemoryStream转换为byte数组
+ byte[] imageBytes = ms.ToArray();
+ bytes.Add(imageBytes);
+ //// 使用byte数组(例如,保存到文件或进行其他处理)
+ //File.WriteAllBytes("localImage.jpg", imageBytes);
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("Error: " + ex.Message);
+ }
+ return bytes;
+ }
+
+
///
/// 获取附件数据流类
///
@@ -146,5 +186,45 @@ namespace BLL
}
}
}
+
+
+ ///
+ /// 数据和附件插入到多附件表【不存实际文件,只存地址】
+ ///
+ public static void InsertAttachFileRecord(string attachFileId, string dataId, string attachSource, string attachUrl)
+ {
+ var getAtt = Funs.DB.AttachFile.FirstOrDefault(x => x.AttachFileId == attachFileId);
+ if (getAtt != null)
+ {
+ Funs.DB.AttachFile.DeleteOnSubmit(getAtt);
+ Funs.DB.SubmitChanges();
+ }
+ //多附件
+ var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId);
+ if (attachFile == null && !string.IsNullOrEmpty(attachSource))
+ {
+ Model.AttachFile newAttachFile = new Model.AttachFile
+ {
+ AttachFileId = attachFileId,
+ ToKeyId = dataId,
+ AttachSource = attachSource,
+ AttachUrl = attachUrl
+ };
+ Funs.DB.AttachFile.InsertOnSubmit(newAttachFile);
+ Funs.DB.SubmitChanges();
+ }
+ else
+ {
+ if (attachFile.AttachUrl != attachUrl)
+ {
+ ///删除附件文件
+ BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, attachFile.AttachUrl);
+ attachFile.AttachSource = attachSource;
+ attachFile.AttachUrl = attachUrl;
+ Funs.DB.SubmitChanges();
+ }
+ }
+ }
+
}
}
diff --git a/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs b/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs
index 0bc5ea4..995b16c 100644
--- a/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs
+++ b/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectify.aspx.cs
@@ -13,10 +13,12 @@ namespace FineUIPro.Web.DCGL.ServerCheck
{
public partial class CheckRectify : PageBase
{
+ private static string proType;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
+ proType = Request.Params["proType"] ?? string.Empty;
this.GetButtonPower();
//btnNew.OnClientClick = Window1.GetShowReference("CheckRectifyEdit.aspx") + "return false;";
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
@@ -30,15 +32,19 @@ namespace FineUIPro.Web.DCGL.ServerCheck
///
private void BindGrid()
{
- string strSql = string.Empty;
+ StringBuilder sb = new StringBuilder();
+ sb.Append($@"SELECT S.CheckRectifyId,S.CheckRectifyCode,S.ProjectId,S.ProjectName,S.UnitId,U.UnitName,S.CheckDate,CASE S.HandleState WHEN '{BLL.Const.State_1}' THEN '未签发' WHEN '{BLL.Const.State_2}' THEN '未上报' ELSE '已上报' END AS HandleState,
+ S.IssueMan,S.IssueDate,ISNULL(TotalCount.TotalCount,0) AS TotalCount ,ISNULL(CompleteCount.CompleteCount,0) AS CompleteCount,(ISNULL(TotalCount.TotalCount,0) -ISNULL(CompleteCount.CompleteCount,0)) AS UnCompleteCount ");
+ sb.Append("FROM dbo.DCGL_Check_CheckRectify AS S LEFT JOIN dbo.Base_Unit AS U ON U.UnitId = S.UnitId ");
+ sb.Append(" LEFT JOIN (SELECT COUNT(*) AS TotalCount, CheckRectifyId FROM dbo.DCGL_Check_CheckRectifyItem GROUP BY CheckRectifyId) AS TotalCount ON S.CheckRectifyId=TotalCount.CheckRectifyId ");
+ sb.Append(" LEFT JOIN (SELECT COUNT(*) AS CompleteCount, CheckRectifyId FROM dbo.DCGL_Check_CheckRectifyItem WHERE RealEndDate IS NOT NULL GROUP BY CheckRectifyId) AS CompleteCount ON S.CheckRectifyId=CompleteCount.CheckRectifyId ");
+ if (!string.IsNullOrWhiteSpace(proType) && proType == "1")
+ {//只查询本项目检查数据
+ sb.Append($"WHERE S.ProjectId='{this.CurrUser.LoginProjectId}' ");
+ }
+ sb.Append("ORDER BY HandleState");
SqlParameter[] parameter = new SqlParameter[] { };
- strSql = "SELECT S.CheckRectifyId,S.CheckRectifyCode,S.ProjectId,S.ProjectName,S.UnitId,U.UnitName,S.CheckDate,CASE S.HandleState WHEN '" + BLL.Const.State_1 + "' THEN '未签发' WHEN '" + BLL.Const.State_2 + "' THEN '未上报' ELSE '已上报' END AS HandleState,"
- + @" S.IssueMan,S.IssueDate,ISNULL(TotalCount.TotalCount,0) AS TotalCount ,ISNULL(CompleteCount.CompleteCount,0) AS CompleteCount,(ISNULL(TotalCount.TotalCount,0) -ISNULL(CompleteCount.CompleteCount,0)) AS UnCompleteCount"
- + @" FROM dbo.DCGL_Check_CheckRectify AS S LEFT JOIN dbo.Base_Unit AS U ON U.UnitId = S.UnitId"
- + @" LEFT JOIN (SELECT COUNT(*) AS TotalCount, CheckRectifyId FROM dbo.DCGL_Check_CheckRectifyItem GROUP BY CheckRectifyId) AS TotalCount ON S.CheckRectifyId=TotalCount.CheckRectifyId"
- + @" LEFT JOIN (SELECT COUNT(*) AS CompleteCount, CheckRectifyId FROM dbo.DCGL_Check_CheckRectifyItem WHERE RealEndDate IS NOT NULL GROUP BY CheckRectifyId) AS CompleteCount ON S.CheckRectifyId=CompleteCount.CheckRectifyId"
- + @" ORDER BY HandleState";
- DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
+ DataTable tb = SQLHelper.GetDataTableRunText(sb.ToString(), parameter);
// 2.获取当前分页数据
//var table = this.GetPagedDataTable(Grid1, tb1);
@@ -365,7 +371,7 @@ namespace FineUIPro.Web.DCGL.ServerCheck
#endregion
#endregion
-
+
///
/// 从集团获取
///
@@ -387,8 +393,9 @@ namespace FineUIPro.Web.DCGL.ServerCheck
#region 获取
+
///
- /// 获取
+ /// 获取督查检查整改
///
///
///
@@ -397,7 +404,239 @@ namespace FineUIPro.Web.DCGL.ServerCheck
var responeData = new Model.ResponeData();
try
{
- string unitId =CommonService.GetThisUnitId();
+ string unitId = CommonService.GetThisUnitId();
+ string baseurl = SysConstSetService.CNCECPath + "/api/HSSEData/getDCGLCheckInfoRectify?unitId=" + unitId;
+ string contenttype = "application/json;charset=unicode";
+ Hashtable newToken = new Hashtable
+ {
+ { "token", ServerService.GetToken().Token }
+ };
+
+ var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
+ if (!string.IsNullOrEmpty(strJosn))
+ {
+ JObject obj = JObject.Parse(strJosn);
+ responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
+ responeData.message = obj["message"].ToString();
+ if (responeData.code == 1)
+ {
+ JArray getData = JArray.Parse(obj["data"].ToString());
+ if (getData.Count() > 0)
+ {
+ using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
+ {
+ List ids = new List();
+ foreach (var item in getData)
+ {
+ string getCheckRectifyId = item["CheckRectifyId"].ToString();
+ if (!ids.Contains(getCheckRectifyId))
+ {
+ var newRectify = db.DCGL_Check_CheckRectify.FirstOrDefault(e => e.CheckRectifyId == getCheckRectifyId);
+ if (newRectify == null)
+ {
+ ids.Add(getCheckRectifyId);
+ Model.DCGL_Check_CheckRectify newCheckRectify = new Model.DCGL_Check_CheckRectify
+ {
+ CheckRectifyId = getCheckRectifyId,
+ CheckRectifyCode = item["CheckRectifyCode"].ToString(),
+ ProjectId = item["ProjectId"].ToString(),
+ ProjectName = item["ProjectName"].ToString(),
+ UnitId = unitId,
+ CheckDate = Funs.GetNewDateTime(item["CheckDate"].ToString()),
+ IssueMan = item["IssueMan"].ToString(),
+ IssueDate = Funs.GetNewDateTime(item["IssueDate"].ToString()),
+ HandleState = item["HandleState"].ToString()
+ };
+ db.DCGL_Check_CheckRectify.InsertOnSubmit(newCheckRectify);
+ db.SubmitChanges();
+ }
+ else
+ {
+ newRectify.CheckRectifyCode = item["CheckRectifyCode"].ToString();
+ db.SubmitChanges();
+ }
+
+ //获取对应主表主键的明细集合
+ string getNoticeItemId = item["NoticeItemId"].ToString();
+ var notice = db.DCGL_Check_CheckInfo_TableNoticeItem.FirstOrDefault(x => x.ID == getNoticeItemId);
+ if (notice == null)
+ {
+ Model.DCGL_Check_CheckInfo_TableNoticeItem newCheckRectifyItem = new Model.DCGL_Check_CheckInfo_TableNoticeItem
+ {
+ ID = getNoticeItemId,
+ CheckInfoId = item["CheckInfoId"].ToString(),
+ SortIndex = Funs.GetNewInt(item["SortIndex"].ToString()),
+ Describe = item["Describe"].ToString(),
+ Standards = item["Standards"].ToString(),
+ Advice = item["Advice"].ToString(),
+ LimitTime = Funs.GetNewDateTime(item["LimitTime"].ToString()),
+
+ Situation = item["Situation"].ToString(),
+ Remark = item["Remark"].ToString(),
+ Url = item["Url"].ToString(),
+ AffUrl = item["AffUrl"].ToString(),
+ RiskLevel = item["RiskLevel"].ToString(),
+ ProblemTypes = item["ProblemTypes"].ToString(),
+ ProblemSubTypeId = item["ProblemSubTypeId"].ToString(),
+ ProblemSubType = item["ProblemSubType"].ToString(),
+ States = item["States"].ToString(),
+
+ //WorkType = item["WorkType"].ToString(),
+ //DangerPoint = item["DangerPoint"].ToString(),
+ //RiskExists = item["RiskExists"].ToString(),
+ //IsProject = Convert.ToBoolean(item["IsProject"].ToString()),
+ //CheckMan = item["CheckMan"].ToString(),
+ //SubjectUnitMan = item["SubjectUnitMan"].ToString(),
+ };
+ db.DCGL_Check_CheckInfo_TableNoticeItem.InsertOnSubmit(newCheckRectifyItem);
+ db.SubmitChanges();
+ }
+
+ BLL.CommonService.DeleteAttachFileById(getNoticeItemId);//删除附件
+ ////上传附件
+ string getAttachFileId = item["AttachFileId"].ToString();
+ if (!string.IsNullOrEmpty(getAttachFileId))
+ {
+ List resultList = new List();
+ string filePath = item["FilePath"].ToString();
+ string attachSource = item["AttachSource"].ToString();
+ string attachUrl = item["AttachUrl"].ToString();
+
+ BLL.FileInsertService.InsertAttachFileRecord(getAttachFileId, getNoticeItemId, attachSource, attachUrl);
+ //if (!string.IsNullOrWhiteSpace(filePath) && !string.IsNullOrWhiteSpace(attachSource) && !string.IsNullOrWhiteSpace(attachUrl))
+ //{
+ // resultList = FileInsertService.FilePathTransStream(filePath, attachUrl);
+ //}
+ //BLL.FileInsertService.InsertAttachFile(getAttachFileId, getNoticeItemId, attachSource, attachUrl, resultList);
+ }
+
+ string getCheckRectifyItemId = item["CheckRectifyItemId"].ToString();
+ var oldItem = db.DCGL_Check_CheckRectifyItem.FirstOrDefault(e => e.CheckRectifyItemId == getCheckRectifyItemId);
+ if (oldItem == null)
+ {
+ Model.DCGL_Check_CheckRectifyItem newCheckRectifyItem = new Model.DCGL_Check_CheckRectifyItem
+ {
+ CheckRectifyItemId = getCheckRectifyItemId,
+ CheckRectifyId = getCheckRectifyId,
+ NoticeItemId = getNoticeItemId,
+ ConfirmMan = item["ConfirmMan"].ToString(),
+ ConfirmManName = item["ConfirmManName"].ToString(),
+ ConfirmDate = Funs.GetNewDateTime(item["ConfirmDate"].ToString()),
+ OrderEndDate = Funs.GetNewDateTime(item["OrderEndDate"].ToString()),
+ OrderEndPerson = item["OrderEndPerson"].ToString(),
+ RealEndDate = Funs.GetNewDateTime(item["RealEndDate"].ToString()),
+ };
+
+ db.DCGL_Check_CheckRectifyItem.InsertOnSubmit(newCheckRectifyItem);
+ db.SubmitChanges();
+ }
+ }
+ else
+ {
+ //获取对应主表主键的明细集合
+ string getNoticeItemId = item["NoticeItemId"].ToString();
+ var notice = db.DCGL_Check_CheckInfo_TableNoticeItem.FirstOrDefault(x => x.ID == getNoticeItemId);
+ if (notice == null)
+ {
+
+ Model.DCGL_Check_CheckInfo_TableNoticeItem newCheckRectifyItem = new Model.DCGL_Check_CheckInfo_TableNoticeItem
+ {
+ ID = getNoticeItemId,
+ CheckInfoId = item["CheckInfoId"].ToString(),
+ SortIndex = Funs.GetNewInt(item["SortIndex"].ToString()),
+ Describe = item["Describe"].ToString(),
+ Standards = item["Standards"].ToString(),
+ Advice = item["Advice"].ToString(),
+ LimitTime = Funs.GetNewDateTime(item["LimitTime"].ToString()),
+
+ Situation = item["Situation"].ToString(),
+ Remark = item["Remark"].ToString(),
+ Url = item["Url"].ToString(),
+ AffUrl = item["AffUrl"].ToString(),
+ RiskLevel = item["RiskLevel"].ToString(),
+ ProblemTypes = item["ProblemTypes"].ToString(),
+ ProblemSubTypeId = item["ProblemSubTypeId"].ToString(),
+ ProblemSubType = item["ProblemSubType"].ToString(),
+ States = item["States"].ToString(),
+
+ //WorkType = item["WorkType"].ToString(),
+ //DangerPoint = item["DangerPoint"].ToString(),
+ //RiskExists = item["RiskExists"].ToString(),
+ //IsProject = Convert.ToBoolean(item["IsProject"].ToString()),
+ //CheckMan = item["CheckMan"].ToString(),
+ //SubjectUnitMan = item["SubjectUnitMan"].ToString(),
+ };
+ db.DCGL_Check_CheckInfo_TableNoticeItem.InsertOnSubmit(newCheckRectifyItem);
+ db.SubmitChanges();
+ }
+
+ BLL.CommonService.DeleteAttachFileById(getNoticeItemId);//删除附件
+ ////上传附件
+ string getAttachFileId = item["AttachFileId"].ToString();
+ if (!string.IsNullOrEmpty(getAttachFileId))
+ {
+ List resultList = new List();
+ string attachSource = item["AttachSource"].ToString();
+ string attachUrl = item["AttachUrl"].ToString();
+ BLL.FileInsertService.InsertAttachFileRecord(getAttachFileId, getNoticeItemId, attachSource, attachUrl);
+ //if (!string.IsNullOrWhiteSpace(filePath) && !string.IsNullOrWhiteSpace(attachSource) && !string.IsNullOrWhiteSpace(attachUrl))
+ //{
+ // resultList = FileInsertService.FilePathTransStream(filePath, attachUrl);
+ //}
+ //BLL.FileInsertService.InsertAttachFile(getAttachFileId, getNoticeItemId, attachSource, attachUrl, resultList);
+ }
+
+ string getCheckRectifyItemId = item["CheckRectifyItemId"].ToString();
+ var oldItem = db.DCGL_Check_CheckRectifyItem.FirstOrDefault(e => e.CheckRectifyItemId == getCheckRectifyItemId);
+ if (oldItem == null)
+ {
+ Model.DCGL_Check_CheckRectifyItem newCheckRectifyItem = new Model.DCGL_Check_CheckRectifyItem
+ {
+ CheckRectifyItemId = getCheckRectifyItemId,
+ CheckRectifyId = getCheckRectifyId,
+ NoticeItemId = getNoticeItemId,
+ ConfirmMan = item["ConfirmMan"].ToString(),
+ ConfirmManName = item["ConfirmManName"].ToString(),
+ ConfirmDate = Funs.GetNewDateTime(item["ConfirmDate"].ToString()),
+ OrderEndDate = Funs.GetNewDateTime(item["OrderEndDate"].ToString()),
+ OrderEndPerson = item["OrderEndPerson"].ToString(),
+ RealEndDate = Funs.GetNewDateTime(item["RealEndDate"].ToString()),
+ };
+
+ db.DCGL_Check_CheckRectifyItem.InsertOnSubmit(newCheckRectifyItem);
+ db.SubmitChanges();
+ }
+ }
+ }
+ }
+ }
+ responeData.message = "获取成功:整改明细记录" + getData.Count().ToString() + "条";
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ responeData.code = 0;
+ responeData.message = "获取失败:" + ex.Message;
+ ErrLogInfo.WriteLog("督查检查通知单获取!", ex);
+ }
+
+ return responeData;
+ }
+ #endregion
+
+ #region 获取
+ ///
+ /// 获取
+ ///
+ ///
+ ///
+ public static Model.ResponeData getCheck_CheckRectifyListToSUBOld()
+ {
+ var responeData = new Model.ResponeData();
+ try
+ {
+ string unitId = CommonService.GetThisUnitId();
string baseurl = SysConstSetService.CNCECPath + "/api/HSSEData/getDCGLCheckRectify?unitId=" + unitId;
string contenttype = "application/json;charset=unicode";
Hashtable newToken = new Hashtable
diff --git a/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectifyEdit.aspx b/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectifyEdit.aspx
index 0276c36..c545431 100644
--- a/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectifyEdit.aspx
+++ b/SUBQHSE/FineUIPro.Web/DCGL/ServerCheck/CheckRectifyEdit.aspx
@@ -6,11 +6,36 @@
隐患整改单
+
+
+
@@ -57,7 +82,7 @@
@@ -74,10 +99,16 @@
-
+
+
+
+
+ <%--
-
+ --%>
@@ -150,5 +181,43 @@
IsModal="true" Width="800px" Height="500px">
+
+

+
+
+