From fbe33a615f1c4e798a0f8e58163e68c3ce789614 Mon Sep 17 00:00:00 2001
From: lg <123456>
Date: 星期四, 20 十一月 2025 10:17:49 +0800
Subject: [PATCH] 初始化标准版
---
DevApp/Gs.DevApp/UserControl/ShowFile.cs | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/DevApp/Gs.DevApp/UserControl/ShowFile.cs b/DevApp/Gs.DevApp/UserControl/ShowFile.cs
index eefa5e3..9bef396 100644
--- a/DevApp/Gs.DevApp/UserControl/ShowFile.cs
+++ b/DevApp/Gs.DevApp/UserControl/ShowFile.cs
@@ -1,6 +1,7 @@
锘縰sing CefSharp.WinForms;
using System;
using System.Configuration;
+using System.Data.SqlClient;
using System.IO;
using System.Windows.Forms;
@@ -8,6 +9,7 @@
{
public partial class ShowFile : DevExpress.XtraEditors.XtraForm
{
+ string strConn = "Data Source=192.168.1.146,12468;Initial Catalog=GS_MES;User ID=mesUser;Password =qixi1qaz@WSXmes";
private static readonly string WebApiUrl =
ConfigurationManager.AppSettings["WebApiUrl"];
private ChromiumWebBrowser chromeBrowser;
@@ -27,8 +29,23 @@
private void ShowFile_Load(object sender, EventArgs e)
{
- string filePath = System.Uri.EscapeUriString(urlPath);
string fileType = GetFileType(urlPath);
+ string filePath = "";
+ //杩欐槸guid,涓嶆槸璺緞锛屾牴鎹甮uid 璇诲彇鍒板畠鐨勮矾寰�
+ if (urlPath.Length == 36)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder(" select top 1 url_Path from [dbo].[MES_FILE] where parent_Guid='" + urlPath + "'");
+ object obj = GetSingle(sb.ToString());
+ if (obj != null)
+ {
+ filePath = System.Uri.EscapeUriString(obj.ToString());
+ fileType = GetFileType(filePath);
+ }
+ else
+ filePath = System.Uri.EscapeUriString(urlPath);
+ }
+ else
+ filePath = System.Uri.EscapeUriString(urlPath);
string _url = WebApiUrl + "upload/h5/site.html?fileType=" + fileType + "&filePath=" + filePath + "&mid=" + Guid.NewGuid().ToString();
chromeBrowser = new ChromiumWebBrowser(_url);
this.pane1.Controls.Add(chromeBrowser);
@@ -56,5 +73,34 @@
return "other";
}
}
+
+
+ /// <summary>
+ /// 鎵ц涓�鏉¤绠楁煡璇㈢粨鏋滆鍙ワ紝杩斿洖鏌ヨ缁撴灉锛坥bject锛夈��
+ /// </summary>
+ /// <param name="SQLString">璁$畻鏌ヨ缁撴灉璇彞</param>
+ /// <returns>鏌ヨ缁撴灉锛坥bject锛�</returns>
+ private object GetSingle(string SQLString)
+ {
+ using (var connection = new SqlConnection(strConn))
+ {
+ using (var cmd = new SqlCommand(SQLString, connection))
+ {
+ try
+ {
+ connection.Open();
+ var obj = cmd.ExecuteScalar();
+ if (Equals(obj, null) || Equals(obj, DBNull.Value))
+ return null;
+ return obj;
+ }
+ catch (SqlException e)
+ {
+ connection.Close();
+ throw new Exception(e.Message);
+ }
+ }
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3