Commit 4a07258e zshaohui

缓存上一次请求信息

1 个父辈 53e27817
......@@ -1202,7 +1202,7 @@ public class CDeviceController {
}
public static Map<String,String> lastOutBarcodeMap = Maps.newConcurrentMap();
public static Map<String, String> lastSeqMap = Maps.newConcurrentMap();
@ApiOperation("物料出库(新接口)")
@RequestMapping("/reelFromBox")
......@@ -1213,30 +1213,26 @@ public class CDeviceController {
String code = paramMap.get("code"); //条码编号
String currentLoc = paramMap.get("currentLoc"); //当前位置
String stacker = paramMap.get("stacker");//条码编号
String requestSeq = paramMap.get("seq");
log.info("物料放到料串上,通知出库,隔口号为:" + boxPar + ",条码信息为:" + code + "当前位置为:" + currentLoc + "条码编号为:" + stacker);
log.info("物料放到料串上,通知出库,隔口号为:" + boxPar + ",条码信息为:" + code + "当前位置为:" + currentLoc + "条码编号为:" + stacker+",请求id为:"+requestSeq);
String lastOutBarcode = lastOutBarcodeMap.get(boxPar);
if (StringUtils.isEmpty(lastOutBarcode)){
if (StringUtils.isEmpty(code)){
lastOutBarcodeMap.put(boxPar,"noCode");
}else {
lastOutBarcodeMap.put(boxPar,code);
}
} else {
if (StringUtils.isEmpty(code)){
if (lastOutBarcode.equals("noCode")){
log.info(boxPar+"上一次没扫到条码,与当前传入的一致,直接返回ok");
return ResultBean.newOkResult(new HashMap<>());
}
}else {
if (lastOutBarcode.equals(code)) {
log.info(boxPar+"上一次扫到的为:"+lastOutBarcode+",与当前传入的条码:"+code+"一致,直接返回ok");
return ResultBean.newOkResult(new HashMap<>());
//如果顺序相同,直返返回ok
if (StringUtils.isNotEmpty(requestSeq)) {
String lastSeq = lastSeqMap.get(boxPar);
if (StringUtils.isNotEmpty(lastSeq)) {
if (lastSeq.equals(requestSeq)) {
log.info(boxPar+"与上一次请求的序列号:"+requestSeq+"相同,直接返回ok");
return ResultBean.newOkResult("");
} else {
lastSeqMap.put(boxPar, requestSeq);
}
} else {
lastSeqMap.put(boxPar,requestSeq);
}
}
Barcode alearyOutBarcode = null;
try {
if (StringUtils.isEmpty(code)) {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!