|
@ -117,6 +117,13 @@ public class GHSQHTask extends AbstractTask { |
|
|
// 申请任务
|
|
|
// 申请任务
|
|
|
SchBaseTask task = new SchBaseTask(); // 任务实体
|
|
|
SchBaseTask task = new SchBaseTask(); // 任务实体
|
|
|
String apply_point_code = schBasePoint.getPoint_code(); // 请求点
|
|
|
String apply_point_code = schBasePoint.getPoint_code(); // 请求点
|
|
|
|
|
|
// 获取对接位点位对象
|
|
|
|
|
|
SchBasePoint pointObj = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, apply_point_code)); |
|
|
|
|
|
//首位01或06生成任务需要补01,例如GHS0101下发需要改成GHS010101
|
|
|
|
|
|
if(apply_point_code.endsWith("01")||apply_point_code.endsWith("06")) { |
|
|
|
|
|
apply_point_code+="01"; |
|
|
|
|
|
} |
|
|
String config_code = "GHSQHTask"; |
|
|
String config_code = "GHSQHTask"; |
|
|
// 1、校验数据
|
|
|
// 1、校验数据
|
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
|
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>() |
|
@ -130,9 +137,6 @@ public class GHSQHTask extends AbstractTask { |
|
|
|
|
|
|
|
|
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn, |
|
|
Assert.isFalse(unFinishTasksByTaskConfig.size() >= tcmn, |
|
|
"该点位申请的任务未完成数已超过上限,无法申请任务"); |
|
|
"该点位申请的任务未完成数已超过上限,无法申请任务"); |
|
|
// 获取对接位点位对象
|
|
|
|
|
|
SchBasePoint pointObj = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
|
|
|
.eq(SchBasePoint::getPoint_code, apply_point_code)); |
|
|
|
|
|
// 校验是否需要自动agv
|
|
|
// 校验是否需要自动agv
|
|
|
if (!pointObj.getIs_auto()) { |
|
|
if (!pointObj.getIs_auto()) { |
|
|
// 如果不需要自动,则不创建任务
|
|
|
// 如果不需要自动,则不创建任务
|
|
@ -146,14 +150,12 @@ public class GHSQHTask extends AbstractTask { |
|
|
task.setTask_status(TaskStatus.APPLY.getCode()); |
|
|
task.setTask_status(TaskStatus.APPLY.getCode()); |
|
|
task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码
|
|
|
task.setWorkshop_code(taskConfig.getWorkshop_code()); // 车间编码
|
|
|
//首位01或06生成任务需要补01,例如GHS0101下发需要改成GHS010101
|
|
|
//首位01或06生成任务需要补01,例如GHS0101下发需要改成GHS010101
|
|
|
if(schBasePoint.getPoint_code().endsWith("01")||schBasePoint.getPoint_code().endsWith("06")) { |
|
|
task.setPoint_code1(apply_point_code); |
|
|
task.setPoint_code1(task.getPoint_code1()+"01"); |
|
|
|
|
|
} |
|
|
|
|
|
task.setPoint_code2(endPoint); |
|
|
task.setPoint_code2(endPoint); |
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
|
task.setRemark(""); |
|
|
task.setRemark(""); |
|
|
// 设置起/终点
|
|
|
// 设置起/终点
|
|
|
this.setTaskPoint(taskConfig, task, apply_point_code); |
|
|
// this.setTaskPoint(taskConfig, task, apply_point_code);
|
|
|
taskService.create(task); |
|
|
taskService.create(task); |
|
|
|
|
|
|
|
|
//下发
|
|
|
//下发
|
|
@ -319,13 +321,19 @@ public class GHSQHTask extends AbstractTask { |
|
|
@Override |
|
|
@Override |
|
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|
|
//todo 重算最优点
|
|
|
//todo 重算最优点
|
|
|
|
|
|
String schBasePoint=schBaseTask.getPoint_code1(); |
|
|
|
|
|
if(schBasePoint.endsWith("0101")||schBasePoint.endsWith("0601")){ |
|
|
|
|
|
schBasePoint=schBasePoint.substring(0,schBasePoint.length()-2); |
|
|
|
|
|
} |
|
|
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
SchBasePoint startPoint = pointService.getOne(new LambdaQueryWrapper<SchBasePoint>() |
|
|
.eq(SchBasePoint::getPoint_code, schBaseTask.getPoint_code1())); |
|
|
.eq(SchBasePoint::getPoint_code, schBasePoint)); |
|
|
SchBasePoint nextPoint = this.findNextPoint(startPoint); |
|
|
SchBasePoint nextPoint = this.findNextPoint(startPoint); |
|
|
if (ObjectUtil.isEmpty(nextPoint)) { |
|
|
if (ObjectUtil.isEmpty(nextPoint)) { |
|
|
throw new Exception("当前起点" + schBaseTask.getPoint_code1() + "未找到合适的放货点位"); |
|
|
throw new Exception("当前起点" + schBaseTask.getPoint_code1() + "未找到合适的放货点位"); |
|
|
} |
|
|
} |
|
|
//上位记的是整一个缓存区三个点
|
|
|
//上位记的是整一个缓存区三个点
|
|
|
schBaseTask.setPoint_code2(nextPoint.getPoint_code()); |
|
|
schBaseTask.setPoint_code2(nextPoint.getPoint_code()); |
|
|
|
|
|
nextPoint.setIng_task_code(schBaseTask.getTask_code()); |
|
|
|
|
|
pointService.update(nextPoint); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|