|
|
|
|
@ -228,8 +228,14 @@ public class ScheduledTasks { |
|
|
|
|
taskQueryBo.setTaskType("21"); |
|
|
|
|
List<BusinDataTaskVo> businDataTaskVo21 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); |
|
|
|
|
businDataTaskVos.addAll(businDataTaskVo21); |
|
|
|
|
for (BusinDataTaskVo businDataTaskVo : businDataTaskVos){ |
|
|
|
|
doTask(businDataTaskVo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (BusinDataTaskVo businDataTaskVo : businDataTaskVos) { |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public void doTask(BusinDataTaskVo businDataTaskVo) { |
|
|
|
|
String taskType = businDataTaskVo.getTaskType(); |
|
|
|
|
Long taskId = businDataTaskVo.getId(); |
|
|
|
|
Long containerId = businDataTaskVo.getContainerId(); |
|
|
|
|
@ -240,9 +246,9 @@ public class ScheduledTasks { |
|
|
|
|
if (taskType.equals("0") || taskType.equals("7")) { |
|
|
|
|
//获取要出入库的条码信息
|
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); |
|
|
|
|
if(ObjectUtils.isEmpty(businDataTaskGoodsVos)){ |
|
|
|
|
/* if(ObjectUtils.isEmpty(businDataTaskGoodsVos)){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0); |
|
|
|
|
String vehicheModel = goodsVo.getVehicheModel(); |
|
|
|
|
String color = goodsVo.getColor(); |
|
|
|
|
@ -346,7 +352,7 @@ public class ScheduledTasks { |
|
|
|
|
//根据车型分配库位 先判断该任务是否已经分配了货位
|
|
|
|
|
Result<BaseLocationVo> locationVoResult = null; |
|
|
|
|
if(ObjectUtils.isEmpty(businDataTaskVo.getToRow())){ |
|
|
|
|
// locationVoResult = iBaseLocationService.assignEmptyLocation(vehicheModel, color,DateUtils.getDate(),businDataTaskGoodsVos);
|
|
|
|
|
// locationVoResult = iBaseLocationService.assignEmptyLocation(vehicheModel, color,DateUtils.getDate(),businDataTaskGoodsVos);
|
|
|
|
|
// TODO: 2024/6/28 zjx
|
|
|
|
|
locationVoResult = iBaseLocationService.assignEmptyLocationByStock( goodsNo, vehicheModel,DateUtils.getDate(),businDataTaskGoodsVos); |
|
|
|
|
|
|
|
|
|
@ -493,7 +499,7 @@ public class ScheduledTasks { |
|
|
|
|
businDataTaskVo.setTaskPath(toLocation); |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
|
|
|
|
|
//生成入库单
|
|
|
|
|
//生成入库单
|
|
|
|
|
if (randome.equals("P01")){ |
|
|
|
|
Result<String> stringResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo); |
|
|
|
|
|
|
|
|
|
@ -603,7 +609,7 @@ public class ScheduledTasks { |
|
|
|
|
//// exeBo.setTransQual("1");
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
basePointDeviceVo = basePointDeviceVos.get(0); |
|
|
|
|
basePointDeviceVo = basePointDeviceVos.get(0); |
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//plcId =basePointDeviceVo.getPlcId();
|
|
|
|
|
@ -1038,40 +1044,40 @@ public class ScheduledTasks { |
|
|
|
|
//获取要出库的物料信息
|
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.getTaskGoodsByTaskCodeForOut(businDataTaskVo.getId()); |
|
|
|
|
|
|
|
|
|
//拿到按比例分配的库区
|
|
|
|
|
//拿到按比例分配的库区
|
|
|
|
|
// randome = allocationTasksUtils.randomeout();
|
|
|
|
|
//测试时使用
|
|
|
|
|
randome="P01"; |
|
|
|
|
//测试时使用
|
|
|
|
|
randome="P01"; |
|
|
|
|
//TODO 测试注释 要到开
|
|
|
|
|
// if (randome.equals("P02")) {
|
|
|
|
|
if (businDataTaskVo.getDistinction().equals("2")) { |
|
|
|
|
int number = businDataTaskGoodsVos.size(); |
|
|
|
|
List<String> goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); |
|
|
|
|
//根据GoodsNo查看立库是否有库存
|
|
|
|
|
List<SysStockDetail> list = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>() |
|
|
|
|
.in(SysStockDetail::getGoodsNo, goodsno) |
|
|
|
|
.eq(SysStockDetail::getQty, "1") |
|
|
|
|
.isNull(SysStockDetail::getOutQty) |
|
|
|
|
.isNull(SysStockDetail::getLocationId)); |
|
|
|
|
if (ObjectUtils.isEmpty(list)) { |
|
|
|
|
businDataTaskVo.setDistinction("1"); |
|
|
|
|
} else { |
|
|
|
|
String frompoint=null; |
|
|
|
|
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_out01); |
|
|
|
|
pointQueryBo.setGroupNo(tepairGroup); |
|
|
|
|
BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
frompoint = pointDeviceout.getPointNo(); |
|
|
|
|
//查询平库出库任务使用状态
|
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.four_out.getValue()); |
|
|
|
|
businDataTaskVo.setTaskType(TaskTypeEnum.thirteen_out.getValue()); |
|
|
|
|
businDataTaskVo.setTaskPath(frompoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (businDataTaskVo.getDistinction().equals("2")) { |
|
|
|
|
int number = businDataTaskGoodsVos.size(); |
|
|
|
|
List<String> goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList()); |
|
|
|
|
//根据GoodsNo查看立库是否有库存
|
|
|
|
|
List<SysStockDetail> list = iSysStockDetailService.list(new LambdaQueryWrapper<SysStockDetail>() |
|
|
|
|
.in(SysStockDetail::getGoodsNo, goodsno) |
|
|
|
|
.eq(SysStockDetail::getQty, "1") |
|
|
|
|
.isNull(SysStockDetail::getOutQty) |
|
|
|
|
.isNull(SysStockDetail::getLocationId)); |
|
|
|
|
if (ObjectUtils.isEmpty(list)) { |
|
|
|
|
businDataTaskVo.setDistinction("1"); |
|
|
|
|
} else { |
|
|
|
|
String frompoint=null; |
|
|
|
|
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_out01); |
|
|
|
|
pointQueryBo.setGroupNo(tepairGroup); |
|
|
|
|
BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
frompoint = pointDeviceout.getPointNo(); |
|
|
|
|
//查询平库出库任务使用状态
|
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.four_out.getValue()); |
|
|
|
|
businDataTaskVo.setTaskType(TaskTypeEnum.thirteen_out.getValue()); |
|
|
|
|
businDataTaskVo.setTaskPath(frompoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//TODO 测试注释 要到开
|
|
|
|
|
// if (!randome.equals("P02")) {
|
|
|
|
|
if (!businDataTaskVo.getDistinction().equals("2")) { |
|
|
|
|
if (!businDataTaskVo.getDistinction().equals("2")) { |
|
|
|
|
// int number = businDataTaskGoodsVos.size();
|
|
|
|
|
// List<String> goodsno = businDataTaskGoodsVos.stream().map(e -> e.getGoodsNo()).collect(Collectors.toList());
|
|
|
|
|
//根据GoodsNo查看立库是否有库存
|
|
|
|
|
@ -1081,66 +1087,66 @@ public class ScheduledTasks { |
|
|
|
|
// .eq(SysStockDetail::getQty, "1")
|
|
|
|
|
// .ne(SysStockDetail::getOutQty ,"1" )
|
|
|
|
|
// .isNotNull(SysStockDetail::getLocationId));
|
|
|
|
|
//查询库存并返回库位信息
|
|
|
|
|
//查询库存并返回库位信息
|
|
|
|
|
BusinTaskExeBo businTaskExeBo = iBusinDataTaskService.outboundInfo(businDataTaskGoodsVos, String.valueOf(businDataTaskVo.getId())); |
|
|
|
|
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(businDataTask) && ObjectUtils.isNotEmpty(businDataTask.getFromLayer())) { |
|
|
|
|
if (ObjectUtils.isNotEmpty(businTaskExeBo)){ |
|
|
|
|
////生成出库单
|
|
|
|
|
Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(businTaskExeBo); |
|
|
|
|
businDataTask.setTransId(billResult.getData()); |
|
|
|
|
} |
|
|
|
|
//添加货位预占和库存预占
|
|
|
|
|
//获取货位信息
|
|
|
|
|
BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); |
|
|
|
|
location.setLocationStatus("4"); |
|
|
|
|
iBaseLocationService.updateById(location); |
|
|
|
|
//根据货位拿到库存信息
|
|
|
|
|
List<SysStockDetail> sysStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(location.getId())); |
|
|
|
|
sysStockDetailList.stream().forEach(e -> { |
|
|
|
|
e.setOutQty(1); |
|
|
|
|
}); |
|
|
|
|
//给库存添加出货预占
|
|
|
|
|
iSysStockDetailService.updateBatchById(sysStockDetailList); |
|
|
|
|
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(businDataTask) && ObjectUtils.isNotEmpty(businDataTask.getFromLayer())) { |
|
|
|
|
if (ObjectUtils.isNotEmpty(businTaskExeBo)){ |
|
|
|
|
////生成出库单
|
|
|
|
|
Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(businTaskExeBo); |
|
|
|
|
businDataTask.setTransId(billResult.getData()); |
|
|
|
|
} |
|
|
|
|
//添加货位预占和库存预占
|
|
|
|
|
//获取货位信息
|
|
|
|
|
BaseLocation location = iBaseLocationService.getById(businDataTask.getLocationId()); |
|
|
|
|
location.setLocationStatus("4"); |
|
|
|
|
iBaseLocationService.updateById(location); |
|
|
|
|
//根据货位拿到库存信息
|
|
|
|
|
List<SysStockDetail> sysStockDetailList = sysStockDetailMapper.getStockDetailByLocationId(String.valueOf(location.getId())); |
|
|
|
|
sysStockDetailList.stream().forEach(e -> { |
|
|
|
|
e.setOutQty(1); |
|
|
|
|
}); |
|
|
|
|
//给库存添加出货预占
|
|
|
|
|
iSysStockDetailService.updateBatchById(sysStockDetailList); |
|
|
|
|
// Result<Boolean> taskResult =new Result<>();
|
|
|
|
|
Result<Boolean> taskResult = outTask(businDataTask); |
|
|
|
|
if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { |
|
|
|
|
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:"+businDataTask.getId()))){ |
|
|
|
|
redisTemplate.opsForValue().set("outbound:"+businDataTask.getId(), businDataTask.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以)
|
|
|
|
|
businDataTask.setContainerId(sysStockDetailList.get(0).getContainerCode()); |
|
|
|
|
if(!"5".equals(businDataTask.getTaskType())){ |
|
|
|
|
//根据过点时间更改out表里的状态信息
|
|
|
|
|
List<BusinDataTaskGoods> businDataTaskGoods = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper<BusinDataTaskGoods>() |
|
|
|
|
.eq(BusinDataTaskGoods::getTaskCode, businDataTask.getId())); |
|
|
|
|
BaseBarcodesOut baseBarcodesOutServiceOne = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>() |
|
|
|
|
.eq(BaseBarcodesOut::getTraverseDate, businDataTaskGoods.get(0).getTraverseDate())); |
|
|
|
|
baseBarcodesOutServiceOne.setOutStatus("2"); |
|
|
|
|
iBaseBarcodesOutService.updateById(baseBarcodesOutServiceOne); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//添加巷道任务数和总任务数
|
|
|
|
|
//tunnelTaskUtil.addOutboundTaskNum(businDataTask.getTunnel());
|
|
|
|
|
} else { |
|
|
|
|
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:"+businDataTask.getId()))){ |
|
|
|
|
businDataTask.setExceptionMsg("下发堆垛机失败"); |
|
|
|
|
businDataTask.setTaskStatus(TaskStatusEnum.err.getValue()); |
|
|
|
|
}else { |
|
|
|
|
businDataTask.setExceptionMsg("已经下发堆垛机"); |
|
|
|
|
businDataTask.setTaskStatus("-3"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
businDataTask.setDistinction(businDataTaskVo.getDistinction()); |
|
|
|
|
iBusinDataTaskService.saveOrUpdate(businDataTask); |
|
|
|
|
businDataTaskVo = BeanUtil.toBean(businDataTask, BusinDataTaskVo.class); |
|
|
|
|
}else { |
|
|
|
|
businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); |
|
|
|
|
businDataTaskVo.setTaskStatus("-3"); |
|
|
|
|
} |
|
|
|
|
Result<Boolean> taskResult = outTask(businDataTask); |
|
|
|
|
if (taskResult.getCode() == HttpStatus.SUCCESS.getCode()) { |
|
|
|
|
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:"+businDataTask.getId()))){ |
|
|
|
|
redisTemplate.opsForValue().set("outbound:"+businDataTask.getId(), businDataTask.toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//拿到库存里的治具编号(不分体的每个保险杠在一个货位一个任务,分体的只有一个任务一个货位所以只随机拿到一个库存信息的治具号就可以)
|
|
|
|
|
businDataTask.setContainerId(sysStockDetailList.get(0).getContainerCode()); |
|
|
|
|
if(!"5".equals(businDataTask.getTaskType())){ |
|
|
|
|
//根据过点时间更改out表里的状态信息
|
|
|
|
|
List<BusinDataTaskGoods> businDataTaskGoods = iBusinDataTaskGoodsService.list(new LambdaQueryWrapper<BusinDataTaskGoods>() |
|
|
|
|
.eq(BusinDataTaskGoods::getTaskCode, businDataTask.getId())); |
|
|
|
|
BaseBarcodesOut baseBarcodesOutServiceOne = iBaseBarcodesOutService.getOne(new LambdaQueryWrapper<BaseBarcodesOut>() |
|
|
|
|
.eq(BaseBarcodesOut::getTraverseDate, businDataTaskGoods.get(0).getTraverseDate())); |
|
|
|
|
baseBarcodesOutServiceOne.setOutStatus("2"); |
|
|
|
|
iBaseBarcodesOutService.updateById(baseBarcodesOutServiceOne); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//添加巷道任务数和总任务数
|
|
|
|
|
//tunnelTaskUtil.addOutboundTaskNum(businDataTask.getTunnel());
|
|
|
|
|
} else { |
|
|
|
|
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get("outbound:"+businDataTask.getId()))){ |
|
|
|
|
businDataTask.setExceptionMsg("下发堆垛机失败"); |
|
|
|
|
businDataTask.setTaskStatus(TaskStatusEnum.err.getValue()); |
|
|
|
|
}else { |
|
|
|
|
businDataTask.setExceptionMsg("已经下发堆垛机"); |
|
|
|
|
businDataTask.setTaskStatus("-3"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
businDataTask.setDistinction(businDataTaskVo.getDistinction()); |
|
|
|
|
iBusinDataTaskService.saveOrUpdate(businDataTask); |
|
|
|
|
businDataTaskVo = BeanUtil.toBean(businDataTask, BusinDataTaskVo.class); |
|
|
|
|
}else { |
|
|
|
|
businDataTaskVo.setExceptionMsg("当前开放的货位已无当前库存"); |
|
|
|
|
businDataTaskVo.setTaskStatus("-3"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if (ObjectUtils.isNotEmpty(list)) {
|
|
|
|
|
//
|
|
|
|
|
@ -1550,7 +1556,8 @@ public class ScheduledTasks { |
|
|
|
|
//统一提交任务数据
|
|
|
|
|
iBusinDataTaskService.saveOrUpdate(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查看堆垛机是否拥堵
|
|
|
|
|
public Result<Boolean> PLCout(BusinDataTask businDataTask){ |
|
|
|
|
|