MES登录接口设置
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
using System;
|
||||
using JY.Inspection.Enums;
|
||||
using JY.Inspection.Mes;
|
||||
using JY.MES.Entity;
|
||||
using JY.MES.MES;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
@@ -36,14 +41,11 @@ namespace JY.Inspection.Common
|
||||
///
|
||||
[Display(Name = "密码")]
|
||||
public string PassWord { get; set; }
|
||||
/// <summary>
|
||||
/// 权限
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
|
||||
[Display(Name = "权限")]
|
||||
public Autuority Level { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 权限枚举
|
||||
/// </summary>
|
||||
@@ -54,7 +56,6 @@ namespace JY.Inspection.Common
|
||||
操作员,//操作员
|
||||
Empty,
|
||||
}
|
||||
|
||||
public class UserHelper
|
||||
{
|
||||
private string filePath = string.Empty;
|
||||
@@ -292,5 +293,52 @@ namespace JY.Inspection.Common
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用MES员工信息接口校验登录信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public User CheckMesUserLogin(string userName, string passWord, ref string strErr)
|
||||
{
|
||||
User user = null;
|
||||
|
||||
ReqLoginMes req = new ReqLoginMes()
|
||||
{
|
||||
SiteCode = Global.systemConfig.siteCode,
|
||||
LineCode = Global.systemConfig.lineCode,
|
||||
EquipNum = Global.systemConfig.equipCode,
|
||||
UserName = userName,
|
||||
PassWord = passWord,
|
||||
UserCardID = string.Empty
|
||||
};
|
||||
|
||||
string strJson = JsonConvert.SerializeObject(req);
|
||||
|
||||
MesCallResult<RespLoginMes> result = new MESDataCombin().LoginMes(req);
|
||||
|
||||
if (result.IsSuccess && result.OriResponse?.Rows.Length == 1)
|
||||
{
|
||||
// TODO 权限转化
|
||||
string levelStr = result.OriResponse.Rows[0].PermissionLevel;
|
||||
|
||||
bool resultLevel = Int32.TryParse(levelStr, out int level);
|
||||
if (!resultLevel)
|
||||
{
|
||||
strErr = $"权限转化失败,权限值为:{levelStr}";
|
||||
return user;
|
||||
}
|
||||
|
||||
user = new User() {
|
||||
UserName = result.OriResponse.Rows[0].Username,
|
||||
Level = level.ToEnum<EnumAutority>().MapperEnum()
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
strErr = string.IsNullOrEmpty(result.OriResponse?.Message) ? result.ErrorMessage : result.OriResponse?.Message;
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user