Commit e36133a6 LN

分配库位处理

1 个父辈 42a61a02
package com.neotel.smfcore.common.utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import org.apache.logging.log4j.LogManager;
......@@ -25,15 +26,15 @@ public class ReelLockPosUtil {
/**
* 料盘锁定库位信息,用于包装料分配到其他料仓
*/
private static Map<String, ReelLockPosInfo> reelLocKPosMap;
private static Map<String, ReelLockPosInfo> reelLocKPosMap = Maps.newConcurrentMap();
@PostConstruct
public void init() {
dataCache = autodataCache;
reelLocKPosMap=dataCache.getCache(REEL_LOCK_POS_MAP_KEY);
if(reelLocKPosMap==null){
reelLocKPosMap=new HashMap<String,ReelLockPosInfo>(){};
Map<String, ReelLockPosInfo> cacheReelLocKPosMap = dataCache.getCache(REEL_LOCK_POS_MAP_KEY);
if (cacheReelLocKPosMap != null) {
reelLocKPosMap.putAll(cacheReelLocKPosMap);
}
}
......
......@@ -5,6 +5,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mks.api.response.APIException;
import com.neotel.smfcore.common.bean.ReelLockPosInfo;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ApiException;
import com.neotel.smfcore.common.exception.ValidateException;
......@@ -332,6 +333,7 @@ public class RobotBoxHandler extends BaseDeviceHandler {
//返回 105=查找空库位失败
//返回 106=唯一码已有入库任务
//返回 107=物料已过期,无法入库
//返回 108=库位被锁定,暂停入库,重新获取库位号
//返回108=已有待完成的出入库任务,直接NG
//返回110=接口验证失败,需要去XRay重新点料
......@@ -628,7 +630,39 @@ public class RobotBoxHandler extends BaseDeviceHandler {
// }
// }
// }
ReelLockPosInfo oldLockInfo = ReelLockPosUtil.getLockPosInfoByCode(barcode.getBarcode());
if (oldLockInfo != null) {
if (!oldLockInfo.getBarcode().equals(barcode.getBarcode())) {
// String result = "-1";
// okMsg = rfid + " [" + barcode.getBarcode() + "]锁定库位[" + pos.getPosName() + "],清理旧有锁定信息";
// resultMap.put("result", result);
// resultMap.put("msg", okMsg);
//已经锁定过库位,但不是同一个条码,需要把对应位置的锁定信息清理掉
ReelLockPosUtil.removeReelLockPosInfo(oldLockInfo.getBarcode());
log.info("清理锁定库位:库位号[" + oldLockInfo.getLockPosName() + "]上物料[" + oldLockInfo.getBarcode() + "]锁定的库位");
}
}
log.info(okMsg + oldLockInfo);
ReelLockPosInfo reelLocInfo = new ReelLockPosInfo();
reelLocInfo.setBarcode(barcode.getBarcode());
reelLocInfo.setCid(storage.getCid());
reelLocInfo.setLockPosName(pos.getPosName());
reelLocInfo.setLockPosId(pos.getId());
reelLocInfo = ReelLockPosUtil.addReelLockPosInfo(reelLocInfo, cidList);
if (reelLocInfo == null) {
errorMsg = "[" + barcode.getBarcode() + "]库位["+reelLocInfo.getLockPosName()+"]已被锁定,暂停入库";
lineMsg = errorMsg;
DeviceMessageUtil.updateLineMsg(lineMsg,code,cids, reelLocInfo.getLockPosName(),"smfcore.linemsg.posLock",new String[]{barcode.getBarcode(),reelLocInfo.getLockPosName()});
resultMap.put("result", "107");
resultMap.put("msg", errorMsg);
return resultMap;
}
resultMap.put("result", "0");
resultMap.put("msg", "ok");
DataLog newTask = taskService.addPutInTaskToExecute(storage, barcode, pos);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!