baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)
This commit is contained in:
commit
c2b0e7be0d
6522 files changed
+3530643
No files matched your search
@@ -0,0 +1,144 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gaussian 登录</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;box-sizing:border-box}
|
||||
body{font-family:'Microsoft YaHei','PingFang SC',sans-serif;background:linear-gradient(135deg,#1a73e8,#1557b0);min-height:100vh;display:flex;justify-content:center;align-items:center;padding:20px}
|
||||
.login-box{background:#fff;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.2);width:100%;max-width:420px;padding:40px 36px}
|
||||
.login-box .logo{text-align:center;font-size:22px;font-weight:700;color:#1a73e8;margin-bottom:6px}
|
||||
.login-box .sub{text-align:center;font-size:13px;color:#999;margin-bottom:28px}
|
||||
.form-group{margin-bottom:18px}
|
||||
.form-group label{display:block;font-size:13px;font-weight:600;color:#333;margin-bottom:6px}
|
||||
.form-group input{width:100%;height:44px;padding:0 14px;border:2px solid #e0e0e0;border-radius:8px;font-size:14px;outline:0;transition:border-color .25s,box-shadow .25s}
|
||||
.form-group input:focus{border-color:#1a73e8;box-shadow:0 0 0 3px rgba(26,115,232,.12)}
|
||||
.btn{width:100%;height:46px;border:0;border-radius:8px;font-size:16px;font-weight:600;cursor:pointer;transition:.2s;margin-top:6px}
|
||||
.btn-primary{background:linear-gradient(135deg,#1a73e8,#1557b0);color:#fff}
|
||||
.btn-primary:hover{opacity:.92}
|
||||
.btn-primary:disabled{opacity:.6;cursor:default}
|
||||
.btn-link{background:0 0;color:#1a73e8;font-size:13px;height:auto;padding:8px 0;text-decoration:underline}
|
||||
.btn-link:hover{color:#1557b0}
|
||||
.error{color:#e74c3c;font-size:13px;margin-top:10px;display:none;text-align:center}
|
||||
.error.show{display:block}
|
||||
.loading{display:inline-block;width:18px;height:18px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite;vertical-align:middle;margin-right:8px}
|
||||
@keyframes spin{to{transform:rotate(360deg)}}
|
||||
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:999;justify-content:center;align-items:center}
|
||||
.modal-overlay.show{display:flex}
|
||||
.modal{background:#fff;border-radius:12px;box-shadow:0 20px 60px rgba(0,0,0,.2);width:100%;max-width:400px;padding:32px 30px}
|
||||
.modal h3{font-size:18px;color:#333;margin-bottom:20px;text-align:center}
|
||||
.modal .form-group{margin-bottom:14px}
|
||||
.modal .btn-row{display:flex;gap:10px;margin-top:8px}
|
||||
.modal .btn-row .btn{flex:1}
|
||||
.btn-secondary{background:#f0f0f0;color:#666}
|
||||
.btn-secondary:hover{background:#e0e0e0}
|
||||
.toast{position:fixed;top:14px;left:50%;transform:translateX(-50%);padding:10px 22px;border-radius:8px;font-size:13px;z-index:1001;box-shadow:0 4px 20px rgba(0,0,0,.15);display:none;min-width:240px;text-align:center}
|
||||
.toast.error{background:#fdeaea;color:#b71c1c;display:block}
|
||||
.toast.success{background:#e6f9ed;color:#1a7a3a;display:block}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="toast" id="toast"></div>
|
||||
<div class="login-box">
|
||||
<div class="logo">Gaussian</div>
|
||||
<div class="sub">Gaussian IT管理系统</div>
|
||||
<div id="loginForm">
|
||||
<div class="form-group"><label>用户名</label><input type="text" id="txtUserId" placeholder="请输入用户账号" autocomplete="off" /></div>
|
||||
<div class="form-group"><label>密码</label><input type="password" id="txtPassword" placeholder="请输入密码" /></div>
|
||||
<div class="error" id="loginError"></div>
|
||||
<button class="btn btn-primary" id="btnLogin" onclick="doLogin()">登 录</button>
|
||||
<button class="btn btn-link" onclick="showChangePwd()">修改密码</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-overlay" id="pwdModal">
|
||||
<div class="modal">
|
||||
<h3>修改密码</h3>
|
||||
<div class="form-group"><label>用户名</label><input type="text" id="cpUserId" placeholder="请输入用户账号" /></div>
|
||||
<div class="form-group"><label>原密码</label><input type="password" id="cpOldPwd" placeholder="请输入原密码" /></div>
|
||||
<div class="form-group"><label>新密码</label><input type="password" id="cpNewPwd" placeholder="请输入新密码" /></div>
|
||||
<div class="error" id="cpError"></div>
|
||||
<div class="btn-row">
|
||||
<button class="btn btn-secondary" onclick="hideChangePwd()">取消</button>
|
||||
<button class="btn btn-primary" id="btnChangePwd" onclick="doChangePwd()">确认修改</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toast(msg,tp){var el=document.getElementById('toast');el.textContent=msg;el.className='toast '+tp;clearTimeout(el._timer);el._timer=setTimeout(function(){el.className='toast'},3500)}
|
||||
function logout(){sessionStorage.removeItem('gx_user');window.location.href='login.html'}
|
||||
function showChangePwd(){document.getElementById('pwdModal').classList.add('show');document.getElementById('cpError').classList.remove('show')}
|
||||
function hideChangePwd(){document.getElementById('pwdModal').classList.remove('show');document.getElementById('cpError').classList.remove('show')}
|
||||
|
||||
function doLogin(){
|
||||
var userId=document.getElementById('txtUserId').value.trim();
|
||||
var pwd=document.getElementById('txtPassword').value.trim();
|
||||
if(!userId){document.getElementById('loginError').textContent='请输入用户名';document.getElementById('loginError').classList.add('show');return}
|
||||
document.getElementById('loginError').classList.remove('show');
|
||||
var btn=document.getElementById('btnLogin');btn.disabled=true;btn.innerHTML='<span class="loading"></span>登录中...';
|
||||
var xhr=new XMLHttpRequest();
|
||||
xhr.open('POST','api/Auth/Login',true);
|
||||
xhr.setRequestHeader('Content-Type','application/json');
|
||||
xhr.onload=function(){
|
||||
btn.disabled=false;btn.innerHTML='登 录';
|
||||
try{
|
||||
var r=JSON.parse(xhr.responseText);
|
||||
if(r.success){
|
||||
sessionStorage.setItem('gx_user',JSON.stringify(r.data));
|
||||
var roles=r.data.roleNumbers||[];
|
||||
if(roles.indexOf('Produce02')>=0)window.location.href='View/MES/mes_dashboard.html';
|
||||
else if(roles.indexOf('Purchase01')>=0)window.location.href='procurement.html';
|
||||
else if(roles.indexOf('YF01')>=0)window.location.href='dashboard.html';
|
||||
else if(roles.indexOf('CRM01')>=0)window.location.href='index.html';
|
||||
else window.location.href='procurement.html';
|
||||
}else{
|
||||
document.getElementById('loginError').textContent=r.message||'登录失败';
|
||||
document.getElementById('loginError').classList.add('show');
|
||||
}
|
||||
}catch(e){document.getElementById('loginError').textContent='登录异常';document.getElementById('loginError').classList.add('show')}
|
||||
};
|
||||
xhr.onerror=function(){btn.disabled=false;btn.innerHTML='登 录';document.getElementById('loginError').textContent='网络连接失败';document.getElementById('loginError').classList.add('show')};
|
||||
xhr.send(JSON.stringify({userId:userId,password:pwd}));
|
||||
}
|
||||
|
||||
function doChangePwd(){
|
||||
var userId=document.getElementById('cpUserId').value.trim();
|
||||
var oldPwd=document.getElementById('cpOldPwd').value.trim();
|
||||
var newPwd=document.getElementById('cpNewPwd').value.trim();
|
||||
if(!userId){document.getElementById('cpError').textContent='请输入用户名';document.getElementById('cpError').classList.add('show');return}
|
||||
document.getElementById('cpError').classList.remove('show');
|
||||
var btn=document.getElementById('btnChangePwd');btn.disabled=true;btn.innerHTML='提交中...';
|
||||
var xhr=new XMLHttpRequest();
|
||||
xhr.open('POST','api/Auth/ChangePassword',true);
|
||||
xhr.setRequestHeader('Content-Type','application/json');
|
||||
xhr.onload=function(){
|
||||
btn.disabled=false;btn.innerHTML='确认修改';
|
||||
try{var r=JSON.parse(xhr.responseText);
|
||||
if(r.success){toast('密码修改成功','success');hideChangePwd();document.getElementById('cpUserId').value='';document.getElementById('cpOldPwd').value='';document.getElementById('cpNewPwd').value=''}
|
||||
else{document.getElementById('cpError').textContent=r.message||'修改失败';document.getElementById('cpError').classList.add('show')}
|
||||
}catch(e){document.getElementById('cpError').textContent='请求异常';document.getElementById('cpError').classList.add('show')}
|
||||
};
|
||||
xhr.onerror=function(){btn.disabled=false;btn.innerHTML='确认修改';toast('网络连接失败','error')};
|
||||
xhr.send(JSON.stringify({userId:userId,oldPassword:oldPwd,newPassword:newPwd}));
|
||||
}
|
||||
|
||||
document.getElementById('txtPassword').addEventListener('keydown',function(e){if(e.key==='Enter')doLogin()});
|
||||
document.getElementById('txtUserId').addEventListener('keydown',function(e){if(e.key==='Enter')document.getElementById('txtPassword').focus()});
|
||||
|
||||
(function(){
|
||||
var user=sessionStorage.getItem('gx_user');
|
||||
if(user){
|
||||
try{var data=JSON.parse(user);var roles=data.roleNumbers||[];
|
||||
if(roles.indexOf('Produce02')>=0)window.location.href='View/MES/mes_dashboard.html';
|
||||
else if(roles.indexOf('Purchase01')>=0)window.location.href='procurement.html';
|
||||
else if(roles.indexOf('YF01')>=0)window.location.href='dashboard.html';
|
||||
else if(roles.indexOf('CRM01')>=0)window.location.href='index.html';
|
||||
else window.location.href='procurement.html';
|
||||
}catch(e){}
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace GXWebApi.Common
|
||||
{
|
||||
|
||||
public class DBHelpe
|
||||
{
|
||||
// private readonly static string config = ConfigurationManager.ConnectionStrings["DB"].ConnectionString;
|
||||
|
||||
private string PriConnectionString = string.Empty;
|
||||
private static DBHelpe _instance = null;//单例
|
||||
public DBHelpe()
|
||||
{
|
||||
//获取连接字符串
|
||||
try
|
||||
{
|
||||
PriConnectionString = ConfigurationManager.ConnectionStrings["GXWMS"].ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(string.Format("未配置{0}库:{1}", "GXWMS", ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单例模式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static DBHelpe GetInstance()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new DBHelpe();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
#region 执行查询,返回要查询的结果集 DataTable
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询,返回要查询的结果集
|
||||
/// </summary>
|
||||
/// <param name="sql">sql语句</param>
|
||||
/// <returns></returns>
|
||||
public DataTable ExecuteTable(string par_SqlStr)
|
||||
{
|
||||
return ExecuteTable(par_SqlStr, CommandType.Text, null);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个DataTable对象
|
||||
/// </summary>
|
||||
/// <param name="M_str_par_SqlStr">SQL语句</param>
|
||||
/// <param name="M_str_table">表名</param>
|
||||
/// <returns>返回DataSet对象</returns>
|
||||
/// <summary>
|
||||
/// 执行查询,返回要查询的结果集
|
||||
/// </summary>
|
||||
/// <param name="sql">SQL语句</param>
|
||||
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
|
||||
/// <returns></returns>
|
||||
public DataTable ExecuteTable(string par_SqlStr, CommandType par_CommandType = CommandType.Text)
|
||||
{
|
||||
return ExecuteTable(par_SqlStr, par_CommandType, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询,返回要查询的结果集
|
||||
/// </summary>
|
||||
/// <param name="sql">SQL语句</param>
|
||||
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
|
||||
/// <param name="parameters">参数列表</param>
|
||||
/// <returns></returns>
|
||||
public DataTable ExecuteTable(string sql, CommandType par_CommandType, params System.Data.SqlClient.SqlParameter[] pParameters)
|
||||
{
|
||||
// 保存要查询的结果
|
||||
DataTable table = new DataTable("dt");
|
||||
//SqlCommand command;
|
||||
using (SqlConnection Connection = new SqlConnection(PriConnectionString))
|
||||
{
|
||||
//command = new SqlCommand(sql, Connection);
|
||||
using (SqlCommand command = new SqlCommand(sql, Connection))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (Connection.State != ConnectionState.Open)
|
||||
Connection.Open();
|
||||
// 设置SQL语句的类型
|
||||
command.CommandType = par_CommandType;
|
||||
command.CommandTimeout = 36000;
|
||||
// 如果传入了参数,则添加到命令对象中
|
||||
if (pParameters != null)
|
||||
{
|
||||
for (int i = command.Parameters.Count - 1; i >= 0; i--)
|
||||
{
|
||||
command.Parameters.RemoveAt(i);
|
||||
}
|
||||
command.Parameters.AddRange(pParameters);
|
||||
}
|
||||
|
||||
// 创建一个适配器对象,用以将结果填充到DataTable中
|
||||
SqlDataAdapter adapter = new SqlDataAdapter(command);
|
||||
|
||||
adapter.Fill(table);
|
||||
|
||||
}
|
||||
catch (System.Data.SqlClient.SqlException E)
|
||||
{
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
command.Parameters.Clear();
|
||||
command.Dispose();
|
||||
Connection.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return table;
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 执行增、删、改操作,返回受影响的行数
|
||||
/// <summary>
|
||||
/// 执行增、删、改操作,返回受影响的行数
|
||||
/// </summary>
|
||||
/// <param name="sql">存储过程名</param>
|
||||
/// <returns></returns>
|
||||
public int ExecuteNonQuery(string par_sql)
|
||||
{
|
||||
return ExecuteNonQuery(par_sql, CommandType.Text, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行增、删、改操作,返回受影响的行数
|
||||
/// </summary>
|
||||
/// <param name="sql">SQL语句</param>
|
||||
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
|
||||
/// <returns></returns>
|
||||
public int ExecuteNonQuery(string par_sql, CommandType par_CommandType)
|
||||
{
|
||||
return ExecuteNonQuery(par_sql, par_CommandType, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行增、删、改操作,返回受影响的行数
|
||||
/// </summary>
|
||||
/// <param name="sql">SQL语句</param>
|
||||
/// <param name="par_CommandType">SQL语句的类型(SQL文本命令或存储过程)</param>
|
||||
/// <param name="parameters">参数列表</param>
|
||||
/// <returns></returns>
|
||||
public int ExecuteNonQuery(string par_sql, CommandType par_CommandType, params System.Data.SqlClient.SqlParameter[] pParameters)
|
||||
{
|
||||
// 受影响的行数
|
||||
int count = 0;
|
||||
using (SqlConnection Connection = new SqlConnection(PriConnectionString))
|
||||
{
|
||||
using (SqlCommand command = new SqlCommand(par_sql, Connection))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Connection.State != ConnectionState.Open)
|
||||
Connection.Open();
|
||||
// 设置SQL语句的类型
|
||||
command.CommandType = par_CommandType;
|
||||
command.CommandTimeout = 36000;
|
||||
// 如果传入了参数,则添加到命令对象中
|
||||
if (pParameters != null)
|
||||
{
|
||||
for (int i = command.Parameters.Count - 1; i >= 0; i--)
|
||||
{
|
||||
command.Parameters.RemoveAt(i);
|
||||
}
|
||||
command.Parameters.AddRange(pParameters);
|
||||
}
|
||||
|
||||
count = command.ExecuteNonQuery();
|
||||
|
||||
}
|
||||
catch (System.Data.SqlClient.SqlException E)
|
||||
{
|
||||
throw new Exception(E.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
command.Parameters.Clear();
|
||||
command.Dispose();
|
||||
Connection.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 防止数据库参数为NULL
|
||||
/// </summary>
|
||||
/// <param name="param">参数名</param>
|
||||
/// <param name="value">参数值</param>
|
||||
/// <returns>数据库参数</returns>
|
||||
public static SqlParameter SetParam(string param, object value)
|
||||
{
|
||||
if (value == null)
|
||||
return new SqlParameter(param, "");
|
||||
return new SqlParameter(param, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断存储过程是否存在
|
||||
/// </summary>
|
||||
/// <param name="storeProcedureName">存储过程名</param>
|
||||
/// <returns></returns>
|
||||
public bool IsStoreProcedureExist(string storeProcedureName)
|
||||
{
|
||||
string existSql = string.Format(@"select * from sysobjects where id = object_id(N'[{0}]') and OBJECTPROPERTY(id, N'IsProcedure') = 1", storeProcedureName);
|
||||
DataTable dt = this.ExecuteTable(existSql);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static DataTable ConvertDataReaderToDataTable(SqlDataReader reader)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataTable objDataTable = new DataTable();
|
||||
int intFieldCount = reader.FieldCount;
|
||||
for (int intCounter = 0; intCounter < intFieldCount; ++intCounter)
|
||||
{
|
||||
objDataTable.Columns.Add(reader.GetName(intCounter), reader.GetFieldType(intCounter));
|
||||
}
|
||||
objDataTable.BeginLoadData();
|
||||
object[] objValues = new object[intFieldCount];
|
||||
while (reader.Read())
|
||||
{
|
||||
reader.GetValues(objValues);
|
||||
objDataTable.LoadDataRow(objValues, true);
|
||||
}
|
||||
reader.Close();
|
||||
objDataTable.EndLoadData();
|
||||
return objDataTable;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("转换出错!", ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user