Commit 75d9630d LN

hotayi登陆验证修改

1 个父辈 028bebd0
...@@ -137,8 +137,10 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -137,8 +137,10 @@ public class HotayiApi extends BaseSmfApiListener {
CodeBean codeBean = BarcodeRule.splitCodeAndSize(params.getCode()); CodeBean codeBean = BarcodeRule.splitCodeAndSize(params.getCode());
String reelId = codeBean.getCodeStr(); String reelId = codeBean.getCodeStr();
HotayiBean m6Bean=getM6Bean(reelId);
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("Barcode", reelId); paramMap.put("Info", m6Bean.getInfo());
paramMap.put("Data", m6Bean.getData());
log.info(reelId + "入库验证M6,参数" + JsonUtil.toJsonStr(paramMap)); log.info(reelId + "入库验证M6,参数" + JsonUtil.toJsonStr(paramMap));
String result = HttpHelper.getJson(codeResolveUrl, paramMap); String result = HttpHelper.getJson(codeResolveUrl, paramMap);
...@@ -191,7 +193,7 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -191,7 +193,7 @@ public class HotayiApi extends BaseSmfApiListener {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("入库验证接口出错:" + e.getMessage()); log.error("入库验证接口出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.inCheck.error", "MES验证出错:" + e.getMessage()); throw new ValidateException("smfcore.mesApi.inCheck.error", "MES验证出错:" + e.getMessage(),new String[]{ e.getMessage()});
} }
} }
...@@ -276,6 +278,15 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -276,6 +278,15 @@ public class HotayiApi extends BaseSmfApiListener {
//“Mode”: “1” //“Mode”: “1”
// } // }
// } // }
private HotayiBean getM6Bean(String barcode ) {
HotayiBean bean = new HotayiBean();
bean.addInfo("MachineID", machineID);
bean.addInfo("IPAddress", iPAddress);
bean.addInfo("MessageNo", "M6");
bean.addData("Barcode", barcode);
return bean;
}
private HotayiBean getM10Bean(String barcode,Integer OperationMode,Integer Mode ) { private HotayiBean getM10Bean(String barcode,Integer OperationMode,Integer Mode ) {
HotayiBean bean = new HotayiBean(); HotayiBean bean = new HotayiBean();
bean.addInfo("MachineID", machineID); bean.addInfo("MachineID", machineID);
...@@ -303,7 +314,7 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -303,7 +314,7 @@ public class HotayiApi extends BaseSmfApiListener {
HotayiBean m22Bean = getM22Bean(userName, pwd, "SMT Machine"); HotayiBean m22Bean = getM22Bean(userName, pwd, "SMT Machine");
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("Info", m22Bean.getInfo()); paramMap.put("Info", m22Bean.getInfo());
paramMap.put("Date", m22Bean.getData()); paramMap.put("Data", m22Bean.getData());
String requestParams = JsonUtil.toJsonStr(paramMap); String requestParams = JsonUtil.toJsonStr(paramMap);
...@@ -315,14 +326,18 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -315,14 +326,18 @@ public class HotayiApi extends BaseSmfApiListener {
result = result.replace("\"{", "{"); result = result.replace("\"{", "{");
result = result.replace("}\"", "}"); result = result.replace("}\"", "}");
log.info(userName + "登陆验证M22 处理后" + result); log.info(userName + "登陆验证M22 处理后" + result);
// 2023-04-18 11:16:04.447 INFO [HotayiApi.java:323] - 47024登陆验证M22 返回"{\"Info\":{\"MachineID\":1441,\"IPAddress\":\"10.1.41.93\",\"MessageNo\":\"m21\"},\"Data\":{\"Username\":\"YEONG CHEN YIE\",\"UserLevel\":10}}"
// 2023-04-18 11:16:04.447 INFO [HotayiApi.java:328] - 47024登陆验证M22 处理后
// {"Info":{"MachineID":1441,"IPAddress":"10.1.41.93","MessageNo":"m21"},"Data":{"Username":"YEONG CHEN YIE","UserLevel":10}}
HotayiBean hotayiBean = JsonUtil.toObj(result, HotayiBean.class); HotayiBean hotayiBean = JsonUtil.toObj(result, HotayiBean.class);
String resultMsgNo = hotayiBean.getInfoItem("MessageNo"); String resultMsgNo = hotayiBean.getInfoItem("MessageNo");
if (resultMsgNo.equals("M90")) { if (resultMsgNo.equals("M90")) {
String errorCode = hotayiBean.getDataItem("ErrorCode"); String errorCode = hotayiBean.getDataItem("ErrorCode");
String errorMessage = hotayiBean.getDataItem("ErrorMessage"); String errorMessage = hotayiBean.getDataItem("ErrorMessage");
throw new ValidateException("smfcore.mesApi.loginCheck.ng","NG: ["+errorCode+"]"+errorMessage); throw new ValidateException("smfcore.mesApi.loginCheck.error","NG: ["+errorCode+"]"+errorMessage,new String[]{"["+errorCode+"]"+errorMessage});
}else { }else {
String UserLevel = hotayiBean.getInfoItem("UserLevel"); Integer UserLevel = hotayiBean.getDataItem("UserLevel");
// String name=hotayiBean.getDataItem("Username");
if (ObjectUtil.isNotEmpty(UserLevel)) { if (ObjectUtil.isNotEmpty(UserLevel)) {
log.info(userName + "登陆验证M22 返回 UserLevel=" + UserLevel); log.info(userName + "登陆验证M22 返回 UserLevel=" + UserLevel);
...@@ -339,10 +354,10 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -339,10 +354,10 @@ public class HotayiApi extends BaseSmfApiListener {
} catch (Exception e) { } catch (Exception e) {
log.error("登陆验证接口出错:" + e.getMessage()); log.error("登陆验证接口出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.loginCheck.error", "MES Login Error:" + e.getMessage()); throw new ValidateException("smfcore.mesApi.loginCheck.error", "MES Login Error:" + e.getMessage(),new String[]{e.getMessage()});
} }
} }
private void autoCreateUser(String userName,String pwd,String userLevel) { private void autoCreateUser(String userName,String pwd,Integer userLevel) {
try { try {
// 10 = Administrator // 10 = Administrator
// 20 = Engineer // 20 = Engineer
...@@ -353,9 +368,9 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -353,9 +368,9 @@ public class HotayiApi extends BaseSmfApiListener {
log.info("autoCreateUser 未找到用户,自动创建用户[" + userName + "] "); log.info("autoCreateUser 未找到用户,自动创建用户[" + userName + "] ");
String roleName = "operater"; String roleName = "operater";
if (userLevel.equals("10")) { if (userLevel==10) {
roleName = "admin"; roleName = "admin";
} else if (userLevel.equals("20")) { } else if (userLevel==20) {
roleName = "engineer"; roleName = "engineer";
} }
...@@ -376,6 +391,11 @@ public class HotayiApi extends BaseSmfApiListener { ...@@ -376,6 +391,11 @@ public class HotayiApi extends BaseSmfApiListener {
user.setLanguage("en_US"); user.setLanguage("en_US");
user.setRoleId(role.getId()); user.setRoleId(role.getId());
user.setEnabled(true); user.setEnabled(true);
if(userLevel==10){
user.setIsAdmin(true);
}else{
user.setIsAdmin(false);
}
user=userManager.save(user); user=userManager.save(user);
log.info("autoCreateUser 未找到用户,自动创建用户[" + userName + "]完成 "); log.info("autoCreateUser 未找到用户,自动创建用户[" + userName + "]完成 ");
......
...@@ -346,6 +346,9 @@ smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}] ...@@ -346,6 +346,9 @@ smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25 smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}] smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}]
smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7 smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.mesApi.inCheck.error=MES\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9646\u9A8C\u8BC1\u5931\u8D25
smfcore.mesApi.loginCheck.error=MES\u767B\u9646\u9A8C\u8BC1\u9519\u8BEF\uFF1A{0}
#smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0} #smfclient.nlp.onlyOneTray=\u4E0D\u53EF\u540C\u65F6\u653E\u5165\u591A\u76D8\u7269\u6599:{0}
#smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1} #smfclient.nlp.cannotFindPos={0}\u672A\u627E\u5230\u5E93\u4F4D:{1}
#smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F #smfclient.nlp.inputOk={0}\u5165\u5E93\u5230{1}\u6210\u529F
......
...@@ -344,4 +344,7 @@ order.error.executing= {0} Already in the task list ...@@ -344,4 +344,7 @@ order.error.executing= {0} Already in the task list
smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}] smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.operationFailure=Operation failed smfcore.operationFailure=Operation failed
smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}] smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}]
smfcore.selfAudit.noPos=Self Audit{0}No depot number found
\ No newline at end of file \ No newline at end of file
smfcore.selfAudit.noPos=Self Audit{0}No depot number found
smfcore.mesApi.inCheck.error=MES verification error\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES Login fail
smfcore.mesApi.loginCheck.error=MES Login error\uFF1A{0}
\ No newline at end of file \ No newline at end of file
...@@ -341,4 +341,7 @@ order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D ...@@ -341,4 +341,7 @@ order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}] smfcore.queryPos.solderOutFail=[{0}]checkOut fail,currStatus[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25 smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}] smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}]
smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
\ No newline at end of file \ No newline at end of file
smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.mesApi.inCheck.error=MES\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9646\u9A8C\u8BC1\u5931\u8D25
smfcore.mesApi.loginCheck.error=MES\u767B\u9646\u9A8C\u8BC1\u9519\u8BEF\uFF1A{0}
\ No newline at end of file \ No newline at end of file
...@@ -341,4 +341,7 @@ order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D ...@@ -341,4 +341,7 @@ order.error.executing={0}\u5DF2\u5728\u4EFB\u52A1\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25\uFF0C\u5F53\u524D\u72B6\u6001\uFF1A[{1}] smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25\uFF0C\u5F53\u524D\u72B6\u6001\uFF1A[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25 smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}] smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}]
smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
\ No newline at end of file \ No newline at end of file
smfcore.selfAudit.noPos=\u76D8\u70B9{0}\u672A\u627E\u5230\u5E93\u4F4D\u53F7
smfcore.mesApi.inCheck.error=MES\u9A8C\u8BC1\u51FA\u9519\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9646\u9A8C\u8BC1\u5931\u8D25
smfcore.mesApi.loginCheck.error=MES\u767B\u9646\u9A8C\u8BC1\u9519\u8BEF\uFF1A{0}
\ No newline at end of file \ No newline at end of file
...@@ -342,4 +342,7 @@ order.error.executing={0}\u5DF2\u5728\u4EFB\u52D9\u5217\u8868\u4E2D ...@@ -342,4 +342,7 @@ order.error.executing={0}\u5DF2\u5728\u4EFB\u52D9\u5217\u8868\u4E2D
smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25\uFF0C\u5F53\u524D\u72B6\u6001\uFF1A[{1}] smfcore.queryPos.solderOutFail=[{0}]\u51FA\u5E93\u5931\u8D25\uFF0C\u5F53\u524D\u72B6\u6001\uFF1A[{1}]
smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25 smfcore.operationFailure=\u64CD\u4F5C\u5931\u8D25
smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}] smfcore.hotayi.machineID.error=machineID inconsistency [{0}] [{1}]
smfcore.selfAudit.noPos=\u76E4\u9EDE{0}\u672A\u627E\u5230\u5EAB\u4F4D\u865F
\ No newline at end of file \ No newline at end of file
smfcore.selfAudit.noPos=\u76E4\u9EDE{0}\u672A\u627E\u5230\u5EAB\u4F4D\u865F
smfcore.mesApi.inCheck.error=MES\u9A57\u8B49\u51FA\u932F\uFF1A{0}
smfcore.mesApi.loginCheck.fail=MES\u767B\u9678\u9A57\u8B49\u5931\u6557
smfcore.mesApi.loginCheck.error=MES\u767B\u9678\u9A57\u8B49\u932F\u8AA4\uFF1A{0}
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!