Commit edd8a5ff LN

增加接口地址配置

1 个父辈 cd8a0ac9
...@@ -144,7 +144,10 @@ public class HttpHelper { ...@@ -144,7 +144,10 @@ public class HttpHelper {
if (params == null || params.isEmpty()) { if (params == null || params.isEmpty()) {
params = null; params = null;
} }
return postJsonWithAuth(url, params, null); String result= postJsonWithAuth(url, params, null);
log.info(" postJson url=["+url+"],return=["+result+"]");
return result;
} }
public static String postJsonWithAuth(String url, Object params, String auth) throws ApiException { public static String postJsonWithAuth(String url, Object params, String auth) throws ApiException {
...@@ -172,6 +175,8 @@ public class HttpHelper { ...@@ -172,6 +175,8 @@ public class HttpHelper {
String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET); String responseContent = EntityUtils.toString(entity, CONTENT_CHARSET);
response.close(); response.close();
httpClient.close(); httpClient.close();
log.info("postJsonWithAuth url=["+url+"] return= ["+responseContent+"]");
return responseContent; return responseContent;
} catch (Exception e) { } catch (Exception e) {
throw new ApiException("Request to [" + url + "] failed:" + e.getMessage()); throw new ApiException("Request to [" + url + "] failed:" + e.getMessage());
......
...@@ -225,7 +225,7 @@ public class SmfApi { ...@@ -225,7 +225,7 @@ public class SmfApi {
return null; return null;
} }
public boolean canLogin(String username, String pwd)throws ValidateException { public boolean canLogin(String username, String pwd)throws ValidateException {
if (ObjectUtil.isNotEmpty(username) && ObjectUtil.isNotEmpty(pwd)) { if (ObjectUtil.isNotEmpty(username) ) {
if (isUrlExist(loginCheckUrl)) { if (isUrlExist(loginCheckUrl)) {
for (ISmfApiListener apiListener : apiListenerList) { for (ISmfApiListener apiListener : apiListenerList) {
......
...@@ -12,8 +12,9 @@ import com.neotel.smfcore.core.inList.util.InListCache; ...@@ -12,8 +12,9 @@ import com.neotel.smfcore.core.inList.util.InListCache;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.text.html.InlineView; @Service
@Slf4j @Slf4j
public class MicronSpApiListener extends BaseSmfApiListener { public class MicronSpApiListener extends BaseSmfApiListener {
...@@ -21,7 +22,11 @@ public class MicronSpApiListener extends BaseSmfApiListener { ...@@ -21,7 +22,11 @@ public class MicronSpApiListener extends BaseSmfApiListener {
private InListCache inListCache; private InListCache inListCache;
@Override @Override
public boolean isForThisApi(String apiName) { public boolean isForThisApi(String apiName) {
return Micron20031Api.isEnable(); if (Micron20031Api.isEnable()) {
return true;
}
// return apiName != null && apiName.equalsIgnoreCase("20031");
return false;
} }
@Override @Override
public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException { public Barcode canPutInAfterResolve(String inCheckUrl, CodeValidateParam params, Barcode barcode) throws ValidateException {
...@@ -58,4 +63,19 @@ public class MicronSpApiListener extends BaseSmfApiListener { ...@@ -58,4 +63,19 @@ public class MicronSpApiListener extends BaseSmfApiListener {
} }
return null; return null;
} }
@Override
public boolean canLogin(String loginCheckUrl, String userName, String pwd) throws ValidateException {
try {
return Micron20031Api.checkUserRights(userName);
}catch (ValidateException e){
throw e;
}
catch (Exception e) {
log.error("登陆验证接口出错:" + e.getMessage());
throw new ValidateException("smfcore.mesApi.loginCheck.error", "MES Login Error:" + e.getMessage());
}
}
} }
...@@ -13,6 +13,7 @@ import com.neotel.smfcore.core.inList.util.InListCache; ...@@ -13,6 +13,7 @@ import com.neotel.smfcore.core.inList.util.InListCache;
import com.neotel.smfcore.core.storage.enums.DeviceType; import com.neotel.smfcore.core.storage.enums.DeviceType;
import com.neotel.smfcore.core.storage.service.manager.IStorageManager; import com.neotel.smfcore.core.storage.service.manager.IStorageManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.custom.micron20031.bean.DepositMatReqBean; import com.neotel.smfcore.custom.micron20031.bean.DepositMatReqBean;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -105,9 +106,12 @@ public class MicronSpLoadController { ...@@ -105,9 +106,12 @@ public class MicronSpLoadController {
inListCache.addInListToMap(inList); inListCache.addInListToMap(inList);
storage.setInListName(matReqNo); storage.setInListName(matReqNo);
log.info("设置料仓[" + storage.getName() + "]的入库单为:[" + matReqNo + "],同时更新入库单开始时间"); log.info("设置料仓[" + storage.getName() + "]的入库单为:[" + matReqNo + "],同时更新入库单开始时间,同时发送 closeInLock=doit");
storageManager.save(storage); storageManager.save(storage);
dataCache.reloadStorage(storage, ""); dataCache.reloadStorage(storage, "");
//设置开始入库
DevicesStatusUtil.appendOp(storage.getCid(),"closeInLock","doit");
return ResultBean.newOkResult(matReqNo); return ResultBean.newOkResult(matReqNo);
} }
...@@ -122,9 +126,13 @@ public class MicronSpLoadController { ...@@ -122,9 +126,13 @@ public class MicronSpLoadController {
return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败"); return ResultBean.newErrorResult(-1, "smfcore.micron.operationFailure", "操作失败");
} }
storage.setInListName(""); storage.setInListName("");
log.info("设置料仓[" + storage.getName() + "]开始 return "); log.info("设置料仓[" + storage.getName() + "]开始 return ,同时发送 closeInLock=doit ");
storageManager.save(storage); storageManager.save(storage);
dataCache.reloadStorage(storage,""); dataCache.reloadStorage(storage,"");
//设置开始入库
DevicesStatusUtil.appendOp(storage.getCid(),"closeInLock","doit");
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!