出库单返回单号
增加登录验证
This commit is contained in:
@@ -9,8 +9,10 @@ namespace NX.ERP.Model.Request
|
|||||||
{
|
{
|
||||||
private string _UserCode;
|
private string _UserCode;
|
||||||
private string _UserName;
|
private string _UserName;
|
||||||
|
private string _mdPassword;
|
||||||
|
|
||||||
public string UserCode { get => _UserCode; set => _UserCode = value; }
|
public string UserCode { get => _UserCode; set => _UserCode = value; }
|
||||||
public string UserName { get => _UserName; set => _UserName = value; }
|
public string UserName { get => _UserName; set => _UserName = value; }
|
||||||
|
public string MdPassword { get => _mdPassword; set => _mdPassword = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,7 +259,18 @@ namespace NX.ERP.U8.Store
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return AddRdVoucher(voucherParameter);
|
var voucherId = AddRdVoucher(voucherParameter);
|
||||||
|
if (!string.IsNullOrEmpty(voucherId))
|
||||||
|
{
|
||||||
|
var model = this.GetModel(int.Parse(voucherId));
|
||||||
|
if (model!=null)
|
||||||
|
{
|
||||||
|
voucherId = model.Code;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return voucherId;
|
||||||
}
|
}
|
||||||
catch (Exception err)
|
catch (Exception err)
|
||||||
{
|
{
|
||||||
@@ -294,6 +305,13 @@ namespace NX.ERP.U8.Store
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MaterialStoreOut GetModel(int Id)
|
||||||
|
{
|
||||||
|
return GetList(" a.id=@id", new { Id }).FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MaterialStoreOut GetModel(string Code)
|
public MaterialStoreOut GetModel(string Code)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
|
|
||||||
@@ -17,22 +19,15 @@ namespace NX.ERP.U8.User
|
|||||||
|
|
||||||
public IEnumerable<Model.Request.User> GetList(string strWhere = "", object Param = null)
|
public IEnumerable<Model.Request.User> GetList(string strWhere = "", object Param = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
using (var conn = U8LoginContext.Instance.Connection)
|
using (var conn = U8LoginContext.Instance.Connection)
|
||||||
{
|
{
|
||||||
var sql = @" select cUser_Id as UserCode ,cUser_Name as UserName from UFSystem..UA_User ";
|
var sql = @" select cUser_Id as UserCode ,cUser_Name as UserName,cPassword as mdPassword from UFSystem..UA_User ";
|
||||||
if (!string.IsNullOrEmpty(strWhere))
|
if (!string.IsNullOrEmpty(strWhere))
|
||||||
{
|
{
|
||||||
sql += $" where {strWhere}";
|
sql += $" where {strWhere}";
|
||||||
}
|
}
|
||||||
return conn.Query<Model.Request.User>(sql, Param);
|
return conn.Query<Model.Request.User>(sql, Param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -44,23 +39,37 @@ namespace NX.ERP.U8.User
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public bool Login(string UserId, string Password)
|
||||||
|
{
|
||||||
|
byte[] byte1 = Encoding.UTF8.GetBytes(Password);
|
||||||
|
SHA1Managed sHA1Managed = new SHA1Managed();
|
||||||
|
var hashValue = sHA1Managed.ComputeHash(byte1);
|
||||||
|
var mdPassword = Convert.ToBase64String(hashValue) + (char)3;
|
||||||
|
//密码密文
|
||||||
|
var userDal = new UserDal();
|
||||||
|
var user = userDal.GetModel(UserId);
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (user.MdPassword != mdPassword)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public string Userrole(string Opnanme, string Pasd)
|
public string Userrole(string Opnanme, string Pasd)
|
||||||
{
|
{
|
||||||
var AccID = ConfigurationManager.AppSettings["AccId"];
|
var AccID = ConfigurationManager.AppSettings["AccId"];
|
||||||
//NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
|
|
||||||
|
|
||||||
//NX.ERP.U8.U8LoginContext.Instance.UserId = System.Configuration.ConfigurationManager.AppSettings["UserId"];
|
|
||||||
|
|
||||||
var Server = ConfigurationManager.AppSettings["Server"];
|
var Server = ConfigurationManager.AppSettings["Server"];
|
||||||
var _login = new NX.ERP.U8.U8LoginContext(Server, AccID);
|
var _login = new NX.ERP.U8.U8LoginContext(Server, AccID);
|
||||||
_login.Login(Opnanme, Pasd);
|
_login.Login(Opnanme, Pasd);
|
||||||
|
|
||||||
var sql = $@" SELECT 1 from UFSystem..UA_Role where cUser_Id=@Opnanme and cGroup_Id='report' ;";
|
var sql = $@" SELECT 1 from UFSystem..UA_Role where cUser_Id=@Opnanme and cGroup_Id='report' ;";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using (var conn = _login.Connection)
|
using (var conn = _login.Connection)
|
||||||
{
|
{
|
||||||
return conn.ExecuteScalar<string>(sql, new { Opnanme }, null, 30, System.Data.CommandType.Text);
|
return conn.ExecuteScalar<string>(sql, new { Opnanme }, null, 30, System.Data.CommandType.Text);
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
namespace NX.ERP.WebAPi.Controllers.System
|
namespace NX.ERP.WebAPi.Controllers.System
|
||||||
@@ -12,8 +14,8 @@ namespace NX.ERP.WebAPi.Controllers.System
|
|||||||
{
|
{
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("api/System/Login")]
|
[Route("api/System/BOLogin")]
|
||||||
public string Login(LoginEntity loginEntity)
|
public string BOLogin(LoginEntity loginEntity)
|
||||||
{
|
{
|
||||||
var AccID = ConfigurationManager.AppSettings["AccId"];
|
var AccID = ConfigurationManager.AppSettings["AccId"];
|
||||||
//NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
|
//NX.ERP.U8.U8LoginContext.Instance.PassWord = System.Configuration.ConfigurationManager.AppSettings["Password"];
|
||||||
@@ -24,6 +26,27 @@ namespace NX.ERP.WebAPi.Controllers.System
|
|||||||
return _login.loginId;
|
return _login.loginId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Route("api/System/Login")]
|
||||||
|
public bool Login(LoginEntity loginEntity)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(loginEntity.Password) || string.IsNullOrEmpty(loginEntity.UserId))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//密码密文
|
||||||
|
var userDal = new U8.User.UserDal();
|
||||||
|
return userDal.Login(loginEntity.UserId, loginEntity.Password);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("api/System/Userrole")]
|
[Route("api/System/Userrole")]
|
||||||
public string Userrole(LoginEntity loginEntity)
|
public string Userrole(LoginEntity loginEntity)
|
||||||
|
|||||||
Reference in New Issue
Block a user