|
|
|
@ -140,6 +140,9 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
log.warn("箱绑定参数为空或箱条码缺失"); |
|
|
|
log.warn("箱绑定参数为空或箱条码缺失"); |
|
|
|
return R.fail("箱条码不能为空"); |
|
|
|
return R.fail("箱条码不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (boxBinding.getOrderIdList()==null||boxBinding.getOrderIdList().isEmpty()) { |
|
|
|
|
|
|
|
return R.fail("订单不能为空"); |
|
|
|
|
|
|
|
} |
|
|
|
String boxBarcode = boxBinding.getBoxBarcode(); |
|
|
|
String boxBarcode = boxBinding.getBoxBarcode(); |
|
|
|
|
|
|
|
|
|
|
|
// 2. 校验箱条码是否存在运行中的任务(避免重复绑定)
|
|
|
|
// 2. 校验箱条码是否存在运行中的任务(避免重复绑定)
|
|
|
|
@ -177,6 +180,9 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private R saveOrderBindingList(String boxBarcode, ArrayList<Long> orderIdList) { |
|
|
|
private R saveOrderBindingList(String boxBarcode, ArrayList<Long> orderIdList) { |
|
|
|
ArrayList<OrderBind> orderBindList = new ArrayList<>(); |
|
|
|
ArrayList<OrderBind> orderBindList = new ArrayList<>(); |
|
|
|
|
|
|
|
if (orderIdList.isEmpty()) { |
|
|
|
|
|
|
|
return R.fail("订单id不能为空"); |
|
|
|
|
|
|
|
} |
|
|
|
// 构建订单绑定记录
|
|
|
|
// 构建订单绑定记录
|
|
|
|
for (Long orderId : orderIdList) { |
|
|
|
for (Long orderId : orderIdList) { |
|
|
|
OrderBind orderBind = new OrderBind(); |
|
|
|
OrderBind orderBind = new OrderBind(); |
|
|
|
@ -220,7 +226,6 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
BsWorkCenterVO bsWorkCenterVO = new BsWorkCenterVO(); |
|
|
|
BsWorkCenterVO bsWorkCenterVO = new BsWorkCenterVO(); |
|
|
|
bsWorkCenterVO.setId(0l); |
|
|
|
bsWorkCenterVO.setId(0l); |
|
|
|
bsWorkCenterVO.setWcName(DROPOFF_CONVEYOR_LINE_NAME); |
|
|
|
bsWorkCenterVO.setWcName(DROPOFF_CONVEYOR_LINE_NAME); |
|
|
|
bsWorkCenterVOList.add(bsWorkCenterVO); |
|
|
|
|
|
|
|
if (!stationList.isEmpty()) { |
|
|
|
if (!stationList.isEmpty()) { |
|
|
|
List<Long> list = stationList.stream().map(Station::getWcId).distinct().collect(Collectors.toList()); |
|
|
|
List<Long> list = stationList.stream().map(Station::getWcId).distinct().collect(Collectors.toList()); |
|
|
|
List<BsWorkCenterVO> bwList = bsWorkCenterService.getByIds(list); |
|
|
|
List<BsWorkCenterVO> bwList = bsWorkCenterService.getByIds(list); |
|
|
|
@ -234,17 +239,6 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
return R.data(bsWorkCenterVOList); |
|
|
|
return R.data(bsWorkCenterVOList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R getBSWORKCENTER() { |
|
|
|
|
|
|
|
List<Station> stationList = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getStationStatus, STATUS_FREE)); |
|
|
|
|
|
|
|
if (!stationList.isEmpty()) { |
|
|
|
|
|
|
|
List<Long> list = stationList.stream().map(Station::getWcId).distinct().collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<BsWorkCenterVO> bwList = bsWorkCenterService.getByIds(list); |
|
|
|
|
|
|
|
return R.data(bwList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R receive(String stationCode) { |
|
|
|
public R receive(String stationCode) { |
|
|
|
@ -304,6 +298,7 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
} |
|
|
|
} |
|
|
|
// 6. 完善任务信息并保存
|
|
|
|
// 6. 完善任务信息并保存
|
|
|
|
task = (Task) locationResult.getData(); |
|
|
|
task = (Task) locationResult.getData(); |
|
|
|
|
|
|
|
log.info("task:"+task.toString()); |
|
|
|
if (task.getStationId()==null&&agvSend) { |
|
|
|
if (task.getStationId()==null&&agvSend) { |
|
|
|
List<Location> locationList = iLocationService.list(new LambdaQueryWrapper<Location>().eq(Location::getId, task.getLocationId())); |
|
|
|
List<Location> locationList = iLocationService.list(new LambdaQueryWrapper<Location>().eq(Location::getId, task.getLocationId())); |
|
|
|
if (!CollectionUtils.isEmpty(locationList)) { |
|
|
|
if (!CollectionUtils.isEmpty(locationList)) { |
|
|
|
@ -347,6 +342,7 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
if (agvResult) { |
|
|
|
if (agvResult) { |
|
|
|
return R.success(); |
|
|
|
return R.success(); |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
|
|
|
|
iTaskService.removeById(task); |
|
|
|
return R.fail("AGV小车调用异常"); |
|
|
|
return R.fail("AGV小车调用异常"); |
|
|
|
} |
|
|
|
} |
|
|
|
}else { |
|
|
|
}else { |
|
|
|
@ -371,7 +367,7 @@ public class IOrderBoxServiceImpl implements IOrderBoxService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private R getSiteLocation(Task task) { |
|
|
|
private R getSiteLocation(Task task) { |
|
|
|
// 1. 查询当前工位可用的站点(状态为占用的站点)
|
|
|
|
// 1. 查询当前工位可用的站点(状态为占用的站点)
|
|
|
|
List<Station> list = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getWcId, task.getWcId()).eq(Station::getStationStatus, STATUS_OCCUPIED)); |
|
|
|
List<Station> list = iStationService.list(new LambdaQueryWrapper<Station>().eq(Station::getWcId, task.getWcId()).eq(Station::getStationStatus, STATUS_FREE)); |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
task.setStationId(list.get(0).getId()); // 分配第一个可用站点
|
|
|
|
task.setStationId(list.get(0).getId()); // 分配第一个可用站点
|
|
|
|
// 更新站点状态为预占用(锁定站点)
|
|
|
|
// 更新站点状态为预占用(锁定站点)
|
|
|
|
|