Commit 444038d6 LN

客户端发送出库完成任务时若未找到任务,清空库位。

1 个父辈 547746f8
package com.neotel.smfcore.core.device.handler.impl;
import cn.hutool.core.util.ObjectUtil;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.ReelLockPosUtil;
import com.neotel.smfcore.common.utils.SecurityUtils;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.barcode.bean.CodeBean;
import com.neotel.smfcore.core.barcode.enums.COMPONENT_TYPE;
......@@ -515,10 +518,10 @@ public class BaseDeviceHandler implements IDeviceHandler {
protected void finishedOutPos(String cid, String posName,int executeTime) throws ValidateException {
DataLog task = taskService.findExecutingTask(cid, posName);
if (task != null && task.isCheckOutTask()) {
if(executeTime>0){
if (executeTime > 0) {
task.setExecuteTime(executeTime);
}
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,执行时间["+executeTime+"]秒");
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,执行时间[" + executeTime + "]秒");
DataLog cancelTask = taskService.findFinishedTask(cid, posName);
if (cancelTask != null && cancelTask.isCancel()) {
//将相同库位已经取消的任务从完成队列里删除
......@@ -532,17 +535,30 @@ public class BaseDeviceHandler implements IDeviceHandler {
task = taskService.findFinishedTask(cid, posName);
if (task != null && task.isCheckOutTask()) {
if (task.isCancel()) {//被取消的任务,客户端发完成信号过来,修改取消状态为已完成
if(executeTime>0){
if (executeTime > 0) {
task.setExecuteTime(executeTime);
}
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间["+executeTime+"]秒");
log.info(task.getBarcode() + "出仓位[" + task.getPosName() + "]完成,但任务已被取消,修改为完成,执行时间[" + executeTime + "]秒");
updateCheckoutData(task);
}
} else {
StoragePos storagePos = storagePosManager.getByPosName(posName);
if (storagePos != null && storagePos.isUsed()) {
String barcode = storagePos.getBarcode().getBarcode();
//查找库位是否为空,如果库位有料,调用清理手动出库的方法清理库存
if (ObjectUtil.isNotEmpty(barcode)) {
log.info(cid + "出仓位[" + posName + "]完成时任务不存在,清理库位中的库存[" + barcode + "]");
taskService.addTaskToFinished(storagePos, null, cid + "-clear");
}else{
log.info(cid + "出仓位[" + posName + "]完成时任务不存在,清理库位失败,条码为空");
}
} else {
log.warn(cid + "出仓位[" + posName + "]完成时任务不存在");
}
}
}
}
/**
* 入库完成时,更新库位的最小入库时间
* @param posId
......
......@@ -274,7 +274,7 @@ public class DataLog extends BasePo implements Serializable {
*/
public boolean needRemoveFromCache(){
if(isFinished() || isCancel()){
if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 3 * 60 * 1000){
if(System.currentTimeMillis() - super.getUpdateDate().getTime() > 5 * 60 * 1000){
return true;
}
}
......
......@@ -207,6 +207,7 @@ public class TaskService {
//从正在执行和等待列表中移除
removeQueueTask(task);
task.setStatus(OP_STATUS.CANCEL.name());
task.setUpdateDate(new Date());
updateFinishedTask(task);
log.info("任务[" + task.getId() + "] posName[" + task.getPosName() + "] Reel Id[" + task.getBarcode() + "]取消成功");
return true;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!