代码更新:
1. 修改入库选择库位的逻辑
This commit is contained in:
parent
0808951a4e
commit
baa94e47ea
|
|
@ -47,6 +47,10 @@ public class JobComponent {
|
||||||
*/
|
*/
|
||||||
private final IWorkService workService;
|
private final IWorkService workService;
|
||||||
|
|
||||||
|
private boolean isSendingCommonTask = false;
|
||||||
|
private boolean isSendingPickOutTask = false;
|
||||||
|
private boolean isSendingPickTask = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 向Wcs下发任务
|
* 向Wcs下发任务
|
||||||
* 每2秒执行一次
|
* 每2秒执行一次
|
||||||
|
|
@ -55,16 +59,24 @@ public class JobComponent {
|
||||||
@Async("myThreadPool")
|
@Async("myThreadPool")
|
||||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
public void sendCommonTasks() {
|
public void sendCommonTasks() {
|
||||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
if (isSendingCommonTask) {
|
||||||
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
// 正在执行下发任务操作
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
isSendingCommonTask = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
||||||
|
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 发送正常任务
|
// 发送正常任务
|
||||||
wmsJobService.sendCommonTasks();
|
wmsJobService.sendCommonTasks();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
} finally {
|
||||||
|
isSendingCommonTask = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,16 +88,23 @@ public class JobComponent {
|
||||||
@Async("myThreadPool")
|
@Async("myThreadPool")
|
||||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
public void sendPickOutTasks() {
|
public void sendPickOutTasks() {
|
||||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_PICK_OUT_TASK.getConfigKey());
|
if (isSendingPickOutTask) {
|
||||||
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
isSendingPickOutTask = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_PICK_OUT_TASK.getConfigKey());
|
||||||
|
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 发送站台拣选出库任务
|
// 发送站台拣选出库任务
|
||||||
wmsJobService.sendPickOutTasks();
|
wmsJobService.sendPickOutTasks();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
} finally {
|
||||||
|
isSendingPickOutTask = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,16 +116,23 @@ public class JobComponent {
|
||||||
@Async("myThreadPool")
|
@Async("myThreadPool")
|
||||||
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED)
|
||||||
public void sendPickTasks() {
|
public void sendPickTasks() {
|
||||||
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
if (isSendingPickTask) {
|
||||||
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
isSendingPickTask = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
String sendTask = configMap.get(ConfigMapKeyEnum.SEND_TASK.getConfigKey());
|
||||||
|
if (StringUtils.isEmpty(sendTask) || !sendTask.equals("1")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 发送拣选任务
|
// 发送拣选任务
|
||||||
wmsJobService.sendPickTasks();
|
wmsJobService.sendPickTasks();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 回滚事务
|
// 回滚事务
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
} finally {
|
||||||
|
isSendingPickTask = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.wms.constants.enums.StockStatus;
|
import com.wms.constants.enums.StockStatus;
|
||||||
import com.wms.constants.enums.TaskType;
|
import com.wms.constants.enums.TaskType;
|
||||||
|
import com.wms.constants.enums.WmsTaskStatus;
|
||||||
import com.wms.entity.table.Location;
|
import com.wms.entity.table.Location;
|
||||||
import com.wms.entity.table.Stand;
|
import com.wms.entity.table.Stand;
|
||||||
import com.wms.entity.table.Stock;
|
import com.wms.entity.table.Stock;
|
||||||
|
|
@ -76,9 +77,10 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
||||||
List<Stand> stackerList = standMapper.selectList(new LambdaQueryWrapper<Stand>()
|
List<Stand> stackerList = standMapper.selectList(new LambdaQueryWrapper<Stand>()
|
||||||
.eq(Stand::getIsLock, 0).eq(Stand::getStandStatus, 0)
|
.eq(Stand::getIsLock, 0).eq(Stand::getStandStatus, 0)
|
||||||
.eq(Stand::getStandType, 3));
|
.eq(Stand::getStandType, 3));
|
||||||
// 查出所有的正在执行的拣选出库的任务
|
// 查出所有的入库任务
|
||||||
List<Task> stackRunningTasks = taskMapper.selectList(new LambdaQueryWrapper<Task>()
|
List<Task> stackRunningTasks = taskMapper.selectList(new LambdaQueryWrapper<Task>()
|
||||||
.eq(Task::getTaskType, TaskType.IN.getCode()));
|
.eq(Task::getTaskType, TaskType.IN.getCode())
|
||||||
|
.ge(Task::getTaskStatus, WmsTaskStatus.NEW.getCode()));
|
||||||
Map<Integer, Integer> runningTaskNumToEquipmentMap = new HashMap<>();
|
Map<Integer, Integer> runningTaskNumToEquipmentMap = new HashMap<>();
|
||||||
for (Stand stacker : stackerList) {
|
for (Stand stacker : stackerList) {
|
||||||
// 找这台堆垛机正在执行的拣选出库任务数量
|
// 找这台堆垛机正在执行的拣选出库任务数量
|
||||||
|
|
@ -86,8 +88,8 @@ public class LocationServiceImplements extends ServiceImpl<LocationMapper, Locat
|
||||||
}
|
}
|
||||||
// 生成堆垛机的任务数量映射
|
// 生成堆垛机的任务数量映射
|
||||||
for (Task tempStackRunningTask : stackRunningTasks) {
|
for (Task tempStackRunningTask : stackRunningTasks) {
|
||||||
if (instantLocationMap.containsKey(tempStackRunningTask.getOrigin())) {
|
if (instantLocationMap.containsKey(tempStackRunningTask.getDestination())) {
|
||||||
int key = instantLocationMap.get(tempStackRunningTask.getOrigin()).getEquipmentId();
|
int key = instantLocationMap.get(tempStackRunningTask.getDestination()).getEquipmentId();
|
||||||
if (runningTaskNumToEquipmentMap.isEmpty()) {
|
if (runningTaskNumToEquipmentMap.isEmpty()) {
|
||||||
// 没有可用堆垛机
|
// 没有可用堆垛机
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user