物流状态更新

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

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

Loading…
Cancel
Save