|
|
|
|
@ -175,7 +175,7 @@ public class ScheduledTasks { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @PostConstruct
|
|
|
|
|
// @Scheduled(cron = "0/3 * * * * ? ")
|
|
|
|
|
@Scheduled(cron = "0/3 * * * * ? ") |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void task() { |
|
|
|
|
log.info("开始获取需要执行的任务"); |
|
|
|
|
@ -225,6 +225,9 @@ public class ScheduledTasks { |
|
|
|
|
taskQueryBo.setTaskType("19"); |
|
|
|
|
List<BusinDataTaskVo> businDataTaskVo19 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); |
|
|
|
|
businDataTaskVos.addAll(businDataTaskVo19); |
|
|
|
|
taskQueryBo.setTaskType("21"); |
|
|
|
|
List<BusinDataTaskVo> businDataTaskVo21 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); |
|
|
|
|
businDataTaskVos.addAll(businDataTaskVo21); |
|
|
|
|
|
|
|
|
|
for (BusinDataTaskVo businDataTaskVo : businDataTaskVos) { |
|
|
|
|
String taskType = businDataTaskVo.getTaskType(); |
|
|
|
|
@ -917,19 +920,8 @@ public class ScheduledTasks { |
|
|
|
|
basePointDeviceVo = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo).get(1); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Result<BaseLocationVo> baseLocationVoResult = iBaseLocationService.queryById(businDataTaskVo.getLocationId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); |
|
|
|
|
BusinTaskExeBo exeBo = new BusinTaskExeBo(); |
|
|
|
|
exeBo.setTaskCode(taskId); |
|
|
|
|
exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); |
|
|
|
|
exeBo.setContainerId(containerId); |
|
|
|
|
exeBo.setBaseLocationVo(baseLocationVoResult.getData()); |
|
|
|
|
exeBo.setTransNo("1"); |
|
|
|
|
exeBo.setTransQual("1"); |
|
|
|
|
iPutInOutStorageService.exeTaskPutinStorage(exeBo); |
|
|
|
|
|
|
|
|
|
NUMBER = false; |
|
|
|
|
//先入待冲孔区
|
|
|
|
|
Long punchingArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); |
|
|
|
|
@ -944,6 +936,16 @@ public class ScheduledTasks { |
|
|
|
|
//获取货位及巷道;
|
|
|
|
|
String tunnel = locationVo.getTunnel(); |
|
|
|
|
businDataTaskVo.setTunnel(tunnel); |
|
|
|
|
// Result<BaseLocationVo> baseLocationVoResult = iBaseLocationService.queryById(locationVo.getId());
|
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); |
|
|
|
|
BusinTaskExeBo exeBo = new BusinTaskExeBo(); |
|
|
|
|
exeBo.setTaskCode(taskId); |
|
|
|
|
exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos); |
|
|
|
|
exeBo.setContainerId(containerId); |
|
|
|
|
exeBo.setBaseLocationVo(locationVo); |
|
|
|
|
exeBo.setTransNo("1"); |
|
|
|
|
exeBo.setTransQual("1"); |
|
|
|
|
iPutInOutStorageService.exeTaskPutinStorage(exeBo); |
|
|
|
|
//获取巷道对应的立库输送线接驳口
|
|
|
|
|
pointQueryBo.setTunnel(tunnel); |
|
|
|
|
pointQueryBo.setDirection("0"); |
|
|
|
|
@ -1076,6 +1078,7 @@ public class ScheduledTasks { |
|
|
|
|
List<SysStockDetail> list = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>() |
|
|
|
|
.in(SysStockDetail::getGoodsNo, goodsno) |
|
|
|
|
.eq(SysStockDetail::getQty, "1") |
|
|
|
|
.ne(SysStockDetail::getOutQty ,"1" ) |
|
|
|
|
.isNotNull(SysStockDetail::getLocationId)); |
|
|
|
|
//查询库存并返回库位信息
|
|
|
|
|
BusinTaskExeBo businTaskExeBo = iBusinDataTaskService.outboundInfo(businDataTaskGoodsVos, String.valueOf(businDataTaskVo.getId())); |
|
|
|
|
@ -1083,9 +1086,11 @@ public class ScheduledTasks { |
|
|
|
|
if (ObjectUtils.isNotEmpty(list)) { |
|
|
|
|
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(businDataTask) && ObjectUtils.isNotEmpty(businDataTask.getFromLayer())) { |
|
|
|
|
////生成出库单
|
|
|
|
|
Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(businTaskExeBo); |
|
|
|
|
businDataTask.setTransId(billResult.getData()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(businTaskExeBo)){ |
|
|
|
|
////生成出库单
|
|
|
|
|
Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(businTaskExeBo); |
|
|
|
|
businDataTask.setTransId(billResult.getData()); |
|
|
|
|
} |
|
|
|
|
//添加货位预占和库存预占
|
|
|
|
|
//获取货位信息
|
|
|
|
|
BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); |
|
|
|
|
@ -1133,6 +1138,9 @@ public class ScheduledTasks { |
|
|
|
|
businDataTask.setDistinction(businDataTaskVo.getDistinction()); |
|
|
|
|
iBusinDataTaskService.saveOrUpdate(businDataTask); |
|
|
|
|
businDataTaskVo = BeanUtil.toBean(businDataTask, BusinDataTaskVo.class); |
|
|
|
|
}else { |
|
|
|
|
businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); |
|
|
|
|
businDataTaskVo.setTaskStatus("-3"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
@ -1384,6 +1392,36 @@ public class ScheduledTasks { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else if(taskType.equals(TaskTypeEnum.punching_delivery.getValue())){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else if(taskType.equals(TaskTypeEnum.replenished_in.getValue())){ |
|
|
|
|
String agvno = null; |
|
|
|
|
if (businDataTaskVo.getTaskPath().contains("manMade")) { |
|
|
|
|
List agvtaskType=new ArrayList(); |
|
|
|
|
agvtaskType.add("15"); |
|
|
|
|
agvtaskType.add("12"); |
|
|
|
|
BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper<BusinDataTask>() |
|
|
|
|
.in(BusinDataTask::getTaskType, agvtaskType) |
|
|
|
|
.eq(BusinDataTask::getContainerId, businDataTaskVo.getContainerId()) |
|
|
|
|
.eq(BusinDataTask::getTaskStatus, "2") |
|
|
|
|
.orderByDesc(BusinDataTask::getId) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
if (ObjectUtils.isNotEmpty(manMade01)) { |
|
|
|
|
agvno = manMade01.getAgvNo(); |
|
|
|
|
} |
|
|
|
|
} else if (businDataTaskVo.getTaskPath().contains("Artificial")) { |
|
|
|
|
String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); |
|
|
|
|
String[] idArrs = idArr.split("_"); |
|
|
|
|
agvno = idArrs[1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<BusinDataTaskGoodsVo> goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); |
|
|
|
|
List<String> goodsNoStr = goodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
iBusinDataTaskService.runReplenishIn(businDataTaskVo,agvno); |
|
|
|
|
Result<Boolean> booleanResult = iPutInOutStorageService.reduceInventory(taskId,goodsNoStr); |
|
|
|
|
} |
|
|
|
|
else if (taskType.equals("21")){ |
|
|
|
|
// 冲孔出库
|
|
|
|
|
//待冲孔区货位
|
|
|
|
|
Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.punching_area)); |
|
|
|
|
@ -1472,7 +1510,7 @@ public class ScheduledTasks { |
|
|
|
|
//拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以)
|
|
|
|
|
businDataTaskVo.setContainerId(sysStockDetailList.get(0).getContainerCode()); |
|
|
|
|
|
|
|
|
|
Result<Boolean> taskResult1 = outTask(businDataTaskVo); |
|
|
|
|
Result<Boolean> taskResult1 = outTask(businDataTaskVo); |
|
|
|
|
if (taskResult1.getCode() == HttpStatus.SUCCESS.getCode()) { |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
//生成出库单
|
|
|
|
|
@ -1507,33 +1545,6 @@ public class ScheduledTasks { |
|
|
|
|
businDataTaskVo.setTaskStatus("-3"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if(taskType.equals(TaskTypeEnum.replenished_in.getValue())){ |
|
|
|
|
String agvno = null; |
|
|
|
|
if (businDataTaskVo.getTaskPath().contains("manMade")) { |
|
|
|
|
List agvtaskType=new ArrayList(); |
|
|
|
|
agvtaskType.add("15"); |
|
|
|
|
agvtaskType.add("12"); |
|
|
|
|
BusinDataTask manMade01 = iBusinDataTaskService.getOne(new LambdaQueryWrapper<BusinDataTask>() |
|
|
|
|
.in(BusinDataTask::getTaskType, agvtaskType) |
|
|
|
|
.eq(BusinDataTask::getContainerId, businDataTaskVo.getContainerId()) |
|
|
|
|
.eq(BusinDataTask::getTaskStatus, "2") |
|
|
|
|
.orderByDesc(BusinDataTask::getId) |
|
|
|
|
.last("limit 1")); |
|
|
|
|
if (ObjectUtils.isNotEmpty(manMade01)) { |
|
|
|
|
agvno = manMade01.getAgvNo(); |
|
|
|
|
} |
|
|
|
|
} else if (businDataTaskVo.getTaskPath().contains("Artificial")) { |
|
|
|
|
String idArr = redisTemplate.opsForValue().get(RedisConstant.Replenishment).toString(); |
|
|
|
|
String[] idArrs = idArr.split("_"); |
|
|
|
|
agvno = idArrs[1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<BusinDataTaskGoodsVo> goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); |
|
|
|
|
List<String> goodsNoStr = goodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
iBusinDataTaskService.runReplenishIn(businDataTaskVo,agvno); |
|
|
|
|
Result<Boolean> booleanResult = iPutInOutStorageService.reduceInventory(taskId,goodsNoStr); |
|
|
|
|
} |
|
|
|
|
//统一提交任务数据
|
|
|
|
|
iBusinDataTaskService.saveOrUpdate(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); |
|
|
|
|
} |
|
|
|
|
@ -1823,7 +1834,7 @@ public class ScheduledTasks { |
|
|
|
|
int randomoperands = (int) Math.round(Math.random() * 1000); |
|
|
|
|
String taskCode = "T_" + DateUtils.dateTimeNow() + randomoperands; |
|
|
|
|
task.setTaskCode(taskCode); |
|
|
|
|
task.setTaskType("4"); |
|
|
|
|
task.setTaskType("21"); |
|
|
|
|
task.setBatch(DateUtils.getDate()); |
|
|
|
|
task.setPriority("2"); |
|
|
|
|
task.setIsTop("0"); |
|
|
|
|
|