Commit 40dd58c2 zshaohui

操作设备时,增加用户登录缓存信息

1 个父辈 a2c0459d
......@@ -10,6 +10,7 @@ import java.text.MessageFormat;
public class ApiException extends Exception {
public ApiException(String message){
super(message);
this.defaultMsg = message;
}
public String msgKey="";
......
......@@ -49,6 +49,7 @@ import com.neotel.smfcore.core.system.util.DevicesStatusUtil;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.micron20031.Micron20031Api;
import com.neotel.smfcore.custom.micron20031.bean.MInOutType;
import com.neotel.smfcore.custom.micron20031.cache.LoginCache;
import com.neotel.smfcore.security.service.manager.IGroupManager;
import com.neotel.smfcore.custom.siemens.bean.LotCheckInfo;
import lombok.extern.slf4j.Slf4j;
......@@ -108,6 +109,9 @@ public class BaseDeviceHandler implements IDeviceHandler {
@Autowired
private IInOutDataManager inOutDataManager;
@Autowired
private LoginCache loginCache;
/**
* CID的服务器消息(key 为 cid)
*/
......@@ -286,7 +290,7 @@ public class BaseDeviceHandler implements IDeviceHandler {
type=COMPONENT_TYPE.FIXTURE;
}
String codeStr = statusBean.getCode();
CodeValidateParam params = new CodeValidateParam("",storage.getGroupId(),storage.getId(),codeStr,"");
CodeValidateParam params = new CodeValidateParam(loginCache.getLoginUserName(storage.getCid()),storage.getGroupId(),storage.getId(),codeStr,"");
Barcode barcodeSave = smfApi.canPutInBeforeResolve(params);
if(barcodeSave == null){
barcodeSave = codeResolve.resolveOneValideBarcode(codeStr,type);
......
......@@ -11,7 +11,9 @@ import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.custom.micron20031.bean.DepositMatReqBean;
import com.neotel.smfcore.custom.micron20031.bean.MatOrderBean;
import com.neotel.smfcore.custom.micron20031.cache.LoginCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -181,6 +183,14 @@ public class Micron20031Api {
}
}
private static LoginCache loginCache;
@Autowired
private void setLoginCache(LoginCache cache){
Micron20031Api.loginCache = cache;
}
private static String MATERIAL_TYPE = "SOLDER_PASTE";
public static boolean isEnable(){
......
......@@ -3,6 +3,7 @@ package com.neotel.smfcore.custom.micron20031;
import cn.hutool.core.util.ObjectUtil;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.inList.rest.bean.dto.InListDto;
import com.neotel.smfcore.core.inList.rest.bean.mapstruct.InListMapper;
......@@ -15,6 +16,7 @@ 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 com.neotel.smfcore.custom.micron20031.cache.LoginCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -46,6 +48,9 @@ public class MicronSpLoadController {
@Autowired
private DataCache dataCache;
@Autowired
private LoginCache loginCache;
@ApiOperation("获取入库单详情")
@GetMapping(value = "/desposit/getMatReqDetail")
public ResultBean getMatReqDetail(String matReqNo) {
......@@ -117,6 +122,9 @@ public class MicronSpLoadController {
//设置开始入库
DevicesStatusUtil.appendOp(storage.getCid(),"closeInLock","doit");
loginCache.updateLoginMap(storage.getCid(),SecurityUtils.getLoginUsername());
return ResultBean.newOkResult(matReqNo);
}
......@@ -138,6 +146,8 @@ public class MicronSpLoadController {
//设置开始入库
DevicesStatusUtil.appendOp(storage.getCid(),"closeInLock","doit");
loginCache.updateLoginMap(storage.getCid(), SecurityUtils.getLoginUsername());
return ResultBean.newOkResult("");
}
......
......@@ -19,6 +19,7 @@ import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.core.system.util.TaskService;
import com.neotel.smfcore.custom.micron20031.bean.MInOutType;
import com.neotel.smfcore.custom.micron20031.bean.dto.SpUnloadDto;
import com.neotel.smfcore.custom.micron20031.cache.LoginCache;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
......@@ -53,6 +54,9 @@ public class MicronSpUnloadController {
@Autowired
private StoragePosMapper storagePosMapper;
@Autowired
private LoginCache loginCache;
@ApiOperation("Withdraw Offline出库: GetEquipIDList")
......@@ -144,6 +148,9 @@ public class MicronSpUnloadController {
if (!Strings.isNullOrEmpty(outResult)) {
throw new ValidateException("smfcore.error", outResult);
}
loginCache.updateLoginMap(storage.getCid(),SecurityUtils.getLoginUsername());
return ResultBean.newOkResult("");
}
......@@ -198,6 +205,7 @@ public class MicronSpUnloadController {
dtoResult.add(getUnloadDto(pos, unloakOk));
loginCache.updateLoginMap(storage.getCid(),SecurityUtils.getLoginUsername());
}
return ResultBean.newOkResult(dtoResult);
}
......
package com.neotel.smfcore.custom.micron20031.cache;
import org.springframework.stereotype.Service;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Service
public class LoginCache {
Map<String, String> loginMap = new ConcurrentHashMap<>();
public void updateLoginMap(String cid, String userName) {
loginMap.put(cid, userName);
}
public String getLoginUserName(String cid) {
return loginMap.get(cid);
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!