物流状态更新

liweidong
liweidong-hj 5 days ago
parent c82d2f4606
commit 213a3404b2
  1. 115
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/PipelineServiceImpl.java
  2. 20
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/TaskExecuteRecordServiceImpl.java

@ -210,21 +210,24 @@ public class PipelineServiceImpl implements IPipelineService {
log.error("AGV调度失败,boxBarcode:{},station:{}",
boxBarcode, station.getStationCode());
return false;
}else {
log.info("AGV调度成功,boxBarcode:{},station:{}",
boxBarcode, station.getStationCode());
}
// 7. 更新任务状态
task.setTaskStatus(Task.STATUS_FINISHED);
boolean taskUpdate = taskService.updateById(task);
if (!taskUpdate) {
log.error("任务状态更新失败,但AGV调度已成功,taskId:{}", task.getId());
}
// // 7. 更新任务状态
// task.setTaskStatus(Task.STATUS_FINISHED);
// boolean taskUpdate = taskService.updateById(task);
// if (!taskUpdate) {
// log.error("任务状态更新失败,但AGV调度已成功,taskId:{}", task.getId());
// }
// 8. 更新站点状态为占用
station.setStationStatus(Station.STATUS_OCCUPIED);
boolean stationUpdate = stationService.updateById(station);
if (!stationUpdate) {
log.error("站点状态更新失败,但AGV调度已成功,stationId:{}", stationId);
}
// station.setStationStatus(Station.STATUS_OCCUPIED);
// boolean stationUpdate = stationService.updateById(station);
// if (!stationUpdate) {
// log.error("站点状态更新失败,但AGV调度已成功,stationId:{}", stationId);
// }
log.info("预占站点处理成功,boxBarcode:{},station:{}", boxBarcode, station.getStationCode());
@ -237,51 +240,51 @@ public class PipelineServiceImpl implements IPipelineService {
*/
private boolean handleNoPreOccupiedStation(Task task) {
// 查找空闲站点
Long wcId = task.getWcId();
if (null != wcId) {
// 尝试找空闲站点
Station station = findFreeStationCode(wcId);
if (null != station) {
log.info("找到空闲站点:{},将物料箱送往该站点", station.getStationCode());
//将站点设置为预占
station.setStationStatus(Station.PRE_STATUS_OCCUPIED);
stationService.updateById(station);
String taskType = agvTaskTypeUtil.getTaskTypeByPositions(Station.PICKUP_CONVEYOR_LINE,station.getStationCode());
if (StringUtils.isEmpty(taskType)) {
log.error("生成任务类型失败,from:{},to:{}",
Station.PICKUP_CONVEYOR_LINE, station.getStationCode());
return false;
}
boolean agvSchedulingTask = iTaskExecuteRecordService.genAgvSchedulingTask
(taskType, Station.PICKUP_CONVEYOR_LINE, station.getStationCode(), AgvConstant.EQUIPMENT_TYPE_AGV, task);
if (!agvSchedulingTask) {
log.error("AGV调度失败,station:{}", station.getStationCode());
return false;
}
// 更新任务状态
task.setTaskStatus(Task.STATUS_FINISHED);
boolean taskUpdate = taskService.updateById(task);
if (!taskUpdate) {
log.error("任务状态更新失败,但AGV调度已成功,taskId:{}", task.getId());
}
// 更新站点状态为占用
station.setStationStatus(Station.STATUS_OCCUPIED);
boolean stationUpdate = stationService.updateById(station);
if (!stationUpdate) {
log.error("站点状态更新失败,但AGV调度已成功,stationId:{}", station.getId());
}
log.info("预占站点处理成功,station:{}", station.getStationCode());
return agvSchedulingTask;
}
}
// Long wcId = task.getWcId();
//
// if (null != wcId) {
// // 尝试找空闲站点
// Station station = findFreeStationCode(wcId);
// if (null != station) {
// log.info("找到空闲站点:{},将物料箱送往该站点", station.getStationCode());
// //将站点设置为预占
// station.setStationStatus(Station.PRE_STATUS_OCCUPIED);
// stationService.updateById(station);
//
// String taskType = agvTaskTypeUtil.getTaskTypeByPositions(Station.PICKUP_CONVEYOR_LINE,station.getStationCode());
// if (StringUtils.isEmpty(taskType)) {
// log.error("生成任务类型失败,from:{},to:{}",
// Station.PICKUP_CONVEYOR_LINE, station.getStationCode());
// return false;
// }
//
// boolean agvSchedulingTask = iTaskExecuteRecordService.genAgvSchedulingTask
// (taskType, Station.PICKUP_CONVEYOR_LINE, station.getStationCode(), AgvConstant.EQUIPMENT_TYPE_AGV, task);
//
// if (!agvSchedulingTask) {
// log.error("AGV调度失败,station:{}", station.getStationCode());
// return false;
// }
//
// // 更新任务状态
// task.setTaskStatus(Task.STATUS_FINISHED);
// boolean taskUpdate = taskService.updateById(task);
// if (!taskUpdate) {
// log.error("任务状态更新失败,但AGV调度已成功,taskId:{}", task.getId());
// }
//
// // 更新站点状态为占用
// station.setStationStatus(Station.STATUS_OCCUPIED);
// boolean stationUpdate = stationService.updateById(station);
// if (!stationUpdate) {
// log.error("站点状态更新失败,但AGV调度已成功,stationId:{}", station.getId());
// }
//
// log.info("预占站点处理成功,station:{}", station.getStationCode());
//
// return agvSchedulingTask;
// }
// }
// 没有空闲站点,走库位逻辑
log.info("无空闲站点,尝试将物料箱移入库位");

@ -501,7 +501,7 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec
if (boxBarcode != null && !boxBarcode.trim().isEmpty()) {
BoxBindingDto boxBindingDto = new BoxBindingDto();
boxBindingDto.setBoxBarcode(boxBarcode);
// R ret = iOrderBindService.boxUnbind(boxBindingDto);
R ret = iOrderBindService.boxUnbind(boxBindingDto);
}
if (taskUpdate) {
@ -728,11 +728,11 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec
}
// 更新站点状态为占用
station.setStationStatus(Station.STATUS_OCCUPIED);
boolean stationUpdate = stationService.updateById(station);
if (!stationUpdate) {
log.error("站点状态更新失败,但AGV调度已成功,stationId:{}", station.getId());
}
// station.setStationStatus(Station.STATUS_OCCUPIED);
// boolean stationUpdate = stationService.updateById(station);
// if (!stationUpdate) {
// log.error("站点状态更新失败,但AGV调度已成功,stationId:{}", station.getId());
// }
location.setLocationStatus(Location.STATUS_FREE);
boolean locationUpdate = locationService.updateById(location);
@ -865,10 +865,14 @@ public class TaskExecuteRecordServiceImpl extends BaseServiceImpl<TaskExecuteRec
}
private String extractShelfCodeFromMessage(String message) {
if (message == null || !message.contains(":")) {
if (message == null) {
return null;
}
int lastColonIndex = Math.max(message.lastIndexOf(":"), message.lastIndexOf(":"));
if (lastColonIndex == -1) {
return null;
}
return message.substring(message.lastIndexOf(":") + 1).trim();
return message.substring(lastColonIndex + 1).trim();
}
}

Loading…
Cancel
Save