|
|
|
|
@ -199,9 +199,7 @@ public class ScheduledTasks { |
|
|
|
|
taskQueryBo.setTaskType("1"); |
|
|
|
|
List<BusinDataTaskVo> businDataTaskVo1 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); |
|
|
|
|
businDataTaskVos.addAll(businDataTaskVo1); |
|
|
|
|
taskQueryBo.setTaskType("2"); |
|
|
|
|
List<BusinDataTaskVo> businDataTaskVo2 = iBusinDataTaskService.selectBusinDataTask1(taskQueryBo); |
|
|
|
|
businDataTaskVos.addAll(businDataTaskVo2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//越库模式下或暂停出库,需要设置暂停出库
|
|
|
|
|
String startStopOutbound= StartStopOutboundEnum.STOP.getValue(); |
|
|
|
|
@ -270,7 +268,7 @@ public class ScheduledTasks { |
|
|
|
|
|
|
|
|
|
//查询下挂任务目前的车型:入库:3LN(20秒) 出库:3UG(40秒) 空托和保险杠交替进行 4和15
|
|
|
|
|
//从redis中写入
|
|
|
|
|
if (inVehicheModel.equals("3LN") || inVehicheModel.equals("3UE")) {//下发车型为3LN的时候,根据出库任务数量执行空托任务
|
|
|
|
|
if (inVehicheModel.equals("3LN") || inVehicheModel.equals("3UE")) {//下挂车型为3LN的时候,根据出库任务数量执行空托任务
|
|
|
|
|
//获取出库任务下发成功数
|
|
|
|
|
if (redisTemplate.hasKey(RedisConstant.redisSurplusWaitIssueEmpFixTaskNum)) { |
|
|
|
|
Integer lastSurpTaskNum = (Integer) redisTemplate.opsForValue().get(RedisConstant.redisSurplusWaitIssueEmpFixTaskNum); |
|
|
|
|
@ -520,163 +518,7 @@ public class ScheduledTasks { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else if (taskType.equals("2")) { |
|
|
|
|
Long plcId = 0L; |
|
|
|
|
Long stkPlcId = 0L; |
|
|
|
|
Boolean NUMBER = true; |
|
|
|
|
//维修异常 呼叫AGV
|
|
|
|
|
//获取起始点位
|
|
|
|
|
String startPoint = businDataTaskVo.getTaskPath(); |
|
|
|
|
//查询维修地点是否有空闲
|
|
|
|
|
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.scanexc_group); |
|
|
|
|
// String tmpPoint = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point_tmp);
|
|
|
|
|
|
|
|
|
|
pointQueryBo.setGroupNo(tepairGroup); |
|
|
|
|
BasePointDeviceVo basePointDeviceVo = null; |
|
|
|
|
List<BasePointDeviceVo> basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
List<String> points = new ArrayList<>(); |
|
|
|
|
points.add(startPoint); |
|
|
|
|
Map<String, String> snPointMap = new HashMap<>(3); |
|
|
|
|
snPointMap.put("1", startPoint); |
|
|
|
|
//获取机械手上报点
|
|
|
|
|
String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); |
|
|
|
|
BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); |
|
|
|
|
pointQueryBoup.setGroupNo(tepairGroupin); |
|
|
|
|
BasePointDeviceVo pointDevice = new BasePointDeviceVo(); |
|
|
|
|
pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); |
|
|
|
|
points.add(pointDevice.getHandshakePoint()); |
|
|
|
|
snPointMap.put("2", pointDevice.getHandshakePoint()); |
|
|
|
|
BaseLocationVo locationVo = null; |
|
|
|
|
BusinTaskExeBo exeBo = new BusinTaskExeBo(); |
|
|
|
|
//无空闲区 分配异常区库位
|
|
|
|
|
// if (basePointDeviceVos.size() ==0) {
|
|
|
|
|
// NUMBER=false;
|
|
|
|
|
//
|
|
|
|
|
// if (businDataTaskVo.getWarehouseType().equals("2")) {
|
|
|
|
|
// String tepairGroup1 = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01);
|
|
|
|
|
// pointQueryBo.setGroupNo(tepairGroup1);
|
|
|
|
|
// BasePointDeviceVo pointDeviceout = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo);
|
|
|
|
|
// basePointDeviceVo = pointDeviceout;
|
|
|
|
|
// } else {
|
|
|
|
|
// //异常区ID
|
|
|
|
|
// Long abnormalArea =Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area));
|
|
|
|
|
// List<BaseLocationVo> baseLocationVos = baseLocationMapper.getLocationByAreaId(abnormalArea);
|
|
|
|
|
// if (baseLocationVos.size() > 0) {
|
|
|
|
|
// locationVo = baseLocationVos.get(0);
|
|
|
|
|
// }
|
|
|
|
|
// businDataTaskVo.setToColumn(locationVo.getLocationColumn());
|
|
|
|
|
// businDataTaskVo.setToLayer(locationVo.getLayer());
|
|
|
|
|
// businDataTaskVo.setToRow(locationVo.getLocationRow());
|
|
|
|
|
// //获取货位及巷道;
|
|
|
|
|
// String tunnel = locationVo.getTunnel();
|
|
|
|
|
// businDataTaskVo.setTunnel(tunnel);
|
|
|
|
|
// pointQueryBo=new BasePointDeviceQueryBo();
|
|
|
|
|
// pointQueryBo.setTunnel(tunnel);
|
|
|
|
|
// pointQueryBo.setDirection("0");
|
|
|
|
|
// basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo);
|
|
|
|
|
// if (basePointDeviceVos.size() > 0) {
|
|
|
|
|
// basePointDeviceVo = basePointDeviceVos.get(0);
|
|
|
|
|
// basePointDeviceVo.setPlcId(Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)));
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// //获取巷道对应的堆垛机信息
|
|
|
|
|
// pointQueryBo.setDevType("1");
|
|
|
|
|
// BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo);
|
|
|
|
|
// stkPlcId = baseDevicePlcVo.getPlcId();
|
|
|
|
|
// List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId());
|
|
|
|
|
//// exeBo.setTaskCode(taskId);
|
|
|
|
|
//// exeBo.setBusinDataTaskGoodsVo(businDataTaskGoodsVos);
|
|
|
|
|
//// exeBo.setContainerId(containerId);
|
|
|
|
|
//// exeBo.setBaseLocationVo(locationVo);
|
|
|
|
|
//// exeBo.setTransNo("1");
|
|
|
|
|
//// exeBo.setTransQual("1");
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
basePointDeviceVo = basePointDeviceVos.get(0); |
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//plcId =basePointDeviceVo.getPlcId();
|
|
|
|
|
// String toPointNo = basePointDeviceVo.getPointNo();
|
|
|
|
|
// snPointMap.put("3",toPointNo);
|
|
|
|
|
// points.add(toPointNo);
|
|
|
|
|
// int agvTaskType = Integer.valueOf(basePointDeviceVo.getIsDown());
|
|
|
|
|
|
|
|
|
|
String toPointNo = basePointDeviceVo.getPointNo(); |
|
|
|
|
; |
|
|
|
|
int agvTaskType = 33; |
|
|
|
|
snPointMap.put("3", "XX"); |
|
|
|
|
points.add("XX"); |
|
|
|
|
snPointMap.put("4", "XX"); |
|
|
|
|
points.add("XX"); |
|
|
|
|
snPointMap.put("5", toPointNo); |
|
|
|
|
points.add(toPointNo); |
|
|
|
|
// TODO 中科 测试 需要删除
|
|
|
|
|
businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); |
|
|
|
|
businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); |
|
|
|
|
Result<Boolean> booleanResult = new Result<>(); |
|
|
|
|
//呼叫AGV
|
|
|
|
|
if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) { |
|
|
|
|
booleanResult = callAGV(taskId, agvTaskType, points, businDataTaskVo.getAgvNo()); |
|
|
|
|
} else { |
|
|
|
|
booleanResult = callAGV(taskId, agvTaskType, points); |
|
|
|
|
} |
|
|
|
|
if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) { |
|
|
|
|
BusinDataTask businDataTask = new BusinDataTask(); |
|
|
|
|
businDataTask.setId(businDataTaskVo.getId()); |
|
|
|
|
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
businDataTask.setTaskPath(toPointNo); |
|
|
|
|
iBusinDataTaskService.updateById(businDataTask); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//呼叫AGV成功
|
|
|
|
|
if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
businDataTaskVo.setTaskPath(toPointNo); |
|
|
|
|
// TODO 中科 测试 需要还原
|
|
|
|
|
// //把占用的点位改为已占用
|
|
|
|
|
if (NUMBER) { |
|
|
|
|
BasePoint basePoint = iBasePointService.getById(basePointDeviceVo.getPointId()); |
|
|
|
|
basePoint.setIsOccupy("1"); |
|
|
|
|
iBasePointService.updateById(basePoint); |
|
|
|
|
} |
|
|
|
|
// //更改货位状态为4已分配
|
|
|
|
|
// if (ObjectUtils.isNotEmpty(locationVo)){
|
|
|
|
|
// BaseLocation baseLocation = iBaseLocationService.getById(locationVo.getId());
|
|
|
|
|
// baseLocation.setLocationStatus("4");
|
|
|
|
|
// iBaseLocationService.updateById(baseLocation);
|
|
|
|
|
// }
|
|
|
|
|
// TODO 中科 测试 需要还原
|
|
|
|
|
// TODO 中科 测试 需要还原
|
|
|
|
|
} |
|
|
|
|
// else{
|
|
|
|
|
// if (redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)==null){
|
|
|
|
|
// redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,0);
|
|
|
|
|
// }
|
|
|
|
|
// Long a=Long.valueOf(String.valueOf(redisTemplate.opsForValue().get(RedisConstant.redisAgvTaskerror+taskId)));
|
|
|
|
|
// businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue());
|
|
|
|
|
// businDataTaskVo.setExceptionMsg(booleanResult.getMsg());
|
|
|
|
|
// if (a<3L){
|
|
|
|
|
// long l = a + 1;
|
|
|
|
|
// redisTemplate.opsForValue().set(RedisConstant.redisAgvTaskerror+taskId,l);
|
|
|
|
|
// }else {
|
|
|
|
|
// businDataTaskVo.setTaskStatus("-2");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// TODO 测试注释 要打开
|
|
|
|
|
// //更新入库条码表状态为异常
|
|
|
|
|
List<BaseBarcodesIn> barcodesIns = new ArrayList<>(); |
|
|
|
|
List<BusinDataTaskGoodsVo> goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); |
|
|
|
|
for (BusinDataTaskGoodsVo goodsVo : goodsVos) { |
|
|
|
|
BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper<BaseBarcodesIn>() |
|
|
|
|
.eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode()) |
|
|
|
|
); |
|
|
|
|
baseBarcodesIn.setInStatus("4"); |
|
|
|
|
baseBarcodesIn.setInDate(DateUtils.getDate()); |
|
|
|
|
barcodesIns.add(baseBarcodesIn); |
|
|
|
|
} |
|
|
|
|
iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns); |
|
|
|
|
|
|
|
|
|
businDataTaskVo.setDpsNoOne(plcId); |
|
|
|
|
businDataTaskVo.setDpsNoTwo(stkPlcId); |
|
|
|
|
//异常杠下挂区域直接调度
|
|
|
|
|
} |
|
|
|
|
else if (taskType.equals("1")) { |
|
|
|
|
Long plcId = 0L; |
|
|
|
|
@ -1336,13 +1178,6 @@ public class ScheduledTasks { |
|
|
|
|
Result<Boolean> taskResult1 = outTask(businDataTaskVo); |
|
|
|
|
if (taskResult1.getCode() == HttpStatus.SUCCESS.getCode()) { |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
//生成出库单
|
|
|
|
|
BusinTaskExeBo exeBo = new BusinTaskExeBo(); |
|
|
|
|
exeBo.setTaskCode(taskId); |
|
|
|
|
exeBo.setBusinDataTaskGoodsVo(goodsVo); |
|
|
|
|
exeBo.setBaseLocationVo(baseLocationVo); |
|
|
|
|
exeBo.setTransNo("2"); |
|
|
|
|
exeBo.setTransQual("2"); |
|
|
|
|
|
|
|
|
|
// Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo);
|
|
|
|
|
// businDataTaskVo.setTransId(billResult.getData());
|
|
|
|
|
@ -1407,14 +1242,6 @@ public class ScheduledTasks { |
|
|
|
|
} |
|
|
|
|
BaseLocation baseLocationVo = baseLocationService.getOne(new LambdaQueryWrapper<BaseLocation>() |
|
|
|
|
.eq(BaseLocation::getId, businDataTaskVo.getLocationId())); |
|
|
|
|
//生成出库单
|
|
|
|
|
BusinTaskExeBo exeBo = new BusinTaskExeBo(); |
|
|
|
|
exeBo.setTaskCode(taskId); |
|
|
|
|
exeBo.setBusinDataTaskGoodsVo(goodsVo); |
|
|
|
|
exeBo.setBaseLocationVo(BeanUtil.toBean(baseLocationVo,BaseLocationVo.class)); |
|
|
|
|
exeBo.setTransNo("2"); |
|
|
|
|
exeBo.setTransQual("2"); |
|
|
|
|
|
|
|
|
|
// Result<String> billResult = iPutInOutStorageService.exeTaskPutinStorage(exeBo);
|
|
|
|
|
// businDataTaskVo.setTransId(billResult.getData());
|
|
|
|
|
//添加货位预占和库存预占
|
|
|
|
|
@ -1441,8 +1268,6 @@ public class ScheduledTasks { |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.err.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
else if (taskType.equals("22")) { |
|
|
|
|
BusinDataTask businDataTask = iBusinDataTaskService.getById(businDataTaskVo.getId()); |
|
|
|
|
@ -1851,9 +1676,6 @@ public class ScheduledTasks { |
|
|
|
|
|
|
|
|
|
//生成异常出库任务
|
|
|
|
|
BusinDataTask task = new BusinDataTask(); |
|
|
|
|
int randomoperands = (int) Math.round(Math.random() * 1000); |
|
|
|
|
String taskCode = "T_" + DateUtils.dateTimeNow() + randomoperands; |
|
|
|
|
task.setTaskCode(taskCode); |
|
|
|
|
task.setTaskType(TaskTypeEnum.abnormal_delivery.getValue()); |
|
|
|
|
task.setBatch(DateUtils.getDate()); |
|
|
|
|
task.setPriority("2"); |
|
|
|
|
@ -1903,9 +1725,6 @@ public class ScheduledTasks { |
|
|
|
|
|
|
|
|
|
//生成冲孔出库任务
|
|
|
|
|
BusinDataTask task = new BusinDataTask(); |
|
|
|
|
int randomoperands = (int) Math.round(Math.random() * 1000); |
|
|
|
|
String taskCode = "T_" + DateUtils.dateTimeNow() + randomoperands; |
|
|
|
|
task.setTaskCode(taskCode); |
|
|
|
|
task.setTaskType("21"); |
|
|
|
|
task.setBatch(DateUtils.getDate()); |
|
|
|
|
task.setPriority("2"); |
|
|
|
|
@ -1914,10 +1733,7 @@ public class ScheduledTasks { |
|
|
|
|
task.setCreateTime(DateUtils.getNowDate()); |
|
|
|
|
task.setTaskPath(toPointNo); |
|
|
|
|
task.setTaskStatus("0"); |
|
|
|
|
|
|
|
|
|
iBusinDataTaskService.insertBusinDataTask(task); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1951,9 +1767,9 @@ public class ScheduledTasks { |
|
|
|
|
//获取要出入库的条码信息
|
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); |
|
|
|
|
String taskType = businDataTaskVo.getTaskType(); |
|
|
|
|
if (ObjectUtils.isEmpty(businDataTaskGoodsVos) || (!taskType.equals("0") && !taskType.equals("3")) ) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (!taskType.equals("0") && !taskType.equals("3") && !taskType.equals("2")) |
|
|
|
|
{ return;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("3".equals(taskType)){ |
|
|
|
|
Long plcId = 0L; |
|
|
|
|
@ -2007,6 +1823,7 @@ public class ScheduledTasks { |
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVoList = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); |
|
|
|
|
AssingEmptyLocBo assingEmptyLocBo = new AssingEmptyLocBo(); |
|
|
|
|
assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVoList); |
|
|
|
|
assingEmptyLocBo.setAreaId(punchingArea); |
|
|
|
|
//冲孔杠分配货位
|
|
|
|
|
Result<BaseLocationVo> locationVoResult = iBaseLocationService.assignEmptyLocatioPunching(assingEmptyLocBo); |
|
|
|
|
|
|
|
|
|
@ -2084,7 +1901,8 @@ public class ScheduledTasks { |
|
|
|
|
businDataTaskVo.setDpsNoOne(plcId); |
|
|
|
|
businDataTaskVo.setDpsNoTwo(stkPlcId); |
|
|
|
|
iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); |
|
|
|
|
}else { |
|
|
|
|
} |
|
|
|
|
else if ("0".equals(taskType)){ |
|
|
|
|
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
BusinDataTaskGoodsVo goodsVo = businDataTaskGoodsVos.get(0); |
|
|
|
|
String vehicheModel = goodsVo.getVehicheModel(); |
|
|
|
|
@ -2092,8 +1910,6 @@ public class ScheduledTasks { |
|
|
|
|
String startPoint = businDataTaskVo.getTaskPath(); |
|
|
|
|
|
|
|
|
|
redisTemplate.opsForValue().set(RedisConstant.redisInVehicheModel, vehicheModel); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 1.判断是否启动越库 |
|
|
|
|
* 2.判断此入库的保险杠是否是有出库任务,如果有,送往小组装 |
|
|
|
|
@ -2278,30 +2094,22 @@ public class ScheduledTasks { |
|
|
|
|
//到达组装线等待上报点进行的业务处理
|
|
|
|
|
String reportPointGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.report_point); |
|
|
|
|
BasePointDeviceQueryBo pointReportQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
String reportPoint = ""; |
|
|
|
|
pointReportQueryBo.setGroupNo(reportPointGroup); |
|
|
|
|
BasePointDeviceVo reportPointDeviceOut = basePointDeviceMapper.selectBasePointByGroupno(pointReportQueryBo); |
|
|
|
|
if (ObjectUtils.isEmpty(reportPointDeviceOut)) { |
|
|
|
|
log.error("请维护组装线上报点"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
reportPoint = reportPointDeviceOut.getPointNo(); |
|
|
|
|
//越库到小组装的下挂点
|
|
|
|
|
toLocation =outTaskVos.get(0).getTaskPath(); |
|
|
|
|
|
|
|
|
|
points.add(businDataTaskVo.getTaskPath()); |
|
|
|
|
// points.add(pointDevice.getHandshakePoint());
|
|
|
|
|
|
|
|
|
|
// points.add(reportPoint);
|
|
|
|
|
points.add(toLocation); |
|
|
|
|
|
|
|
|
|
snPointMap.put("1", businDataTaskVo.getTaskPath()); |
|
|
|
|
// snPointMap.put("2", pointDevice.getHandshakePoint());
|
|
|
|
|
// snPointMap.put("3", reportPoint);
|
|
|
|
|
snPointMap.put("2", toLocation); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//呼叫AGV
|
|
|
|
|
Result<Boolean> booleanResult = new Result<>(); |
|
|
|
|
if (taskType.equals("7")) { |
|
|
|
|
@ -2355,8 +2163,135 @@ public class ScheduledTasks { |
|
|
|
|
} |
|
|
|
|
iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); |
|
|
|
|
} |
|
|
|
|
else if ("2".equals(taskType)){ |
|
|
|
|
Long plcId = 0L; |
|
|
|
|
Long stkPlcId = 0L; |
|
|
|
|
Boolean NUMBER = true; |
|
|
|
|
|
|
|
|
|
BaseLocationVo locationVo = null; |
|
|
|
|
String toPointNo=""; |
|
|
|
|
int agvTaskType=33; |
|
|
|
|
//获取起始点位
|
|
|
|
|
String startPoint = businDataTaskVo.getTaskPath(); |
|
|
|
|
|
|
|
|
|
//获取机械手上报点
|
|
|
|
|
List<String> points = new ArrayList<>(); |
|
|
|
|
Map<String, String> snPointMap = new HashMap<>(3); |
|
|
|
|
String tepairGroupin = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.putout_point); |
|
|
|
|
BasePointDeviceQueryBo pointQueryBoup = new BasePointDeviceQueryBo(); |
|
|
|
|
pointQueryBoup.setGroupNo(tepairGroupin); |
|
|
|
|
BasePointDeviceVo pointDevice = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBoup); |
|
|
|
|
points.add(startPoint); |
|
|
|
|
snPointMap.put("1", startPoint); |
|
|
|
|
points.add(pointDevice.getHandshakePoint()); |
|
|
|
|
snPointMap.put("2", pointDevice.getHandshakePoint()); |
|
|
|
|
|
|
|
|
|
//查询维修地点是否有空闲
|
|
|
|
|
String tepairGroup = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.scanexc_group); |
|
|
|
|
BasePointDeviceQueryBo pointQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
pointQueryBo.setGroupNo(tepairGroup); |
|
|
|
|
BasePointDeviceVo basePointDeviceVo = null; |
|
|
|
|
List<BasePointDeviceVo> basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
|
|
|
|
|
//无空闲区 分配异常区库位
|
|
|
|
|
if (basePointDeviceVos.size() == 0) { |
|
|
|
|
NUMBER = false; |
|
|
|
|
agvTaskType=RCSTaskTypeEnum.A_TO_B_HAND_PUT.getValue(); |
|
|
|
|
if (businDataTaskVo.getWarehouseType().equals("2")) { |
|
|
|
|
String tepairGroup1 = sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.P_in01); |
|
|
|
|
pointQueryBo.setGroupNo(tepairGroup1); |
|
|
|
|
basePointDeviceVo = basePointDeviceMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
//异常区ID
|
|
|
|
|
Long abnormalArea = Long.valueOf(sysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.abnormal_area)); |
|
|
|
|
//分配货位
|
|
|
|
|
List<BusinDataTaskGoodsVo> businDataTaskGoodsVoList = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(businDataTaskVo.getId()); |
|
|
|
|
AssingEmptyLocBo assingEmptyLocBo = new AssingEmptyLocBo(); |
|
|
|
|
assingEmptyLocBo.setBusinDataTaskGoodsVos(businDataTaskGoodsVoList); |
|
|
|
|
assingEmptyLocBo.setAreaId(abnormalArea); |
|
|
|
|
Result<BaseLocationVo> locationVoResult = iBaseLocationService.assignEmptyLocatioError(assingEmptyLocBo); |
|
|
|
|
if (Result.isOk(locationVoResult)){ |
|
|
|
|
locationVo = locationVoResult.getData(); |
|
|
|
|
} |
|
|
|
|
businDataTaskVo.setToColumn(locationVo.getLocationColumn()); |
|
|
|
|
businDataTaskVo.setToLayer(locationVo.getLayer()); |
|
|
|
|
businDataTaskVo.setToRow(locationVo.getLocationRow()); |
|
|
|
|
businDataTaskVo.setLocationId(locationVo.getId()); |
|
|
|
|
//获取货位及巷道;
|
|
|
|
|
String tunnel = locationVo.getTunnel(); |
|
|
|
|
businDataTaskVo.setTunnel(tunnel); |
|
|
|
|
pointQueryBo = new BasePointDeviceQueryBo(); |
|
|
|
|
pointQueryBo.setTunnel(tunnel); |
|
|
|
|
pointQueryBo.setDirection("0"); |
|
|
|
|
basePointDeviceVos = baseLocationPlcMapper.selectBasePointByGroupno(pointQueryBo); |
|
|
|
|
if (basePointDeviceVos.size() > 0) { |
|
|
|
|
basePointDeviceVo = basePointDeviceVos.get(0); |
|
|
|
|
} |
|
|
|
|
//获取巷道对应的堆垛机信息
|
|
|
|
|
pointQueryBo.setDevType("1"); |
|
|
|
|
BaseDevicePlcVo baseDevicePlcVo = baseLocationPlcMapper.selectBaseDevicePlc(pointQueryBo); |
|
|
|
|
stkPlcId = baseDevicePlcVo.getPlcId(); |
|
|
|
|
plcId =Long.valueOf(isysParameterService.selectConfigByKey(ParameterConstants.ParameterSystem.LK_plc_id)); |
|
|
|
|
toPointNo = basePointDeviceVo.getPointNo(); |
|
|
|
|
snPointMap.put("3",toPointNo); |
|
|
|
|
points.add(toPointNo); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
agvTaskType = 33; |
|
|
|
|
basePointDeviceVo = basePointDeviceVos.get(0); |
|
|
|
|
toPointNo = basePointDeviceVo.getPointNo(); |
|
|
|
|
snPointMap.put("3", "XX"); |
|
|
|
|
points.add("XX"); |
|
|
|
|
snPointMap.put("4", "XX"); |
|
|
|
|
points.add("XX"); |
|
|
|
|
snPointMap.put("5", toPointNo); |
|
|
|
|
points.add(toPointNo); |
|
|
|
|
} |
|
|
|
|
businDataTaskVo.setPoints(JsonUtil.toJSONString(snPointMap)); |
|
|
|
|
businDataTaskVo.setIsDown(String.valueOf(agvTaskType)); |
|
|
|
|
|
|
|
|
|
Result<Boolean> booleanResult; |
|
|
|
|
//呼叫AGV
|
|
|
|
|
if (StringUtils.isNotEmpty(businDataTaskVo.getAgvNo())) { |
|
|
|
|
booleanResult = callAGV(taskId, agvTaskType, points, businDataTaskVo.getAgvNo()); |
|
|
|
|
} else { |
|
|
|
|
booleanResult = callAGV(taskId, agvTaskType, points); |
|
|
|
|
} |
|
|
|
|
if (booleanResult.getCode() == HttpStatus.ERROR.getCode()) { |
|
|
|
|
BusinDataTask businDataTask = new BusinDataTask(); |
|
|
|
|
businDataTask.setId(businDataTaskVo.getId()); |
|
|
|
|
businDataTask.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
businDataTask.setTaskPath(toPointNo); |
|
|
|
|
iBusinDataTaskService.updateById(businDataTask); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//呼叫AGV成功
|
|
|
|
|
if (booleanResult.getCode() == HttpStatus.SUCCESS.getCode()) { |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
businDataTaskVo.setTaskPath(toPointNo); |
|
|
|
|
if (NUMBER) { |
|
|
|
|
BasePoint basePoint = iBasePointService.getById(basePointDeviceVo.getPointId()); |
|
|
|
|
basePoint.setIsOccupy("1"); |
|
|
|
|
iBasePointService.updateById(basePoint); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//更新入库条码表状态为异常
|
|
|
|
|
List<BaseBarcodesIn> barcodesIns = new ArrayList<>(); |
|
|
|
|
List<BusinDataTaskGoodsVo> goodsVos = iBusinDataTaskGoodsService.selectBusinTaskGoodsByTaskCode(taskId); |
|
|
|
|
for (BusinDataTaskGoodsVo goodsVo : goodsVos) { |
|
|
|
|
BaseBarcodesIn baseBarcodesIn = iBaseBarcodesInService.getOne(new LambdaQueryWrapper<BaseBarcodesIn>() |
|
|
|
|
.eq(BaseBarcodesIn::getQrCode, goodsVo.getQrCode()) |
|
|
|
|
); |
|
|
|
|
baseBarcodesIn.setInStatus("4"); |
|
|
|
|
baseBarcodesIn.setInDate(DateUtils.getDate()); |
|
|
|
|
barcodesIns.add(baseBarcodesIn); |
|
|
|
|
} |
|
|
|
|
iBaseBarcodesInService.saveOrUpdateBatch(barcodesIns); |
|
|
|
|
businDataTaskVo.setDpsNoOne(plcId); |
|
|
|
|
businDataTaskVo.setDpsNoTwo(stkPlcId); |
|
|
|
|
businDataTaskVo.setTaskStatus(TaskStatusEnum.wait_callback.getValue()); |
|
|
|
|
iBusinDataTaskService.updateById(BeanUtil.toBean(businDataTaskVo, BusinDataTask.class)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|