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