Commit edd8a5ff LN

增加接口地址配置

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