Commit 211a0cdc sunke

1 亮灯灭灯慢的问题

2 第一盘料没感应到又扫了第二盘物料时,取消第一盘料的入库任务
1 个父辈 c7bd53b4
...@@ -141,32 +141,27 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -141,32 +141,27 @@ public class NLPShelfHandler extends BaseDeviceHandler{
if(storage == null){ if(storage == null){
return ResultBean.newErrorResult(-1,"smfcore.shelfNotExist", "{0}对应的料架不存在",new String[]{cid} ); return ResultBean.newErrorResult(-1,"smfcore.shelfNotExist", "{0}对应的料架不存在",new String[]{cid} );
} }
String groupId = storage.getGroupId(); synchronized(storage){
if(groupId.equals("")){ //实际信号有料,数据库无信息
groupId="-1"; String[] hasReelPosErrorList = request.getParameterValues("hasReelPosErrorList");
} //实际信号无料,数据库有信息
String[] hasReelPosList = request.getParameterValues("hasReelPosList"); String[] noReelPosErrorList = request.getParameterValues("noReelPosErrorList");
String[] noReelPosList = request.getParameterValues("noReelPosList");
String[] hasReelPosErrorList = request.getParameterValues("hasReelPosErrorList");//实际信号有料,数据库无信息
String[] noReelPosErrorList = request.getParameterValues("noReelPosErrorList");//实际信号无料,数据库有信息
if(hasReelPosErrorList==null){ if(hasReelPosErrorList==null){
hasReelPosErrorList=new String[]{}; hasReelPosErrorList=new String[]{};
} }
if(noReelPosErrorList==null) { if(noReelPosErrorList==null) {
noReelPosErrorList = new String[]{}; noReelPosErrorList = new String[]{};
} }
List<String> usedPosNameList = dataCache.getUsedPosNameList(storage.getCid());
List<String> ngToOk=new ArrayList<>(); List<String> ngToOk=new ArrayList<>();
//数据库有信息,实际无料 //数据库有信息,实际无料
if(noReelPosErrorList.length>0){ if(noReelPosErrorList.length>0){
//log.info("开始检测noReelPosErrorList"); //log.info("开始检测noReelPosErrorList");
Query query=new Query(Criteria.where("posName").in(noReelPosErrorList)); for (String noReelPosName : noReelPosErrorList) {
List<StoragePos> posList= storagePosManager.findByQuery(query); if(usedPosNameList.contains(noReelPosName)){
for (StoragePos pos:posList) { ngToOk.add(noReelPosName);
if(!pos.isUsed()){ log.info("sensorChange 客户端上传 noReelPosErrorList 库位["+noReelPosName+"]数据库无物料,放入ngToOk");
ngToOk.add(pos.getPosName());
log.info("sensorChange 客户端上传 noReelPosErrorList 库位["+pos.getPosName()+"]数据库无信息,放入ngToOk");
} }
} }
} }
...@@ -181,16 +176,14 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -181,16 +176,14 @@ public class NLPShelfHandler extends BaseDeviceHandler{
List<String> outOkList = new ArrayList<>(); List<String> outOkList = new ArrayList<>();
List<String> outNgList = new ArrayList<>(); List<String> outNgList = new ArrayList<>();
String[] hasReelPosList = request.getParameterValues("hasReelPosList");
if(hasReelPosList != null){ if(hasReelPosList != null){
log.info("开始检测hasReelPosList"); log.info("开始检测hasReelPosList");
Set<String> disabledPosNameSet = dataCache.getDisabledPosNameSet();
List<String> newList=new ArrayList<>(); List<String> newList=new ArrayList<>();
for (String posName : hasReelPosList) { for (String posName : hasReelPosList) {
StoragePos pos = storagePosManager.getByPosName(posName); if(disabledPosNameSet.contains(posName)){
if(pos==null) { log.info("sensorChange hasReelPosList [" + posName + "]库位被禁用,忽略");
log.info("sensorChange 未找到库位 hasReelPosList [" + posName + "]");
continue;
}
if(!pos.isEnabled()){
continue; continue;
} }
newList.add(posName); newList.add(posName);
...@@ -202,10 +195,6 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -202,10 +195,6 @@ public class NLPShelfHandler extends BaseDeviceHandler{
if(hasReelPosList.length > 1){ if(hasReelPosList.length > 1){
String msg = "不可同时放入多盘物料:"+ String.join(",",hasReelPosList); String msg = "不可同时放入多盘物料:"+ String.join(",",hasReelPosList);
log.error(msg); log.error(msg);
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
SocketMsg socketMsg = new SocketMsg(notifyUsers, msg, MsgType.ERROR,"smfclient.nlp.onlyOneTray",new String[]{String.join(",",hasReelPosList)});
WebSocketServer.sendMsg("",socketMsg);
for (String posStr : hasReelPosList) { for (String posStr : hasReelPosList) {
inNgList.add(posStr); inNgList.add(posStr);
} }
...@@ -215,22 +204,64 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -215,22 +204,64 @@ public class NLPShelfHandler extends BaseDeviceHandler{
if(pos == null){ if(pos == null){
String msg = "未找到库位:"+String.join(",",hasReelPosList) ; String msg = "未找到库位:"+String.join(",",hasReelPosList) ;
log.error(msg); log.error(msg);
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
WebSocketServer.sendMsg("",new SocketMsg(notifyUsers,msg, MsgType.ERROR,"smfclient.nlp.cannotFindPos",new String[]{"",String.join(",",hasReelPosList)}));
} }
else if(!pos.getStorageId().equals(storage.getId())){ else if(!pos.getStorageId().equals(storage.getId())){
String msg = "["+storage.getName()+"]未找到库位:"+String.join(",",hasReelPosList) ; String msg = "["+storage.getName()+"]未找到库位:"+String.join(",",hasReelPosList) ;
log.error(msg); log.error(msg);
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
WebSocketServer.sendMsg("",new SocketMsg(notifyUsers, msg, MsgType.ERROR,"smfclient.nlp.cannotFindPos",new String[]{storage.getName(),String.join(",",hasReelPosList)}));
} }
//如果库位有料,直接结束 //如果库位有料,直接结束
else if(pos.getBarcode()!=null) { else if(pos.getBarcode()!=null) {
log.info("料架[" + cid + "]入库库位[" + pos.getPosName() + "]已有料: [" + pos.getBarcode().getBarcode() + "]"); log.info("料架[" + cid + "]入库库位[" + pos.getPosName() + "]已有料: [" + pos.getBarcode().getBarcode() + "]");
} }
else{ else{
boolean posInResult = handlePosIn(storage,pos);
if(posInResult){
inOkList.add(pos.getPosName());
}else{
inNgList.add(pos.getPosName());
}
}
}
}
String[] noReelPosList = request.getParameterValues("noReelPosList");
if(noReelPosList != null){
//出库
log.info("出库检测noReelPosList");
for (String noReelPosName : noReelPosList) {
boolean handleNoReelPosResult = handleNoReelPos(storage,usedPosNameList,noReelPosName);
if(handleNoReelPosResult){
outOkList.add(noReelPosName);
}else{
outNgList.add(noReelPosName);
}
}
}
Map<String,List<String>> dataMap = new HashMap<>();
dataMap.put("inOkList",inOkList);
dataMap.put("inNgList",inNgList);
dataMap.put("outOkList",outOkList);
dataMap.put("outNgList",outNgList);
dataMap.put("ngToOk",ngToOk);
return ResultBean.newOkResult(dataMap);
}
}
/**
* 处理库位入库
* @param storage
* @param pos
* @return
*/
private boolean handlePosIn(Storage storage, StoragePos pos){
String groupId = storage.getGroupId();
if(groupId.equals("")){
groupId="-1";
}
Collection<DataLog> queueTasks = taskService.getQueueTasks(); Collection<DataLog> queueTasks = taskService.getQueueTasks();
for (DataLog queueTask : queueTasks) { for (DataLog queueTask : queueTasks) {
boolean isPutInTask=false; boolean isPutInTask=false;
...@@ -242,8 +273,9 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -242,8 +273,9 @@ public class NLPShelfHandler extends BaseDeviceHandler{
else if(queueTask.isPutInTask() && queueTask.getGroupId().equals(groupId)) { else if(queueTask.isPutInTask() && queueTask.getGroupId().equals(groupId)) {
isPutInTask = true; isPutInTask = true;
} }
boolean inResult = false;
if(isPutInTask) { if(isPutInTask) {
queueTask.setCid(cid); queueTask.setCid(storage.getCid());
queueTask.setPosId(pos.getId()); queueTask.setPosId(pos.getId());
queueTask.setPosName(pos.getPosName()); queueTask.setPosName(pos.getPosName());
queueTask.setStorageId(storage.getId()); queueTask.setStorageId(storage.getId());
...@@ -251,130 +283,102 @@ public class NLPShelfHandler extends BaseDeviceHandler{ ...@@ -251,130 +283,102 @@ public class NLPShelfHandler extends BaseDeviceHandler{
try { try {
//入库完成,发送入库完成请求 //入库完成,发送入库完成请求
log.info("入库完成,发送入库完成请求"); log.info("入库完成,发送入库完成请求");
super.finishedPutIn(cid, pos.getPosName()); super.finishedPutIn(storage.getCid(), pos.getPosName());
inOkList.add(hasReelPosList[0]);
String msg = queueTask.getBarcode() + "入库到" + pos.getPosName() + "成功"; String msg = queueTask.getBarcode() + "入库到" + pos.getPosName() + "成功";
log.info(msg); log.info(msg);
inResult = true;
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
WebSocketServer.sendMsg("",new SocketMsg(notifyUsers, msg, MsgType.INFO,"smfclient.nlp.inputOk",new String[]{queueTask.getBarcode(),pos.getPosName()}));
try { try {
//判断是否是入库单入库 //判断是否是入库单入库
if (queueTask.getInType() == 5) { if (queueTask.getInType() == 5) {
log.info("入库单入库"); log.info("入库单入库");
Barcode barcode = barcodeManager.findByBarcode(queueTask.getBarcode()); Barcode barcode = barcodeManager.findByBarcode(queueTask.getBarcode());
InListItem item = inListCache.UpdateInList(queueTask.getSourceName(), pos, barcode); InListItem item = inListCache.UpdateInList(queueTask.getSourceName(), pos, barcode);
if (item != null) { if (item != null) {
InList inList = inListCache.getInList(queueTask.getSourceName()); InList inList = inListCache.getInList(queueTask.getSourceName());
//入库完成,调用 7.2转储单入库过账接口 //入库完成,调用 7.2转储单入库过账接口
TransferOrderInInfo inInfo = new TransferOrderInInfo(inList.getName(), inList.getDocType(), queueTask.getBarcode(), item.getBaseCode(), item.getInLgort(), queueTask.getNum()); TransferOrderInInfo inInfo = new TransferOrderInInfo(inList.getName(), inList.getDocType(), queueTask.getBarcode(), item.getBaseCode(), item.getInLgort(), queueTask.getNum());
boolean result = HikApi.transferOrderInApi(queueTask.getOperator(), inInfo); HikApi.transferOrderInApi(queueTask.getOperator(), inInfo);
} }
} else { } else {
log.info("调用 7.5入库上架过账接口"); log.info("调用 7.5入库上架过账接口");
//入库完成,调用 7.5入库上架过账接口 //入库完成,调用 7.5入库上架过账接口
boolean result = HikApi.putInApi(queueTask.getOperator(), InOutApiInfo.inputInfo(queueTask.getInType(), queueTask.getBarcode(), queueTask.getNum())); HikApi.putInApi(queueTask.getOperator(), InOutApiInfo.inputInfo(queueTask.getInType(), queueTask.getBarcode(), queueTask.getNum()));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("入库完成接口处理报错:", e); log.error("入库完成接口处理报错:", e);
return ResultBean.newErrorResult(-1, "smfcore.inputError", "入库出错:{0}", new String[]{e.getMessage()});
} }
break;
} catch (Exception e) { } catch (Exception e) {
log.error("入库完成处理出错:", e); log.error("入库完成处理出错:", e);
return ResultBean.newErrorResult(-1, "smfcore.inputError", "入库出错:{0}", new String[]{e.getMessage()});
} }
return inResult;
} }
} }
if(inOkList.size() == 0){
inNgList.add(hasReelPosList[0]);
log.error("未找到["+pos.getPosName()+"]的入库任务"); log.error("未找到["+pos.getPosName()+"]的入库任务");
return false;
} }
}
}
}
if(noReelPosList != null){
//出库
log.info("出库检测noReelPosList"); /**
for (String posName : noReelPosList) { * 处理客户端发上来的无料库位
StoragePos pos = storagePosManager.getByPosName(posName); * @param storage
* @param usedPosNameList
* @param noReelPosName
* @return
*/
private boolean handleNoReelPos(Storage storage, List<String> usedPosNameList, String noReelPosName){
boolean handleResult = false;
if(!usedPosNameList.contains(noReelPosName)){
log.info("库位: "+noReelPosName+" 中数据库中已无物料信息,加入outOkList");
handleResult = true;
}else{
StoragePos pos = storagePosManager.getByPosName(noReelPosName);
if(pos==null){ if(pos==null){
log.info("sensorChange 未找到库位 noReelPosList ["+posName+"]"); log.error("sensorChange 未找到库位 noReelPosList ["+noReelPosName+"],加入outOkList");
continue; handleResult = true;
} }else{
if(!pos.isEnabled()){ if(!pos.isEnabled()){
continue; log.error("sensorChange noReelPosList ["+noReelPosName+"]已禁用,加入outOkList");
} handleResult = true;
if(pos == null){ }else if(!pos.getStorageId().equals(storage.getId())){
String msg = "未找到库位:"+String.join(",",hasReelPosList) ; String msg = "["+storage.getName()+"]未找到库位:"+ noReelPosName+",加入outOkList";
log.error(msg);
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
WebSocketServer.sendMsg("",new SocketMsg(notifyUsers, msg, MsgType.ERROR,"smfclient.nlp.cannotFindPos",new String[]{"",String.join(",",hasReelPosList)}));
}
else if(!pos.getStorageId().equals(storage.getId())){
String msg = "["+storage.getName()+"]未找到库位:"+String.join(",",hasReelPosList) ;
log.error(msg); log.error(msg);
handleResult = true;
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
WebSocketServer.sendMsg("",new SocketMsg(notifyUsers, msg, MsgType.ERROR,"smfclient.nlp.cannotFindPos",new String[]{storage.getName(),String.join(",",hasReelPosList)}));
}else if(pos.getBarcode()==null){ }else if(pos.getBarcode()==null){
log.info("料架[" + cid + "]出库库位[" + pos.getPosName() + "]已为空 "); log.info("库位: "+noReelPosName+" 数据库中已无物料信息,加入outOkList");
handleResult = true;
}else{ }else{
String outResult = "";
Collection<DataLog> queueTasks = taskService.getQueueTasks(); Collection<DataLog> queueTasks = taskService.getQueueTasks();
String outResult = "";
for (DataLog queueTask : queueTasks) { for (DataLog queueTask : queueTasks) {
if(queueTask.isCheckOutTask() && queueTask.getPosName().equals(posName)){ if(queueTask.isCheckOutTask() && queueTask.getPosName().equals(noReelPosName)){
//出库完成 //出库完成
try { try {
outResult = noReelPosName;
outResult = posName; super.finishedOutPos(storage.getCid(),noReelPosName);
super.finishedOutPos(cid,posName); String msg = queueTask.getBarcode()+ "从"+ noReelPosName+"出库成功";
String msg = queueTask.getBarcode()+ "从"+ posName+"出库成功,颜色["+queueTask.getLightColor()+"]";
log.info(msg); log.info(msg);
List<String> notifyUsers = userManager.findByDeviceGroupId(storage.getGroupId());
WebSocketServer.sendMsg("",new SocketMsg(notifyUsers, msg, MsgType.INFO,"smfclient.nlp.outputOk",new String[]{queueTask.getBarcode(),posName}));
break; break;
} catch (Exception e) { } catch (Exception e) {
log.error("出库出错",e); log.error("库位:" + noReelPosName+"出库出错",e);
return ResultBean.newErrorResult(-1,"smfcore.checkoutError","出库出错:{0}" ,new String[]{ e.getMessage()}); break;
} }
} }
} }
if(outResult.isEmpty()){ if(outResult.isEmpty()){
outNgList.add(posName); handleResult = false;
String msg = "未找到["+posName+"]的出库任务"; String msg = "未找到["+noReelPosName+"]的出库任务";
log.error(msg); log.error(msg);
//WebSocketServer.sendMsg("",new SocketMsg(msg, MsgType.ERROR,"smfclient.nlp.noOutTask",new String[]{posName,storage.getName()})); //WebSocketServer.sendMsg("",new SocketMsg(msg, MsgType.ERROR,"smfclient.nlp.noOutTask",new String[]{posName,storage.getName()}));
}else{ }else{
outOkList.add(outResult); handleResult = true;
} }
} }
} }
} }
return handleResult;
Map<String,List<String>> dataMap = new HashMap<>();
dataMap.put("inOkList",inOkList);
dataMap.put("inNgList",inNgList);
dataMap.put("outOkList",outOkList);
dataMap.put("outNgList",outNgList);
dataMap.put("ngToOk",ngToOk);
return ResultBean.newOkResult(dataMap);
} }
/** /**
* 获取料架的库位占用及出库任务 * 获取料架的库位占用及出库任务
*/ */
......
...@@ -394,6 +394,7 @@ public class DeviceController { ...@@ -394,6 +394,7 @@ public class DeviceController {
} }
pos.setEnabled(false); pos.setEnabled(false);
storagePosManager.save(pos); storagePosManager.save(pos);
dataCache.updateDisablePos(pos);
log.info("屏蔽库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]barcode[" + barcode + "]"); log.info("屏蔽库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]barcode[" + barcode + "]");
DeviceMessageUtil.addEnabledPosMessage(pos,""); DeviceMessageUtil.addEnabledPosMessage(pos,"");
......
...@@ -64,6 +64,11 @@ public class DataCache { ...@@ -64,6 +64,11 @@ public class DataCache {
* 库位占用Map, key为cid,value为已使用的库位列表 * 库位占用Map, key为cid,value为已使用的库位列表
*/ */
private static Map<String, List<String>> usedPosNameMap = new ConcurrentHashMap<>(); private static Map<String, List<String>> usedPosNameMap = new ConcurrentHashMap<>();
/**
* 禁用库位名称列表
*/
private static Set<String> disabledPosNameSet;
/** /**
* 所有的料仓 key 为 cid, value 为 Storage * 所有的料仓 key 为 cid, value 为 Storage
*/ */
...@@ -470,6 +475,39 @@ public class DataCache { ...@@ -470,6 +475,39 @@ public class DataCache {
return storageInventory; return storageInventory;
} }
/**
* 获取禁用库位缓存
*/
public Set<String> getDisabledPosNameSet(){
initDisabledPosNameSet();
return disabledPosNameSet;
}
/**
* 初始化禁用库位缓存
*/
private synchronized void initDisabledPosNameSet(){
if(disabledPosNameSet == null){
disabledPosNameSet = new HashSet<>();
List<StoragePos> disabledPosList = storagePosManager.findDisabled();
for (StoragePos disabledPos : disabledPosList) {
disabledPosNameSet.add(disabledPos.getPosName());
}
log.info("加载禁用库位缓存,共" + disabledPosNameSet.size() + "个");
}
}
/**
* 更新禁用库位缓存
*/
public void updateDisablePos(StoragePos pos){
initDisabledPosNameSet();
if(pos.isEnabled()){
disabledPosNameSet.remove(pos.getPosName());
}else{
disabledPosNameSet.add(pos.getPosName());
}
}
/** /**
* 出库时清除使用库位列表 * 出库时清除使用库位列表
...@@ -492,9 +530,9 @@ public class DataCache { ...@@ -492,9 +530,9 @@ public class DataCache {
/** /**
* 获取设备所有占用的库位名称列表 * 获取设备所有占用的库位名称列表
*/ */
public List<String> getUsedPosNameList(String cid) { public synchronized List<String> getUsedPosNameList(String cid) {
if(cid == null){ if(cid == null || cid.isEmpty()){
cid = ""; return new ArrayList<>();
} }
List<String> posNameList = usedPosNameMap.get(cid); List<String> posNameList = usedPosNameMap.get(cid);
if (posNameList == null) { if (posNameList == null) {
......
...@@ -183,13 +183,14 @@ public class SingleInController { ...@@ -183,13 +183,14 @@ public class SingleInController {
if (ObjectUtils.isEmpty(code)) { if (ObjectUtils.isEmpty(code)) {
throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"}); throw new ValidateException("smfcore.valueCanotNull", "{0}不能为空", new String[]{"code"});
} }
Storage storage = storageManager.get(storageId); Storage storage = dataCache.getStorageById(storageId);
if (storage == null) { if (storage == null) {
return ResultBean.newErrorResult(-1, "smfcore.shelfNotExist", "{0}对应的料架不存在", new String[]{storageId}); return ResultBean.newErrorResult(-1, "smfcore.shelfNotExist", "{0}对应的料架不存在", new String[]{storageId});
} }
// log.info("codeInProcess , code["+code+"],storageId["+storageId+"]开始验证是否有未结束的任务"); synchronized (storage){
// log.info("codeInProcess , code["+code+"],storageId["+storageId+"]开始验证是否有未结束的任务");
// WebSocketServer.sendMsg("", new SocketMsg("{0}未找到库位:{1}"+code, MsgType.INFO,"smfclient.nlp.cannotFindPos",new String[]{"消息测试","库位号"})); // WebSocketServer.sendMsg("", new SocketMsg("{0}未找到库位:{1}"+code, MsgType.INFO,"smfclient.nlp.cannotFindPos",new String[]{"消息测试","库位号"}));
String loginUser = SecurityUtils.getLoginUsername(); String loginUser = SecurityUtils.getLoginUsername();
Collection<DataLog> queueTasks = taskService.getQueueTasks(); Collection<DataLog> queueTasks = taskService.getQueueTasks();
...@@ -198,8 +199,10 @@ public class SingleInController { ...@@ -198,8 +199,10 @@ public class SingleInController {
// log.info("------codeInProcess queueTask="+ JsonUtil.toJsonStr(queueTask)); // log.info("------codeInProcess queueTask="+ JsonUtil.toJsonStr(queueTask));
if (queueTask.isPutInTask() &&(queueTask.isWait()||queueTask.isExecuting()) ) { if (queueTask.isPutInTask() &&(queueTask.isWait()||queueTask.isExecuting()) ) {
if (!Strings.isNullOrEmpty(storageId) && queueTask.getStorageId().equals(storageId)) { if (!Strings.isNullOrEmpty(storageId) && queueTask.getStorageId().equals(storageId)) {
log.info("codeIn [" + code + "][" + storageId + "]入库失败:条码[" + queueTask.getBarcode() + "]的任务还未结束 "); log.warn("扫描条码["+code+"]时取消物料["+queueTask.getBarcode()+"]未完成的入库任务");
throw new ValidateException("smfcore.unfinished", "the task of [{0}] is unfinished", new String[]{queueTask.getBarcode()}); taskService.cancelTask(queueTask.getId());
// log.info("codeIn [" + code + "][" + storageId + "]入库失败:条码[" + queueTask.getBarcode() + "]的任务还未结束 ");
// throw new ValidateException("smfcore.unfinished", "the task of [{0}] is unfinished", new String[]{queueTask.getBarcode()});
} }
} }
} }
...@@ -212,19 +215,8 @@ public class SingleInController { ...@@ -212,19 +215,8 @@ public class SingleInController {
} }
for (DataLog queueTask : queueTasks) { for (DataLog queueTask : queueTasks) {
if (queueTask.getBarcode()!=null&&queueTask.getBarcode().equals(barcode.getBarcode())) { if (queueTask.getBarcode()!=null&&queueTask.getBarcode().equals(barcode.getBarcode())) {
log.info("codeIn [" + code + "][" + storageId + "]入库失败:条码[" + queueTask.getBarcode() + "]在料仓["+queueTask.getStorageName()+"]已有入库任务 "); log.warn("扫描条码["+code+"]时取消["+queueTask.getBarcode()+"]未完成的入库任务");
throw new ValidateException("smfcore.barcode.unfinished", "条码["+queueTask.getBarcode()+"]在料仓["+queueTask.getStorageName()+"]已有入库任务", taskService.cancelTask(queueTask.getId());
new String[]{queueTask.getBarcode(),queueTask.getStorageName()});
}
}
//判断料架是否有空位
for (UsageItem item : storage.getUsageMap().values()) {
if (item.getH() == barcode.getHeight() && item.getW() == barcode.getPlateSize()) {
int emptyCount = item.getTotalCount() - item.getUsedCount();
if(emptyCount<=0){
log.info("codeIn [" + code + "][" + storageId + "]入库失败:"+barcode.getPlateSize()+"X"+barcode.getHeight()+"未找到可用库位 ");
throw new ValidateException("smfcore.noValidPos", "未找到可用仓位");
}
} }
} }
...@@ -340,6 +332,8 @@ public class SingleInController { ...@@ -340,6 +332,8 @@ public class SingleInController {
return ResultBean.newOkResult(""); return ResultBean.newOkResult("");
} }
}
@ApiOperation("扫码料架功能") @ApiOperation("扫码料架功能")
@PostMapping("/shelfCode") @PostMapping("/shelfCode")
......
...@@ -215,6 +215,7 @@ public class StoragePosController { ...@@ -215,6 +215,7 @@ public class StoragePosController {
} }
pos.setEnabled(enabledDto.isEnabled()); pos.setEnabled(enabledDto.isEnabled());
storagePosManager.save(pos); storagePosManager.save(pos);
dataCache.updateDisablePos(pos);
log.info("启用禁用库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled()); log.info("启用禁用库位:库位号[" + pos.getId() + "][" + pos.getPosName() + "]=" + enabledDto.isEnabled());
DeviceMessageUtil.addEnabledPosMessage(pos,SecurityUtils.getCurrentUsername()); DeviceMessageUtil.addEnabledPosMessage(pos,SecurityUtils.getCurrentUsername());
...@@ -244,6 +245,7 @@ public class StoragePosController { ...@@ -244,6 +245,7 @@ public class StoragePosController {
String enabledStr=""; String enabledStr="";
if(pos.isEnabled()!= saveDto.isEnabled()){ if(pos.isEnabled()!= saveDto.isEnabled()){
pos.setEnabled(saveDto.isEnabled()); pos.setEnabled(saveDto.isEnabled());
dataCache.updateDisablePos(pos);
enabledStr=saveDto.isEnabled()?",启用库位":",禁用库位"; enabledStr=saveDto.isEnabled()?",启用库位":",禁用库位";
DeviceMessageUtil.addEnabledPosMessage(pos,SecurityUtils.getCurrentUsername()); DeviceMessageUtil.addEnabledPosMessage(pos,SecurityUtils.getCurrentUsername());
} }
......
...@@ -43,6 +43,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> { ...@@ -43,6 +43,8 @@ public interface IStoragePosManager extends IBaseManager<StoragePos> {
List<StoragePos> findNotEmpty(); List<StoragePos> findNotEmpty();
List<StoragePos> findDisabled();
List<StoragePos> findByStorage(String storageId); List<StoragePos> findByStorage(String storageId);
void insertAll(List<StoragePos> posList); void insertAll(List<StoragePos> posList);
......
...@@ -7,10 +7,8 @@ import com.google.common.collect.Maps; ...@@ -7,10 +7,8 @@ import com.google.common.collect.Maps;
import com.neotel.smfcore.common.base.IExcelDownLoad; import com.neotel.smfcore.common.base.IExcelDownLoad;
import com.neotel.smfcore.common.bean.PageData; import com.neotel.smfcore.common.bean.PageData;
import com.neotel.smfcore.common.exception.ValidateException; import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.DateUtil;
import com.neotel.smfcore.common.utils.FileUtil; import com.neotel.smfcore.common.utils.FileUtil;
import com.neotel.smfcore.common.utils.PointUtil; import com.neotel.smfcore.common.utils.PointUtil;
import com.neotel.smfcore.common.utils.StringUtils;
import com.neotel.smfcore.core.barcode.bean.PlateSizeBean; import com.neotel.smfcore.core.barcode.bean.PlateSizeBean;
import com.neotel.smfcore.core.barcode.service.po.Barcode; import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.language.util.MessageUtils; import com.neotel.smfcore.core.language.util.MessageUtils;
...@@ -21,7 +19,6 @@ import com.neotel.smfcore.core.storage.service.dao.IStoragePosDao; ...@@ -21,7 +19,6 @@ import com.neotel.smfcore.core.storage.service.dao.IStoragePosDao;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager; import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage; import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos; import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.security.service.po.User;
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.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -415,6 +412,13 @@ public class StoragePosManagerImpl implements IStoragePosManager { ...@@ -415,6 +412,13 @@ public class StoragePosManagerImpl implements IStoragePosManager {
} }
@Override @Override
public List<StoragePos> findDisabled(){
Criteria c = Criteria.where("enabled").is(false);//不可用;
Query query = new Query(c);
return storagePosDao.findByQuery(query);
}
@Override
public List<StoragePos> findByStorage(String storageId) { public List<StoragePos> findByStorage(String storageId) {
return storagePosDao.findListByCondition(new String[]{"storageId" }, new String[]{storageId }); return storagePosDao.findListByCondition(new String[]{"storageId" }, new String[]{storageId });
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!